Revision: 200949
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 17 Dec 2009 08:45:05 +0200
changeset 0 ff3acec5bc43
child 1 8118492f1bdf
Revision: 200949 Kit: 200951
group/bld.inf
inc/musicplayerbldvariant.hrh
layers.sysdef.xml
mpxmusicplayer/Conf/mpxmusicplayer.confml
mpxmusicplayer/Conf/mpxmusicplayer_101F880D.crml
mpxmusicplayer/Conf/mpxmusicplayer_101FFCD0.crml
mpxmusicplayer/Conf/mpxmusicplayer_101FFCD1.crml
mpxmusicplayer/Conf/mpxmusicplayer_101FFCDC.crml
mpxmusicplayer/activeidle/aiplayerplugin/data/aiplayerplugin.rss
mpxmusicplayer/activeidle/aiplayerplugin/data/aiplayerpluginresource.rss
mpxmusicplayer/activeidle/aiplayerplugin/group/aiplayerplugin.mmp
mpxmusicplayer/activeidle/aiplayerplugin/group/bld.inf
mpxmusicplayer/activeidle/aiplayerplugin/inc/aiplayerplugin.h
mpxmusicplayer/activeidle/aiplayerplugin/inc/aiplayerplugincontentmodel.h
mpxmusicplayer/activeidle/aiplayerplugin/inc/aiplayerpluginengine.h
mpxmusicplayer/activeidle/aiplayerplugin/inc/aiplayerpluginengineobserver.h
mpxmusicplayer/activeidle/aiplayerplugin/inc/aiplayerpluginuids.hrh
mpxmusicplayer/activeidle/aiplayerplugin/loc/aiplayerplugin.loc
mpxmusicplayer/activeidle/aiplayerplugin/src/aiplayerplugin.cpp
mpxmusicplayer/activeidle/aiplayerplugin/src/aiplayerpluginengine.cpp
mpxmusicplayer/activeidle/group/bld.inf
mpxmusicplayer/activeidle/rom/mpxactiveidleplugin.iby
mpxmusicplayer/activeidle/rom/mpxactiveidlepluginrsc.iby
mpxmusicplayer/app/data/mpx.rss
mpxmusicplayer/app/data/mpx_reg.rss
mpxmusicplayer/app/group/bld.inf
mpxmusicplayer/app/group/mpx.mmp
mpxmusicplayer/app/group/mpxappuiiconsbitmaps.mk
mpxmusicplayer/app/group/mpxappuiiconsscalable.mk
mpxmusicplayer/app/inc/mpxPDcommandhandler.h
mpxmusicplayer/app/inc/mpxapp.h
mpxmusicplayer/app/inc/mpxappui.h
mpxmusicplayer/app/inc/mpxcommandhandler.h
mpxmusicplayer/app/inc/mpxcontroller.h
mpxmusicplayer/app/inc/mpxdocument.h
mpxmusicplayer/app/inc/mpxrestorepath.h
mpxmusicplayer/app/loc/mpx.loc
mpxmusicplayer/app/rom/mpxmusicplayerapp.iby
mpxmusicplayer/app/rom/mpxmusicplayerapprsc.iby
mpxmusicplayer/app/src/mpxPDcommandhandler.cpp
mpxmusicplayer/app/src/mpxapp.cpp
mpxmusicplayer/app/src/mpxappui.cpp
mpxmusicplayer/app/src/mpxcommandhandler.cpp
mpxmusicplayer/app/src/mpxcontroller.cpp
mpxmusicplayer/app/src/mpxdocument.cpp
mpxmusicplayer/app/src/mpxrestorepath.cpp
mpxmusicplayer/cenrep/101f880d.txt
mpxmusicplayer/cenrep/101ffcd0.txt
mpxmusicplayer/cenrep/101ffcd1.txt
mpxmusicplayer/cenrep/101ffcdc.txt
mpxmusicplayer/cenrep/keys_mpxmusicplayer.xls
mpxmusicplayer/commonui/bwinscw/mpxcommonuiU.DEF
mpxmusicplayer/commonui/data/mpxcommonui.rss
mpxmusicplayer/commonui/eabi/mpxcommonuiU.DEF
mpxmusicplayer/commonui/group/bld.inf
mpxmusicplayer/commonui/group/iconlist.txt
mpxmusicplayer/commonui/group/mpxcommonui.mmp
mpxmusicplayer/commonui/group/mpxcommonuiicons.mk
mpxmusicplayer/commonui/inc/mpxcommonui.hrh
mpxmusicplayer/commonui/inc/mpxdrmuihelper.h
mpxmusicplayer/commonui/inc/mpxfilenamequerydlg.h
mpxmusicplayer/commonui/inc/mpximageutil.h
mpxmusicplayer/commonui/loc/mpxcommonui.loc
mpxmusicplayer/commonui/rom/mpxcommonui.iby
mpxmusicplayer/commonui/rom/mpxcommonuirsc.iby
mpxmusicplayer/commonui/src/mpxalbumartutil.cpp
mpxmusicplayer/commonui/src/mpxcommonuihelper.cpp
mpxmusicplayer/commonui/src/mpxdrmuihelper.cpp
mpxmusicplayer/commonui/src/mpxfilenamequerydlg.cpp
mpxmusicplayer/commonui/src/mpximageutil.cpp
mpxmusicplayer/commonui/src/mpxlbxextendedfeatures.cpp
mpxmusicplayer/commonui/src/mpxsavehelper.cpp
mpxmusicplayer/commonui/src/mpxtlshelper.cpp
mpxmusicplayer/group/backup_registration.xml
mpxmusicplayer/group/bld.inf
mpxmusicplayer/group/mpxmusicplayerstub.sis
mpxmusicplayer/group/mpxmusicplayerstubsis.mk
mpxmusicplayer/help/data/xhtml.zip
mpxmusicplayer/help/group/bld.inf
mpxmusicplayer/help/inc/mus.hlp.hrh
mpxmusicplayer/help/rom/mpxmusicplayerhelps_variant.iby
mpxmusicplayer/inc/mpxmetadatahandler.h
mpxmusicplayer/inc/mpxsavehelper.h
mpxmusicplayer/mediakeyhandler/bwinscw/mpxmediakeyhandlerU.DEF
mpxmusicplayer/mediakeyhandler/data/mpxmediakeyhandler.rss
mpxmusicplayer/mediakeyhandler/eabi/mpxmediakeyhandlerU.DEF
mpxmusicplayer/mediakeyhandler/group/bld.inf
mpxmusicplayer/mediakeyhandler/group/iconlist.txt
mpxmusicplayer/mediakeyhandler/group/mpxmediakeyhandler.mmp
mpxmusicplayer/mediakeyhandler/group/mpxmediakeyhandlericons.mk
mpxmusicplayer/mediakeyhandler/inc/mpxmediakeyhandlerimp.h
mpxmusicplayer/mediakeyhandler/inc/mpxnotifierdialog.h
mpxmusicplayer/mediakeyhandler/inc/mpxremconkeyresponse.h
mpxmusicplayer/mediakeyhandler/loc/mpxmediakeyhandler.loc
mpxmusicplayer/mediakeyhandler/rom/mpxmediakeyhandler.iby
mpxmusicplayer/mediakeyhandler/rom/mpxmediakeyhandlerrsc.iby
mpxmusicplayer/mediakeyhandler/src/mpxmediakeyhandler.cpp
mpxmusicplayer/mediakeyhandler/src/mpxmediakeyhandlerimp.cpp
mpxmusicplayer/mediakeyhandler/src/mpxnotifierdialog.cpp
mpxmusicplayer/mediakeyhandler/src/mpxremconkeyresponse.cpp
mpxmusicplayer/metadatahandler/bwinscw/mpxmetadatahandleru.def
mpxmusicplayer/metadatahandler/data/mplayeravrcpsettings.rss
mpxmusicplayer/metadatahandler/data/settings.rh
mpxmusicplayer/metadatahandler/eabi/mpxmetadatahandleru.def
mpxmusicplayer/metadatahandler/group/bld.inf
mpxmusicplayer/metadatahandler/group/mpxmetadatahandler.mmp
mpxmusicplayer/metadatahandler/inc/mpxmetadatahandlerimp.h
mpxmusicplayer/metadatahandler/loc/mpxmetadatahandler.loc
mpxmusicplayer/metadatahandler/rom/mpxmetadatahandler.iby
mpxmusicplayer/metadatahandler/src/mpxmetadatahandler.cpp
mpxmusicplayer/metadatahandler/src/mpxmetadatahandlerimp.cpp
mpxmusicplayer/rom/mpxmusicplayer.iby
mpxmusicplayer/rom/mpxmusicplayerrsc.iby
mpxmusicplayer/sis/101ffcd0.cre
mpxmusicplayer/sis/101ffcd1.cre
mpxmusicplayer/sis/101ffcdc.cre
mpxmusicplayer/sis/build-sisx.bat
mpxmusicplayer/sis/hgmpxcollectionview.pkg
mpxmusicplayer/sis/mpxmusicplayer.pkg
mpxmusicplayer/sis/mpxmusicplayer.sis
mpxmusicplayer/sis/mpxmusicplayer.xml
mpxmusicplayer/sis/mpxmusicplayer_cenrep.xml
mpxmusicplayer/sis/mpxmusicplayercenrep.pkg
mpxmusicplayer/sis/mpxmusicplayerstub.pkg
mpxmusicplayer/sis/mpxmusicplayerstub.sis
mpxplugins/group/bld.inf
mpxplugins/group/mpxplugins_stub.sis
mpxplugins/inc/mpxaudioeffectengine.h
mpxplugins/inc/mpxaudioeffectproperties.h
mpxplugins/inc/mpxaudioeffectproperties.inl
mpxplugins/serviceplugins/collectionplugins/group/bld.inf
mpxplugins/serviceplugins/collectionplugins/inc/mpxdbactivetask.h
mpxplugins/serviceplugins/collectionplugins/inc/mpxdbcommondef.h
mpxplugins/serviceplugins/collectionplugins/inc/mpxdbcommonstd.h
mpxplugins/serviceplugins/collectionplugins/inc/mpxdbcommonutil.h
mpxplugins/serviceplugins/collectionplugins/inc/mpxdbmanager.h
mpxplugins/serviceplugins/collectionplugins/inc/mpxdbtable.h
mpxplugins/serviceplugins/collectionplugins/inc/mpxpluginresource.hrh
mpxplugins/serviceplugins/collectionplugins/inc/mpxresource.h
mpxplugins/serviceplugins/collectionplugins/inc/mpxtable.h
mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/data/101FFCD9.RSS
mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/group/bld.inf
mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/group/mpxinmemoryplugin.mmp
mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/inc/mpxinmemoryplugin.h
mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/inc/mpxmusicmemoryplugin.h
mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/src/mpxinmemoryplugin.cpp
mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/src/mpxinmemorypluginproxy.cpp
mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/src/mpxmusicmemoryplugin.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/bwinscw/mpxsqlitedbcommonu.def
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/eabi/mpxsqlitedbcommonu.def
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/group/bld.inf
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/group/mpxsqlitedbcommon.mmp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbactivetask.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbcommonutil.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbtable.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxresource.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/data/10207C85.RSS
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/data/mpxcollectiondbhgres.rss
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/group/bld.inf
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/group/iconlist.txt
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/group/mpxdbpluginiconshg.mk
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/group/mpxsqlitedbhgplugin.mmp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondb.hrh
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbdef.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbmanager.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbstd.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbalbum.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbartist.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbautoplaylist.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbauxiliary.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbcategory.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbcomposer.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbgenre.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbhandler.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbmusic.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbplaylist.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbplaylistsongs.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbplugin.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbpluginqueries.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbutil.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/loc/mpxcollectiondbhg.loc
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxcollectiondbmanager.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbalbum.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbartist.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbautoplaylist.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbauxiliary.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbcategory.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbcomposer.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbgenre.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbhandler.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbmusic.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplaylist.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplaylistsongs.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbpluginproxy.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbutil.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/data/101FFC3E.RSS
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/data/mpxcollectiondbres.rss
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/group/bld.inf
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/group/iconlist.txt
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/group/mpxdbpluginicons.mk
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/group/mpxsqlitedbplugin.mmp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxcollectiondb.hrh
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxcollectiondbdef.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxcollectiondbmanager.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxcollectiondbstd.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbalbum.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbartist.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbautoplaylist.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbauxiliary.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbcategory.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbcomposer.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbgenre.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbhandler.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbmusic.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbplaylist.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbplaylistsongs.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbplugin.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbpluginqueries.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbutil.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/loc/mpxcollectiondb.loc
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxcollectiondbmanager.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbalbum.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbartist.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbautoplaylist.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbauxiliary.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbcategory.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbcomposer.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbgenre.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbhandler.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbmusic.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbplaylist.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbplaylistsongs.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbplugin.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbpluginproxy.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbutil.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/data/101FE032.SPD
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/data/101FE032.txt
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/data/101FFC3F.RSS
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/data/PCRes.rss
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/group/bld.inf
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/group/iconlist.txt
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/group/mpxpodcastdbpluginicons.mk
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/group/mpxsqlitepodcastdbplugin.mmp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxdbauxiliary.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxdbcategory.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxdbpodcast.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxdbutil.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastcollectiondb.hrh
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastcollectiondbdef.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastcollectiondbstd.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastdbhandler.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastdbmanager.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastdbplugin.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastdbpluginqueries.h
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/loc/mpxpodcastcollectiondb.loc
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxdbauxiliary.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxdbcategory.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxdbpodcast.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxdbutil.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbhandler.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbmanager.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp
mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbpluginproxy.cpp
mpxplugins/serviceplugins/collectionplugins/rom/mpxinmemplugin.iby
mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitedbcommon.iby
mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitedbhgplugin.iby
mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitedbhgpluginrsc.iby
mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitedbplugin.iby
mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitedbpluginrsc.iby
mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitepodcastdbplugin.iby
mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitepodcastdbpluginrsc.iby
mpxplugins/serviceplugins/group/bld.inf
mpxplugins/serviceplugins/playbackplugins/audioeffects/bwinscw/mpxaudioeffectengineU.DEF
mpxplugins/serviceplugins/playbackplugins/audioeffects/eabi/mpxaudioeffectengineU.DEF
mpxplugins/serviceplugins/playbackplugins/audioeffects/group/bld.inf
mpxplugins/serviceplugins/playbackplugins/audioeffects/group/mpxaudioeffectengine.mmp
mpxplugins/serviceplugins/playbackplugins/audioeffects/src/mpxaudioeffectengine.cpp
mpxplugins/serviceplugins/playbackplugins/group/bld.inf
mpxplugins/serviceplugins/playbackplugins/localaudio/data/101ffc04.rss
mpxplugins/serviceplugins/playbackplugins/localaudio/group/bld.inf
mpxplugins/serviceplugins/playbackplugins/localaudio/group/mpxlocalaudioplayback.mmp
mpxplugins/serviceplugins/playbackplugins/localaudio/inc/mpxlocalaudioplayback.h
mpxplugins/serviceplugins/playbackplugins/localaudio/src/mpxlocalaudioplayback.cpp
mpxplugins/serviceplugins/playbackplugins/localaudio/src/mpxlocalaudioplaybackproxy.cpp
mpxplugins/serviceplugins/playbackplugins/progressdownload/data/101ffc08.rss
mpxplugins/serviceplugins/playbackplugins/progressdownload/group/bld.inf
mpxplugins/serviceplugins/playbackplugins/progressdownload/group/mpxprogressdownload.mmp
mpxplugins/serviceplugins/playbackplugins/progressdownload/inc/mpxprogressdownload.h
mpxplugins/serviceplugins/playbackplugins/progressdownload/src/mpxprogressdownload.cpp
mpxplugins/serviceplugins/playbackplugins/progressdownload/src/mpxprogressdownloadproxy.cpp
mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/data/10207bcc.rss
mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/group/bld.inf
mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/group/mpxprogressdownloadSB.mmp
mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/inc/mpxprogressdownloadsb.h
mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/src/mpxprogressdownloadsb.cpp
mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/src/mpxprogressdownloadsbproxy.cpp
mpxplugins/serviceplugins/playbackplugins/rom/mpxaudioeffects.iby
mpxplugins/serviceplugins/playbackplugins/rom/mpxlocalaudioplugin.iby
mpxplugins/serviceplugins/playbackplugins/rom/mpxprogressdownloadplugin.iby
mpxplugins/serviceplugins/playbackplugins/rom/mpxprogressdownloadsbplugin.iby
mpxplugins/serviceplugins/playlistplugins/group/bld.inf
mpxplugins/serviceplugins/playlistplugins/inc/mpxm3uplaylistexporter.h
mpxplugins/serviceplugins/playlistplugins/inc/mpxm3uplaylistimporter.h
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/BWINS/mpxm3uplaylistparsersU.DEF
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/data/101FFC22.RSS
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/eabi/mpxm3uplaylistparsersU.DEF
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/group/bld.inf
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/group/mpxm3uplaylistparsers.mmp
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/group/mpxm3uplaylistplugin.mmp
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/inc/mpxm3uplaylistdefs.h
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/inc/mpxm3uplaylistdefs.hrh
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/inc/mpxm3uplaylistplugin.h
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/src/mpxm3uplaylistexporter.cpp
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/src/mpxm3uplaylistimporter.cpp
mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/src/mpxm3uplaylistplugin.cpp
mpxplugins/serviceplugins/playlistplugins/rom/mpxm3uplaylistplugin.iby
mpxplugins/serviceplugins/screensaverplugins/group/bld.inf
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/data/101ffc13.rss
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/data/mpxscreensaverplugin.rss
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/group/bld.inf
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/group/iconlist.txt
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/group/mpxscreensaverplugin.mmp
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/group/mpxscreensaverpluginicons.mk
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/inc/mpxscreensaverplugin.h
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/inc/mpxscreensaverplugin.hrh
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/inc/mpxscreensaverplugin.rh
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/inc/mpxscreensaverplugincontainer.h
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/inc/mpxscreensaverpluginimplementationuid.hrh
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/loc/mpxscreensaverplugin.loc
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/src/mpxscreensaverplugin.cpp
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/src/mpxscreensaverplugincontainer.cpp
mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/src/mpxscreensaverpluginproxy.cpp
mpxplugins/serviceplugins/screensaverplugins/rom/mpxscreensaverplugin.iby
mpxplugins/serviceplugins/screensaverplugins/rom/mpxscreensaverpluginrsc.iby
mpxplugins/viewplugins/group/bld.inf
mpxplugins/viewplugins/icons/qgn_graf_mup_npv_defalbumart.svg
mpxplugins/viewplugins/icons/qgn_graf_mup_podcast_art.svg
mpxplugins/viewplugins/inc/mpxaddtracksdialog.h
mpxplugins/viewplugins/inc/mpxalbumarteditordialog.h
mpxplugins/viewplugins/inc/mpxalbumarteventobserver.h
mpxplugins/viewplugins/inc/mpxaudioeffectsview.h
mpxplugins/viewplugins/inc/mpxcollectionview.h
mpxplugins/viewplugins/inc/mpxcollectionviewhg.h
mpxplugins/viewplugins/inc/mpxcommonplaybackviewimp.h
mpxplugins/viewplugins/inc/mpxembeddedplaybackview.h
mpxplugins/viewplugins/inc/mpxequalizerview.h
mpxplugins/viewplugins/inc/mpxlayoutswitchobserver.h
mpxplugins/viewplugins/inc/mpxmainview.h
mpxplugins/viewplugins/inc/mpxmetadataeditordialog.h
mpxplugins/viewplugins/inc/mpxpdplaybackview.h
mpxplugins/viewplugins/inc/mpxpdsbplaybackview.h
mpxplugins/viewplugins/inc/mpxplaybackview.h
mpxplugins/viewplugins/inc/mpxpodcastcollectionview.h
mpxplugins/viewplugins/inc/mpxpodcastplaybackview.h
mpxplugins/viewplugins/inc/mpxupnpbrowsedialog.h
mpxplugins/viewplugins/inc/mpxupnpplaybackdialog.h
mpxplugins/viewplugins/inc/mpxupnpplaybackview.h
mpxplugins/viewplugins/inc/mpxviewprivatepskeys.h
mpxplugins/viewplugins/inc/mpxwaitnoteconstructor.h
mpxplugins/viewplugins/inc/mpxwaitnotedefs.h
mpxplugins/viewplugins/inc/mpxwaitnotedialog.h
mpxplugins/viewplugins/inc/mpxwaitnoteobserver.h
mpxplugins/viewplugins/plugins/addtracksdialogplugin/data/101ffc8d.rss
mpxplugins/viewplugins/plugins/addtracksdialogplugin/group/bld.inf
mpxplugins/viewplugins/plugins/addtracksdialogplugin/group/mpxaddtracksdialogplugin.mmp
mpxplugins/viewplugins/plugins/addtracksdialogplugin/inc/mpxaddtracksdialogplugin.h
mpxplugins/viewplugins/plugins/addtracksdialogplugin/inc/mpxaddtracksdialogplugin.hrh
mpxplugins/viewplugins/plugins/addtracksdialogplugin/src/mpxaddtracksdialogplugin.cpp
mpxplugins/viewplugins/plugins/addtracksdialogplugin/src/mpxaddtracksdialogpluginproxy.cpp
mpxplugins/viewplugins/plugins/albumarteditordialogplugin/data/101ffc87.rss
mpxplugins/viewplugins/plugins/albumarteditordialogplugin/group/bld.inf
mpxplugins/viewplugins/plugins/albumarteditordialogplugin/group/mpxalbumarteditordialogplugin.mmp
mpxplugins/viewplugins/plugins/albumarteditordialogplugin/inc/mpxalbumarteditordialogplugin.h
mpxplugins/viewplugins/plugins/albumarteditordialogplugin/inc/mpxalbumarteditordialogplugin.hrh
mpxplugins/viewplugins/plugins/albumarteditordialogplugin/src/mpxalbumarteditordialogplugin.cpp
mpxplugins/viewplugins/plugins/albumarteditordialogplugin/src/mpxalbumarteditordialogpluginproxy.cpp
mpxplugins/viewplugins/plugins/audioeffectsviewplugin/data/101ffc75.rss
mpxplugins/viewplugins/plugins/audioeffectsviewplugin/group/bld.inf
mpxplugins/viewplugins/plugins/audioeffectsviewplugin/group/mpxaudioeffectsviewplugin.mmp
mpxplugins/viewplugins/plugins/audioeffectsviewplugin/inc/mpxaudioeffectsviewplugin.h
mpxplugins/viewplugins/plugins/audioeffectsviewplugin/inc/mpxaudioeffectsviewplugin.hrh
mpxplugins/viewplugins/plugins/audioeffectsviewplugin/src/mpxaudioeffectsviewplugin.cpp
mpxplugins/viewplugins/plugins/audioeffectsviewplugin/src/mpxaudioeffectsviewpluginproxy.cpp
mpxplugins/viewplugins/plugins/collectionviewhgplugin/data/10207C82.rss
mpxplugins/viewplugins/plugins/collectionviewhgplugin/group/bld.inf
mpxplugins/viewplugins/plugins/collectionviewhgplugin/group/mpxcollectionviewhgplugin.mmp
mpxplugins/viewplugins/plugins/collectionviewhgplugin/inc/mpxcollectionviewhgplugin.h
mpxplugins/viewplugins/plugins/collectionviewhgplugin/inc/mpxcollectionviewhgplugin.hrh
mpxplugins/viewplugins/plugins/collectionviewhgplugin/src/mpxcollectionviewhgplugin.cpp
mpxplugins/viewplugins/plugins/collectionviewhgplugin/src/mpxcollectionviewhgpluginproxy.cpp
mpxplugins/viewplugins/plugins/collectionviewplugin/data/101ffc80.rss
mpxplugins/viewplugins/plugins/collectionviewplugin/group/bld.inf
mpxplugins/viewplugins/plugins/collectionviewplugin/group/mpxcollectionviewplugin.mmp
mpxplugins/viewplugins/plugins/collectionviewplugin/inc/mpxcollectionviewplugin.h
mpxplugins/viewplugins/plugins/collectionviewplugin/inc/mpxcollectionviewplugin.hrh
mpxplugins/viewplugins/plugins/collectionviewplugin/src/mpxcollectionviewplugin.cpp
mpxplugins/viewplugins/plugins/collectionviewplugin/src/mpxcollectionviewpluginproxy.cpp
mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/data/101ffc7B.rss
mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/group/bld.inf
mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/group/mpxembeddedplaybackviewplugin.mmp
mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/inc/mpxembeddedplaybackviewplugin.h
mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/inc/mpxembeddedplaybackviewplugin.hrh
mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/src/mpxembeddedplaybackviewplugin.cpp
mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/src/mpxembeddedplaybackviewpluginproxy.cpp
mpxplugins/viewplugins/plugins/equalizerviewplugin/data/101ffc78.rss
mpxplugins/viewplugins/plugins/equalizerviewplugin/group/bld.inf
mpxplugins/viewplugins/plugins/equalizerviewplugin/group/mpxequalizerviewplugin.mmp
mpxplugins/viewplugins/plugins/equalizerviewplugin/inc/mpxequalizerviewplugin.h
mpxplugins/viewplugins/plugins/equalizerviewplugin/inc/mpxequalizerviewplugin.hrh
mpxplugins/viewplugins/plugins/equalizerviewplugin/src/mpxequalizerviewplugin.cpp
mpxplugins/viewplugins/plugins/equalizerviewplugin/src/mpxequalizerviewpluginproxy.cpp
mpxplugins/viewplugins/plugins/group/bld.inf
mpxplugins/viewplugins/plugins/mainviewplugin/data/101ffc7d.rss
mpxplugins/viewplugins/plugins/mainviewplugin/group/bld.inf
mpxplugins/viewplugins/plugins/mainviewplugin/group/mpxmainviewplugin.mmp
mpxplugins/viewplugins/plugins/mainviewplugin/inc/mpxmainviewplugin.h
mpxplugins/viewplugins/plugins/mainviewplugin/inc/mpxmainviewplugin.hrh
mpxplugins/viewplugins/plugins/mainviewplugin/src/mpxmainviewplugin.cpp
mpxplugins/viewplugins/plugins/mainviewplugin/src/mpxmainviewpluginproxy.cpp
mpxplugins/viewplugins/plugins/metadataeditordialogplugin/data/101ffc84.rss
mpxplugins/viewplugins/plugins/metadataeditordialogplugin/group/bld.inf
mpxplugins/viewplugins/plugins/metadataeditordialogplugin/group/mpxmetadataeditordialogplugin.mmp
mpxplugins/viewplugins/plugins/metadataeditordialogplugin/inc/mpxmetadataeditordialogplugin.h
mpxplugins/viewplugins/plugins/metadataeditordialogplugin/inc/mpxmetadataeditordialogplugin.hrh
mpxplugins/viewplugins/plugins/metadataeditordialogplugin/src/mpxmetadataeditordialogplugin.cpp
mpxplugins/viewplugins/plugins/metadataeditordialogplugin/src/mpxmetadataeditordialogpluginproxy.cpp
mpxplugins/viewplugins/plugins/pdplaybackviewplugin/data/101ffc9f.rss
mpxplugins/viewplugins/plugins/pdplaybackviewplugin/group/bld.inf
mpxplugins/viewplugins/plugins/pdplaybackviewplugin/group/mpxpdplaybackviewplugin.mmp
mpxplugins/viewplugins/plugins/pdplaybackviewplugin/inc/mpxpdplaybackviewplugin.h
mpxplugins/viewplugins/plugins/pdplaybackviewplugin/inc/mpxpdplaybackviewplugin.hrh
mpxplugins/viewplugins/plugins/pdplaybackviewplugin/src/mpxpdplaybackviewplugin.cpp
mpxplugins/viewplugins/plugins/pdplaybackviewplugin/src/mpxpdplaybackviewpluginproxy.cpp
mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/data/10207bce.rss
mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/group/bld.inf
mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/group/mpxpdsbplaybackviewplugin.mmp
mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/inc/mpxpdsbplaybackviewplugin.h
mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/inc/mpxpdsbplaybackviewplugin.hrh
mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/src/mpxpdsbplaybackviewplugin.cpp
mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/src/mpxpdsbplaybackviewpluginproxy.cpp
mpxplugins/viewplugins/plugins/playbackviewplugin/data/101ffc72.rss
mpxplugins/viewplugins/plugins/playbackviewplugin/group/bld.inf
mpxplugins/viewplugins/plugins/playbackviewplugin/group/mpxplaybackviewplugin.mmp
mpxplugins/viewplugins/plugins/playbackviewplugin/inc/mpxplaybackviewplugin.h
mpxplugins/viewplugins/plugins/playbackviewplugin/inc/mpxplaybackviewplugin.hrh
mpxplugins/viewplugins/plugins/playbackviewplugin/src/mpxplaybackviewplugin.cpp
mpxplugins/viewplugins/plugins/playbackviewplugin/src/mpxplaybackviewpluginproxy.cpp
mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/data/101ffcb9.rss
mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/group/bld.inf
mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/group/mpxpodcastplaybackviewplugin.mmp
mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/inc/mpxpodcastplaybackviewplugin.h
mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/inc/mpxpodcastplaybackviewplugin.hrh
mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/src/mpxpodcastplaybackviewplugin.cpp
mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/src/mpxpodcastplaybackviewpluginproxy.cpp
mpxplugins/viewplugins/plugins/podcastviewplugin/data/101ffc9b.rss
mpxplugins/viewplugins/plugins/podcastviewplugin/group/bld.inf
mpxplugins/viewplugins/plugins/podcastviewplugin/group/mpxpodcastcollectionviewplugin.mmp
mpxplugins/viewplugins/plugins/podcastviewplugin/inc/mpxpodcastcollectionviewplugin.h
mpxplugins/viewplugins/plugins/podcastviewplugin/inc/mpxpodcastcollectionviewplugin.hrh
mpxplugins/viewplugins/plugins/podcastviewplugin/src/mpxpodcastcollectionviewplugin.cpp
mpxplugins/viewplugins/plugins/podcastviewplugin/src/mpxpodcastcollectionviewpluginproxy.cpp
mpxplugins/viewplugins/plugins/rom/mpxaddtracksdialogplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxalbumarteditordialogplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxaudioeffectsviewplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxcollectionviewhgplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxcollectionviewplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxembeddedplaybackviewplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxequalizerviewplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxmainviewplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxmetadataeditordialogplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxpdplaybackviewplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxpdsbplaybackviewplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxplaybackviewplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxpodcastplaybackviewplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxpodcastviewplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxupnpbrowsedialogplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxupnpplaybackdialogplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxupnpplaybackviewplugin.iby
mpxplugins/viewplugins/plugins/rom/mpxwaitnotedialogplugin.iby
mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/data/101FFC95.rss
mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/group/bld.inf
mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/group/mpxupnpbrowsedialogplugin.mmp
mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/inc/mpxupnpbrowsedialogplugin.h
mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/inc/mpxupnpbrowsedialogplugin.hrh
mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/src/mpxupnpbrowsedialogplugin.cpp
mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/src/mpxupnpbrowsedialogpluginproxy.cpp
mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/data/101ffcbc.rss
mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/group/bld.inf
mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/group/mpxupnpplaybackdialogplugin.mmp
mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/inc/mpxupnpplaybackdialogplugin.h
mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/inc/mpxupnpplaybackdialogplugin.hrh
mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/src/mpxupnpplaybackdialogplugin.cpp
mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/src/mpxupnpplaybackdialogpluginproxy.cpp
mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/data/101ffc98.rss
mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/group/bld.inf
mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/group/mpxupnpplaybackviewplugin.mmp
mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/inc/mpxupnpplaybackviewplugin.h
mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/inc/mpxupnpplaybackviewplugin.hrh
mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/src/mpxupnpplaybackviewplugin.cpp
mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/src/mpxupnpplaybackviewpluginproxy.cpp
mpxplugins/viewplugins/plugins/waitnotedialogplugin/data/101FFC6D.rss
mpxplugins/viewplugins/plugins/waitnotedialogplugin/group/bld.inf
mpxplugins/viewplugins/plugins/waitnotedialogplugin/group/mpxwaitnoteplugin.mmp
mpxplugins/viewplugins/plugins/waitnotedialogplugin/inc/mpxwaitnoteplugin.h
mpxplugins/viewplugins/plugins/waitnotedialogplugin/inc/mpxwaitnoteplugin.hrh
mpxplugins/viewplugins/plugins/waitnotedialogplugin/src/mpxwaitnoteplugin.cpp
mpxplugins/viewplugins/plugins/waitnotedialogplugin/src/mpxwaitnotepluginproxy.cpp
mpxplugins/viewplugins/views/addtracksdialog/bwinscw/mpxaddtracksdialogU.DEF
mpxplugins/viewplugins/views/addtracksdialog/data/mpxaddtracksdialog.rss
mpxplugins/viewplugins/views/addtracksdialog/eabi/mpxaddtracksdialogU.DEF
mpxplugins/viewplugins/views/addtracksdialog/group/bld.inf
mpxplugins/viewplugins/views/addtracksdialog/group/iconlist.txt
mpxplugins/viewplugins/views/addtracksdialog/group/mpxaddtracksdialog.mmp
mpxplugins/viewplugins/views/addtracksdialog/group/mpxaddtracksdialogicons.mk
mpxplugins/viewplugins/views/addtracksdialog/inc/mpxaddtracksdialog.hlp.hrh
mpxplugins/viewplugins/views/addtracksdialog/inc/mpxaddtracksdialog.hrh
mpxplugins/viewplugins/views/addtracksdialog/inc/mpxaddtracksdialogcommon.h
mpxplugins/viewplugins/views/addtracksdialog/inc/mpxaddtrackslbxarray.h
mpxplugins/viewplugins/views/addtracksdialog/inc/mpxaddtrackslistmodel.h
mpxplugins/viewplugins/views/addtracksdialog/loc/mpxaddtracksdialog.loc
mpxplugins/viewplugins/views/addtracksdialog/src/mpxaddtracksdialog.cpp
mpxplugins/viewplugins/views/addtracksdialog/src/mpxaddtrackslbxarray.cpp
mpxplugins/viewplugins/views/addtracksdialog/src/mpxaddtrackslistmodel.cpp
mpxplugins/viewplugins/views/albumarteditordialog/bwinscw/mpxalbumarteditordialogU.DEF
mpxplugins/viewplugins/views/albumarteditordialog/data/mpxalbumarteditordialog.rss
mpxplugins/viewplugins/views/albumarteditordialog/eabi/mpxalbumarteditordialogU.DEF
mpxplugins/viewplugins/views/albumarteditordialog/group/bld.inf
mpxplugins/viewplugins/views/albumarteditordialog/group/mpxalbumarteditordialog.mmp
mpxplugins/viewplugins/views/albumarteditordialog/inc/mpxalbumarteditorcustomcontrolcontainer.h
mpxplugins/viewplugins/views/albumarteditordialog/inc/mpxalbumarteditordialog.hlp.hrh
mpxplugins/viewplugins/views/albumarteditordialog/inc/mpxalbumarteditordialog.hrh
mpxplugins/viewplugins/views/albumarteditordialog/inc/mpxalbumarteditordialogcustomcontrol.h
mpxplugins/viewplugins/views/albumarteditordialog/inc/mpxalbumarteditordialogimagethumbnailutil.h
mpxplugins/viewplugins/views/albumarteditordialog/loc/mpxalbumarteditordialog.loc
mpxplugins/viewplugins/views/albumarteditordialog/src/mpxalbumarteditorcustomcontrolcontainer.cpp
mpxplugins/viewplugins/views/albumarteditordialog/src/mpxalbumarteditordialog.cpp
mpxplugins/viewplugins/views/albumarteditordialog/src/mpxalbumarteditordialogcustomcontrol.cpp
mpxplugins/viewplugins/views/albumarteditordialog/src/mpxalbumarteditordialogimagethumbnailutil.cpp
mpxplugins/viewplugins/views/audioeffectsview/bwinscw/mpxaudioeffectsviewU.DEF
mpxplugins/viewplugins/views/audioeffectsview/data/mpxaudioeffectsview.rss
mpxplugins/viewplugins/views/audioeffectsview/data/reverb.txt
mpxplugins/viewplugins/views/audioeffectsview/eabi/mpxaudioeffectsviewU.DEF
mpxplugins/viewplugins/views/audioeffectsview/group/bld.inf
mpxplugins/viewplugins/views/audioeffectsview/group/mpxaudioeffectsview.mmp
mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffects.hrh
mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffectsitems.h
mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffectsmodel.h
mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffectsview.hlp.hrh
mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffectsviewcontainer.h
mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffectsviewimp.h
mpxplugins/viewplugins/views/audioeffectsview/loc/mpxaudioeffects.loc
mpxplugins/viewplugins/views/audioeffectsview/src/mpxaudioeffectsitems.cpp
mpxplugins/viewplugins/views/audioeffectsview/src/mpxaudioeffectsmodel.cpp
mpxplugins/viewplugins/views/audioeffectsview/src/mpxaudioeffectsview.cpp
mpxplugins/viewplugins/views/audioeffectsview/src/mpxaudioeffectsviewcontainer.cpp
mpxplugins/viewplugins/views/audioeffectsview/src/mpxaudioeffectsviewimp.cpp
mpxplugins/viewplugins/views/collectionview/bwinscw/mpxcollectionviewU.DEF
mpxplugins/viewplugins/views/collectionview/data/mpxcollectionview.rss
mpxplugins/viewplugins/views/collectionview/eabi/mpxcollectionviewU.DEF
mpxplugins/viewplugins/views/collectionview/group/bld.inf
mpxplugins/viewplugins/views/collectionview/group/iconlist.txt
mpxplugins/viewplugins/views/collectionview/group/mpxcollectionview.mmp
mpxplugins/viewplugins/views/collectionview/group/mpxcollectionviewicons.mk
mpxplugins/viewplugins/views/collectionview/inc/mpxcollectionview.hlp.hrh
mpxplugins/viewplugins/views/collectionview/inc/mpxcollectionview.hrh
mpxplugins/viewplugins/views/collectionview/inc/mpxcollectionviewcontainer.h
mpxplugins/viewplugins/views/collectionview/inc/mpxcollectionviewimp.h
mpxplugins/viewplugins/views/collectionview/inc/mpxcollectionviewlistboxarray.h
mpxplugins/viewplugins/views/collectionview/loc/mpxcollectionview.loc
mpxplugins/viewplugins/views/collectionview/src/mpxcollectionview.cpp
mpxplugins/viewplugins/views/collectionview/src/mpxcollectionviewcontainer.cpp
mpxplugins/viewplugins/views/collectionview/src/mpxcollectionviewimp.cpp
mpxplugins/viewplugins/views/collectionview/src/mpxcollectionviewlistboxarray.cpp
mpxplugins/viewplugins/views/collectionviewhg/bwinscw/mpxcollectionviewhgu.def
mpxplugins/viewplugins/views/collectionviewhg/data/mpxcollectionviewhg.rss
mpxplugins/viewplugins/views/collectionviewhg/eabi/mpxcollectionviewhgu.def
mpxplugins/viewplugins/views/collectionviewhg/group/bld.inf
mpxplugins/viewplugins/views/collectionviewhg/group/iconlist.txt
mpxplugins/viewplugins/views/collectionviewhg/group/mpxcollectionviewhg.mmp
mpxplugins/viewplugins/views/collectionviewhg/group/mpxcollectionviewhgicons.mk
mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhg.hlp.hrh
mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhg.hrh
mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgcontainer.h
mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgimp.h
mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhglistboxarray.h
mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgplaylisthelper.h
mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgtnloader.h
mpxplugins/viewplugins/views/collectionviewhg/loc/mpxcollectionviewhg.loc
mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhg.cpp
mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgcontainer.cpp
mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp
mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhglistboxarray.cpp
mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgplaylisthelper.cpp
mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgtnloader.cpp
mpxplugins/viewplugins/views/commoncontainer/bwinscw/mpxcommoncontainerU.DEF
mpxplugins/viewplugins/views/commoncontainer/data/mpxcommoncontainer.rss
mpxplugins/viewplugins/views/commoncontainer/eabi/mpxcommoncontainerU.DEF
mpxplugins/viewplugins/views/commoncontainer/group/bld.inf
mpxplugins/viewplugins/views/commoncontainer/group/mpxcommoncontainer.mmp
mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontaineravkonimp.h
mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainerfilteredlist.h
mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainerhgimp.h
mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainerhitchcockimp.h
mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainermediahelper.h
mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainersearchfield.h
mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainersearchfieldwrapper.h
mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainertexturemanager.h
mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainertexturemanager2.h
mpxplugins/viewplugins/views/commoncontainer/loc/mpxcommoncontainer.loc
mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainer.cpp
mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontaineravkonimp.cpp
mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainerfilteredlist.cpp
mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainerhgimp.cpp
mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainerhitchcockimp.cpp
mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainermediahelper.cpp
mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainersearchfield.cpp
mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainerssearchfieldwrapper.cpp
mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainertexturemanager.cpp
mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainertexturemanager2.cpp
mpxplugins/viewplugins/views/commoncontainer/src/mpxcommonlistboxarraybase.cpp
mpxplugins/viewplugins/views/commonplaybackview/bwinscw/mpxcommonplaybackviewU.DEF
mpxplugins/viewplugins/views/commonplaybackview/data/mpxcommonplaybackview.rss
mpxplugins/viewplugins/views/commonplaybackview/data/mpxcommonplaybackviewui.rh
mpxplugins/viewplugins/views/commonplaybackview/data/mpxfmtx.rss
mpxplugins/viewplugins/views/commonplaybackview/data/mpxunifiedcommonplaybackview.rss
mpxplugins/viewplugins/views/commonplaybackview/eabi/mpxcommonplaybackviewU.DEF
mpxplugins/viewplugins/views/commonplaybackview/group/bld.inf
mpxplugins/viewplugins/views/commonplaybackview/group/iconlist.txt
mpxplugins/viewplugins/views/commonplaybackview/group/mpxcommonplaybackview.mmp
mpxplugins/viewplugins/views/commonplaybackview/group/mpxcommonplaybackviewicons.mk
mpxplugins/viewplugins/views/commonplaybackview/inc/mpxbuttonmanager.h
mpxplugins/viewplugins/views/commonplaybackview/loc/mpxcommonplaybackview.loc
mpxplugins/viewplugins/views/commonplaybackview/src/mpxbutton.cpp
mpxplugins/viewplugins/views/commonplaybackview/src/mpxbuttonmanager.cpp
mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewcontainer.cpp
mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewimp.cpp
mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewlayout.cpp
mpxplugins/viewplugins/views/commonplaybackview/src/mpxplaybackviewinfolabel.cpp
mpxplugins/viewplugins/views/embeddedplaybackview/bwinscw/mpxembeddedplaybackviewU.DEF
mpxplugins/viewplugins/views/embeddedplaybackview/data/mpxembeddedplaybackview.rss
mpxplugins/viewplugins/views/embeddedplaybackview/eabi/mpxembeddedplaybackviewU.DEF
mpxplugins/viewplugins/views/embeddedplaybackview/group/bld.inf
mpxplugins/viewplugins/views/embeddedplaybackview/group/iconlist.txt
mpxplugins/viewplugins/views/embeddedplaybackview/group/mpxembeddedplaybackview.mmp
mpxplugins/viewplugins/views/embeddedplaybackview/group/mpxembeddedplaybackviewicons.mk
mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackview.hlp.hrh
mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackview.hrh
mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackviewcontainer.h
mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackviewimp.h
mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackviewlayout.h
mpxplugins/viewplugins/views/embeddedplaybackview/loc/mpxembeddedplaybackview.loc
mpxplugins/viewplugins/views/embeddedplaybackview/src/mpxembeddedplaybackview.cpp
mpxplugins/viewplugins/views/embeddedplaybackview/src/mpxembeddedplaybackviewcontainer.cpp
mpxplugins/viewplugins/views/embeddedplaybackview/src/mpxembeddedplaybackviewimp.cpp
mpxplugins/viewplugins/views/embeddedplaybackview/src/mpxembeddedplaybackviewlayout.cpp
mpxplugins/viewplugins/views/equalizerview/bwinscw/mpxequalizerviewU.DEF
mpxplugins/viewplugins/views/equalizerview/data/nullsound.mp3
mpxplugins/viewplugins/views/equalizerview/eabi/mpxequalizerviewU.DEF
mpxplugins/viewplugins/views/equalizerview/group/bld.inf
mpxplugins/viewplugins/views/equalizerview/group/mpxequalizerview.mmp
mpxplugins/viewplugins/views/equalizerview/inc/mpxequalizerhelper.h
mpxplugins/viewplugins/views/equalizerview/src/mpxequalizerhelper.cpp
mpxplugins/viewplugins/views/equalizerview/src/mpxequalizerhelperstub.cpp
mpxplugins/viewplugins/views/equalizerview/src/mpxequalizerview.cpp
mpxplugins/viewplugins/views/group/bld.inf
mpxplugins/viewplugins/views/inc/mpxbutton.h
mpxplugins/viewplugins/views/inc/mpxcbahandler.h
mpxplugins/viewplugins/views/inc/mpxcommoncontainer.h
mpxplugins/viewplugins/views/inc/mpxcommoncontainer.hrh
mpxplugins/viewplugins/views/inc/mpxcommonlistboxarraybase.h
mpxplugins/viewplugins/views/inc/mpxcommonlistboxarrayobserver.h
mpxplugins/viewplugins/views/inc/mpxcommonplaybackview.hrh
mpxplugins/viewplugins/views/inc/mpxcommonplaybackviewcontainer.h
mpxplugins/viewplugins/views/inc/mpxcommonplaybackviewdefs.h
mpxplugins/viewplugins/views/inc/mpxcommonplaybackviewlayout.h
mpxplugins/viewplugins/views/inc/mpxplaybackview.hlp.hrh
mpxplugins/viewplugins/views/inc/mpxplaybackviewinfolabel.h
mpxplugins/viewplugins/views/inc/mpxplaybackviewlayoutinterface.h
mpxplugins/viewplugins/views/inc/mpxviewcontainer.h
mpxplugins/viewplugins/views/mainview/bwinscw/mpxmainviewU.DEF
mpxplugins/viewplugins/views/mainview/data/mpxmainview.rss
mpxplugins/viewplugins/views/mainview/eabi/mpxmainviewU.DEF
mpxplugins/viewplugins/views/mainview/group/bld.inf
mpxplugins/viewplugins/views/mainview/group/iconlist.txt
mpxplugins/viewplugins/views/mainview/group/mpxmainview.mmp
mpxplugins/viewplugins/views/mainview/group/mpxmainviewicons.mk
mpxplugins/viewplugins/views/mainview/inc/mpxmainview.hlp.hrh
mpxplugins/viewplugins/views/mainview/inc/mpxmainview.hrh
mpxplugins/viewplugins/views/mainview/inc/mpxmainviewcontainer.h
mpxplugins/viewplugins/views/mainview/inc/mpxmainviewimp.h
mpxplugins/viewplugins/views/mainview/loc/mpxmainview.loc
mpxplugins/viewplugins/views/mainview/src/mpxmainview.cpp
mpxplugins/viewplugins/views/mainview/src/mpxmainviewcontainer.cpp
mpxplugins/viewplugins/views/mainview/src/mpxmainviewimp.cpp
mpxplugins/viewplugins/views/metadataeditordialog/bwinscw/mpxmetadataeditordialogU.DEF
mpxplugins/viewplugins/views/metadataeditordialog/data/mpxmetadataeditordialog.rss
mpxplugins/viewplugins/views/metadataeditordialog/eabi/mpxmetadataeditordialogU.DEF
mpxplugins/viewplugins/views/metadataeditordialog/group/bld.inf
mpxplugins/viewplugins/views/metadataeditordialog/group/mpxmetadataeditordialog.mmp
mpxplugins/viewplugins/views/metadataeditordialog/inc/mpxmetadataeditordialog.hlp.hrh
mpxplugins/viewplugins/views/metadataeditordialog/inc/mpxmetadataeditordialog.hrh
mpxplugins/viewplugins/views/metadataeditordialog/loc/mpxmetadataeditordialog.loc
mpxplugins/viewplugins/views/metadataeditordialog/src/mpxmetadataeditordialog.cpp
mpxplugins/viewplugins/views/pdplaybackview/bwinscw/mpxpdplaybackviewU.DEF
mpxplugins/viewplugins/views/pdplaybackview/data/mpxpdplaybackview.rss
mpxplugins/viewplugins/views/pdplaybackview/eabi/mpxpdplaybackviewU.DEF
mpxplugins/viewplugins/views/pdplaybackview/group/bld.inf
mpxplugins/viewplugins/views/pdplaybackview/group/mpxpdplaybackview.mmp
mpxplugins/viewplugins/views/pdplaybackview/inc/mpxpdplaybackview.hlp.hrh
mpxplugins/viewplugins/views/pdplaybackview/inc/mpxpdplaybackview.hrh
mpxplugins/viewplugins/views/pdplaybackview/inc/mpxpdplaybackviewcontainer.h
mpxplugins/viewplugins/views/pdplaybackview/inc/mpxpdplaybackviewimp.h
mpxplugins/viewplugins/views/pdplaybackview/inc/mpxpdplaybackviewlayout.h
mpxplugins/viewplugins/views/pdplaybackview/loc/mpxpdplaybackview.loc
mpxplugins/viewplugins/views/pdplaybackview/src/mpxpdplaybackview.cpp
mpxplugins/viewplugins/views/pdplaybackview/src/mpxpdplaybackviewcontainer.cpp
mpxplugins/viewplugins/views/pdplaybackview/src/mpxpdplaybackviewimp.cpp
mpxplugins/viewplugins/views/pdplaybackview/src/mpxpdplaybackviewlayout.cpp
mpxplugins/viewplugins/views/pdsbplaybackview/bwinscw/mpxpdsbplaybackviewu.def
mpxplugins/viewplugins/views/pdsbplaybackview/data/mpxpdsbplaybackview.rss
mpxplugins/viewplugins/views/pdsbplaybackview/eabi/mpxpdsbplaybackviewu.def
mpxplugins/viewplugins/views/pdsbplaybackview/group/bld.inf
mpxplugins/viewplugins/views/pdsbplaybackview/group/mpxpdsbplaybackview.mmp
mpxplugins/viewplugins/views/pdsbplaybackview/inc/mpxpdsbplaybackview.hlp.hrh
mpxplugins/viewplugins/views/pdsbplaybackview/inc/mpxpdsbplaybackview.hrh
mpxplugins/viewplugins/views/pdsbplaybackview/inc/mpxpdsbplaybackviewcontainer.h
mpxplugins/viewplugins/views/pdsbplaybackview/inc/mpxpdsbplaybackviewimp.h
mpxplugins/viewplugins/views/pdsbplaybackview/inc/mpxpdsbplaybackviewlayout.h
mpxplugins/viewplugins/views/pdsbplaybackview/loc/mpxpdsbplaybackview.loc
mpxplugins/viewplugins/views/pdsbplaybackview/src/mpxpdsbplaybackview.cpp
mpxplugins/viewplugins/views/pdsbplaybackview/src/mpxpdsbplaybackviewcontainer.cpp
mpxplugins/viewplugins/views/pdsbplaybackview/src/mpxpdsbplaybackviewimp.cpp
mpxplugins/viewplugins/views/pdsbplaybackview/src/mpxpdsbplaybackviewlayout.cpp
mpxplugins/viewplugins/views/playbackview/bwinscw/mpxplaybackviewU.DEF
mpxplugins/viewplugins/views/playbackview/data/mpxplaybackview.rss
mpxplugins/viewplugins/views/playbackview/eabi/mpxplaybackviewU.DEF
mpxplugins/viewplugins/views/playbackview/group/bld.inf
mpxplugins/viewplugins/views/playbackview/group/mpxplaybackview.mmp
mpxplugins/viewplugins/views/playbackview/inc/mpxplaybackview.hlp.hrh
mpxplugins/viewplugins/views/playbackview/inc/mpxplaybackview.hrh
mpxplugins/viewplugins/views/playbackview/inc/mpxplaybackviewcontainer.h
mpxplugins/viewplugins/views/playbackview/inc/mpxplaybackviewimp.h
mpxplugins/viewplugins/views/playbackview/inc/mpxplaybackviewlayout.h
mpxplugins/viewplugins/views/playbackview/src/mpxplaybackview.cpp
mpxplugins/viewplugins/views/playbackview/src/mpxplaybackviewcontainer.cpp
mpxplugins/viewplugins/views/playbackview/src/mpxplaybackviewimp.cpp
mpxplugins/viewplugins/views/playbackview/src/mpxplaybackviewlayout.cpp
mpxplugins/viewplugins/views/podcastplaybackview/bwinscw/mpxpodcastplaybackviewU.DEF
mpxplugins/viewplugins/views/podcastplaybackview/data/mpxpodcastplaybackview.rss
mpxplugins/viewplugins/views/podcastplaybackview/eabi/mpxpodcastplaybackviewU.DEF
mpxplugins/viewplugins/views/podcastplaybackview/group/bld.inf
mpxplugins/viewplugins/views/podcastplaybackview/group/iconlist.txt
mpxplugins/viewplugins/views/podcastplaybackview/group/mpxpodcastplaybackview.mmp
mpxplugins/viewplugins/views/podcastplaybackview/group/mpxpodcastplaybackviewicons.mk
mpxplugins/viewplugins/views/podcastplaybackview/inc/mpxpodcastplaybackview.hlp.hrh
mpxplugins/viewplugins/views/podcastplaybackview/inc/mpxpodcastplaybackview.hrh
mpxplugins/viewplugins/views/podcastplaybackview/inc/mpxpodcastplaybackviewcontainer.h
mpxplugins/viewplugins/views/podcastplaybackview/inc/mpxpodcastplaybackviewimp.h
mpxplugins/viewplugins/views/podcastplaybackview/inc/mpxpodcastplaybackviewlayout.h
mpxplugins/viewplugins/views/podcastplaybackview/loc/mpxpodcastplaybackview.loc
mpxplugins/viewplugins/views/podcastplaybackview/src/mpxpodcastplaybackview.cpp
mpxplugins/viewplugins/views/podcastplaybackview/src/mpxpodcastplaybackviewcontainer.cpp
mpxplugins/viewplugins/views/podcastplaybackview/src/mpxpodcastplaybackviewimp.cpp
mpxplugins/viewplugins/views/podcastplaybackview/src/mpxpodcastplaybackviewlayout.cpp
mpxplugins/viewplugins/views/podcastview/bwinscw/mpxpodcastcollectionviewU.DEF
mpxplugins/viewplugins/views/podcastview/data/mpxpodcastcollectionview.rss
mpxplugins/viewplugins/views/podcastview/eabi/mpxpodcastcollectionviewU.DEF
mpxplugins/viewplugins/views/podcastview/group/bld.inf
mpxplugins/viewplugins/views/podcastview/group/iconlist.txt
mpxplugins/viewplugins/views/podcastview/group/mpxpodcastcollectionview.mmp
mpxplugins/viewplugins/views/podcastview/group/mpxpodcastcollectionviewicons.mk
mpxplugins/viewplugins/views/podcastview/inc/mpxpodcastcollectionview.hlp.hrh
mpxplugins/viewplugins/views/podcastview/inc/mpxpodcastcollectionview.hrh
mpxplugins/viewplugins/views/podcastview/inc/mpxpodcastcollectionviewcontainer.h
mpxplugins/viewplugins/views/podcastview/inc/mpxpodcastcollectionviewimp.h
mpxplugins/viewplugins/views/podcastview/inc/mpxpodcastcollectionviewlistboxarray.h
mpxplugins/viewplugins/views/podcastview/loc/mpxpodcastcollectionview.loc
mpxplugins/viewplugins/views/podcastview/src/mpxpodcastcollectionview.cpp
mpxplugins/viewplugins/views/podcastview/src/mpxpodcastcollectionviewcontainer.cpp
mpxplugins/viewplugins/views/podcastview/src/mpxpodcastcollectionviewimp.cpp
mpxplugins/viewplugins/views/podcastview/src/mpxpodcastcollectionviewlistboxarray.cpp
mpxplugins/viewplugins/views/rom/mpxaddtracksdialog.iby
mpxplugins/viewplugins/views/rom/mpxaddtracksdialogrsc.iby
mpxplugins/viewplugins/views/rom/mpxalbumarteditordialog.iby
mpxplugins/viewplugins/views/rom/mpxalbumarteditordialogrsc.iby
mpxplugins/viewplugins/views/rom/mpxaudioeffectsview.iby
mpxplugins/viewplugins/views/rom/mpxaudioeffectsviewrsc.iby
mpxplugins/viewplugins/views/rom/mpxcollectionview.iby
mpxplugins/viewplugins/views/rom/mpxcollectionviewhg.iby
mpxplugins/viewplugins/views/rom/mpxcollectionviewhgrsc.iby
mpxplugins/viewplugins/views/rom/mpxcollectionviewrsc.iby
mpxplugins/viewplugins/views/rom/mpxcommoncontainer.iby
mpxplugins/viewplugins/views/rom/mpxcommoncontainerrsc.iby
mpxplugins/viewplugins/views/rom/mpxcommonplaybackview.iby
mpxplugins/viewplugins/views/rom/mpxcommonplaybackviewrsc.iby
mpxplugins/viewplugins/views/rom/mpxembeddedplaybackview.iby
mpxplugins/viewplugins/views/rom/mpxembeddedplaybackviewrsc.iby
mpxplugins/viewplugins/views/rom/mpxequalizerview.iby
mpxplugins/viewplugins/views/rom/mpxmainview.iby
mpxplugins/viewplugins/views/rom/mpxmainviewrsc.iby
mpxplugins/viewplugins/views/rom/mpxmetadataeditordialog.iby
mpxplugins/viewplugins/views/rom/mpxmetadataeditordialogrsc.iby
mpxplugins/viewplugins/views/rom/mpxpdplaybackview.iby
mpxplugins/viewplugins/views/rom/mpxpdplaybackviewrsc.iby
mpxplugins/viewplugins/views/rom/mpxpdsbplaybackview.iby
mpxplugins/viewplugins/views/rom/mpxpdsbplaybackviewrsc.iby
mpxplugins/viewplugins/views/rom/mpxplaybackview.iby
mpxplugins/viewplugins/views/rom/mpxplaybackviewrsc.iby
mpxplugins/viewplugins/views/rom/mpxpodcastplaybackview.iby
mpxplugins/viewplugins/views/rom/mpxpodcastplaybackviewrsc.iby
mpxplugins/viewplugins/views/rom/mpxpodcastview.iby
mpxplugins/viewplugins/views/rom/mpxpodcastviewrsc.iby
mpxplugins/viewplugins/views/rom/mpxupnpbrowsedialog.iby
mpxplugins/viewplugins/views/rom/mpxupnpbrowsedialogrsc.iby
mpxplugins/viewplugins/views/rom/mpxupnpplaybackdialog.iby
mpxplugins/viewplugins/views/rom/mpxupnpplaybackdialogrsc.iby
mpxplugins/viewplugins/views/rom/mpxupnpplaybackview.iby
mpxplugins/viewplugins/views/rom/mpxupnpplaybackviewrsc.iby
mpxplugins/viewplugins/views/rom/mpxwaitnotedialog.iby
mpxplugins/viewplugins/views/rom/mpxwaitnotedialogrsc.iby
mpxplugins/viewplugins/views/upnpbrowsedialog/bwinscw/mpxupnpbrowsedialogU.DEF
mpxplugins/viewplugins/views/upnpbrowsedialog/data/mpxupnpbrowsedialog.rss
mpxplugins/viewplugins/views/upnpbrowsedialog/eabi/mpxupnpbrowsedialogU.DEF
mpxplugins/viewplugins/views/upnpbrowsedialog/group/bld.inf
mpxplugins/viewplugins/views/upnpbrowsedialog/group/mpxupnpbrowsedialog.mmp
mpxplugins/viewplugins/views/upnpbrowsedialog/inc/mpxplayermanagerstub.h
mpxplugins/viewplugins/views/upnpbrowsedialog/inc/mpxupnpbrowsedialog.hrh
mpxplugins/viewplugins/views/upnpbrowsedialog/loc/mpxupnpbrowsedialog.loc
mpxplugins/viewplugins/views/upnpbrowsedialog/src/mpxplayermanagerstub.cpp
mpxplugins/viewplugins/views/upnpbrowsedialog/src/mpxupnpbrowsedialog.cpp
mpxplugins/viewplugins/views/upnpplaybackdialog/bwinscw/mpxupnpplaybackdialogU.DEF
mpxplugins/viewplugins/views/upnpplaybackdialog/data/mpxupnpplaybackdialog.rss
mpxplugins/viewplugins/views/upnpplaybackdialog/eabi/mpxupnpplaybackdialogU.DEF
mpxplugins/viewplugins/views/upnpplaybackdialog/group/bld.inf
mpxplugins/viewplugins/views/upnpplaybackdialog/group/mpxupnpplaybackdialog.mmp
mpxplugins/viewplugins/views/upnpplaybackdialog/inc/mpxupnpplaybackdialog.hrh
mpxplugins/viewplugins/views/upnpplaybackdialog/inc/mpxupnpplaybackdialogcustomcontrol.h
mpxplugins/viewplugins/views/upnpplaybackdialog/inc/mpxupnpplaybackdialogcustomcontrolcontainer.h
mpxplugins/viewplugins/views/upnpplaybackdialog/inc/mpxupnpplaybackdialoglayout.h
mpxplugins/viewplugins/views/upnpplaybackdialog/src/mpxupnpplaybackdialog.cpp
mpxplugins/viewplugins/views/upnpplaybackdialog/src/mpxupnpplaybackdialogcustomcontrol.cpp
mpxplugins/viewplugins/views/upnpplaybackdialog/src/mpxupnpplaybackdialogcustomcontrolcontainer.cpp
mpxplugins/viewplugins/views/upnpplaybackdialog/src/mpxupnpplaybackdialoglayout.cpp
mpxplugins/viewplugins/views/upnpplaybackview/bwinscw/mpxupnpplaybackviewU.DEF
mpxplugins/viewplugins/views/upnpplaybackview/data/mpxupnpplaybackview.rss
mpxplugins/viewplugins/views/upnpplaybackview/eabi/mpxupnpplaybackviewU.DEF
mpxplugins/viewplugins/views/upnpplaybackview/group/bld.inf
mpxplugins/viewplugins/views/upnpplaybackview/group/iconlist.txt
mpxplugins/viewplugins/views/upnpplaybackview/group/mpxupnpplaybackview.mmp
mpxplugins/viewplugins/views/upnpplaybackview/group/mpxupnpplaybackviewicons.mk
mpxplugins/viewplugins/views/upnpplaybackview/inc/mpxupnpplaybackview.hlp.hrh
mpxplugins/viewplugins/views/upnpplaybackview/inc/mpxupnpplaybackview.hrh
mpxplugins/viewplugins/views/upnpplaybackview/inc/mpxupnpplaybackviewcontainer.h
mpxplugins/viewplugins/views/upnpplaybackview/inc/mpxupnpplaybackviewimp.h
mpxplugins/viewplugins/views/upnpplaybackview/inc/mpxupnpplaybackviewlayout.h
mpxplugins/viewplugins/views/upnpplaybackview/loc/mpxupnpplaybackview.loc
mpxplugins/viewplugins/views/upnpplaybackview/src/mpxupnpplaybackview.cpp
mpxplugins/viewplugins/views/upnpplaybackview/src/mpxupnpplaybackviewcontainer.cpp
mpxplugins/viewplugins/views/upnpplaybackview/src/mpxupnpplaybackviewimp.cpp
mpxplugins/viewplugins/views/upnpplaybackview/src/mpxupnpplaybackviewlayout.cpp
mpxplugins/viewplugins/views/waitnotedialog/bwinscw/mpxwaitnotedialogU.DEF
mpxplugins/viewplugins/views/waitnotedialog/data/mpxwaitnotedialog.rss
mpxplugins/viewplugins/views/waitnotedialog/eabi/mpxwaitnotedialogU.DEF
mpxplugins/viewplugins/views/waitnotedialog/group/bld.inf
mpxplugins/viewplugins/views/waitnotedialog/group/mpxwaitnotedialog.mmp
mpxplugins/viewplugins/views/waitnotedialog/inc/mpxformatdialog.h
mpxplugins/viewplugins/views/waitnotedialog/inc/mpxmtpdialog.h
mpxplugins/viewplugins/views/waitnotedialog/inc/mpxopeningdialog.h
mpxplugins/viewplugins/views/waitnotedialog/inc/mpxscanningdialog.h
mpxplugins/viewplugins/views/waitnotedialog/inc/mpxusbdialog.h
mpxplugins/viewplugins/views/waitnotedialog/loc/mpxwaitnotedialog.loc
mpxplugins/viewplugins/views/waitnotedialog/src/mpxformatdialog.cpp
mpxplugins/viewplugins/views/waitnotedialog/src/mpxmtpdialog.cpp
mpxplugins/viewplugins/views/waitnotedialog/src/mpxopeningdialog.cpp
mpxplugins/viewplugins/views/waitnotedialog/src/mpxscanningdialog.cpp
mpxplugins/viewplugins/views/waitnotedialog/src/mpxusbdialog.cpp
mpxplugins/viewplugins/views/waitnotedialog/src/mpxwaitnoteconstructor.cpp
mpxplugins/viewplugins/views/waitnotedialog/src/mpxwaitnotedialog.cpp
musichomescreen/bwins/dummyMusicu.def
musichomescreen/data/music_matrix_items.xml
musichomescreen/data/musichomescreen.rss
musichomescreen/data/suite.xml
musichomescreen/data/themes/default/group/bld.inf
musichomescreen/data/themes/default/install/musicwidget/group/bld.inf
musichomescreen/data/themes/default/install/musicwidget/hsps/00/manifest.dat
musichomescreen/data/themes/default/install/musicwidget/hsps/00/musicwidgetconfiguration.dtd
musichomescreen/data/themes/default/install/musicwidget/hsps/00/widgetconfiguration.xml
musichomescreen/data/themes/default/install/musicwidget/loc/musicwidgetconfiguration.loc
musichomescreen/data/themes/default/install/musicwidget/rom/musicwidget.iby
musichomescreen/data/themes/default/install/musicwidget/rom/musicwidget_customer.iby
musichomescreen/data/themes/default/install/musicwidget/rom/musicwidget_resources.iby
musichomescreen/data/themes/default/install/musicwidget/rom/musicwidget_variant.iby
musichomescreen/data/themes/default/install/musicwidget/xuikon/00/MusicWidget.css
musichomescreen/data/themes/default/install/musicwidget/xuikon/00/MusicWidget.dat
musichomescreen/data/themes/default/install/musicwidget/xuikon/00/MusicWidget.xml
musichomescreen/data/themes/default/install/musicwidget/xuikon/00/musicwidget.o0000
musichomescreen/data/themes/default/install/musicwidget/xuikon/37/MusicWidget.css
musichomescreen/data/themes/default/install/musicwidget/xuikon/50/MusicWidget.css
musichomescreen/data/themes/default/install/musicwidget/xuikon/57/MusicWidget.css
musichomescreen/data/themes/default/install/musicwidget/xuikon/94/MusicWidget.css
musichomescreen/eabi/dummyMusicu.def
musichomescreen/group/bld.inf
musichomescreen/group/export_musicsuiteconf.mk
musichomescreen/group/iconlist.txt
musichomescreen/group/musichomescreenicons.mk
musichomescreen/group/musicsuiteconf.mmp
musichomescreen/inc/cpglobals.h
musichomescreen/inc/mpxresource.h
musichomescreen/loc/musichomescreen.loc
musichomescreen/mcpmusicplayer/data/mcpmusicplayer.rss
musichomescreen/mcpmusicplayer/group/bld.inf
musichomescreen/mcpmusicplayer/group/mcpmusicplayer.mmp
musichomescreen/mcpmusicplayer/inc/aiplayerpluginengine.h
musichomescreen/mcpmusicplayer/inc/aiplayerpluginengineobserver.h
musichomescreen/mcpmusicplayer/inc/applicationmonitor.h
musichomescreen/mcpmusicplayer/inc/applicationmonitorobserver.h
musichomescreen/mcpmusicplayer/inc/filemonitor.h
musichomescreen/mcpmusicplayer/inc/filemonitorobserver.h
musichomescreen/mcpmusicplayer/inc/mcpmusicplayer.h
musichomescreen/mcpmusicplayer/inc/mcpmusicplayeruids.hrh
musichomescreen/mcpmusicplayer/inc/pnsmonitor.h
musichomescreen/mcpmusicplayer/inc/pnsmonitorobserver.h
musichomescreen/mcpmusicplayer/rom/mcpmusicplayer.iby
musichomescreen/mcpmusicplayer/src/aiplayerpluginengine.cpp
musichomescreen/mcpmusicplayer/src/applicationmonitor.cpp
musichomescreen/mcpmusicplayer/src/filemonitor.cpp
musichomescreen/mcpmusicplayer/src/mcpmusicplayer.cpp
musichomescreen/mcpmusicplayer/src/pnsmonitor.cpp
musichomescreen/mcpmusicplayer/src/proxy.cpp
musichomescreen/mpxcollectionpublisher/data/mpxcollectionpublisher.rss
musichomescreen/mpxcollectionpublisher/group/bld.inf
musichomescreen/mpxcollectionpublisher/group/mpxcollectionpublisher.mmp
musichomescreen/mpxcollectionpublisher/inc/mpxcollectionpublisher.h
musichomescreen/mpxcollectionpublisher/inc/mpxcollectionpublisheruids.hrh
musichomescreen/mpxcollectionpublisher/rom/mpxcollectionpublisher.iby
musichomescreen/mpxcollectionpublisher/src/mpxcollectionpublisher.cpp
musichomescreen/mpxcollectionpublisher/src/proxy.cpp
musichomescreen/musiccontentpublisher/data/musiccontentpublisher.rss
musichomescreen/musiccontentpublisher/group/bld.inf
musichomescreen/musiccontentpublisher/group/musiccontentpublisher.mmp
musichomescreen/musiccontentpublisher/inc/mcpharvesterpublisherobserver.h
musichomescreen/musiccontentpublisher/inc/musiccontentpublisher.h
musichomescreen/musiccontentpublisher/inc/musiccontentpublisheruids.hrh
musichomescreen/musiccontentpublisher/inc/pluginmanager.h
musichomescreen/musiccontentpublisher/inc/sapidatapluginconst.h
musichomescreen/musiccontentpublisher/rom/musiccontentpublisher.iby
musichomescreen/musiccontentpublisher/src/mcpharvesterpublisherobserver.cpp
musichomescreen/musiccontentpublisher/src/musiccontentpublisher.cpp
musichomescreen/musiccontentpublisher/src/pluginmanager.cpp
musichomescreen/musiccontentpublisher/src/proxy.cpp
musichomescreen/musicplayeractionhandlerplugin/data/musicplayeractionhandlerplugin.rss
musichomescreen/musicplayeractionhandlerplugin/group/bld.inf
musichomescreen/musicplayeractionhandlerplugin/group/musicplayeractionhandlerplugin.mmp
musichomescreen/musicplayeractionhandlerplugin/inc/musicplayeractionhandler.h
musichomescreen/musicplayeractionhandlerplugin/inc/musicplayeractionhandleruids.hrh
musichomescreen/musicplayeractionhandlerplugin/rom/musicplayeractionhandlerplugin.iby
musichomescreen/musicplayeractionhandlerplugin/src/musicplayeractionhandler.cpp
musichomescreen/musicplayeractionhandlerplugin/src/proxy.cpp
musichomescreen/rom/musichomescreen.iby
musichomescreen/rom/musichomescreenrsc.iby
musichomescreen/rom/musicmatrixmenu.iby
musichomescreen/src/dummy.cpp
musichomescreen/src/mpxresource.cpp
musichomescreen_multiview/bwins/dummyMusicu.def
musichomescreen_multiview/data/music_matrix_items.xml
musichomescreen_multiview/data/musichomescreen.rss
musichomescreen_multiview/data/suite.xml
musichomescreen_multiview/data/themes/default/group/bld.inf
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/group/bld.inf
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/hsps/00/manifest.dat
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/hsps/00/musicwidgetconfiguration.dtd
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/hsps/00/widgetconfiguration.xml
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/icons/musicwidgeticon.mif
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/loc/musicwidgetconfiguration.loc
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/rom/musicwidget.iby
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/rom/musicwidget_customer.iby
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/rom/musicwidget_resources.iby
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/rom/musicwidget_variant.iby
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/00/MusicWidget.css
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/00/MusicWidget.dat
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/00/MusicWidget.xml
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/37/MusicWidget.css
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/50/MusicWidget.css
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/57/MusicWidget.css
musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/94/MusicWidget.css
musichomescreen_multiview/eabi/dummyMusicu.def
musichomescreen_multiview/group/bld.inf
musichomescreen_multiview/group/export_musicsuiteconf.mk
musichomescreen_multiview/group/iconlist.txt
musichomescreen_multiview/group/musichomescreenicons.mk
musichomescreen_multiview/group/musicsuiteconf.mmp
musichomescreen_multiview/group/musicwidgeticon.txt
musichomescreen_multiview/inc/cpglobals.h
musichomescreen_multiview/inc/mpxresource.h
musichomescreen_multiview/loc/musichomescreen.loc
musichomescreen_multiview/mcpmusicplayer/data/mcpmusicplayer.rss
musichomescreen_multiview/mcpmusicplayer/group/bld.inf
musichomescreen_multiview/mcpmusicplayer/group/mcpmusicplayer.mmp
musichomescreen_multiview/mcpmusicplayer/inc/aiplayerpluginengine.h
musichomescreen_multiview/mcpmusicplayer/inc/aiplayerpluginengineobserver.h
musichomescreen_multiview/mcpmusicplayer/inc/applicationmonitor.h
musichomescreen_multiview/mcpmusicplayer/inc/applicationmonitorobserver.h
musichomescreen_multiview/mcpmusicplayer/inc/filemonitor.h
musichomescreen_multiview/mcpmusicplayer/inc/filemonitorobserver.h
musichomescreen_multiview/mcpmusicplayer/inc/mcpmusicplayer.h
musichomescreen_multiview/mcpmusicplayer/inc/mcpmusicplayeruids.hrh
musichomescreen_multiview/mcpmusicplayer/inc/pnsmonitor.h
musichomescreen_multiview/mcpmusicplayer/inc/pnsmonitorobserver.h
musichomescreen_multiview/mcpmusicplayer/rom/mcpmusicplayer.iby
musichomescreen_multiview/mcpmusicplayer/src/aiplayerpluginengine.cpp
musichomescreen_multiview/mcpmusicplayer/src/applicationmonitor.cpp
musichomescreen_multiview/mcpmusicplayer/src/filemonitor.cpp
musichomescreen_multiview/mcpmusicplayer/src/mcpmusicplayer.cpp
musichomescreen_multiview/mcpmusicplayer/src/pnsmonitor.cpp
musichomescreen_multiview/mcpmusicplayer/src/proxy.cpp
musichomescreen_multiview/mpxcollectionpublisher/data/mpxcollectionpublisher.rss
musichomescreen_multiview/mpxcollectionpublisher/group/bld.inf
musichomescreen_multiview/mpxcollectionpublisher/group/mpxcollectionpublisher.mmp
musichomescreen_multiview/mpxcollectionpublisher/inc/mpxcollectionpublisher.h
musichomescreen_multiview/mpxcollectionpublisher/inc/mpxcollectionpublisheruids.hrh
musichomescreen_multiview/mpxcollectionpublisher/rom/mpxcollectionpublisher.iby
musichomescreen_multiview/mpxcollectionpublisher/src/mpxcollectionpublisher.cpp
musichomescreen_multiview/mpxcollectionpublisher/src/proxy.cpp
musichomescreen_multiview/musiccontentpublisher/data/musiccontentpublisher.rss
musichomescreen_multiview/musiccontentpublisher/group/bld.inf
musichomescreen_multiview/musiccontentpublisher/group/musiccontentpublisher.mmp
musichomescreen_multiview/musiccontentpublisher/inc/mcpharvesterpublisherobserver.h
musichomescreen_multiview/musiccontentpublisher/inc/musiccontentpublisher.h
musichomescreen_multiview/musiccontentpublisher/inc/musiccontentpublisheruids.hrh
musichomescreen_multiview/musiccontentpublisher/inc/pluginmanager.h
musichomescreen_multiview/musiccontentpublisher/inc/sapidatapluginconst.h
musichomescreen_multiview/musiccontentpublisher/rom/musiccontentpublisher.iby
musichomescreen_multiview/musiccontentpublisher/src/mcpharvesterpublisherobserver.cpp
musichomescreen_multiview/musiccontentpublisher/src/musiccontentpublisher.cpp
musichomescreen_multiview/musiccontentpublisher/src/pluginmanager.cpp
musichomescreen_multiview/musiccontentpublisher/src/proxy.cpp
musichomescreen_multiview/musicplayeractionhandlerplugin/data/musicplayeractionhandlerplugin.rss
musichomescreen_multiview/musicplayeractionhandlerplugin/group/bld.inf
musichomescreen_multiview/musicplayeractionhandlerplugin/group/musicplayeractionhandlerplugin.mmp
musichomescreen_multiview/musicplayeractionhandlerplugin/inc/musicplayeractionhandler.h
musichomescreen_multiview/musicplayeractionhandlerplugin/inc/musicplayeractionhandleruids.hrh
musichomescreen_multiview/musicplayeractionhandlerplugin/rom/musicplayeractionhandlerplugin.iby
musichomescreen_multiview/musicplayeractionhandlerplugin/src/musicplayeractionhandler.cpp
musichomescreen_multiview/musicplayeractionhandlerplugin/src/proxy.cpp
musichomescreen_multiview/rom/musichomescreen.iby
musichomescreen_multiview/rom/musichomescreenrsc.iby
musichomescreen_multiview/rom/musicmatrixmenu.iby
musichomescreen_multiview/src/dummy.cpp
musichomescreen_multiview/src/mpxresource.cpp
musicplayer_plat/audio_application_features_api/audio_application_features_api.metaxml
musicplayer_plat/audio_application_features_api/group/bld.inf
musicplayer_plat/audio_application_features_api/inc/MusicPlayerInternalCRKeys.h
musicplayer_plat/audio_application_features_api/inc/musicplayerdomaincrkeys.h
musicplayer_plat/group/bld.inf
musicplayer_plat/mpx_music_player_app_api/group/bld.inf
musicplayer_plat/mpx_music_player_app_api/inc/mpxappui.hrh
musicplayer_plat/mpx_music_player_app_api/inc/mpxcommonuihelper.h
musicplayer_plat/mpx_music_player_app_api/inc/mpxconstants.h
musicplayer_plat/mpx_music_player_app_api/inc/mpxinternalcrkeys.h
musicplayer_plat/mpx_music_player_app_api/inc/mpxmusicplayer.hrh
musicplayer_plat/mpx_music_player_app_api/inc/mpxmusicplayerviewplugin.hrh
musicplayer_plat/mpx_music_player_app_api/inc/mpxtlshelper.h
musicplayer_plat/mpx_music_player_app_api/mpx_music_player_app_api.metaxml
musicplayer_plat/mpx_music_player_app_api/tsrc/conf/tcMpxMusicPlayerTest.cfg
musicplayer_plat/mpx_music_player_app_api/tsrc/conf/ui_mpxmusicplayertest.cfg
musicplayer_plat/mpx_music_player_app_api/tsrc/group/bld.inf
musicplayer_plat/mpx_music_player_app_api/tsrc/init/TestFramework.ini
musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/Bwins/ui_mpxmusicplayertestu.def
musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/EABI/ui_mpxmusicplayertestu.def
musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/group/bld.inf
musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/group/ui_mpxmusicplayertest.mmp
musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/group/ui_mpxmusicplayertest.pkg
musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/inc/EdwinTestControl.h
musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/inc/mpxcommonuihelper.h
musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/inc/ui_mpxmusicplayertest.h
musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/src/EdwinTestControl.cpp
musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/src/ui_mpxmusicplayertest.cpp
musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/src/ui_mpxmusicplayertestBlocks.cpp
musicplayer_plat/mpx_music_player_commonui_api/group/bld.inf
musicplayer_plat/mpx_music_player_commonui_api/inc/mpxalbumartutil.h
musicplayer_plat/mpx_music_player_commonui_api/inc/mpxalbumartutilobserver.h
musicplayer_plat/mpx_music_player_commonui_api/inc/mpxlbxextendedfeatures.h
musicplayer_plat/mpx_music_player_commonui_api/mpx_music_player_commonui_api.metaxml
musicplayer_plat/mpx_music_player_commonui_api/tsrc/conf/ui_mpxmusicplayercommonuitest.cfg
musicplayer_plat/mpx_music_player_commonui_api/tsrc/group/bld.inf
musicplayer_plat/mpx_music_player_commonui_api/tsrc/init/TestFramework.ini
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/Bmarm/ui_mpxmusicplayercommonuitestU.DEF
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/Bwins/ui_mpxmusicplayercommonuitestU.DEF
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/EABI/ui_mpxmusicplayercommonuitestU.def
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/group/bld.inf
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/group/ui_mpxmusicplayercommonuitest.mmp
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/group/ui_mpxmusicplayercommonuitest.pkg
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/group/ui_mpxmusicplayercommonuitest_DoxyFile.txt
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/inc/EdwinTestControl.h
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/inc/ListBoxTestControl.h
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/inc/ui_mpxmusicplayercommonuitest.h
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/src/EdwinTestControl.cpp
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/src/ListBoxTestControl.cpp
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/src/ui_mpxmusicplayercommonuitest.cpp
musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/src/ui_mpxmusicplayercommonuitestBlocks.cpp
musicplayer_plat/mpx_music_player_media_key_handler_api/group/bld.inf
musicplayer_plat/mpx_music_player_media_key_handler_api/inc/mpxmediakeyhandler.h
musicplayer_plat/mpx_music_player_media_key_handler_api/inc/mpxmediakeyhandlerdefs.h
musicplayer_plat/mpx_music_player_media_key_handler_api/inc/mpxmediakeyhandlerobserver.h
musicplayer_plat/mpx_music_player_media_key_handler_api/mpx_music_player_media_key_handler_api.metaxml
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/conf/ui_mpxmusicplayerkeyhandertest.cfg
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/group/bld.inf
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/init/TestFramework.ini
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/Bmarm/ui_mpxmusicplayerkeyhandertestU.DEF
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/Bwins/ui_mpxmusicplayerkeyhandertestU.DEF
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/EABI/ui_mpxmusicplayerkeyhandertestU.def
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/group/bld.inf
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/group/ui_mpxmusicplayerkeyhandertest.mmp
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/group/ui_mpxmusicplayerkeyhandertest.pkg
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/group/ui_mpxmusicplayerkeyhandertest_DoxyFile.txt
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/inc/EdwinTestControl.h
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/inc/ui_mpxmusicplayerkeyhandertest.h
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/src/EdwinTestControl.cpp
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/src/ui_mpxmusicplayerkeyhandertest.cpp
musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/src/ui_mpxmusicplayerkeyhandertestBlocks.cpp
musicplayer_plat/mpx_music_player_remote_control_api/group/bld.inf
musicplayer_plat/mpx_music_player_remote_control_api/inc/mplayersecondarydisplayapi.h
musicplayer_plat/mpx_music_player_remote_control_api/mpx_music_player_remote_control_api.metaxml
musicplayer_plat/mpx_music_shop_ui_api/group/bld.inf
musicplayer_plat/mpx_music_shop_ui_api/inc/MMusicShopBrViewCallback.h
musicplayer_plat/mpx_music_shop_ui_api/inc/MusicShopEmbeddedLauncher.h
musicplayer_plat/mpx_music_shop_ui_api/inc/MusicShopExternalInterface.h
musicplayer_plat/mpx_music_shop_ui_api/mpx_music_shop_ui_api.metaxml
musicplayer_plat/mpx_music_store_api/group/bld.inf
musicplayer_plat/mpx_music_store_api/inc/MusicStoreUidConstants.h
musicplayer_plat/mpx_music_store_api/inc/mpxfindinmusicshop.h
musicplayer_plat/mpx_music_store_api/inc/mpxfindinmusicshop.inl
musicplayer_plat/mpx_music_store_api/inc/mpxfindinmusicshopcommon.h
musicplayer_plat/mpx_music_store_api/mpx_music_store_api.metaxml
musicplayer_plat/mpx_music_store_api/tsrc/conf/mpxmusicstoretest.cfg
musicplayer_plat/mpx_music_store_api/tsrc/group/bld.inf
musicplayer_plat/mpx_music_store_api/tsrc/init/TestFramework.ini
musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/Bmarm/mpxmusicstoretestU.DEF
musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/Bwins/mpxmusicstoretestU.DEF
musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/EABI/mpxmusicstoretestU.def
musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/group/bld.inf
musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/group/mpxmusicstoretest.mmp
musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/group/mpxmusicstoretest.pkg
musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/group/mpxmusicstoretest_DoxyFile.txt
musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/group/mpxmusicstoretest_nrm.mmp
musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/inc/mpxmusicstoretest.h
musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/src/mpxmusicstoretest.cpp
musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/src/mpxmusicstoretestBlocks.cpp
musicplayer_plat/mpx_music_wap_adapter_cenrep_api/group/bld.inf
musicplayer_plat/mpx_music_wap_adapter_cenrep_api/inc/MusicWapCenRepKeys.h
musicplayer_plat/mpx_music_wap_adapter_cenrep_api/mpx_music_wap_adapter_cenrep_api.metaxml
musicplayer_plat/music_content_publisher_plugin_api/group/bld.inf
musicplayer_plat/music_content_publisher_plugin_api/inc/mcpplugin.h
musicplayer_plat/music_content_publisher_plugin_api/inc/mcppluginobserver.h
musicplayer_plat/music_content_publisher_plugin_api/inc/mcppluginuids.hrh
musicplayer_plat/music_content_publisher_plugin_api/music_content_publisher_plugin_api.metaxml
package_definition.xml
sysdef_1_4_0.dtd
tsrc/group/bld.inf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for music domain
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../inc/musicplayerbldvariant.hrh"
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+
+PRJ_MMPFILES
+#include "../musicplayer_plat/group/bld.inf"
+//#include "../cameseui/group/bld.inf"
+#include "../mpxmusicplayer/group/bld.inf"
+#ifdef IAD_INCLUDE_ENHANCED_HOMESCREEN
+#include "../musichomescreen_multiview/group/bld.inf"
+#endif
+#include "../mpxplugins/group/bld.inf"
+
+
+//  End of File  
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/inc/musicplayerbldvariant.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  bldvariant headers for project musicplayer
+*
+*/
+
+
+
+#ifndef MUSICPLAYERBLDVARIANT_HRH
+#define MUSICPLAYERBLDVARIANT_HRH
+
+
+#define IAD_INCLUDE_BACKSTEPPING
+#define IAD_INCLUDE_ENHANCED_HOMESCREEN
+#define IAD_INCLUDE_UPNP
+#define IAD_INCLUDE_SINGLE_CLICK
+
+#endif  // MUSICPLAYERBLDVARIANT_HRH
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/layers.sysdef.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+  <!ENTITY layer_real_source_path "sf/app/musicplayer" >
+]> 
+
+<SystemDefinition name="avdomain" schema="1.4.0">
+	<systemModel>
+  <!-- Common file for prebuild layers-->
+  	<layer name="app_layer">
+			<module name="musicplayer">
+				<unit unitID="musicplayer" mrp="" bldFile="&layer_real_source_path;/group" name="musicplayer" />
+			</module>
+    </layer>    
+
+    <layer name="api_test_layer">
+			<module name="musicplayer_tsrc">
+				<unit unitID="musicplayer_tsrc" name="musicplayer_tsrc" bldFile="&layer_real_source_path;/tsrc/group" mrp="" />
+			</module>
+    </layer>
+
+    <layer name="pref_test_layer">
+			<module name="musicplayer_tsrc_group">
+				<unit unitID="musicplayer_tsrc_group" name="musicplayer_tsrc_group" bldFile="&layer_real_source_path;/tsrc/group" mrp="" filter="TA_MUSICPLAYER" />
+			</module>
+    </layer>
+
+  	<layer name="app_musicplayer_layer">
+			<module name="musicplayer_group">
+				<unit unitID="musicplayer_group" mrp="" bldFile="&layer_real_source_path;/group" name="musicplayer_group" />
+			</module>
+    </layer>
+
+  </systemModel>
+</SystemDefinition>
\ No newline at end of file
Binary file mpxmusicplayer/Conf/mpxmusicplayer.confml has changed
Binary file mpxmusicplayer/Conf/mpxmusicplayer_101F880D.crml has changed
Binary file mpxmusicplayer/Conf/mpxmusicplayer_101FFCD0.crml has changed
Binary file mpxmusicplayer/Conf/mpxmusicplayer_101FFCD1.crml has changed
Binary file mpxmusicplayer/Conf/mpxmusicplayer_101FFCDC.crml has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/data/aiplayerplugin.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project aiplayerplugin
+*
+*/
+
+
+#include <aicontentpublisheruid.hrh>
+#include <ecom/registryinfov2.rh>
+#include "aiplayerpluginuids.hrh"
+
+// ---------------------------------------------------------------------------
+// registry_info
+// ECOM registry information
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO registry_info
+    {
+    resource_format_version = RESOURCE_FORMAT_VERSION_2;
+    dll_uid = AI_UID_ECOM_DLL_CONTENTPUBLISHER_PLAYERPLUGIN;
+
+    // Interface info array
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of the implemented interface
+            interface_uid = AI_UID_ECOM_INTERFACE_CONTENTPUBLISHER;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid  =  AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_PLAYERPLUGIN;
+                    version_no          =  1;
+                    display_name        =  "PlayerPlugin";
+                    default_data        =  "";
+                    opaque_data         =  " ";
+                    rom_only            =  1;
+                    }
+                };
+            }
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/data/aiplayerpluginresource.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project aiplayerplugin
+*
+*/
+
+
+NAME MPAI
+
+#include <avkon.rh>
+#include <eikon.rh>
+#include <aiplayerplugin.loc>
+
+RESOURCE RSS_SIGNATURE { }
+RESOURCE TBUF { buf=""; }
+
+// ---------------------------------------------------------------------------
+// ?resource_name
+// ?description
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_aipp_unknown_artist
+    {
+    buf = qtn_aipp_unknown_artist;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/group/aiplayerplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project aiplayerplugin
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET              aiplayerplugin2.dll
+TARGETTYPE          PLUGIN
+UID                 0x10009D8D 0x10207B72
+
+CAPABILITY          CAP_ECOM_PLUGIN
+VENDORID            VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH          ../src
+SOURCE              aiplayerplugin.cpp
+SOURCE              aiplayerpluginengine.cpp
+
+SOURCEPATH          ../data
+START RESOURCE      aiplayerplugin.rss
+TARGET              aiplayerplugin2.rsc
+LANGUAGE_IDS
+END
+
+SOURCEPATH          ../data
+START RESOURCE      aiplayerpluginresource.rss
+TARGETPATH          APP_RESOURCE_DIR
+HEADER
+LANGUAGE_IDS 
+END
+
+USERINCLUDE         ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY             euser.lib
+LIBRARY             ecom.lib
+LIBRARY             avkon.lib
+LIBRARY             ws32.lib
+LIBRARY             cone.lib
+LIBRARY             efsrv.lib   		// TParse
+LIBRARY             bafl.lib   		// BaflUtils
+LIBRARY             estor.lib    		// RWriteStream
+LIBRARY             aiutils.lib
+LIBRARY             commonengine.lib  	// stringloader
+LIBRARY             apgrfx.lib              // TaskList
+LIBRARY             apparc.lib		// StartApp
+LIBRARY             mpxcommon.lib           // mpxparameter
+LIBRARY             mpxplaybackutility.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project aiplayerplugin
+*
+*/
+
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+#ifdef RD_CUSTOMIZABLE_AI
+../loc/aiplayerplugin.loc	    APP_LAYER_LOC_EXPORT_PATH(aiplayerplugin.loc)
+#endif
+
+PRJ_MMPFILES
+#ifdef RD_CUSTOMIZABLE_AI
+aiplayerplugin.mmp
+#endif
+
+PRJ_TESTMMPFILES
+
+PRJ_TESTEXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/inc/aiplayerplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  AI ecom plugin class. Main interface to XML AI framework.
+*
+*/
+
+
+#ifndef C_AIPLAYERPLUGIN_H
+#define C_AIPLAYERPLUGIN_H
+
+// INCLUDES
+#include <aicontentpublisher.h>
+#include <aicontentobserver.h>
+#include <aipropertyextension.h>
+#include <aieventhandlerextension.h>
+
+#include "aiplayerpluginengine.h"
+#include "aiplayerpluginengineobserver.h"
+
+class MAiPluginSettings;
+class MAiContentObserver;
+class MAiContentItemIterator;
+class CCoeEnv;
+
+
+/**
+ *  Music Player Player Plugin.
+ *  This class implements AI ecom plugin. This is the main interface to
+ *  the XML AI framework.
+ *
+ *  @lib aiplayerplugin2.lib
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CAiPlayerPlugin ) : public CAiContentPublisher,
+                                       public MAiPropertyExtension,
+                                       public MAiEventHandlerExtension,
+                                       public MAiPlayerPluginEngineObserver
+    {
+public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CAiPlayerPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAiPlayerPlugin();
+
+public:
+
+    /**
+     * From CAiContentPublisher
+     * See aicontentpublisher.h for detailed description.
+     * @since S60 5.0
+     */
+    void Resume( TAiTransitionReason aReason );
+    void Suspend( TAiTransitionReason aReason );
+    void Stop( TAiTransitionReason aReason );
+    void SubscribeL( MAiContentObserver& aObserver );
+    void ConfigureL( RAiSettingsItemArray& aSettings );
+    TAny* Extension( TUid aUid );
+
+    /**
+     * From MAiPropertyExtension
+     * See aipropertyextension.h for detailed description.
+     * @since S60 5.0
+     */
+    TAny* GetPropertyL( TInt aProperty );
+    void SetPropertyL( TInt aProperty, TAny* aValue );
+
+    /**
+     * From MAiEventHandlerExtension
+     * See aieventhandlerextension.h for detailed description.
+     * @since S60 5.0
+     */
+    void HandleEvent( TInt aEvent, const TDesC& aParam );
+
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * See aiplayerpluginengine.h for detailed description.
+     * @since S60 5.0
+     */
+    void PlayerStateChanged( TMPlayerState aState );
+    void TrackInfoChanged( const TDesC& aTitle, const TDesC& aArtist );
+    void PlaybackPositionChanged( TInt aPosition );
+    void VolumeChanged( TInt aVolume );
+
+private:
+
+    CAiPlayerPlugin();
+    void ConstructL();
+
+    /**
+     * Helper class for HandleEvent received from MAiEventHandlerExtension
+     */
+    void DoHandleEventL( TInt aEvent, const TDesC& aParam );
+
+    /**
+     * Callback function invoked through iCleanTimer upon timeout.
+     */
+	static TInt ClearL( TAny* aPtr );
+
+private:     // Data
+
+    RPointerArray<MAiContentObserver>   iObservers;
+    TAiPublisherInfo                    iInfo;
+    MAiContentItemIterator*             iContent;
+    MAiContentItemIterator*             iResources;
+    MAiContentItemIterator*             iEvents;
+
+    CAiPlayerPluginEngine*              iEngine;
+    TMPlayerState          				iState;
+
+    TBuf<128>                           iDuration;
+    TBuf<128>                           iElapsedTime;
+    HBufC*                              iLongFormatString;
+    HBufC*                              iShortFormatString;
+    HBufC*                              iUnknownArtistText;
+    TInt                                iResourceOffset;
+
+    CCoeEnv*                            iCoeEnv;                // Not owned
+    TBool 								iPlayStarted;
+    CPeriodic*  						iCleanTimer;
+    TInt                                iLastSetVolume;
+    };
+
+#endif  // C_AIPLAYERPLUGIN_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/inc/aiplayerplugincontentmodel.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  SDK, AI Player Plugin Content Model API
+*
+*/
+
+
+#ifndef AIPLPLCONTENTMODEL_H
+#define AIPLPLCONTENTMODEL_H
+
+#include <aicontentmodel.h>
+#include "aiplayerpluginuids.hrh"
+
+// Plug-in Implementation UID.
+const TInt KImplUidMusicPlayerPlugin = AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_PLAYERPLUGIN;
+const TUid KUidMusicPlayerPlugin = { KImplUidMusicPlayerPlugin };
+
+
+// ================================= CONTENT ===================================
+
+/**
+ * Content Ids
+ */
+enum TAiPlplContentIds
+    {
+     EAiPlplContentArtistCaption
+    ,EAiPlplContentTitleCaption
+    ,EAiPlplContentDurationCaption
+    ,EAiPlplContentVolume
+    ,EAiPlplContentStatus
+    ,EAiPlplContentElapsedTime
+    };
+
+/**
+ * Content that the plugin will publish
+ */
+const TAiContentItem KAiPlplContent[] =
+    {
+     { EAiPlplContentArtistCaption,   L"Artist",    KAiContentTypeText }
+    ,{ EAiPlplContentTitleCaption,    L"Title",     KAiContentTypeText }
+    ,{ EAiPlplContentDurationCaption, L"Duration",  KAiContentTypeText }
+     //Current volume level. Content needs to be re-published every time when volume is changed
+     //Always published as resource see KAiPlplResources \ VolumeLevel
+    ,{ EAiPlplContentVolume,   		  L"Volume",    KAiContentTypeText }
+     //Current player status. Content needs to be re-published every time when player status is changed.
+     //When player is stoped, the plug-in MUST publish empty item
+     //Always published as resource see KAiPlplResources \ Status
+    ,{ EAiPlplContentStatus,          L"Status",    KAiContentTypeBitmap }
+    ,{ EAiPlplContentElapsedTime,     L"ElapsedTime",KAiContentTypeText }
+    };
+
+
+// ================================ RESOURCES ==================================
+
+
+/**
+ * Resource Ids
+ */
+enum TAiPlplPluginResourceIds
+    {
+     EAiPlplResourceVol0
+    ,EAiPlplResourceVol1
+    ,EAiPlplResourceVol2
+    ,EAiPlplResourceVol3
+    ,EAiPlplResourceVol4
+    ,EAiPlplResourceVol5
+    ,EAiPlplResourceVol6
+    ,EAiPlplResourceVol7
+    ,EAiPlplResourceVol8
+    ,EAiPlplResourceVol9
+    ,EAiPlplResourceVol10
+    ,EAiPlplResourcePlayIcon
+    ,EAiPlplResourcePauseIcon
+    };
+
+/**
+ * Resources that the plugin will publish
+ */
+const TAiContentItem KAiPlplResources[] =
+    {
+    //UI resources that represents volume levels
+    { EAiPlplResourceVol0,     L"Vol0",       KAiContentTypeText }
+   ,{ EAiPlplResourceVol1,     L"Vol1",       KAiContentTypeText }
+   ,{ EAiPlplResourceVol2,     L"Vol2",       KAiContentTypeText }
+   ,{ EAiPlplResourceVol3,     L"Vol3",       KAiContentTypeText }
+   ,{ EAiPlplResourceVol4,     L"Vol4",       KAiContentTypeText }
+   ,{ EAiPlplResourceVol5,     L"Vol5",       KAiContentTypeText }
+   ,{ EAiPlplResourceVol6,     L"Vol6",       KAiContentTypeText }
+   ,{ EAiPlplResourceVol7,     L"Vol7",       KAiContentTypeText }
+   ,{ EAiPlplResourceVol8,     L"Vol8",       KAiContentTypeText }
+   ,{ EAiPlplResourceVol9,     L"Vol9",       KAiContentTypeText }
+   ,{ EAiPlplResourceVol10,   L"Vol10",       KAiContentTypeText }
+    
+    //UI resources that represents status
+   ,{ EAiPlplResourcePlayIcon,  L"PlayIcon",  KAiContentTypeBitmap }
+   ,{ EAiPlplResourcePauseIcon, L"PauseIcon", KAiContentTypeBitmap }
+    };
+
+// ============================ SERVICES (Events) ==============================
+
+/**
+ * Event Ids.
+ */
+enum TAiPlplEventIds
+    {
+     EAiPlplEventVolInc
+    ,EAiPlplEventVolDec
+    ,EAiPlplEventLaunchLibrary
+    ,EAiPlplEventVolSet
+    ,EAiPlplEventVolMute
+    ,EAiPlplEventVolRestore
+    };
+
+/**
+ * Services that the plugin can perform
+ */
+const TAiContentItem KAiPlplEvents[] =
+    {
+     { EAiPlplEventVolInc,         L"VolInc", "" }
+    ,{ EAiPlplEventVolDec,         L"VolDec", "" }
+    ,{ EAiPlplEventLaunchLibrary,  L"Library", "" }
+    ,{ EAiPlplEventVolSet,         L"VolSet", "" }
+    ,{ EAiPlplEventVolMute,        L"Mute", "" }
+    ,{ EAiPlplEventVolRestore,     L"Restore", "" }
+    };
+
+#endif // AIPLPLCONTENTMODEL_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/inc/aiplayerpluginengine.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Engine which interfaces to MPX framework.
+*
+*/
+
+
+#ifndef C_AIPLAYERPLUGINENGINE_H
+#define C_AIPLAYERPLUGINENGINE_H
+
+#include <e32base.h>
+#include <mpxplaybackobserver.h>
+
+#include "aiplayerpluginengineobserver.h"
+
+class MMPXPlaybackUtility;
+
+
+/**
+ *  Music Player Player Plugin Engine.
+ *  This class provides interface to MPX framework.
+ *
+ *  @lib aiplayerplugin2.lib
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CAiPlayerPluginEngine ) : public CBase,
+                                             public MMPXPlaybackObserver,
+                                             public MMPXPlaybackCallback
+    {
+public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CAiPlayerPluginEngine* NewL( MAiPlayerPluginEngineObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAiPlayerPluginEngine();
+
+    /**
+     * From MMPXPlaybackObserver
+     * See mpxplaybackobserver.h for detailed description.
+     * @since S60 5.0
+     */
+    void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+    /**
+     * From MMPXPlaybackCallback
+     * See mpxplaybackobserver.h for detailed description.
+     * @since S60 5.0
+     */
+    void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError );
+    void HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, TBool aComplete, TInt aError );
+    void HandleMediaL( const CMPXMedia& aMedia, TInt aError );
+    void HandlePlaybackCommandComplete( CMPXCommand* aCommandResult, TInt aError );
+
+public:
+
+    /**
+     * Get the current state of the active player.
+     *
+     * @return Active player state
+     * @see TMPlayerState
+     */
+    TMPlayerState PlayerState();
+
+    /**
+     * Get the title of the currently playing song.
+     *
+     * @return Song title
+     */
+    const TDesC& Title();
+
+    /**
+     * Get the artist of the currently playing song.
+     *
+     * @return Artist
+     */
+    const TDesC& Artist();
+
+    /**
+     * Get the current position.
+     *
+     * @return Current position.
+     */
+    TInt Position();
+
+    /**
+     * Get the duration of the currently playing song.
+     *
+     * @return Song duration.
+     */
+    TInt Duration();
+
+    /**
+     * Get the current volume.
+     *
+     * @return Current volume.
+     */
+    TInt Volume();
+
+    /**
+     * Set volume.
+     *
+     * @param aVolume Volume level
+     */
+    void SetVolumeL( TInt aVolume );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CAiPlayerPluginEngine( MAiPlayerPluginEngineObserver& aObserver );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     *  Handle playback message
+     *
+     *  @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+    /**
+     *  Handle playback property
+     *
+     *  @param aProperty the property
+     *  @param aValue the value of the property
+     *  @param aError error code
+     */
+    void DoHandlePropertyL( TInt aProperty, TInt aValue, TInt aError );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     */
+    void DoHandleStateChangedL( TMPXPlaybackState aState );
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    void HandleErrorL( TInt aError );
+
+    /**
+     *  Map states from TMPXPlaybackState to TMPlayerState
+     *
+     *  @param aState State in TMPXPlaybackState format
+     *  @return State in TMPlayerState format, or KErrNotFound
+     *          if the state can't be mapped
+     */
+    TMPlayerState MapState( TMPXPlaybackState aState );
+
+    /**
+     *  Map volume from MPX player to AI volume level.
+     *
+     *  @param aVolume Volume level from MPX player
+     *  @return Volume level for AI.
+     */
+    TInt MapToAiVolume( TInt aVolume );
+
+    /**
+     *  Map volume from AI to MPX player volume level.
+     *
+     *  @param aVolume Volume level from AI
+     *  @return Volume level for MPX player.
+     */
+    TInt MapToMpxVolume( TInt aVolume );
+    
+    /**
+     *  Request media.
+     */
+    void RequestMediaL();
+
+private:    // Data
+
+    MAiPlayerPluginEngineObserver* 	iObserver; 			// Not owned
+    MMPXPlaybackUtility* 			iPlaybackUtility; 	// Owned
+
+    HBufC*		iTitle;
+    HBufC*		iArtist;
+    TInt		iMaxVolume;
+    TInt		iVolume;
+    TInt		iPosition;
+    TInt		iDuration;
+    };
+
+#endif  // C_CAiPlayerPluginEngine_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/inc/aiplayerpluginengineobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c)  Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player stautus observer
+*
+*/
+
+
+#ifndef M_AIPLAYERPLUGINENGINEOBSERVER_H
+#define M_AIPLAYERPLUGINENGINEOBSERVER_H
+
+#include <e32std.h>
+
+/**
+ *  Player state.
+ */
+enum TMPlayerState
+    {
+    EMPlayerStatePlaying,
+    EMPlayerStatePaused,
+    EMPlayerStateSeeking,
+    EMPlayerStateOther
+    };
+
+/**
+ *  Observer interface to be implemented by a client of AiPlayerPluginEngine.
+ *
+ *  @lib aiplayerplugin2.lib
+ *  @since S60 5.0
+ */
+class MAiPlayerPluginEngineObserver
+    {
+public:
+
+    /**
+     * Called when active player instance's state changes
+     *
+     * @since S60 5.0
+     * @param aState Active player state
+     * @see TMPlayerState
+     */
+    virtual void PlayerStateChanged( TMPlayerState aState ) = 0;
+
+    /**
+     * Called when track info changes (i.e. track changes or current track's
+     * info is updated) in the active player instance.
+     *
+     * @since S60 5.0
+     * @param aTitle Current track's title.
+     * @param aArtist Current track's artist.
+     */
+    virtual void TrackInfoChanged( const TDesC& aTitle, const TDesC& aArtist ) = 0;
+
+    /**
+     * Called each second during playback.
+     *
+     * @since S60 5.0
+     * @param aPosition Current playback position in seconds.
+     */
+    virtual void PlaybackPositionChanged( TInt aPosition ) = 0;
+
+    /**
+     * Called when the player volume is changed.
+     *
+     * @since S60 5.0
+     * @param aVolume volume level.
+     */
+    virtual void VolumeChanged( TInt aVolume ) = 0;
+    };
+
+
+#endif // ?M_AIPLAYERPLUGINENGINEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/inc/aiplayerpluginuids.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project aiplayerplugin
+*
+*/
+
+
+#ifndef AIPLAYERPLUGINUIDS_HRH
+#define AIPLAYERPLUGINUIDS_HRH
+
+/** Ecom implementation uid for player plugin */
+#define AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_PLAYERPLUGIN 0x10207B73
+
+/** Ecom dll uid for player plugin */
+#define AI_UID_ECOM_DLL_CONTENTPUBLISHER_PLAYERPLUGIN 0x10207B72
+
+#endif // AIPLAYERPLUGINUIDS_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/loc/aiplayerplugin.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project aiplayerplugin
+*
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Text shown when artist is unknown
+// l:list_double_large_graphic_pane_t1_cp2
+// w:
+// r:5.0
+//
+#define qtn_aipp_unknown_artist "Unknown artist"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/src/aiplayerplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,632 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Active Idle player plug-in
+*
+*/
+
+
+#include <ecom/implementationproxy.h>
+#include <aiutility.h>
+
+#include <AknUtils.h>
+#include <StringLoader.h>
+#include <bautils.h>
+#include <avkon.rsg>
+
+#include <data_caging_path_literals.hrh> 	// KDC_APP_BITMAP_DIR
+#include <apgcli.h>           				// RApaLsSession
+#include <apacmdln.h>         				// CApaCommandLine
+#include <apgtask.h>
+
+#include <mpxlog.h>
+#include <mpxconstants.h> 					// KAppUidMusicPlayer
+#include <mpxparameter.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <aiplayerpluginresource.rsg>
+
+#include "aiplayerplugin.h"
+#include "aiplayerpluginuids.hrh"
+#include "aiplayerplugincontentmodel.h"
+
+_LIT(KMPXZeroDurationMark, "--");
+const TInt KMPXMinSecSeparatorIndex = 2;
+const TInt KMPXOneSecInMicroSecs = 1000000;
+const TInt KMPXOneHourInSeconds = 60*60;
+const TInt KMPXTimeIndicatorLength = 16;
+const TInt KPlayerMusicPlayerParameterGranularity = 50;
+_LIT( KMPXAiPlayerRscPath, "z:aiplayerpluginresource.rsc" );
+
+const TInt KMPlayerResumeWaitTime = 1000000; // 1.0s
+
+// ======== MEMBER FUNCTIONS ========
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::ConstructL
+// ----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::ConstructL()
+    {
+    MPX_DEBUG1("CAiPlayerPlugin::ConstructL() - begin");
+
+    iInfo.iUid = KUidMusicPlayerPlugin;
+    iInfo.iName.Copy(_L8("PlayerPlugin"));
+
+    iContent   = AiUtility::CreateContentItemArrayIteratorL(KAiPlplContent);
+    iResources = AiUtility::CreateContentItemArrayIteratorL(KAiPlplResources);
+    iEvents    = AiUtility::CreateContentItemArrayIteratorL(KAiPlplEvents);
+
+    // Read time format strings from AVKON resource
+    iLongFormatString = StringLoader::LoadL(R_QTN_TIME_DURAT_LONG_WITH_ZERO);
+    iShortFormatString = StringLoader::LoadL(R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO);
+
+    iCoeEnv = CCoeEnv::Static();
+
+    TParse parse;
+    parse.Set(KMPXAiPlayerRscPath, &KDC_APP_RESOURCE_DIR, NULL);
+    TFileName resourceFile;
+    resourceFile.Append(parse.FullName());
+    BaflUtils::NearestLanguageFile(iCoeEnv->FsSession(), resourceFile);
+    iResourceOffset = iCoeEnv->AddResourceFileL(resourceFile);
+    iUnknownArtistText = StringLoader::LoadL(R_MPX_QTN_AIPP_UNKNOWN_ARTIST);
+
+    iPlayStarted = EFalse;
+    iCleanTimer = CPeriodic::NewL(CActive::EPriorityStandard);
+
+    MPX_DEBUG1("CAiPlayerPlugin::ConstructL() - end");
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::NewL
+// ----------------------------------------------------------------------------
+//
+CAiPlayerPlugin* CAiPlayerPlugin::NewL()
+    {
+    CAiPlayerPlugin* self = new (ELeave) CAiPlayerPlugin;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::CAiPlayerPlugin
+// ----------------------------------------------------------------------------
+//
+CAiPlayerPlugin::CAiPlayerPlugin()
+    : iEngine(NULL)
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::~CAiPlayerPlugin()
+// ----------------------------------------------------------------------------
+//
+CAiPlayerPlugin::~CAiPlayerPlugin()
+    {
+    iObservers.Close();
+
+    Release( iContent );
+    Release( iResources );
+    Release( iEvents );
+
+    if ( iResourceOffset )
+        {
+        iCoeEnv->DeleteResourceFile(iResourceOffset);
+        }
+
+    delete iEngine;
+
+    delete iLongFormatString;
+    delete iShortFormatString;
+    delete iUnknownArtistText;
+
+    iCoeEnv = NULL;
+    iCleanTimer->Cancel();
+    delete iCleanTimer;
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::Resume
+// ----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::Resume( TAiTransitionReason aReason )
+    {
+    MPX_DEBUG1("CAiPlayerPlugin::ResumeL");
+    if ( !iEngine )
+        {
+        TRAPD(err, iEngine = CAiPlayerPluginEngine::NewL(*this));
+        if ( err == KErrNone )
+        	{
+			iState = iEngine->PlayerState();
+			PlayerStateChanged( iState );
+		    if (iState == EMPlayerStatePlaying || iState == EMPlayerStatePaused )
+				{
+				TrackInfoChanged( iEngine->Title(), iEngine->Artist() );
+				VolumeChanged( iEngine->Volume() );
+				PlaybackPositionChanged( iEngine->Position() );
+				}
+			}
+        }
+     else if ( aReason == EAiGeneralThemeChanged )
+        {
+        PlayerStateChanged( iEngine->PlayerState() );
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::Suspend
+// ----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::Suspend( TAiTransitionReason /*aReason*/ )
+    {
+    MPX_DEBUG1("CAiPlayerPlugin::Suspend");
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::Stop
+// ----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::Stop( TAiTransitionReason /*aReason*/ )
+    {
+    MPX_DEBUG1("CAiPlayerPlugin::Stop");
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::SubscribeL
+// ----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::SubscribeL( MAiContentObserver& aObserver )
+    {
+    MPX_DEBUG1("CAiPlayerPlugin::SubscribeL");
+    return iObservers.AppendL(&aObserver);
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::ConfigureL
+// ----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::ConfigureL( RAiSettingsItemArray& /*aSettings*/ )
+    {
+    MPX_DEBUG1("CAiPlayerPlugin::ConfigureL");
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::Extension
+// ----------------------------------------------------------------------------
+//
+TAny* CAiPlayerPlugin::Extension( TUid aUid )
+    {
+    if (aUid == KExtensionUidProperty)
+        {
+        return static_cast<MAiPropertyExtension*>(this);
+        }
+    else if (aUid == KExtensionUidEventHandler)
+        {
+        return static_cast<MAiEventHandlerExtension*>(this);
+        }
+    return NULL; // Requested extension not supported
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::GetPropertyL
+// ----------------------------------------------------------------------------
+//
+TAny* CAiPlayerPlugin::GetPropertyL( TInt aProperty )
+    {
+    switch (aProperty)
+        {
+        case EAiPublisherInfo:
+        return &iInfo;
+
+        case EAiPublisherContent:
+        return static_cast<MAiContentItemIterator*>(iContent);
+
+        case EAiPublisherResources:
+        return static_cast<MAiContentItemIterator*>(iResources);
+
+        case EAiPublisherEvents:
+        return static_cast<MAiContentItemIterator*>(iEvents);
+        }
+
+    User::Leave(KErrNotSupported);
+    return NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::SetPropertyL
+// ----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::SetPropertyL( TInt aProperty, TAny* aValue )
+    {
+    if (aValue)
+        {
+        switch (aProperty)
+            {
+            case EAiPublisherInfo:
+                {
+                const TAiPublisherInfo* info =
+                    static_cast<const TAiPublisherInfo*>(aValue);
+
+                iInfo.iUid.iUid = info->iUid.iUid;
+                iInfo.iName.Copy( info->iName );
+                }
+            break;
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::HandleEvent
+// ----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::HandleEvent( TInt aEvent, const TDesC& aParam )
+    {
+    MPX_DEBUG1("CAiPlayerPlugin::HandleEvent");
+    TRAPD(err, DoHandleEventL( aEvent, aParam ) );
+    if ( err != KErrNone )
+    	{
+		MPX_DEBUG2("CAiPlayerPlugin::HandleEvent err[%d]", err);
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::DoHandleEventL
+// ----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::DoHandleEventL( TInt aEvent, const TDesC& aParam )
+    {
+    MPX_DEBUG2("CAiPlayerPlugin::DoHandleEventL %d", aEvent);
+
+	TInt volume = iEngine->Volume();
+    switch (aEvent)
+        {
+        case EAiPlplEventVolInc:
+            {
+            iEngine->SetVolumeL(++volume);
+            iLastSetVolume = volume;
+            }
+            break;
+        case EAiPlplEventVolDec:
+            {
+            iEngine->SetVolumeL(--volume);
+            iLastSetVolume = volume;
+            }
+            break;
+    	case EAiPlplEventVolSet:
+    		{
+    		TLex lex;
+    		lex.Assign(aParam);
+    		if( lex.Val(volume) == KErrNone )
+    		    {
+        		iEngine->SetVolumeL(volume);
+    		    }
+            iLastSetVolume = volume;
+    		}
+        	break;
+    	case EAiPlplEventVolMute:
+    		{
+    		iLastSetVolume = volume;
+       		iEngine->SetVolumeL(0);
+    		}
+	        break;
+    	case EAiPlplEventVolRestore:
+    		{
+    		if( iLastSetVolume == 0 )
+    		    {
+    		    // So that "muting muted" don't function funky way.
+    		    iLastSetVolume = 1;
+    		    }
+       		iEngine->SetVolumeL(iLastSetVolume);
+    		}
+	        break;
+        case EAiPlplEventLaunchLibrary:
+            {
+            MPX_DEBUG1("CAiPlayerPlugin::DoHandleEventL() EAiPlplEventLaunchLibrary");
+            //Launch player
+            TApaTaskList tasList(iEikonEnv->WsSession());
+            TApaTask task = tasList.FindApp(KAppUidMusicPlayerX);
+            if (task.Exists())
+                {
+                MPX_DEBUG1("CAiPlayerPlugin::DoHandleEventL() Music app is already launched. Go to Now Playing view.");
+                RWsSession& wsSession( iCoeEnv->WsSession() );
+                CMPXParameter* param = new ( ELeave ) CMPXParameter();
+                CleanupStack::PushL( param );
+                param->iType.iUid = KMPXPluginTypePlaybackUid;
+                param->iCmdForward = EMPXCmdFwdNowPlaying;
+
+                MPX_DEBUG1( "CAiPlayerPlugin::DoHandleEventL start Externalize" );
+                CBufBase* buffer = CBufFlat::NewL( KPlayerMusicPlayerParameterGranularity );
+                CleanupStack::PushL( buffer );
+                RBufWriteStream writeStream( *buffer );
+                CleanupClosePushL( writeStream );
+                param->ExternalizeL( writeStream );
+                writeStream.CommitL();
+                buffer->Compress();
+                CleanupStack::PopAndDestroy( &writeStream );
+
+                MPX_DEBUG2( "CAiPlayerPlugin::DoHandleEventL start Send message, message size = %d", buffer->Size() );
+                wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX, buffer->Ptr( 0 ));
+                MPX_DEBUG1( "CAiPlayerPlugin::DoHandleEventL Send message complete" );
+                CleanupStack::PopAndDestroy( buffer );
+                CleanupStack::PopAndDestroy( param );
+                }
+            else
+                {
+				// Launch Music Player Application
+                MPX_DEBUG1("CAiPlayerPlugin::DoHandleEventL() Launch Music app for the first time");
+				RProcess process;
+				TApaAppInfo appInfo;
+				RApaLsSession session;
+				TInt res = session.Connect(); // Ignore error
+				CleanupClosePushL( session );
+				TInt err = session.GetAppInfo( appInfo, KAppUidMusicPlayerX );
+				if ( !err )
+						{
+						process.Create( appInfo.iFullName, KNullDesC );// Ignore error
+						TRAP( err,
+							{
+							CApaCommandLine* commandLine = CApaCommandLine::NewLC();
+							commandLine->SetDocumentNameL( KNullDesC );
+							commandLine->SetExecutableNameL( appInfo.iFullName );
+							commandLine->SetProcessEnvironmentL( process );
+							session.StartApp( *commandLine ); // Ignore error
+							CleanupStack::PopAndDestroy(); // commandLine
+							});
+						process.Resume();
+						process.Close();
+						}
+				CleanupStack::PopAndDestroy(); // Close RApaLsSession session
+                }
+            }
+            break;
+        default:
+        	break;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CAiPlayerPlugin::ClearL
+// ----------------------------------------------------------------------------
+//
+TInt CAiPlayerPlugin::ClearL(TAny* aPtr)
+	{
+    MPX_DEBUG1("CAiPlayerPlugin::ClearL");
+  	CAiPlayerPlugin* plugin = reinterpret_cast<CAiPlayerPlugin*> (aPtr);
+    for (TInt i = 0; i < plugin->iObservers.Count(); i++)
+    	{
+        MAiContentObserver* observer = plugin->iObservers[i];
+        observer->Clean((MAiPropertyExtension&) *plugin, EAiPlplContentArtistCaption, 1);
+        observer->Clean((MAiPropertyExtension&) *plugin, EAiPlplContentTitleCaption, 1);
+        observer->Clean((MAiPropertyExtension&) *plugin, EAiPlplContentDurationCaption, 1);
+        observer->Clean((MAiPropertyExtension&) *plugin, EAiPlplContentElapsedTime,1);
+        observer->Clean((MAiPropertyExtension&) *plugin, EAiPlplContentStatus, 1);
+        observer->Clean((MAiPropertyExtension&) *plugin, EAiPlplContentVolume,1);
+        observer->Commit(0);
+    	}
+    plugin->iCleanTimer->Cancel();
+    return KErrNone;
+	}
+
+// -----------------------------------------------------------------------------
+// CAiPlayerPlugin::PlayerStateChanged
+// -----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::PlayerStateChanged( TMPlayerState aState )
+    {
+    MPX_DEBUG2("CAiPlayerPlugin::PlayerStateChanged [%d]", aState);
+    iState = aState;
+    for (TInt i = 0; i < iObservers.Count(); i++)
+        {
+        MAiContentObserver* observer = iObservers[i];
+        observer->StartTransaction(reinterpret_cast<TInt32>(this));
+        switch(iState)
+            {
+            case EMPlayerStatePlaying:
+                {
+       			iPlayStarted = ETrue;
+       			iCleanTimer->Cancel();
+                observer->Publish(*this,
+                                  EAiPlplContentStatus,
+                                  EAiPlplResourcePlayIcon,
+                                  1);
+                }
+                break;
+            case EMPlayerStatePaused:
+                {
+       			iPlayStarted = ETrue;
+                iCleanTimer->Cancel();
+                observer->Publish(*this,
+                                  EAiPlplContentStatus,
+                                  EAiPlplResourcePauseIcon,
+                                  1);
+                PlaybackPositionChanged(iEngine->Position());
+                }
+                break;
+            case EMPlayerStateSeeking:
+                PlaybackPositionChanged(iEngine->Position());
+                break;
+            default:    // EMPlayerStateOther
+       			if ( iPlayStarted )
+       				{
+       				iCleanTimer->Start(KMPlayerResumeWaitTime,
+       			                        KMPlayerResumeWaitTime,
+       			                        TCallBack(ClearL,this));
+       				}
+       			iPlayStarted = EFalse;
+                break;
+            }
+        observer->Commit(reinterpret_cast<TInt32>(this));
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CAiPlayerPlugin::TrackInfoChanged
+// -----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::TrackInfoChanged( const TDesC& aTitle, const TDesC& aArtist )
+    {
+    MPX_DEBUG1("CAiPlayerPlugin::TrackInfoChanged");
+    for (TInt i = 0; i < iObservers.Count(); i++)
+        {
+        MAiContentObserver* observer = iObservers[i];
+        observer->StartTransaction(reinterpret_cast<TInt32>(this));
+
+        if ( &aTitle && aTitle.Length() ) //Check if hte reference exists add if is not empty
+            {
+            observer->Publish(*this, EAiPlplContentTitleCaption, aTitle, 1);
+            }
+        if ( &aArtist && aArtist.Length() ) //Check if hte reference exists add if is not empty
+            {
+            observer->Publish(*this, EAiPlplContentArtistCaption, aArtist, 1);
+            }
+        else
+            {
+            observer->Publish(*this, EAiPlplContentArtistCaption, *iUnknownArtistText, 1);
+            }
+        observer->Commit(reinterpret_cast<TInt32>(this));
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CAiPlayerPlugin::PlaybackPositionChanged
+// -----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::PlaybackPositionChanged( TInt aPosition )
+    {
+    MPX_DEBUG1("CAiPlayerPlugin::PlaybackPositionChanged");
+
+    TBuf<KMPXTimeIndicatorLength> elapsed;
+    TBuf<KMPXTimeIndicatorLength> total;
+
+    TInt64 playbackPosInSeconds;
+    TInt64 totalLengthInSeconds;
+
+    playbackPosInSeconds = aPosition;
+    totalLengthInSeconds = iEngine->Duration();
+
+    TPtrC format = *iShortFormatString;
+
+    if (totalLengthInSeconds >= KMPXOneHourInSeconds)
+        {
+        // For tracks longer than an hour we use different time format and a
+        // slightly different layout which has more space for the time labels.
+        format.Set(*iLongFormatString);
+        }
+
+    TTime elapsedTime(playbackPosInSeconds * KMPXOneSecInMicroSecs);
+    TTime totalTime(totalLengthInSeconds * KMPXOneSecInMicroSecs);
+
+    if (aPosition == 0)
+    	{
+    	totalLengthInSeconds = 0;
+    	}
+
+    // Convert total playing time to texts.
+    elapsedTime.FormatL(elapsed, format);
+
+    if (totalLengthInSeconds)
+        {
+        // Time remaining
+        totalTime.FormatL(total, format);
+        }
+    else
+        {
+        // Time remaining: --:--
+        TLocale locale;
+        TBuf<KMPXTimeIndicatorLength> pos;
+        TChar separator = locale.TimeSeparator(KMPXMinSecSeparatorIndex);
+        total = KMPXZeroDurationMark;
+        total.Append(separator);
+        total += KMPXZeroDurationMark;
+        }
+
+    AknTextUtils::LanguageSpecificNumberConversion(elapsed);
+    AknTextUtils::LanguageSpecificNumberConversion(total);
+
+    iElapsedTime.Copy(elapsed);
+
+    iDuration.Copy(elapsed);
+    iDuration.Append(_L("/"));
+    iDuration.Append(total);
+
+    if ( iState == EMPlayerStatePlaying || iState == EMPlayerStatePaused || iState == EMPlayerStateSeeking )
+        {
+        for (TInt i = 0; i < iObservers.Count(); i++)
+            {
+            MAiContentObserver* observer = iObservers[i];
+            observer->StartTransaction(reinterpret_cast<TInt32>(this));
+
+            //for (Classic view)
+            observer->Publish(*this,
+                           EAiPlplContentElapsedTime,
+                           iElapsedTime,
+                           1);
+
+            //for (Navibar view)
+            observer->Publish(*this,
+                           EAiPlplContentDurationCaption,
+                           iDuration,
+                           1);
+
+            observer->Commit(reinterpret_cast<TInt32>(this));
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CAiPlayerPlugin::VolumeChanged
+// -----------------------------------------------------------------------------
+//
+void CAiPlayerPlugin::VolumeChanged( TInt aVolume )
+    {
+    MPX_DEBUG1("CAiPlayerPlugin::VolumeChanged");
+
+    for (TInt i = 0; i < iObservers.Count(); i++)
+        {
+        MAiContentObserver* observer = iObservers[i];
+        observer->StartTransaction(reinterpret_cast<TInt32>(this));
+
+        // Order of enum TAiPlplPluginResourceIds is important
+        // must stay EAiPlplResourceVol0= 0 ... EAiPlplResourceVol10 = 10
+        // for this to work
+        if ( aVolume>=0 && aVolume<=10 )
+            {
+            observer->Publish(*this,
+                              EAiPlplContentVolume,
+                              aVolume,
+                              1);
+            }
+        observer->Commit(reinterpret_cast<TInt32>(this));
+        }
+    }
+
+// ======== GLOBAL FUNCTIONS ========
+
+// Provide a key pair value table for ECOM.
+// Used to identify the correct construction function for the requested interface.
+const TImplementationProxy ImplementationTable[] =
+{
+    IMPLEMENTATION_PROXY_ENTRY( AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_PLAYERPLUGIN,
+                                CAiPlayerPlugin::NewL )
+};
+
+
+// Return an instance of the proxy table.
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+{
+    aTableCount = sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/aiplayerplugin/src/aiplayerpluginengine.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,514 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player stautus observer
+*
+*/
+
+
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxmedia.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessagedefs.h>
+#include <mpxlog.h>
+
+#include "aiplayerpluginengine.h"
+
+const TInt KMPXOneSecInMilliSecs( 1000 );
+const TInt KVolumeLevelMin = 0;
+const TInt KVolumeLevelMax = 10;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::ConstructL()
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::ConstructL");
+    // Get the playback utility instance from engine.
+    iPlaybackUtility = MMPXPlaybackUtility::NewL( KPbModeActivePlayer, this );
+    
+    TMPXPlaybackState state( EPbStateNotInitialised ); 
+    
+    // Not fatal error if fetching the playback state fails
+    TRAP_IGNORE( state = iPlaybackUtility->StateL() );
+    
+    if( state != EPbStateNotInitialised &&
+        state != EPbStateInitialising )
+    	{
+    	// Playback is already ongoing. We aren't going to receive EMediaChanged
+    	// for the current song so we need manually update the media info   
+    	RequestMediaL();
+    	}
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::NewL
+// ---------------------------------------------------------------------------
+//
+CAiPlayerPluginEngine* CAiPlayerPluginEngine::NewL( MAiPlayerPluginEngineObserver& aObserver )
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::NewL");
+    CAiPlayerPluginEngine* self = new ( ELeave ) CAiPlayerPluginEngine( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::CAiPlayerPluginEngine
+// ---------------------------------------------------------------------------
+//
+CAiPlayerPluginEngine::CAiPlayerPluginEngine( MAiPlayerPluginEngineObserver& aObserver )
+    : iObserver( &aObserver ),
+      iPlaybackUtility(NULL),
+      iTitle(NULL),
+      iArtist(NULL),
+      iMaxVolume(KVolumeLevelMax),
+      iVolume(KErrNotFound),
+      iPosition(KErrNotFound),
+      iDuration(KErrNotFound)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::~CAiPlayerPluginEngine
+// ---------------------------------------------------------------------------
+//
+CAiPlayerPluginEngine::~CAiPlayerPluginEngine()
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::~CAiPlayerPluginEngine");
+    if ( iPlaybackUtility )
+        {
+        iPlaybackUtility->Close();
+        }
+    delete iTitle;
+    delete iArtist;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError )
+    {
+    DoHandlePropertyL( aProperty, aValue, aError );
+    }
+
+// ---------------------------------------------------------------------------
+// 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 CAiPlayerPluginEngine::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandleMediaL( const CMPXMedia& aMedia, TInt aError )
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::HandleMediaL");
+    if ( KErrNone == aError )
+        {
+		delete iTitle;
+		iTitle = NULL;
+        if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) )
+            {
+            iTitle = (aMedia.ValueText( KMPXMediaGeneralTitle )).AllocL();
+            }
+        else if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
+            {
+            TParsePtrC filePath( aMedia.ValueText( KMPXMediaGeneralUri ) );
+            iTitle = (filePath.Name()).AllocL();
+            }
+		delete iArtist;
+		iArtist = NULL;
+		iArtist = (aMedia.ValueText( KMPXMediaMusicArtist )).AllocL();
+
+        iObserver->TrackInfoChanged( *iTitle, *iArtist );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle completion of a asynchronous command
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandlePlaybackCommandComplete( CMPXCommand* /*aCommandResult*/, TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Get the current state of the active player
+// ---------------------------------------------------------------------------
+//
+TMPlayerState CAiPlayerPluginEngine::PlayerState()
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::PlayerState");
+    TMPXPlaybackState state( EPbStateNotInitialised );
+    TRAP_IGNORE( state = iPlaybackUtility->StateL() );
+    return MapState( state );
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::Title
+// ---------------------------------------------------------------------------
+//
+const TDesC& CAiPlayerPluginEngine::Title()
+    {
+    if ( iTitle )
+        {
+        return *iTitle;
+        }
+     else
+        {
+        return KNullDesC;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::Artist
+// ---------------------------------------------------------------------------
+//
+const TDesC& CAiPlayerPluginEngine::Artist()
+    {
+    if ( iArtist )
+        {
+        return *iArtist;
+        }
+     else
+        {
+        return KNullDesC;
+        }
+    }
+
+// ----------------------------------------------------
+// CAiPlayerPluginEngine::Position
+// ----------------------------------------------------
+//
+TInt CAiPlayerPluginEngine::Position()
+    {
+    return iPosition;
+    }
+
+// ----------------------------------------------------
+// CAiPlayerPluginEngine::Duration
+// ----------------------------------------------------
+//
+TInt CAiPlayerPluginEngine::Duration()
+    {
+    return iDuration;
+    }
+
+// ----------------------------------------------------
+// CAiPlayerPluginEngine::Volume
+// ----------------------------------------------------
+//
+TInt CAiPlayerPluginEngine::Volume()
+    {
+    return iVolume;
+    }
+
+// ----------------------------------------------------
+// CAiPlayerPluginEngine::SetVolumeL
+// ----------------------------------------------------
+//
+void CAiPlayerPluginEngine::SetVolumeL( TInt aValue )
+    {
+	MPX_DEBUG2("CAiPlayerPluginEngine::SetVolumeL(%d)", aValue );
+    if ( aValue == iVolume )
+        {
+        return;
+        }
+    if ( aValue < KVolumeLevelMin || aValue > KVolumeLevelMax )
+        {
+        User::Leave(KErrArgument);
+        }
+    else
+        {
+       	// iVolume will be updated upon callback DoHandlePropertyL
+        iPlaybackUtility->SetL( EPbPropertyVolume, MapToMpxVolume(aValue) ) ;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::DoHandlePlaybackMessageL");
+
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        MPX_DEBUG2("CAiPlayerPluginEngine::DoHandlePlaybackMessageL(%d)", event );
+        switch ( event )
+            {
+            case TMPXPlaybackMessage::EPropertyChanged:
+                {
+                TInt error( KErrNone );
+                DoHandlePropertyL(
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ),
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ),
+                    error );
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+				TMPXPlaybackState state( aMessage.ValueTObjectL<TMPXPlaybackState>( KMPXMessageGeneralType ));
+                MPX_DEBUG2("CAiPlayerPluginEngine::HandlePlaybackMessageL - EStateChanged(%d)", state);
+
+                DoHandleStateChangedL( state );
+                break;
+                }
+            case TMPXPlaybackMessage::EMediaChanged:
+            case TMPXPlaybackMessage::EPlaylistUpdated:
+                {
+                iPlaybackUtility->PropertyL( *this, EPbPropertyPosition );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyDuration );
+                RequestMediaL();
+                break;
+                }
+            case TMPXPlaybackMessage::ECommandReceived:
+                {
+                MPX_DEBUG2("CAiPlayerPluginEngine::HandlePlaybackMessageL - ECommandReceived(%d)",
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+                break;
+                }
+            case TMPXPlaybackMessage::EActivePlayerChanged:
+                {
+                MPX_DEBUG3("CAiPlayerPluginEngine::HandlePlaybackMessageL - EActivePlayerChanged(%d, %d)",
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ), 
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyPosition );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyDuration );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyMaxVolume );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyVolume );
+                DoHandleStateChangedL( iPlaybackUtility->StateL() );
+                // refresh media property
+                RequestMediaL();
+                break;
+                }
+            case TMPXPlaybackMessage::EDownloadStateChanged:
+                {
+                iPlaybackUtility->PropertyL( *this, EPbPropertyPosition );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyDuration );
+                RequestMediaL();
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::DoHandlePropertyL( TInt aProperty, TInt aValue, TInt aError )
+    {
+    MPX_DEBUG4("CAiPlayerPluginEngine::DoHandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError );
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty	)
+            {
+            case EPbPropertyPosition:
+                {
+				iPosition = aValue / KMPXOneSecInMilliSecs;
+                iObserver->PlaybackPositionChanged( iPosition );
+                break;
+                }
+            case EPbPropertyDuration:
+                {
+				iDuration = aValue / KMPXOneSecInMilliSecs;
+                break;
+                }
+            case EPbPropertyMaxVolume:
+                {
+                iMaxVolume = aValue;
+                break;
+                }
+            case EPbPropertyVolume:
+                {
+                TInt volume = MapToAiVolume(aValue);
+				if ( iVolume != volume )
+					{
+					iVolume = volume;
+					iObserver->VolumeChanged( iVolume );
+					}
+
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::DoHandleStateChangedL( TMPXPlaybackState aState )
+    {
+    TMPlayerState state = MapState( aState );
+    MPX_DEBUG3("CAiPlayerPluginEngine::DoHandleStateChangedL - State mapped from (%d) to (%d)", aState, state );
+    iObserver->PlayerStateChanged(state);
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandleErrorL( TInt aError )
+    {
+	MPX_DEBUG2("CAiPlayerPluginEngine::HandleErrorL(%d)", aError );
+    }
+
+// ---------------------------------------------------------------------------
+// Map states from TMPXPlaybackState to TMPlayerState
+// ---------------------------------------------------------------------------
+//
+TMPlayerState CAiPlayerPluginEngine::MapState( TMPXPlaybackState aState )
+    {
+	TMPlayerState state = EMPlayerStateOther;
+    switch ( aState )
+        {
+        case EPbStatePlaying:
+            state = EMPlayerStatePlaying;
+            break;
+        case EPbStatePaused:
+            state = EMPlayerStatePaused;
+            break;
+        case EPbStateSeekingForward:
+        case EPbStateSeekingBackward:
+            state = EMPlayerStateSeeking;
+            break;
+        default:
+            break;
+        }
+    return state;
+    }
+
+// ---------------------------------------------------------------------------
+// Maps volume from MPX player to AI volume.
+// ---------------------------------------------------------------------------
+//
+TInt CAiPlayerPluginEngine::MapToAiVolume( TInt aVolume )
+    {
+	TInt volume;
+	if ( iMaxVolume == KVolumeLevelMax )
+		{
+		// No need to translate
+		volume = aVolume;
+		}
+	else if ( aVolume == KVolumeLevelMin )
+		{
+		volume = KVolumeLevelMin;
+		}
+	else if ( aVolume == iMaxVolume )
+		{
+		volume = KVolumeLevelMax;
+		}
+	else
+		{
+		volume = (TInt) ((aVolume * KVolumeLevelMax) / iMaxVolume);
+		}
+	return volume;
+    }
+
+// ---------------------------------------------------------------------------
+// Maps volume from AI to MPX player volume.
+// ---------------------------------------------------------------------------
+//
+TInt CAiPlayerPluginEngine::MapToMpxVolume( TInt aVolume )
+    {
+	TInt volume;
+	if ( iMaxVolume == KVolumeLevelMax )
+		{
+		// No need to translate
+		volume = aVolume;
+		}
+	else if ( aVolume == KVolumeLevelMin )
+		{
+		volume = KVolumeLevelMin;
+		}
+	else if ( aVolume == KVolumeLevelMax )
+		{
+		volume = iMaxVolume;
+		}
+	else
+		{
+		volume = (TInt) ((aVolume * iMaxVolume) / KVolumeLevelMax);
+		}
+	return volume;
+    }
+
+// ---------------------------------------------------------------------------
+// Requests Media.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::RequestMediaL()
+    {
+    MMPXSource* s = iPlaybackUtility->Source();
+    if ( s )
+        {
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        attrs.Append( KMPXMediaGeneralUri );
+        attrs.Append( KMPXMediaGeneralTitle );
+        attrs.Append( KMPXMediaMusicArtist );
+        s->MediaL( attrs.Array(), *this );
+        CleanupStack::PopAndDestroy( &attrs );
+        }
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project Active Idle plugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../aiplayerplugin/group/bld.inf"
+
+PRJ_EXPORTS
+../rom/mpxactiveidleplugin.iby      CORE_APP_LAYER_IBY_EXPORT_PATH(mpxactiveidleplugin.iby)
+../rom/mpxactiveidlepluginrsc.iby   LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxactiveidlepluginrsc.iby)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/rom/mpxactiveidleplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for Player plugin
+*
+*/
+
+#ifndef MPXACTIVEIDLEPLUGIN_IBY
+#define MPXACTIVEIDLEPLUGIN_IBY
+
+#include <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+
+#ifdef RD_CUSTOMIZABLE_AI
+ECOM_PLUGIN( aiplayerplugin2.dll, aiplayerplugin2.rsc )
+#endif // RD_CUSTOMIZABLE_AI
+
+#endif // MPXACTIVEIDLEPLUGIN_IBY
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/activeidle/rom/mpxactiveidlepluginrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for Player plugin resource
+*
+*/
+
+
+#ifndef MPXACTIVEIDLEPLUGINRSC_IBY
+#define MPXACTIVEIDLEPLUGINRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+data=DATAZ_\APP_RESOURCE_DIR\aiplayerpluginresource.rsc     APP_RESOURCE_DIR\aiplayerpluginresource.rsc
+
+#endif  // MPXACTIVEIDLEPLUGINRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/data/mpx.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,268 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxmusicplayer
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MPXA // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+#include <appinfo.rh>
+#include <mpx.mbg>    
+#include <mpxpathconfiguration.hrh>
+
+#include <mpx.loc>
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// CONSTANTS  
+// Bitmap file path
+#define KMPXAifMifFile "\\resource\\apps\\mpx_aif.mif"
+#define KMPXAifMbmFile "\\resource\\apps\\mpx_aif.mbm"
+
+
+// RESOURCE DEFINITIONS 
+
+RESOURCE EIK_APP_INFO
+    {
+    status_pane = r_mpx_status_pane;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_localisable_app_info
+// Application info.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE LOCALISABLE_APP_INFO r_mpx_localisable_app_info
+    {
+    short_caption = qtn_apps_mplayer_grid;
+    caption_and_icon = 
+        CAPTION_AND_ICON_INFO
+            {
+            caption = qtn_apps_mplayer_grid;
+
+#ifdef __SCALABLE_ICONS
+            number_of_icons = 1;
+            icon_file = KMPXAifMifFile;
+#else // __SCALABLE_ICONS
+            number_of_icons = 2;
+            icon_file = KMPXAifMbmFile;
+#endif // __SCALABLE_ICONS
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_status_pane
+// Music Player's status pane.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE STATUS_PANE_APP_MODEL r_mpx_status_pane
+    {
+    layout = R_AVKON_STATUS_PANE_LAYOUT_USUAL;
+    panes = 
+        {   
+        SPANE_PANE
+            {
+            id = EEikStatusPaneUidTitle;
+            type = EAknCtTitlePane;
+            resource = r_mpx_overriden_app_name;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_save_song_confirmation_query
+// Confirmation query dialog for saving a song
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_save_song_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_video_call_ongoing
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_video_call_ongoing
+    {
+    buf = qtn_mus_info_video_call_ongoing;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_overriden_app_name
+// Overriden application name.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TITLE_PANE r_mpx_overriden_app_name
+    {
+    txt = " "; // Has to contain at least 1 character
+    }
+
+// -----------------------------------------------------------------------------
+//    r_mpx_targetfolder_attachment
+//    Folder used for saving attachments.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_targetfolder_attachment
+    {
+    buf = text_targetfolder_attachment;
+    }
+
+// -----------------------------------------------------------------------------
+//    r_mpx_targetfolder_downloads
+//    Folder used for saving downloads.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_targetfolder_downloads
+    {
+    buf = text_targetfolder_downloads;
+    }
+
+// -----------------------------------------------------------------------------
+//    r_mpx_targetfolder_ringtones
+//    Folder used for saving ringtones.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_targetfolder_ringtones
+    {
+    buf = text_targetfolder_ringtones;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_save_one_item_wait_note
+// Text for saving one item wait note
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_save_one_item_wait_note
+    {
+    buf = qtn_nmp_wait_save_one_item;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_saved_to_collection_note
+// Text for saved to collection
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_saved_to_collection_note
+    {
+    buf = qtn_nmp_note_saved_to_collection;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_saved_note
+// Text for saved to gallery
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_saved_note
+    {
+    buf = qtn_nmp_note_saved_to_gallery;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_query_conf_save_downloaded
+// Text for asking user to save
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_query_conf_save_downloaded
+    {
+    buf = qtn_iv_query_conf_save_downloaded;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_mpx_refresh_after_sync
+// Text for querying refresh after a usb transfer
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_refresh_after_sync
+    {
+    buf = qtn_nmp_note_library_refresh_sync;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_no_memory_info
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_no_memory_info
+    {
+    buf = qtn_memlo_ram_out_of_mem;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_query_yes_no
+//    Ask the user for a yes/no question
+//
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_query_yes_no
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_cannot_proceed_with_operation
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cannot_proceed_with_operation
+    {
+    buf = qtn_nmp_note_cannot_proceed_with_operation;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/data/mpx_reg.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxmusicplayer
+*
+*/
+
+
+
+#include <appinfo.rh>
+#include <bldvariant.hrh>
+#include <data_caging_paths_strings.hrh>
+#include <mpx.rsg>
+#include <mpxmusicplayer.hrh>
+
+
+UID2 KUidAppRegistrationResourceFile
+UID3 KMusicPlayerAppUidConstant
+
+#define EDataTypePriorityMPX 0xFFFA
+
+RESOURCE APP_REGISTRATION_INFO
+    {
+    app_file = "mpx";
+
+    localisable_resource_file = APP_RESOURCE_DIR"\\mpx";
+    localisable_resource_id = R_MPX_LOCALISABLE_APP_INFO;
+
+    embeddability = KAppEmbeddable;
+
+    // MIME types supported by the application
+    // Note: the audio/x-amr content-type header definition can be removed after 
+    //       official registration of the AMR format by the IANA registry.
+    datatype_list =
+        {
+#ifdef __SERIES60_MIDI
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-midi"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/midi"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/sp-midi"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-beatnik-rmf"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-rmf"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/rmf"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/mobile-xmf"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/vnd.nokia.mobile-xmf"; },
+#endif
+
+#ifdef __SERIES60_DRM
+        DATATYPE { priority = EDataTypePriorityMPX; type = "application/x-mrv.xml"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "application/x-mrv.wbxml"; },
+#endif
+
+#if (defined __WMA || defined __WINDOWS_MEDIA)
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-ms-wma"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "x-caf-audio/x-ms-wma"; },
+#endif
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-pn-realaudio"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-realaudio"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/vnd.rn-realaudio"; },
+//        DATATYPE { priority = EDataTypePriorityMPX; type = "application/vnd.rn-realmedia"; }
+#endif
+
+        DATATYPE { priority = EDataTypePriorityMPX; type = "playlist/mpegurl"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/mpeg"; }, 
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/mp3"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/m4a"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-mp3"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/3gpp"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/3gpp2"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/mp4"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/aac"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/basic"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/amr"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/amr-wb"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/awb"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-amr"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-epoc-wve"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-sibo-wve"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/wav"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-wav"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/x-au"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "audio/au"; },
+        DATATYPE { priority = EDataTypePriorityMPX; type = "application/vnd.nokia.ringing-tone"; }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxmusicplayer.
+*
+*/
+
+
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/mpxmusicplayerapp.iby            CORE_APP_LAYER_IBY_EXPORT_PATH(mpxmusicplayerapp.iby)
+../rom/mpxmusicplayerapprsc.iby         LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxmusicplayerapprsc.iby)
+../loc/mpx.loc	    			APP_LAYER_LOC_EXPORT_PATH(mpx.loc)
+
+
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpx_aif.mif
+OPTION HEADERFILE mpx.mbg
+OPTION SOURCES  -c8,8 qgn_menu_mp
+END
+
+PRJ_MMPFILES
+mpx.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/group/mpx.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxmusicplayer.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../inc/musicplayerbldvariant.hrh"
+
+TARGET          mpx.exe
+TARGETTYPE      exe
+UID             0x100039CE 0x102072C3  //Please do not Change 
+
+CAPABILITY      CAP_APPLICATION NetworkControl DRM
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+MACRO __S60_MPX_AIW_ASSIGN_AS
+MACRO __ENABLE_MSK
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+MACRO CAMESE_IN_DRM_UTILITY
+#ifdef IAD_INCLUDE_SINGLE_CLICK 
+MACRO SINGLE_CLICK_INCLUDED
+#endif
+
+// For BrCtl
+EPOCSTACKSIZE   0x10000
+//EPOCSTACKSIZE   0x5000
+EPOCHEAPSIZE    0x1000 0x1F00000
+
+SOURCEPATH      ../src
+SOURCE          mpxapp.cpp 
+SOURCE          mpxappui.cpp
+SOURCE          mpxdocument.cpp
+SOURCE          mpxrestorepath.cpp
+SOURCE          mpxcommandhandler.cpp
+SOURCE          mpxcontroller.cpp
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+SOURCE          mpxPDcommandhandler.cpp
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+START RESOURCE  ../data/mpx.rss
+TARGETPATH      APP_RESOURCE_DIR
+HEADER
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         aknnotify.lib  // Global note.
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib
+LIBRARY         ws32.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         commonui.lib
+LIBRARY         servicehandler.lib
+LIBRARY         commonengine.lib
+LIBRARY         estor.lib
+LIBRARY         apgrfx.lib
+LIBRARY         featmgr.lib
+LIBRARY         centralrepository.lib
+LIBRARY         sysutil.lib
+LIBRARY         PlatformEnv.lib
+LIBRARY         apmime.lib
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+LIBRARY         eikdlg.lib
+LIBRARY         mediatorclient.lib
+//#endif // __COVER_DISPLAY
+// Cover UI end
+
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcollectionhelper.lib
+LIBRARY         mpxmediakeyhandler.lib
+LIBRARY         mpxharvesterutility.lib 
+
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT
+LIBRARY         camesedrmhandler.lib
+#endif
+#ifdef FF_OOM_MONITOR2_COMPONENT
+LIBRARY oommonitor.lib
+#endif //FF_OOM_MONITOR2_COMPONENT
+LIBRARY iaupdateapi.lib  //IAD
+
+START RESOURCE ../data/mpx_reg.rss
+DEPENDS mpx.rsg
+// Do not change the UID below.
+TARGETPATH /private/10003a3f/apps
+END
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/group/mpxappuiiconsbitmaps.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,52 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  scalable icons makefile for project mpx
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpx_aif.mbm
+HEADERFILENAME=$(HEADERDIR)/mpx.mbg
+
+MAKMAKE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/c8,8 qgn_menu_mp_lst.bmp \
+		/c8,8 qgn_menu_mp_cxt.bmp
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : ;
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/group/mpxappuiiconsscalable.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  scalable icons makefile for project mpx
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpx_aif.mif
+HEADERFILENAME=$(HEADERDIR)/mpx.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/c8,8 qgn_menu_mp.svg
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/inc/mpxPDcommandhandler.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles commands passed in by other appilcations
+*
+*/
+
+
+#ifndef CMPXPDCOMMANDHANDLER_H
+#define CMPXPDCOMMANDHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxplaybackobserver.h>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxplaybackcommanddefs.h>
+
+// FORWARD DECLARATIONS
+class MMPXPlaybackUtility;
+class MMPXViewUtility;
+class CMPXParameter;
+class CMPXDrmMediaUtility;
+class CMPXCommonUiHelper;
+
+// CLASS DECLARATION
+/**
+ * Process commands passed in by other applications.
+ *
+ *  @lib mpx.exe
+ *  @since 3.1
+ */
+class CMPXPdCommandHandler : public CBase,
+                             public MMPXPlaybackObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since 3.1
+         * @param aPlaybackUtility Playback utility to use.
+         * @param aCollectionMode The collection mode for current music player
+         * @param aParameter The command to process.
+         * @return Pointer to newly created object.
+         */
+        static CMPXPdCommandHandler * NewL( MMPXPlaybackUtility* aPlaybackUtility );
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since 3.1
+         * @param aPlaybackUtility Playback utility to use.
+         * @param aCollectionMode The collection mode for current music player
+         * @param aParameter The command to process.
+         * @return Pointer to newly created object.
+         */
+        static CMPXPdCommandHandler * NewLC( MMPXPlaybackUtility* aPlaybackUtility );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMPXPdCommandHandler();
+
+
+        TInt HandleCommandParametersL( const TDesC8& aParameter );
+
+	    /**
+	     * Handle media key commands.
+	     *
+	     * @param aCommand Media key commands. see mpxappui.hrh
+	     */
+	    void HandleCommandL( TMPXPlaybackCommand aCommand );
+
+        /**
+         *  Current state of player
+         * 
+         *  @since 3.1
+         *  @return current PdPlaybackUtility state
+         */
+        TMPXPlaybackState PdStateL() const;
+        
+        TBool IsPlaybackCompleted();
+        
+    private:
+
+        /**
+         * C++ Constructor
+         *
+         */
+        CMPXPdCommandHandler(MMPXPlaybackUtility* aPlaybackUtility);
+
+        /**
+         * By default Symbian 2nd phase constructor is private.
+         *
+         */
+        void ConstructL();
+
+
+        /**
+         * From MMPXPlaybackObserver
+         * Handle playback message
+         *
+         * @param aMessage playback message
+         * @param aErr system error code.
+         */
+        void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+    private:  // New functions
+
+        /**
+         * Start processing the message
+         *
+         */
+        void DoHandleMessageL();
+
+        /**
+         * Handle playback message
+         *
+         * @param aMessage playback message
+         */
+        void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+        
+	    /**
+	     *  Handle playback state changed.
+	     *
+	     *  @param aState New Playback state
+	     */
+	    void DoHandleStateChangedL(
+	        TMPXPlaybackState aState );
+        
+
+        void ActivatePlaybackViewL();
+
+        void SendCustomCommandToMPXL( TUint aTransactionID, TMPXPlaybackPdCommand aCustomCmd );
+
+
+    private:
+
+        MMPXPlaybackUtility* iPdPlaybackUtility; // owned
+        MMPXPlaybackUtility* iPlaybackUtility; // owned
+
+        MMPXViewUtility* iViewUtility; // owned
+		CMPXDrmMediaUtility* iDrmMediaUtility; // owned
+		CMPXCommonUiHelper* iCommonUiHelper; // owned
+		TBool iPlaybackCompleted;
+		TBufC<KMaxFileName> iCurrentFileName;
+		TMPXPlaybackState iPrevousPlaybackState;
+
+    };
+
+#endif // CMPXPDCOMMANDHANDLER_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/inc/mpxapp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Application class required by AVKON application framework.
+*
+*/
+
+
+
+#ifndef CMPXAPP_H
+#define CMPXAPP_H
+
+
+// INCLUDES
+#include <aknapp.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  CMPXApp application class.
+ *
+ *  Provides factory to create concrete document object.
+ *
+ *  @lib mpx.exe
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXApp ) : public CAknApplication
+    {
+private:
+
+// from base class CApaApplication
+
+    /**
+     * From CApaApplication, creates CMPXDocument document object.
+     * @return A pointer to the created document object.
+     */
+    CApaDocument* CreateDocumentL();
+    
+    /**
+     * From CApaApplication, returns application's UID (defined in mpxconstants.h).
+     * @return The UID for music player application.
+     */
+    TUid AppDllUid() const;
+    };
+
+#endif // CMPXAPP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/inc/mpxappui.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,878 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Application UI class required by AVKON application architecture.
+*
+*/
+
+
+
+#ifndef CMPXAPPUI_H
+#define CMPXAPPUI_H
+
+
+// INCLUDES
+#include <e32std.h>
+#include <f32file.h>
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+#include <AknServerApp.h>
+#endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+#include <aknViewAppUi.h>
+#include <apparc.h>
+#include <AknProgressDialog.h>  // MProgressDialogCallback
+#ifdef FF_OOM_MONITOR2_COMPONENT
+#include <oommonitorsession.h>
+#endif
+#include <iaupdateobserver.h>  //IAD
+#include <mpxplaybackobserver.h>
+#include <mpxcollectionobserver.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxmediakeyhandlerobserver.h>
+#include <mpxviewactivationobserver.h>
+#include <mpxcollectionhelper.h>
+#include <mpxcollectionuihelperobserver.h>
+#include "mpxsavehelper.h"
+#include "mpxcontroller.h"
+
+// FORWARD DECLARATIONS
+class MMPXPlaybackUtility;
+class MMPXCollectionUtility;
+class MMPXViewUtility;
+class CMPXCommonUiHelper;
+class MMPXMediaKeyHandler;
+class CRepository;
+class CMPXRestorePath;
+class MMPXHarvesterUtility;
+class MMPXCollectionHelper;
+class CMPXCommandHandler;
+class CIdle;
+class CIAUpdate; //IAD
+class CIAUpdateParameters; //IAD
+//class CMPXController;
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+class CMediatorCommandInitiator;
+//#endif // __COVER_DISPLAY
+// Cover UI end
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+class CMPXPdCommandHandler;
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT
+class CCameseDrmHandler;
+#endif
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+class CDocumentHandler;
+#endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+
+// CLASS DECLARATION
+
+/**
+ * Application UI class.
+ * Provides support for the following features:
+ * - EIKON control architecture
+ * - view architecture
+ * - status pane
+ *
+ *  @lib mpx.exe
+ *  @since 3.1
+ */
+class CMPXAppUi : public CAknViewAppUi,
+                  public MMPXPlaybackObserver,
+                  public MMPXCollectionObserver,
+                  public MMPXCHelperEmbeddedOpenObserver,
+                  public MMPXMediaKeyHandlerObserver,
+                  public MMPXViewActivationObserver,
+                  public MMPXSaveHelperObserver,
+                  public MMPXCollectionHelperObserver,
+                  public MProgressDialogCallback,
+                  public MFileManObserver,
+                  public MMPXPlaybackCallback,
+                  public MIAUpdateObserver
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+                  ,public MAknServerAppExitObserver
+#endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXAppUi();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXAppUi();
+
+    /**
+     * This function is used for querying whether the application
+     * is launched in embedded mode or not.
+     * @since 3.1
+     * @return ETrue:  The application is launched in embedded mode.
+     *         EFalse: The application is launched in standalone mode.
+     */
+    TBool IsEmbedded() const;
+
+    /**
+     * Opens temporary playlist or album from buffer. Buffer contents are
+     * handled as album if the album name is provided.
+     * @since 3.1
+     * @param aBuffer Descriptor containing playlist contents (each track's
+     *                path is separated with a line feed "\n").
+     * @param aName Album name.
+     */
+    void OpenPlaylistFromBufferL(
+        const TDesC& aBuffer,
+        TDesC& aName );
+
+    /**
+     * Opens the specified file in response.
+     * @since 3.1
+     * @param aFileStore Not used
+     * @param aFile      File handle to open
+     */
+    void OpenFileL(
+        CFileStore*& aFileStore,
+        RFile& aFile,
+        const CAiwGenericParamList* aParams );
+
+    /**
+     * Make Phone/Idle/ActiveIdle come to foreground.
+     */
+    void ActivatePhoneAppL();
+
+    /**
+     * Function for deferred exit call back
+     *
+     * @param aPtr Pointer to self
+     * @return System wide error code
+     */
+    static TInt DeferredExitCallback( TAny* aPtr );
+
+private:
+
+    /**
+     * Start a waitnote dialog
+     */
+    void StartWaitNoteL( TWaitNoteType aNoteType );
+
+    /**
+     * Close the waitnote dialog
+     */
+    void CloseWaitNoteL( );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Handle media key commands.
+     *
+     * @param aCommand Media key commands. see mpxappui.hrh
+     */
+    void DoHandleMediaKeyCommandL( TMPXPlaybackCommand aCommand );
+
+    /**
+     * Control popup behaviour.
+     *
+     * @param aCommand Media key commands. see mpxappui.hrh
+     * @param aValue Parameter for aCommand
+     */
+    void HandlePopupL( TMPXPlaybackCommand aCommand );
+
+    /**
+     * Check if Active Idle app is on foreground.
+     *
+     * @return ETrue if idle app is in the foreground, EFalse otherwise.
+     */
+    TBool IsIdleAppForeground();
+
+    /**
+     * Check if Active Idle is enabled.
+     *
+     * @return ETrue if active idle is in the enabled, EFalse otherwise.
+     */
+    TBool IsActiveIdleEnabled();
+
+    /**
+     * Creates and initializes all member variables
+     */
+    void CreateMemberVariablesL();
+
+    /**
+     * Saves a file
+     */
+    void DoSaveL();
+
+    /**
+     * Creates a new save path filename
+     *
+     * @param aNewPath Contains new save path on return
+     */
+    void CreateAutomaticSavePathL( TFileName& aNewPath );
+
+    /**
+     * Handling to be done after save/add file is complete
+     */
+    void HandlePostSaveOperationL();
+    
+     /**
+     * Handles WMA DRM Protected Media
+     *
+     * @return ETrue if it's ok to open the document, EFalse otherwise.
+     */
+    TBool HandleWMAProtectionL();
+
+    /**
+     * Handles both OMA and WM DRM Protected Media
+     *
+     * @param aMedia Media object containing the rights information.
+     * @return ETrue if it's ok to open the document, EFalse otherwise.
+     */
+    TBool HandleDRMProtectionL(const CMPXMedia& aMedia);
+
+    /**
+     * Handles broadcast messages
+     */
+    void HandleBroadcastMessageL( const CMPXMessage& aMessage );
+
+    /**
+     * Handles commands passed in by other applications
+     */
+    void HandleCommandParametersL( const TDesC8& aCommand );
+
+    /**
+     * Handle playback message
+     *
+     * @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+    
+    #ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT
+    /**
+     * Handle Camese Playback PreProcessing
+     *
+     * @param aMessage playback message
+     * @param aSkipEvent whether App Ui should skip this event
+     */
+    void HandleCamesePlaybackPreProcessingL(const CMPXMessage& aMessage, TBool& aSkipEvent);
+   #endif
+
+
+    /**
+     * Handle Player Changed Playback Message
+     *
+     */
+    void HandlePlaybackPlayerChangedL();
+
+    /**
+     * Handle custom commands.
+     *
+     * @param aUid Command category Uid. Different command set will have
+     *             different Uid to avoid clash.
+     * @param aCommand Command to be handled.
+     */
+    void DoHandleCustomCommandL(
+        const TUid& aUid,
+        const TInt aCommand );
+
+    /**
+     * Callback function to signal that saving a file is complete
+     *
+     * @param aErr Error of the operation.
+     */
+    void DoHandleSaveCompleteL( TInt aErr );
+
+    /**
+     * Handle collection message
+     *
+     * @param aMessage collection message
+     */
+    void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+    /**
+     * Check if the Browser is closed.
+     *
+     * @param aParameter AIW parameter passed in by other applications
+     */
+    TBool IsBrowserClosed(const TDesC8& aParameter);
+
+    /**
+     * Brings the browser to the foreground.
+     *
+     * @return ETrue if browser was found, EFalse otherwise.
+     */
+
+    TBool BringUpBrowserL();
+#endif
+
+    /*
+    * Returns whether playback is remote i.e using UPNP.
+    * @return ETrue if playback is remote, EFalse otherwise.
+    */
+    TBool IsPlaybackRemote();
+
+    /*
+    * Sends a command to collection to set media
+    */
+    void SetMediaL( CMPXMedia& aMedia );
+// from base class MMPXPlaybackObserver
+
+    /**
+     * From MMPXPlaybackObserver
+     * Handle playback message
+     *
+     * @since 3.1
+     * @param aMessage playback message
+     * @param aErr system error code.
+     */
+    void HandlePlaybackMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+// from base class MMPXCollectionObserver
+
+    /**
+     * From MMPXCollectionObserver
+     * Handle media properties.
+     *
+     * @since 3.1
+     * @param aMedia  media properties.
+     * @param aError Error code.
+     */
+    void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+    /**
+     * From MMPXCollectionObserver
+     * Handle collection message.
+     *
+     * @since 3.1
+     * @param aMessage Collection message
+     * @param aErr system error code.
+     */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+    /**
+     * From MMPXCollectionObserver
+     * Handles the collection entries being opened.
+     *
+     * @since 3.1
+     * @param aEntries Collection entries opened.
+     * @param aIndex Focused entry.
+     * @param aComplete ETrue no more entries. EFalse more entries
+     *                  expected.
+     * @param aError Error code.
+     */
+    void HandleOpenL(
+        const CMPXMedia& aEntries,
+        TInt aIndex,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+     * From MMPXCollectionObserver
+     * Handles the item being opened.
+     *
+     * @since 3.1
+     * @param aPlaylist Collection playlist, owner ship is transfered.
+     * @param aError Error code.
+     */
+    void HandleOpenL(
+        const CMPXCollectionPlaylist& aPlaylist,
+        TInt aError );
+
+// from base class MMPXCHelperEmbeddedOpenObserver
+
+    /**
+    * From MMPXCHelperEmbeddedOpenObserver
+    * Handles errors from opening in embedded mode
+    *
+    * @since 3.1
+    * @param aErr Error code
+    * @param aCategory Type of item to be opened.
+    */
+    void HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory  );
+
+// from base class MMPXMediaKeyHandlerObserver
+
+    /**
+     * Handle media key commands.
+     *
+     * @since 5.0
+     * @param aCommand Command to be handled.
+     * @param aData data for the specific command
+     */
+    void HandleMediaKeyCommand(
+        const TMPXPlaybackCommand aCommand,
+        const TInt aData = KErrNotFound );
+
+// from base class MMPXViewActivationObserver
+
+    /**
+     * From MMPXViewActivationObserver
+     * Handle view activation.
+     *
+     * @since 3.1
+     * @param aCurrentViewType Current view type Uid.
+     * @param aPreviousViewType Previous view type Uid.
+     */
+    void HandleViewActivation(
+        const TUid& aCurrentViewType,
+        const TUid& aPreviousViewType );
+
+    /**
+     * @see MMPXViewActivationObserver
+     */
+    void HandleViewUpdate(
+        TUid aViewUid,
+        MMPXViewActivationObserver::TViewUpdateEvent aUpdateEvent,
+        TBool aLoaded,
+        TInt aData);
+
+// from base class CEikAppUi
+
+    /**
+     * From CEikAppUi
+     * opens the specified file in response to a corresponding message.
+     *
+     * @param aFileName File to be opened.
+     */
+    void OpenFileL( const TDesC& aFileName );
+
+    /**
+     * From CCoeAppUi
+     * called when event occurs of type EEventFocusLost or EEventFocusGained.
+     *
+     * @param aForeground ETrue if the application is in the foreground,
+     *                    otherwise EFalse.
+     */
+    void HandleForegroundEventL( TBool aForeground );
+
+    /**
+     * From CEikAppUi
+     * processes shell commands.
+     *
+     * @param aCommand The shell command sent to the application.
+     * @param aDocument Name The name of the document as
+                        specified on the command line
+     * @param aTail Tail end information in the command
+     * @return ETrue if the file exist, EFalse otherwise
+     */
+    TBool ProcessCommandParametersL(
+        TApaCommand aCommand,
+        TFileName& aDocumentName,
+        const TDesC8& aTail );
+
+    /**
+     * From CEikAppUi
+     * takes care of command handling.
+     *
+     * @param aCommand The ID of the command.
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * From CEikAppUi
+     * handle window server events.
+     *
+     * @param aEvent The window server event to be handled.
+     * @param aDestination The control associated with the event.
+     */
+    void HandleWsEventL(
+        const TWsEvent& aEvent,
+        CCoeControl* aDestination );
+
+    /**
+     * From CEikAppUi
+     * Handles window server messages.
+     *
+     * @param aClientHandleOfTargetWindowGroup The window group that the message
+     *                                         was sent to.
+     * @param aMessageUid The message UID.
+     * @param aMessageParameters The Message parameters.
+     * @return Indicates whether the message was handled or not.
+     */
+    MCoeMessageObserver::TMessageResponse HandleMessageL(
+        TUint32 aClientHandleOfTargetWindowGroup,
+        TUid aMessageUid,
+        const TDesC8& aMessageParameters );
+
+    /**
+     * From CEikAppUi
+     * Process message sent by another application
+     *
+     * @param aUid uid identifying the message.
+     * @param aParams The message to be processed.
+     */
+    void ProcessMessageL( TUid aUid, const TDesC8& aParams );
+
+    /**
+     * From CEikAppUi
+     * process command line parameter
+     *
+     * @param aCommandLine The message to be processed.
+     */
+    TBool ProcessCommandParametersL( CApaCommandLine& aCommandLine );
+
+
+// from base class MMPXSaveHelperObserver
+
+    /**
+     * From MMPXSaveHelperObserver
+     * Callback function to signal that saving a file is complete
+     *
+     * @since 3.1
+     * @param aErr Error of the operation.
+     */
+    void HandleSaveComplete( TInt aErr );
+
+// from base class MMPXCollectionHelperObserver
+
+    /**
+     * From MMPXCollectionHelperObserver
+     * Callback function to signal that adding a file is complete
+     *
+     * @since 3.1
+     * @param aErr Error of the operation.
+     */
+    void HandleAddFileCompleteL( TInt aErr );
+
+// from base class MProgressDialogCallback
+
+    /**
+     * From MProgressDialogCallback
+     * Callback method
+     * Gets called when a dialog is dismissed.
+     *
+     * @param aButtonId Button pressed for the dialog to be dismissed.
+     */
+    void DialogDismissedL( TInt aButtonId );
+
+// from base class MFileManObserver
+
+    /**
+     * From MFileManObserver
+     * Callback method
+     * Gets called during a file operation.
+     *
+     * @return Control status
+     */
+    MFileManObserver::TControl NotifyFileManOperation();
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+
+// from base class MAknServerAppExitObserver
+
+    /**
+     * From MAknServerAppExitObserver.
+     */
+    void HandleServerAppExit(TInt aReason);
+    /**
+     * Create a Forwards parameters that were passed by browser to media player
+     * If the new parameters is created successful, it will be leave on the CleanupStack
+     * @param aParamList the original parameter
+     * @return Forward parameters that is created.
+     */
+    CAiwGenericParamList* CreateForwardAiwParametersLC(const CAiwGenericParamList* aParamList) const;
+
+#endif // RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+
+    /**
+    * Update the refreshed time for music and podcast plugins
+    */
+    void DoUpdatePluginRefreshedTimeL();
+
+// from base class MMPXPlaybackCallback
+    /**
+    *  Handle playback property
+    *
+    *  @param aProperty the property
+    *  @param aValue the value of the property
+    *  @param aError error code
+    */
+    void HandlePropertyL(TMPXPlaybackProperty aProperty,
+                                 TInt aValue,
+                                 TInt aError);
+
+    /**
+    *  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
+    *
+    *  @param aPlayer UID of the subplayer
+    *  @param aSubPlayers a list of sub players
+    *  @param aComplete ETrue no more sub players. EFalse more subplayer
+    *                   expected
+    *  @param aError error code
+    */
+    void HandleSubPlayerNamesL(TUid aPlayer,
+                                       const MDesCArray* aSubPlayers,
+                                       TBool aComplete,
+                                       TInt aError);
+
+    /**
+    *  Call back of media request
+    *
+    *  @param aMedia media
+    *  @param aError error code
+    */
+    void HandleMediaL(const CMPXMedia& aProperties,
+                              TInt aError);
+
+    /**
+     *  Checks if the specified view is the active view
+     *
+     *  @param aViewType view identifier
+     *  @return ETRUE if the view is active, EFALSE otherwise
+     */
+    TBool IsActiveView(TInt aViewType );
+
+    /**
+     * Reopens the path in order to get the latest data.
+     *
+     */
+    void ReOpenPathL();
+
+    /**
+     * Suppress the collection view from coming up.
+     *
+     */
+    TBool SuppressCollectionView();
+
+    /**
+     *  Sets the playback volume.
+     *
+     *  @param aVolume volume value.
+     */
+    void SetVolume( const TInt aVolume );
+
+    /**
+     *  Mutes the playback volume.
+     */
+    void MuteVolume();
+
+    /**
+     *  Unmutes the playback volume.
+     */
+    void UnMuteVolume();
+
+    /**
+     *  Translates Playback commands to MPX commands
+     */
+    TInt MPXCmdForPbCmd( TMPXPlaybackCommand aCommand );
+
+    /**
+    *  if current heap memory is less than the lowest need of music player
+    *  music player well exit.
+    *
+    *  @param music player need memory
+    */
+    void CheckAvailableMemory( TInt aNeedMemory );
+
+#ifdef FF_OOM_MONITOR2_COMPONENT
+    /**
+     * Dynamically set music player's busy or mornal priority in OOM
+     * according to MPX playing state.
+     *
+     * @param aPriority     Correct priority to set.
+     */
+    void SetMpxOomPriorityL( ROomMonitorSession::TOomPriority aPriority );
+
+    /**
+    *  Check heap memory through OOM moudule.
+    *  If less than the lowest need of music player
+    *  music player will exit.
+    *
+    *  @param aNeedMemory   Memory needed by Music Player
+    */
+    void CheckAvailableMemoryByOomL( TInt aNeedMemory );
+#endif //    FF_OOM_MONITOR2_COMPONENT
+
+	/**
+	* Launch matrix menu Music suite with given message
+	*/
+	void LaunchMmViewL( const TDesC8& aMessage );
+
+    /**
+    * Check updates
+    */
+    void CheckUpdatesL(); //IAD
+
+    /**
+    * Clean IAD update parameters
+    */
+    void CleanUpdateParams(); //IAD
+
+
+    // from base class MIAUpdateObserver
+
+    /**
+    * This callback function is called when the update checking operation has completed.
+    *
+    * @param aErrorCode The error code of the observed update operation.
+    *                   KErrNone for successful completion,
+    *                   otherwise a system wide error code.
+    * @param aAvailableUpdates Number of the updates that were found available.
+    */
+    void CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates );
+
+    /**
+    * This callback function is called when an update operation has completed.
+    *
+    * @param aErrorCode The error code of the completed update operation.
+    *                   KErrNone for successful completion,
+    *                   otherwise a system wide error code.
+    * @param aResult Details about the completed update operation.
+    *                Ownership is transferred.
+    */
+    void UpdateComplete( TInt aErrorCode, CIAUpdateResult* aResultDetails );
+
+    /**
+    * This callback function is called when an update query operation has completed.
+    *
+    * @param aErrorCode The error code of the observed query operation.
+    *                   KErrNone for successful completion,
+    *                   otherwise a system wide error code.
+    * @param aUpdateNow ETrue informs that an update operation should be started.
+    *                   EFalse informs that there is no need to start an update
+    *                   operation.
+    */
+    void UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow );
+
+private:
+    enum TMPXSaveMode
+    {
+    EMPXSaveModeIdle = 0,
+    EMPXOpenAfterSave,
+    EMPXExitAppAfterSave,
+    EMPXExitHostAppAfterSave,
+    EMPXAssignRingtone,
+    EMPXAssignContact
+    };
+
+private: //Data
+
+    MMPXPlaybackUtility* iPlaybackUtility;  // own
+    MMPXCollectionUtility* iCollectionUtility;  // own
+    MMPXViewUtility* iViewUtility;  // own
+    MMPXHarvesterUtility* iHarvesterUtility;  // own
+    MMPXCollectionUiHelper* iCollectionUiHelper;  // own
+    MMPXCollectionHelper* iCollectionHelper;  // own
+
+    // RemCon target for receiving media key events
+    MMPXMediaKeyHandler* iMediaKeyHandler;  // own
+
+    CMPXCommonUiHelper* iCommonUiHelper;    // own
+    CMPXSaveHelper* iSaveHelper;    // own
+    CRepository* iSettingsRepository;  // own, for active idle setting
+
+    // Handle commands passed in from other applications
+    CMPXCommandHandler*  iProcessParameter; // own
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+    CMPXPdCommandHandler*  iPdParameterHandler; // own
+    TBool iAppStartedByBrowser;
+    TBool iPdPbvStartedByBrowser;
+    TBool icollectionBrowsed;
+    TBool iPbvStartedByBrowser;
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+    // Path backup and restore when music player is exited
+    CMPXRestorePath* iPathRestore; // own
+
+    // Music Player controller for System Events and startup check
+    CMPXController*  iController;
+
+    // Array of ring tone mime types for saving files
+    CDesCArrayFlat iRingToneMimeTypes; // own
+
+    HBufC* iSavePath;  // own
+
+    CIdle* iIdle; // own
+
+    RFile iFile;
+
+    TInt iOpenState;
+    TBool iIsUsbOnGoing; // USB status
+    TBool iFormattingOnGoing; // Formatting state
+    TBool iRefreshOnGoing;
+
+    // Flag whether or not playback was paused for save operation
+    TBool iPausedForSave;
+
+    TBool iInitedVolume;
+
+    TUid iPreviousViewType;  // previous view type
+    TUid iCurrentViewType;  // current view type
+
+    // UIDs for the music and podcast collection databases
+    TUid iMusicCollectionId;
+    TUid iPodcastCollectionId;
+
+    RArray<TUid> iDeferredViewActivationUid;
+
+    TInt iCurrentIndex;
+
+    TMPXSaveMode iSaveMode;
+
+    TBool iCancelFileMan;
+
+    TBool iStandAlone;
+
+    TInt iCurrentVolume;
+    TInt iMaxVolume;
+
+    TBool iUPnPUnavailableEventFromCollection;
+
+    TBool iDelayedParameterHandling;
+
+    TBool iIgnoreExternalCommand;
+
+    TBool iRefreshCollectionView;
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+    CMediatorCommandInitiator* iCommandInitiator;
+    TBool iCoverDisplay;
+//#endif
+// Cover UI end
+
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT
+    // Indicates we are handling Protected WMA Media on Open stage
+    TBool iHandlingProtectedWMAMedia;
+    CCameseDrmHandler* iCameseDrmHandler;       // own
+#endif
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    CDocumentHandler* iDocHandler;
+#endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+
+    TInt iCmdActivatedViewTypeId;
+
+    TBool iDisablePodcasting;
+    TBool iLaunchModePlaying;   // Launch mode specified in startup parameter
+    CIAUpdate* iUpdate;  // IAD client object
+    CIAUpdateParameters* iParameters; // Parameters for IAD update
+
+#ifdef FF_OOM_MONITOR2_COMPONENT
+    ROomMonitorSession::TOomPriority iOomPriority;
+#endif    // FF_OOM_MONITOR2_COMPONENT
+
+	TBool iStartInAlbumMenu;
+    };
+
+#endif  // CMPXAPPUI_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/inc/mpxcommandhandler.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,299 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles commands passed in by other appilcations
+*
+*/
+
+
+#ifndef CMPXCOMMANDHANDLER_H
+#define CMPXCOMMANDHANDLER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxcollectionobserver.h>
+#include <mpxplaybackobserver.h>
+
+// FORWARD DECLARATIONS
+class CMPXCollectionPath;
+class MMPXCollectionUtility;
+class MMPXPlaybackUtility;
+class MMPXViewUtility;
+class CMPXParameter;
+
+// CLASS DECLARATION
+/**
+ * Process commands passed in by other applications.
+ *
+ *  @lib mpx.exe
+ *  @since 3.1
+ */
+class CMPXCommandHandler : public CBase,
+                           public MMPXCollectionObserver,
+                           public MMPXPlaybackObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since 3.1
+         * @param aPlaybackUtility Playback utility to use.
+         * @param aCollectionMode The collection mode for current music player
+         * @param aParameter The command to process.
+         * @return Pointer to newly created object.
+         */
+        static CMPXCommandHandler * NewL(
+            MMPXPlaybackUtility* aPlaybackUtility,
+            TUid aCollectionMode,
+            const TDesC8& aParameter );
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since 3.1
+         * @param aPlaybackUtility Playback utility to use.
+         * @param aCollectionMode The collection mode for current music player
+         * @param aParameter The command to process.
+         * @return Pointer to newly created object.
+         */
+        static CMPXCommandHandler * NewLC(
+            MMPXPlaybackUtility* aPlaybackUtility,
+            TUid aCollectionMode,
+            const TDesC8& aParameter );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMPXCommandHandler();
+
+        /**
+         * Start processing the command
+         *
+         * @param aIsUsbInUse Current USB state, ETrue if it's in use,
+         *                    EFalse otherwise
+         * @param aRefreshing Current refresh state, ETrue if refresh ongoing,
+         *                    EFalse otherwise
+         */
+        void ProcessMessageL( TBool aIsUsbInUse, TBool aRefreshing, TBool aFormattingOnGoing );
+
+        /**
+         * Returns if a path has been inited in playback engine
+         *
+         * @return ETrue if a path has been inited, EFalse otherwise.
+         */
+        TBool IsPathInited();
+
+        /**
+         * Set current USB state
+         *
+         * @param aIsUsbInUse Current USB state, ETrue if it's in use,
+         *                    EFalse otherwise
+         */
+        void SetUsbInUse( TBool aIsUsbInUse );
+
+        /**
+         * Set current refresh state
+         *
+         * @param aRefreshing Current refresh state, ETrue if refresh ongoing,
+         *                    EFalse otherwise
+         */
+        void SetRefreshState( TBool aRefreshing );
+
+        /**
+         * Determines if the command should be handled by standalone mode.
+         * This does not forward the command, it just returns if it should
+         *
+         * @return ETrue if the command should be forwarded, EFalse otherwise
+         */
+        TBool ForwardCmdToStandAloneMode();
+
+        /**
+         * Determines if the command should be handled by now playing instance
+         * This does not forward the command, it just returns if it should
+         *
+         * @return ETrue if the command should be forwarded, EFalse otherwise
+         */
+        TBool ForwardCmdToNowPlaying();
+
+        /**
+         * Checks if initialize playback engine is needed for current command
+         *
+         * @return ETrue if init is needed, EFalse otherwise
+         */
+        TBool IsInitPlaybackEngineNeeded();
+
+        /**
+         * Extracts the activated view type from the command
+         *
+         * @return Activated view type ID
+         */
+        TInt ActivatedViewTypeId();
+
+    private:
+
+        /**
+         * C++ Constructor
+         *
+         * @param aPlaybackUtility Playback utility to use.
+         */
+        CMPXCommandHandler(
+            MMPXPlaybackUtility* aPlaybackUtility );
+
+        /**
+         * By default Symbian 2nd phase constructor is private.
+         *
+         * @param aCollectionMode The collection mode for current music player
+         * @param aParameter The command to process.
+         */
+        void ConstructL(
+            TUid aCollectionMode,
+            const TDesC8& aParameter );
+
+    // from base class MMPXCollectionObserver
+
+        /**
+         * From MMPXCollectionObserver
+         * Handle media properties.
+         *
+         * @since 3.1
+         * @param aMedia  media properties.
+         * @param aError Error code.
+         */
+        void HandleCollectionMediaL(
+            const CMPXMedia& aMedia,
+            TInt aError );
+
+        /**
+         * From MMPXCollectionObserver
+         * Handle collection message.
+         *
+         * @since 3.1
+         * @param aMessage Collection message
+         * @param aErr system error code.
+         */
+        void HandleCollectionMessage(
+            CMPXMessage* aMessage, TInt aError );
+
+        /**
+         * From MMPXCollectionObserver
+         * Handles the collection entries being opened.
+         *
+         * @since 3.1
+         * @param aEntries Collection entries opened.
+         * @param aIndex Focused entry.
+         * @param aComplete ETrue no more entries. EFalse more entries
+         *                  expected.
+         * @param aError Error code.
+         */
+        void HandleOpenL(
+            const CMPXMedia& aEntries,
+            TInt aIndex,
+            TBool aComplete,
+            TInt aError );
+
+        /**
+         * From MMPXCollectionObserver
+         * Handles the item being opened.
+         *
+         * @since 3.1
+         * @param aPlaylist Collection playlist, owner ship is transfered.
+         * @param aError Error code.
+         */
+        void HandleOpenL(
+            const CMPXCollectionPlaylist& aPlaylist,
+            TInt aError );
+
+        /**
+         * From MMPXPlaybackObserver
+         * Handle playback message
+         *
+         * @param aMessage playback message
+         * @param aErr system error code.
+         */
+        void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+    private:  // New functions
+
+        /**
+         * Initialize playback engine with the path provided
+         *
+         * @param aPath The collection path to initialize playback engine with.
+         */
+        void InitPlaybackEngineL( CMPXCollectionPath& aPath );
+
+        /**
+         * Start processing the message
+         *
+         */
+        void DoHandleMessageL();
+
+        /**
+         * Extracts the message from the paramter provided.  The message
+         * is internalized to iParameter
+         *
+         * @param aParameter Parameter to extract the message from.
+         */
+        void ExtractMessageL( const TDesC8& aParameter );
+
+        /**
+         * Handle playback message
+         *
+         * @param aMessage playback message
+         */
+        void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+        /**
+         * Handle collection message
+         *
+         * @param aMessage collection message
+         */
+        void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+
+    private: // enums
+
+        enum TMPXCollectionPlaylistSetupState
+            {
+            TMPXCollectionPlaylistSetupStateIdle,
+            TMPXCollectionPlaylistSetupStateOpenPath,
+            TMPXCollectionPlaylistSetupStateInitPlaybackEngine
+            };
+
+    private:
+
+        MMPXPlaybackUtility* iPlaybackUtility; // Not owned
+
+        MMPXCollectionUtility* iMusicPlayerCollectionUtility; //owned
+
+        MMPXViewUtility* iViewUtility; // owned
+
+        CMPXCollectionOpenUtility* iIsolatedIncOpenUtil; // owned
+
+        CMPXParameter* iParameter; //owned
+
+        TBool iUnhandledMessage;
+
+        TBool iPathInited;
+
+        TBool iUsbInUse;
+
+        TBool iRefreshOngoing;
+        TBool iLastPlayedAutostart;
+
+        TMPXCollectionPlaylistSetupState iCollectionPlaylistState;
+    };
+
+#endif // CMPXCOMMANDHANDLER_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/inc/mpxcontroller.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,233 @@
+/*
+* Copyright (c)  Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Controller for MPX Music player
+*
+*/
+
+
+#ifndef C_MPXCONTROLLER_H
+#define C_MPXCONTROLLER_H
+
+#include <mpxcollectionobserver.h>
+#include <coeaui.h>
+
+// Foward declarations
+class MMPXCollectionUtility;
+class MMPXViewUtility;
+class MMPXPlaybackUtility;
+class CAknQueryDialog;
+
+// Enumerations 
+//@FIX ME
+enum TWaitNoteType
+    {
+    EMPXScanningNote,
+    EMPXRefreshingNote,
+    EMPXMTPEventNote,
+    EMPXUsbEventNote,
+    EMPXOpeningNote,
+    EMPXMediaNotAvailableNote,
+    EMPXCorruptScanningNote,
+    EMPXFormatScanningNote,
+    EMPXNoteNotDefined
+    };
+    
+/**
+ *  Controller for handling system events and system startup
+ *
+ *  @lib mpx.exe
+ *  @since S60 3.2
+ */
+class CMPXController : public CBase,
+                       public MMPXCollectionObserver,
+                       public MCoeViewActivationObserver
+    {
+
+public:
+
+    /**
+    * Two-Phased constructor
+    */
+    static CMPXController* NewL( TBool aDisablePodcasting );
+
+    /**
+    * virtual destructor
+    */
+    virtual ~CMPXController();
+
+public: // New Functions
+    
+    /**
+    * Idle callback function
+    */
+    static TInt IdleCallback( TAny* ptr );
+    
+    /**
+    * Idle processing function
+    */
+    void HandleIdleEventL();
+
+private: // Inherited function 
+
+// From MMPXCollectionObserver
+    
+    /**
+     * From MMPXCollectionObserver
+     * Handle collection message.
+     *
+     * @param aMessage Collection message
+     * @param aErr system error code.
+     */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d a folder
+     *
+     *  @param aEntries collection entries opened
+     *  @param aIndex focused entry
+     *  @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     *  @param aError error code   
+     */
+    void HandleOpenL(
+        const CMPXMedia& aEntries,
+        TInt aIndex,
+        TBool aComplete,
+        TInt aError );
+    
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d an item. Client typically responds by
+     *  'playing' the item
+     *
+     *  @param aPlaylist collection path to item
+     *  @param aError error code   
+     */
+    void HandleOpenL(
+        const CMPXCollectionPlaylist& aPlaylist,
+        TInt aError );        
+
+    /**
+     *  
+     *  From MMPXCollectionObserver
+     *  Handle media properties
+     *  Notes: The client is responsible for delete the object of aProperties
+     *
+     *  @param aMedia media 
+     *  @param aError error code    
+     */
+    void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+    /**
+    * From MCoeViewActivationObserver
+    * Wait for view activation
+    */
+    void HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId,
+                               const TVwsViewId& aViewIdToBeDeactivated);
+
+private: // New functions
+
+    /**
+     * Start either the refresh or scanning note
+     */
+    void StartWaitNoteL( TWaitNoteType aNoteType );
+    
+    /**
+     * Close the waitnote dialog
+     * @param aSkipCheckIfActive - flags if the method should check if waitnote 
+     *                             is the current view 
+     */
+    void CloseWaitNoteL(TBool aSkipCheckIfActive = EFalse);
+    
+    /**
+    * Calls MediaL to retrieve item details
+    */ 
+    void DoRetrieveDetailsL(TBool aSkipAttribute = EFalse);
+
+    /**
+     * Handle collection message
+     * 
+     * @param aMessage collection message
+     */
+    void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+    
+    /**
+     * Handle a broadcast message event 
+     * from the collection framework
+     * @arg aEvent, event to handle
+     */
+    void DoHandleBroadcastMsgL( TInt aEvent );
+    
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    void HandleErrorL( TInt aError );
+    
+    /**
+     * Handle a corrupt message sent from the collection server
+     */
+    void DoHandleCorruptMsgL();
+    
+private:
+    
+    /**
+    * Constructor
+    */
+    CMPXController( TBool aDisablePodcasting );
+
+    /**
+    * 2nd phase constructor
+    */
+    void ConstructL();
+
+private: // data
+
+    // Member variables
+    MMPXCollectionUtility*      iCollectionUtility;
+    MMPXViewUtility*            iViewUtility;
+    MMPXPlaybackUtility*        iPlaybackUtility;
+    CIdle*                      iIdle;
+    
+    // States
+    TBool                       iDelayedRefreshForUIReady;
+    TBool                       iDelayedUsbRefresh;
+    TBool                       iRefreshingCollection;
+    TBool                       iInitDBNeeded;
+    TBool                       iInitDBCorrupted;
+    TBool                       iUIReady;
+    CMPXCollectionPath*         iCurPath;
+    
+    // Handling system events
+    CAknQueryDialog*            iQueryDialog;  // not owned, only for dismissal
+    TInt                        iCurSystemEvent;
+    TInt                        iCurPlugin;
+    TBool                       iOutOfDisk;
+    TBool                       iDiskDismountDuringFormat;
+    TBool                       iRestartWaitDialog;
+    TBool                       iDisablePodcasting;
+    
+    // Music and Podcast database ID
+    TUid iMusicCollectionId;
+    TUid iPodcastCollectionId;
+    };
+
+#endif // C_MPXCONTROLLER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/inc/mpxdocument.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Document class required by AVKON application framework.
+*
+*/
+
+
+
+#ifndef CMPXDOCUMENT_H
+#define CMPXDOCUMENT_H
+
+
+// INCLUDES
+#include <GenericParamConsumer.h>
+
+   
+// FORWARD DECLARATIONS
+class CEikAppUi;
+class MMPXViewUtility;
+
+
+// CLASS DECLARATION
+
+/**
+ *  CMPXDocument application class.
+ *
+ *  @lib mpx.exe
+ *  @since S60 v3.1
+ */
+class CMPXDocument : public CAiwGenericParamConsumer
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @param aApp AppUi of musicplayer.
+     * @return Pointer to newly created object.
+     */
+    static CMPXDocument* NewL( CEikApplication& aApp );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXDocument();
+
+private:
+
+    /**
+     * C++ constructor.
+     *
+     * @param aApp AppUi of musicplayer.
+     */
+    CMPXDocument( CEikApplication& aApp );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */  
+    void ConstructL();
+
+    /**
+     * Parse input paramaters from AIW interface.
+     * @return ETrue if open a file by framework is required. Otherwise, EFalse.
+     */  
+    TBool ParseInputParameters();
+
+// from base class CEikDocument
+
+    /**
+     * From CEikDocument.
+     * Create CMPXAppUi "App UI" object.
+     *
+     * @return Pointer to newly created object.
+     */
+    CEikAppUi* CreateAppUiL();
+
+    /**
+     * From CEikDocument.
+     * Called by the framework to open a file.
+     *
+     * @param aDoOpen ETrue to open an existing file, 
+                      EFalse to create a new default file.
+     * @param aFileName THe path and name of the file to open or create.
+     * @param aFs FIle server session to use.
+     * @return Pointer to newly created object.
+     */
+    CFileStore* OpenFileL( 
+        TBool aDoOpen,
+        const TDesC& aFilename,
+        RFs& aFs );
+
+    /**
+     * From CEikDocument.
+     * Called by the framework to open a file.
+     *
+     * @param aFileStore This is set by the function to the file 
+                         store that stores the main document, 
+                         if the file is a "native" Symbian OS file, 
+                         otherwise it is set to NULL.
+     * @param aFile The path and name of the file to read from
+     */
+    void OpenFileL(
+        CFileStore*& aFileStore, 
+        RFile& aFile );
+
+private:
+
+    MMPXViewUtility* iViewUtility;
+    };
+
+#endif  // CMPXDOCUMENT_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/inc/mpxrestorepath.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,259 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Saves/restores current playback path
+*
+*/
+
+
+#ifndef CMPXRESTOREPATH_H
+#define CMPXRESTOREPATH_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxcollectionobserver.h>
+#include <mpxplaybackobserver.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CMPXAppUi;
+class CMPXCollectionPath;
+class MMPXCollectionUtility;
+class MMPXPlaybackUtility;
+class MMPXCollectionUiHelper;
+class CMPXCollectionOpenUtility;
+
+// CLASS DECLARATION
+/**
+ * Saves/restores current playback path.
+ *
+ *  @lib mpx.exe
+ *  @since 3.1
+ */
+class CMPXRestorePath : public CBase,
+                        public MMPXCollectionObserver,
+                        public MMPXPlaybackObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since 3.1
+         * @param aPlaybackUtility Playback utility to use.
+         * @param aCollectionUiHelper UI helper to use
+         * @return Pointer to newly created object.
+         */
+        static CMPXRestorePath * NewL(MMPXPlaybackUtility* aPlaybackUtility,
+                                      MMPXCollectionUiHelper* aCollectionUiHelper);
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since 3.1
+         * @param aPlaybackUtility Playback utility to use.
+         * @param aCollectionUiHelper UI helper to use
+         * @return Pointer to newly created object.
+         */
+        static CMPXRestorePath * NewLC(MMPXPlaybackUtility* aPlaybackUtility,
+                                       MMPXCollectionUiHelper* aCollectionUiHelper);
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMPXRestorePath();
+
+    public: // New funtions
+
+        /**
+         *  Loads current collection path
+         */
+        void LoadPathL();
+
+        /**
+         * Loads the default collection path
+         * @param some delay to load the path (in ms)
+         */
+        void LoadDefaultPathL( TInt aDelay = 0 );
+
+        /**
+         * Save the current collection Path
+         */
+        void SavePathL();
+
+        /**
+         * Return if the default playlist has been initialized
+         *
+         * @return ETrue if the path has been initialized, EFalse otherwise;
+         */
+        TBool Initialized();
+
+        /**
+         * Return if the playlist is currently initializing
+         *
+         * @return ETrue it's currently initializing, EFalse otherwise;
+         */
+        TBool IsInitializing();
+
+        /**
+         * Set the initialized state
+         *
+         * @param aInit The current state of initialization.
+         */
+        void SetInitialized( TBool aInit );
+
+        /**
+         * Cancels the initialize operation
+         */
+        void CancelInit();
+        
+        /**
+         * Get the Uid of the root path 
+         */
+        TUid RooPathId();
+
+    private:
+
+        /**
+         * C++ Constructor
+         *
+         * @param aPlaybackUtility Playback utility to use.
+         * @param aCollectionUiHelper collection ui helper to use
+         */
+        CMPXRestorePath (MMPXPlaybackUtility* aPlaybackUtility,
+                         MMPXCollectionUiHelper* aCollectionUiHelper);
+
+        /**
+         * By default Symbian 2nd phase constructor is private.
+         */
+        void ConstructL();
+
+    // from base class MMPXCollectionObserver
+
+        /**
+         * From MMPXCollectionObserver
+         * Handle media properties.
+         *
+         * @since 3.1
+         * @param aMedia  media properties.
+         * @param aError Error code.
+         */
+        void HandleCollectionMediaL(
+            const CMPXMedia& aMedia,
+            TInt aError );
+
+        /**
+         * From MMPXCollectionObserver
+         * Handle collection message.
+         *
+         * @since 3.1
+         * @param aMessage Collection message
+         * @param aErr system error code.
+         */
+        void HandleCollectionMessage(
+            CMPXMessage* aMessage, TInt aError );
+
+        /**
+         * From MMPXCollectionObserver
+         * Handles the collection entries being opened.
+         *
+         * @since 3.1
+         * @param aEntries Collection entries opened.
+         * @param aIndex Focused entry.
+         * @param aComplete ETrue no more entries. EFalse more entries
+         *                  expected.
+         * @param aError Error code.
+         */
+        void HandleOpenL(
+            const CMPXMedia& aEntries,
+            TInt aIndex,
+            TBool aComplete,
+            TInt aError );
+
+        /**
+         * From MMPXCollectionObserver
+         * Handles the item being opened.
+         *
+         * @since 3.1
+         * @param aPlaylist Collection playlist, owner ship is transfered.
+         * @param aError Error code.
+         */
+        void HandleOpenL(
+            const CMPXCollectionPlaylist& aPlaylist,
+            TInt aError );
+
+        /**
+         * From MMPXPlaybackObserver
+         * Handle playback message
+         *
+         * @param aMessage playback message
+         * @param aErr system error code.
+         */
+        void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+    private:  // New functions
+
+        /**
+         * Initialize playback engine with the path provided
+         *
+         * @param aPath The collection path to initialize playback engine with.
+         */
+        void InitPlaybackEngineL( CMPXCollectionPath& aPath );
+
+        /**
+         * Handle playback message
+         *
+         * @param aMessage playback message
+         */
+        void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+        /**
+         * Handle collection message
+         *
+         * @param aMessage collection message
+         */
+        void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+
+        /**
+        * Start the incremental open operation at a particular index
+        * @param aPath path to open
+        * @param aIndex index to start reading from
+        * @param aDelay delay to start the operation (in ms)
+        */
+        void DoIncrementalOpenL( CMPXCollectionPath& aPath, TInt aIndex,
+                                 TInt aDelay = 0 );
+
+    private:
+
+        MMPXCollectionUtility* iCollectionUtility; // owned
+        MMPXPlaybackUtility* iPlaybackUtility;  // not owned
+        MMPXCollectionUiHelper* iCollectionUiHelper;  // not owned
+        CMPXCollectionOpenUtility* iIncOpenUtil;
+
+        TBool iPathInitialized;
+        TBool iIsInitializing;
+        TBool iInitCanceled;
+        TBool iDefaultPath;      // Are we initializing the default path?
+        TMPXItemId iSelectionId; // Item we want to play
+        TInt  iSelectionIndex; // Index we are restoring to
+        TBool iLoadSavedPath;    // Load a saved path or load a default path?
+        TBool iUSBOngoing;       // is usb ongoing
+        TUid iRootPathId;
+        TBool iMTPStarted;      // is MTP started
+    };
+
+#endif // CMPXRESTOREPATH_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/loc/mpx.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxmusicplayer
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:MPXMusicPlayer app title for aif caption file.
+// l:cell_app_pane_t1
+// r:3.1
+//
+#define qtn_apps_mplayer_grid "Music player"
+
+// d:Error note text.
+// d:User attempted to start Music Player application while a video call was in
+// d:progress.
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_mus_info_video_call_ongoing "Music Player cannot be used during video call."
+
+// d:Text for wait note for saving a file where %U is the filename
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_nmp_wait_save_one_item "Saving %U"
+
+// d:Text for saved to Music Player
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_saved_to_collection "Saved. Added to Music Player"
+
+// d:Text for saved to Gallery
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_saved_to_gallery "Saved"
+
+// d:Text for a confirmation query shown to ask user to save
+// l:popup_note_window/opt1
+// r:3.1
+//
+#define qtn_iv_query_conf_save_downloaded    "%U has not been saved. Save now?"
+
+// d:Dialog shown to query the user if they want to refresh 
+// d:database after a USB session
+// l:popup_note_window
+// r:3.1
+//
+#define qtn_nmp_note_library_refresh_sync "Music May need to be refreshed due to recent USB sync. Refresh Now?"
+
+// d:Dialog shown not to proceed with operation during USB connection.
+// l:popup_note_window
+// r:3.2.3
+#define qtn_nmp_note_cannot_proceed_with_operation "Cannot proceed with operation during USB connection."
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/rom/mpxmusicplayerapp.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project MPX Music Player Application.
+*
+*/
+
+
+#ifndef MPXMUSICPLAYERAPP_IBY
+#define MPXMUSICPLAYERAPP_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+S60_APP_EXE( mpx )
+S60_APP_AIF_ICONS( mpx )
+data=DATAZ_\PRIVATE\10003A3F\APPS\mpx_reg.rsc        Private\10003a3f\import\apps\mpx_reg.rsc
+
+#endif  // MPXMUSICPLAYERAPP_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/rom/mpxmusicplayerapprsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project MPX Music Player Application.
+*
+*/
+
+
+#ifndef MPXMUSICPLAYERAPPRSC_IBY
+#define MPXMUSICPLAYERAPPRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpx.rsc                    APP_RESOURCE_DIR\mpx.rsc
+
+#endif  // MPXMUSICPLAYERAPPRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/src/mpxPDcommandhandler.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,450 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles commands passed in by other appilcations
+*
+*/
+
+
+// INCLUDE FILES
+#include <bldvariant.hrh>
+#include <apgtask.h>
+#include <eikenv.h>
+#include <coeutils.h>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxviewutility.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpxparameter.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessagedefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediaarray.h>
+#include <AiwGenericParam.h>
+#include <pathinfo.h>
+#include <mpxcommandgeneraldefs.h>
+#include <caf/caferr.h>
+#include <StringLoader.h>
+
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionplugin.hrh>
+#include <mpxdrmmediautility.h>
+#include <mpxmediadrmdefs.h>
+
+#include "mpxtlshelper.h"
+#include "mpxconstants.h"
+#include "mpxPDcommandhandler.h"
+#include "mpxlog.h"
+#include "mpxcommonuihelper.h"
+#include <mpxmediakeyhandler.rsg>
+
+// CONSTANTS
+#define KProgressDownloadUid  0x10207BCD
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXPdCommandHandler* CMPXPdCommandHandler::NewL(
+    MMPXPlaybackUtility* aPlaybackUtility)
+    {
+    CMPXPdCommandHandler* self = NewLC(aPlaybackUtility);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXPdCommandHandler* CMPXPdCommandHandler::NewLC(
+    MMPXPlaybackUtility* aPlaybackUtility)
+    {
+    CMPXPdCommandHandler* self = new ( ELeave ) CMPXPdCommandHandler( aPlaybackUtility );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ----------------------------------------------------------------------------
+//
+CMPXPdCommandHandler::CMPXPdCommandHandler(
+    MMPXPlaybackUtility* aPlaybackUtility ):
+    iPlaybackUtility( aPlaybackUtility )
+    ,iPlaybackCompleted(EFalse)
+    ,iPrevousPlaybackState(EPbStateNotInitialised)
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CMPXPdCommandHandler::~CMPXPdCommandHandler()
+    {
+    if ( iPdPlaybackUtility )
+        {
+        TRAP_IGNORE( iPdPlaybackUtility->RemoveObserverL( *this ) );
+        TRAP_IGNORE( iPdPlaybackUtility->CommandL( EPbCmdStop ) );
+        TRAP_IGNORE( iPdPlaybackUtility->CommandL( EPbCmdClose ) );
+        iPdPlaybackUtility->PlayerManager().ClearSelectPlayersL();
+        iPdPlaybackUtility->Close();
+        }
+    if ( iViewUtility )
+        {
+        iViewUtility->Close();
+        }
+    delete iDrmMediaUtility;
+    delete iCommonUiHelper;
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXPdCommandHandler::ConstructL()
+    {
+    iViewUtility = MMPXViewUtility::UtilityL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdCommandHandler::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Handle playback message
+// -----------------------------------------------------------------------------
+//
+void CMPXPdCommandHandler::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXPdCommandHandler::DoHandlePlaybackMessageL" );
+    TMPXMessageId id( *aMessage.Value<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        switch ( *aMessage.Value<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EInitializeComplete:
+                break;
+
+            case TMPXPlaybackMessage::EDownloadCmdCancelDownload:
+                iPdPlaybackUtility->PlayerManager().ClearSelectPlayersL();
+                iPlaybackCompleted = ETrue;
+                break;
+
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                TInt type( *aMessage.Value<TInt>( KMPXMessageGeneralType ) );
+                MPX_DEBUG2( "CMPXPdSbPlaybackViewImp::DoHandlePlaybackMessageL - EStateChanged(%d)", type );
+
+                TMPXPlaybackState state =
+                    static_cast<TMPXPlaybackState>( type );
+                DoHandleStateChangedL( state );
+                iPrevousPlaybackState = state;
+                break;
+                }
+            case TMPXPlaybackMessage::EMediaChanged:
+
+                iPlaybackCompleted = ETrue;
+                break;
+            default:
+                {
+                // ignore other playback messages
+                break;
+                }
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::HandleCommandParametersL
+// -----------------------------------------------------------------------------
+//
+TInt CMPXPdCommandHandler::HandleCommandParametersL(
+    const TDesC8& aParams )
+    {
+    CBufFlat* paramBuf = CBufFlat::NewL( /*anExpandSize*/1 );
+    CleanupStack::PushL( paramBuf );
+    paramBuf->InsertL( 0, aParams );
+    RBufReadStream readStream( *paramBuf );
+
+    CAiwGenericParamList* genParList = CAiwGenericParamList::NewLC( readStream );
+
+    // Unpack download ID
+    TInt index = 0;
+
+    const TAiwGenericParam* genParam = genParList->FindFirst( index,
+        EGenericParamDownloadId, EVariantTypeTInt32 );
+    TInt32 downloadID;
+    if ( genParam )
+        {
+        genParam->Value().Get( downloadID );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( genParList );
+        CleanupStack::PopAndDestroy( paramBuf );
+        if (!iPdPlaybackUtility)
+            {
+            iPlaybackCompleted = ETrue;
+            }          
+        
+        return KErrNotFound;   
+        }
+
+    index = 0;
+    // Unpack fileName
+    const TAiwGenericParam* paramFileName =
+        genParList->FindFirst( index, EGenericParamFile, EVariantTypeDesC );
+    TPtrC fileName;
+    if ( index == KErrNotFound )
+        {
+        fileName.Set( KNullDesC );
+        }
+    else
+        {
+        fileName.Set( paramFileName->Value().AsDes() );
+        }
+    if (!ConeUtils::FileExists(fileName))
+        {
+        CleanupStack::PopAndDestroy( genParList );
+        CleanupStack::PopAndDestroy( paramBuf );
+        if (!iPdPlaybackUtility)
+            {
+            iPlaybackCompleted = ETrue;
+            } 
+        return KErrNotFound;        
+        }
+    if ( downloadID == KErrNotFound )
+        {
+        if ( iPdPlaybackUtility )
+            {
+            if ( iPdPlaybackUtility->StateL() == EPbStatePlaying )
+                {
+                iPdPlaybackUtility->CommandL(EPbCmdPause);
+                }
+            }
+        iPlaybackUtility->InitL(fileName);
+            MMPXPlayer* player =
+                iPlaybackUtility->PlayerManager().CurrentPlayer();
+            TUid pluginUid( KNullUid );
+            RArray<TUid> array;
+            CleanupClosePushL( array );
+
+            if ( player )
+                {
+                array.AppendL( player->UidL() );
+                }
+            else
+                {
+                array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) );
+                }
+
+            // add the collection plugin UID to ensure the correct
+            // last playback view is activated
+            MMPXSource* source = iPlaybackUtility->Source();
+            if( source )
+                {
+                CMPXCollectionPlaylist* pl = source->PlaylistL();
+                if (pl)
+                    {
+                    CleanupStack::PushL( pl );
+                    const CMPXCollectionPath& path = pl->Path();
+                    if(path.Levels() > 0)
+                        {
+                        array.AppendL(TUid::Uid(path.Id(0)));
+                        }
+                    CleanupStack::PopAndDestroy( pl );
+                    }
+                }
+            iViewUtility->ActivateViewL( array );
+            CleanupStack::PopAndDestroy( &array );
+
+        }
+    else if ( iCurrentFileName == fileName && iPdPlaybackUtility)
+        {
+        if ( iPlaybackUtility )
+            {
+             if ( iPlaybackUtility->StateL() == EPbStatePlaying )
+                {
+                iPlaybackUtility->CommandL(EPbCmdPause);
+                }
+            }
+        if ( iPdPlaybackUtility->StateL() == EPbStatePaused )
+            {
+            iPdPlaybackUtility->CommandL( EPbCmdPlay );
+            }
+        ActivatePlaybackViewL();
+        }
+    else
+        {
+        // Create a new playback utility instance
+        if (iPdPlaybackUtility)
+            {
+            iPdPlaybackUtility->RemoveObserverL( *this );
+            iPdPlaybackUtility->PlayerManager().ClearSelectPlayersL();
+            iPdPlaybackUtility->Close();
+            }
+        iPdPlaybackUtility = MMPXPlaybackUtility::UtilityL( 
+                TUid::Uid(KProgressDownloadUid) );
+        MMPXPlayerManager& manager = iPdPlaybackUtility->PlayerManager();
+        manager.SelectPlayerL(TUid::Uid(KProgressDownloadUid));
+        iPdPlaybackUtility->AddObserverL(*this);
+
+        SendCustomCommandToMPXL( downloadID, EPbCmdStartPd );
+        iPlaybackCompleted = EFalse;
+        if ( iPlaybackUtility && iPlaybackUtility->StateL() == EPbStatePlaying )
+            {
+            iPlaybackUtility->CommandL(EPbCmdPause);
+            }
+        iPdPlaybackUtility->InitL(fileName);
+        ActivatePlaybackViewL();
+        iCurrentFileName=fileName;
+        }
+    CleanupStack::PopAndDestroy( genParList );
+    CleanupStack::PopAndDestroy( paramBuf );
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle media key commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdCommandHandler::HandleCommandL(
+    TMPXPlaybackCommand aCommand )
+    {
+    MPX_FUNC( "CMPXPdCommandHandler::HandleCommandL" );
+	MMPXPlaybackUtility* activePlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
+	if (activePlaybackUtility)
+		{
+		CleanupClosePushL(*activePlaybackUtility);
+		activePlaybackUtility->CommandL(aCommand);
+		CleanupStack::PopAndDestroy(activePlaybackUtility);
+		}
+    }
+
+// ---------------------------------------------------------------------------
+// Current state of player
+// ---------------------------------------------------------------------------
+//
+TMPXPlaybackState CMPXPdCommandHandler::PdStateL() const
+    {
+    MPX_FUNC( "CMPXPdCommandHandler::PdStateL" );
+    TMPXPlaybackState pbPlayerState( EPbStateNotInitialised );
+    if ( iPdPlaybackUtility )
+        {
+        pbPlayerState = iPdPlaybackUtility->StateL();
+        }
+    
+    return pbPlayerState;
+    }
+
+// ---------------------------------------------------------
+// CMPXPdCommandHandler::ActivatePlaybackViewL()
+// ---------------------------------------------------------
+//
+void CMPXPdCommandHandler::ActivatePlaybackViewL()
+    {
+    MMPXPlayer* player = iPdPlaybackUtility->PlayerManager().CurrentPlayer();
+    TUid pluginUid( KNullUid );
+    RArray<TUid> array;
+    CleanupClosePushL( array );
+    if ( player )
+        {
+        pluginUid = player->UidL();
+        array.AppendL( pluginUid );
+        }
+    array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ));
+    iViewUtility->ActivateViewL( array );
+    CleanupStack::PopAndDestroy( &array );
+    }
+
+// --------------------------------------------------------------
+// CMPXPdCommandHandler::SendCustomCommandToMPXL()
+// --------------------------------------------------------------
+//
+void CMPXPdCommandHandler::SendCustomCommandToMPXL(
+                        TUint aTransactionID,
+                        TMPXPlaybackPdCommand aCustomCmd)
+    {
+    MPX_DEBUG2("CMPXPdCommandHandler::SendCustomCommandToMPXL(aEvent=%d) (aCustomCmd=%d)", aCustomCmd);
+
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackPD );
+    cmd->SetTObjectValueL<TMPXPlaybackPdCommand>( KMPXCommandPlaybackGeneralType, aCustomCmd );
+    cmd->SetTObjectValueL<TUint>( KMPXCommandPlaybackPDTransactionID, aTransactionID );
+    iPdPlaybackUtility->CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdCommandHandler::DoHandleStateChangedL(
+    TMPXPlaybackState aState )
+    {
+    MPX_DEBUG2( "CMPXPdCommandHandler::DoHandleStateChangedL(%d)", aState );
+
+    switch ( aState )
+        {
+        case EPbStateStopped:
+            {
+            iPlaybackCompleted = ETrue;
+            }
+            break;
+        case EPbStatePaused:
+            {
+            if (iPrevousPlaybackState == EPbStateInitialising)
+                {
+                iPdPlaybackUtility->CommandL( EPbCmdPlay ); //Automatically play when EMC is done initializing.
+                }
+            }
+            break;
+        default:
+            break;
+        }
+    MPX_DEBUG1("CMPXPdCommandHandler::DoHandleStateChangedL()");
+    }
+
+
+// --------------------------------------------------------------
+// CMPXPdCommandHandler::IsPlaybackCompleted()
+// --------------------------------------------------------------
+//
+TBool CMPXPdCommandHandler::IsPlaybackCompleted()
+    {
+    return iPlaybackCompleted;
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/src/mpxapp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Application class required by AVKON application framework.
+*
+*/
+
+
+// INCLUDE FILES
+#include <eikstart.h>
+
+#include "mpxapp.h"
+#include "mpxdocument.h"
+#include <mpxconstants.h>
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Returns application UID
+// ---------------------------------------------------------------------------
+//
+TUid CMPXApp::AppDllUid() const
+    {
+    return KAppUidMusicPlayerX;
+    }
+   
+// ---------------------------------------------------------------------------
+// Creates CMPXDocument object
+// ---------------------------------------------------------------------------
+//
+CApaDocument* CMPXApp::CreateDocumentL()
+    {
+    return CMPXDocument::NewL( *this );
+    }
+
+
+// ======== GLOBAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructs and returns an application object.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CApaApplication* NewApplication()
+    {
+    return new CMPXApp;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Main function of the application executable.
+// ---------------------------------------------------------------------------
+//
+GLDEF_C TInt E32Main()
+    {
+    return EikStart::RunApplication( NewApplication );
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/src/mpxappui.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4636 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Application UI class required by AVKON application architecture.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AknGlobalNote.h>
+#include <avkon.hrh>
+#include <apgwgnam.h>
+#include <hlplch.h>
+#include <e32base.h>
+#include <e32property.h>
+#include <eikproc.h>
+#include <apacln.h>
+#include <coeutils.h>
+#include <StringLoader.h>
+#include <textresolver.h>
+#include <aknnotewrappers.h>
+#include <AknTaskList.h>
+#include <aknview.h>
+#include <featmgr.h>
+#include <centralrepository.h>
+#include <settingsinternalcrkeys.h>
+#include <ctsydomainpskeys.h>
+#include <caf/caferr.h>
+#include <eikapp.h>
+#include <pathinfo.h>
+#include <sysutil.h>
+#include <apgcli.h>
+#include <AknDlgShut.h>
+#include <aknconsts.h>
+#include <activeidle2domainpskeys.h>
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+#include <AiwGenericParam.h>
+#endif
+
+#include <mpxplaybackutility.h>
+#include <mpxcollectionutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxviewutility.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpx.rsg>
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionplugin.hrh>
+#include <mpxmedia.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxmediaarray.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediakeyhandler.h>
+#include <mpxharvesterutility.h>
+#include <mpxdrmmediautility.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionplugin.hrh>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+#include <aknSDData.h>
+#include <AknMediatorFacade.h>
+#include <MediatorCommandInitiator.h>
+#include <MediatorDomainUIDs.h>
+#include "mplayersecondarydisplayapi.h"
+#include <featmgr.h>
+//#endif
+// Cover UI end
+
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT 
+#include "camesedrmhandler.h"
+#endif 
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+#include <DocumentHandler.h>
+#include <apmstd.h>
+#endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+
+#include "mpxinternalcrkeys.h"
+#include "mpxcommandhandler.h"
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+#include <AiwGenericParam.h>
+#include "mpxPDcommandhandler.h"
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+#include "mpxcommonuihelper.h"
+#include <mpxcommonui.rsg> //for R_MPX_FILE_NOT_FOUND_TEXT
+#include "mpxappui.h"
+#include "mpxcontroller.h"
+#include "mpxrestorepath.h"
+#include "mpxdocument.h"
+#include "mpxtlshelper.h"
+#include "mpxlog.h"
+#include "mpxappui.hrh"
+#include <mpxconstants.h>
+#include <mpxviewpluginmanager.h>
+#include <mpxviewplugin.h>
+
+#include <iaupdate.h>
+#include <iaupdateparameters.h>
+#include <iaupdateresult.h>
+
+// CONSTANTS
+_LIT( KMPXLineChange, "\n" );
+_LIT(KMPXMusicplayerPrivateFolder, "\\private\\");
+_LIT(KMPXMusicPlayerExec, "mpx.exe" );
+
+const TInt KMPXMusicPlayerAlreadySaved( -5000 );
+
+// Application Uid for Active Idle app
+#ifdef __ACTIVE_IDLE
+const TUid KMPXUidIdleApp = { 0x101FD64C };
+#else
+const TUid KMPXUidIdleApp = KPSUidActiveIdle2; // use this one instead because the "aisystemuids.hrh" is not export
+#endif
+
+// MusicPlayer SIS Package UID
+#define KMPXMusicPlayerSISPkgUid  0x101FFC62 
+
+_LIT8( KMmMessage, "mm://musicsuite?action=exit" );
+const TInt KMmUid3( 0x101f4cd2 );
+
+// Granularity for ring tone mime types array
+const TInt KMPXRingToneMimeTypesGranularity( 10 );
+
+const TInt KMPXMinVolume( 0 );
+const TInt KMPXMaxVolume(100);
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+_LIT8(KDataTypeRAM,"audio/x-pn-realaudio-plugin");
+#endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+
+const TInt KMaxIntLen( 10 );
+_LIT8( KMVPrefix, "MVviewID:" );
+const TInt KMVPrefixLen( 9 );
+
+const TUid  KLocalPlaybackUid = { 0x101FFC06 };
+const TUid  KPhoneAppUid      = {0x100058B3};
+const TInt  KWaitNoteImpUid   = 0x101FFC6C; // refresh wait note UID
+const TInt KLowestMemoryNeeded = 5242880; //5 Mbytes
+
+const TUid KCRUidMPXMPSettings = {0x101FFCDC};
+const TUint32 KMPXMPPlaybackRandomMode = 0x0B;
+const TUint32 KMPXMPPlaybackRepeatMode = 0x0C;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXAppUi::CMPXAppUi()
+    : iRingToneMimeTypes( KMPXRingToneMimeTypesGranularity ),
+      iCurrentIndex( KErrNotFound ), iSaveMode( EMPXSaveModeIdle ),
+      iStandAlone(EFalse),
+      iMaxVolume(KMPXMaxVolume)
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+      ,iAppStartedByBrowser(EFalse)
+      ,iPdPbvStartedByBrowser(EFalse)
+      ,icollectionBrowsed(EFalse)
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+#ifdef FF_OOM_MONITOR2_COMPONENT   //__ENABLE_MPX_BUSYSETTING_FOR_OOM2
+      ,iOomPriority( ROomMonitorSession::EOomPriorityNormal )
+#endif //FF_OOM_MONITOR2_COMPONENT
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::ConstructL()
+    {
+    MPX_FUNC( "CMPXAppUi::ConstructL" );
+#ifndef __ENABLE_MSK
+    BaseConstructL( EAknEnableSkin 
+#ifdef SINGLE_CLICK_INCLUDED
+    | EAknSingleClickCompatible
+#endif
+	);
+#else
+    BaseConstructL( EAknEnableSkin | EAknEnableMSK 
+#ifdef SINGLE_CLICK_INCLUDED
+    | EAknSingleClickCompatible
+#endif
+	);
+#endif // __ENABLE_MSK
+
+    iCommonUiHelper = CMPXCommonUiHelper::NewL();
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+// initialize FeatureManager
+    FeatureManager::InitializeLibL();
+
+    // Check updates from IAD, continue UI launching even if something fails there
+    TRAP_IGNORE( CheckUpdatesL() );
+
+    if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
+        {
+        iCoverDisplay = ETrue;
+        iCommandInitiator = CMediatorCommandInitiator::NewL( NULL );
+        }
+    else
+        {
+        iCoverDisplay = EFalse;
+        }
+//#endif // __COVER_DISPLAY
+// Cover UI end
+
+    if ( MPXUser::IsCallOngoing( EPSCTsyCallTypeH324Multimedia ) )
+        {
+        HBufC* text =
+            StringLoader::LoadLC( R_MPX_VIDEO_CALL_ONGOING );
+        CAknGlobalNote* globalInfoNote = CAknGlobalNote::NewLC();
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+    if ( iCoverDisplay )
+        {
+        CAknSDData* sddata = CAknSDData::NewL(
+            KMPlayerNoteCategory,
+            EMPlayerNoteVideoCall,
+            KNullDesC8);
+        globalInfoNote->SetSecondaryDisplayData(sddata); // ownership transferred
+        }
+//#endif //__COVER_DISPLAY
+// Cover UI end
+
+        globalInfoNote->ShowNoteL(
+            EAknGlobalInformationNote,
+            text->Des() );
+        CleanupStack::PopAndDestroy( globalInfoNote );
+        CleanupStack::PopAndDestroy( text );
+        Exit();
+        return;
+        }
+
+    //check memory
+#ifdef FF_OOM_MONITOR2_COMPONENT
+    CheckAvailableMemoryByOomL( KLowestMemoryNeeded );
+#else
+    CheckAvailableMemory( KLowestMemoryNeeded );
+#endif    //FF_OOM_MONITOR2_COMPONENT
+
+    if ( !IsEmbedded() )
+        {
+        // Do we support podcasting in music player?
+        // Event if repository get fails, it will default to EFalse
+        //
+        TInt val(0);
+        CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
+        repository->Get( KMPXMPLocalVariation, val );
+        iDisablePodcasting = val&KMPXDisablePodcastingOption ? ETrue : EFalse;
+        iStartInAlbumMenu = val&KMPXStartMusicPlayerinArtistsandAlbums ? ETrue : EFalse;
+        delete repository;
+        CreateMemberVariablesL();
+
+        TUid defaultView( iViewUtility->DefaultViewUid() );
+
+        // Pre-load views in standalone mode
+        iViewUtility->PreLoadViewsL( TUid::Uid( KMusicPlayerAppUidConstant ) );
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU
+        iCollectionUtility->Collection().OpenL(
+            TUid::Uid(EMPXCollectionPluginMusic));
+#endif
+
+		if ( iStartInAlbumMenu )
+			{
+
+			// We want to open the music player to the albums level for 9.2
+			// Changes in other areas will also be needed.
+
+			CMPXCollectionPath* path = iCollectionUiHelper->MusicMenuPathL();
+			CleanupStack::PushL( path );
+			path->AppendL(3); // Albums
+			MPX_DEBUG_PATH(*path);
+			iCollectionUtility->Collection().OpenL( *path );
+			CleanupStack::PopAndDestroy( path );
+			}
+		else
+			{
+			CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+			CleanupStack::PushL( path );
+			MPX_DEBUG1("CMPXAppUi::ConstructL() current collection path");
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        MPX_DEBUG1("CMPXAppUi::ConstructL() restoring stale path");
+        CMPXCollectionPath* mainMusicMenu = CMPXCollectionPath::NewL();
+        CleanupStack::PushL( mainMusicMenu );
+        mainMusicMenu->AppendL(0x101FFC3A);
+        iCollectionUtility->Collection().OpenL( *mainMusicMenu );
+        CleanupStack::PopAndDestroy( mainMusicMenu );
+        CleanupStack::PopAndDestroy( path );
+#else
+        MPX_DEBUG1( "CMPXAppUi::ConstructL wrong path" );
+        if( path->Levels() > 1 )
+            {
+            // Correct the path by opening 0 levels
+            MPX_DEBUG1("CMPXAppUi::ConstructL() restoring stale path");
+            CMPXCollectionPath* root = CMPXCollectionPath::NewL();
+            CleanupStack::PushL( root );
+            iCollectionUtility->Collection().OpenL( *root );
+            CleanupStack::PopAndDestroy( root );
+            }
+        CleanupStack::PopAndDestroy( path );
+#endif
+			}
+
+
+        if ( defaultView != KNullUid )
+            {
+            iViewUtility->SetAsDefaultViewL( defaultView );
+            }
+        else
+            {
+            iViewUtility->SetAsDefaultViewL(
+                TUid::Uid( KMPXPluginTypeMainUid ) );
+            }
+
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        // Startup database checker
+        iController = CMPXController::NewL(iDisablePodcasting);
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+
+        // Only in stand alone mode
+        iHarvesterUtility = CMPXHarvesterFactory::NewL();
+        iHarvesterUtility->CheckForSystemEventsL();
+
+#ifdef _DEBUG
+        TBool iExitOptionHidden = EFalse;
+#else // _DEBUG
+        TBool iExitOptionHidden = iCommonUiHelper->ExitOptionHiddenL();
+#endif // _DEBUG
+        if(iExitOptionHidden)
+            {
+            // Do not offer choice to exit application from task swapper.
+            CEikonEnv::Static()->SetSystem( ETrue );
+            }
+
+        RProcess proc;
+        CleanupClosePushL( proc );
+        CMPXCommonUiHelper::SetStandAloneModePId( proc.Id().Id() );
+        CleanupStack::PopAndDestroy( &proc );
+        }
+
+    iRingToneMimeTypes.AppendL(_L("application/vnd.nokia.ringing-tone"));
+    iRingToneMimeTypes.AppendL(_L("audio/x-midi"));
+    iRingToneMimeTypes.AppendL(_L("audio/midi"));
+    iRingToneMimeTypes.AppendL(_L("audio/sp-midi"));
+    iRingToneMimeTypes.AppendL(_L("audio/amr"));
+    iRingToneMimeTypes.AppendL(_L("audio/amr-wb"));
+    iRingToneMimeTypes.AppendL(_L("audio/awb"));
+    iRingToneMimeTypes.AppendL(_L("audio/x-amr"));
+    iRingToneMimeTypes.AppendL(_L("audio/audio/vnd.nokia.mobile-xmf"));
+    iLaunchModePlaying = EFalse;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXAppUi::~CMPXAppUi()
+    {
+    MPX_DEBUG1( "-->CMPXAppUi::~CMPXAppUi()" );
+#ifdef FF_OOM_MONITOR2_COMPONENT
+    SetMpxOomPriorityL( ROomMonitorSession::EOomPriorityNormal );
+#endif //FF_OOM_MONITOR2_COMPONENT
+
+    if ( !IsEmbedded() )
+        {
+        CMPXCommonUiHelper::SetStandAloneModePId( 0 );
+        }
+
+// Cover UI Start
+// #ifdef __COVER_DISPLAY
+
+    FeatureManager::UnInitializeLib();
+    delete iCommandInitiator;
+
+// #endif // __COVER_DISPLAY
+// Cover UI End
+    delete iPathRestore;
+    delete iController;
+    delete iProcessParameter;
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+    delete iPdParameterHandler;
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+    delete iIdle;
+
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+
+    if ( iPlaybackUtility )
+        {
+        TRAP_IGNORE( iPlaybackUtility->CommandL( EPbCmdClose ) );
+        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+        iPlaybackUtility->Close();
+        }
+
+    if ( iViewUtility )
+        {
+        iViewUtility->RemoveObserver( this );
+        iViewUtility->Close();
+        }
+    delete iCommonUiHelper;
+
+    if( iCollectionUiHelper )
+        {
+        iCollectionUiHelper->Close();
+        }
+
+    if ( iCollectionHelper )
+        {
+        iCollectionHelper->Close();
+        }
+    if( iHarvesterUtility )
+        {
+        iHarvesterUtility->Close();
+        }
+
+    delete iMediaKeyHandler;
+    delete iSettingsRepository;
+    iFile.Close();
+    iDeferredViewActivationUid.Close();
+    delete iSavePath;
+    iRingToneMimeTypes.Reset();
+
+    delete iSaveHelper;
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT 
+    delete iCameseDrmHandler;
+#endif 
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    delete iDocHandler;
+#endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+
+    CleanUpdateParams();
+
+    MPX_DEBUG1( "<--CMPXAppUi::~CMPXAppUi()" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Querying whether the application is launched in embedded mode or not.
+// ---------------------------------------------------------------------------
+//
+TBool CMPXAppUi::IsEmbedded() const
+    {
+    return iEikonEnv->StartedAsServerApp();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Opens temporary playlist or album from buffer.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::OpenPlaylistFromBufferL(
+    const TDesC& aBuffer,
+    TDesC& aName )
+    {
+    MPX_FUNC( "CMPXAppUi::OpenPlaylistFromBufferL" );
+    TPtrC bufPtr( aBuffer );
+    TInt offset = 0;
+    CMPXMediaArray* tracksArray = CMPXMediaArray::NewL();
+    CleanupStack::PushL( tracksArray );
+
+    while ( bufPtr.Length() > 0 )
+        {
+        offset = bufPtr.Find( KMPXLineChange );
+        CMPXMedia* track = CMPXMedia::NewL();
+        CleanupStack::PushL( track );
+        track->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem);
+        track->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong );
+        if ( offset == KErrNotFound )
+            {
+            TParsePtrC fn( bufPtr );
+            track->SetTextValueL( KMPXMediaGeneralTitle, fn.Name() );
+            track->SetTextValueL( KMPXMediaGeneralUri, bufPtr );
+            // Set bufPtr to the end of buffer
+            bufPtr.Set( bufPtr.Right( 0 ) ); //magic
+            }
+        else
+            {
+            TParsePtrC fn( bufPtr.Left( offset ) );
+            track->SetTextValueL( KMPXMediaGeneralTitle, fn.Name() );
+            track->SetTextValueL( KMPXMediaGeneralUri, fn.FullName() );
+            // Move past the line feed
+            bufPtr.Set( bufPtr.Mid( ++offset ) );
+            }
+        tracksArray->AppendL( track );
+        CleanupStack::Pop( track );
+        }
+
+    CMPXMedia* media = CMPXMedia::NewL();
+    CleanupStack::PushL( media );
+    media->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem);
+    media->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPlaylist );
+    if ( aName.Length() > 0 )
+        {
+        media->SetTObjectValueL( KMPXMediaGeneralTitle, aName );
+        }
+    media->SetCObjectValueL( KMPXMediaArrayContents, tracksArray );
+    media->SetTObjectValueL( KMPXMediaArrayCount, tracksArray->Count() );
+    iCollectionUiHelper->OpenL( MPXTlsHelper::HostUid(), *media,
+                                this, EMPXCollectionPluginMusic );
+    CleanupStack::PopAndDestroy( media );
+    CleanupStack::PopAndDestroy( tracksArray );
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// -----------------------------------------------------------------------------
+// CMPXAppUi::ForwardAiwParametersToMediaPlayer
+// -----------------------------------------------------------------------------
+//
+CAiwGenericParamList* CMPXAppUi::CreateForwardAiwParametersLC(
+        const CAiwGenericParamList* aParamList) const
+    {
+    MPX_FUNC( "CMPXAppUi::ForwardAiwParametersToMediaPlayerL" );
+
+    //Read parameters that were appended to the parameter list
+
+    //Creates a new parameter list which will be forwarded to Media Player
+    CAiwGenericParamList* newParamList = CAiwGenericParamList::NewLC();
+
+    if (aParamList)
+        {
+        TInt index = 0;
+
+        //param contains the specific parameter being looked for in the parameter list
+        //if found, append it again so it can be passed to Media Player
+
+        //Move parameter
+        const TAiwGenericParam* param = aParamList->FindFirst(index,
+                                            EGenericParamAllowMove);
+        if (param)
+            {
+            TBool allowMove(ETrue);
+            TAiwVariant allowMoveVariant(allowMove);
+            TAiwGenericParam genericParamAllowMove(EGenericParamAllowMove,
+                                                   allowMoveVariant);
+            newParamList->AppendL(genericParamAllowMove);
+            }
+
+        index = 0;
+        param = NULL;
+        //Save parameter
+        param = aParamList->FindFirst(index, EGenericParamAllowSave);
+        if (param)
+            {
+            TBool allowSave(ETrue);
+            TAiwVariant allowSaveVariant(allowSave);
+            TAiwGenericParam genericParamAllowSave(EGenericParamAllowSave,
+                                                   allowSaveVariant);
+            newParamList->AppendL(genericParamAllowSave);
+            }
+
+        index = 0;
+        param = NULL;
+        //Resolution parameter
+        param = aParamList->FindFirst(index, EGenericParamResolution);
+        if (param)
+            {
+            //For future use
+            }
+
+        index = 0;
+        param = NULL;
+        //File parameter
+        param = aParamList->FindFirst(index, EGenericParamFile);
+        if (param)
+            {
+            TDataType dataType( _L8("audio/x-pn-realaudio") );
+            TAiwVariant filename( _L8("c:\\system\\temp\\RtspTemp.ram") );
+            TAiwGenericParam param( EGenericParamFile, filename );
+            newParamList->AppendL( param );
+            }
+
+        index = 0;
+        param = NULL;
+        //Access Point parameter
+        param = aParamList->FindFirst(index, EGenericParamAccessPoint);
+        if (param)
+            {
+            TInt32 value = 0;
+            TInt32 ret = param->Value().Get(value);
+            if (ret)
+                {
+                TAiwVariant accessPointVariant(value);
+                TAiwGenericParam genericParamAccessPoint(EGenericParamAccessPoint,
+                                                         accessPointVariant);
+                newParamList->AppendL(genericParamAccessPoint);
+                }
+            }
+        }
+    return newParamList;
+    }
+#endif
+
+// ---------------------------------------------------------------------------
+// Opens the specified file in response to a corresponding message.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::OpenFileL(
+    CFileStore*& /* aFileStore */,
+    RFile& aFile,
+    const CAiwGenericParamList* aParams )
+    {
+    MPX_FUNC( "CMPXAppUi::OpenFileL" );
+
+    // Duplicate the file handle passed in before
+    // creating the member variables.
+    TFileName filename;
+    aFile.FullName( filename );
+    iFile.Close();
+    iFile.Duplicate( aFile );
+    aFile.Close();
+
+    if ( IsEmbedded() )
+        {
+        CreateMemberVariablesL();
+        iViewUtility->PreLoadViewL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ));
+        }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    // Get MIME type
+    RApaLsSession apa;
+    User::LeaveIfError( apa.Connect() );
+    CleanupClosePushL( apa );
+    TDataRecognitionResult result;
+    User::LeaveIfError( apa.RecognizeData( iFile, result ));
+    CleanupStack::PopAndDestroy( &apa );
+
+    TDataType dataType = TDataType( KDataTypeRAM() );
+
+    if ( result.iDataType == dataType )
+        {
+        CAiwGenericParamList* paramList = CreateForwardAiwParametersLC(aParams);
+        iDocHandler->OpenFileEmbeddedL(iFile, dataType, *paramList);
+        CleanupStack::PopAndDestroy(paramList);
+        iDocHandler->SetExitObserver(this);
+        }
+    else
+#endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+        {
+        // Open File with Collection Helper
+        iCollectionUiHelper->OpenL( MPXTlsHelper::HostUid(), filename,
+                                    this, EMPXCollectionPluginMusic );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMPXAppUi::ActivatePhoneAppL
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::ActivatePhoneAppL()
+    {
+    MPX_FUNC( "CMPXAppUi::ActivatePhoneAppL" );
+    TApaTaskList apaTaskList( CCoeEnv::Static()->WsSession() );
+    TApaTask apaTask = apaTaskList.FindApp( KPhoneAppUid );
+    if ( apaTask.Exists() )
+        {
+        // Bring phone to foreground
+        apaTask.BringToForeground();
+        }
+
+    // Move Music Player to background
+    // magic: -1 = force wg to background
+    }
+
+// ----------------------------------------------------------------------------
+// void CMPXAppUi::DeferredExitCallback
+// call back function for deferred exit.
+// ----------------------------------------------------------------------------
+//
+TInt CMPXAppUi::DeferredExitCallback( TAny* aPtr )
+    {
+    MPX_FUNC( "CMPXAppUi::DeferredExitCallback" );
+    CMPXAppUi* self = static_cast<CMPXAppUi*>( aPtr );
+    TRAP_IGNORE( self->HandleCommandL( EEikCmdExit ) );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Start a waitnote dialog
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::StartWaitNoteL( TWaitNoteType aNoteType )
+    {
+    CloseWaitNoteL();
+    TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid );
+    TPckg<TWaitNoteType> note = aNoteType;
+    HBufC* arg = MPXUser::AllocL( note );
+    CleanupStack::PushL( arg );
+    iViewUtility->ActivateViewL( waitnoteId, arg );
+    CleanupStack::PopAndDestroy( arg );
+    }
+
+// ---------------------------------------------------------------------------
+// Close the waitnote dialog
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::CloseWaitNoteL()
+    {
+    TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid );
+    TUid activeView = iViewUtility->ActiveViewType();
+    if( activeView == waitnoteId )
+        {
+        CMPXViewPlugin* pi =
+            iViewUtility->ViewPluginManager().PluginL( TUid::Uid(KWaitNoteImpUid) );
+        pi->DeactivateView();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXMediaKeyHandlerObserver.
+// Handle media key commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleMediaKeyCommand(
+    const TMPXPlaybackCommand aCommand,
+    const TInt aData )
+    {
+    MPX_FUNC( "CMPXAppUi::HandleMediaKeyCommand" );
+
+    switch ( aCommand )
+        {
+        case EPbCmdSetVolume:
+            {
+            TMPXPlaybackState playerState( EPbStateNotInitialised );
+            playerState = iPlaybackUtility->StateL();
+            if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) ||
+                ( playerState == EPbStatePlaying ) ||
+                ( playerState == EPbStateSeekingForward ) ||
+                ( playerState == EPbStateSeekingBackward ) ||
+                iPdParameterHandler )
+                {
+                TMPXPlaybackState pdPlayerState( EPbStateNotInitialised );
+                if ( iPdParameterHandler )
+                    {
+                    pdPlayerState = iPdParameterHandler->PdStateL();
+                    }
+                
+                // only process command if there no call ongoing
+                // or if we're actively playing during call
+                if ( IsForeground() || EPbStatePlaying == playerState || EPbStatePlaying == pdPlayerState )
+                    {
+					if ( aData != iCurrentVolume )
+                        {
+                        SetVolume( aData );
+                        }
+                    // popup volume control even if volume didn't change
+                    HandlePopupL( EPbCmdSetVolume );
+                    }
+                }
+            break;
+            }
+        case EPbCmdMuteVolume:
+            {
+            TMPXPlaybackState playerState( EPbStateNotInitialised );
+            playerState = iPlaybackUtility->StateL();
+            if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) ||
+                ( playerState == EPbStatePlaying ) ||
+                ( playerState == EPbStateSeekingForward ) ||
+                ( playerState == EPbStateSeekingBackward ) )
+                {
+                // only process command if there no call ongoing
+                // or if we're actively playing during call
+                if ( IsForeground() || EPbStatePlaying == playerState )
+                    {
+                    MuteVolume();
+                    HandlePopupL( EPbCmdMuteVolume );
+                    }
+                }
+            break;
+            }
+        case EPbCmdUnMuteVolume:
+            {
+            TMPXPlaybackState playerState( EPbStateNotInitialised );
+            playerState = iPlaybackUtility->StateL();
+            if ( !MPXUser::IsCallOngoing( KMPXCallTypeGenericVoice ) ||
+                ( playerState == EPbStatePlaying ) ||
+                ( playerState == EPbStateSeekingForward ) ||
+                ( playerState == EPbStateSeekingBackward ) )
+                {
+                // only process command if there no call ongoing
+                // or if we're actively playing during call
+                if ( IsForeground() || EPbStatePlaying == playerState )
+                    {
+                    UnMuteVolume();
+                    HandlePopupL( EPbCmdUnMuteVolume );
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            // Dispatches all other commands
+
+            TBool foregroundApp( IsForeground() );
+            if ( !IsDisplayingMenuOrDialog() && foregroundApp )
+                {
+                // Forward the command to view to handle when
+                // music is foreground app and not displaying
+                // dialogs or the options menu
+                if ( iView )
+                    {
+                    MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand sending command %d to view", MPXCmdForPbCmd(aCommand) );
+                    iView->HandleCommandL( MPXCmdForPbCmd(aCommand) );
+                    }
+                }
+            else
+                {
+                TMPXPlaybackState playerState( EPbStateNotInitialised );
+                playerState = iPlaybackUtility->StateL();
+                if ( foregroundApp && IsDisplayingDialog() )
+                    {
+                    // displaying dialog in the foreground
+                    if ( EPbStatePlaying == playerState ||
+                         EPbStatePaused == playerState ||
+                         EPbStateSeekingForward == playerState ||
+                         EPbStateSeekingBackward == playerState ||
+                         aCommand == EPbCmdPlay ||
+                         aCommand == EPbCmdPlayPause  )
+                        {
+                        // In playing/paused state, all media keys are active.
+                        // Now playing view is not bring to foreground.
+                        // Seeking forward/backwards is also "playing"
+                        MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Dialog displaying, sending command %d to DoHandleMediaKeyCommandL", aCommand );
+                        DoHandleMediaKeyCommandL( aCommand );
+                        }
+                    else
+                        {
+                        MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Dialog displaying, inactive state, command %d ignored", aCommand );
+                        }
+                    }
+                else
+                    {
+                    // displaying menu/not foreground, pass to view to handle only play command
+                    if ( EPbStatePlaying == playerState ||
+                        EPbStatePaused == playerState ||
+                        EPbStateSeekingForward == playerState ||
+                        EPbStateSeekingBackward == playerState )
+                        {
+                        MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, sending command %d to DoHandleMediaKeyCommandL", aCommand );
+                        DoHandleMediaKeyCommandL( aCommand );
+                        }
+                    else if ( ( aCommand == EPbCmdPlay || aCommand == EPbCmdPlayPause ) && iView )
+                        {
+                        if ( !foregroundApp )
+                            {
+                            MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, active idle foreground, sending command %d to DoHandleMediaKeyCommandL", aCommand );
+                            // not foreground, play without loading playback view
+                            DoHandleMediaKeyCommandL( aCommand );
+                            }
+                        else
+                            {
+                            MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, sending command %d to view", aCommand );
+                            iView->HandleCommandL( MPXCmdForPbCmd(aCommand) );
+                            }
+                        }
+                    else if ( aCommand == EPbCmdPlay || aCommand == EPbCmdPlayPause )
+                        {
+                        // play command without a view, this case
+                        // happens when music player is started in starter
+                        // and has not been activated yet
+                        // if music player gets this event, that means embedded mode
+                        // is not active. safe to just use TApaTask to switch task
+                        // bring music player to foreground in this case
+                        TApaTaskList tasList( CEikonEnv::Static()->WsSession() );
+                        TApaTask task =
+                             tasList.FindApp( KAppUidMusicPlayerX );
+                        if ( task.Exists() )
+                            {
+                            task.BringToForeground();
+                            }
+                        }
+                    else
+                        {
+                        MPX_DEBUG2( "CMPXAppUi::HandleMediaKeyCommand Menu displaying/not foreground, inactive state, command %d ignored", aCommand );
+                        }
+                    }
+                }
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Additional handling of media key commands.
+// Determine if the command will be passed to the playback engine.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::DoHandleMediaKeyCommandL(
+    TMPXPlaybackCommand aCommand )
+    {
+    MPX_FUNC( "CMPXAppUi::DoHandleMediaKeyCommandL" );
+
+    TBool handleCommand(EFalse);
+    TMPXPlaybackState playerState( iPlaybackUtility->StateL() );
+
+    MMPXSource* source( iPlaybackUtility->Source() );
+    switch ( aCommand )
+        {
+        case EPbCmdPlay:
+        case EPbCmdPause:
+        case EPbCmdPlayPause:
+            {
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+            if ( source || iPdParameterHandler )
+#else
+            if ( source )
+#endif
+                {
+                handleCommand = ETrue;
+                }
+            break;
+            }
+        case EPbCmdStop:
+            {
+            handleCommand = ETrue;
+            break;
+            }
+        case EPbCmdNext:
+            {
+            // TODO: Invalid if in progressive download mode??
+
+            // ignore next key in stopped mode, except when
+            // the foreground is playbackview
+            if (( EPbStateStopped != playerState ||
+                  KMPXPluginTypePlaybackUid == iCurrentViewType.iUid ||
+                  KMPXPluginTypeEmbeddedPlaybackUid == iCurrentViewType.iUid  ) &&
+                source )
+                {
+                handleCommand = ETrue;
+                }
+            break;
+            }
+        case EPbCmdPrevious:
+            {
+            // TODO: Invalid if in progressive download mode??
+
+            // ignore previous key in stopped mode, except when
+            // the foreground is playbackview 
+            if (( EPbStateStopped != playerState ||
+                  KMPXPluginTypePlaybackUid == iCurrentViewType.iUid ||
+                  KMPXPluginTypeEmbeddedPlaybackUid == iCurrentViewType.iUid) &&
+                source )
+                {
+                handleCommand = ETrue;
+                }
+            break;
+            }
+        case EPbCmdStartSeekForward:
+            {
+            // TODO: Invalid if in progressive download mode??
+            if (( EPbStatePlaying == playerState ||
+                  EPbStatePaused == playerState ||
+                  EPbStateSeekingBackward == playerState ) &&
+                source )
+                {
+                handleCommand = ETrue;
+                }
+            break;
+            }
+        case EPbCmdStartSeekBackward:
+            {
+            // TODO: Invalid if in progressive download mode??
+            if (( EPbStatePlaying == playerState ||
+                  EPbStatePaused == playerState ||
+                  EPbStateSeekingForward == playerState  ) &&
+                source )
+                {
+                handleCommand = ETrue;
+                }
+            break;
+            }
+        case EPbCmdStopSeeking:
+            {
+            if (( EPbStateSeekingForward == playerState ||
+                  EPbStateSeekingBackward == playerState ) &&
+                source )
+                {
+                handleCommand = ETrue;
+                }
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+
+    if ( handleCommand )
+        {
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+
+        if (iPdParameterHandler)
+            {
+            iPdParameterHandler->HandleCommandL( aCommand );
+            }
+        else
+            {
+            iPlaybackUtility->CommandL( aCommand );
+            }
+#else
+        iPlaybackUtility->CommandL( aCommand );
+#endif
+        // Control popup behaviour
+        HandlePopupL( aCommand );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Control popup behaviour.
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::HandlePopupL(
+    TMPXPlaybackCommand aCommand )
+    {
+    MPX_FUNC( "CMPXAppUi::HandlePopupL" );
+    TBool showPlaybackPopup( ETrue );
+    TBool showVolumePopup( ETrue );
+
+    if ( IsForeground() )
+        {
+        switch ( iCurrentViewType.iUid )
+            {
+            case KMPXPluginTypePlaybackUid:
+            case KMPXPluginTypeEmbeddedPlaybackUid:
+            case KMPXPluginTypeMainUid:
+                {
+                // do not show playback popup in these views
+                MPX_DEBUG2( "CMPXAppUi::HandlePopupL active view type is 0x%x, not showing popup", iCurrentViewType.iUid );
+                showPlaybackPopup = EFalse;
+                break;
+                }
+            default:
+                {
+                MPX_DEBUG2( "CMPXAppUi::HandlePopupL active view type is 0x%x, showing popup", iCurrentViewType.iUid );
+                break;
+                }
+            }
+        }
+    else if ( !IsForeground() && IsActiveIdleEnabled() && IsIdleAppForeground() )
+        {
+        showPlaybackPopup = EFalse;
+        }
+
+    if ( !IsForeground())
+        {
+        if ( IsActiveIdleEnabled() && IsIdleAppForeground() )
+            {
+            showVolumePopup = ETrue;
+            }
+        else
+            {
+            showVolumePopup = EFalse;
+            }
+        }
+
+    switch ( aCommand )
+        {
+        case EPbCmdStop:
+            {
+            iMediaKeyHandler->DismissNotifier( EDisplayMediaPopup );
+            break;
+            }
+        case EPbCmdPrevious:
+        case EPbCmdNext:
+            {
+            if ( showPlaybackPopup )
+                {
+                // skip backwards should start timer right away
+                // because it'll not receive events to trigger the timer
+                // if skipping multiple songs, the timer will be reset
+                // everytime it reaches a song
+
+                // skip fowards should also start timer right away
+                // becuase if it's the last song, there won't be any events
+                // to trigger the timer
+                iMediaKeyHandler->ShowPlaybackPopupL( EMPXPopupTimeout );
+                }
+            break;
+            }
+        case EPbCmdPlay:
+        case EPbCmdPause:
+        case EPbCmdPlayPause:
+        case EPbCmdStartSeekForward:
+        case EPbCmdStartSeekBackward:
+            {
+            if ( showPlaybackPopup )
+                {
+                iMediaKeyHandler->ShowPlaybackPopupL( EMPXPopupNoTimeout );
+                }
+            break;
+            }
+        case EPbCmdStopSeeking:
+            {
+            if ( showPlaybackPopup )
+                {
+                iMediaKeyHandler->ShowPlaybackPopupL( EMPXPopupTimeout );
+                }
+            break;
+            }
+        case EPbCmdSetVolume:
+        case EPbCmdMuteVolume:
+        case EPbCmdUnMuteVolume:
+            {
+            if ( showVolumePopup && iMediaKeyHandler)
+                {
+                // display pop up volume control
+                iMediaKeyHandler->ShowVolumePopupL();
+                }
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Check if Active Idle app is on foreground
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAppUi::IsIdleAppForeground()
+    {
+    MPX_FUNC( "CMPXAppUi::IsIdleAppForeground" );
+    TBool isIdleActive( EFalse );
+    // Gets the window group id of the app in foreground
+    RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+    TInt windowGroupId = wsSession.GetFocusWindowGroup();
+    if ( windowGroupId >= 0 )
+        {
+        TRAP_IGNORE(
+            {
+            CApaWindowGroupName* wgName = CApaWindowGroupName::NewL(
+                wsSession, windowGroupId );
+
+            isIdleActive = ( wgName->AppUid() == KMPXUidIdleApp );
+            delete wgName;
+            } );
+        }
+
+    return isIdleActive;
+    }
+
+// -----------------------------------------------------------------------------
+// Check if Active Idle is enabled
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAppUi::IsActiveIdleEnabled()
+    {
+    MPX_FUNC( "CMPXAppUi::IsActiveIdleEnabled" );
+    TBool res( EFalse );
+
+#ifdef __ACTIVE_IDLE
+    if (! FeatureManager::FeatureSupported( KFeatureIdActiveIdle ) )
+        return EFalse;
+#endif
+    if ( !iSettingsRepository )
+        {
+        TRAP_IGNORE(
+            {
+            iSettingsRepository = CRepository::NewL(
+                KCRUidPersonalizationSettings );
+            } );
+        }
+
+    if ( iSettingsRepository )
+        {
+        TInt value( 0 );
+        TInt err( iSettingsRepository->Get( KSettingsActiveIdleState, value ) );
+        if ( !err && value )
+            {
+            res = ETrue;
+            }
+        }
+    return res;
+    }
+
+// ---------------------------------------------------------------------------
+// Creates and initializes all member variables
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::CreateMemberVariablesL()
+    {
+    MPX_FUNC("CMPXAppUi::CreateMemberVariablesL()");
+
+    TUid playbackMode( KAppUidMusicPlayerX );
+    TUid collectionMode( KAppUidMusicPlayerX );
+    if ( IsEmbedded() )
+        {
+        playbackMode = KPbModeNewPlayer;
+        collectionMode = MPXTlsHelper::HostUid(); // Collection context == host UID
+        }
+
+    if ( !iCollectionUtility )
+        {
+        iCollectionUtility = MMPXCollectionUtility::NewL( this, collectionMode );
+        }
+
+    // Get an instance of view utility
+    if ( !iViewUtility )
+        {
+        iViewUtility = MMPXViewUtility::UtilityL();
+        iViewUtility->AddObserverL( this );
+        iViewUtility->ConstructDefaultViewHistoryL();
+        }
+
+    if ( !iCollectionUiHelper )
+        {
+        iCollectionUiHelper = CMPXCollectionHelperFactory:: NewCollectionUiHelperL();
+        }
+
+    // Create a new playback utility instance
+    if ( !iPlaybackUtility )
+        {
+        iPlaybackUtility = MMPXPlaybackUtility::UtilityL( playbackMode );
+        iPlaybackUtility->AddObserverL( *this );
+
+        // get the current Volume and Max Volume
+        iPlaybackUtility->PropertyL(*this, EPbPropertyVolume);
+        iPlaybackUtility->PropertyL(*this, EPbPropertyMaxVolume);
+        if( !IsEmbedded() )
+            {
+            TInt randomMode = 0;
+            TInt repeatMode = 0;
+            
+            CRepository* repository = CRepository::NewL( KCRUidMPXMPSettings );
+            repository->Get( KMPXMPPlaybackRandomMode, randomMode );
+            repository->Get( KMPXMPPlaybackRepeatMode, repeatMode );
+            delete repository;
+            repository = NULL;
+            
+            MPX_DEBUG3("CMPXAppUi::CreateMemberVariablesL() randomMode(%d), repeatMode(%d)", randomMode, repeatMode);
+            
+            iPlaybackUtility->SetL( EPbPropertyRandomMode, randomMode );
+            iPlaybackUtility->SetL( EPbPropertyRepeatMode, repeatMode );
+            }
+        }
+
+    if ( !iMediaKeyHandler )
+        {
+        // Handle media key in appui
+        iMediaKeyHandler = MMPXMediaKeyHandler::NewL(
+            EDisplayVolumePopup | EDisplayMediaPopup,
+            this );
+        }
+
+    if( !IsEmbedded() )
+        {
+        iPathRestore = CMPXRestorePath::NewL( iPlaybackUtility,
+                                              iCollectionUiHelper );
+
+        // Fetch the music collection UID
+        RArray<TUid> uid;
+        CleanupClosePushL( uid );
+        uid.AppendL( TUid::Uid(EMPXCollectionPluginMusic) );
+        iMusicCollectionId = iCollectionUtility->CollectionIDL( uid.Array() );
+
+        // Fetch the podcast collection UID
+        if( !iDisablePodcasting )
+            {
+            uid.Reset();
+            uid.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) );
+            iPodcastCollectionId = iCollectionUtility->CollectionIDL( uid.Array() );;
+            }
+
+        CleanupStack::PopAndDestroy( &uid );
+        }
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT 
+    // In case Camese Superdistribution is enabled,
+    // we just need to initialize the Camese Drm Handler
+    // object. It will act as a collection utility
+    // observer and will handle WMDRM protected content
+    // in lieu of the AppUi.
+    if ( !iCameseDrmHandler )
+        {
+        iCameseDrmHandler = CCameseDrmHandler::NewL(iFile);
+        }
+#endif
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    if( !iDocHandler )
+        {
+        iDocHandler = CDocumentHandler::NewL(iEikonEnv->Process());
+        }
+#endif //RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    }
+
+// ---------------------------------------------------------------------------
+// Save file
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::DoSaveL()
+    {
+    MPX_DEBUG1("CMPXAppUi::DoSaveL(): entering");
+    ASSERT( iFile.SubSessionHandle() );
+
+    // Get target path
+    TFileName newFile;
+    CreateAutomaticSavePathL( newFile );
+    delete iSavePath;
+    iSavePath = NULL;
+    iSavePath = newFile.AllocL();
+
+    // display waiting note
+    TParsePtrC fileParse( newFile );
+    HBufC* string( StringLoader::LoadLC( R_MPX_SAVE_ONE_ITEM_WAIT_NOTE,
+                                         fileParse.Name() ));
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+        if ( iCommandInitiator )
+        {
+        HBufC8* filename8 = HBufC8::NewLC( KMaxFileName );
+        filename8->Des().Copy( fileParse.Name() );
+        TPtrC name(KNullDesC);
+        name.Set( fileParse.Name() );
+        HBufC8* data = HBufC8::NewLC(KMaxFileName);
+
+        TPtr8 dataPtr = data->Des();
+        RDesWriteStream str(dataPtr);
+
+        TPtrC8 b(KNullDesC8);
+        b.Set(*filename8);
+
+        str << b;
+        str.CommitL();
+
+        iCommandInitiator->IssueCommand( KMediatorSecondaryDisplayDomain,
+                                        KMPlayerNoteCategory,
+                                        EMPlayerNoteSaveOneItem,
+                                        TVersion (0,0,0),
+                                        *data );
+        CleanupStack::PopAndDestroy(2);
+        }
+//#endif // __COVER_DISPLAY
+// Cover UI end
+
+    iCommonUiHelper->ShowWaitNoteL(
+        *string,
+        R_AVKON_SOFTKEYS_EMPTY,
+        EFalse,
+        this );
+    CleanupStack::PopAndDestroy( string );
+
+    TMPXLaunchMode mode( MPXTlsHelper::LaunchMode() );
+    iPausedForSave = EFalse;
+    if ( EMPXLaunchModeTrack == mode )
+        {
+        // Close the file in playback engine
+        iPlaybackUtility->CommandL( EPbCmdPreservePosition );
+        iPlaybackUtility->CommandL( EPbCmdPreserveState );
+        iPlaybackUtility->CommandL( EPbCmdClose );
+        }
+    else
+        {
+        if ( EPbStatePlaying == iPlaybackUtility->StateL() )
+            {
+            iPlaybackUtility->CommandL( EPbCmdPause );
+            iPausedForSave = ETrue;
+            }
+        }
+
+    // Check disk space
+    TBool allowMove( MPXTlsHelper::AllowMove() );
+#ifdef RD_MULTIPLE_DRIVE
+    // Only need to check if on phone memory. All other drives were
+    // checked while creating the automatic save path
+    if( fileParse.Drive().CompareF( PathInfo::PhoneMemoryRootPath().Left(2) ) == 0 )
+#else
+    // Do not need to check if on memory card as that was already done
+    if( fileParse.Drive().CompareF( PathInfo::MemoryCardRootPath().Left(2) ) != 0 )
+#endif // RD_MULTIPLE_DRIVE
+        {
+        // If a file is being moved then there is no need to check for
+        // available space, as moving the file doesn't increase space consumption
+        // Check is still needed if a file is being copied
+        RFs& fs( iEikonEnv->FsSession() );
+        TInt size( 0 );
+        iFile.Size( size );
+        if ( !allowMove )
+            {
+            if ( SysUtil::FFSSpaceBelowCriticalLevelL( &fs, size ) )
+                {
+                iCommonUiHelper->DismissWaitNoteL();
+                User::Leave( KErrDiskFull ); // Phone memory full, Avkon shows note
+                }
+            }
+        }
+
+    // Create save helper if not created
+    if ( !iSaveHelper )
+        {
+        iSaveHelper = CMPXSaveHelper::NewL( this, this );
+        }
+
+    // s60 change. playlist could be opened from messaging app.
+    // in the case we don't want to copy in async mode
+    if (( EMPXLaunchModeTrack != MPXTlsHelper::LaunchMode() )
+        && (!iCommonUiHelper->IsHostMessagingL()))
+        {
+        iSaveHelper->StartCopyOperationL( iFile, newFile, allowMove );
+        iFile.Close();
+        }
+    else
+        {
+        if ( iCommonUiHelper->IsHostMessagingL() )
+            {
+            // save ringtone. We need to do sync call to save file because
+            // the asyc calls doesn't guarantee the file is copied completely.
+            // This is deal with a situation when set ringtone from messaging app
+            // that the ringtone files are kept in proviate directory.
+            iSaveHelper->StartCopyOperationL( iFile, newFile, EFalse, ETrue );
+            }
+        else
+            {
+            iSaveHelper->StartCopyOperationL( iFile, newFile, allowMove );
+            iFile.Close();
+            }
+        }
+
+    MPX_DEBUG1("CMPXAppUi::DoSaveL(): exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CreateAutomaticSavePathL
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::CreateAutomaticSavePathL( TFileName& aNewPath )
+    {
+    MPX_DEBUG1("CMPXAppUi::CreateAutomaticSavePathL(): entering");
+
+    RFs& fs( iEikonEnv->FsSession() );
+    TFileName fileName;
+    iFile.FullName( fileName );
+    TParsePtrC fileParse( fileName );
+
+    // Get the size and check if there's enough room to store
+    TInt size( 0 );
+    User::LeaveIfError( iFile.Size( size ));
+
+#ifdef RD_MULTIPLE_DRIVE
+    // Get the next available drive (internal mass store, MMC or phone memory)
+    HBufC* defaultRootPath( iCommonUiHelper->AvailableDriveLC( size ) );
+    aNewPath = *defaultRootPath;
+    CleanupStack::PopAndDestroy( defaultRootPath );
+#else
+    HBufC* defaultRootPath( iCommonUiHelper->DefaultDriveLC() );
+    aNewPath = *defaultRootPath;
+    CleanupStack::PopAndDestroy( defaultRootPath );
+    if ( aNewPath.CompareF( PathInfo::MemoryCardRootPath()) == 0 )
+        {
+        // only if memory card is supported, check if there is enough space
+        // on the card.
+        TBool isBelowCritical( EFalse );
+        TRAPD( err, isBelowCritical =
+                    SysUtil::MMCSpaceBelowCriticalLevelL( &fs, size ));
+        if ( err || isBelowCritical )
+            {
+            aNewPath = PathInfo::PhoneMemoryRootPath();
+            }
+        }
+#endif // RD_MULTIPLE_DRIVE
+
+    TInt pathResId( KErrNotFound );
+
+    // Get MIME type to see if it's a ringtone
+    RApaLsSession apa;
+    User::LeaveIfError( apa.Connect() );
+    CleanupClosePushL( apa );
+    TDataRecognitionResult result;
+    User::LeaveIfError( apa.RecognizeData( iFile, result ));
+    CleanupStack::PopAndDestroy( &apa );
+    TPtrC resultPtr( result.iDataType.Des() );
+    TInt val( 0 );
+    if ( iRingToneMimeTypes.Find( resultPtr, val ) == 0 )
+        {
+        pathResId = R_MPX_TARGETFOLDER_RINGTONES;
+        }
+    else if ( iCommonUiHelper->IsHostMessagingL() )
+        {
+        pathResId = R_MPX_TARGETFOLDER_ATTACHMENT;
+        }
+    else
+        {
+        pathResId = R_MPX_TARGETFOLDER_DOWNLOADS;
+        }
+
+    HBufC* defaultPath( StringLoader::LoadLC( pathResId ));
+    aNewPath += *defaultPath;
+    aNewPath += fileParse.NameAndExt();
+    CleanupStack::PopAndDestroy( defaultPath );
+
+    if ( !ConeUtils::FileExists( aNewPath ) )
+        {
+        User::LeaveIfError(
+            Application()->GenerateFileName( fs, aNewPath ));
+        }
+    else if ( iCommonUiHelper->IsHostMessagingL() )
+        {
+        MPXTlsHelper::SetNeedSave( EFalse );
+        }
+
+    MPX_DEBUG1("CMPXAppUi::CreateAutomaticSavePathL(): exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// HandlePostSaveOperationL
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::HandlePostSaveOperationL()
+    {
+    MPX_DEBUG1("CMPXAppUi::HandlePostSaveOperationL(): entering");
+
+    if ( iSaveMode == EMPXExitAppAfterSave )
+        {
+        MPX_DEBUG1( "CMPXAppUi::HandlePostSaveOperationL() exit after save" );
+        iSaveMode = EMPXSaveModeIdle;
+        iFile.Close();
+        RunAppShutter();
+        }
+    else if ( iSaveMode == EMPXExitHostAppAfterSave )
+        {
+        MPX_DEBUG1( "CMPXAppUi::HandlePostSaveOperationL() exit host app after save" );
+        iSaveMode = EMPXSaveModeIdle;
+        iFile.Close();
+        CAknEnv::RunAppShutter();
+        }
+    else
+        {
+        MPX_DEBUG1( "CMPXAppUi::HandlePostSaveOperationL() reopen" );
+        if ( EMPXLaunchModeTrack == MPXTlsHelper::LaunchMode() )
+            {
+            if ( iSavePath )
+                {
+                iCollectionUiHelper->OpenL( MPXTlsHelper::HostUid(),
+                                            *iSavePath,
+                                            this,
+                                            EMPXCollectionPluginMusic );
+                delete iSavePath;
+                iSavePath = NULL;
+                // User may set ringtone or contact more than once so don't close it after save.
+                // The iFile.Close will be called at destructor. It is safe because we are
+                // in Embedded mode.
+                if ( EMPXLaunchModeTrack != MPXTlsHelper::LaunchMode() )
+                    {
+                    iFile.Close();
+                    }
+                }
+            else
+                {
+                if ( iFile.SubSessionHandle() )
+                    {
+                    TFileName filename;
+                    iFile.FullName( filename );
+                    iCollectionUiHelper->OpenL( MPXTlsHelper::HostUid(),
+                                                filename,
+                                                this,
+                                                EMPXCollectionPluginMusic );
+                    }
+                }
+            }
+        else
+            {
+            if ( iPausedForSave )
+                {
+                iPlaybackUtility->CommandL( EPbCmdPlay );
+                }
+            }
+        iSaveMode = EMPXSaveModeIdle;
+        }
+
+    MPX_DEBUG1("CMPXAppUi::HandlePostSaveOperationL(): exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    TBool skip = EFalse;
+
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT       
+    if (aMessage)
+        {            
+        TMPXMessageId* id( aMessage->Value<TMPXMessageId>( KMPXMessageGeneralId ) );
+        if ( id )
+            {
+            if ( KMPXMessageGeneral == *id )
+                {
+                // Prefilter the playback event before passing in to 
+                // AppUi handler.        
+                MPX_TRAP( aError, HandleCamesePlaybackPreProcessingL(*aMessage, skip) );
+                }
+            }
+        }
+#endif  
+
+    if ( !skip && aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handle media properties.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError )
+    {
+    MPX_FUNC( "CMPXAppUi::HandleCollectionMediaL" );
+    TBool okToOpen( ETrue );
+
+    const CMPXMedia* media( &aMedia );
+
+    // Check if rights OK
+    if ( !aError )
+        {
+        // First make sure it's a DRM file and the file protection type
+        if ( media->IsSupported( KMPXMediaDrmProtected ) &&
+                media->IsSupported( KMPXMediaDrmType ) )
+            {
+            TBool prot(
+                    media->ValueTObjectL<TBool>( KMPXMediaDrmProtected ) );
+            if ( prot )
+                {
+#ifdef CAMESE_IN_DRM_UTILITY
+                // OMA and WMDRM cases will be handled with same logic now
+                okToOpen = HandleDRMProtectionL(*media);
+#else
+                TMPXMediaDrmType type( 
+                        media->ValueTObjectL<TMPXMediaDrmType>( KMPXMediaDrmType ) );
+                if ( EMPXDrmTypeWMA == type )
+                    {
+                    okToOpen = HandleWMAProtectionL();
+                    }
+
+                else
+                    {
+                    okToOpen = HandleDRMProtectionL(*media);
+                    }
+#endif                        
+                }
+
+            }
+        }
+    else
+        {
+        okToOpen = EFalse;
+#ifndef __CAMESE_SUPERDISTRIBUTION_SUPPORT
+        // Leave Error Handling for Camese Ui
+        // if Camese support is enabled
+        iCommonUiHelper->HandleErrorL( aError );
+#endif
+        }
+
+    // If all checking passed then open
+    if ( okToOpen )
+        {
+        iCollectionUtility->Collection().OpenL();
+        }
+    else if ( MPXTlsHelper::NeedSave() )
+        {
+        MPX_DEBUG1( "CMPXAppUi::HandleCollectionMediaL open failed, attempting to save" );
+        HandleCommandL( EMPXCmdSaveAndExit );
+        }
+    }
+
+    // ---------------------------------------------------------------------------
+    // CMPXAppUi::HandleWMAProtectionL
+    // ---------------------------------------------------------------------------
+    //
+TBool CMPXAppUi::HandleWMAProtectionL()
+    {
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT    
+
+    if ( !IsPlaybackRemote() )
+        {
+        // Indicates we are currently handling WMA Protected Media
+        iHandlingProtectedWMAMedia = ETrue;  
+        }
+#endif
+    // Regardless of Camese support enabled or not,
+    // we always proceed to starting playback of
+    // protected WMA media.      
+    return ETrue;       
+    }
+
+    // ---------------------------------------------------------------------------
+    // CMPXAppUi::HandleDRMProtectionL
+    // ---------------------------------------------------------------------------
+    //
+    TBool CMPXAppUi::HandleDRMProtectionL(const CMPXMedia& aMedia)
+        {
+        TBool okToOpen( ETrue );
+
+    // DRM Protection
+    // Now check the rights status and if it's about to expire.
+    if ( aMedia.IsSupported( KMPXMediaDrmRightsStatus ) &&
+         aMedia.IsSupported( KMPXMediaDrmAboutToExpire ) )
+        {
+        TMPXMediaDrmRightsStatus status(
+            aMedia.ValueTObjectL<TMPXMediaDrmRightsStatus>(
+                KMPXMediaDrmRightsStatus ) );
+        TBool aboutToExpire(
+            aMedia.ValueTObjectL<TBool>( KMPXMediaDrmAboutToExpire) );
+
+        // Preview clips cannot be saved
+        if ( EMPXDrmRightsPreview == status )
+            {
+            MPXTlsHelper::SetNeedSave( EFalse );
+            }
+
+        RFile* file( NULL );
+        if ( iFile.SubSessionHandle() &&
+             MPXTlsHelper::LaunchMode() != EMPXLaunchModePlaylist )
+            {
+            file = &iFile;
+            }
+
+        // Display error message if about to expire, or if
+        // there are no rights
+        if ( aboutToExpire )
+            {
+            TInt ret( iCommonUiHelper->HandleErrorL(
+                        KMPXRightsAboutToExpire, &aMedia, file ));
+            if ( KErrNone != ret )
+                {
+                okToOpen = EFalse;
+                }
+            }
+        else if ( EMPXDrmRightsMissing == status ||
+                EMPXDrmRightsExpired == status )
+            {
+            // DRMStream:
+            // for silent cases the rights may have been recieved
+            TInt ret( iCommonUiHelper->HandleErrorL( KErrCANoRights, &aMedia, file ));
+            if ( KErrNone != ret )
+                {
+                okToOpen = EFalse;
+                }
+            }
+
+        if ( !okToOpen )
+            {
+            // If embedded and no rights, then close
+            if ( IsEmbedded() )
+                {
+                // Only close embedded mode if not a playlist
+                if ( MPXTlsHelper::LaunchMode() != EMPXLaunchModePlaylist )
+                    {
+                    RunAppShutter();
+                    }
+                else
+                    {
+                    // Reset collection path and save index
+                    MMPXCollection& col( iCollectionUtility->Collection() );
+                    CMPXCollectionPath* cPath( col.PathL() );
+                    CleanupStack::PushL( cPath );
+                    iCurrentIndex = cPath->Index();
+                    cPath->Back();
+                    col.OpenL( *cPath );
+                    CleanupStack::PopAndDestroy( cPath );
+                    }
+                }
+
+            // If standalone and no rights, mark item as invalid
+            // and reset collection path
+            else
+                {
+                // Check if DRM Flag is already mark as invalid, only set if it's not.
+                MMPXCollection& col( iCollectionUtility->Collection() );
+                TBool setDrm( ETrue );
+                TBool clearOtherFlags( EFalse );
+                TUint flag( 0 );
+
+                if ( aMedia.IsSupported( KMPXMediaGeneralFlags ))
+                    {
+                    flag = aMedia.ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+                    if ( flag & KMPXMediaGeneralFlagsIsDrmLicenceInvalid )
+                        {
+                        setDrm = EFalse;
+                        }
+                    if ( flag & KMPXMediaGeneralFlagsIsCorrupted ||
+                         flag & KMPXMediaGeneralFlagsIsInvalid )
+                        {
+                        clearOtherFlags = ETrue;
+                        }
+                    }
+                if ( setDrm )
+                    {
+                    CMPXMedia* entry( CMPXMedia::NewL( aMedia ));
+                    CleanupStack::PushL( entry );
+
+                    flag = KMPXMediaGeneralFlagsSetOrUnsetBit |
+                           KMPXMediaGeneralFlagsIsDrmLicenceInvalid;
+                    entry->SetTObjectValueL( KMPXMediaGeneralFlags, flag );
+                    SetMediaL( *entry );
+                    CleanupStack::PopAndDestroy( entry );
+                    }
+
+                // Reset corrupted and invalid flags if they are set
+                if ( clearOtherFlags )
+                    {
+                    CMPXMedia* entry( CMPXMedia::NewL( aMedia ));
+                    CleanupStack::PushL( entry );
+
+                    flag = KMPXMediaGeneralFlagsIsCorrupted |
+                           KMPXMediaGeneralFlagsIsInvalid;
+                    entry->SetTObjectValueL( KMPXMediaGeneralFlags, flag );
+                    SetMediaL( *entry );
+                    CleanupStack::PopAndDestroy( entry );
+                    }
+
+                // Reset collection path and save index
+                CMPXCollectionPath* cPath( col.PathL() );
+                CleanupStack::PushL( cPath );
+                iCurrentIndex = cPath->Index();
+                cPath->Back();
+                col.OpenL( *cPath );
+                CleanupStack::PopAndDestroy( cPath );
+                }
+            }
+        }
+    else
+        {
+        // If rights status and about to expire attributes are
+        // not set, retrieve them.
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
+                                     EMPXMediaGeneralBasic |
+                                     EMPXMediaGeneralUri |
+                                     EMPXMediaGeneralFlags |
+                                     EMPXMediaGeneralCollectionId |
+                                     EMPXMediaGeneralId ));
+        attrs.Append( KMPXMediaDrmAll );
+        CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL( cPath );
+        iCollectionUtility->Collection().MediaL(
+            *cPath,
+            attrs.Array() );
+        CleanupStack::PopAndDestroy( cPath );
+        CleanupStack::PopAndDestroy( &attrs );
+        okToOpen = EFalse;
+        }
+
+    return okToOpen;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle Broadcast messages from the collection
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleBroadcastMessageL( const CMPXMessage& aMessage )
+    {
+    // Disable media keys during system operations.
+    TInt op( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+    MPX_DEBUG2( "CMPXAppUi::HandleBroadcastMessageL EBroadcastEvent, op = %d", op );
+    if( op == EMcMsgUSBMassStorageStart ||
+        op == EMcMsgUSBMTPStart ||
+        op == EMcMsgRefreshStart ||
+        op == EMcMsgFormatStart )
+        {
+        MPX_DEBUG1( "CMPXAppUi::HandleBroadcastMessageL EBroadcastEvent disable media key" );
+        if ( !IsEmbedded() || op != EMcMsgUSBMTPStart )
+            {
+            iMediaKeyHandler->SetEnableMediaKeys( EFalse );
+            }
+        }
+    else if( op == EMcMsgUSBMassStorageEnd ||
+             op == EMcMsgUSBMTPEnd ||
+             op == EMcMsgRefreshEnd ||
+             op == EMcMsgFormatEnd )
+        {
+        MPX_DEBUG1( "CMPXAppUi::HandleBroadcastMessageL EBroadcastEvent enable media key" );
+        if ( !IsEmbedded() || op != EMcMsgUSBMTPEnd )
+            {
+            iMediaKeyHandler->SetEnableMediaKeys( ETrue );
+            }
+        }
+    if (op == EMcMsgRefreshEnd)
+        {
+        TInt err = aMessage.ValueTObjectL<TInt>(KMPXMessageGeneralData);
+
+        MPX_DEBUG2("EMcMsgRefreshEnd, err = %d", err);
+
+        if (err < KErrNone)
+            iCommonUiHelper->HandleErrorL(err);
+        }
+
+    // Re-open the path so that the view can be refreshed,
+    // because there could be changes in the view contents
+    //
+    if ( op == EMcMsgUSBMassStorageStart ||
+         op == EMcMsgUSBMTPStart )
+        {
+        iIsUsbOnGoing = ETrue;
+        if ( iProcessParameter )
+            {
+            iProcessParameter->SetUsbInUse( ETrue );
+            }
+        }
+    if ( op == EMcMsgUSBMassStorageEnd ||
+        op == EMcMsgUSBMTPEnd )
+        {
+        iIsUsbOnGoing = EFalse;
+        if ( iProcessParameter )
+            {
+            iProcessParameter->SetUsbInUse( EFalse );
+            }
+        if( op == EMcMsgUSBMTPEnd )
+            {
+            DoUpdatePluginRefreshedTimeL();
+            }
+        }
+    if( op == EMcMsgFormatStart )
+        {
+        iFormattingOnGoing = ETrue;
+        }
+    else if( op == EMcMsgFormatEnd )
+        {
+        iFormattingOnGoing = EFalse;
+        }
+    else if ( op == EMcMsgRefreshStart )
+        {
+        iRefreshOnGoing = ETrue;
+        if( iProcessParameter )
+            {
+            iProcessParameter->SetRefreshState( ETrue );
+            }
+        }
+    else if ( op == EMcMsgRefreshEnd )
+        {
+        iRefreshOnGoing = EFalse;
+        if( iProcessParameter )
+            {
+            iProcessParameter->SetRefreshState( EFalse );
+            }
+        }
+
+    if ( op == EMcMsgUSBMTPEnd )
+        {
+            if ( !IsEmbedded() )
+                {
+                CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL ( );
+                CleanupStack::PushL ( cPath );
+                TBool usbDiskRemovalEvent(EFalse);
+                if ( (op == EMcMsgDiskRemoved) && iIsUsbOnGoing )
+                    {
+                    usbDiskRemovalEvent = ETrue;
+                    }
+
+                if ( cPath->Levels ( )> 1 && !iFormattingOnGoing && !usbDiskRemovalEvent &&
+                     iCurrentViewType.iUid != KMPXPluginTypePlaybackUid &&
+                     iCurrentViewType.iUid != KMPXPluginTypeAudioEffectsUid )
+                    {
+
+                        cPath->Back ( );
+                        iCollectionUtility->Collection().OpenL ( *cPath );
+                        
+                    }
+                CleanupStack::PopAndDestroy ( cPath );
+                }
+
+        }
+    else if ( op == EMcMsgDiskRemoved )
+        {
+        if ( !IsEmbedded() )
+            {
+            CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL ( );
+            CleanupStack::PushL ( cPath );
+            TBool usbDiskRemovalEvent(EFalse);
+            if ( (op == EMcMsgDiskRemoved) && iIsUsbOnGoing )
+                {
+                usbDiskRemovalEvent = ETrue;
+                }
+
+            if ( cPath->Levels ( )> 1 && !iFormattingOnGoing && !usbDiskRemovalEvent &&
+                 iCurrentViewType.iUid != KMPXPluginTypePlaybackUid )
+                {
+
+                    cPath->Back ( );
+                    iCollectionUtility->Collection().OpenL ( *cPath );
+                    
+                }
+            CleanupStack::PopAndDestroy ( cPath );
+            }
+        }
+    // Re-open the collection view after a refresh
+    // and after album art or metadata dialog or add songs editor dialog closes
+    if (((op == EMcMsgRefreshEnd ) || (op == EMcMsgUSBMassStorageEnd))
+            && (IsActiveView(KMPXPluginTypeAlbumArtEditorUid)
+                    || IsActiveView(KMPXPluginTypeMetadataEditorUid)
+                    || IsActiveView( KMPXPluginTypeAddSongsEditorUid ) ) )
+        {
+        if ( !IsEmbedded() )
+            {
+            iRefreshCollectionView = ETrue;
+            }
+        }
+    // Re-open the collection view after a refresh
+    // if we were currently in collection view.
+    if( op == EMcMsgRefreshEnd && IsActiveView(KMPXPluginTypeCollectionUid))
+        {
+        if( !IsEmbedded() )
+            {
+            iRefreshCollectionView = EFalse;
+            CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( path );
+            if( path->Levels() > 1 &&
+                iCurrentViewType.iUid != KMPXPluginTypePlaybackUid )
+                {
+                path->Back();
+                iCollectionUtility->Collection().OpenL( *path );
+                }
+            CleanupStack::PopAndDestroy( path );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handles commands passed in by other applications
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleCommandParametersL( const TDesC8& aCommand )
+    {
+    MPX_FUNC( "CMPXAppUi::HandleCommandParametersL" );
+    if ( !iIgnoreExternalCommand && aCommand.Size() > 0 )
+        {
+        delete iProcessParameter;
+        iProcessParameter = NULL;
+        TUid collectionMode( KAppUidMusicPlayerX );
+        if ( IsEmbedded() )
+            {
+            collectionMode = MPXTlsHelper::HostUid(); // Collection context == host UID
+            }
+        iProcessParameter = CMPXCommandHandler::NewL(
+            iPlaybackUtility, collectionMode, aCommand );
+
+        TBool fwdStandAlone( iProcessParameter->ForwardCmdToStandAloneMode() );
+        TBool fwdNowPlaying( iProcessParameter->ForwardCmdToNowPlaying() );
+
+        MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL iIsUsbOnGoing = %d", iIsUsbOnGoing );
+        // if ActiveIdle plugin sends a command i.e., EMPXCmdFwdNowPlaying, it doesn't make any dialogs dismiss.
+        if ( !fwdNowPlaying && iCurrentViewType.iUid != KMPXPluginTypeWaitNoteDialogUid && !iIsUsbOnGoing )
+            {
+            MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL dismissing dialogs" );
+            // dismiss all the dialogs except scaning wait note
+            AknDialogShutter::ShutDialogsL( *CEikonEnv::Static() );
+            }
+
+        iCmdActivatedViewTypeId = iProcessParameter->ActivatedViewTypeId();
+        MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL activated view type= =0x%x",
+            iCmdActivatedViewTypeId );
+
+        MPX_DEBUG3( "CMPXAppUi::HandleCommandParametersL should forward to standalone %d, now playing %d", fwdStandAlone, fwdNowPlaying );
+
+        RArray<TProcessId> procArray;
+        CleanupClosePushL( procArray );
+        TProcessId npProcId( 0 );
+        MMPXPlaybackUtility* activePbU = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
+        activePbU->GetClientsL( procArray );
+        activePbU->Close();
+        npProcId = procArray[ 0 ];
+        CleanupStack::PopAndDestroy( &procArray );
+
+        TInt64 standAlonePId( CMPXCommonUiHelper::StandAloneModePId() );
+
+        RProcess currProc;
+        TProcessId currPId( currProc.Id() );
+        currProc.Close();
+
+        MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL current pid 0x%lx", currPId.Id() );
+        MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL nppid 0x%lx", npProcId.Id() );
+        MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL standalone pid 0x%lx", standAlonePId );
+
+        if ( ( !fwdStandAlone && !fwdNowPlaying ) || // no forward
+             ( fwdStandAlone && ( currPId.Id() == standAlonePId ) ) || // we're standalone mode
+             ( fwdNowPlaying && ( currPId == npProcId ) ) ) // we are now playing
+            {
+            if ( iPathRestore )
+                {
+                if ( !iPathRestore->Initialized() &&
+                    iProcessParameter->IsInitPlaybackEngineNeeded() )
+                    {
+                    if ( iPathRestore->IsInitializing() )
+                        {
+                        MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL command handling delayed until path restore completes" );
+                        // delay command processing until path restore is complete
+                        iDelayedParameterHandling = ETrue;
+                        }
+                    else
+                        {
+                        MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL canceling path restore" );
+                        // command will init playback engine, can cancel path restore's init
+                        iPathRestore->CancelInit();
+                        }
+                    }
+                }
+            if ( !iDelayedParameterHandling )
+                {
+                // command should be handled locally
+                iProcessParameter->ProcessMessageL( iIsUsbOnGoing, iRefreshOnGoing, iFormattingOnGoing );
+                }
+            }
+        else
+            {
+            TInt64 procId( 0 );
+            if ( iProcessParameter->ForwardCmdToStandAloneMode() )
+                {
+                MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL forwarding to standalone" );
+                procId = standAlonePId;
+                }
+            else if ( iProcessParameter->ForwardCmdToNowPlaying() )
+                {
+                MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL forwarding to now playing" );
+                procId = npProcId.Id();
+                }
+            delete iProcessParameter;
+            iProcessParameter = NULL;
+
+            if ( procId != 0 )
+                {
+                // standalone music player exist, forward command to it
+                RWsSession& wsSession( iCoeEnv->WsSession() );
+                TInt wgId( MPXUser::FindWindowGroupIdL( procId, wsSession ) );
+                MPX_DEBUG2( "CMPXAppUi::HandleCommandParametersL() forwarding message to wgId 0x%x", wgId );
+                wsSession.SendMessageToWindowGroup( wgId, KAppUidMusicPlayerX, aCommand );
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL no music player instance, starting a new one" );
+                // no music player instance, start a new one
+                RApaLsSession ls;
+                CleanupClosePushL( ls );
+                User::LeaveIfError( ls.Connect() );
+                TApaAppInfo appInfo;
+                User::LeaveIfError( ls.GetAppInfo( appInfo, KAppUidMusicPlayerX ) );
+                CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC();
+                apaCommandLine->SetExecutableNameL( appInfo.iFullName );
+                apaCommandLine->SetTailEndL( aCommand );
+                User::LeaveIfError( ls.StartApp( *apaCommandLine ) );
+                CleanupStack::PopAndDestroy(); // apaCommandLine
+                CleanupStack::PopAndDestroy(); // ls
+                }
+            }
+        }
+    else if ( iIgnoreExternalCommand )
+        {
+        MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL command to be ignored, requested by views" );
+        // bring musicplayer to foreground
+        // have to use window group to activate, in case some other window
+        // has higher priority than us (e.g. playback popup and volume popup)
+        RWindowGroup myWin = CEikonEnv::Static()->RootWin();
+        myWin.SetOrdinalPosition( 0, ECoeWinPriorityNormal );
+        }
+    else
+        {
+        MPX_DEBUG1( "CMPXAppUi::HandleCommandParametersL invalid parameter length, command ignored" );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXAppUi::DoHandlePlaybackMessageL" );
+
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EPlayerChanged:
+                {
+                MPX_DEBUG1( "CMPXAppUi::DoHandlePlaybackMessageL EPlayerChanged" );
+                // get the current Volume and Max Volume
+                iPlaybackUtility->PropertyL(*this, EPbPropertyVolume);
+                iPlaybackUtility->PropertyL(*this, EPbPropertyMaxVolume);
+                HandlePlaybackPlayerChangedL();
+                break;
+                }
+            case TMPXPlaybackMessage::EInitializeComplete:
+                {
+                MPX_DEBUG1( "CMPXAppUi::DoHandlePlaybackMessageL init complete" );
+                TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+                if ( ( IsEmbedded() || iPathRestore && iPathRestore->Initialized() ) && data )
+                    {
+                    TMPXLaunchMode mode = MPXTlsHelper::LaunchMode();
+                    if ( EMPXLaunchModeStopped != mode &&
+                       EMPXLaunchModeUnknown!= mode )
+                        {
+                        // Play the track
+                        MPX_DEBUG1( "CMPXAppUi::DoHandlePlaybackMessageL send play command" );
+                        CMPXCommand* cmd( CMPXCommand::NewL() );
+                        CleanupStack::PushL( cmd );
+                        cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId,
+                                               KMPXCommandIdPlaybackGeneral );
+                        cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType,
+                                               EPbCmdPlay );
+                        cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync,
+                                                      ETrue );
+                        cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer,
+                                                ETrue );
+                        iPlaybackUtility->CommandL( *cmd );
+                        CleanupStack::PopAndDestroy( cmd );
+                        }
+                    }
+                else // iPathRestore not initialized
+                    {
+                    if ( iPathRestore )
+                        {
+                        iPathRestore->SetInitialized( ETrue );
+                        }
+
+                    if ( iStandAlone )
+                        {
+                        iPlaybackUtility->CommandL( EPbCmdPlay );
+                        }
+
+                    if ( iDelayedParameterHandling )
+                        {
+                        MPX_DEBUG1( "CMPXAppUi::DoHandlePlaybackMessageL start command handling" );
+                        iDelayedParameterHandling = EFalse;
+                        iProcessParameter->ProcessMessageL( iIsUsbOnGoing, iRefreshOnGoing, iFormattingOnGoing );
+                        }
+                    }
+
+                break;
+                }
+            case TMPXPlaybackMessage::EPlayerUnavailable:
+                {
+                MPX_DEBUG1( "CMPXAppUi::DoHandlePlaybackMessageL EPlayerUnavailable" );
+                iUPnPUnavailableEventFromCollection = EFalse;
+
+                MMPXSource* source = iPlaybackUtility->Source();
+                if ( source )
+                    {
+                    CMPXCollectionPlaylist* playlist = source->PlaylistL();
+                    if ( playlist )
+                        {
+                        CleanupStack::PushL( playlist );
+                        iPlaybackUtility->PlayerManager().ClearSelectPlayersL();
+                        MPX_DEBUG2( "CMPXAppUi::DoHandlePlaybackMessageL playlist index = %d", playlist->Index());
+                        iPlaybackUtility->InitL( *playlist, ETrue );
+                        CleanupStack::PopAndDestroy( playlist );
+                        }
+                    }
+
+                if ( iCurrentViewType.iUid != KMPXPluginTypePlaybackUid )
+                    {
+                    iUPnPUnavailableEventFromCollection = ETrue;
+                    }
+
+                break;
+                }
+            case TMPXPlaybackMessage::EPropertyChanged:
+                {
+                TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+                TMPXPlaybackProperty property(
+                    static_cast<TMPXPlaybackProperty>( type ) );
+                if ( property == EPbPropertyVolume )
+                    {
+                    iCurrentVolume = aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData );
+                    MPX_DEBUG2( "CMPXAppUi::DoHandlePlaybackMessageL iCurrentVolume = %d", iCurrentVolume );
+                    }
+                else if( property == EPbPropertyRandomMode 
+                        || property == EPbPropertyRepeatMode )
+                    {
+                    TInt value = aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData );
+                    TUint32 key = KMPXMPPlaybackRandomMode;
+                    if( property == EPbPropertyRepeatMode )
+                        {
+                        key = KMPXMPPlaybackRepeatMode;
+                        }
+                    MPX_DEBUG3( "CMPXAppUi::DoHandlePlaybackMessageL EPropertyChanged key = %d, value = %d", key, value );
+                    CRepository* repository = CRepository::NewL( KCRUidMPXMPSettings );
+                    repository->Set( key, value );
+                    delete repository;
+                    repository = NULL;
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+                TMPXPlaybackState state(
+                    static_cast<TMPXPlaybackState>( type ) );
+
+#ifndef FF_OOM_MONITOR2_COMPONENT
+                // Obtain wgname
+                // Gets the window group id of the app in foreground
+                RWsSession& wsSession( iCoeEnv->WsSession() );
+                RWindowGroup myWin = iEikonEnv->RootWin();
+                CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC( wsSession, myWin.Identifier() );
+#endif  //FF_OOM_MONITOR2_COMPONENT
+                switch( state )
+                    {
+                    case EPbStateInitialising:
+                    case EPbStatePlaying:
+                    case EPbStatePaused:
+                    case EPbStateSeekingForward:
+                    case EPbStateSeekingBackward:
+                    case EPbStateBuffering:
+                    case EPbStateDownloading:
+                        {
+#ifdef FF_OOM_MONITOR2_COMPONENT
+                        SetMpxOomPriorityL( ROomMonitorSession::EOomPriorityBusy );
+#else
+                        wgName->SetBusy(ETrue);
+#endif //FF_OOM_MONITOR2_COMPONENT
+                        break;
+                        }
+                    case EPbStateNotInitialised:
+                    case EPbStateStopped:
+                    case EPbStateShuttingDown:
+                        {
+#ifdef FF_OOM_MONITOR2_COMPONENT
+                        SetMpxOomPriorityL( ROomMonitorSession::EOomPriorityNormal );
+#else
+                        wgName->SetBusy(EFalse);
+#endif //FF_OOM_MONITOR2_COMPONENT
+                        break;
+                        }
+                    default:
+                        {
+                        break;
+                        }
+                    }
+#ifndef FF_OOM_MONITOR2_COMPONENT
+                CleanupStack::PopAndDestroy();  //wgName
+#endif //FF_OOM_MONITOR2_COMPONENT
+
+                break;
+                }
+            case TMPXPlaybackMessage::EError:
+                {
+                MPX_DEBUG2( "CMPXAppUi::DoHandlePlaybackMessageL error = %d", aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT   
+// ---------------------------------------------------------------------------
+// Handle Camese Playback Message Preprocessing
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleCamesePlaybackPreProcessingL(const CMPXMessage& aMessage,                                                   
+                                                   TBool& aSkipEvent)
+    {
+    aSkipEvent = EFalse;
+    
+    // Pre-filter events, avoiding handling if Camese 
+    // is handling WMA songs in pre-init phase.     
+    if (iHandlingProtectedWMAMedia)
+        {
+        TInt event = aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent );
+        if (event == TMPXPlaybackMessage::EPlayerChanged)            
+            { 
+            MPX_DEBUG1("CMPXAppUi::HandleCamesePlaybackPreProcessingL EPlayerChanged");
+
+            // Do not allow processing of the player changed stage
+            // to avoid view switching.
+            aSkipEvent = ETrue;     
+            }
+        else if (event == TMPXPlaybackMessage::EInitializeComplete)
+            {
+            MPX_DEBUG1("CMPXAppUi::HandleCamesePlaybackPreProcessingL EStateChanged EInitializeComplete");
+            // Execute view switching now.
+            HandlePlaybackPlayerChangedL();  
+            // Finished Protected Media Handling stage.
+            iHandlingProtectedWMAMedia = EFalse;                                                    
+            }
+        else if (event == TMPXPlaybackMessage::EError)
+            {
+            MPX_DEBUG2( "CMPXAppUi::HandleCamesePlaybackPreProcessingL error = %d", aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+
+            // Finished Protected Media Handling stage.
+            iHandlingProtectedWMAMedia = EFalse;
+            }
+        }   
+    }
+#endif
+
+// ---------------------------------------------------------------------------
+// Handle playback message for player changed.
+// ---------------------------------------------------------------------------
+//
+ void CMPXAppUi::HandlePlaybackPlayerChangedL()
+    {
+    // Don't switch views if we are getting player changed
+    // event from path restore or when we switch player because of a UPnP
+    // Unavailable event in Collection view
+    //
+    if ( !iUPnPUnavailableEventFromCollection &&
+         ( IsEmbedded() || iPathRestore ) )
+        {
+        if( iPathRestore && !iPathRestore->Initialized() )
+            {
+            iPathRestore->CancelInit();
+            }
+        MMPXPlayer* player =
+            iPlaybackUtility->PlayerManager().CurrentPlayer();
+        TUid pluginUid( KNullUid );
+        RArray<TUid> array;
+        CleanupClosePushL( array );
+
+        if ( player )
+            {
+            pluginUid = player->UidL();
+            MPX_DEBUG2( "CMPXAppUi::HandlePlaybackPlayerChangedL pluginUid uid = 0x%x", pluginUid.iUid );
+            array.AppendL( pluginUid );
+            }
+
+        MMPXSource* source = iPlaybackUtility->Source();
+        if ( source )
+            {
+            CMPXCollectionPlaylist* playlist = source->PlaylistL();
+            if ( playlist )
+                {
+                CleanupStack::PushL( playlist );
+                CMPXCollectionPath* pbPath =
+                    CMPXCollectionPath::NewL( playlist->Path() );
+                CleanupStack::PushL( pbPath );
+                if ( pbPath->Levels() > 0 )
+                    {
+                    MPX_DEBUG2( "CMPXAppUi::HandlePlaybackPlayerChangedL collection uid = 0x%x", pbPath->Id( 0 ).iId1 );
+                    array.AppendL( TUid::Uid( pbPath->Id( 0 ) ) );
+                    }
+                CleanupStack::PopAndDestroy( pbPath );
+                CleanupStack::PopAndDestroy( playlist );
+                }
+            }
+
+        if ( IsEmbedded() )
+            {
+            array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ));
+            }
+        else
+            {
+            array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) );
+            }
+        iViewUtility->ActivateViewL( array );
+        CleanupStack::PopAndDestroy( &array );
+
+        MPX_DEBUG2( "-->Plugin Uid:(%d)", pluginUid.iUid );
+        }
+    iUPnPUnavailableEventFromCollection = EFalse;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Callback function to signal that saving a file is complete
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::DoHandleSaveCompleteL( TInt aErr )
+    {
+    MPX_DEBUG2("CMPXAppUi::DoHandleSaveCompleteL(%d) entering", aErr);
+
+    if( iIsUsbOnGoing && (aErr != KErrNone) )
+        {
+        // Kill mpx embedded mode so usb can start
+        //
+        MPX_DEBUG1("CMPXAppUi::HandleAddFileCompleteL usb ongoing");
+        iSaveMode = EMPXExitAppAfterSave;
+        HandlePostSaveOperationL();
+        }
+    else if ( !iCancelFileMan )
+        {
+        if ( !aErr )
+            {
+            if ( !iCollectionHelper )
+                {
+                iCollectionHelper = CMPXCollectionHelperFactory::NewCollectionHelperL();
+                }
+            iCollectionHelper->AddL( *iSavePath, this );
+            if ( iView )
+                {
+                if ( iSaveMode == EMPXAssignRingtone )
+                    {
+                    TRAP_IGNORE(
+                        MPXTlsHelper::SetFilePath( iSavePath->Des() );
+                        iView->HandleCommandL( EMPXCmdAfterSaveAiwCmdAssign ));
+                    MPXTlsHelper::SetNeedSave( EFalse );
+                    }
+                else if ( iSaveMode == EMPXAssignContact )
+                    {
+                    TRAP_IGNORE(
+                        iView->HandleCommandL( EMPXCmdAfterSaveUseAsCascade ));
+                    MPXTlsHelper::SetNeedSave( EFalse );
+                    }
+                }
+            }
+        else
+            {
+            iCommonUiHelper->DismissWaitNoteL();
+            iCommonUiHelper->HandleErrorL( aErr );
+            delete iSavePath;
+            iSavePath = NULL;
+            if ( iView )
+                {
+                iView->HandleCommandL( EMPXCmdSaveCancelled );
+                }
+            HandlePostSaveOperationL();
+            }
+        }
+    else
+        {
+        MPX_DEBUG1("CMPXAppUi::DoHandleSaveCompleteL() during cancel, starting callback" );
+        iIdle = CIdle::NewL( CActive::EPriorityIdle );
+        iSaveMode = EMPXSaveModeIdle;
+        iIdle->Start( TCallBack( CMPXAppUi::DeferredExitCallback, this ) );
+        }
+
+    MPX_DEBUG1("CMPXAppUi::DoHandleSaveCompleteL() exiting" );
+    }
+
+// -----------------------------------------------------------------------------
+// Handle collection message
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::DoHandleCollectionMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXAppUi::DoHandleCollectionMessageL" );
+
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXCustomMessageId == id )
+        {
+        // This is a custom collection message
+        //
+        TInt colId = aMessage.ValueTObjectL<TInt>( TMPXAttribute( KMPXCustomMessageId,
+                                                      EMPXCustomMessageCollectionId ) );
+        TInt op = aMessage.ValueTObjectL<TInt>( TMPXAttribute( KMPXCustomMessageId,
+                                                   EMPXCustomMessageEventType ) );
+        TInt err = aMessage.ValueTObjectL<TInt>( TMPXAttribute( KMPXCustomMessageId,
+                                                    EMPXCustomMessageErrorCode ) );
+
+        MPX_DEBUG4("CMPXAppUi::DoHandleCollectionMessageL -- KMPXCustomMessageId \
+                    %i %i %i", colId, op, err);
+
+        if( colId == iMusicCollectionId.iUid ||
+            colId == iPodcastCollectionId.iUid )
+            {
+            if( op == EMcsOpen )
+                {
+                // @todo, need UI spec
+                // popup special error note for out of disk
+                iCommonUiHelper->HandleErrorL( err );
+                }
+            }
+        }
+    else if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+
+        MPX_DEBUG3( "CMPXAppUi::DoHandleCollectionMessageL Event = %d, Type() = %d",
+            event, type );
+        if ( event == TMPXCollectionMessage::ECollectionChanged && !SuppressCollectionView() )
+            {
+            MPX_DEBUG1( "CMPXAppUi::DoHandleCollectionMessageL ECollectionChanged" );
+            if ( EMPXLaunchModeTrack != MPXTlsHelper::LaunchMode() )
+                {
+                CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+                CleanupStack::PushL( cPath );
+                if ( cPath->Levels() != 1 )
+                    {
+                    RArray<TUid> uids;
+                    CleanupClosePushL( uids );
+                   if ( iLaunchModePlaying && EMPXLaunchModePlaylist == MPXTlsHelper::LaunchMode() )
+                        {
+                        iLaunchModePlaying = EFalse;
+                        cPath->SelectL(TMPXItemId(0));
+                        iCollectionUtility->Collection().OpenL( *cPath );
+                        }
+                    else
+                        {
+                        uids.AppendL( TUid::Uid( KMPXPluginTypeCollectionUid ) );
+                        uids.AppendL( TUid::Uid( data ) );
+                        }
+
+                    // If transitioning from Now Playing to Collection view,
+                    // We have to set the selection index
+                    // Only applicable if path levels is > 2, ie not music / podcast menu
+                    //
+                    if( iCurrentViewType.iUid == KMPXPluginTypePlaybackUid )
+                        {
+                        MMPXSource* s = iPlaybackUtility->Source();
+                        if( s && cPath->Levels() > 2 )
+                            {
+                            CMPXCollectionPlaylist* pl = s->PlaylistL();
+                            TInt browsePathCount = cPath->Count();
+
+                            if (pl &&
+                                browsePathCount > 0) // don't set index since this playlist
+                                                     // no longer contains any items, this can
+                                                     // happen in the case of autoplaylists and cause
+                                                     // a hang
+                                {
+                                CleanupStack::PushL( pl );
+                                TInt playlistIndex = pl->Path().Index();
+                                if(playlistIndex < browsePathCount)
+                                    {
+                                    iCollectionUtility->Collection().CommandL(EMcCmdSelect,
+                                                                              playlistIndex);
+                                    }
+                                CleanupStack::PopAndDestroy( pl );
+                                }
+                            }
+                        }
+
+                    // Activate the collection view
+                    MPX_DEBUG2( "CMPXAppUi::DoHandleCollectionMessageL cpath depth = %d", cPath->Levels() );
+                    // only activate collection view when it's not at plugin selection
+                    // screen, it is handled by main view
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+                    icollectionBrowsed = ETrue;
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+                    iViewUtility->ActivateViewL( uids );
+                    CleanupStack::PopAndDestroy( &uids );
+                    }
+                CleanupStack::PopAndDestroy( cPath );
+                }
+            }
+        else if ( event == TMPXCollectionMessage::EPathChanged &&
+            !SuppressCollectionView() &&
+            type == EMcPathChangedByOpen &&
+            data == EMcItemOpened)
+            { // Open new entries
+
+            MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL EPathChanged EMcItemOpened" );
+
+            // First get media to check for protected state
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
+                                         EMPXMediaGeneralBasic |
+                                         EMPXMediaGeneralUri ));
+
+            attrs.Append( TMPXAttribute( KMPXMediaIdDrm,
+                                         EMPXMediaDrmType |
+                                         EMPXMediaDrmProtected ));
+            CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( cPath );
+            if( cPath->Count() > 0 )
+                {
+                iCollectionUtility->Collection().MediaL(
+                    *cPath,
+                    attrs.Array() );
+                }
+            else
+                {
+                // OpenL the blank playlist
+                iCollectionUtility->Collection().OpenL();
+                }
+            // Default start up state for local playback is Playing
+            MPXTlsHelper::SetLaunchModeL( EMPXLaunchModePlaying );
+            CleanupStack::PopAndDestroy( cPath );
+            CleanupStack::PopAndDestroy( &attrs );
+            }
+        else if( event == TMPXCollectionMessage::EPathChanged &&
+            !SuppressCollectionView() &&
+            type == EMcPathChangedByOpen &&
+            data == EMcContainerOpened  &&
+            ( iCurrentViewType.iUid == KMPXPluginTypePlaybackUid ||
+              iCurrentViewType.iUid == KMPXPluginTypeEmbeddedPlaybackUid ||
+              iCurrentViewType.iUid == KMPXPluginTypeAudioEffectsUid ||
+              iCurrentViewType.iUid == KMPXPluginTypeEqualizerUid) )
+            {
+            MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL EPathChanged EMcContainerOpened" );
+            CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( cPath );
+
+            TInt levels( cPath->Levels() );
+            if ( levels != 1 )
+                {
+                iDeferredViewActivationUid.Reset();
+                if ( iLaunchModePlaying && EMPXLaunchModePlaylist == MPXTlsHelper::LaunchMode() )
+                    {
+                    iLaunchModePlaying = EFalse;
+                    cPath->SelectL(TMPXItemId(0));
+                    iCollectionUtility->Collection().OpenL( *cPath );
+                    }
+                else
+                    {
+                    iDeferredViewActivationUid.AppendL( TUid::Uid( KMPXPluginTypeCollectionUid ) );
+                    iDeferredViewActivationUid.AppendL( TUid::Uid( data ) );
+                    }
+                // add the collection uid to make sure the correct view is
+                // activated
+                if ( levels > 0 )
+                    {
+                    iDeferredViewActivationUid.AppendL( TUid::Uid( cPath->Id( 0 ) ) );
+                    }
+
+                // Set selection to playlist index if transitioning from
+                // playback to collection view
+                // Only applicable if path levels is > 2, ie not music / podcast menu
+                //
+                MMPXSource* s = iPlaybackUtility->Source();
+                if( s && levels > 2 )
+                    {
+                    CMPXCollectionPlaylist* pl = s->PlaylistL();
+                    TInt browsePathCount = cPath->Count();
+
+                    // don't set index since this playlist
+                    // no longer contains any items, this can
+                    // happen in the case of autoplaylists and cause
+                    // a hang
+                    //
+                    // Make sure we are the same level and the same container before making index call
+                    //
+                    if (pl &&
+                        browsePathCount > 0 &&
+                        levels == pl->Path().Levels() &&
+                        cPath->Id(levels-2) == pl->Path().Id(levels-2) )
+                        {
+                        CleanupStack::PushL( pl );
+                        TInt playlistIndex = pl->Path().Index();
+
+                        if(playlistIndex < browsePathCount)
+                            {
+                            iCollectionUtility->Collection().CommandL(EMcCmdSelect,
+                                                                     playlistIndex);
+                            }
+                        CleanupStack::PopAndDestroy( pl );
+                        }
+                    }
+
+                MPX_DEBUG2( "CMPXAppUi::HandleCollectionMessageL cpath depth = %d", cPath->Levels() );
+                if ( IsForeground() )
+                    {
+                    MPX_DEBUG3( "CMPXAppUi::HandleCollectionMessageL Activating view now CurUid=0x%x, DefUid=0x%x", iCurrentViewType.iUid, iDeferredViewActivationUid[iDeferredViewActivationUid.Count()-1].iUid);
+                    // only activate collection view when it's not at plugin selection
+                    // screen, it is handled by main view
+                    iViewUtility->ActivateViewL( iDeferredViewActivationUid );
+                    iDeferredViewActivationUid.Reset();
+                    }
+                else
+                    {
+                    MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL musicplayer in background, deferred view activation" );
+                    }
+                }
+            CleanupStack::PopAndDestroy( cPath );
+            }
+
+        else if( event == TMPXCollectionMessage::EPathChanged &&
+            type == EMcPathChangedByOpen &&
+            data == EMcContainerOpened )
+            {
+            MPXTlsHelper::SetLaunchModeL( EMPXLaunchModePlaying );
+            CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( cPath );
+
+            if ( cPath->Levels() == 1 && !IsEmbedded() &&
+                iCurrentViewType.iUid != KMPXPluginTypeMainUid &&
+                iCurrentViewType.iUid != KMPXPluginTypeWaitNoteDialogUid &&
+                !SuppressCollectionView() )
+                {
+                // activate main view if other clients navigated to first level
+                if ( IsForeground() )
+                    {
+                    MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL Switching to main view" );
+                    iViewUtility->ActivateViewL(
+                        TUid::Uid( KMPXPluginTypeMainUid ) );
+                    }
+                else
+                    {
+                    MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL musicplayer in background, deferred view activation" );
+                    iDeferredViewActivationUid.Reset();
+                    iDeferredViewActivationUid.Append( TUid::Uid( KMPXPluginTypeMainUid ) );
+                    }
+                }
+
+			TInt level(2);
+			if ( iStartInAlbumMenu )
+				{
+				level = 3;
+				}
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+            // Music Player opens directly at level 2 so we need to initialize
+            // the path then
+            if( cPath->Levels() == level && iPathRestore && !iPathRestore->Initialized() && !iStandAlone )
+#else
+            if( cPath->Levels() == 1 && iPathRestore && !iPathRestore->Initialized() )
+#endif
+                {
+                if ( iProcessParameter )
+                    {
+                    if ( !iProcessParameter->IsPathInited() )
+                        {
+                        MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL load path" );
+                        iPathRestore->LoadPathL();
+                        }
+                    else
+                        {
+                        MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL path inited by command handler, not restore path" );
+                        }
+                    }
+                else
+                    {
+                    MPX_DEBUG1( "CMPXAppUi::HandleCollectionMessageL load path" );
+                    iPathRestore->LoadPathL();
+                    }
+                }
+            else if ( iCurrentIndex != KErrNotFound )
+                {
+                iCollectionUtility->Collection().CommandL( EMcCmdSelect, iCurrentIndex );
+                iCurrentIndex = KErrNotFound;
+                iCollectionUtility->Collection().OpenL();
+                }
+            CleanupStack::PopAndDestroy( cPath );
+            }
+
+        else if( event == TMPXCollectionMessage::EBroadcastEvent )
+            {
+            HandleBroadcastMessageL( aMessage );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::IsPlaybackRemote
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAppUi::IsPlaybackRemote()
+    {
+    TBool isRemote = EFalse;
+
+    TMPXPlaybackPlayerType type( EPbLocal );
+    TUid uid;
+    TInt index;
+    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+    HBufC* subPlayerName = NULL;
+    TRAP_IGNORE( manager.GetSelectionL( type, uid, index, subPlayerName ) );
+    delete subPlayerName;
+
+//#ifdef __UPNP_FRAMEWORK_2_0_
+    if ( FeatureManager::FeatureSupported( KFeatureIdUpnpFramework20 ) )
+        {
+        // Check for Remote, since in embedded mode
+        // playback utility will report type as Unknown.
+        if ( type == EPbRemote )
+            {
+            isRemote = ETrue;
+            }
+        }
+
+//#endif //__UPNP_FRAMEWORK_2_0_
+
+    return isRemote;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::SetMediaL
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::SetMediaL( CMPXMedia& aMedia )
+    {
+    // Set to collection
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet );
+    cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue );
+    TUid colId( aMedia.ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId));
+    cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid );
+    cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColSetMedia, &aMedia );
+    iCollectionUtility->Collection().CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+// ---------------------------------------------------------------------------
+// Handle Custom messages from the collection
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleCollectionMessage( CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) )
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handles the collection entries being opened.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleOpenL(
+    const CMPXMedia& /* aEntries */,
+    TInt /* aIndex */,
+    TBool /* aComplete */,
+    TInt aError )
+    {
+    if ( aError != KErrNone )
+        {
+        // Clip the collection path to root level and reopen
+        // This could happen after a USB refresh event where the
+        // item no longer exists
+        //
+        CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL( path );
+        while( path->Levels() > 1)
+            {
+            path->Back();
+            }
+        iCollectionUtility->Collection().OpenL( *path );
+        CleanupStack::PopAndDestroy( path );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handles the item being opened.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleOpenL(
+    const CMPXCollectionPlaylist& aPlaylist,
+    TInt aError )
+    {
+    MPX_FUNC("CMPXAppUi::HandleOpenL()");
+    if ( KErrNone == aError )
+        {
+        if( !IsEmbedded() )
+            {
+            TInt count ( aPlaylist.Count() ) ;
+
+            // temporarily disable repeat and shuffle if playlist
+            // is a podcast playlist and the list is not empty.
+            if(KMPXUidPodcastDBPlugin == TUid::Uid((TInt)aPlaylist.Path().Id(0)))
+                {
+                if(count > 0)
+                    {
+                    CMPXCollectionPlaylist* tmpPlaylist =
+                                    CMPXCollectionPlaylist::NewL( aPlaylist );
+                    CleanupStack::PushL( tmpPlaylist );
+                    tmpPlaylist->SetRepeatEnabled( EFalse );
+                    tmpPlaylist->SetShuffleEnabledL( EFalse );
+                    iPlaybackUtility->InitL( *tmpPlaylist, ETrue );
+                    CleanupStack::PopAndDestroy( tmpPlaylist );
+                    }
+                else
+                    {
+                    // Empty now playing
+                    //
+                    CMPXCollectionPlaylist* tmpPlaylist =
+                                    CMPXCollectionPlaylist::NewL( aPlaylist );
+                    CleanupStack::PushL( tmpPlaylist );
+                    tmpPlaylist->SetRepeatEnabled( EFalse );
+                    tmpPlaylist->SetShuffleEnabledL( EFalse );
+                    iPlaybackUtility->InitL( *tmpPlaylist, ETrue );
+
+                    RArray<TUid> array;
+                    CleanupClosePushL( array );
+
+                    CMPXCollectionPath* pbPath =
+                            CMPXCollectionPath::NewL( tmpPlaylist->Path() );
+                    CleanupStack::PushL( pbPath );
+                    if ( pbPath->Levels() > 0 )
+                        {
+                        array.AppendL( TUid::Uid( pbPath->Id( 0 ) ) );
+                        }
+                    CleanupStack::PopAndDestroy( pbPath );
+
+                    array.AppendL( KLocalPlaybackUid );
+
+                    if ( IsEmbedded() )
+                        {
+                        array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ));
+                        }
+                    else
+                        {
+                        array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) );
+                        }
+                    iViewUtility->ActivateViewL( array );
+                    CleanupStack::PopAndDestroy( &array );
+                    CleanupStack::PopAndDestroy( tmpPlaylist );
+                    }
+                }
+            else
+                {
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+                if ( iPdParameterHandler && !iPdParameterHandler->IsPlaybackCompleted())
+                    {
+                        iPdParameterHandler->HandleCommandL(EPbCmdPause);
+                    }
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+                if ( count > 0 )
+                    {
+                    iPlaybackUtility->InitL( aPlaylist, ETrue );
+                    }
+                else if( count == 0 &&
+                         iPathRestore->Initialized() )
+                    {
+                    // Empty now playing
+                    //
+                    iPlaybackUtility->InitL( aPlaylist, EFalse );
+
+                    RArray<TUid> array;
+                    CleanupClosePushL( array );
+
+                    CMPXCollectionPath* pbPath =
+                            CMPXCollectionPath::NewL( aPlaylist.Path() );
+                    CleanupStack::PushL( pbPath );
+                    if ( pbPath->Levels() > 0 )
+                        {
+                        array.AppendL( TUid::Uid( pbPath->Id( 0 ) ) );
+                        }
+                    CleanupStack::PopAndDestroy( pbPath );
+
+                    if ( IsEmbedded() )
+                        {
+                        array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ));
+                        }
+                    else
+                        {
+                        array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) );
+                        }
+                    iViewUtility->ActivateViewL( array );
+                    CleanupStack::PopAndDestroy( &array );
+                    }
+                }
+            // ETrue->initialize next song concurrently
+            }
+        else
+            {
+            // aPlaylist is const, must copy
+            //
+            CMPXCollectionPlaylist* tmp =
+                                    CMPXCollectionPlaylist::NewL( aPlaylist );
+            CleanupStack::PushL( tmp );
+            tmp->SetEmbeddedPlaylist( ETrue );
+            tmp->SetRepeatEnabled( EFalse );
+            tmp->SetShuffleEnabledL( EFalse );
+            iPlaybackUtility->InitL( *tmp, ETrue );
+            CleanupStack::PopAndDestroy( tmp );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCHelperEmbeddedOpenObserver
+// Handles OpenL from that occured in embedded mode
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory  )
+    {
+    MPX_FUNC( "CMPXAppUi::HandleEmbeddedOpenL" );
+    if( aErr != KErrNone )
+        {
+        iCommonUiHelper->HandleErrorL( aErr );
+
+        // Kill MPX
+        RunAppShutter();
+        }
+    else // No error, set the launch mode
+        {
+        iPlaybackUtility->CommandL( EPbCmdDisableEffect );
+        if( aCategory == EMPXPlaylist )
+            {
+            if ( MPXTlsHelper::LaunchMode() == EMPXLaunchModePlaying )
+                {
+                iLaunchModePlaying = ETrue;
+                }
+            MPXTlsHelper::SetLaunchModeL( EMPXLaunchModePlaylist );
+            }
+        else // ( aCategory == EMPXSong )
+            {
+            MPXTlsHelper::SetLaunchModeL( EMPXLaunchModeTrack );
+            iViewUtility->ActivateViewL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ));
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXViewActivationObserver.
+// Handle view activation.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleViewActivation(
+    const TUid& aCurrentViewType,
+    const TUid& aPreviousViewType )
+    {
+    MPX_FUNC( "CMPXAppUi::HandleViewActivation" );
+    MPX_DEBUG3("CurrentViewType=0x%x, PreviousViewType=0x%x", aCurrentViewType.iUid, aPreviousViewType.iUid);
+    iCurrentViewType = aCurrentViewType;
+    iPreviousViewType = aPreviousViewType;
+    iDeferredViewActivationUid.Reset();
+
+    switch ( aCurrentViewType.iUid )
+        {
+        case KMPXPluginTypePlaybackUid:
+            {
+            if ( IsForeground() )
+                {
+                iMediaKeyHandler->DismissNotifier( EDisplayMediaPopup );
+                }
+            break;
+            }
+      
+        case KMPXPluginTypeCollectionUid:
+            {
+            if (iRefreshCollectionView )
+                {
+                iRefreshCollectionView = EFalse;
+                TRAP_IGNORE(ReOpenPathL());
+                }
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CEikAppUi.
+// Opens the specified file
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleViewUpdate(
+    TUid /* aViewUid */,
+    MMPXViewActivationObserver::TViewUpdateEvent /* aUpdateEvent */,
+    TBool /* aLoaded */,
+    TInt /* aData */)
+    {
+    MPX_FUNC( "CMPXAppUi::HandleViewUpdate" );
+    }
+
+// ---------------------------------------------------------------------------
+// From CEikAppUi.
+// Opens the specified file
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::OpenFileL( const TDesC& aFileName )
+    {
+    MPX_FUNC( "CMPXAppUi::OpenFileL" );
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+   if ( iPdParameterHandler )
+        {
+        // no need to open file at this time.
+        return;
+        }
+#endif //RD_BROWSER_PROGRESSIVE_DOWNLOAD
+    if ( IsEmbedded() )
+        {
+        CreateMemberVariablesL();
+
+        iViewUtility->PreLoadViewL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ));
+    // Open file with collection helper
+    iCollectionUiHelper->OpenL( MPXTlsHelper::HostUid(),
+                                aFileName, this,
+                                EMPXCollectionPluginMusic );
+        }
+    else
+        {
+       
+        MPX_DEBUG1( "CMPXAppUi::OpenFileL Standalone" );
+        TDataType datatype( TUid::Uid( KMusicPlayerAppUidConstant ) );
+        iDocHandler->OpenTempFileL( aFileName, iFile );
+        
+        CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
+        TMPXLaunchMode  mode( EMPXLaunchModeStopped );
+        TAiwVariant value(  mode );
+        TAiwGenericParam param( EGenericParamPlayerInitMode, value );
+        paramList->AppendL( param ); // Takes ownership
+
+        TRAPD( err, iDocHandler->OpenFileEmbeddedL( iFile, datatype, *paramList ));
+
+        //
+        //  ignore some document handler errors
+        //
+        if ( err == KErrServerTerminated )
+            {
+            //
+            //  Document handler leaves with -15 if end key is pressed when
+            //  embedded application is not fully started or embedded
+            //  application panics in start up.  So we can only close the
+            //  App in this point and hope that user is press end key
+            //
+            HandleCommandL( EEikCmdExit );
+            }
+        else if ( err != KErrNone )
+            {
+            //  Reset error since it was handled here and
+            //  the program will exit
+            //
+            User::Leave( err );
+            }
+
+        CleanupStack::PopAndDestroy(paramList);
+        MPX_DEBUG1( "CMPXAppUi::OpenFileL Register as callback for exit" );
+        iDocHandler->SetExitObserver(this);
+        
+        iStandAlone = ETrue;
+            
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeAppUi.
+// Handle foreground event.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleForegroundEventL(
+    TBool aForeground )
+    {
+    MPX_FUNC_EX( "CMPXAppUi::HandleForegroundEventL" );
+
+    if ( !aForeground )
+        {
+        // music player is going to background
+        // set key repeat rate to normal avkon rate
+        CEikonEnv::Static()->WsSession().SetKeyboardRepeatRate(
+            KAknKeyboardRepeatInitialDelay, KAknStandardKeyboardRepeatRate );
+        CEikonEnv::Static()->WsSession().Flush();
+        }
+
+    // Dismiss playback popup if foreground app is active idle or playback
+    // view is on foreground
+    if ( ( !aForeground && IsActiveIdleEnabled() && IsIdleAppForeground() )
+        || ( aForeground
+            && ( KMPXPluginTypePlaybackUid == iCurrentViewType.iUid ) ) )
+        {
+        iMediaKeyHandler->DismissNotifier( EDisplayMediaPopup );
+        }
+
+    if ( aForeground && iDeferredViewActivationUid.Count() != 0 )
+        {
+        MPX_DEBUG1( "CMPXAppUi::HandleForegroundEventL deferred view activation, activating" );
+        iViewUtility->ActivateViewL( iDeferredViewActivationUid );
+        iDeferredViewActivationUid.Reset();
+        }
+
+    CAknViewAppUi::HandleForegroundEventL( aForeground );
+    }
+
+// ---------------------------------------------------------------------------
+// From CEikAppUi.
+// Owerwritten -> file opening
+// (app startup via shell commands)
+// ---------------------------------------------------------------------------
+//
+TBool CMPXAppUi::ProcessCommandParametersL(
+    TApaCommand /*aCommand*/,
+    TFileName& aDocumentName,
+    const TDesC8& /*aTail*/ )
+    {
+    MPX_FUNC_EX( "CMPXAppUi::ProcessCommandParametersL TApaCommand" );
+    return ConeUtils::FileExists( aDocumentName );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Launch matrix menu suite with specific message
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::LaunchMmViewL( const TDesC8& aMessage )
+    {
+    TApaTaskList taskList( iCoeEnv->WsSession() );
+    TApaTask task = taskList.FindApp( TUid::Uid( KMmUid3 ) );
+
+    if ( task.Exists() )
+        {
+        task.SendMessage( TUid::Uid( KUidApaMessageSwitchOpenFileValue ), 
+             aMessage );
+        }
+    }  
+
+// ---------------------------------------------------------------------------
+// From CEikAppUi.
+// Handle commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleCommandL(
+    TInt aCommand )
+    {
+    MPX_FUNC( "CMPXAppUi::HandleCommandL" );
+    TMPXPlaybackCommand cmd = EPbCmdEnd;
+    switch ( aCommand )
+        {
+        case EMPXCmdPlay:
+        case EMPXCmdPause:
+        case EMPXCmdPlayPause:
+        case EMPXCmdStop:
+        case EMPXCmdNext:
+        case EMPXCmdPrevious:
+        case EMPXCmdSeekForward:
+        case EMPXCmdSeekBackward:
+        case EMPXCmdStopSeeking:
+            {
+            switch ( aCommand )
+                {
+                case EMPXCmdPlay:
+                    cmd = EPbCmdPlay;
+                    break;
+                case EMPXCmdPause:
+                    cmd = EPbCmdPause;
+                    break;
+                case EMPXCmdPlayPause:
+                    cmd = EPbCmdPlayPause;
+                    break;
+                case EMPXCmdStop:
+                    cmd = EPbCmdStop;
+                    break;
+                case EMPXCmdNext:
+                    cmd = EPbCmdNext;
+                    break;
+                case EMPXCmdPrevious:
+                    cmd = EPbCmdPrevious;
+                    break;
+                case EMPXCmdSeekForward:
+                    cmd = EPbCmdStartSeekForward;
+                    break;
+                case EMPXCmdSeekBackward:
+                    cmd = EPbCmdStartSeekBackward;
+                    break;
+                case EMPXCmdStopSeeking:
+                    cmd = EPbCmdStopSeeking;
+                    break;
+                default:
+                    break;
+                }
+            DoHandleMediaKeyCommandL( cmd );
+            break;
+            }
+        case EMPXCmdGoToNowPlaying:
+            {
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+
+            TBool pdPlaybackCompleted(EFalse);
+            if ( iPdParameterHandler )
+                {
+                pdPlaybackCompleted = iPdParameterHandler->IsPlaybackCompleted();
+                if ( pdPlaybackCompleted )
+                    {
+                    delete iPdParameterHandler;
+                    iPdParameterHandler = NULL;
+                    }
+                }
+
+            MMPXPlaybackUtility* activePlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
+
+            MMPXPlayer* player =
+                activePlaybackUtility->PlayerManager().CurrentPlayer();
+            TUid pluginUid( KNullUid );
+            RArray<TUid> array;
+            CleanupClosePushL( array );
+
+
+            MMPXSource* source = activePlaybackUtility->Source();
+            CMPXCollectionPlaylist* pl = NULL;
+            if( source )
+                {
+                pl = source->PlaylistL();
+                }
+
+            if ( pl || !pdPlaybackCompleted )
+                {
+                if (pl)
+                  delete pl;
+                if ( player )
+                    {
+                    array.AppendL( player->UidL() );
+                    if ( IsEmbedded() )
+                        {
+                        array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ) );
+                        }
+                    }
+                else
+                    {
+                    if ( IsEmbedded() )
+                        {
+                        array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ) );
+                        }
+                    else
+                        {
+                        array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) );
+                        }
+                    }
+
+                // add the collection plugin UID to ensure the correct
+                // last playback view is activated
+                //MMPXSource* source = activePlaybackUtility->Source();
+                if( source )
+                    {
+                    CMPXCollectionPlaylist* pl = source->PlaylistL();
+                    if (pl)
+                        {
+                        CleanupStack::PushL( pl );
+                        const CMPXCollectionPath& path = pl->Path();
+                        if(path.Levels() > 0)
+                            {
+                            array.AppendL(TUid::Uid(path.Id(0)));
+                            }
+                        CleanupStack::PopAndDestroy( pl );
+                        }
+                    }
+                else if ( !iPathRestore->Initialized() )
+                    {
+                    if ( iPathRestore->RooPathId() != KNullUid )
+                        {
+                        array.AppendL( iPathRestore->RooPathId() );
+                        }
+                    }
+                }
+            else
+                {
+                CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+                CleanupStack::PushL( cPath );
+
+                array.AppendL( TUid::Uid( KMPXPluginTypeCollectionUid ) );
+                if ( cPath->Levels() > 0 )
+                    {
+                    array.AppendL( TUid::Uid( cPath->Id( 0 ) ) );
+                    }
+                CleanupStack::PopAndDestroy( cPath );
+                }
+
+            if ( iAppStartedByBrowser && !icollectionBrowsed && pdPlaybackCompleted)
+                {
+                activePlaybackUtility->Close();
+                CleanupStack::PopAndDestroy( &array );
+                RunAppShutter();
+                break;
+                }
+            else
+                {
+                activePlaybackUtility->Close();
+                iViewUtility->ActivateViewL( array );
+                CleanupStack::PopAndDestroy( &array );
+                }
+
+            break;
+            }
+#else // RD_BROWSER_PROGRESSIVE_DOWNLOAD not supported
+            MMPXPlayer* player =
+                iPlaybackUtility->PlayerManager().CurrentPlayer();
+            TUid pluginUid( KNullUid );
+            RArray<TUid> array;
+            CleanupClosePushL( array );
+
+            if ( player )
+                {
+                array.AppendL( player->UidL() );
+                if ( IsEmbedded() )
+                    {
+                    array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ) );
+                    }
+                }
+            else
+                {
+                if ( IsEmbedded() )
+                    {
+                    array.AppendL( TUid::Uid( KMPXPluginTypeEmbeddedPlaybackUid ) );
+                    }
+                else
+                    {
+                    array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) );
+                    }
+                }
+
+            // add the collection plugin UID to ensure the correct
+            // last playback view is activated
+            MMPXSource* source = iPlaybackUtility->Source();
+            if( source )
+                {
+                CMPXCollectionPlaylist* pl = source->PlaylistL();
+                if (pl)
+                    {
+                    CleanupStack::PushL( pl );
+                    const CMPXCollectionPath& path = pl->Path();
+                    if(path.Levels() > 0)
+                        {
+                        array.AppendL(TUid::Uid(path.Id(0)));
+                        }
+                    CleanupStack::PopAndDestroy( pl );
+                    }
+                }
+
+            iViewUtility->ActivateViewL( array );
+            CleanupStack::PopAndDestroy( &array );
+            break;
+            }
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+
+        case EMPXCmdVolumeChanged:
+            cmd = EPbCmdSetVolume;
+            HandlePopupL(cmd);
+            break;
+        case EMPXCmdIgnoreExternalCommand:
+            {
+            iIgnoreExternalCommand = ETrue;
+            break;
+            }
+        case EMPXCmdHandleExternalCommand:
+            {
+            iIgnoreExternalCommand = EFalse;
+            break;
+            }
+        case EMPXCmdHideApp:
+            {
+            // Move Music Player to background
+            // magic: -1 = force wg to background
+            iEikonEnv->RootWin().SetOrdinalPosition( -1 );
+            break;
+            }
+
+        case EAknSoftkeyBack:
+            {
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+            if ( iViewUtility->ViewHistoryDepth() == 1 || iAppStartedByBrowser )
+                {
+                HandleCommandL( EEikCmdExit );
+                }
+
+            else if ( iPbvStartedByBrowser && !iAppStartedByBrowser )
+                {
+                iPbvStartedByBrowser = EFalse;
+
+                if( iPdParameterHandler )
+                    {
+                    if( !( iPdParameterHandler->IsPlaybackCompleted() ) )
+                        {
+
+                        iPdParameterHandler->HandleCommandL( EPbCmdStop );
+                        }
+                    iPdParameterHandler->HandleCommandL( EPbCmdClose );
+                    delete iPdParameterHandler;
+                    iPdParameterHandler = NULL;
+                    }
+
+                iRefreshCollectionView = ETrue;
+                iViewUtility->ActivatePreviousViewL();
+                BringUpBrowserL();
+                }
+
+            else if ( !iPdParameterHandler || !iAppStartedByBrowser )
+                {
+                iViewUtility->ActivatePreviousViewL();
+                }
+
+            else
+                {
+                HandleCommandL( EEikCmdExit );
+                }
+#else
+            // if we're in top level of our local view stack,
+            // back command exits the app.  otherwise activate
+            // the previous view in our local view stack
+            if ( iViewUtility->ViewHistoryDepth() == 1 )
+                {
+                HandleCommandL( EEikCmdExit );
+                }
+            else
+                {
+                iViewUtility->ActivatePreviousViewL();
+                }
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+            break;
+            }
+        case EEikCmdExit: // fall through        
+        case EAknCmdExit:
+		case EAknSoftkeyExit:
+			{
+            if ( iView && KMPXPluginTypeCollectionUid == iCurrentViewType.iUid )
+                {
+                MPX_DEBUG2( "CMPXAppUi::HandleCommand() "
+                            "sending EMPXCmdCancelReorder to view %d",
+                            KMPXPluginTypeCollectionUid );
+                iView->HandleCommandL( EMPXCmdCancelReorder );
+                }
+            CloseWaitNoteL();
+
+			if( aCommand == EAknCmdExit || aCommand == EEikCmdExit ) 
+				{
+				TKeyEvent key;
+				key.iCode = EKeyEscape;
+				key.iModifiers = 0;
+
+				// Under EQ it is possible to have multiple dialogs open
+				TInt err( KErrNone );
+				while( IsDisplayingDialog() && err == KErrNone )
+					{
+					TRAP( err, iCoeEnv->SimulateKeyEventL(key,EEventKey); )
+					}
+
+				// Options/Exit selected, close also the MM suite
+                if( aCommand == EAknCmdExit )
+                    {
+                    LaunchMmViewL( KMmMessage );
+                    }
+				}
+
+            if ( iSaveMode != EMPXSaveModeIdle )
+                {
+                iCancelFileMan = ETrue;
+                }
+            else
+                {
+                if( iPathRestore )
+                    {
+                    TRAP_IGNORE(iPathRestore->SavePathL());
+                    }
+
+                if ( iPlaybackUtility )
+                    {
+                    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+                    TRAP_IGNORE( manager.ClearSelectPlayersL() );
+                    iPlaybackUtility->CommandL( EPbCmdClose );
+                    }
+
+                Exit();
+                }
+            break;
+            }
+        case EAknCmdHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL(
+                iEikonEnv->WsSession(),
+                AppHelpContextL() );
+            break;
+            }
+        case EMPXCmdSaveAndReopen:
+            {
+            iCancelFileMan = EFalse;
+            iSaveMode = EMPXOpenAfterSave;
+            MPX_TRAPD( err, DoSaveL());
+            if ( KErrNone != err )
+                {
+                HandleSaveComplete( err );
+                }
+            break;
+            }
+        case EMPXCmdIsFileSaved:
+            {
+            TFileName SavedAudioFile;
+            CreateAutomaticSavePathL( SavedAudioFile );
+            break;
+            }
+        case EMPXCmdSaveForUseAsContact:
+        case EMPXCmdSaveForUseAsRingtone:
+            {
+            iCancelFileMan = EFalse;
+            ASSERT( iFile.SubSessionHandle() );
+            TBool abort = EFalse;
+            TBool aiwExecuted = EFalse;
+            TFileName fullName;
+            iFile.FullName( fullName );
+            TParsePtrC fileParse( fullName );
+            TBool isPrivate = (fileParse.NamePresent() &&
+                !KMPXMusicplayerPrivateFolder().CompareF(
+                    fileParse.Path().Left(
+                        KMPXMusicplayerPrivateFolder().Length())));
+            TFileName savedFile;
+            CreateAutomaticSavePathL( savedFile );
+
+
+            if ( isPrivate && !ConeUtils::FileExists( savedFile ) )
+                {
+                HBufC* string( StringLoader::LoadLC( R_MPX_QUERY_CONF_SAVE_DOWNLOADED,
+                                                     fileParse.Name() ));
+                CAknQueryDialog* confirmationDlg( CAknQueryDialog::NewL(
+                    CAknQueryDialog::EConfirmationTone ));
+                if ( confirmationDlg->ExecuteLD( R_MPX_SAVE_SONG_CONFIRMATION_QUERY,
+                                                 *string ))
+                    {
+                    // User wants to save the file and execute AIW function
+                    if ( aCommand == EMPXCmdSaveForUseAsRingtone )
+                        {
+                        iSaveMode = EMPXAssignRingtone;
+                        }
+                    else if ( aCommand == EMPXCmdSaveForUseAsContact )
+                        {
+                        iSaveMode = EMPXAssignContact;
+                        }
+                    MPX_TRAPD( err, DoSaveL() );
+                    if ( KErrNone != err )
+                        {
+                        HandleSaveComplete( err );
+                        }
+                    abort = EFalse;
+                    aiwExecuted = ETrue;
+                    if ( iView )
+                        {
+                        iView->HandleCommandL( EMPXCmdSaveComplete );
+                        }
+                    }
+                else
+                    {
+                    if ( iView )
+                        {
+                        iView->HandleCommandL( EMPXCmdSaveNotProgress );
+                        }
+                    abort = ETrue;
+                    }
+                CleanupStack::PopAndDestroy( string );
+                }
+            else if ( ConeUtils::FileExists( savedFile ) )
+                {
+                if ( iView )
+                    {
+                    iView->HandleCommandL( EMPXCmdSaveNotProgress );
+                    }
+                MPXTlsHelper::SetFilePath( savedFile );
+                }
+
+            if ( !abort && !aiwExecuted )
+                {
+                if ( aCommand == EMPXCmdSaveForUseAsRingtone )
+                    {
+                    TRAP_IGNORE(
+                        iView->HandleCommandL( EMPXCmdAfterSaveAiwCmdAssign ));
+                    }
+                else if ( aCommand == EMPXCmdSaveForUseAsContact )
+                    {
+                    TRAP_IGNORE(
+                        iView->HandleCommandL( EMPXCmdAfterSaveUseAsCascade ));
+                    }
+                }
+            break;
+            }
+        case EMPXCmdSaveAndExit: // fall though
+        case EMPXCmdSaveAndExitHostApp:
+            {
+            iCancelFileMan = EFalse;
+            ASSERT( iFile.SubSessionHandle() );
+            TFileName fullName;
+            iFile.FullName( fullName );
+            TParsePtrC fileParse( fullName );
+            HBufC* string( StringLoader::LoadLC( R_MPX_QUERY_CONF_SAVE_DOWNLOADED,
+                                                 fileParse.Name() ));
+            CAknQueryDialog* confirmationDlg( CAknQueryDialog::NewL(
+                CAknQueryDialog::EConfirmationTone ));
+//#ifdef __COVER_DISPLAY
+            confirmationDlg->PublishDialogL(
+                    EMPlayerQueryNotSaved,
+                    KMPlayerNoteCategory);
+
+            CAknMediatorFacade* covercl(
+                AknMediatorFacade( confirmationDlg ) );
+            if ( covercl )
+                {
+                covercl->BufStream() << fileParse.Name();
+                }
+//#endif //__COVER_DISPLAY
+
+            if ( confirmationDlg->ExecuteLD( R_MPX_SAVE_SONG_CONFIRMATION_QUERY,
+                                             *string ))
+                {
+                iSaveMode = ( aCommand == EMPXCmdSaveAndExit ?
+                    EMPXExitAppAfterSave : EMPXExitHostAppAfterSave );
+                MPX_TRAPD( err, DoSaveL() );
+                if ( KErrNone != err )
+                    {
+                    HandleSaveComplete( err );
+                    }
+                }
+            else
+                {
+                if ( aCommand == EMPXCmdSaveAndExit )
+                    {
+                    RunAppShutter();
+                    }
+                else
+                    {
+                    // EMPXCmdSaveAndExitHostApp
+                    CAknEnv::RunAppShutter();
+                    }
+                }
+            CleanupStack::PopAndDestroy( string );
+            break;
+            }
+        case EAknCmdTaskSwapper:
+            {
+            // Handle command when Music Player is selected in Multitasker
+            // and Music Player is the foreground app.
+            break;
+            }
+
+        case EMPXCmdGotoCollection:
+            {
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+            iPdPbvStartedByBrowser = EFalse;
+            icollectionBrowsed = ETrue;
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+            iStandAlone = EFalse;
+
+            break;
+            }
+
+        default:
+            {
+            // do nothing if the command is not reconized
+            MPX_DEBUG2( "CMPXAppUi::HandleCommandL unknown command 0x%x", aCommand );
+            break;
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From CEikAppUi.
+// Handle window server events.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleWsEventL(
+    const TWsEvent& aEvent,
+    CCoeControl* aDestination )
+    {
+    MPX_FUNC_EX( "CMPXAppUi::HandleWsEventL" );
+    if ( aEvent.Type() == KAknUidValueEndKeyCloseEvent )
+        {
+		TMPXPlaybackState playerState( EPbStateNotInitialised );
+		if( iPlaybackUtility )
+			{
+			TRAP_IGNORE( playerState = iPlaybackUtility->StateL() );
+			}
+
+        if ( ( iCommonUiHelper->ExitOptionHiddenL() && !IsEmbedded() ) ||
+			EPbStatePlaying == playerState ||
+			EPbStatePaused == playerState )
+            {
+            // Go back to Idle when End key is pressed in non-embedded mode or
+            // player is in playing/paused mode
+            if( IsForeground() )
+                {
+                ActivatePhoneAppL();
+                }
+            return;
+            }
+        }
+
+    // Notify the playback popup that orientation is about to change
+    if( iMediaKeyHandler && aEvent.Type() == EEventScreenDeviceChanged )
+        {
+        iMediaKeyHandler->NotifyOrientationChangeBegin();
+        }
+
+    CAknAppUi::HandleWsEventL( aEvent, aDestination );
+    }
+
+// ---------------------------------------------------------------------------
+// From MCoeMessageObserver.
+// Handle messages from windows server.
+// ---------------------------------------------------------------------------
+//
+MCoeMessageObserver::TMessageResponse CMPXAppUi::HandleMessageL(
+    TUint32 aClientHandleOfTargetWindowGroup,
+    TUid aMessageUid,
+    const TDesC8& aMessageParameters )
+    {
+    MPX_FUNC_EX( "CMPXAppUi::HandleMessageL" );
+
+    MCoeMessageObserver::TMessageResponse ret( EMessageNotHandled );
+
+    if ( aMessageUid == KAppUidMusicPlayerX )
+        {
+        MPX_DEBUG2( "CMPXAppUi::HandleMessageL Message received for music player, size = %d", aMessageParameters.Size() );
+        // message for music player
+        HandleCommandParametersL( aMessageParameters );
+        ret = EMessageHandled;
+        }
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+    else if ( aMessageUid == KNullUid )
+        {
+        ASSERT(!IsEmbedded());////browser should not send messages to music player if it is not RootApp.
+        if ( aMessageParameters.Length() )
+            {
+            if ( IsBrowserClosed(aMessageParameters) )
+                {
+                if ( iAppStartedByBrowser )
+                    {
+                    RunAppShutter();
+                    return EMessageHandled;
+                    }
+                }
+            else
+                {
+                if (!iPdParameterHandler)
+                    {
+                    iPdParameterHandler = CMPXPdCommandHandler::NewL(iPlaybackUtility);
+                    }
+                if(KErrNotFound == iPdParameterHandler->HandleCommandParametersL( aMessageParameters )) // File or dl id do not exist.
+                    {
+                    iCommonUiHelper->DisplayInfoNoteL(R_MPX_FILE_NOT_FOUND_TEXT);
+                    HandleCommandL(EMPXCmdGoToNowPlaying);
+                    BringUpBrowserL();
+                    }
+                else
+                    {
+                    iPbvStartedByBrowser = ETrue;
+                    }
+                ret = EMessageHandled;
+                }
+            }
+        }
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+    else
+        {
+        ret = CAknViewAppUi::HandleMessageL(
+            aClientHandleOfTargetWindowGroup,
+            aMessageUid,
+            aMessageParameters );
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// From CEikAppUi.
+// process message sent by another application
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::ProcessMessageL(
+        TUid aUid, const TDesC8& aParams )
+    {
+    MPX_FUNC_EX( "CMPXAppUi::ProcessMessageL" );
+    if ( aUid == KAppUidMusicPlayerX )
+        {
+        // message for music player
+        MPX_DEBUG2( "CMPXAppUi::ProcessMessageL Message received for music player, size = %d", aParams.Size() );
+        HandleCommandParametersL( aParams );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From CEikAppUi.
+// process command line parameter
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAppUi::ProcessCommandParametersL( CApaCommandLine& aCommandLine )
+    {
+    MPX_FUNC_EX( "CMPXAppUi::ProcessCommandParametersL CApaCommandLine" );
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+    if (EApaCommandOpen == aCommandLine.Command())
+        {
+        TPtrC param = aCommandLine.DocumentName();
+        if ( param.Length() )
+            {
+            if (!ConeUtils::FileExists(param))
+                {
+                iAppStartedByBrowser = ETrue;
+                iPdPbvStartedByBrowser = ETrue;
+                // Convert param to 8-bit.
+                HBufC8* param8 = HBufC8::NewLC( param.Length() );
+                param8->Des().Copy( param );
+                if ( IsBrowserClosed(*param8) )
+                    {
+                    Exit();
+                    }
+                else
+                    {
+                    if (!iPdParameterHandler)
+                        {
+                        iPdParameterHandler = CMPXPdCommandHandler::NewL(iPlaybackUtility);//this is where it is created the first time
+                        }
+                    if ( KErrNotFound == iPdParameterHandler->HandleCommandParametersL( *param8 ) )
+                        {
+                        delete iPdParameterHandler;
+                        iPdParameterHandler = NULL;
+                        iCommonUiHelper->DisplayInfoNoteL(R_MPX_FILE_NOT_FOUND_TEXT);
+                        BringUpBrowserL();
+                        Exit();
+                        }
+                    else
+                        {
+                        // Default start up state for Progressive Download playback is Playing
+                        MPXTlsHelper::SetLaunchModeL( EMPXLaunchModePlaying );
+                        }
+                    }
+                CleanupStack::PopAndDestroy( param8 );
+                }
+            }
+        }
+#endif  // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+    const TPtrC8 command = aCommandLine.TailEnd();
+        if ( command.Size() > 0 )
+        {
+        HandleCommandParametersL( command );
+        }
+    return ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXSaveHelperObserver
+// Callback function to signal that saving a file is complete
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleSaveComplete( TInt aErr )
+    {
+    MPX_DEBUG2("CMPXAppUi::HandleSaveComplete(%d) entering", aErr);
+    TRAP_IGNORE( DoHandleSaveCompleteL( aErr ) );
+    MPX_DEBUG1("CMPXAppUi::HandleSaveComplete() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionHelperObserver
+// Callback function to signal that adding a file is complete
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleAddFileCompleteL( TInt aErr )
+    {
+    MPX_DEBUG2("CMPXAppUi::HandleAddFileCompleteL(%d) entering", aErr);
+
+    iCommonUiHelper->DismissWaitNoteL();
+
+    // close collectionhelper since it is not needed now
+    if ( iCollectionHelper )
+        {
+        iCollectionHelper->Close();
+        iCollectionHelper = NULL;
+        }
+
+    if ( !aErr )
+        {
+        if (( iSaveMode != EMPXAssignRingtone ) &&
+            ( iSaveMode != EMPXAssignContact ))
+            {
+            iCommonUiHelper->DisplayConfirmNoteL( R_MPX_SAVED_TO_COLLECTION_NOTE );
+            }
+        }
+    else if ( KErrNotSupported == aErr )
+        {
+        iCommonUiHelper->DisplayConfirmNoteL( R_MPX_SAVED_NOTE );
+        }
+    else if( iIsUsbOnGoing && (aErr != KErrNone) )
+        {
+        // Kill mpx embedded mode so usb can start
+        //
+        MPX_DEBUG1("CMPXAppUi::HandleAddFileCompleteL usb ongoing");
+        iSaveMode = EMPXExitAppAfterSave;
+        }
+    else
+        {
+        iCommonUiHelper->HandleErrorL( aErr );
+        }
+
+    if ( iView )
+        {
+        iView->HandleCommandL( EMPXCmdSaveComplete );
+        }
+
+    HandlePostSaveOperationL();
+
+    MPX_DEBUG1("CMPXAppUi::HandleAddFileCompleteL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MProgressDialogCallback.
+// Get's called when a dialog is dismissed.
+// ---------------------------------------------------------------------------
+//
+void CMPXAppUi::DialogDismissedL( TInt aButtonId )
+    {
+    MPX_DEBUG1("CMPXAppUi::DialogDismissedL");
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+    if ( iCommandInitiator )
+        {
+        iCommandInitiator->CancelCommand( KMediatorSecondaryDisplayDomain,
+                                    KMPlayerNoteCategory,
+                                    EMPlayerNoteSaveOneItem );
+        }
+//#endif
+// Cover UI end
+
+    if ( aButtonId == EAknSoftkeyCancel && iView )
+        {
+        iView->HandleCommandL( EMPXCmdSaveCancelled );
+        if ( iSaveMode != EMPXSaveModeIdle )
+            {
+            iCancelFileMan = ETrue;
+            if( iSaveHelper )
+                {
+                iSaveHelper->Cancel();
+                }
+            iSaveMode = EMPXSaveModeIdle;
+            }
+        }
+    MPX_DEBUG1("CMPXAppUi::DialogDismissedL");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::NotifyFileManOperation
+// -----------------------------------------------------------------------------
+//
+MFileManObserver::TControl CMPXAppUi::NotifyFileManOperation()
+    {
+    MPX_DEBUG1("CMPXAppUi::NotifyFileManOperation(): entering");
+    // this code is run in CFileMan working thread.
+    if( iCancelFileMan )
+        {
+        MPX_DEBUG1("CMPXAppUi::NotifyFileManOperation(): ECancel");
+        return MFileManObserver::ECancel;
+        }
+    return MFileManObserver::EContinue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::DoUpdatePluginRefreshedTimeL
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::DoUpdatePluginRefreshedTimeL()
+    {
+    CMPXCommand* cmd = CMPXCommand::NewL();
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdUpdateRefreshTime );
+    cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue );
+
+    // Update Music
+    cmd->SetTObjectValueL<TUid>( KMPXCommandGeneralCollectionId, iMusicCollectionId );
+    iCollectionUtility->Collection().CommandL( *cmd );
+
+    // Update Podcast
+    if( !iDisablePodcasting )
+        {
+        cmd->SetTObjectValueL<TUid>( KMPXCommandGeneralCollectionId, iPodcastCollectionId );
+        iCollectionUtility->Collection().CommandL( *cmd );
+        }
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::HandlePropertyL
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::HandlePropertyL(TMPXPlaybackProperty aProperty, TInt aValue, TInt aError)
+    {
+    if (aError == KErrNone)
+        {
+        switch (aProperty)
+            {
+        case EPbPropertyVolume:
+            {
+            iCurrentVolume = aValue;
+            }
+            break;
+
+        case EPbPropertyMaxVolume:
+            {
+            iMaxVolume = aValue;
+            }
+            break;
+
+        default:
+            break;
+            }
+        }
+    else
+        {
+        // How to handle error?
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::HandleSubPlayerNamesL
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleSubPlayerNamesL(
+    TUid /*aPlayer*/,
+    const MDesCArray* /*aSubPlayers*/,
+    TBool /*aComplete*/,
+    TInt /*aError*/)
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::HandleMediaL
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleMediaL(
+    const CMPXMedia& /*aProperties*/,
+    TInt /*aError*/)
+    {
+
+    }
+// -----------------------------------------------------------------------------
+// CMPXAppUi::IsActiveView
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAppUi::IsActiveView(TInt aViewType )
+    {
+    return (iCurrentViewType.iUid == aViewType ) || ((iCurrentViewType.iUid == KMPXPluginTypeWaitNoteDialogUid ) && (iPreviousViewType.iUid == aViewType));
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::ReOpenPathL
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::ReOpenPathL()
+    {
+    CMPXCollectionPath* path = iCollectionUtility->Collection().PathL ( );
+    CleanupStack::PushL ( path );
+    if ( path->Levels ( )> 1 )
+        {
+        path->Back ( );
+        iCollectionUtility->Collection().OpenL ( *path );
+        }
+    CleanupStack::PopAndDestroy ( path );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::HandleServerAppExit
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::HandleServerAppExit(TInt /*aReason*/)
+    {
+        RunAppShutter();
+    }
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+// -----------------------------------------------------------------------------
+// CMPXAppUi::IsBrowserClosed
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAppUi::IsBrowserClosed(
+    const TDesC8& aParams )
+    {
+    TBool ret(EFalse);
+    CBufFlat* paramBuf = CBufFlat::NewL( /*anExpandSize*/1 );
+    CleanupStack::PushL( paramBuf );
+    paramBuf->InsertL( 0, aParams );
+    RBufReadStream readStream( *paramBuf );
+
+    CAiwGenericParamList* genParList = CAiwGenericParamList::NewLC( readStream );
+
+    TInt index = 0;
+    const TAiwGenericParam* paramTerminate = genParList->FindFirst( index,
+        EGenericParamTerminate, EVariantTypeTInt32 );
+    TInt32 terminateID = 0;
+    if ( paramTerminate )
+        {
+        paramTerminate->Value().Get( terminateID );
+        }
+
+    if ( terminateID )
+        {
+        ret = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy( genParList );
+    CleanupStack::PopAndDestroy( paramBuf );
+
+    return ret;
+    }
+
+// ---------------------------------------------------------
+// Bring Browser application to the foreground.
+// ---------------------------------------------------------
+//
+TBool CMPXAppUi::BringUpBrowserL()
+    {
+    TBool browserFound(EFalse);
+    RWsSession& wsSession=iEikonEnv->WsSession();
+    CAknTaskList* taskList = CAknTaskList::NewL( wsSession );
+    TApaTask task = taskList->FindRootApp( TUid::Uid(KMPXBrowserUid) );
+    delete taskList;
+    if( task.Exists() )
+        {
+        task.BringToForeground();
+        browserFound = ETrue;
+        }
+    return browserFound;
+    }
+
+#endif // RD_BROWSER_PROGRESSIVE_DOWNLOAD
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::SuppressCollectionView
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAppUi::SuppressCollectionView()
+    {
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+            return ( iPdPbvStartedByBrowser || iStandAlone );
+#else
+            return ( iStandAlone );
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::SetVolume
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::SetVolume( const TInt aVolume )
+    {
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdSetVolume );
+    cmd->SetTObjectValueL<TUint>( KMPXCommandPlaybackGeneralData, aVolume );
+    iPlaybackUtility->CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::MuteVolume
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::MuteVolume()
+    {
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdMuteVolume );
+    iPlaybackUtility->CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::UnMuteVolume
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::UnMuteVolume()
+    {
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdUnMuteVolume );
+    iPlaybackUtility->CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::UnMuteVolume
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAppUi::MPXCmdForPbCmd(
+    TMPXPlaybackCommand aCommand )
+    {
+    TInt cmd( KErrNotFound );
+
+    switch ( aCommand )
+        {
+        case EPbCmdStop:
+            {
+            cmd = EMPXCmdStop;
+            break;
+            }
+        case EPbCmdPlay:
+            {
+            cmd = EMPXCmdPlay;
+            break;
+            }
+        case EPbCmdPause:
+            {
+            cmd = EMPXCmdPause;
+            break;
+            }
+        case EPbCmdPlayPause:
+            {
+            cmd = EMPXCmdPlayPause;
+            break;
+            }
+        case EPbCmdNext:
+            {
+            cmd = EMPXCmdNext;
+            break;
+            }
+        case EPbCmdPrevious:
+            {
+            cmd = EMPXCmdPrevious;
+            break;
+            }
+        case EPbCmdStartSeekForward:
+            {
+            cmd = EMPXCmdSeekForward;
+            break;
+            }
+        case EPbCmdStartSeekBackward:
+            {
+            cmd = EMPXCmdSeekBackward;
+            break;
+            }
+        case EPbCmdStopSeeking:
+            {
+            cmd = EMPXCmdStopSeeking;
+            break;
+            }
+        default:
+            {
+            // Command not found
+            break;
+            }
+        }
+    return cmd;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::CheckAvailableMemory
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::CheckAvailableMemory( TInt aNeedMemory )
+    {
+    TMemoryInfoV1Buf info;
+    UserHal::MemoryInfo(info);
+    if( info().iFreeRamInBytes < aNeedMemory )
+        {
+        HBufC* title =
+            StringLoader::LoadLC( R_MPX_NO_MEMORY_INFO );
+        CAknGlobalNote* infoNote = CAknGlobalNote::NewLC();
+        infoNote->ShowNoteL(
+            EAknGlobalInformationNote,
+            title->Des() );
+        CleanupStack::PopAndDestroy( infoNote );
+        CleanupStack::PopAndDestroy( title );
+        Exit();
+        return;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::CheckUpdatesComplete
+// from base class MIAUpdateObserver
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::CheckUpdatesComplete( TInt aErrorCode, TInt aAvailableUpdates )
+    {
+    MPX_DEBUG2("CMPXAppUi::CheckUpdatesComplete(UpdatesComplete: %d) entering", aErrorCode);
+    if ( aErrorCode == KErrNone )
+        {
+            MPX_DEBUG2("CMPXAppUi::CheckUpdatesComplete(AvailableUpdates: %d)", aAvailableUpdates);
+            if ( aAvailableUpdates > 0 )
+                {
+                // There were some updates available. Let's ask if the user wants to update them.
+                iUpdate->UpdateQuery();
+                }
+            else
+                {
+                // No updates available. CIAUpdate object could be deleted
+                CleanUpdateParams();
+                }
+        }
+        MPX_DEBUG1( "CMPXAppUi::CheckUpdatesComplete() exiting" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::UpdateComplete
+// from base class MIAUpdateObserver
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::UpdateComplete( TInt /*aErrorCode*/, CIAUpdateResult* aResultDetails )
+    {
+    MPX_DEBUG1( "CMPXAppUi::UpdateComplete() entering" );
+    // The update process that the user started from IAUpdate UI is now completed.
+    if(aResultDetails)
+        {
+        delete aResultDetails; // Ownership was transferred, so this must be deleted by the client
+        aResultDetails = NULL;
+        }
+
+    // We do not need the client-server session anymore, let's delete the object to close the session
+    CleanUpdateParams();
+    MPX_DEBUG1( "CMPXAppUi::UpdateComplete() exiting" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::UpdateQueryComplete
+// from base class MIAUpdateObserver
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::UpdateQueryComplete( TInt aErrorCode, TBool aUpdateNow )
+    {
+    MPX_DEBUG2("CMPXAppUi::UpdateQueryComplete(QueryComplete: %d) entering", aErrorCode);
+    if ( aErrorCode == KErrNone )
+        {
+        MPX_DEBUG2("CMPXAppUi::UpdateQueryComplete(UpdateNow: %d) ", aUpdateNow);
+        if ( aUpdateNow )
+            {
+            // User choosed to update now, so let's launch the IAUpdate UI.
+            iUpdate->ShowUpdates( *iParameters );
+            }
+        else
+            {
+            // The answer was 'Later'. CIAUpdate object could be deleted
+            CleanUpdateParams();
+            }
+         }
+    MPX_DEBUG1( "CMPXAppUi::UpdateQueryComplete() exiting" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::UpdateQueryComplete
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::CleanUpdateParams()
+    {
+    MPX_DEBUG1( "CMPXAppUi::CleanUpdateParams() entering" );
+    if(iUpdate)
+        {
+        delete iUpdate;
+        iUpdate = NULL;
+        }
+    if(iParameters)
+        {
+        delete iParameters;
+        iParameters = NULL;
+        }
+    MPX_DEBUG1( "CMPXAppUi::CleanUpdateParams() exiting" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::CheckUpdatesL
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::CheckUpdatesL()
+    {
+    MPX_DEBUG1( "CMPXAppUi::CheckUpdatesL() entering" );
+    if ( FeatureManager::FeatureSupported( KFeatureIdIAUpdate ) )
+        {
+        MPX_DEBUG1( "CMPXAppUi::CheckUpdatesL() IAD Update supported" );
+
+        TRAP_IGNORE( iUpdate = CIAUpdate::NewL( *this ) );
+
+        MPX_DEBUG1( "CMPXAppUi::CheckUpdatesL() IAD Update Client Created" );
+
+        if ( iUpdate )
+            {
+            MPX_DEBUG1( "CMPXAppUi::CheckUpdatesL() creating IAD Update paramentes" );
+            iParameters = CIAUpdateParameters::NewL();
+
+            // Search for updates using SIS package UID
+            iParameters->SetUid( TUid::Uid( KMPXMusicPlayerSISPkgUid ) );
+
+            //mpx.exe to be started after update is finished
+            iParameters->SetCommandLineExecutableL( KMPXMusicPlayerExec );
+
+            //check the updates
+            iUpdate->CheckUpdates( *iParameters );
+            }
+        }
+    MPX_DEBUG1( "CMPXAppUi::CheckUpdatesL() exiting" );
+    }
+
+#ifdef FF_OOM_MONITOR2_COMPONENT
+// -----------------------------------------------------------------------------
+// CMPXAppUi::SetMpxOomPriorityL
+// -----------------------------------------------------------------------------
+//
+void CMPXAppUi::SetMpxOomPriorityL( ROomMonitorSession::TOomPriority aPriority )
+    {
+    if( aPriority != iOomPriority )
+        {
+        ROomMonitorSession monitorSession;
+        User::LeaveIfError ( monitorSession.Connect() );
+        // No leaving code after this point, so no need to use cleanup stack
+        monitorSession.SetOomPriority( aPriority );
+        iOomPriority = aPriority;
+        monitorSession.Close(); // CLOSE THE OOM SESSION....
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAppUi::CheckAvailableMemoryByOomL
+// -----------------------------------------------------------------------------
+//
+void  CMPXAppUi::CheckAvailableMemoryByOomL( TInt aNeedMemory )
+    {
+    ROomMonitorSession oomMonitor;
+    User::LeaveIfError( oomMonitor.Connect() );
+    // No leaving code after this point, so no need to use cleanup stack
+    TInt errorCode = oomMonitor.RequestFreeMemory( aNeedMemory );
+    oomMonitor.Close();
+
+    if ( errorCode != KErrNone )
+        {
+        // NOT ENOUGH MEMORY ....Show Information note and exit out..
+        HBufC* title = StringLoader::LoadLC( R_MPX_NO_MEMORY_INFO );
+        CAknGlobalNote* infoNote = CAknGlobalNote::NewLC();
+        infoNote->ShowNoteL(
+            EAknGlobalInformationNote,
+            title->Des() );
+        CleanupStack::PopAndDestroy( infoNote );
+        CleanupStack::PopAndDestroy( title );
+        Exit();
+        }
+    }
+#endif // FF_OOM_MONITOR2_COMPONENT
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/src/mpxcommandhandler.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,768 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Handles commands passed in by other appilcations
+*
+*/
+
+
+// INCLUDE FILES
+#include <bldvariant.hrh>
+#include <apgtask.h>
+#include <eikenv.h>
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionopenutility.h>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxviewutility.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxparameter.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessagedefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediaarray.h>
+
+#include "mpxtlshelper.h"
+#include <mpxconstants.h>
+#include "mpxcommandhandler.h"
+#include "mpxlog.h"
+#include <mpxviewpluginmanager.h>
+#include <mpxviewplugin.h>
+
+const TInt KIncrementalFetchCount = 10; // all we need is the first song in all song
+const TInt KWaitNoteImpUid = 0x101FFC6C; // refresh wait note UID
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCommandHandler* CMPXCommandHandler::NewL(
+    MMPXPlaybackUtility* aPlaybackUtility,
+    TUid aCollectionMode,
+    const TDesC8& aParameter )
+    {
+    CMPXCommandHandler* self = NewLC(
+        aPlaybackUtility, aCollectionMode, aParameter );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCommandHandler* CMPXCommandHandler::NewLC(
+    MMPXPlaybackUtility* aPlaybackUtility,
+    TUid aCollectionMode,
+    const TDesC8& aParameter )
+    {
+    CMPXCommandHandler* self = new ( ELeave )
+        CMPXCommandHandler( aPlaybackUtility );
+    CleanupStack::PushL(self);
+    self->ConstructL( aCollectionMode, aParameter );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ----------------------------------------------------------------------------
+//
+CMPXCommandHandler::CMPXCommandHandler(
+    MMPXPlaybackUtility* aPlaybackUtility ):
+    iPlaybackUtility( aPlaybackUtility )
+    ,iPathInited( EFalse )
+    ,iLastPlayedAutostart(EFalse)
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCommandHandler::~CMPXCommandHandler()
+    {
+    if ( iPlaybackUtility )
+        {
+        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+        }
+    if ( iMusicPlayerCollectionUtility )
+        {
+        iMusicPlayerCollectionUtility->Close();
+        }
+    if ( iViewUtility )
+        {
+        iViewUtility->Close();
+        }
+    delete iIsolatedIncOpenUtil;
+    delete iParameter;
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXCommandHandler::ConstructL(
+    TUid aCollectionMode,
+    const TDesC8& aParameter )
+    {
+    iIsolatedIncOpenUtil =
+        CMPXCollectionOpenUtility::NewL( this, KMcModeIsolated );
+    iMusicPlayerCollectionUtility = MMPXCollectionUtility::NewL(
+        this, aCollectionMode );
+    iPlaybackUtility->AddObserverL( *this );
+    iViewUtility = MMPXViewUtility::UtilityL();
+    ExtractMessageL( aParameter );
+    }
+
+// ---------------------------------------------------------------------------
+// Start processing the command
+// ---------------------------------------------------------------------------
+//
+void CMPXCommandHandler::ProcessMessageL( TBool aIsUsbInUse, TBool aRefreshing, TBool aFormattingOnGoing )
+    {
+    MPX_FUNC( "CMPXCommandHandler::ProcessMessageL" );
+    iPathInited = EFalse;
+    iUsbInUse = aIsUsbInUse;
+    iRefreshOngoing = aRefreshing;
+    if ( iUsbInUse || iRefreshOngoing || aFormattingOnGoing )
+        {
+        MPX_DEBUG1( "CMPXCommandHandler::ProcessMessageL USB/Refresh/Formatting ongoing, bring app to foreground only" );
+        // USB is in use, bring the app to foreground and ignore the message
+        delete iParameter;
+        iParameter = NULL;
+        // have to use window group to activate, in case some other window
+        // has higher priority than us (e.g. playback popup and volume popup)
+        RWindowGroup myWin = CEikonEnv::Static()->RootWin();
+        myWin.SetOrdinalPosition( 0, ECoeWinPriorityNormal );
+        }
+    else
+        {
+        if ( iParameter )
+            {
+            if ( CEikonEnv::Static()->StartedAsServerApp() )
+                {
+                // embedded mode, can't check if db exist
+                // just process the message
+                MPX_DEBUG1( "CMPXCommandHandler::ProcessMessageL embedded mode" );
+                DoHandleMessageL();
+                }
+            else
+                {
+                // check if DB is created
+                MPX_DEBUG1( "CMPXCommandHandler::ProcessMessageL check if db is created" );
+                RArray<TMPXAttribute> atts;
+                CleanupClosePushL( atts );
+                atts.Append( KMPXMediaColDetailDBCreated );
+                if ( iParameter->iCollectionPath )
+                    {
+                    iMusicPlayerCollectionUtility->Collection().MediaL(
+                        *iParameter->iCollectionPath, atts.Array() );
+                    }
+                else
+                    {
+                    MMPXCollectionUiHelper* colUiHelper =
+                        CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+                    CMPXCollectionPath* cpath = colUiHelper->MusicMenuPathL();
+                    CleanupStack::PushL( cpath );
+                    iMusicPlayerCollectionUtility->Collection().MediaL(
+                        *cpath, atts.Array() );
+                    colUiHelper->Close();
+                    CleanupStack::PopAndDestroy( cpath );
+                    }
+                CleanupStack::PopAndDestroy( &atts );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Returns if a path has been inited in playback engine
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCommandHandler::IsPathInited()
+    {
+    MPX_FUNC( "CMPXCommandHandler::IsPathInited" );
+    return iPathInited;
+    }
+
+// ---------------------------------------------------------------------------
+// Set usb status
+// ---------------------------------------------------------------------------
+//
+void CMPXCommandHandler::SetUsbInUse( TBool aIsUsbInUse )
+    {
+    MPX_FUNC( "CMPXCommandHandler::SetUsbInUse" );
+    iUsbInUse = aIsUsbInUse;
+    }
+
+// ---------------------------------------------------------------------------
+// Set refresh status
+// ---------------------------------------------------------------------------
+//
+void CMPXCommandHandler::SetRefreshState( TBool aRefreshing )
+    {
+    MPX_FUNC( "CMPXCommandHandler::aRefreshing" );
+    iRefreshOngoing = aRefreshing;
+    }
+
+// ---------------------------------------------------------------------------
+// Determines if the command should be handled by standalone mode.
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCommandHandler::ForwardCmdToStandAloneMode()
+    {
+    MPX_FUNC( "CMPXCommandHandler::ForwardCmdToStandAloneMode" );
+    TBool ret( EFalse );
+    if ( iParameter )
+        {
+        ret = ( iParameter->iCmdForward == EMPXCmdFwdStandAlone );
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Determines if the command should be handled by now playing instance
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCommandHandler::ForwardCmdToNowPlaying()
+    {
+    MPX_FUNC( "CMPXCommandHandler::ForwardCmdToNowPlaying" );
+    TBool ret( EFalse );
+    if ( iParameter )
+        {
+        ret = ( iParameter->iCmdForward == EMPXCmdFwdNowPlaying );
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Checks if initialize playback engine is needed for current command
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCommandHandler::IsInitPlaybackEngineNeeded()
+    {
+    MPX_FUNC( "CMPXCommandHandler::IsInitPlaybackEngineNeeded" );
+    TBool ret( EFalse );
+    if ( iParameter )
+        {
+        ret = ( iParameter->iPathType == EMPXTypeCollectionPlaylist );
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Extracts the activated view type from the command
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCommandHandler::ActivatedViewTypeId()
+    {
+    MPX_FUNC( "CMPXCommandHandler::ActivatedViewTypeId" );
+    TInt id( 0 );
+    if ( iParameter )
+        {
+        id = iParameter->iType.iUid;
+        }
+    return id;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handle media properties.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommandHandler::HandleCollectionMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXCommandHandler::HandleCollectionMediaL" );
+    TBool bringToForeground( EFalse );
+
+    TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid );
+    TUid activeView = iViewUtility->ActiveViewType();
+    if( activeView == waitnoteId && !iUsbInUse && !iRefreshOngoing )
+        {
+        CMPXViewPlugin* pi =
+            iViewUtility->ViewPluginManager().PluginL( TUid::Uid(KWaitNoteImpUid) );
+        pi->DeactivateView();
+        }
+
+    if ( aError == KErrNone )
+        {
+        if( aMedia.IsSupported( KMPXMediaColDetailDBCreated ) )
+            {
+            TBool dbCreated( aMedia.ValueTObjectL<TBool>( KMPXMediaColDetailDBCreated ) );
+            if ( dbCreated )
+                {
+                MPX_DEBUG1( "CMPXCommandHandler::HandleCollectionMediaL DB status ok" );
+                DoHandleMessageL();
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXCommandHandler::HandleCollectionMediaL DB not created" );
+                if ( !iUsbInUse && !iRefreshOngoing )
+                    {
+                    iViewUtility->ActivateViewL( TUid::Uid( KMPXPluginTypeMainUid ) );
+                    }
+                else
+                    {
+                    MPX_DEBUG1( "CMPXCommandHandler::HandleCollectionMediaL USB in use/Refreshing, not activating view" );
+                    }
+                bringToForeground = ETrue;
+                }
+            }
+        }
+    else
+        {
+        MPX_DEBUG1( "CMPXCommandHandler::HandleCollectionMediaL error getting DB status" );
+        if ( !iUsbInUse && !iRefreshOngoing )
+            {
+            iViewUtility->ActivateViewL( TUid::Uid( KMPXPluginTypeMainUid ) );
+            }
+        else
+            {
+            MPX_DEBUG1( "CMPXCommandHandler::HandleCollectionMediaL USB in use/Refreshing, not activating view" );
+            }
+        bringToForeground = ETrue;
+        }
+
+    if ( bringToForeground )
+        {
+        MPX_DEBUG1( "CMPXCommandHandler::HandleCollectionMediaL bringing app to foreground" );
+        // have to use window group to activate, in case some other window
+        // has higher priority than us (e.g. playback popup and volume popup)
+        RWindowGroup myWin = CEikonEnv::Static()->RootWin();
+        myWin.SetOrdinalPosition( 0, ECoeWinPriorityNormal );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handle collection message.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommandHandler::HandleCollectionMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handles the collection entries being opened.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommandHandler::HandleOpenL(
+    const CMPXMedia& aEntries,
+    TInt /* aIndex */,
+    TBool /* aComplete */,
+    TInt aError  )
+    {
+    MPX_FUNC( "CMPXCommandHandler::HandleOpenL 4" );
+    if ( iCollectionPlaylistState ==
+        TMPXCollectionPlaylistSetupStateOpenPath )
+        {
+        if ( !aError )
+            {
+            const CMPXMediaArray* mediaArray(
+                aEntries.Value<CMPXMediaArray>( KMPXMediaArrayContents ) );
+            User::LeaveIfNull( const_cast<CMPXMediaArray*>( mediaArray ));
+            if ( mediaArray->Count() > 0 )
+                {
+                CMPXCollectionPath* cPath( iIsolatedIncOpenUtil->PathL() );
+                CleanupStack::PushL( cPath );
+                if ( cPath->Id( cPath->Levels() - 1 ) != KMPXInvalidItemId )
+                    {
+                    iIsolatedIncOpenUtil->Stop();
+                    InitPlaybackEngineL( *cPath );
+                    }
+                CleanupStack::PopAndDestroy( cPath );
+                }
+            else
+                {
+                // if there's nothing to open, check if the parameter
+                // contains a view to open
+                DoHandleMessageL();
+                }
+            }
+        else
+            {
+            iCollectionPlaylistState = TMPXCollectionPlaylistSetupStateIdle;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handles the item being opened.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommandHandler::HandleOpenL(
+    const CMPXCollectionPlaylist& /*aPlaylist*/,
+    TInt /*aError*/ )
+    {
+    MPX_FUNC("CMPXCommandHandler::HandleOpenL 2");
+    // Not used
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommandHandler::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Initialize the playback engine with a collection path
+// ---------------------------------------------------------------------------
+//
+void CMPXCommandHandler::InitPlaybackEngineL( CMPXCollectionPath& aPath )
+    {
+    MPX_FUNC( "CMPXCommandHandler::InitPlaybackEngineL" );
+    CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL( aPath );
+    CleanupStack::PushL( playlist );
+    if ( iCollectionPlaylistState ==
+        TMPXCollectionPlaylistSetupStateOpenPath )
+        {
+        playlist->SetToIndex(KErrNotFound);
+        }
+    iCollectionPlaylistState =
+        TMPXCollectionPlaylistSetupStateInitPlaybackEngine;
+    iPlaybackUtility->InitL( *playlist, ETrue );
+    iPathInited = ETrue;
+    CleanupStack::PopAndDestroy( playlist );
+    }
+
+// -----------------------------------------------------------------------------
+// DoHandleMessageL
+// -----------------------------------------------------------------------------
+//
+void CMPXCommandHandler::DoHandleMessageL()
+    {
+    MPX_FUNC( "CMPXCommandHandler::DoHandleMessageL" );
+
+    TBool isNeedSetWindowGroup = ETrue;
+    TBool pathOpened( EFalse );
+    iUnhandledMessage = EFalse;
+    TUid appToActivate( KAppUidMusicPlayerX );
+    if ( CEikonEnv::Static()->StartedAsServerApp() )
+        {
+        // if it's embedded mode
+        appToActivate = MPXTlsHelper::HostUid();
+        }
+
+    MPX_DEBUG3( "CMPXCommandHandler::DoHandleMessageL iUsbInUse = %d, iRefreshOngoing = %d", iUsbInUse, iRefreshOngoing );
+    if ( iParameter && !iUsbInUse && !iRefreshOngoing )
+        {
+        if ( iParameter->iCollectionPath )
+            {
+            if ( iParameter->iPathType != EMPXTypeCollectionPlaylist )
+                {
+                // if it's a collection path, use music player collection
+                // utility to open it.  Collection server understands collection path
+                // with indexes but not ids.
+                MPX_DEBUG1( "CMPXCommandHandler::DoHandleMessageL iCollectionPath defined, path" );
+                iMusicPlayerCollectionUtility->Collection().OpenL(
+                    *iParameter->iCollectionPath );
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXCommandHandler::DoHandleMessageL iCollectionPath defined, playlist" );
+                // if it's collection playlist path, need to use isolated
+                // collection utility to translate it to real uids
+                iCollectionPlaylistState =
+                    TMPXCollectionPlaylistSetupStateOpenPath;
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL( attrs );
+                TArray<TMPXAttribute> ary = attrs.Array();
+                iIsolatedIncOpenUtil->Stop();
+                iIsolatedIncOpenUtil->SetDelay( 0 );
+                iIsolatedIncOpenUtil->StartL( *iParameter->iCollectionPath, ary, KIncrementalFetchCount,
+                                      0, CMPXCollectionOpenUtility::EFetchNormal );
+                CleanupStack::PopAndDestroy( &attrs );
+                }
+            pathOpened = ETrue;
+            }
+        if ( iParameter->iType != KNullUid )
+            {
+            if ( pathOpened )
+                {
+                MPX_DEBUG1( "CMPXCommandHandler::DoHandleMessageL path opened, view activation deffered" );
+                // path opened, need to wait for callback before handling
+                // view switching
+                iUnhandledMessage = ETrue;
+                delete iParameter->iCollectionPath;
+                iParameter->iCollectionPath = NULL;
+                }
+            else
+                {
+                MPX_DEBUG2( "CMPXCommandHandler::DoHandleMessageL activate view 0x%x", iParameter->iType.iUid );
+                if ( iParameter->iType.iUid == KMPXPluginTypePlaybackUid && appToActivate == KAppUidMusicPlayerX )
+                    {
+                    // push default view history in case for view jumps
+                    iViewUtility->PushDefaultHistoryL();
+                    // only do this when it's not embedded mode
+                    MPX_DEBUG1( "CMPXCommandHandler::DoHandleMessageL activate playback view special handling" );
+                    // special handling needed for playback view activation
+                    MMPXPlayer* player =
+                        iPlaybackUtility->PlayerManager().CurrentPlayer();
+                    RArray<TUid> array;
+                    CleanupClosePushL( array );
+
+                    array.AppendL( iParameter->iType );
+                    if ( player )
+                        {
+                        array.AppendL( player->UidL() );
+                        }
+
+                    // add the collection plugin UID to ensure the correct
+                    // last playback view is activated
+                    MMPXSource* source = iPlaybackUtility->Source();
+                    if( source )
+                        {
+                        CMPXCollectionPlaylist* pl = source->PlaylistL();
+                        if ( pl )
+                            {
+                            CleanupStack::PushL( pl );
+                            const CMPXCollectionPath& path = pl->Path();
+                            if( path.Levels() > 0 )
+                                {
+                                MPX_DEBUG2( "CMPXCommandHandler::DoHandleMessageL appending UID 0x%x", path.Id( 0 ).iId1 );
+                                array.AppendL( TUid::Uid( path.Id( 0 ) ) );
+                                }
+                            CleanupStack::PopAndDestroy( pl );
+                            }
+                        }
+                    if ( !iUsbInUse && !iRefreshOngoing )
+                        {
+                        iViewUtility->ActivateViewL( array );
+                        }
+                    else
+                        {
+                        MPX_DEBUG1( "CMPXCommandHandler::DoHandleMessageL USB in use/Refreshing, not activating view" );
+                        }
+                    CleanupStack::PopAndDestroy( &array );
+                    }
+                else if ( iParameter->iType.iUid == KMPXPluginTypeLastPlayedUid && appToActivate == KAppUidMusicPlayerX )
+                    {
+                    // push default view history in case for view jumps
+                    iViewUtility->PushDefaultHistoryL();
+                    // only do this when it's not embedded mode
+                    MPX_DEBUG1( "CMPXCommandHandler::DoHandleMessageL activate playback view special handling" );
+                    // special handling needed for playback view activation
+                    MMPXPlayer* player =
+                        iPlaybackUtility->PlayerManager().CurrentPlayer();
+                    RArray<TUid> array;
+                    CleanupClosePushL( array );
+
+                    array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid) );
+                    if ( player )
+                        {
+                        array.AppendL( player->UidL() );
+                        }
+
+                    // add the collection plugin UID to ensure the correct
+                    // last playback view is activated
+                    MMPXSource* source = iPlaybackUtility->Source();
+                    if( source )
+                        {
+                        CMPXCollectionPlaylist* pl = source->PlaylistL();
+                        if ( pl )
+                            {
+                            CleanupStack::PushL( pl );
+                            const CMPXCollectionPath& path = pl->Path();
+                            if( path.Levels() > 0 )
+                                {
+                                MPX_DEBUG2( "CMPXCommandHandler::DoHandleMessageL appending UID 0x%x", path.Id( 0 ).iId1 );
+                                array.AppendL( TUid::Uid( path.Id( 0 ) ) );
+                                }
+                            CleanupStack::PopAndDestroy( pl );
+                            }
+                        }
+                    if ( !iUsbInUse && !iRefreshOngoing )
+                        {
+                        iLastPlayedAutostart = ETrue;
+                        TRAP_IGNORE(iPlaybackUtility->CommandL( EPbCmdPlay ));
+                        RWindowGroup myWin = CEikonEnv::Static()->RootWin();
+                        if ( myWin.OrdinalPosition() == 0 ) //top window
+                            {
+                            iViewUtility->ActivateViewL( array );
+                            }
+                        else 
+                            {
+                            isNeedSetWindowGroup = EFalse;
+                        	}
+                        }
+                    else
+                        {
+                        MPX_DEBUG1( "CMPXCommandHandler::DoHandleMessageL USB in use/Refreshing, not activating view" );
+                        }
+                    CleanupStack::PopAndDestroy( &array );
+                    }
+                else if ( appToActivate == KAppUidMusicPlayerX )
+                    {
+                    if ( !iUsbInUse && !iRefreshOngoing )
+                        {
+                        RArray<TUid> array;
+                        CleanupClosePushL( array );
+                        array.AppendL( iParameter->iType );
+                        if ( iParameter->iType.iUid == KMPXPluginTypeCollectionUid && appToActivate == KAppUidMusicPlayerX )
+                            {
+                            CMPXCollectionPath* cpath( iMusicPlayerCollectionUtility->Collection().PathL() );
+                            CleanupStack::PushL( cpath );
+                            if( cpath->Levels() > 0 )
+                                {
+                                MPX_DEBUG2( "CMPXCommandHandler::DoHandleMessageL appending UID 0x%x", cpath->Id( 0 ).iId1 );
+                                array.AppendL( TUid::Uid( cpath->Id( 0 ) ) );
+                                }
+                            CleanupStack::PopAndDestroy( cpath );
+                            }
+                        // push default view history in case for view jumps
+                        iViewUtility->PushDefaultHistoryL();
+                        // only do this if it's not embedded mode
+                        iViewUtility->ActivateViewL( array );
+                        CleanupStack::PopAndDestroy( &array );
+                        }
+                    else
+                        {
+                        MPX_DEBUG1( "CMPXCommandHandler::DoHandleMessageL USB in use/Refreshing, not activating view" );
+                        }
+                    }
+                else
+                    {
+                    MPX_DEBUG1( "CMPXCommandHandler::DoHandleMessageL embedded mode, not activating view" );
+                    }
+                }
+            }
+        }
+    if ( !iUnhandledMessage || iUsbInUse || iRefreshOngoing )
+        {
+        // after the message is handled, delete it
+        delete iParameter;
+        iParameter = NULL;
+        // have to use window group to activate, in case some other window
+        // has higher priority than us (e.g. playback popup and volume popup)
+        if ( isNeedSetWindowGroup )
+            {
+            RWindowGroup myWin = CEikonEnv::Static()->RootWin();
+            myWin.SetOrdinalPosition( 0, ECoeWinPriorityNormal );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// ExtractMessageL
+// -----------------------------------------------------------------------------
+//
+void CMPXCommandHandler::ExtractMessageL( const TDesC8& aMessage )
+    {
+    MPX_FUNC( "CMPXCommandHandler::ExtractMessageL" );
+    ASSERT( aMessage.Length() > 0 );
+    delete iParameter;
+    iParameter = NULL;
+    CBufBase* buffer = CBufFlat::NewL( aMessage.Size() );
+    CleanupStack::PushL( buffer );
+    buffer->ResizeL( aMessage.Size() );
+    buffer->Write( 0, aMessage );
+    RBufReadStream readStream( *buffer );
+    CleanupClosePushL( readStream );
+    iParameter = new ( ELeave ) CMPXParameter();
+    iParameter->InternalizeL( readStream );
+    CleanupStack::PopAndDestroy( &readStream );
+    CleanupStack::PopAndDestroy( buffer );
+    }
+
+// -----------------------------------------------------------------------------
+// Handle playback message
+// -----------------------------------------------------------------------------
+//
+void CMPXCommandHandler::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXCommandHandler::DoHandlePlaybackMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EInitializeComplete:
+                {
+                if ( iCollectionPlaylistState ==
+                    TMPXCollectionPlaylistSetupStateInitPlaybackEngine )
+                    {
+                    iViewUtility->PushDefaultHistoryL();
+                    iPlaybackUtility->CommandL( EPbCmdPlay );
+                    iCollectionPlaylistState =
+                        TMPXCollectionPlaylistSetupStateIdle;
+                    delete iParameter;
+                    iParameter = NULL;
+                    RWindowGroup myWin = CEikonEnv::Static()->RootWin();
+                    myWin.SetOrdinalPosition( 0, ECoeWinPriorityNormal );
+                    }
+                if (iLastPlayedAutostart)
+                    {
+                    iPlaybackUtility->CommandL( EPbCmdPlay );
+                    iLastPlayedAutostart = EFalse;
+                    }
+                break;
+                }
+            default:
+                {
+                // ignore other playback messages
+                break;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle collection message
+// -----------------------------------------------------------------------------
+//
+void CMPXCommandHandler::DoHandleCollectionMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXCommandHandler::DoHandleCollectionMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        MPX_DEBUG3( "CMPXCommandHandler::HandleCollectionMessage Event = %d, Type() = %d",
+            event, type );
+        if ( iUnhandledMessage )
+            {
+            DoHandleMessageL();
+            }
+        else
+            {
+            // do nothing
+            }
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/src/mpxcontroller.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,777 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Controller for MPX Music player
+*
+*/
+
+
+#include <e32base.h>
+#include <mpx.rsg>
+#include <mpxlog.h>
+
+// Member Variables
+#include <mpxcollectionutility.h>
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxcollectionplugin.hrh>
+#include <mpxviewutility.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpxviewpluginmanager.h>
+#include <mpxviewplugin.h>
+#include <mpxplaybackutility.h>
+
+// MPX Attributes
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxmessagecontainerdefs.h>
+
+// Other MPX
+#include <mpxmedia.h>
+#include <mpxcollectionpath.h>
+#include <mpxmusicplayer.hrh>
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+#include <aknSDData.h>
+#include <AknMediatorFacade.h>
+#include <mplayersecondarydisplayapi.h>
+//#endif
+// Cover UI end
+
+// System
+#include <StringLoader.h>
+#include <textresolver.h>
+#include <AknQueryDialog.h>
+#include <aknnotewrappers.h>
+
+// Header
+#include "mpxcontroller.h"
+
+// CONSTANTS
+const TInt KWaitNoteImpUid = 0x101FFC6C;
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXController::CMPXController( TBool aDisablePodcasting ) 
+                                 : iCurSystemEvent(KErrNotFound),
+                                   iCurPlugin(KErrNotFound),
+                                   iDisablePodcasting(aDisablePodcasting)
+    {
+    
+    }
+
+
+// ---------------------------------------------------------------------------
+// 2nd phase constructor
+// ---------------------------------------------------------------------------
+//
+void CMPXController::ConstructL()
+    {
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+    iViewUtility = MMPXViewUtility::UtilityL();
+    iIdle = CIdle::NewL( CActive::EPriorityStandard );
+    
+    // Monitor for when the app is first activated
+    CEikonEnv::Static()->AppUi()->AddViewActivationObserverL( this );
+    
+    // Fetch the music collection UID
+    RArray<TUid> uid;
+    CleanupClosePushL( uid );
+    uid.AppendL( TUid::Uid(EMPXCollectionPluginMusic) );
+    iMusicCollectionId = iCollectionUtility->CollectionIDL( uid.Array() );
+    
+    // Fetch the podcast collection UID
+    if( !iDisablePodcasting )
+        {
+        uid.Reset();
+        uid.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) );
+        iPodcastCollectionId = iCollectionUtility->CollectionIDL( uid.Array() );;
+        }
+    CleanupStack::PopAndDestroy( &uid );
+
+    // Do the initial checking
+    DoRetrieveDetailsL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two phase constructor
+// ---------------------------------------------------------------------------
+//
+CMPXController* CMPXController::NewL( TBool aDisablePodcasting )
+    {
+    CMPXController* self = new( ELeave ) CMPXController( aDisablePodcasting );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXController::~CMPXController()
+    {
+    CEikonEnv::Static()->AppUi()->RemoveViewActivationObserver( this );
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+    
+    if ( iViewUtility )
+        {
+        iViewUtility->Close();
+        }
+    
+    if ( iPlaybackUtility )
+        {
+        iPlaybackUtility->Close();
+        }
+        
+    delete iCurPath;
+    delete iIdle;
+    }
+
+    
+// ---------------------------------------------------------------------------
+// Handle an idle callback event
+// ---------------------------------------------------------------------------
+//
+TInt CMPXController::IdleCallback( TAny* ptr )
+    {
+    TRAP_IGNORE( ( (CMPXController*) ptr )->HandleIdleEventL() );
+    return 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle an idle callback event
+// ---------------------------------------------------------------------------
+//    
+void CMPXController::HandleIdleEventL()
+    {
+    MPX_FUNC( "CMPXController::HandleIdleEventL" );
+    if( iRestartWaitDialog )
+        {
+        DoHandleBroadcastMsgL( iCurSystemEvent );
+        iRestartWaitDialog = EFalse;
+        }
+    else
+        {
+        TInt event = iDelayedUsbRefresh ? EMcMsgUSBMassStorageStart : iCurSystemEvent;
+        switch( event )
+            {
+            case EMcMsgUSBMassStorageStart:
+                {
+                MPX_DEBUG1("CMPXController::HandleIdleEventL -- Mass Storage dialog");
+                iCurSystemEvent = KErrNotFound;
+                iDelayedUsbRefresh = EFalse;
+
+                HBufC* title = StringLoader::LoadLC( R_MPX_REFRESH_AFTER_SYNC );
+                CAknQueryDialog* query = new( ELeave ) CAknQueryDialog();
+                iQueryDialog = query;
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY            
+		            query->PublishDialogL(
+		                EMPlayerNoteUSBSyncRefresh,
+		                KMPlayerNoteCategory); 
+//#endif           
+// Cover UI end         
+                 
+                TInt rtn = query->ExecuteLD( R_MPX_QUERY_YES_NO , 
+                                             *title );
+                CleanupStack::PopAndDestroy( title );
+                iQueryDialog = NULL;  // Dialog destroyed
+                
+                if ( rtn == EAknSoftkeyYes )
+                    {
+                    StartWaitNoteL( EMPXRefreshingNote );  
+                    }
+                else
+                    {
+                    MPX_DEBUG1("CMPXController::HandleIdleEventL -- refreshing view");
+                    
+                    // Refresh the UI view in this case
+                    // 
+                    if ( !CEikonEnv::Static()->StartedAsServerApp() )
+                        {
+                        CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+                        CleanupStack::PushL( cPath );
+                        if( cPath->Levels() > 1 && 
+                            iViewUtility->ActiveViewType() == TUid::Uid(KMPXPluginTypeCollectionUid) ) 
+                            {
+                            MPX_DEBUG1("CMPXController::HandleIdleEventL() Refreshing UI");
+                            cPath->Back();
+                            iCollectionUtility->Collection().OpenL( *cPath );
+                            }
+                        CleanupStack::PopAndDestroy( cPath );
+                        }
+                    
+                    DoRetrieveDetailsL();
+                    }
+                break;
+                }
+            default:
+                {
+                break;    
+                }
+            
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//   
+void CMPXController::HandleCollectionMessage( CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMPXController::HandleOpenL( const CMPXMedia& /*aEntries*/,
+                                  TInt /*aIndex*/,
+                                  TBool /*aComplete*/,
+                                  TInt /*aError*/ )
+    {
+    // Not used
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMPXController::HandleOpenL( const CMPXCollectionPlaylist& /*aPlaylist*/,
+                                   TInt /*aError*/ )
+    {
+    // Not used
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMPXController::HandleCollectionMediaL( const CMPXMedia& aMedia,
+                                             TInt aError )
+    {
+    MPX_FUNC( "CMPXController::HandleCollectionMediaL" );
+    
+    // Handle Each error condition
+    //
+    if (aError == KErrNoMemory)
+        {
+        TRAP_IGNORE(
+                HandleErrorL( aError );
+                );
+        CAknEnv::RunAppShutter();
+        User::Exit(KErrNoMemory);
+        }
+    else if( aError == KErrCorrupt )
+        {
+        DoHandleCorruptMsgL();
+        }
+    else if (aError == KErrDiskFull)
+        {
+        iOutOfDisk = ETrue;
+        CloseWaitNoteL();
+        iCurPlugin = KErrNotFound;
+        DoRetrieveDetailsL(ETrue);         
+        } 
+    else // !KErrNoMemory, !KErrCorrupt, !KErrDiskFull
+        {
+        if(!iOutOfDisk)
+            {
+            // Check to see if database has been created for this item
+            //
+            TBool dbCreated = ETrue;
+            if( aMedia.IsSupported(KMPXMediaColDetailDBCreated))
+                {
+                dbCreated = aMedia.ValueTObjectL<TBool>(KMPXMediaColDetailDBCreated);    
+                MPX_DEBUG2("CMPXController::HandleCollectionMediaL dbcreated %i", dbCreated);
+                }
+            iInitDBNeeded |= !dbCreated;  //lint !e514 
+       
+            // Check to see if database was corrupted for this item
+            //
+            TBool dbCorrupted = EFalse;
+            if( aMedia.IsSupported(KMPXMediaColDetailDBCorrupted))
+                {
+                dbCorrupted = aMedia.ValueTObjectL<TBool>(KMPXMediaColDetailDBCorrupted);
+                }
+            iInitDBCorrupted |= dbCorrupted;
+            }
+        
+        // Update the list box item, iCurPlugin++ because first item is pb state
+        //
+        iCurPlugin++;
+        
+        // Check to see if we need to do initial scan or refresh due to db corruption
+        //    
+        if( iCurPlugin == iCurPath->Count() )
+            {
+            MPX_DEBUG1("CMPXController::HandleCollectionMediaL plugins MediaL loaded");
+            
+            if( (iInitDBNeeded || iInitDBCorrupted) && !iOutOfDisk )
+                {
+                MPX_DEBUG2("CMPXController::HandleCollectionMediaL iUIReady %d", iUIReady );
+                //If UI isn't ready,we should wait until UI is ready.
+                //Otherwise we would likely see greyed out status pane.
+                if( iUIReady )
+                    {
+                    MPX_DEBUG1("CMPXController::HandleCollectionMediaL starting scan");
+                    TWaitNoteType noteType = iInitDBCorrupted ? EMPXCorruptScanningNote :
+                                                                EMPXScanningNote;
+    
+                    StartWaitNoteL( noteType );
+                    iInitDBNeeded = EFalse; 
+                    iInitDBCorrupted = EFalse;
+                    iRefreshingCollection = ETrue;
+                    iDelayedUsbRefresh = EFalse;
+                    }
+                else
+                    {
+                    iDelayedRefreshForUIReady = ETrue;
+                    }
+                }
+            else if( iDelayedUsbRefresh )
+                {
+                DoHandleBroadcastMsgL( EMcMsgUSBMassStorageEnd );
+                }
+            iCurPlugin = KErrNotFound;
+            }  
+        else if( iCurPlugin < iCurPath->Count() )  // Fetch next
+            {
+            // Set which plugin
+            iCurPath->Set(iCurPlugin);
+            
+            MPX_DEBUG1("CMPXController::HandleCollectionMediaL fetch next");
+            
+            // Only fetch next if we haven't been interrupted by another event
+            //
+            if( (iCurSystemEvent == KErrNotFound) && !iOutOfDisk )
+                {
+                // Fetch the extra data
+                RArray<TMPXAttribute> atts;
+                CleanupClosePushL( atts );
+                atts.Append(KMPXMediaColDetailDBCreated);
+                atts.Append(KMPXMediaColDetailDBCorrupted);
+                
+                iCollectionUtility->Collection().MediaL(*iCurPath, atts.Array() );
+                CleanupStack::PopAndDestroy( &atts );    
+                }
+            else
+                {
+                // Reset state machine
+                iCurPlugin = KErrNotFound;
+                }
+            }
+            
+        if ( aError != KErrNone ) //lint !e961      
+            {
+            HandleErrorL( aError );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Wait until the view is ready
+// ---------------------------------------------------------------------------
+//
+void CMPXController::HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId,
+                                           const TVwsViewId& /*aViewIdToBeDeactivated*/)
+    {
+    if( !iUIReady && aNewlyActivatedViewId.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) )
+        {
+        iUIReady = ETrue;
+        
+        if( iDelayedUsbRefresh )
+            {
+            TRAP_IGNORE( DoHandleBroadcastMsgL( EMcMsgUSBMassStorageEnd ) );
+            }
+        else if( iCurSystemEvent == EMcMsgUSBMassStorageStart ||
+                 iCurSystemEvent == EMcMsgUSBMTPStart )
+            {
+            // If the view has not been active, we would likely see 
+            // greyed out note. So we re-start the dlg
+            //
+            TRAP_IGNORE( CloseWaitNoteL() );
+            
+            iRestartWaitDialog = ETrue;
+            if( iIdle->IsActive() )
+                {
+                iIdle->Cancel();
+                }
+            TCallBack cb( &IdleCallback, this );
+            iIdle->Start( cb );
+            }
+        else if( iDelayedRefreshForUIReady )
+            {
+            TRAP_IGNORE( DoRetrieveDetailsL() );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Start a refreshing note
+// ---------------------------------------------------------------------------
+//
+void CMPXController::StartWaitNoteL( TWaitNoteType aNoteType )
+    {
+    CloseWaitNoteL();
+    TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid );
+    TPckg<TWaitNoteType> note = aNoteType;
+    HBufC* arg = MPXUser::AllocL( note );
+    CleanupStack::PushL( arg );
+    iViewUtility->ActivateViewL( waitnoteId, arg );
+    CleanupStack::PopAndDestroy( arg );
+    }
+
+// ---------------------------------------------------------------------------
+// Close waitnote dialog
+// ---------------------------------------------------------------------------
+//
+void CMPXController::CloseWaitNoteL(TBool aSkipCheckIfActive)
+    {
+    TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid );
+    TUid activeView = iViewUtility->ActiveViewType();
+    if(( activeView == waitnoteId ) || (aSkipCheckIfActive))
+        {
+        CMPXViewPlugin* pi = 
+            iViewUtility->ViewPluginManager().PluginL( TUid::Uid(KWaitNoteImpUid) );
+        pi->DeactivateView();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Calls MediaL to retrieve item details
+// ---------------------------------------------------------------------------
+//
+void CMPXController::DoRetrieveDetailsL(TBool aSkipAttribute)
+    {
+    MPX_DEBUG2("CMPXController::DoRetrieveDetailsL %i", iCurPlugin);
+    
+    // Make sure we don't overlap 2 sets of MediaL()
+    //
+    if( iCurPlugin == KErrNotFound && iCurSystemEvent == KErrNotFound )
+        {
+        delete iCurPath;
+        iCurPath = NULL;                
+        
+        // Default path consisting of the music and podcast plugins
+        RArray<TMPXItemId> ids;
+        CleanupClosePushL( ids );
+        
+        // Root level path
+        iCurPath = CMPXCollectionPath::NewL();
+        ids.AppendL( TMPXItemId(iMusicCollectionId.iUid) );
+        if( !iDisablePodcasting )
+            {
+            ids.AppendL( TMPXItemId(iPodcastCollectionId.iUid) );
+            }
+        iCurPath->AppendL( ids.Array() );
+        
+        CleanupStack::PopAndDestroy( &ids );
+
+        if( iCurPath->Levels() == 1 && iCurPath->Count() )
+            {
+            iCurPath->SetToFirst();
+            iCurPlugin = 0;
+            
+            // Do a MediaL to re-retrieve details
+            //
+            RArray<TMPXAttribute> atts;
+            CleanupClosePushL( atts );
+            if(!aSkipAttribute)
+                {
+                atts.Append(KMPXMediaColDetailDBCreated);
+                atts.Append(KMPXMediaColDetailDBCorrupted);
+                }
+
+            iCollectionUtility->Collection().MediaL(*iCurPath, atts.Array() );
+            CleanupStack::PopAndDestroy( &atts );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle collection messages.
+// ---------------------------------------------------------------------------
+//
+void CMPXController::DoHandleCollectionMessageL( 
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXCommandHandler::DoHandleCollectionMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id ) 
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt op( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );    
+        
+        // End of refresh message, update the list box text
+        //
+        if( event == TMPXCollectionMessage::EBroadcastEvent && 
+            op == EMcMsgRefreshEnd )
+            {
+            MPX_DEBUG1("CMPXController::HandleCollectionMessageL - refresh end");
+            iRefreshingCollection = EFalse;
+            iOutOfDisk = data == KErrDiskFull ? ETrue : EFalse; 
+            
+            iCurPlugin = KErrNotFound;
+            iInitDBNeeded = EFalse;
+            iInitDBCorrupted = EFalse;
+            
+            DoRetrieveDetailsL(iOutOfDisk);
+            }
+        else if(event == TMPXCollectionMessage::EBroadcastEvent && 
+                op == EMcMsgRefreshStart)
+            {
+            iRefreshingCollection = ETrue;
+            }
+        // Handle other broadcast messages
+        //
+        else if( event == TMPXCollectionMessage::EBroadcastEvent )
+            {
+            MPX_DEBUG1("CMPXController::HandleCollectionMessageL - broadcast");
+            DoHandleBroadcastMsgL( op );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Any processing to handle broadcast events
+// ---------------------------------------------------------------------------
+//
+void CMPXController::DoHandleBroadcastMsgL( TInt aEvent )
+    {
+    MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg<--");
+    switch( aEvent )
+        {
+        case EMcMsgFormatStart:
+            {
+            MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg - EMcMsgFormatStart");
+            
+            // If we were in MTP sync, we stay in mtp sync mode
+            if( iCurSystemEvent == KErrNotFound )
+                {
+                // Show a formatting wait note
+                iCurSystemEvent = EMcMsgFormatStart;
+                iDiskDismountDuringFormat = EFalse;
+                iPlaybackUtility->CommandL( EPbCmdStop );
+                
+                StartWaitNoteL( EMPXFormatScanningNote );
+                }
+            break;
+            }
+        case EMcMsgFormatEnd:
+            {
+            MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg - EMcMsgFormatEnd");
+            if( iCurSystemEvent == EMcMsgFormatStart )
+                {
+                iCurSystemEvent = KErrNotFound;
+                
+                if( !iDiskDismountDuringFormat )
+                    {
+                    MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg - Sync db after format");
+                    
+                    if( !iRefreshingCollection )
+                        {
+                        StartWaitNoteL( EMPXScanningNote );
+                        iRefreshingCollection = ETrue;  
+                        }
+                    }
+                }
+            break;
+            }    
+        case EMcMsgDiskRemoved:
+            {
+            MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg - EMcMsgDiskRemoved");
+            iPlaybackUtility->CommandL( EPbCmdStop );
+
+            if( iCurSystemEvent == EMcMsgFormatStart )
+                {
+                iDiskDismountDuringFormat = ETrue;
+                }
+            else
+                {
+                // Check the database flags
+                DoRetrieveDetailsL();
+                }
+            break;
+            }
+        case EMcMsgDiskInserted:
+            {
+            MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg - EMcMsgDiskInserted");
+            // Only show the query if we are not processing a usb event
+            // USB dismounts and re-mounts the drive several times
+            //
+            // Ignore the disk insert during format, after format a fake event will be sent.
+            //
+            if( iCurSystemEvent != EMcMsgUSBMassStorageStart &&
+                iCurSystemEvent != EMcMsgUSBMTPStart &&
+                iCurSystemEvent != EMcMsgFormatStart )
+                {
+                if( iQueryDialog )
+                    {
+                    MPX_DEBUG1("Main View -- Dismissing Query");
+                    iQueryDialog->DismissQueryL();
+                    }
+                
+                // Always start a refresh
+                //
+                if( !iRefreshingCollection )
+                    {
+                    StartWaitNoteL( EMPXScanningNote );
+                    iRefreshingCollection = ETrue;  
+                    }
+                }
+            break;
+            }
+        case EMcMsgUSBMassStorageEnd:
+            {
+            MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg - EMcMsgUSBMassStorageEnd");
+            
+            // Show query dialog to ask if they want to refresh
+            //
+            MPX_DEBUG1( "CMPXController::DoHandleBroadcastMsg - EMcMsgUSBMassStorageEnd" );
+
+            if( iUIReady )
+                {
+                CloseWaitNoteL(ETrue);
+                if( iIdle->IsActive() )
+                    {
+                    iIdle->Cancel();
+                    }
+                TCallBack cb( &IdleCallback, this );
+                iIdle->Start( cb );
+                }
+            else
+                {
+                iDelayedUsbRefresh = ETrue;
+                iCurSystemEvent = KErrNotFound;
+                }
+            break;
+            }
+        case EMcMsgUSBMassStorageStart:
+            {
+            MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg - EMcMsgUSBMassStorageStart");
+            
+            // Close playback framework and start wait note
+            if( iQueryDialog )
+                {
+                MPX_DEBUG1("Main View -- Dismissing Query");
+                iQueryDialog->DismissQueryL();
+                }
+            iCurSystemEvent = EMcMsgUSBMassStorageStart;
+            iPlaybackUtility->CommandL( EPbCmdStop );
+            StartWaitNoteL( EMPXUsbEventNote );
+            break;
+            }
+        case EMcMsgUSBMTPStart:
+            {
+            MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg - EMcMsgUSBMTPStart");
+            // Close playback framework and start wait note
+            if( iQueryDialog )
+                {
+                MPX_DEBUG1("Main View -- Dismissing Query");
+                iQueryDialog->DismissQueryL();
+                }
+            iCurSystemEvent = EMcMsgUSBMTPStart;
+            iPlaybackUtility->CommandL( EPbCmdStop );
+            StartWaitNoteL( EMPXMTPEventNote );
+            break;
+            }
+        case EMcMsgUSBMTPEnd:
+            {
+            MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg EMcMsgUSBMTPEnd");
+            iCurSystemEvent = KErrNotFound;
+            CloseWaitNoteL(ETrue);
+            break;
+            }
+        case EMcMsgRefreshEnd: // fall through
+            {
+            MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg - EMcMsgRefreshEnd");
+            iCurSystemEvent = KErrNotFound;
+            break;
+            }
+        case EMcMsgSystemEventMax:  
+        case EMcMsgRefreshStart:    // fall through
+            {
+            MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg - EMcMsgSystemEventMax, EMcMsgRefreshStart");
+            break;        
+            }
+        default: 
+            {
+            break;
+            }
+        }
+    MPX_DEBUG1("CMPXController::DoHandleBroadcastMsg -->");
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CMPXController::HandleErrorL( TInt aError )
+    {
+    if ( aError )
+        {
+        MPX_DEBUG2( "CMPXController::HandleErrorL(%d)", aError );
+        
+        // TextResolver instance for error resolving.
+        CTextResolver* textresolver = CTextResolver::NewLC();
+        // Resolve the error text
+        const TDesC& text =
+            textresolver->ResolveErrorString( aError );
+
+        CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+        dlg->ExecuteLD( text );
+        CleanupStack::PopAndDestroy( textresolver );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle a corrupt message 
+// ---------------------------------------------------------------------------
+//
+void CMPXController::DoHandleCorruptMsgL()
+    {
+    // Start the corrupt note. The corrupt note will delete 
+    // the old databases and restart everything from SCRATCH
+    //
+    MPX_DEBUG1("CMPXController::DoHandleCorruptMsgL <-- starting scan");
+    
+    StartWaitNoteL( EMPXCorruptScanningNote );
+    iInitDBNeeded = EFalse; 
+    iInitDBCorrupted = EFalse;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/src/mpxdocument.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,250 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Document class required by AVKON application framework.
+*
+*/
+
+
+// INCLUDE FILES
+#include <AiwGenericParam.h>
+#include <mpxviewutility.h>
+
+#include "mpxdocument.h"
+#include "mpxappui.h"
+#include "mpxtlshelper.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXDocument::CMPXDocument( CEikApplication& aApp )
+    : CAiwGenericParamConsumer( aApp )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXDocument::ConstructL()
+    {
+    // Initialize TLS
+    MPXTlsHelper::InitializeL();
+
+    // Get view utility. View utility must be created before AppUi.
+    iViewUtility = MMPXViewUtility::UtilityL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXDocument* CMPXDocument::NewL(
+    CEikApplication& aApp )
+    {
+    CMPXDocument* self = new ( ELeave ) CMPXDocument( aApp );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXDocument::~CMPXDocument()
+    {
+    if ( iViewUtility )
+        {
+        iViewUtility->Close();
+        }
+
+    // Release resources in TLS
+    MPXTlsHelper::Uninitialize();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Parse input paramaters from AIW interface.
+// ---------------------------------------------------------------------------
+//
+TBool CMPXDocument::ParseInputParameters()
+    {
+    TBool openFile( ETrue );
+    TPtrC buf;
+    TPtrC name;
+
+    const CAiwGenericParamList* params = GetInputParameters();
+    if ( params )
+        {
+        TInt index( 0 );
+        const TAiwGenericParam* param = params->FindFirst(
+            index,
+            EGenericParamPlayerInitMode,
+            EVariantTypeTInt32 );
+
+        if ( !param )
+            {
+            index = 0;
+            param = params->FindFirst(
+                index,
+                EGenericParamUnspecified,
+                EVariantTypeTInt32 );
+            }
+
+        if ( index >= 0 && param )
+            {
+            TInt32 value( 0 );
+            param->Value().Get( value );
+            TRAP_IGNORE( MPXTlsHelper::SetLaunchModeL(
+                static_cast<TMPXLaunchMode>( value ) ) );
+            }
+
+        // Get album contents, if available
+        index = 0;
+        param = params->FindFirst(
+            index,
+            EGenericParamAlbumItems,
+            EVariantTypeDesC );
+
+        if ( index >= 0 && param )
+            {
+            buf.Set( param->Value().AsDes() );
+            }
+
+        // Get album name, if available
+        index = 0;
+        param = params->FindFirst(
+            index,
+            EGenericParamAlbumName,
+            EVariantTypeDesC );
+
+        if ( index >= 0 && param )
+            {
+            name.Set( param->Value().AsDes() );
+            }
+
+        // Get host application UID
+        index = 0;
+        param = params->FindFirst(
+            index,
+            EGenericParamApplication,
+            EVariantTypeTUid );
+
+        if ( index >= 0 && param )
+            {
+            TUid uid( KNullUid );
+            param->Value().Get( uid );
+            TRAP_IGNORE( MPXTlsHelper::SetHostUidL( uid ) );
+            }
+
+        // Check allow save flag
+        index = 0;
+        param = params->FindFirst(
+            index,
+            EGenericParamAllowSave );
+
+        if ( index >= 0 && param )
+            {
+            TInt32 value( 0 );
+            param->Value().Get( value );
+            MPXTlsHelper::SetNeedSave( value );
+            }
+
+        // Check allow move flag
+        index = 0;
+        param = params->FindFirst(
+            index,
+            EGenericParamAllowMove,
+            EVariantTypeTInt32 );
+
+        if ( index >= 0 && param )
+            {
+            TInt32 value( 0 );
+            param->Value().Get( value );
+            MPXTlsHelper::SetAllowMove( value );
+            }
+        }
+
+    if ( buf.Length() > 0 )
+        {
+        // TODO: Support for album items
+        openFile = EFalse;
+        }
+
+    return openFile;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CEikDocument.
+// Constructs CMPXAppUi
+// ---------------------------------------------------------------------------
+//
+CEikAppUi* CMPXDocument::CreateAppUiL()
+    {
+    return new ( ELeave ) CMPXAppUi;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CAknDocument.
+// Called by the framework to open a file.
+// ---------------------------------------------------------------------------
+//
+CFileStore* CMPXDocument::OpenFileL(
+    TBool aDoOpen,
+    const TDesC& aFilename,
+    RFs& aFs )
+    {
+    if ( aDoOpen )
+        {
+        if ( ParseInputParameters() )
+            {
+            iAppUi->OpenFileL( aFilename );
+            }
+        }
+
+    return CAknDocument::OpenFileL( aDoOpen, aFilename, aFs );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class CAknDocument.
+// Called by the framework to open a file.
+// ---------------------------------------------------------------------------
+//
+void CMPXDocument::OpenFileL(
+    CFileStore*& aFileStore,
+    RFile& aFile )
+    {
+    if ( ParseInputParameters() )
+        {
+        const CAiwGenericParamList* params = GetInputParameters();
+        static_cast<CMPXAppUi*>(iAppUi)->OpenFileL( aFileStore, aFile, params );
+        }
+
+    return CAknDocument::OpenFileL( aFileStore, aFile );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/app/src/mpxrestorepath.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,740 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Saves/restores current playback path
+*
+*/
+
+
+// INCLUDE FILES
+#include <bldvariant.hrh>
+#include <s32file.h>
+
+#include <eikenv.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxplaybackpluginobserver.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessagedefs.h>
+#include <mpxcollectionopenutility.h>
+#include <mpxsubscription.h>
+#include <mpxviewutility.h>
+#include <mpxmusicplayerviewplugin.hrh>
+
+#include "mpxrestorepath.h"
+#include <mpxconstants.h>
+#include "mpxlog.h"
+
+// CONSTANTS
+_LIT( KMPXCollectionPathFileName, "c:\\system\\data\\mpxcollectionpath.dat" );
+const TInt KIncrementalFetchCount = 400;
+const TInt KIncrementalNullOffset = 0;
+const TInt KIncrementalLoadDelay = 1000000; // 1 second in ms
+#define KMPXPdSbPlaybackViewImplementationId    0x10207BD0
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXRestorePath* CMPXRestorePath::NewL(MMPXPlaybackUtility* aPlaybackUtility,
+                                       MMPXCollectionUiHelper* aCollectionUiHelper)
+    {
+    CMPXRestorePath* self = NewLC(aPlaybackUtility, aCollectionUiHelper);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXRestorePath* CMPXRestorePath::NewLC(MMPXPlaybackUtility* aPlaybackUtility,
+                                        MMPXCollectionUiHelper* aCollectionUiHelper )
+    {
+    CMPXRestorePath* self = new (ELeave) CMPXRestorePath(aPlaybackUtility,
+                                                         aCollectionUiHelper);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ----------------------------------------------------------------------------
+//
+CMPXRestorePath::CMPXRestorePath(MMPXPlaybackUtility* aPlaybackUtility,
+                                 MMPXCollectionUiHelper* aCollectionUiHelper ):
+                                             iPlaybackUtility(aPlaybackUtility),
+                                             iCollectionUiHelper( aCollectionUiHelper ),
+                                             iPathInitialized(0),
+                                             iIsInitializing(EFalse),
+                                             iInitCanceled(EFalse),
+                                             iLoadSavedPath(EFalse),
+                                             iRootPathId( KNullUid )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CMPXRestorePath::~CMPXRestorePath()
+    {
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+
+    delete iIncOpenUtil;
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXRestorePath::ConstructL()
+    {
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeIsolated );
+
+#ifdef __USE_MESSAGE_SUBSCRIPTION
+    // Subscribe to only a few messages from collection utility
+    CMPXSubscription* subscription( CMPXSubscription::NewL() );
+    CleanupStack::PushL( subscription );
+    CMPXSubscriptionItem* subItem1( CMPXSubscriptionItem::NewL() );
+    CleanupStack::PushL( subItem1 );
+    subItem1->SetTObjectValueL( KMPXMessageGeneralId, KMPXMessageGeneral );
+    subItem1->SetTObjectValueL( KMPXMessageGeneralEvent, TMPXCollectionMessage::EBroadcastEvent );
+    subscription->AddItemL( *subItem1 );
+    CMPXSubscriptionItem* subItem2( CMPXSubscriptionItem::CopyL( *subItem1 ));
+    CleanupStack::PushL( subItem2 );
+    subItem2->SetTObjectValueL( KMPXMessageGeneralEvent, TMPXCollectionMessage::EPathChanged );
+    subItem2->SetTObjectValueL( KMPXMessageGeneralType, EMcPathChangedByOpen );
+    subItem2->SetTObjectValueL( KMPXMessageGeneralData, EMcItemOpened );
+    subscription->AddItemL( *subItem2 );
+    iCollectionUtility->Collection().AddSubscriptionL( *subscription );
+    CleanupStack::PopAndDestroy( subItem2 );
+    CleanupStack::PopAndDestroy( subItem1 );
+    CleanupStack::PopAndDestroy( subscription );
+#endif
+
+    iIncOpenUtil = CMPXCollectionOpenUtility::NewL( this, KMcModeIsolated );
+    iMTPStarted = EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// Load from file
+// -----------------------------------------------------------------------------
+//
+void CMPXRestorePath::LoadPathL()
+    {
+    MPX_FUNC("CMPXRestorePath::LoadPathL()");
+    if (iIsInitializing) // avoid reenter
+        return;
+    iDefaultPath = EFalse;
+
+    RFs& fs = CEikonEnv::Static()->FsSession();
+    fs.MkDirAll( KMPXCollectionPathFileName );
+    TParse parsedName;
+
+    fs.Parse( KMPXCollectionPathFileName, parsedName );
+    CFileStore* store( NULL );
+    MPX_TRAPD( error, store = CDirectFileStore::OpenL(fs,
+                                                 parsedName.FullName(),
+                                                 EFileRead ); );
+
+    // If we can internalize a collection path from file, we use that to
+    // create a collection playlist. Otherwise, we construct the default
+    // path using the collection helper.
+    //
+    CMPXCollectionPath* cpath( NULL );
+    if ( error == KErrNone )
+        {
+        CleanupStack::PushL( store );
+
+        RStoreReadStream stream;
+        stream.OpenLC( *store, store->Root() );
+
+        // Recreate the collection path that we were browsing
+        cpath = CMPXCollectionPath::NewL(stream);
+        CleanupStack::PushL(cpath);
+        if( cpath->Levels() )
+            {
+            iRootPathId = TUid::Uid( cpath->Id( 0 ) );
+            }
+        TInt selection = stream.ReadInt32L();
+
+        // bounds checking
+        if( selection >=0 && selection < cpath->Count() )
+            {
+            cpath->Set( selection );
+
+            // Find out what we were selecting
+            iSelectionId = cpath->Id();
+            iSelectionIndex = cpath->Index();
+
+            MPX_DEBUG1("CMPXRestorePath::LoadPathL -- Opening Path in collection");
+
+            // Rebrowse collection path of the container
+            // We re-select the item when the container is opened and
+            // in turn open the song
+            //
+            if( cpath->Levels() )
+                {
+                cpath->Back();
+                }
+            DoIncrementalOpenL( *cpath, iSelectionIndex, KIncrementalLoadDelay );
+            }
+        else
+            {
+            // Bad collection path, restore to default
+            MPX_DEBUG1("CMPXRestorePath::LoadPathL -- bad collection path found");
+            LoadDefaultPathL( KIncrementalLoadDelay );
+            }
+
+        CleanupStack::PopAndDestroy( cpath);
+        CleanupStack::PopAndDestroy(&stream);
+
+        CleanupStack::PopAndDestroy(store);
+        }
+    else
+        {
+        delete store;
+        cpath = iCollectionUiHelper->CreateDefaultPlaylistPathLC();
+
+        iDefaultPath = ETrue;
+        iSelectionId = KMPXInvalidItemId;
+        iSelectionIndex = 0;
+
+        DoIncrementalOpenL( *cpath, iSelectionIndex, KIncrementalLoadDelay );
+        CleanupStack::PopAndDestroy( cpath );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Create the default path and load it in collection
+// ---------------------------------------------------------------------------
+//
+void CMPXRestorePath::LoadDefaultPathL( TInt aDelay )
+    {
+    MPX_DEBUG1("CMPXRestorePath::LoadDefaultPathL");
+    CMPXCollectionPath* cpath = iCollectionUiHelper->CreateDefaultPlaylistPathLC();
+
+    if (!iIsInitializing)
+        {
+        // Get incremental utility to open the path
+        //
+        DoIncrementalOpenL( *cpath, KIncrementalNullOffset, aDelay );
+
+        iPathInitialized = EFalse;
+        iIsInitializing = ETrue;
+        iInitCanceled = EFalse;
+        iDefaultPath = ETrue;
+        iSelectionId = KMPXInvalidItemId;
+        }
+    CleanupStack::PopAndDestroy( cpath );
+    }
+
+// ---------------------------------------------------------------------------
+// Save the currently playing playlist path
+// ---------------------------------------------------------------------------
+//
+void CMPXRestorePath::SavePathL()
+    {
+    RFs& fs = CEikonEnv::Static()->FsSession();
+    fs.MkDirAll( KMPXCollectionPathFileName );
+    TParse parsedName;
+
+    fs.Parse( KMPXCollectionPathFileName, parsedName );
+    CFileStore* store( NULL );
+    MPX_TRAPD( error, store = CDirectFileStore::ReplaceL(fs,
+                                                 parsedName.FullName(),
+                                                 EFileWrite ); );
+
+    if( error == KErrNone )
+        {
+        CleanupStack::PushL( store );
+        store->SetTypeL(store->Layout());
+
+        RStoreWriteStream wStream;
+        TStreamId stream = wStream.CreateLC( *store );
+        store->SetRootL( stream );
+
+        MMPXSource* source = iPlaybackUtility->Source();
+        CMPXCollectionPlaylist* pl( NULL );
+        TInt levels(0);
+
+        // Make sure we have a source, a playlist, and a valid path
+        // Playback engine path could be invalid (0 levels) but have
+        // a source and playlist if the currently playing playlist
+        // is deleted.
+        //
+        if( source )
+            {
+            pl = source->PlaylistL();
+            if (pl)
+                {
+                CleanupStack::PushL( pl );
+                const CMPXCollectionPath& path = pl->Path();
+                levels = path.Levels();
+                if( levels > 0 )
+                    {
+                    wStream << path;
+                    wStream.WriteInt32L( path.Index( path.Levels() - 1 ) );
+                    wStream.CommitL();
+                    }
+                CleanupStack::PopAndDestroy( pl );
+                }
+            }
+
+        CleanupStack::PopAndDestroy( &wStream );
+        CleanupStack::PopAndDestroy( store );
+
+        // Delete if source was invalid. Have to do it here
+        // because store owned a file handle to the file
+        //
+        if( !source || !pl || !levels )
+            {
+            fs.Delete( KMPXCollectionPathFileName );
+            }
+        }
+    else
+        {
+        // File cannot be opened, so try to delete it so that when
+        // music player tries to load the path next time it'll use
+        // the default path
+        //
+        fs.Delete( KMPXCollectionPathFileName );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Check the initialized flag
+// ---------------------------------------------------------------------------
+//
+TBool CMPXRestorePath::Initialized()
+    {
+    return iPathInitialized;
+    }
+
+// ---------------------------------------------------------------------------
+// Check the iIsInitializing flag
+// ---------------------------------------------------------------------------
+//
+TBool CMPXRestorePath::IsInitializing()
+    {
+    return iIsInitializing;
+    }
+
+// ---------------------------------------------------------------------------
+// Set the initialized flag
+// ---------------------------------------------------------------------------
+//
+void CMPXRestorePath::SetInitialized( TBool aInit )
+    {
+    iPathInitialized = aInit;
+    iIsInitializing = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels the initialize operation
+// ---------------------------------------------------------------------------
+//
+void CMPXRestorePath::CancelInit()
+    {
+    iInitCanceled = ETrue;
+    SetInitialized( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handle media properties.
+// ---------------------------------------------------------------------------
+//
+void CMPXRestorePath::HandleCollectionMediaL(
+    const CMPXMedia& /*aMedia*/,
+    TInt /*aError*/ )
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handle collection message.
+// ---------------------------------------------------------------------------
+//
+void CMPXRestorePath::HandleCollectionMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handles the collection entries being opened.
+// ---------------------------------------------------------------------------
+//
+void CMPXRestorePath::HandleOpenL(
+    const CMPXMedia& /* aEntries */,
+    TInt /* aIndex */,
+    TBool /* aComplete */,
+    TInt aError )
+    {
+    // OpenL() callback from trying to open the default Music Menu -> All Songs
+    // or from opening a container
+    //
+    MPX_DEBUG1("CMPXRestorePath::HandleOpenL -- Passing path to playback engine");
+
+    // Stop the incremental open algorithm. We are only interested in fetcing
+    // a single block containing the item we want to play. This will speed up the
+    // initalization procedure. Once the playlist is created, the playlist
+    // takes over the rest of the incremental open operation
+    //
+    iIncOpenUtil->Stop();
+    if ( aError == KErrNone )
+        {
+
+        CMPXCollectionPath* cPath = iIncOpenUtil->PathL();
+        CleanupStack::PushL( cPath );
+
+        if( iSelectionId != KMPXInvalidItemId )
+            {
+            // Find the Index first
+            TInt index = cPath->IndexOfId( iSelectionId );
+
+            // If the item still exists in the path, we open it to init playback
+            if( index != KErrNotFound )
+                {
+                cPath->Set( index );
+                iCollectionUtility->Collection().OpenL( *cPath );
+                }
+            else
+                {
+                LoadDefaultPathL();
+                }
+            iSelectionId = KMPXInvalidItemId;
+            }
+        else  // Opening the default path
+            {
+            InitPlaybackEngineL( *cPath );
+            }
+        CleanupStack::PopAndDestroy( cPath );
+        }
+    else
+        {
+        if( iDefaultPath )
+            {
+            MPX_DEBUG1("CMPXRestorePath::HandleOpenL - Failed to open default path");
+            // Failed to open default path, set to initialized
+            // "No songs view"
+            //
+            iDefaultPath = EFalse;
+            iPathInitialized = ETrue;
+            iIsInitializing = EFalse;
+            }
+        else
+            {
+            MPX_DEBUG1("CMPXRestorePath::HandleOpenL - Opening default Path");
+            iIsInitializing = EFalse;
+            // Try opening default
+            LoadDefaultPathL();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXRestorePath::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handles the item being opened.
+// ---------------------------------------------------------------------------
+//
+void CMPXRestorePath::HandleOpenL(
+    const CMPXCollectionPlaylist& aPlaylist,
+    TInt aError )
+    {
+    MPX_FUNC("CMPXRestorePath::HandleOpenL");
+    if( aError == KErrNone )
+        {
+        if ( !iInitCanceled )
+            {
+            MPX_DEBUG1( "CMPXRestorePath::HandleOpenL - Opening playlist" );
+
+            // toggle repeat and shuffle to off if podcast playlist
+            if(KMPXUidPodcastDBPlugin == TUid::Uid((TInt)aPlaylist.Path().Id(0)))
+                {
+                CMPXCollectionPlaylist* tmp =
+                                CMPXCollectionPlaylist::NewL( aPlaylist );
+                CleanupStack::PushL( tmp );
+                tmp->SetRepeatEnabled( EFalse );
+                tmp->SetShuffleEnabledL( EFalse );
+                iPlaybackUtility->InitL( *tmp, EFalse );
+                CleanupStack::PopAndDestroy( tmp );
+                }
+            else
+                {
+                iPlaybackUtility->InitL( aPlaylist, EFalse );
+                }
+            }
+        else
+            {
+            MPX_DEBUG1( "CMPXRestorePath::HandleOpenL - Init canceled, do nothing" );
+            }
+        }
+    else
+        {
+        if( iDefaultPath )
+            {
+            // Failed to open default path, set to initialized
+            // "No songs view"
+            //
+            iDefaultPath = EFalse;
+            iPathInitialized = ETrue;
+            iIsInitializing = EFalse;
+            }
+        else
+            {
+            // Try opening default
+            LoadDefaultPathL();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Initialize the playback engine with a collection path
+// ---------------------------------------------------------------------------
+//
+void CMPXRestorePath::InitPlaybackEngineL( CMPXCollectionPath& aPath )
+    {
+    MPX_FUNC( "CMPXRestorePath::InitPlaybackEngineL" );
+    // Do not load a playlist if USB started, this
+    // could happen if the user switches mode from MTP to USB
+    // which would lose the playback playlist
+    //
+    if( !iUSBOngoing && !iInitCanceled )
+        {
+        CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL( aPath );
+        CleanupStack::PushL( playlist );
+        iPlaybackUtility->InitL( *playlist, EFalse );
+        CleanupStack::PopAndDestroy( playlist );
+        }
+    else
+        {
+        iIsInitializing = EFalse;
+        iPathInitialized = ETrue;
+        iInitCanceled = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle playback message
+// -----------------------------------------------------------------------------
+//
+void CMPXRestorePath::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXRestorePath::DoHandlePlaybackMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        MPX_DEBUG2( "CMPXRestorePath::DoHandlePlaybackMessageL(%d)", event );
+
+        switch ( event )
+            {
+            default:
+                {
+                // ignore other messages
+                break;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle collection message
+// -----------------------------------------------------------------------------
+//
+void CMPXRestorePath::DoHandleCollectionMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXRestorePath::DoHandleCollectionMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        MPX_DEBUG3( "CMPXRestorePath::DoHandleCollectionMessageL Event = %d, Type() = %d",
+            event, type );
+
+        // When OpenL( *path ) is done we get a path changed msg
+        //
+        if ( event == TMPXCollectionMessage::EPathChanged &&
+            type == EMcPathChangedByOpen &&
+            data == EMcItemOpened )
+            {
+            MPX_DEBUG1("CMPXRestorePath::DoHandleCollectionMessageL -- opening new path");
+            iCollectionUtility->Collection().OpenL();
+            }
+        else if( event == TMPXCollectionMessage::EBroadcastEvent )
+            {
+            // Restore default path after refresh or end of mtp
+            //
+            if( type == EMcMsgRefreshEnd )
+                {
+                MPX_DEBUG1( "CMPXRestorePath::DoHandleCollectionMessageL -- Refresh End" );
+                if( iLoadSavedPath )
+                    {
+                    MPX_DEBUG1("  ---> Loading a saved path");
+                    LoadPathL();
+                    }
+                else
+                    {
+                    MPX_DEBUG1("  ---> Loading a default path");
+                    LoadDefaultPathL();
+                    }
+                iLoadSavedPath = EFalse;
+                }
+            else if ( type == EMcMsgUSBMTPEnd )
+            	{
+                if ( iMTPStarted )
+                    {
+                    MPX_DEBUG1( "CMPXRestorePath::DoHandleCollectionMessageL -- MTP End" );
+                    if( iLoadSavedPath )
+                        {
+                        MPX_DEBUG1("  ---> Loading a saved path");
+                        LoadPathL();
+                        }
+                    else
+                        {
+                        MPX_DEBUG1("  ---> Loading a default path");
+                        LoadDefaultPathL();
+                        }
+                    iLoadSavedPath = EFalse;   
+                    iMTPStarted = EFalse;
+                    }
+            	}
+            // Disk inserted, we try to keep playback playlist at the
+            // currently selected song after the automatic refresh
+            //
+            // USB mass storage dismounts the disk, but in that case
+            // we do want to revert back to first song of all songs
+            //
+            else if( type == EMcMsgDiskInserted &&
+                     !iUSBOngoing )
+                {
+                SavePathL();
+                iLoadSavedPath = ETrue;
+                }
+            else if( type == EMcMsgUSBMassStorageStart )
+                {
+                iUSBOngoing = ETrue;
+                }
+            else if( type == EMcMsgUSBMassStorageEnd )
+                {
+                iUSBOngoing = EFalse;
+                }
+            else if( type == EMcMsgDiskRemoved
+                     && !iUSBOngoing )
+                {
+                MPX_DEBUG1("  ---> Save the current path and restore it");
+                SavePathL();
+                LoadPathL();
+                }
+            else if( type == EMcMsgFormatEnd )
+                {
+                MPX_DEBUG1(" --> Loading a default path after formatting ");
+                LoadDefaultPathL();
+                }
+            else if ( type == EMcMsgUSBMTPStart )
+                {
+                iMTPStarted = ETrue;
+                }
+            }
+        else if ( event == TMPXCollectionMessage::ECollectionChanged && !iInitCanceled )
+            {
+            //To Handle the case when path is restored and we are in playback view.
+            //This will switch to the right playback view to prevent podcast playback on music playback view.
+            MMPXViewUtility* viewUtility = MMPXViewUtility::UtilityL();
+            if (viewUtility->ActiveViewType() == TUid::Uid( KMPXPluginTypePlaybackUid ) && 
+                    viewUtility->ActiveViewImplementationUid() != TUid::Uid(KMPXPdSbPlaybackViewImplementationId))
+                {
+                MMPXPlayer* player = iPlaybackUtility->PlayerManager().CurrentPlayer();
+                if ( player )
+                    {
+                    RArray<TUid> array;
+                    CleanupClosePushL( array );
+                    array.AppendL( player->UidL() );
+                    array.AppendL(TUid::Uid(data));
+                    viewUtility->ActivateViewL( array );
+                    CleanupStack::PopAndDestroy( &array );
+                    }
+                }
+            viewUtility->Close();
+            }
+        else
+            {
+            // Ignore all other messages
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Start the incremental reading operation at an offset
+// -----------------------------------------------------------------------------
+//
+void CMPXRestorePath::DoIncrementalOpenL( CMPXCollectionPath& aPath,
+                                          TInt aIndex,
+                                          TInt aDelay )
+    {
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    TArray<TMPXAttribute> ary = attrs.Array();
+    iIncOpenUtil->Stop();
+    iIncOpenUtil->SetDelay( aDelay );
+    iIncOpenUtil->StartL( aPath, ary, KIncrementalFetchCount,
+                          aIndex, CMPXCollectionOpenUtility::EFetchNormal );
+    CleanupStack::PopAndDestroy( &attrs );
+    }
+
+// -----------------------------------------------------------------------------
+// Get the Uid of the root path 
+// -----------------------------------------------------------------------------
+//
+TUid CMPXRestorePath::RooPathId()
+    {
+    return iRootPathId;
+    }
+// End of File
Binary file mpxmusicplayer/cenrep/101f880d.txt has changed
Binary file mpxmusicplayer/cenrep/101ffcd0.txt has changed
Binary file mpxmusicplayer/cenrep/101ffcd1.txt has changed
Binary file mpxmusicplayer/cenrep/101ffcdc.txt has changed
Binary file mpxmusicplayer/cenrep/keys_mpxmusicplayer.xls has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/bwinscw/mpxcommonuiU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,60 @@
+EXPORTS
+	??1CMPXAlbumArtUtil@@UAE@XZ @ 1 NONAME ; CMPXAlbumArtUtil::~CMPXAlbumArtUtil(void)
+	??1CMPXLbxExtendedFeatures@@UAE@XZ @ 2 NONAME ; CMPXLbxExtendedFeatures::~CMPXLbxExtendedFeatures(void)
+	??1CMPXSaveHelper@@UAE@XZ @ 3 NONAME ; CMPXSaveHelper::~CMPXSaveHelper(void)
+	?AddToSavedPlaylistL@CMPXCommonUiHelper@@QAEHABVCMPXMedia@@0PAVMMPXCHelperObserver@@PAVMProgressDialogCallback@@@Z @ 4 NONAME ; int CMPXCommonUiHelper::AddToSavedPlaylistL(class CMPXMedia const &, class CMPXMedia const &, class MMPXCHelperObserver *, class MProgressDialogCallback *)
+	?AllowMove@MPXTlsHelper@@SAHXZ @ 5 NONAME ; int MPXTlsHelper::AllowMove(void)
+	?AvailableDriveLC@CMPXCommonUiHelper@@QAEPAVHBufC16@@H@Z @ 6 NONAME ; class HBufC16 * CMPXCommonUiHelper::AvailableDriveLC(int)
+	?CancelRequest@CMPXAlbumArtUtil@@QAEXXZ @ 7 NONAME ; void CMPXAlbumArtUtil::CancelRequest(void)
+	?CreatePlaylistL@CMPXCommonUiHelper@@QAEHABVCMPXMedia@@PAVMMPXCHelperObserver@@PAVMProgressDialogCallback@@@Z @ 8 NONAME ; int CMPXCommonUiHelper::CreatePlaylistL(class CMPXMedia const &, class MMPXCHelperObserver *, class MProgressDialogCallback *)
+	?DefaultDriveLC@CMPXCommonUiHelper@@QAEPAVHBufC16@@XZ @ 9 NONAME ; class HBufC16 * CMPXCommonUiHelper::DefaultDriveLC(void)
+	?DismissWaitNoteL@CMPXCommonUiHelper@@QAEXXZ @ 10 NONAME ; void CMPXCommonUiHelper::DismissWaitNoteL(void)
+	?DisplayConfirmNoteL@CMPXCommonUiHelper@@QAEXABVTDesC16@@@Z @ 11 NONAME ; void CMPXCommonUiHelper::DisplayConfirmNoteL(class TDesC16 const &)
+	?DisplayConfirmNoteL@CMPXCommonUiHelper@@QAEXH@Z @ 12 NONAME ; void CMPXCommonUiHelper::DisplayConfirmNoteL(int)
+	?DisplayInfoNoteL@CMPXCommonUiHelper@@QAEXABVTDesC16@@@Z @ 13 NONAME ; void CMPXCommonUiHelper::DisplayInfoNoteL(class TDesC16 const &)
+	?DisplayInfoNoteL@CMPXCommonUiHelper@@QAEXH@Z @ 14 NONAME ; void CMPXCommonUiHelper::DisplayInfoNoteL(int)
+	?DisplayableDurationInTextL@CMPXCommonUiHelper@@QAEPAVHBufC16@@_J@Z @ 15 NONAME ; class HBufC16 * CMPXCommonUiHelper::DisplayableDurationInTextL(long long)
+	?DisplayableDurationL@CMPXCommonUiHelper@@QAEPAVHBufC16@@_JW4TMPXDuratDisplayMode@1@@Z @ 16 NONAME ; class HBufC16 * CMPXCommonUiHelper::DisplayableDurationL(long long, enum CMPXCommonUiHelper::TMPXDuratDisplayMode)
+	?DoSetAsRingingToneL@CMPXCommonUiHelper@@QAEXABVCMPXMedia@@HH@Z @ 17 NONAME ; void CMPXCommonUiHelper::DoSetAsRingingToneL(class CMPXMedia const &, int, int)
+	?EnableSpeedScrollL@CMPXLbxExtendedFeatures@@QAEXH@Z @ 18 NONAME ; void CMPXLbxExtendedFeatures::EnableSpeedScrollL(int)
+	?ExitOptionHiddenL@CMPXCommonUiHelper@@QAEHXZ @ 19 NONAME ; int CMPXCommonUiHelper::ExitOptionHiddenL(void)
+	?ExtractAlbumArtL@CMPXAlbumArtUtil@@QAEXABVCMPXMedia@@AAVMMPXAlbumArtUtilObserver@@ABVTSize@@W4TDisplayMode@@@Z @ 20 NONAME ; void CMPXAlbumArtUtil::ExtractAlbumArtL(class CMPXMedia const &, class MMPXAlbumArtUtilObserver &, class TSize const &, enum TDisplayMode)
+	?FilePath@MPXTlsHelper@@SA?AV?$TBuf@$0BAA@@@XZ @ 21 NONAME ; class TBuf<256> MPXTlsHelper::FilePath(void)
+	?FindPlaylistsL@CMPXCommonUiHelper@@QAEPAVCMPXMedia@@XZ @ 22 NONAME ; class CMPXMedia * CMPXCommonUiHelper::FindPlaylistsL(void)
+	?GenerateTitleL@CMPXCommonUiHelper@@QAEPAVHBufC16@@W4TMPXGeneralCategory@@ABVTDesC16@@@Z @ 23 NONAME ; class HBufC16 * CMPXCommonUiHelper::GenerateTitleL(enum TMPXGeneralCategory, class TDesC16 const &)
+	?HandleErrorL@CMPXCommonUiHelper@@QAEHHPBVCMPXMedia@@PAVRFile@@@Z @ 24 NONAME ; int CMPXCommonUiHelper::HandleErrorL(int, class CMPXMedia const *, class RFile *)
+	?HandleLbxKeyEventL@CMPXLbxExtendedFeatures@@QAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 25 NONAME ; enum TKeyResponse CMPXLbxExtendedFeatures::HandleLbxKeyEventL(struct TKeyEvent const &, enum TEventCode)
+	?HostUid@MPXTlsHelper@@SA?AVTUid@@XZ @ 26 NONAME ; class TUid MPXTlsHelper::HostUid(void)
+	?InitializeL@MPXTlsHelper@@SAXXZ @ 27 NONAME ; void MPXTlsHelper::InitializeL(void)
+	?IsForegroundApplication@CMPXCommonUiHelper@@QAEHH@Z @ 28 NONAME ; int CMPXCommonUiHelper::IsForegroundApplication(int)
+	?IsHostBrowserL@CMPXCommonUiHelper@@QAEHXZ @ 29 NONAME ; int CMPXCommonUiHelper::IsHostBrowserL(void)
+	?IsHostMessagingBrowserL@CMPXCommonUiHelper@@QAEHXZ @ 30 NONAME ; int CMPXCommonUiHelper::IsHostMessagingBrowserL(void)
+	?IsHostMessagingL@CMPXCommonUiHelper@@QAEHXZ @ 31 NONAME ; int CMPXCommonUiHelper::IsHostMessagingL(void)
+	?IsHostPodcastingAppL@CMPXCommonUiHelper@@QAEHXZ @ 32 NONAME ; int CMPXCommonUiHelper::IsHostPodcastingAppL(void)
+	?IsProfileOfflineModeL@CMPXCommonUiHelper@@QAEHXZ @ 33 NONAME ; int CMPXCommonUiHelper::IsProfileOfflineModeL(void)
+	?LaunchMode@MPXTlsHelper@@SA?AW4TMPXLaunchMode@@XZ @ 34 NONAME ; enum TMPXLaunchMode MPXTlsHelper::LaunchMode(void)
+	?LaunchRenameDialogL@CMPXCommonUiHelper@@QAEHABVTDesC16@@AAVTDes16@@0@Z @ 35 NONAME ; int CMPXCommonUiHelper::LaunchRenameDialogL(class TDesC16 const &, class TDes16 &, class TDesC16 const &)
+	?MMCDriveNumber@CMPXCommonUiHelper@@SAHXZ @ 36 NONAME ; int CMPXCommonUiHelper::MMCDriveNumber(void)
+	?NeedSave@MPXTlsHelper@@SAHXZ @ 37 NONAME ; int MPXTlsHelper::NeedSave(void)
+	?NewL@CMPXAlbumArtUtil@@SAPAV1@XZ @ 38 NONAME ; class CMPXAlbumArtUtil * CMPXAlbumArtUtil::NewL(void)
+	?NewL@CMPXCommonUiHelper@@SAPAV1@PAVMMPXCollectionUtility@@@Z @ 39 NONAME ; class CMPXCommonUiHelper * CMPXCommonUiHelper::NewL(class MMPXCollectionUtility *)
+	?NewL@CMPXLbxExtendedFeatures@@SAPAV1@PAVCEikTextListBox@@H@Z @ 40 NONAME ; class CMPXLbxExtendedFeatures * CMPXLbxExtendedFeatures::NewL(class CEikTextListBox *, int)
+	?NewL@CMPXSaveHelper@@SAPAV1@PAVMMPXSaveHelperObserver@@PAVMFileManObserver@@@Z @ 41 NONAME ; class CMPXSaveHelper * CMPXSaveHelper::NewL(class MMPXSaveHelperObserver *, class MFileManObserver *)
+	?RemoveMiddleSoftKeyLabel@CMPXCommonUiHelper@@QAEXAAVCEikButtonGroupContainer@@@Z @ 42 NONAME ; void CMPXCommonUiHelper::RemoveMiddleSoftKeyLabel(class CEikButtonGroupContainer &)
+	?SetAllowMove@MPXTlsHelper@@SAXH@Z @ 43 NONAME ; void MPXTlsHelper::SetAllowMove(int)
+	?SetFilePath@MPXTlsHelper@@SAXABVTDesC16@@@Z @ 44 NONAME ; void MPXTlsHelper::SetFilePath(class TDesC16 const &)
+	?SetHostUidL@MPXTlsHelper@@SAXABVTUid@@@Z @ 45 NONAME ; void MPXTlsHelper::SetHostUidL(class TUid const &)
+	?SetLaunchModeL@MPXTlsHelper@@SAXW4TMPXLaunchMode@@@Z @ 46 NONAME ; void MPXTlsHelper::SetLaunchModeL(enum TMPXLaunchMode)
+	?SetMiddleSoftKeyIconL@CMPXCommonUiHelper@@QAEXAAVCEikButtonGroupContainer@@PAVCFbsBitmap@@1@Z @ 47 NONAME ; void CMPXCommonUiHelper::SetMiddleSoftKeyIconL(class CEikButtonGroupContainer &, class CFbsBitmap *, class CFbsBitmap *)
+	?SetMiddleSoftKeyLabelL@CMPXCommonUiHelper@@QAEXAAVCEikButtonGroupContainer@@HH@Z @ 48 NONAME ; void CMPXCommonUiHelper::SetMiddleSoftKeyLabelL(class CEikButtonGroupContainer &, int, int)
+	?SetNeedSave@MPXTlsHelper@@SAXH@Z @ 49 NONAME ; void MPXTlsHelper::SetNeedSave(int)
+	?SetStandAloneModePId@CMPXCommonUiHelper@@SAH_J@Z @ 50 NONAME ; int CMPXCommonUiHelper::SetStandAloneModePId(long long)
+	?ShowWaitNoteL@CMPXCommonUiHelper@@QAEXAAVTDesC16@@HHPAVMProgressDialogCallback@@H@Z @ 51 NONAME ; void CMPXCommonUiHelper::ShowWaitNoteL(class TDesC16 &, int, int, class MProgressDialogCallback *, int)
+	?SpeedNaviUpdating@CMPXLbxExtendedFeatures@@QAEXH@Z @ 52 NONAME ; void CMPXLbxExtendedFeatures::SpeedNaviUpdating(int)
+	?StandAloneModePId@CMPXCommonUiHelper@@SA_JXZ @ 53 NONAME ; long long CMPXCommonUiHelper::StandAloneModePId(void)
+	?StartCopyOperationL@CMPXSaveHelper@@QAEXAAVRFile@@ABVTDesC16@@HH@Z @ 54 NONAME ; void CMPXSaveHelper::StartCopyOperationL(class RFile &, class TDesC16 const &, int, int)
+	?StartCopyOperationL@CMPXSaveHelper@@QAEXABVTDesC16@@0H@Z @ 55 NONAME ; void CMPXSaveHelper::StartCopyOperationL(class TDesC16 const &, class TDesC16 const &, int)
+	?Uninitialize@MPXTlsHelper@@SAXXZ @ 56 NONAME ; void MPXTlsHelper::Uninitialize(void)
+	?UnitConversionL@CMPXCommonUiHelper@@QAEPAVHBufC16@@_JH@Z @ 57 NONAME ; class HBufC16 * CMPXCommonUiHelper::UnitConversionL(long long, int)
+	?CancelCollectionOperation@CMPXCommonUiHelper@@QAEXXZ @ 58 NONAME ; void CMPXCommonUiHelper::CancelCollectionOperation(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/data/mpxcommonui.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,758 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxcommonui
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MXCU // 4 letter ID
+
+// INCLUDES
+#include <e32keys.h>
+#include <pathconfiguration.hrh>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <CommonDialogs.hrh> 
+#include <CommonDialogs.rh> 
+#include "mpxcommonui.hrh"
+#include <mpxcommonui.loc>
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// -----------------------------------------------------------------------------
+// r_mpx_time_durat_hhhmmss_with_zero
+// 103:55:23, 003:15:12 (hours, minutes and seconds) 
+// (separators are locale dependent)
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_time_durat_hhhmmss_with_zero
+    {
+    buf = "%:0%N%:1%T%:2%S%:3";
+    }
+
+
+// ** Set as ringing tone **
+
+// -----------------------------------------------------------------------------
+// r_mpx_change_rt_for_all_confirmation_query
+// Confirmation query for set as ringtone for all profiles.
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_change_rt_for_all_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationLayout;
+                label = qtn_mg_query_rtone_change_for_all;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_ringtone_set_text
+// Note text when ringtone is set.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_ringtone_set_text
+    {
+    buf = qtn_nmp_note_ringtone_set;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_ringtone_not_allowed_text
+// Note text when set as ringtone is not allowed.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_ringtone_not_allowed_text
+    {
+    buf = text_not_allowed;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_ringtone_unprotected_file_text
+// Note text when the unprotected file can't be set as ringtone.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_ringtone_unprotected_file_text
+    {
+    buf = qtn_profiles_info_tone_no_drm;
+    }
+
+
+// ** Error Strings **
+
+// -----------------------------------------------------------------------------
+// r_mpx_file_not_found_text
+// Note text when attempting to perform an operation on broken file.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_file_not_found_text
+   {
+   buf = qtn_mp_note_broken_file;
+   } 
+
+// -----------------------------------------------------------------------------
+// r_mpx_invalid_group_text
+// Text for an information note shown when user attempts to play a playlist
+// or a category of songs, and all of the tracks are missing or unplayable.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_invalid_group_text
+   {
+   buf = qtn_nmp_note_invalid_list;
+   } 
+
+// -----------------------------------------------------------------------------
+// r_mpx_invalid_clip
+// Notification that a file is corrupted
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_invalid_clip
+    {
+    buf = qtn_mp_note_corrupt_file;
+    }
+
+
+// *** Unit conversion ***
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_memory_b
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_memory_b
+    {
+    buf = qtn_mus_memory_b;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_memory_b_free
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_memory_b_free
+    {
+    buf = qtn_mus_memory_b_free;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_memory_gb
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_memory_gb
+    {
+    buf = qtn_mus_memory_gb;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_memory_gb1_free
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_memory_gb1_free
+    {
+    buf = qtn_mus_memory_gb1_free;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_memory_mb
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_memory_mb
+    {
+    buf = qtn_nmp_memory_mb;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_memory_mb1_free
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_memory_mb1_free
+    {
+    buf = qtn_mus_memory_mb1_free;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_memory_kb
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_memory_kb
+    {
+    buf = qtn_nmp_memory_kb;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_memory_kb1_free
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_memory_kb1_free
+    {
+    buf = qtn_mus_memory_kb1_free;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_phone_memory_root_path
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_phone_memory_root_path
+    {
+    buf = text_phone_memory_root_path;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_memory_card_root_path
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_memory_card_root_path
+    {
+    buf = text_memory_card_root_path;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_memlo_not_enough_memory
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_memlo_not_enough_memory
+    {
+    buf = qtn_memlo_not_enough_memory;
+    }
+
+// ** Speed scrolling **
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_up_down_keys_silent
+// Keysound behaviour when end of list is reached.
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SKEY_LIST r_mpx_cui_up_down_keys_silent
+    {
+    list=
+        {
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyUpArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeLong;
+            },
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyUpArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeRepeat;
+            },
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyDownArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeLong;
+            },
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyDownArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeRepeat;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_scroll_speed_fast
+// Text format used for displaying scrolling speed
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_scroll_speed_fast
+    {
+    buf = qtn_nmp_navi_speed_fast;
+    }
+
+// *** Playlist ***
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_playlist_query_list
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LIST_QUERY r_mpx_cui_playlist_query_list
+    {
+    flags = EGeneralQueryFlags;
+    softkeys = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        AVKON_LIST_QUERY_DLG_LINE
+            {
+            control = AVKON_LIST_QUERY_CONTROL
+                {
+                listtype = EAknCtSinglePopupMenuListBox;
+                heading = qtn_mus_title_select_pl;
+                listbox = AVKON_LIST_QUERY_LIST
+                    {
+                    };
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_generic_wait_note
+// Generic wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_generic_wait_note
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = 0x1000;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_waitnote_softkeys_empty_stop
+// Softkeys used by generic wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_waitnote_softkeys_empty_stop
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;
+            txt = text_softkey_stop;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_playlist_memory_selection_locations
+// -----------------------------------------------------------------------------
+// 
+RESOURCE MEMORYSELECTIONDIALOG r_mpx_playlist_memory_selection_locations
+    {
+    title = qtn_mp_save_to_query;
+    softkey_1 = text_softkey_ok;
+    softkey_2 = text_softkey_cancel;
+    locations =
+        {
+        LOCATION
+            {
+            root_path = text_phone_memory_root_path;
+            },
+        LOCATION
+            {
+            root_path = text_memory_card_root_path;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_targetfolder_playlist
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_targetfolder_playlist
+    {
+    buf = text_targetfolder_playlists;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_playlist_name_query_title
+// -----------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_playlist_name_query_title
+    {
+    buf = qtn_mus_enter_pl_name;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_default_playlist_name
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_default_playlist_name
+    {
+    buf = qtn_mg_def_name_playlist;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_note_adding_one_song
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_nmp_note_adding_one_song
+    {
+    buf = qtn_nmp_note_adding_one_song;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_mus_note_adding_tracks
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_mus_note_adding_tracks
+    {
+    buf = qtn_mus_note_adding_tracks;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_multiple_tracks_added_to_pl
+// Confirmation text for adding tracks to playlist (plural).
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mus_multiple_tracks_added_to_pl
+    {
+    buf = qtn_mus_multiple_tracks_added_to_pl;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_note_track_added_to_pl
+// Confirmation text for adding track to playlist (singular).
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mus_note_track_added_to_pl
+    {
+    buf = qtn_mus_note_track_added_to_pl;
+    }
+
+
+// *** DRM ***
+
+// -----------------------------------------------------------------------------
+// r_mpx_drm_expired_playback
+// Note text when the DRM file cannot be played
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_drm_expired_playback
+    {
+    buf = qtn_nmp_drm_expired_playback;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_drm_prev_rights_set
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_drm_prev_rights_set
+    {
+    buf = qtn_drm_prev_rights_set;
+    }
+
+// -----------------------------------------------------------------------------
+//    r_mpx_no_drm_over_bt
+//    Cannot play DRM protected music over bluetooth
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_no_drm_over_bt
+    {
+    buf = qtn_nmp_note_protected_over_bluetooth;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_confirm_query_with_yes_no
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_confirm_query_with_yes_no
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery; 
+            control = AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_fldr_illegal_characters
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_fldr_illegal_characters
+    {
+    buf = qtn_fldr_illegal_characters;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_fldr_bad_file_name
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_fldr_bad_file_name
+    {
+    buf = qtn_fldr_bad_file_name;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_fldr_overwrite_query
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_fldr_overwrite_query
+    {
+    buf = qtn_fldr_overwrite_query;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_file_name_query
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_file_name_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_DATA_QUERY
+                {
+                layout = EDataLayout;
+                label = qtn_fldr_item_name_prmpt;
+                control = EDWIN
+                    {
+                    flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                    lines = 1;
+                    maxlength = 256;
+                    };
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_create_playlist_name_query
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_create_playlist_name_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_DATA_QUERY
+                {
+                layout = EDataLayout;
+                label = qtn_mus_enter_pl_name;
+                control = EDWIN
+                    {
+                    flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                    lines = 1;
+                    maxlength = 256;
+                    };
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_sec_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_sec_text
+    {
+    buf = qtn_mus_time_frmt_single_second;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_secs_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_secs_text
+    {
+    buf = qtn_mus_time_frmt_plural_second;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_min_sec_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_min_sec_text
+    {
+    buf = qtn_mus_time_frmt_single_min_single_sec;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_min_secs_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_min_secs_text
+    {
+    buf = qtn_mus_time_frmt_single_min_plural_sec;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_mins_sec_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_mins_sec_text
+    {
+    buf = qtn_mus_time_frmt_plural_min_single_sec;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_mins_secs_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_mins_secs_text
+    {
+    buf = qtn_mus_time_frmt_plural_min_plural_sec;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_hr_min_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_hr_min_text
+    {
+    buf = qtn_mus_time_frmt_single_hr_single_min;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_hr_mins_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_hr_mins_text
+    {
+    buf = qtn_mus_time_frmt_single_hr_plural_min;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_hrs_min_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_hrs_min_text
+    {
+    buf = qtn_mus_time_frmt_plural_hr_single_min;
+    }    
+    
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_hrs_mins_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_hrs_mins_text
+    {
+    buf = qtn_mus_time_frmt_plural_hr_plural_min;
+    }  
+    
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_day_hr_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_day_hr_text
+    {
+    buf = qtn_mus_time_frmt_single_day_single_hr;
+    }    
+    
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_day_hrs_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_day_hrs_text
+    {
+    buf = qtn_mus_time_frmt_single_day_plural_hr;
+    }  
+    
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_days_hr_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_days_hr_text
+    {
+    buf = qtn_mus_time_frmt_plural_day_single_hr;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_time_days_hrs_text
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_time_days_hrs_text
+    {
+    buf = qtn_mus_time_frmt_plural_day_plural_hr;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_generic_wait_note
+// Generic wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_delete_wait_note
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = 0x1000;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                imagefile = AVKON_BITMAP_FILE; // bitmap file
+                imageid = EMbmAvkonQgn_note_erased;
+                imagemask = EMbmAvkonQgn_note_erased_mask;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// qtn_mus_playlist_name_exist
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_playlist_name_exist
+    {
+    buf = qtn_fldr_rename_query;
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/eabi/mpxcommonuiU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,70 @@
+EXPORTS
+	_ZN12MPXTlsHelper10LaunchModeEv @ 1 NONAME
+	_ZN12MPXTlsHelper11InitializeLEv @ 2 NONAME
+	_ZN12MPXTlsHelper11SetFilePathERK7TDesC16 @ 3 NONAME
+	_ZN12MPXTlsHelper11SetHostUidLERK4TUid @ 4 NONAME
+	_ZN12MPXTlsHelper11SetNeedSaveEi @ 5 NONAME
+	_ZN12MPXTlsHelper12SetAllowMoveEi @ 6 NONAME
+	_ZN12MPXTlsHelper12UninitializeEv @ 7 NONAME
+	_ZN12MPXTlsHelper14SetLaunchModeLE14TMPXLaunchMode @ 8 NONAME
+	_ZN12MPXTlsHelper7HostUidEv @ 9 NONAME
+	_ZN12MPXTlsHelper8FilePathEv @ 10 NONAME
+	_ZN12MPXTlsHelper8NeedSaveEv @ 11 NONAME
+	_ZN12MPXTlsHelper9AllowMoveEv @ 12 NONAME
+	_ZN14CMPXSaveHelper19StartCopyOperationLER5RFileRK7TDesC16ii @ 13 NONAME
+	_ZN14CMPXSaveHelper19StartCopyOperationLERK7TDesC16S2_i @ 14 NONAME
+	_ZN14CMPXSaveHelper4NewLEP22MMPXSaveHelperObserverP16MFileManObserver @ 15 NONAME
+	_ZN14CMPXSaveHelperD0Ev @ 16 NONAME
+	_ZN14CMPXSaveHelperD1Ev @ 17 NONAME
+	_ZN14CMPXSaveHelperD2Ev @ 18 NONAME
+	_ZN16CMPXAlbumArtUtil13CancelRequestEv @ 19 NONAME
+	_ZN16CMPXAlbumArtUtil16ExtractAlbumArtLERK9CMPXMediaR24MMPXAlbumArtUtilObserverRK5TSize12TDisplayMode @ 20 NONAME
+	_ZN16CMPXAlbumArtUtil4NewLEv @ 21 NONAME
+	_ZN16CMPXAlbumArtUtilD0Ev @ 22 NONAME
+	_ZN16CMPXAlbumArtUtilD1Ev @ 23 NONAME
+	_ZN16CMPXAlbumArtUtilD2Ev @ 24 NONAME
+	_ZN18CMPXCommonUiHelper12HandleErrorLEiPK9CMPXMediaP5RFile @ 25 NONAME
+	_ZN18CMPXCommonUiHelper13ShowWaitNoteLER7TDesC16iiP23MProgressDialogCallbacki @ 26 NONAME
+	_ZN18CMPXCommonUiHelper14DefaultDriveLCEv @ 27 NONAME
+	_ZN18CMPXCommonUiHelper14FindPlaylistsLEv @ 28 NONAME
+	_ZN18CMPXCommonUiHelper14GenerateTitleLE19TMPXGeneralCategoryRK7TDesC16 @ 29 NONAME
+	_ZN18CMPXCommonUiHelper14IsHostBrowserLEv @ 30 NONAME
+	_ZN18CMPXCommonUiHelper14MMCDriveNumberEv @ 31 NONAME
+	_ZN18CMPXCommonUiHelper15CreatePlaylistLERK9CMPXMediaP19MMPXCHelperObserverP23MProgressDialogCallback @ 32 NONAME
+	_ZN18CMPXCommonUiHelper15UnitConversionLExi @ 33 NONAME
+	_ZN18CMPXCommonUiHelper16AvailableDriveLCEi @ 34 NONAME
+	_ZN18CMPXCommonUiHelper16DismissWaitNoteLEv @ 35 NONAME
+	_ZN18CMPXCommonUiHelper16DisplayInfoNoteLERK7TDesC16 @ 36 NONAME
+	_ZN18CMPXCommonUiHelper16DisplayInfoNoteLEi @ 37 NONAME
+	_ZN18CMPXCommonUiHelper16IsHostMessagingLEv @ 38 NONAME
+	_ZN18CMPXCommonUiHelper17ExitOptionHiddenLEv @ 39 NONAME
+	_ZN18CMPXCommonUiHelper17StandAloneModePIdEv @ 40 NONAME
+	_ZN18CMPXCommonUiHelper19AddToSavedPlaylistLERK9CMPXMediaS2_P19MMPXCHelperObserverP23MProgressDialogCallback @ 41 NONAME
+	_ZN18CMPXCommonUiHelper19DisplayConfirmNoteLERK7TDesC16 @ 42 NONAME
+	_ZN18CMPXCommonUiHelper19DisplayConfirmNoteLEi @ 43 NONAME
+	_ZN18CMPXCommonUiHelper19DoSetAsRingingToneLERK9CMPXMediaii @ 44 NONAME
+	_ZN18CMPXCommonUiHelper19LaunchRenameDialogLERK7TDesC16R6TDes16S2_ @ 45 NONAME
+	_ZN18CMPXCommonUiHelper20DisplayableDurationLExNS_20TMPXDuratDisplayModeE @ 46 NONAME
+	_ZN18CMPXCommonUiHelper20IsHostPodcastingAppLEv @ 47 NONAME
+	_ZN18CMPXCommonUiHelper20SetStandAloneModePIdEx @ 48 NONAME
+	_ZN18CMPXCommonUiHelper21IsProfileOfflineModeLEv @ 49 NONAME
+	_ZN18CMPXCommonUiHelper21SetMiddleSoftKeyIconLER24CEikButtonGroupContainerP10CFbsBitmapS3_ @ 50 NONAME
+	_ZN18CMPXCommonUiHelper22SetMiddleSoftKeyLabelLER24CEikButtonGroupContainerii @ 51 NONAME
+	_ZN18CMPXCommonUiHelper23IsForegroundApplicationEi @ 52 NONAME
+	_ZN18CMPXCommonUiHelper23IsHostMessagingBrowserLEv @ 53 NONAME
+	_ZN18CMPXCommonUiHelper24RemoveMiddleSoftKeyLabelER24CEikButtonGroupContainer @ 54 NONAME
+	_ZN18CMPXCommonUiHelper26DisplayableDurationInTextLEx @ 55 NONAME
+	_ZN18CMPXCommonUiHelper4NewLEP21MMPXCollectionUtility @ 56 NONAME
+	_ZN23CMPXLbxExtendedFeatures17SpeedNaviUpdatingEi @ 57 NONAME
+	_ZN23CMPXLbxExtendedFeatures18EnableSpeedScrollLEi @ 58 NONAME
+	_ZN23CMPXLbxExtendedFeatures18HandleLbxKeyEventLERK9TKeyEvent10TEventCode @ 59 NONAME
+	_ZN23CMPXLbxExtendedFeatures4NewLEP15CEikTextListBoxi @ 60 NONAME
+	_ZN23CMPXLbxExtendedFeaturesD0Ev @ 61 NONAME
+	_ZN23CMPXLbxExtendedFeaturesD1Ev @ 62 NONAME
+	_ZN23CMPXLbxExtendedFeaturesD2Ev @ 63 NONAME
+	_ZTI13CMPXImageUtil @ 64 NONAME ; #<TI>#
+	_ZTI16CMPXAlbumArtUtil @ 65 NONAME ; #<TI>#
+	_ZTV13CMPXImageUtil @ 66 NONAME ; #<VT>#
+	_ZTV16CMPXAlbumArtUtil @ 67 NONAME ; #<VT>#
+	_ZN18CMPXCommonUiHelper25CancelCollectionOperationEv @ 68 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxcommonui.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/mpxcommonui.iby          CORE_APP_LAYER_IBY_EXPORT_PATH(mpxcommonui.iby)
+../rom/mpxcommonuirsc.iby       LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxcommonuirsc.iby)
+../loc/mpxcommonui.loc	    	APP_LAYER_LOC_EXPORT_PATH(mpxcommonui.loc)
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxcommonui.mif
+OPTION HEADERFILE mpxcommonui.mbg
+OPTION SOURCES -c8,8 qgn_indi_mmc_add
+END
+
+PRJ_MMPFILES
+
+mpxcommonui.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1 @@
+/c8,8 qgn_indi_mmc_add
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/group/mpxcommonui.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxcommonui.
+*
+*/
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxcommonui.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC66
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+MACRO __ENABLE_MSK
+MACRO CAMESE_IN_DRM_UTILITY
+
+START RESOURCE  ../data/mpxcommonui.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS
+END // RESOURCE
+
+
+SOURCEPATH      ../src
+SOURCE          mpxcommonuihelper.cpp
+SOURCE          mpxtlshelper.cpp
+SOURCE          mpxlbxextendedfeatures.cpp
+SOURCE          mpximageutil.cpp 
+SOURCE          mpxalbumartutil.cpp
+SOURCE          mpxdrmuihelper.cpp
+SOURCE          mpxfilenamequerydlg.cpp
+SOURCE          mpxsavehelper.cpp
+
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         aknskins.lib
+LIBRARY         efsrv.lib
+LIBRARY         egul.lib
+LIBRARY         bafl.lib
+LIBRARY         eikdlg.lib 
+LIBRARY         commonengine.lib
+LIBRARY         commondialogs.lib
+LIBRARY         profilesettingsview.lib
+LIBRARY         profileeng.lib
+LIBRARY         centralrepository.lib
+LIBRARY         ws32.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         mediaclientaudio.lib
+LIBRARY         fbscli.lib estor.lib
+LIBRARY         bitmaptransforms.lib imageconversion.lib metadatautility.lib
+LIBRARY         sysutil.lib
+LIBRARY         drmhelper.lib
+LIBRARY         platformenv.lib // pathinfo
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxcollectionhelper.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         apgrfx.lib
+LIBRARY         featmgr.lib
+LIBRARY         aknnotify.lib 
+LIBRARY         iclextjpegapi.lib
+LIBRARY         thumbnailmanager.lib	// Album art
+
+// CAMESE_IN_DRM_UTILITY
+LIBRARY         drmuihandling.lib
+LIBRARY         drmutility.lib
+LIBRARY         caf.lib
+LIBRARY         cafutils.lib
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/group/mpxcommonuiicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxcommonui
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxcommonui.mif
+HEADERFILENAME=$(HEADERDIR)/mpxcommonui.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/inc/mpxcommonui.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxcommonui
+*
+*/
+
+
+
+#ifndef MPXCOMMONUI_HRH
+#define MPXCOMMONUI_HRH
+
+// CONSTANTS
+
+/** Folder used for creating new playlists */
+#define text_targetfolder_playlists "Playlists\\"
+
+// Host application UIDs in embedded mode
+#define KMPXMessagingUid  0x100058C5
+#define KMPXMmsViewerUid  0x100058DF
+#define KMPXMmsEditorUid  0x100058DE
+#define KMPXMailViewerUid 0x101F4CE4
+#define KMPXMailEditorUid 0x101F4CD6
+#define KMPXUniEditorUid  0x102072D8
+#define KMPXBrowserUid    0x10008D39
+#define KMPXBrowserUid2   0x1020724D
+#define KPodcastingAppUid 0x1028190B
+
+#endif  // MPXCOMMONUI_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/inc/mpxdrmuihelper.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition of UI helper utility for DRM functions
+*
+*/
+
+
+
+#ifndef C_CMPXDRMUIHELPER_H
+#define C_CMPXDRMUIHELPER_H
+
+#ifdef CAMESE_IN_DRM_UTILITY
+#include <drmuicheckrightsobserver.h>
+#endif
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+#ifdef CAMESE_IN_DRM_UTILITY
+namespace DRM
+    {
+    class CDrmUiHandling;
+    }
+#else
+class CDRMHelper;
+#endif
+
+class CMPXCommonUiHelper;
+
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT  
+class CCameseUiHelper;
+#endif
+
+// CLASS DECLARATION
+
+/**
+ *  DRM UI helper utility class.
+ *
+ *  @lib mpxcommonui.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXDrmUiHelper ) : public CBase
+#ifdef CAMESE_IN_DRM_UTILITY
+,public DRM::MDrmUiCheckRightsObserver
+#endif
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXDrmUiHelper* NewL( CMPXCommonUiHelper* aHelper );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXDrmUiHelper();
+    
+    /**
+     * Handles displaying the error message for given error code
+     * according to the media object provided
+     *
+     * @since 3.1
+     * @param aError Error code
+     * @param aMedia MPXMedia object
+     * @param aFile Handle to file
+     * @return KErrNone if no error, or else if a dialog is displayed will
+     *         return the Button ID used to dismiss dialog.
+     */
+    TInt HandleDrmErrorL( TInt aError, 
+                          const CMPXMedia* aMedia=NULL,
+                          RFile* aFile=NULL );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXDrmUiHelper( CMPXCommonUiHelper* aHelper );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private:    // New methods
+
+    /**
+     * Handles OMA specific error messages
+     * @param aMedia MPXMedia object
+     * @param aFile Handle to file
+     * @return KErrNone if no error, or else if a dialog is displayed will
+     *         return the Button ID used to dismiss dialog.
+     */
+    TInt HandleOMAErrorL( TInt aError, 
+            const CMPXMedia* aMedia, 
+            RFile* aFile );
+
+    /**
+     * Handles WMA specific error messages
+     * @param aMedia MPXMedia object
+     * @param aFile Handle to file
+     * @return KErrNone if no error, or else if a dialog is displayed will
+     *         return the Button ID used to dismiss dialog.
+     */
+    TInt HandleWMAErrorL( TInt aError, 
+            const CMPXMedia* aMedia,
+            RFile* aFile );
+
+#ifdef CAMESE_IN_DRM_UTILITY
+private:	// From MDrmUiCheckRightsObserver
+
+    DRM::TCheckRightsAction RightsLeft(
+            TInt aOperationId,
+            TBool aUnconstrained,
+            TTimeIntervalSeconds aTime,
+            TInt aCounts,
+            TTimeIntervalSeconds aAccumulated );
+
+    DRM::TCheckRightsAction RightsNotValid(
+            TInt aOperationId,
+            DRM::TCheckRightsStatus aRightsStatus,
+            TInt aReason );
+
+    // Unused observation methods
+
+    DRM::TEmbeddedPreviewAction EmbeddedPreviewAvailable(
+            TInt aOperationId,
+            const TDesC& aUniqueId,
+            TInt aRightsStatus,
+            TInt aReason );
+
+    DRM::TPreviewRightsAction PreviewRightsUrlAvailable(
+            TInt aOperationId,
+            const TDesC& aPreviewRightsUrl,
+            TInt aRightsStatus,
+            TInt aReason );
+
+    DRM::TSilentRightsAction SilentRightsUrlAvailable(
+            TInt aOperationId,
+            const TDesC& aSilentRightsUrl,
+            TInt aRightsStatus,
+            TInt aReason );
+
+    DRM::TRightsAction RightsUrlAvailable(
+            TInt aOperationId,
+            const TDesC& aRightsUrl,
+            TInt aRightsStatus,
+            TInt aReason,
+            TInt aUrlType );
+
+    void PreviewRightsAvailable(
+            TInt aOperationId,
+            TInt aError );
+
+    void SilentRightsAvailable(
+            TInt aOperationId,
+            TInt aError );
+
+    void RightsAvailable(
+            TInt aOperationId,
+            TInt aError );
+
+    void PlayEmbeddedPreviewSelected(
+            TInt aOperationId,
+            const TDesC& aUniqueId );
+
+    void OperationCompleted( TInt aOperationId, TInt aOperationStatus );
+#endif
+
+private:    // Data
+#ifdef CAMESE_IN_DRM_UTILITY
+    DRM::CDrmUiHandling* iDrmUiHandler; // owned
+
+    TBool iRightsValid;
+#else
+    CDRMHelper* iDrmHelper; // owned
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT 
+    CCameseUiHelper* iCameseUiHelper;       // own
+#endif
+#endif 
+    CMPXCommonUiHelper* iCommonUiHelper;    // Not Owned
+    };
+
+#endif  // C_CMPXDRMUIHELPER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/inc/mpxfilenamequerydlg.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition of file rename dialog for Common UI
+*
+*/
+
+
+#ifndef C_CMPXFILENAMEQUERYDLG_H
+#define C_CMPXFILENAMEQUERYDLG_H
+
+//  INCLUDES
+#include <AknQueryDialog.h>     // CAknTextQueryDialog
+#include <mpxmediageneraldefs.h>
+
+// CLASS DECLARATION
+class CMPXCommonUiHelper;
+
+/**
+ *  @lib mpxcommonui.lib
+ *  @since S60 v3.0
+ *  Dialog for querying file names in File Manager
+ */
+NONSHARABLE_CLASS( CMPXFileNameQueryDlg ): public CAknTextQueryDialog
+    {
+    public:  // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         * @param aOldName Old name of the file, this will be the default name
+         * @param aNewName User entered new name of the file.
+         * @param aPath original path for the file, needed to check if the file
+         *              already exist
+         * @param aCategory specifies the category for the title
+         * @return Newly created query dialog.
+         */
+        static CMPXFileNameQueryDlg* NewL( const TDesC& aOldName, 
+                                           TDes& aNewName,
+                                           const TDesC& aPath, 
+                                           TMPXGeneralCategory aCategory,
+                                           CMPXCommonUiHelper* aParent );
+
+		/**
+        * Destructor.
+        */
+        ~CMPXFileNameQueryDlg();
+
+    public: // from CAknTextQueryDialog
+        /**
+         * @see CAknTextQueryDialog
+         */
+    	TBool OkToExitL( TInt aButtonId );
+
+	private:
+        /**
+        * C++ default constructor.
+        */
+        CMPXFileNameQueryDlg( 
+            TDes& aNewName, 
+            TMPXGeneralCategory aCategory,
+            CMPXCommonUiHelper* aParent );
+
+        /**
+         * Symbian OS 2nd phase constructor.
+         * @param aOldName Old name of the file, this will be the default name
+         * @param aPath original path for the file
+         */
+		void ConstructL( const TDesC& aOldName, const TDesC& aPath );
+		
+		/**
+        * Is given file name valid
+        * @since 3.0
+        * @param aDriveAndPath root path
+        * @param aName name of the file
+        * @param aIsFolder ETrue folder and EFalse file name
+        * @return ETrue if file name is valid
+        */
+        TBool IsValidName(
+            const TDesC& aDriveAndPath, const TDesC& aName, TBool aIsFolder ) const;
+
+        /**
+        * Check that if given file name contains illegal characters
+        * @since 3.0
+        * @param aName name of the file
+        * @return ETrue if file name is valid
+        */
+		TBool IllegalChars( const TDesC& aName ) const;
+
+    private:    // Data        
+        HBufC*                      iOldName;  // own
+        HBufC*                      iPath;     // own
+        CMPXCommonUiHelper*         iParent; // not own
+        MMPXCollectionUiHelper*     iCollectionUiHelper; //own
+        TMPXGeneralCategory         iCategory;
+    };
+
+#endif      // C_CMPXFILENAMEQUERYDLG_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/inc/mpximageutil.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,137 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class declaration of CMPXImageUtil.
+*
+*/
+
+
+#ifndef CMPXIMAGEUTIL_H
+#define CMPXIMAGEUTIL_H
+
+//  INCLUDES
+
+#include "mpxalbumartutilobserver.h"
+
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+class CBitmapScaler;
+class CImageDecoder;
+
+// CLASS DECLARATION
+
+/**
+*  Image Conversion Class.
+**/
+class CMPXImageUtil : public CActive
+    {
+public:
+   
+	// states for this engine
+  	enum TState 
+	    {
+	    EIdle = 0,
+	    EDecoding,
+	    EScaling
+	    };
+
+public:  // Constructors and destructor
+        
+    /**
+    * Two-phased constructor.
+    * @param aObserver ablum art observer
+    * @return A pointer to a newly created object
+    */
+    static CMPXImageUtil* NewL(MMPXAlbumArtUtilObserver& aObserver);
+
+    /**
+    * Destructor.
+    */
+    ~CMPXImageUtil();
+
+private:
+
+    /**
+    * C++ default constructor.
+    */
+    CMPXImageUtil(MMPXAlbumArtUtilObserver& aObserver); 
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();  
+
+public: // New functions
+        
+    /*
+    * Starts to decode an image from a file. 
+    * @param aFileName Full path and filename of the image to be decoded.
+    * @param aSize The size of the required destination BMP.
+    * @param aDisplayMode the display mode of the destination BMP
+    */
+    void StartToDecodeL(const TDesC& aFileName, 
+                        const TSize& aSize, 
+                        TDisplayMode aDisplayMode = EColor64K);
+  
+    /*
+    * Starts to decode an image from JPG buffer
+    * @param aSize The size of the required destination JPG
+    * @param aAlbumArt The pointer to the JPG buffer
+    * @param aDisplayMode the display mode of the destination JPG
+    */
+    void StartToDecodeL(const TSize& aSize, 
+                        HBufC8* aAlbumArt, 
+                        TDisplayMode aDisplayMode = EColor64K);
+
+    /*
+    * Cancel outstanding asynch requests
+    */
+    void CancelRequest();
+    
+private: // New functions
+
+    /**
+    * Scales iBitmap to iSize 
+    **/
+    void ScaleL();
+    TSize CalculateDecodeSize(const TSize& aSize);
+
+private: // Functions from base classes
+
+    /**
+    * Cancellation of an outstanding request.
+    */
+    void DoCancel();
+
+    /**
+    * Handles an active object’s request completion event.
+    */
+    void RunL();
+      
+private:    // Data
+
+    MMPXAlbumArtUtilObserver&       iObserver;      // Album art util observer
+    CFbsBitmap*                     iBitmap;        // decoded image
+    CImageDecoder*                  iImageDecoder;  // decoder
+    CBitmapScaler*                  iScaler;        // bitmap scaler
+    TSize                           iSize;          // desired size of the bitmap
+    TState                          iState;         // engine state
+    RFs                             iFs;            // for opening/saving images from/to files
+    HBufC8*                         iImageData;     // Album art image data (owned)
+    TBool                           iScaleRquired;
+    };
+
+#endif // CMPXIMAGEUTIL_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/loc/mpxcommonui.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,355 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxcommonui
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// *** Set as ringing tone ***
+
+// d:Information note text.
+// d:Shown after track is set as the ringing tone of the active profile.
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_ringtone_set "%U set as ringtone for active profile"
+
+// *** Error strings ***
+
+// d:Notification that a file cannot be found.
+// d:Thus, the intended operation will not be performed.
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_mp_note_broken_file "File cannot be found. Operation cancelled."
+
+// d:Text for an information note shown when user attempts to play a playlist
+// d:or a category of songs, and all of the tracks are missing or unplayable.
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_invalid_list "Unable to play selection. Operation cancelled."
+
+// d:Notification that a file is corrupted.
+// d:Thus, the intended operation will not be performed.
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_mp_note_corrupt_file "File is corrupt. Operation cancelled."
+
+
+// *** Unit conversion ***
+
+// d:Item for Music Library Details dialog.
+// d:%N is free memory in bytes
+// l:list_single_heading_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_memory_b "%N B"
+
+// d:Item for Music Library Details dialog.
+// d:%U is free memory in gigabytes
+// l:list_single_heading_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_memory_gb "%U GB"
+
+// d:Item for Music Library Details dialog.
+// d:%U is free memory in megabytes
+// l:list_single_heading_pane_t1_cp2
+// r:3.1
+//
+#define qtn_nmp_memory_mb "%U MB"
+
+// d:Item for Music Library Details dialog.
+// d:%U is free memory in kilobytes
+// l:list_single_heading_pane_t1_cp2
+// r:3.1
+//
+#define qtn_nmp_memory_kb "%U kB"
+
+// d:Item for Music Library Details dialog.
+// d:%N is free memory in bytes
+// l:list_single_heading_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_memory_b_free "%N B free"
+
+// d:Item for Music Library Details dialog.
+// d:%U is free memory in gigabytes
+// l:list_single_heading_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_memory_gb1_free "%U GB free"
+
+// d:Item for Music Library Details dialog.
+// d:%U is free memory in megabytes
+// l:list_single_heading_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_memory_mb1_free "%U MB free"
+
+// d:Item for Music Library Details dialog.
+// d:%U is free memory in kilobytes
+// l:list_single_heading_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_memory_kb1_free "%U kB free"
+
+
+// *** Speed Scrolling ***
+
+// d:When speed scrolling fast,
+// d:show speed in Navi pane.
+// l:navi_text_pane_t1
+// r:3.1
+//
+#define qtn_nmp_navi_speed_fast "fast"
+
+
+// *** Playlist ***
+
+// d:Options menu item for adding to a playlist.
+// l:list_single_pane_t1_cp2/opt3
+// r:3.1
+//
+#define qtn_mus_options_add_to_pl "Add to a playlist"
+
+// d:Options menu item for adding to a new playlist.
+// l:list_single_popup_submenu_pane_t1
+// r:3.1
+//
+#define qtn_nmp_sub_add_to_playlist_new "New playlist"
+
+// d:Options menu item for adding to a saved playlist.
+// l:list_single_popup_submenu_pane_t1
+// r:3.1
+//
+#define qtn_nmp_sub_add_to_playlist_saved "Saved playlist"
+
+// d:Text for an information shown when a single track has been added to
+// d:a playlist. %U is the name of the playlist.
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_mus_note_track_added_to_pl "Song added to %U"
+
+// d:Text for an information shown when multiple tracks has been added to
+// d:a playlist.
+// d:%N is the number of tracks.
+// d:%U is the name of the playlist.
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_mus_multiple_tracks_added_to_pl "%N songs added to %U"
+
+// d:Title for the playlist selection query when adding new tracks to a 
+// d:playlist.
+// l:heading_pane_t1
+// r:3.1
+//
+#define qtn_mus_title_select_pl "Select a playlist:"
+
+// d:prompt text for new playlist name
+// l:popup_query_data_window
+// r:3.1
+//
+#define qtn_mus_enter_pl_name "Playlist name:"
+
+// d:Playlist default filename without extension.
+// d:Shown in data query editing field.
+// d:Reserve space for ordinal numbers also,
+// d:in case a playlist with same name already exists.
+// l:query_popup_data_pane_t1/opt4
+// r:3.1
+//
+#define qtn_mg_def_name_playlist "Playlist"
+
+// d:Text for wait note for adding multiple songs to playlist
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_mus_note_adding_tracks "Adding songs"
+
+// d:Text for wait note for adding one song to playlist
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_nmp_note_adding_one_song "Adding song"
+
+
+// *** DRM ***
+
+// d:Popup note to tell the user that they cannot play a file, 
+// d:the song rights have expired.
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_drm_expired_playback "Rights are expired. Unable to play %U"
+
+// d:Popup note to tell the user that they cannot set a file as ringtone
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_drm_prev_rights_set "Unable to select object"
+
+// d:Text in navi pane label.
+// d:Shows total duration of one second.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_single_second "1 second"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in seconds.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_plural_second "%N seconds"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in 1 minute and 1 second.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_single_min_single_sec "1 minute, 1 second"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in 1 minutes and seconds.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_single_min_plural_sec "1 minute, %N seconds"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in minutes and one second.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_plural_min_single_sec "%N minutes, 1 second"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in minutes and seconds.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_plural_min_plural_sec "%0N min, %1N sec"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in 1 hour and 1 minute.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_single_hr_single_min "1 hour, 1 minute"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in 1 hour and minutes.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_single_hr_plural_min "1 hour, %N minutes"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in hours and 1 minute.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_plural_hr_single_min "%N hours, 1 minute"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in hours and minutes.
+// l:navi_text_pane_t1
+// r:5.0
+//
+#define qtn_mus_time_frmt_plural_hr_plural_min "%0N hours, %1N minutes"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in 1 day and 1 hour.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_single_day_single_hr "1 day, 1 hour"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in 1 day and hours.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_single_day_plural_hr "1 day, %N hours"
+
+// d:Text in navi pane label.
+// d:Shows total duration of tracks in days and hours.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mus_time_frmt_plural_day_plural_hr "%0N days, %1N hours"
+
+// d: When playing DRM file over a bluetooth headset, 
+// d: the audio should not be played.
+// l: popup_note_window/opt2
+// r: 3.1
+//
+#define qtn_nmp_note_protected_over_bluetooth "Song is protected. Unable to play over Bluetooth headset"
+
+// *** UPNP ***
+
+// d:Media keypress not supported error note.
+// d:Display when media key event isn't supported by player.
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_no_media_key "Media key event not supported by player"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/rom/mpxcommonui.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project MPX Music Player Common Ui.
+*
+*/
+
+
+#ifndef MPXCOMMONUI_IBY
+#define MPXCOMMONUI_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxcommonui.dll              SHARED_LIB_DIR\mpxcommonui.dll
+SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, mpxcommonui )
+
+#endif  // MPXCOMMONUI_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/rom/mpxcommonuirsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project MPX Music Player Common Ui.
+*
+*/
+
+
+#ifndef MPXCOMMONUIRSC_IBY
+#define MPXCOMMONUIRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxcommonui.rsc            APP_RESOURCE_DIR\mpxcommonui.rsc
+
+#endif  // MPXCOMMONUIRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/src/mpxalbumartutil.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,314 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX album utility API
+*
+*/
+
+#include <e32std.h>
+#include <MetaDataUtility.h>
+#include <MetaDataFieldContainer.h>
+#include <mpxuser.h>
+#include <mpxmedia.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxlog.h>
+
+#include "mpxalbumartutilobserver.h"
+#include "mpximageutil.h"
+#include "mpxalbumartutil.h"
+#include <thumbnaildata.h>
+#include <thumbnailobjectsource.h>
+#include <centralrepository.h>
+
+#define THUMBNAIL_CENREP_UID 0x102830B0
+
+const TUint32 KSizeAudioGridWidth = 0x12;
+const TUint32 KSizeAudioGridHeight = 0x13;
+const TUint32 KSizeAudioFullscreenWidth = 0x16;
+const TUint32 KSizeAudioFullscreenHeight = 0x17;
+
+
+_LIT( KMPXAlbumMimeType, "audio/mpeg3" );
+// ============================== MEMBER FUNCTIONS ============================
+
+// ----------------------------------------------------------------------------
+// Create the playback utility object
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CMPXAlbumArtUtil* CMPXAlbumArtUtil::NewL()
+    {
+    CMPXAlbumArtUtil* self = new(ELeave)CMPXAlbumArtUtil();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CMPXAlbumArtUtil::~CMPXAlbumArtUtil()
+    {
+    if (iArtUtil)
+        {
+        delete iArtUtil;
+        }
+    if(iFilename)
+        {   
+        delete iFilename;
+        iFilename = NULL;
+        }
+    delete iThumbnailManager;
+    }
+
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXAlbumArtUtil::CMPXAlbumArtUtil()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+void CMPXAlbumArtUtil::ConstructL()
+    {
+     MPX_FUNC("CMPXAlbumArtUtil::ConstructL()");
+     iThumbnailManager = CThumbnailManager::NewL( *this );
+     iThumbnailManager->SetFlagsL( CThumbnailManager::EDefaultFlags );
+     iThumbnailManager->SetQualityPreferenceL( CThumbnailManager::EOptimizeForPerformance );
+	 //cenrep
+     CRepository* repository;
+     repository = CRepository::NewL( TUid::Uid(THUMBNAIL_CENREP_UID));
+
+     TInt xSize( 0 );
+     TInt ySize( 0 );
+     User::LeaveIfError( repository->Get( KSizeAudioGridWidth, xSize ));
+     User::LeaveIfError( repository->Get( KSizeAudioGridHeight, ySize ));
+     iGridViewImageSize.SetSize(xSize,ySize);
+
+     User::LeaveIfError( repository->Get( KSizeAudioFullscreenWidth, xSize ));
+     User::LeaveIfError( repository->Get( KSizeAudioFullscreenHeight, ySize ));
+     iFullScreenImageSize.SetSize(xSize,ySize);
+     delete repository;
+     repository = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// Create the playback utility object
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXAlbumArtUtil::ExtractAlbumArtL(const CMPXMedia& aMedia,
+                                            MMPXAlbumArtUtilObserver& aObs,
+                                            const TSize& aSize,
+                                            TDisplayMode aDisplayMode /*= EColor64K*/)
+    {
+    MPX_DEBUG1("CMPXAlbumArtUtil::ExtractAlbumArtL(): Entering");
+    MPX_DEBUG_THREAD("CMPXAlbumArtUtil::ExtractAlbumArtL()");
+    delete iArtUtil;
+    iArtUtil = NULL;
+    iArtUtil = CMPXImageUtil::NewL(aObs);
+    iDisplayMode = aDisplayMode;
+    iImageSize = aSize;
+    iObserver = &aObs;
+    
+    if (aMedia.IsSupported( KMPXMediaMusicAlbumArtFileName ))
+        {
+        if ( aMedia.ValueText( KMPXMediaMusicAlbumArtFileName ).Length() == 0)
+            {
+            User::Leave( KErrNotFound );
+            }
+        }
+
+    if ( aMedia.IsSupported( KMPXMediaGeneralUri ) &&
+         aMedia.IsSupported( KMPXMediaMusicAlbumArtFileName ))
+        {
+        delete iFilename;
+        iFilename = NULL;
+        iFilename = aMedia.ValueText( KMPXMediaMusicAlbumArtFileName ).AllocL();
+        if(aSize == iFullScreenImageSize)
+            {
+            iThumbnailManager->SetThumbnailSizeL(EAudioFullScreenThumbnailSize);
+            }
+        else if(aSize == iGridViewImageSize)
+            { 
+            iThumbnailManager->SetThumbnailSizeL(EAudioGridThumbnailSize);
+            } 
+        else
+            {
+            iThumbnailManager->SetThumbnailSizeL(aSize);
+            }
+        ExtractThumbnailL(&aMedia);
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+    MPX_DEBUG1("CMPXAlbumArtUtil::ExtractAlbumArtL(): Exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// Cancel Asynch requests
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXAlbumArtUtil::CancelRequest()
+    {
+    MPX_DEBUG1("CMPXAlbumArtUtil::CancelRequest(): Entering");
+    if ( iArtUtil )
+        {
+        iArtUtil->CancelRequest();
+        }
+    iReqId = 0;
+    MPX_DEBUG1("CMPXAlbumArtUtil::CancelRequest(): Exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Extract binary data from file
+// ----------------------------------------------------------------------------
+//
+HBufC8* CMPXAlbumArtUtil::ExtractBinaryMetaDataLC(const TDesC& aFilename,
+                                             TMetaDataFieldId aFieldId)
+    {
+    MPX_DEBUG1("CMPXAlbumArtUtil::ExtractBinaryMetaDataLC(): Entering");
+    HBufC8* ret(NULL);
+
+    if (EUnknownMetaDataField != aFieldId)
+        {
+        CMetaDataUtility* metaDataUtil = CMetaDataUtility::NewL();
+        CleanupStack::PushL( metaDataUtil );
+
+        RArray<TMetaDataFieldId> wantedFields;
+        CleanupClosePushL(wantedFields);
+        wantedFields.AppendL(aFieldId);
+
+        metaDataUtil->OpenFileL(aFilename, wantedFields);
+        const CMetaDataFieldContainer& metaCont =
+                                        metaDataUtil->MetaDataFieldsL();
+        TPtrC data = metaCont.Field( aFieldId );
+        if(data.Length()==0)
+            {
+            iObserver->ExtractAlbumArtCompleted( NULL, KErrNotFound );            
+            }
+        ret = MPXUser::Alloc8L(data);
+
+        CleanupStack::PopAndDestroy(&wantedFields);
+        CleanupStack::PopAndDestroy(metaDataUtil);
+        CleanupStack::PushL( ret );
+        }
+    else
+        {
+        ret = HBufC8::NewLC(0);
+        }
+
+    MPX_DEBUG1("CMPXAlbumArtUtil::ExtractBinaryMetaDataLC(): Exiting");
+    return ret;
+    }
+		
+// -----------------------------------------------------------------------------
+// Preview thumbnail generation or loading is complete.
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtUtil::ThumbnailPreviewReady(
+    MThumbnailData& /*aThumbnail*/,
+    TThumbnailRequestId /*aId*/ )
+    {
+    MPX_FUNC( "CMPXAlbumArtUtil::ThumbnailPreviewReady" );
+    // Not used
+    }
+
+
+// -----------------------------------------------------------------------------
+// Final thumbnail bitmap generation or loading is complete. 
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtUtil::ThumbnailReady(
+        TInt aError, MThumbnailData& aThumbnail,
+        TThumbnailRequestId aId )
+    {
+    MPX_DEBUG2( "CMPXAlbumArtUtil::ThumbnailReady error = %d", aError);
+
+    if (aError == KErrNone)
+        { 
+        CFbsBitmap* tempBitmap;
+        tempBitmap = aThumbnail.DetachBitmap();                
+        if (tempBitmap)
+            {
+            if(iReqId == aId)
+                {
+                iObserver->ExtractAlbumArtCompleted( tempBitmap, KErrNone ); 
+                }
+            else
+                {
+                delete tempBitmap;
+                } 
+            }
+        else
+            {
+            iObserver->ExtractAlbumArtCompleted( NULL, KErrNotFound );
+            }
+        } 	
+    else
+        {
+        TRAPD( err,
+            HBufC8* art( ExtractBinaryMetaDataLC(iFilename->Des(),EMetaDataJpeg ));
+            CleanupStack::Pop(art);
+            iArtUtil->StartToDecodeL(iImageSize, art, iDisplayMode) );
+        
+        if (err != KErrNone)
+            {
+            iObserver->ExtractAlbumArtCompleted( NULL, KErrNotFound );
+            }  
+        } 
+
+    }
+
+// -----------------------------------------------------------------------------
+//     Extract Thumbnail for the current song
+// -----------------------------------------------------------------------------
+//    	
+void CMPXAlbumArtUtil::ExtractThumbnailL(
+        const CMPXMedia* aMedia)
+    {
+    MPX_FUNC("CMPXAlbumArtUtil::ExtractThumbnailL");
+    
+    TMPXItemId currentId( aMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+    if (currentId == KMPXInvalidItemId )
+        {
+        User::Leave( KErrNotFound );
+        }
+    if (aMedia->IsSupported( KMPXMediaMusicAlbumArtFileName ) )
+        {
+        const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbumArtFileName );
+#ifdef _DEBUG
+        RDebug::RawPrint(album);
+#endif
+        if (album.Compare( KNullDesC) != 0 )
+            {
+            CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( album, KMPXAlbumMimeType );
+            TInt ret = NULL;
+            TRAPD(err, iReqId = TInt (iThumbnailManager->GetThumbnailL( *source, (TAny*)ret)));
+            if( err != KErrNone)
+                {
+                User::Leave( KErrNotFound );
+                }  
+            CleanupStack::PopAndDestroy( source );
+            }
+        }
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/src/mpxcommonuihelper.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1944 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper utility for Common UI
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <coeutils.h>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <AknWaitDialog.h>
+#include <AknProgressDialog.h>
+#include <AknCommonDialogs.h>
+#include <CAknFileNamePromptDialog.h>
+#include <centralrepository.h>
+#include <AknsUtils.h>
+#include <AknIconArray.h>
+#include <barsread.h>
+#include <StringLoader.h>
+#include <AknUtils.h>
+#include <bautils.h>
+#include <eikapp.h>
+#include <cprofiletonehandler.h>
+#include <pathinfo.h>
+#ifdef RD_MULTIPLE_DRIVE
+#include <driveinfo.h>
+#endif // RD_MULTIPLE_DRIVE
+#include <MProfileEngine.h>
+#include <AknQueryDialog.h>
+#include <aknnotewrappers.h>
+#include <data_caging_path_literals.hrh>
+#include <caf/caferr.h>
+#include <sysutil.h>
+#include <textresolver.h>
+#include <aknnotewrappers.h>
+
+#include <mpxmedia.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediaarray.h>
+#include <mpxcommonui.rsg>
+#include <mpxcommonui.mbg>
+#include <mpx.rsg>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionpath.h> // TMPXItemId
+#include <mpxcollectionutility.h>
+#include <mpxcollectionplugin.hrh>
+#include <mpxuser.h>
+#include <AknGlobalNote.h>
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+#include <aknSDData.h>
+#include <AknMediatorFacade.h>
+#include <mplayersecondarydisplayapi.h>
+#include <featmgr.h>
+//#endif
+// Cover UI end
+
+#include <mpxconstants.h>
+#include "mpxfilenamequerydlg.h"
+#include "mpxcommonui.hrh"
+#include "mpxtlshelper.h"
+#include "mpxcommonuihelper.h"
+#include "mpxdrmuihelper.h"
+#include "mpxinternalcrkeys.h"
+#include "mpxlog.h"
+
+
+// CONSTANTS
+const TInt KMPXOneSecInMicroSecs( 1000000 );
+const TInt KMPXOneMinInSeconds( 60 );
+const TInt KMPXOneHourInSeconds( 3600 );
+const TInt KMPXOneDayInSeconds( 86400 );
+const TInt KMPXOneHundredHoursInSecs( 360000 );
+
+const TInt KMPXDurationDisplayResvLen( 10 );
+
+const TInt KMPXDecimalPlaces ( 1 );
+const TInt KMPXWidthOfChar ( 10 );
+
+const TInt KMPXMaxBufferLen ( 160 );
+
+const TInt KMPXMaxPlaylistPathLen ( 200 );
+const TInt KMPXPlaylistinfoLen ( 300 );
+
+const TInt KMPXStandAloneProcessIDTop32( 1 );
+const TInt KMPXStandAloneProcessIDBottom32( 2 );
+
+const TReal KMPXOneKB ( 1024 );
+const TReal KMPXOneMB ( 1048576 );
+const TReal KMPXOneGB ( 1073741824 );
+
+const TText KRightToLeftMark = 0x200F;
+
+const TInt KMPXChunkSize = 100;  // number of songs added in each chunk, IncAddL
+const TInt KSQLErrGeneral = -311; // SQL General error. Don't want to include sql header here
+
+_LIT( KMPXCommonUiRscPath, "mpxcommonui.rsc" );
+_LIT( KMPXAddToPlaylistMemoryCardIcon, "\t0");
+_LIT( KMPXCommonUiIconFile, "mpxcommonui.mbm" );
+_LIT( KMPXAppUiRscPath, "mpx.rsc" );
+
+// autonaming format
+_LIT( KAutoNamingFormat, "%S(%S)");
+#ifndef RD_MULTIPLE_DRIVE
+_LIT( KDriveFormatString, ":\\" );
+#endif // RD_MULTIPLE_DRIVE
+_LIT( KAutoNumberFormat, "%u");
+_LIT( KAutoNumberPaddedFormat, "%+02u");
+_LIT( KWildCardCharacter, "*");
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXCommonUiHelper::CMPXCommonUiHelper(MMPXCollectionUtility* aCollectionUtility)
+    : iCollectionUtility(aCollectionUtility)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonUiHelper::ConstructL()
+    {
+    CCoeEnv* coeEnv = CEikonEnv::Static();
+    TParse parse;
+    parse.Set( KMPXCommonUiRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    TParse appUiparse;
+    appUiparse.Set( KMPXAppUiRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName appUiResourceFile( appUiparse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( appUiResourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), appUiResourceFile );
+    iAppUiResourceOffset = coeEnv->AddResourceFileL( appUiResourceFile );
+
+    iMpxDrmHelper = CMPXDrmUiHelper::NewL( this );
+
+//#ifdef __COVER_DISPLAY
+    if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
+        {
+        iCoverDisplay = ETrue;
+        }
+    else
+        {
+        iCoverDisplay = EFalse;
+        }
+//#endif // __COVER_DISPLAY
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXCommonUiHelper* CMPXCommonUiHelper::NewL(MMPXCollectionUtility* aCollectionUtility)
+    {
+    CMPXCommonUiHelper* self = new ( ELeave ) CMPXCommonUiHelper(aCollectionUtility);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCommonUiHelper::~CMPXCommonUiHelper()
+    {
+    if ( iCollectionUiHelper )
+        {
+        iCollectionUiHelper->Close();
+        }
+
+    if ( iWaitDialog )
+        {
+        iWaitDialog->SetCallback( NULL );
+        TRAP_IGNORE( iWaitDialog->ProcessFinishedL() );
+        }
+
+    if ( iResourceOffset )
+        {
+        CEikonEnv::Static()->DeleteResourceFile( iResourceOffset );
+        }
+    if ( iAppUiResourceOffset )
+        {
+        CEikonEnv::Static()->DeleteResourceFile( iAppUiResourceOffset );
+        }
+    delete iMpxDrmHelper;
+    }
+
+// ---------------------------------------------------------------------------
+// Check if the host application is messaging or browser
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonUiHelper::IsHostMessagingBrowserL()
+    {
+    return ( IsHostMessagingL() || IsHostBrowserL() );
+    }
+
+// ---------------------------------------------------------------------------
+// Check if the host application is messaging
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonUiHelper::IsHostMessagingL()
+    {
+    TBool ret( EFalse );
+    TInt hostUid = MPXTlsHelper::HostUid().iUid;
+    if ( hostUid == KMPXMmsViewerUid || hostUid == KMPXMmsEditorUid ||
+         hostUid == KMPXMailViewerUid || hostUid == KMPXMailEditorUid ||
+         hostUid == KMPXMessagingUid || hostUid == KMPXUniEditorUid )
+        {
+        ret = ETrue;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Check if the host application is browser
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonUiHelper::IsHostBrowserL()
+    {
+    TBool ret( EFalse );
+    TInt hostUid = MPXTlsHelper::HostUid().iUid;
+    if ( hostUid == KMPXBrowserUid || hostUid == KMPXBrowserUid2 ) // browser
+        {
+        ret = ETrue;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Check if the host application is Podcasting Application
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonUiHelper::IsHostPodcastingAppL()
+    {
+    return MPXTlsHelper::HostUid().iUid == KPodcastingAppUid;
+    }
+
+// ---------------------------------------------------------------------------
+// Convert to displayable duration.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CMPXCommonUiHelper::DisplayableDurationL(
+    TInt64 aDuration,
+    TMPXDuratDisplayMode aMode )
+    {
+    TInt resId;
+    HBufC* format = NULL;
+    if ( aDuration >= KMPXOneHundredHoursInSecs )
+        {
+        resId = R_MPX_TIME_DURAT_HHHMMSS_WITH_ZERO;
+        format = StringLoader::LoadLC(
+            resId, aDuration / KMPXOneHourInSeconds );
+        }
+    else
+        {
+        resId = R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO;
+        if ( ( aMode == EMPXDuratHMS ) ||
+            ( aDuration >= KMPXOneHourInSeconds ) )
+            {
+            resId = R_QTN_TIME_DURAT_LONG_WITH_ZERO;
+            }
+        format = StringLoader::LoadLC( resId );
+        }
+
+    // Convert total playing time to texts.
+    TTime durTime( aDuration * KMPXOneSecInMicroSecs );
+
+    HBufC* buf =
+        HBufC::NewLC( format->Length() + KMPXDurationDisplayResvLen );
+    TPtr bufTPtr( buf->Des() );
+
+    durTime.FormatL( bufTPtr, *format );
+    AknTextUtils::LanguageSpecificNumberConversion( bufTPtr );
+    CleanupStack::Pop( buf );
+    CleanupStack::PopAndDestroy( format );
+
+    return buf;
+    }
+
+// ---------------------------------------------------------------------------
+// Convert to displayable duration in text format.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CMPXCommonUiHelper::DisplayableDurationInTextL(
+    TInt64 aDuration )
+    {
+    HBufC* buf = NULL;
+    TInt days = I64INT( aDuration / KMPXOneDayInSeconds );
+    TInt hours =
+        I64INT( ( aDuration % KMPXOneDayInSeconds ) /
+            KMPXOneHourInSeconds );
+    TInt mins =
+        I64INT( ( aDuration % KMPXOneHourInSeconds ) /
+            KMPXOneMinInSeconds );
+    TInt secs = I64INT( aDuration % KMPXOneMinInSeconds );
+
+    CArrayFix< TInt >* intArray =
+        new ( ELeave ) CArrayFixFlat<TInt>( 2 );  // magic number
+    CleanupStack::PushL( intArray );
+
+    if ( days > 1 && ( hours == 0 || hours > 1 ) )
+        {
+        intArray->AppendL( days );
+        intArray->AppendL( hours );
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_DAYS_HRS_TEXT, *intArray );
+        }
+    else if ( days > 1 && hours == 1 )
+        {
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_DAYS_HR_TEXT, days );
+        }
+    else if ( days == 1 && ( hours == 0 || hours > 1 ) )
+        {
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_DAY_HRS_TEXT, hours );
+        }
+    else if ( days == 1 && hours == 1 )
+        {
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_DAY_HR_TEXT );
+        }
+    else if ( hours > 1 &&  ( mins == 0 || mins > 1 ) )
+        {
+        intArray->AppendL( hours );
+        intArray->AppendL( mins );
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_HRS_MINS_TEXT, *intArray );
+        }
+    else if ( hours > 1 && mins == 1 )
+        {
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_HRS_MIN_TEXT, hours );
+        }
+    else if ( hours == 1 && ( mins == 0 || mins > 1 ) )
+        {
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_HR_MINS_TEXT, mins );
+        }
+    else if ( hours == 1 && mins == 1 )
+        {
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_HR_MIN_TEXT );
+        }
+    else if ( mins > 1 && ( secs == 0 || secs > 1 ) )
+        {
+        intArray->AppendL( mins );
+        intArray->AppendL( secs );
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_MINS_SECS_TEXT, *intArray );
+        }
+    else if ( mins > 1 && secs == 1 )
+        {
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_MINS_SEC_TEXT, mins );
+        }
+    else if ( mins == 1 && ( secs == 0 || secs > 1 ) )
+        {
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_MIN_SECS_TEXT, secs );
+        }
+    else if ( mins == 1 && secs == 1 )
+        {
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_MIN_SEC_TEXT );
+        }
+    else if ( secs > 1 )
+        {
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_SECS_TEXT, secs );
+        }
+    else
+        {
+        buf = StringLoader::LoadLC( R_MPX_CUI_TIME_SEC_TEXT );
+        }
+
+    TPtr bufPtr = buf->Des();
+    AknTextUtils::LanguageSpecificNumberConversion( bufPtr );
+    CleanupStack::Pop( buf );
+    CleanupStack::PopAndDestroy( intArray );
+
+    return buf;
+    }
+
+// ---------------------------------------------------------------------------
+// Set current file as ringing tone.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonUiHelper::DoSetAsRingingToneL(
+    const CMPXMedia& aMedia,
+    TBool aSetToAllProfiles,
+    TBool aShowQuery )
+    {
+    TInt rightsStatus( KErrNotFound );
+    TBool canSetAutomated( EFalse );
+    TBool okToSet( ETrue );
+    TBool isProtected( EFalse );
+
+    if ( aMedia.IsSupported ( KMPXMediaDrmProtected ) )
+        {
+        isProtected = aMedia.ValueTObjectL<TBool>( KMPXMediaDrmProtected );
+        }
+    if ( isProtected )
+        {
+        if ( aMedia.IsSupported ( KMPXMediaDrmRightsStatus ) )
+            {
+            rightsStatus = aMedia.ValueTObjectL<TInt>( KMPXMediaDrmRightsStatus );
+            }
+        if ( aMedia.IsSupported ( KMPXMediaDrmCanSetAutomated ) )
+            {
+            canSetAutomated = aMedia.ValueTObjectL<TBool>( KMPXMediaDrmCanSetAutomated );
+            }
+        }
+
+    if ( ( !isProtected ) || ( rightsStatus == EMPXDrmRightsFull )
+        || ( canSetAutomated ) )
+        {
+        if ( aShowQuery && aSetToAllProfiles )
+            {
+            // Show query only if set ringtone to all profiles and needed
+            CAknQueryDialog* query =
+                CAknQueryDialog::NewL( CAknQueryDialog::EConfirmationTone );
+            okToSet = query->ExecuteLD(
+                R_MPX_CHANGE_RT_FOR_ALL_CONFIRMATION_QUERY );
+            }
+
+        if ( okToSet )
+            {
+            TInt error( KErrNone );
+            TInt leaveError( KErrNone );
+            CProfileToneHandler* toneHandler = CProfileToneHandler::NewLC();
+
+            if ( aSetToAllProfiles )
+                {
+                MPX_TRAP( leaveError, error = toneHandler->SetToneForAllProfilesL(
+                        EProfileRingingToneSetting,
+                        aMedia.ValueText( KMPXMediaGeneralUri ) ) );
+                }
+            else
+                {
+                MPX_TRAP( leaveError, error = toneHandler->SetActiveProfileRingingToneL(
+                        aMedia.ValueText( KMPXMediaGeneralUri ) ) );
+                }
+            if ( leaveError != KErrNone )
+                {
+                error = leaveError;
+                }
+
+            CleanupStack::PopAndDestroy( toneHandler );
+
+            if ( KErrNone == error && !aSetToAllProfiles )
+                {
+                HBufC* text = StringLoader::LoadLC(
+                    R_MPX_RINGTONE_SET_TEXT, aMedia.ValueText(
+                        KMPXMediaGeneralTitle ) );
+                DisplayConfirmNoteL( *text );
+                CleanupStack::PopAndDestroy( text );
+                }
+            else if ( KErrPermissionDenied == error )
+                {
+                DisplayInfoNoteL( R_MPX_RINGTONE_UNPROTECTED_FILE_TEXT );
+                }
+            else if ( KErrArgument == error ||
+                      KErrAccessDenied == error )
+                {
+                DisplayInfoNoteL( R_MPX_RINGTONE_NOT_ALLOWED_TEXT );
+                }
+            else if ( KErrNotFound == error )
+                {
+                DisplayInfoNoteL( R_MPX_FILE_NOT_FOUND_TEXT );
+                }
+            else
+                {
+                // do nothing
+                }
+            }
+        }
+    else
+        {
+        DisplayInfoNoteL( R_MPX_DRM_PREV_RIGHTS_SET );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Check if current profile mode is offline mode.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonUiHelper::IsProfileOfflineModeL()
+    {
+    TBool isOfflineMode( EFalse );
+    MProfileEngine* profileEngine;
+    profileEngine = CreateProfileEngineL();
+
+    if ( profileEngine->ActiveProfileId() == EProfileOffLineId )
+        {
+        isOfflineMode = ETrue;
+        }
+    profileEngine->Release();
+
+    return isOfflineMode;
+    }
+
+// -----------------------------------------------------------------------------
+// Returns a path of the default drive used for saving playlists, ringtones,
+// downloads and attachments.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CMPXCommonUiHelper::DefaultDriveLC()
+    {
+#ifdef RD_MULTIPLE_DRIVE
+    // Use an internal mass storage drive as the default drive. If no internal
+    // drive (other than the phone memory) exists, use an external drive.
+    // Otherwise use the phone memory.
+    RFs& fs = CEikonEnv::Static()->FsSession();
+    TDriveList driveList;
+    TInt driveCount(0);
+    TInt defaultInternalDrive(0);
+    TInt defaultExternalDrive(0);
+    TBool foundInternalDrive(EFalse);
+    TBool foundExternalDrive(EFalse);
+    User::LeaveIfError( DriveInfo::GetUserVisibleDrives(
+        fs, driveList, driveCount ) );
+
+    for( TInt driveNum = EDriveA;
+        ( driveNum <= EDriveZ ) && !foundInternalDrive;
+        driveNum++ )
+        {
+        if ( driveList[driveNum] && ( driveNum != EDriveC ) ) // ignore C: drive
+            {
+            // Get the drive status
+            TUint driveStatus(0);
+            DriveInfo::GetDriveStatus( fs, driveNum, driveStatus );
+
+            if ( driveStatus & DriveInfo::EDriveInternal )
+                {
+                defaultInternalDrive = driveNum;
+                foundInternalDrive = ETrue;
+                } // internal mass store drive
+            else if ( !foundExternalDrive &&
+                (driveStatus &
+                (DriveInfo::EDriveRemovable | DriveInfo::EDriveRemote)) )
+                {
+                TVolumeInfo volumeInfo;
+                TInt errCode = fs.Volume( volumeInfo, driveNum );
+                if( errCode == KErrNone )
+                    {
+                    //driveNum is really ready for use      
+                    defaultExternalDrive = driveNum;
+                    foundExternalDrive = ETrue;    
+                    }
+                } // external drive
+            } // if (available drive)
+        } // for (all available drives)
+
+    // Use the internal drive, external drive or phone memory as the default
+    // path
+    HBufC* defaultRootPath = HBufC::NewLC( 10 );
+    TPtr pathPtr( defaultRootPath->Des() );
+    if ( foundInternalDrive )
+        {
+        User::LeaveIfError(
+            PathInfo::GetRootPath( pathPtr, defaultInternalDrive ) );
+        }
+    else if ( foundExternalDrive )
+        {
+        User::LeaveIfError(
+            PathInfo::GetRootPath( pathPtr, defaultExternalDrive ) );
+        }
+    else // use phone memory path
+        {
+        pathPtr.Copy( PathInfo::PhoneMemoryRootPath() );
+        }
+
+    MPX_DEBUG2("CMPXCommonUiHelper::DefaultDriveLC - path = %S", &pathPtr);
+#else
+    HBufC* defaultRootPath = NULL;
+    // Default drive used for saving playlists, etc
+    // is as following:
+    // 1. if E: drive exists ( MMC card inserted )
+    //    playlist will be saved on the E: drive unless
+    //    ( mmc is locked, readonly, or below critical disk space)
+    // 2. E drive is not present ( MMC card ejected ), save the
+    //    playlist on the phone memory instead.
+
+    TChar drive;
+    if ( !IsMemoryCardWritable( drive ) )
+        {
+        // load phone memory root path
+        defaultRootPath = StringLoader::LoadLC(
+            R_MPX_CUI_PHONE_MEMORY_ROOT_PATH );
+        }
+    else
+        {
+        defaultRootPath = HBufC::NewLC( 10 );
+        TPtr ptr( defaultRootPath->Des() );
+        ptr.Append( drive );
+        ptr.Append( KDriveFormatString );
+        }
+#endif // RD_MULTIPLE_DRIVE
+    return defaultRootPath;
+    }
+
+// -----------------------------------------------------------------------------
+// Returns a path of the next available drive used for saving playlists, ringtones,
+// downloads and attachments. The order of priority is internal mass store,
+// MMC, then phone memory.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CMPXCommonUiHelper::AvailableDriveLC( TInt aSize )
+    {
+#ifdef RD_MULTIPLE_DRIVE
+    // Use an available mass storage drive (other than the phone memory). If
+    // none exists, use an external drive. Otherwise use the phone memory.
+    RFs& fs = CEikonEnv::Static()->FsSession();
+    TDriveList driveList;
+    TInt driveCount(0);
+    TInt availableInternalDrive(0);
+    TInt availableExternalDrive(0);
+    TBool foundInternalDrive(EFalse);
+    TBool foundExternalDrive(EFalse);
+    User::LeaveIfError( DriveInfo::GetUserVisibleDrives(
+        fs, driveList, driveCount ) );
+
+    for( TInt driveNum = EDriveA;
+        ( driveNum <= EDriveZ ) && !foundInternalDrive;
+        driveNum++ )
+        {
+        if ( driveList[driveNum] && ( driveNum != EDriveC ) ) // ignore C: drive
+            {
+            // Get the drive status
+            TUint driveStatus(0);
+            DriveInfo::GetDriveStatus( fs, driveNum, driveStatus );
+
+            if ( driveStatus & DriveInfo::EDriveInternal )
+                {
+                // Ensure there is enough disk space for the file
+                TBool internalDriveBelowCritical = EFalse;
+                MPX_TRAPD( err, internalDriveBelowCritical =
+                    SysUtil::DiskSpaceBelowCriticalLevelL(
+                    &fs, aSize, driveNum ) );
+                if ( internalDriveBelowCritical )
+                    {
+                    MPX_DEBUG2("CMPXCommonUiHelper::AvailableDriveLC - Internal drive below critical driveNum=%d", driveNum);
+                    }
+                else if ( err == KErrNone )
+                    {
+                    availableInternalDrive = driveNum;
+                    foundInternalDrive = ETrue;
+                    }
+                } // internal mass store drive
+            else if ( !foundExternalDrive &&
+                (driveStatus &
+                (DriveInfo::EDriveRemovable | DriveInfo::EDriveRemote)) )
+                {
+                TBool externalDriveBelowCritical = EFalse;
+                MPX_TRAPD( err, externalDriveBelowCritical =
+                    SysUtil::DiskSpaceBelowCriticalLevelL(
+                    &fs, aSize, driveNum ) );
+                if ( externalDriveBelowCritical )
+                    {
+                    MPX_DEBUG2("CMPXCommonUiHelper::AvailableDriveLC - External drive below critical driveNum=%d", driveNum);
+                    }
+                else if ( err == KErrNone )
+                    {
+                    availableExternalDrive = driveNum;
+                    foundExternalDrive = ETrue;
+                    }
+                } // external drive
+            } // if (available drive)
+        } // for (all available drives)
+
+    // Use the internal drive, external drive or phone memory as the default
+    // path
+    HBufC* defaultRootPath = HBufC::NewLC( 10 );
+    TPtr pathPtr( defaultRootPath->Des() );
+    if ( foundInternalDrive )
+        {
+        User::LeaveIfError(
+            PathInfo::GetRootPath( pathPtr, availableInternalDrive ) );
+        }
+    else if ( foundExternalDrive )
+        {
+        User::LeaveIfError(
+            PathInfo::GetRootPath( pathPtr, availableExternalDrive ) );
+        }
+    else // use phone memory path
+        {
+        pathPtr.Copy( PathInfo::PhoneMemoryRootPath() );
+        }
+
+    MPX_DEBUG2("CMPXCommonUiHelper::AvailableDriveLC - path = %S", &pathPtr);
+    return defaultRootPath;
+#else
+    (void) aSize;
+    return NULL;
+#endif // RD_MULTIPLE_DRIVE
+    }
+
+// -----------------------------------------------------------------------------
+// Display information note
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonUiHelper::DisplayInfoNoteL( TInt aResourceId )
+    {
+    HBufC* text = StringLoader::LoadLC( aResourceId );
+    DisplayInfoNoteL( *text );
+    CleanupStack::PopAndDestroy( text );
+    }
+
+// -----------------------------------------------------------------------------
+// Display information note
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonUiHelper::DisplayInfoNoteL( const TDesC& aText )
+    {
+    CAknInformationNote* dlg = new ( ELeave ) CAknInformationNote( ETrue );
+    dlg->ExecuteLD( aText );
+    }
+
+// -----------------------------------------------------------------------------
+// Display confirmation note
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonUiHelper::DisplayConfirmNoteL( TInt aResourceId )
+    {
+    HBufC* text = StringLoader::LoadLC( aResourceId );
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+    DisplayConfirmNoteL( *text, aResourceId );
+//#else
+//    DisplayConfirmNoteL( *text );
+//#endif // __COVER_DISPLAY
+// CoverUI end
+
+    CleanupStack::PopAndDestroy( text );
+    }
+
+// -----------------------------------------------------------------------------
+// Display confirmation note
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonUiHelper::DisplayConfirmNoteL( const TDesC& aText )
+    {
+    CAknConfirmationNote* dlg = new ( ELeave ) CAknConfirmationNote( ETrue );
+    dlg->ExecuteLD( aText );
+    }
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+// -----------------------------------------------------------------------------
+// Display confirmation note
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonUiHelper::DisplayConfirmNoteL(
+    const TDesC& aText,
+    TInt aResourceId )
+    {
+    CAknConfirmationNote* dlg = new ( ELeave ) CAknConfirmationNote( ETrue );
+
+    CleanupStack::PushL( dlg );
+    if ( aResourceId == R_MPX_SAVED_TO_COLLECTION_NOTE )
+        {
+        dlg->PublishDialogL(
+            EMPlayerNoteSavedtoCollection,
+            KMPlayerNoteCategory);
+        }
+    else if ( aResourceId == R_MPX_SAVED_NOTE )
+        {
+        dlg->PublishDialogL(
+            EMPlayerNoteSavedtoGallery,
+            KMPlayerNoteCategory);
+        }
+    CleanupStack::Pop( dlg );
+
+    dlg->ExecuteLD( aText );
+    }
+//#endif // __COVER_DISPLAY
+// Cover UI end
+
+// -----------------------------------------------------------------------------
+// Convert a value from bytes to kB/MB/GB.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CMPXCommonUiHelper::UnitConversionL( TInt64 aByte, TBool aFree )
+    {
+    HBufC* res = NULL;
+
+    if ( aByte >= 0 && aByte < KMPXOneKB ) // unit is B
+        {
+        if ( aFree )
+            {
+            res = StringLoader::LoadLC( R_MPX_CUI_MEMORY_B_FREE, aByte );
+            }
+        else
+            {
+            res = StringLoader::LoadLC( R_MPX_CUI_MEMORY_B, aByte );
+            }
+        }
+    else // unit is larger than a byte and must be displayed with decimal
+        {
+        TReal memoryUnitSize;
+        TInt memoryUnitResId;
+
+        if ( aByte >= KMPXOneKB && aByte < KMPXOneMB ) // unis is kB
+            {
+            memoryUnitSize = KMPXOneKB;
+            if ( aFree)
+                {
+                memoryUnitResId = R_MPX_CUI_MEMORY_KB1_FREE;
+                }
+            else
+                {
+                memoryUnitResId = R_MPX_CUI_MEMORY_KB;
+                }
+            }
+        else if ( aByte >= KMPXOneMB && aByte < KMPXOneGB ) // unit is MB
+            {
+            memoryUnitSize = KMPXOneMB;
+            if ( aFree )
+                {
+                memoryUnitResId = R_MPX_CUI_MEMORY_MB1_FREE;
+                }
+            else
+                {
+                memoryUnitResId = R_MPX_CUI_MEMORY_MB;
+                }
+            }
+        else // unit is GB
+            {
+            memoryUnitSize = KMPXOneGB;
+            if ( aFree )
+                {
+                memoryUnitResId = R_MPX_CUI_MEMORY_GB1_FREE;
+                }
+            else
+                {
+                memoryUnitResId = R_MPX_CUI_MEMORY_GB;
+                }
+            }
+
+        TBuf<KMPXMaxBufferLen> sizeBuf;
+        TRealFormat format = TRealFormat( KMPXWidthOfChar, KMPXDecimalPlaces );
+        TReal tmpValue = ( I64REAL(aByte) / memoryUnitSize );
+        sizeBuf.AppendNum( tmpValue, format );
+        if ( User::Language() == ELangArabic )
+            {
+            sizeBuf.Append( KRightToLeftMark );
+            }
+        res = StringLoader::LoadLC( memoryUnitResId, sizeBuf );
+        }
+    CleanupStack::Pop( res );
+    return res;
+    }
+
+// -----------------------------------------------------------------------------
+// Finds all user playlists in the given collection
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXMedia* CMPXCommonUiHelper::FindPlaylistsL()
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::FindPlaylistsL" );
+
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    attrs.Append( KMPXMediaGeneralTitle );
+    attrs.Append( KMPXMediaGeneralId );
+    attrs.Append( KMPXMediaGeneralFlags );
+
+    CMPXMedia* ret = FindAllL( EMPXPlaylist, attrs.Array() );
+    CleanupStack::PopAndDestroy( &attrs );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Add to saved playlist
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonUiHelper::AddToSavedPlaylistL(
+    const CMPXMedia& aPlaylists, const CMPXMedia& aTracks,
+    MMPXCHelperObserver* aObserver, MProgressDialogCallback* aCallback )
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::AddToSavedPlaylistL" );
+
+    TBool ret( EFalse );
+
+    const CMPXMediaArray* mediaArray =
+        aPlaylists.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+    User::LeaveIfNull( const_cast<CMPXMediaArray*>( mediaArray ));
+
+    TInt count( 0 );
+    if ( mediaArray )
+        {
+        count = mediaArray->Count();
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+
+    if ( count < 1)
+        {
+        User::Leave( KErrArgument );
+        }
+    else
+        {
+        TInt index = 0;
+        CAknListQueryDialog* queryDlg =
+            new ( ELeave ) CAknListQueryDialog( &index );
+        queryDlg->PrepareLC( R_MPX_CUI_PLAYLIST_QUERY_LIST );
+
+//#ifdef __COVER_DISPLAY
+        queryDlg->PublishDialogL(
+            EMPlayerQuerySelectPlaylist, KMPlayerNoteCategory );
+//#endif //__COVER_DISPLAY
+
+        // Get the text array from the listbox model
+        CTextListBoxModel* lbxModel =
+            static_cast<CTextListBoxModel*>( queryDlg->ListBox()->Model() );
+        CDesCArray* descArray =
+            static_cast<CDesCArray*>( lbxModel->ItemTextArray() );
+        descArray->Reset();
+
+        // Set up icon array
+        CAknIconArray* icons = new ( ELeave ) CAknIconArray( 1 ); // magic: icon count
+        CleanupStack::PushL( icons );
+        TParse mbmFileName;
+        mbmFileName.Set( KMPXCommonUiIconFile,
+            &KDC_APP_RESOURCE_DIR, NULL );
+        TFileName iconFile( mbmFileName.FullName() );
+        User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+        CFbsBitmap* bitmap = NULL;
+        CFbsBitmap* mask = NULL;
+        AknsUtils::CreateColorIconLC(
+            AknsUtils::SkinInstance(), // aInstance
+            KAknsIIDQgnIndiMmcAdd,     // aID
+            KAknsIIDQsnIconColors,      // aColorID
+            EAknsCIQsnIconColorsCG26,   // aColorIndex
+            bitmap,
+            mask,
+            iconFile,
+            EMbmMpxcommonuiQgn_indi_mmc_add,
+            EMbmMpxcommonuiQgn_indi_mmc_add_mask,
+            KRgbBlack );                // aDefaultColor
+        CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+        icon->SetBitmapsOwnedExternally( EFalse );
+
+        // icon now owns the bitmaps, no need to keep on cleanup stack.
+        CleanupStack::Pop(2); // mask, bitmap
+        bitmap = NULL;
+        mask = NULL;
+        CleanupStack::PushL( icon );
+        icons->AppendL( icon );
+        queryDlg->SetIconArrayL(icons);
+        CleanupStack::Pop( icon );
+        CleanupStack::Pop( icons );
+
+        TInt mmc = MMCDriveNumber();
+        // Prepare for query dialog
+        for ( TInt i = 0; i < count; i++ )
+            {
+            CMPXMedia* media( mediaArray->AtL( i ));
+            TUint flags( 0 );
+            TRAP_IGNORE(flags = media->ValueTObjectL<TUint>( KMPXMediaGeneralFlags ))
+            TInt driveNum = ( ( flags ) & ( KMPXMediaGeneralFlagsDriveInfo ) );
+            HBufC* line = NULL;
+            HBufC* title = media->ValueText( KMPXMediaGeneralTitle ).AllocLC();
+
+            if( driveNum == mmc )
+                {
+                line = HBufC::NewLC(
+                    KMPXAddToPlaylistMemoryCardIcon().Length() +
+                    title->Length() );
+                TPtr linePtr = line->Des();
+                linePtr += *title;
+                linePtr.Append( KMPXAddToPlaylistMemoryCardIcon );
+                }
+            else
+                {
+                line = title->AllocLC();
+                }
+            descArray->AppendL( *line );
+            CleanupStack::PopAndDestroy( line );
+            CleanupStack::PopAndDestroy( title );
+            }
+
+        if ( queryDlg->RunLD() )
+            {
+            if ( index >= 0 )
+                {
+                CMPXMedia* media( mediaArray->AtL( index ));
+                TMPXItemId playlistId =
+                    media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+                const CMPXMediaArray* tracksArray =
+                    aTracks.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+                User::LeaveIfNull( const_cast<CMPXMediaArray*>( tracksArray ));
+                if ( tracksArray->Count() < 1 )
+                    {
+                    User::Leave( KErrArgument );
+                    }
+                else
+                    {
+                    if ( tracksArray->Count() == 1 )
+                        {
+                        HBufC* text = StringLoader::LoadLC(
+                            R_MPX_QTN_NMP_NOTE_ADDING_ONE_SONG );
+                        ShowWaitNoteL( *text,
+                            R_AVKON_SOFTKEYS_EMPTY, ETrue, aCallback );
+                        CleanupStack::PopAndDestroy( text );
+                        }
+                    else
+                        {
+                        HBufC* text = StringLoader::LoadLC(
+                            R_MPX_QTN_MUS_NOTE_ADDING_TRACKS );
+                        ShowWaitNoteL( *text,
+                            R_MPX_WAITNOTE_SOFTKEYS_EMPTY_STOP, ETrue, aCallback );
+                        CleanupStack::PopAndDestroy( text );
+                        }
+                    CMPXMedia* media = CMPXMedia::NewL();
+                    CleanupStack::PushL( media );
+                    media->SetTObjectValueL<TMPXItemId>(
+                        KMPXMediaGeneralId, playlistId );
+                    media->SetTObjectValueL<TMPXGeneralType>(
+                        KMPXMediaGeneralType, EMPXItem );
+                    media->SetTObjectValueL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory, EMPXPlaylist );
+                    media->SetCObjectValueL(
+                        KMPXMediaArrayContents,
+                        const_cast<CMPXMediaArray*>(tracksArray ));
+                    media->SetTObjectValueL(
+                        KMPXMediaArrayCount, tracksArray->Count() );
+
+                    RArray<TUid> ary;
+                    CleanupClosePushL( ary );
+                    ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) );
+                    TUid musicCollection = iCollectionUtility->CollectionIDL( ary.Array() );
+                    CleanupStack::PopAndDestroy( &ary );
+
+                    media->SetTObjectValueL<TUid>( KMPXMediaGeneralCollectionId, musicCollection );
+
+                    if ( !iCollectionUiHelper )
+                        {
+                        iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+                        }
+                    iCollectionUiHelper->IncAddL( *media, aObserver, KMPXChunkSize );
+                    ret = ETrue;
+                    CleanupStack::PopAndDestroy( media );
+                    }
+                }
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Create playlist
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonUiHelper::CreatePlaylistL(
+    const CMPXMedia& aTracks, MMPXCHelperObserver* aObserver,
+    MProgressDialogCallback* aCallback )
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::CreatePlaylistL" );
+
+    RFs& fs = CEikonEnv::Static()->FsSession();
+    HBufC* playlistName = HBufC::NewLC( KMaxFileName );
+    TPtr playlistNamePtr = playlistName->Des();
+    const TInt playListSize = 8;
+
+#ifdef RD_MULTIPLE_DRIVE
+    // Create playlist on the next available drive (internal mass store,
+    // MMC or phone memory)
+    HBufC* defaultRootPath = AvailableDriveLC( playListSize );
+    playlistNamePtr = *defaultRootPath;
+    CleanupStack::PopAndDestroy( defaultRootPath );
+#else
+    HBufC* defaultRootPath = DefaultDriveLC();
+    playlistNamePtr = *defaultRootPath;
+    CleanupStack::PopAndDestroy( defaultRootPath );
+
+    if ( playlistNamePtr.CompareF( PathInfo::MemoryCardRootPath() ) == 0 )
+        {
+        // only if memory card is supported, check if there is enough space
+        // on the card.
+        TBool isBelowCritical = EFalse;
+        MPX_TRAPD( err, isBelowCritical = SysUtil::MMCSpaceBelowCriticalLevelL(
+            &fs, playListSize ) );
+        if ( err || isBelowCritical )
+            {
+            MPX_DEBUG1( "CMPXCommonUiHelper::CreatePlaylistL Error in MMC, default path changed to phone memory" );
+            playlistNamePtr = PathInfo::PhoneMemoryRootPath();
+            }
+        }
+#endif // RD_MULTIPLE_DRIVE
+
+    HBufC* defaultPath =
+        StringLoader::LoadLC( R_MPX_CUI_TARGETFOLDER_PLAYLIST );
+    playlistNamePtr += *defaultPath;
+    CleanupStack::PopAndDestroy( defaultPath );
+
+    TBool ret( PlaylistCreationQueriesL( playlistNamePtr ) );
+    if ( ret )
+        {
+        MPX_DEBUG2( "CMPXCommonUiHelper::CreatePlaylistL Saving playlist %S", &playlistNamePtr );
+        const CMPXMediaArray* tracksArray =
+            aTracks.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+        User::LeaveIfNull( const_cast<CMPXMediaArray*>( tracksArray ));
+        if ( tracksArray->Count() == 1 )
+            {
+            HBufC* text = StringLoader::LoadLC(
+                R_MPX_QTN_NMP_NOTE_ADDING_ONE_SONG );
+            ShowWaitNoteL( *text,
+                R_AVKON_SOFTKEYS_EMPTY, ETrue, aCallback );
+            CleanupStack::PopAndDestroy( text );
+            }
+        else if ( tracksArray->Count() > 0 )
+            {
+            // only show wait note if we're adding more than 1 song
+            HBufC* text = StringLoader::LoadLC(
+                R_MPX_QTN_MUS_NOTE_ADDING_TRACKS );
+            ShowWaitNoteL( *text,
+                R_MPX_WAITNOTE_SOFTKEYS_EMPTY_STOP, ETrue, aCallback );
+            CleanupStack::PopAndDestroy( text );
+            }
+
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL( media );
+        media->SetTObjectValueL<TMPXGeneralType>(
+            KMPXMediaGeneralType, EMPXItem );
+        media->SetTObjectValueL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory, EMPXPlaylist );
+        TParsePtrC fn( playlistNamePtr );
+        // no extension in virtual playlist, all "extension" are inputed
+        // by users as a valid name
+        media->SetTextValueL(
+            KMPXMediaGeneralTitle, fn.NameAndExt() );
+
+        media->SetCObjectValueL(
+            KMPXMediaArrayContents,
+            const_cast<CMPXMediaArray*>(tracksArray ) );
+        media->SetTObjectValueL(
+            KMPXMediaArrayCount, tracksArray->Count() );
+        media->SetTextValueL(
+            KMPXMediaGeneralUri, fn.DriveAndPath() ); // exculde the file name
+        // new playlist
+        if ( !iCollectionUiHelper )
+            {
+            iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+            }
+        iCollectionUiHelper->IncAddL( *media, aObserver, KMPXChunkSize );
+        CleanupStack::PopAndDestroy( media );
+        }
+    CleanupStack::PopAndDestroy( playlistName );
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Launch rename dialog
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXCommonUiHelper::LaunchRenameDialogL(
+    const TDesC& aOldName,
+	TDes& aNewName,
+	const TDesC& aPath )
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::LaunchRenameDialogL" );
+    CMPXFileNameQueryDlg* renameDlg = CMPXFileNameQueryDlg::NewL(
+        aOldName, aNewName, aPath, EMPXPlaylist, this );
+    TInt ret = renameDlg->ExecuteLD( R_MPX_FILE_NAME_QUERY );
+
+    if ( ret )
+        {
+        if ( aNewName.CompareF( aOldName ) == 0 )
+            {
+            ret = EFalse;
+            }
+        else
+            {
+            if ( !iCollectionUiHelper )
+                {
+                iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+                }
+            if ( iCollectionUiHelper->TitleExistsL( EMPXPlaylist, aNewName, EMPXOtherType ) )
+                {
+                HBufC* info = StringLoader::LoadLC( R_MPX_PLAYLIST_NAME_EXIST, aNewName );
+
+                if( CEikonEnv::Static()->QueryWinL( KNullDesC, *info ) )
+                    {
+                    if ( !LaunchRenameDialogL( aOldName, aNewName, aPath ) )
+                        {
+                        ret = EFalse;
+                        }
+                    }
+                else
+                    {
+                    ret = EFalse;
+                    }
+                CleanupStack::PopAndDestroy( info );//query ,info
+                }
+            }
+        }
+    
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Shows wait note
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonUiHelper::ShowWaitNoteL( TDesC& aText, TInt aCBAId,
+    TBool aVisibilityDelayOff, MProgressDialogCallback* aCallback, TInt aResId )
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::ShowWaitNoteL" );
+    if( iWaitDialog )
+        {
+        // if wait note is already running
+        // cancel it and recreate will have timing issues
+        if ( aCallback )
+            {
+            iWaitDialog->SetCallback( aCallback );
+            }
+        iWaitDialog->SetTextL( aText );
+        MEikButtonGroup* buttonGroup =
+            iWaitDialog->ButtonGroupContainer().ButtonGroup();
+        if ( aCBAId )
+            {
+            buttonGroup->SetCommandSetL( aCBAId );
+            }
+        buttonGroup->AsControl()->DrawDeferred();
+        iWaitDialog->DrawDeferred();
+        }
+    else
+        {
+        iWaitDialog = new ( ELeave ) CAknWaitDialog(
+            ( CEikDialog** )&iWaitDialog, aVisibilityDelayOff );
+        if ( aCallback )
+            {
+            iWaitDialog->SetCallback( aCallback );
+            }
+        iWaitDialog->PrepareLC( aResId );
+        iWaitDialog->SetTextL( aText );
+        MEikButtonGroup* buttonGroup =
+            iWaitDialog->ButtonGroupContainer().ButtonGroup();
+        if ( aCBAId )
+            {
+            buttonGroup->SetCommandSetL( aCBAId );
+            }
+        buttonGroup->AsControl()->DrawDeferred();
+        iWaitDialog->RunLD();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Dismiss wait note
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonUiHelper::DismissWaitNoteL()
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::DismissWaitNoteL" );
+    if( iWaitDialog )
+        {
+        iWaitDialog->ProcessFinishedL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handles displaying the error message for given error code
+// according to the media object provided
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXCommonUiHelper::HandleErrorL(
+    TInt aError,
+    const CMPXMedia* aMedia, /*=NULL*/
+    RFile* aFile /*=NULL*/ )
+    {
+    MPX_DEBUG2("CMPXCommonUiHelper::HandleErrorL(%d) entering", aError);
+
+    TBool usingGlobalNote = EFalse; // To use CAknGlobalNote if necessary
+    TInt ret( KErrNone );
+    CTextResolver* textResolver( NULL );
+    HBufC* errorText( NULL );
+    switch ( aError )
+        {
+        case KMPXRightsAboutToExpire:
+        case KErrCANotSupported:
+        case KErrCANoPermission:
+        case KErrCANoRights:
+        case KErrCANoAgent:
+        case KErrCAOutOfRange:
+        case KErrCAPendingRights:
+        case KErrCASizeNotDetermined:
+        case KErrCANewFileHandleRequired:
+            {
+            TRAPD(err, ret = iMpxDrmHelper->HandleDrmErrorL( aError, aMedia, aFile ));
+            if (err)
+                {
+                ret = err;
+                if ( ret == KErrArgument )
+                    // If error is KErrArgument, map it to R_MPX_INVALID_CLIP
+                    errorText = StringLoader::LoadLC( R_MPX_INVALID_CLIP );
+                else
+                    {
+                    // TextResolver instance for error resolving.
+                    textResolver = CTextResolver::NewLC();
+                    // Resolve the error text
+                    const TDesC& text =
+                        textResolver->ResolveErrorString( ret );
+                    errorText = text.AllocLC();
+                    }
+                }
+            break;
+            }
+        case KMPXAllTracksInvalid:
+            {
+            errorText =
+                StringLoader::LoadLC( R_MPX_INVALID_GROUP_TEXT );
+            break;
+            }
+        case KErrNotSupported:
+        case KErrCorrupt:
+            {
+            errorText = StringLoader::LoadLC( R_MPX_INVALID_CLIP );
+            break;
+            }
+        case KErrAccessDenied:
+            {
+            if ( aMedia )
+                {
+                if ( aMedia->IsSupported( KMPXMediaDrmType ) )
+                    {
+                    TMPXMediaDrmType type =
+                        aMedia->ValueTObjectL<TMPXMediaDrmType>( KMPXMediaDrmType );
+                    if ( EMPXDrmTypeOMA == type )
+                        {
+                        errorText = StringLoader::LoadLC( R_MPX_NO_DRM_OVER_BT );
+                        break;
+                        }
+                    }
+                }
+            // fall through on purpose to use default handling
+            // if error was not handled above
+            }
+        case KMPXErrorVideoCall:
+            {
+            errorText = StringLoader::LoadLC( R_MPX_VIDEO_CALL_ONGOING );
+            usingGlobalNote = ETrue;
+            break;
+            }
+        case KErrLocked:
+            errorText = StringLoader::LoadLC( R_MPX_CANNOT_PROCEED_WITH_OPERATION );
+            break;
+        case KErrDisMounted:
+        	break;
+        case KErrDiskFull:
+        case KSQLErrGeneral:
+            errorText = StringLoader::LoadLC( R_MPX_CUI_MEMLO_NOT_ENOUGH_MEMORY );
+            break;
+        default:
+            {
+            // TextResolver instance for error resolving.
+            textResolver = CTextResolver::NewLC();
+            // Resolve the error text
+            const TDesC& text =
+                textResolver->ResolveErrorString( aError );
+            errorText = text.AllocLC();
+            break;
+            }
+        }
+
+    if ( errorText )
+        {
+        if ( !usingGlobalNote )
+            {
+            CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+            dlg->ExecuteLD( *errorText );
+            }
+        else
+            {
+            // CAknErrorNote will not display when mpx is not currently foreground, 
+            // so if necessary, use CAknGlobalNote to replace it.
+            CAknGlobalNote* globalInfoNote = CAknGlobalNote::NewLC();
+            globalInfoNote->ShowNoteL(
+                    EAknGlobalInformationNote,
+                    errorText->Des() );
+            CleanupStack::PopAndDestroy( globalInfoNote );
+            }
+        CleanupStack::PopAndDestroy( errorText );
+        }
+    if ( textResolver )
+        {
+        CleanupStack::PopAndDestroy( textResolver );
+        }
+
+    MPX_DEBUG2("CMPXCommonUiHelper::HandleErrorL() exiting, returning %d", ret);
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets middle softkey label.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonUiHelper::SetMiddleSoftKeyLabelL(
+    CEikButtonGroupContainer& aCba,
+    TInt aResourceId,
+    TInt aCommandId )
+    {
+#ifdef __ENABLE_MSK
+    MPX_FUNC( "CMPXCommonUiHelper::SetMiddleSoftKeyLabelL" );
+    aCba.RemoveCommandFromStack(
+        CEikButtonGroupContainer::EMiddleSoftkeyPosition,
+        aCba.ButtonGroup()->CommandId(
+            CEikButtonGroupContainer::EMiddleSoftkeyPosition ) );
+    HBufC* middleSKText = StringLoader::LoadLC( aResourceId );
+    TPtr mskPtr = middleSKText->Des();
+    aCba.AddCommandToStackL(
+        CEikButtonGroupContainer::EMiddleSoftkeyPosition,
+        aCommandId,
+        mskPtr );
+    CleanupStack::PopAndDestroy( middleSKText );
+#else
+    (void)aCba;
+    (void)aResourceId;
+    (void)aCommandId;
+    User::Leave( KErrNotSupported );
+#endif // __ENABLE_MSK
+    }
+
+// ---------------------------------------------------------------------------
+// Removes middle softkey label.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonUiHelper::RemoveMiddleSoftKeyLabel(
+    CEikButtonGroupContainer& aCba )
+    {
+#ifdef __ENABLE_MSK
+    MPX_FUNC( "CMPXCommonUiHelper::RemoveMiddleSoftKeyLabel" );
+    aCba.RemoveCommandFromStack(
+        CEikButtonGroupContainer::EMiddleSoftkeyPosition,
+        aCba.ButtonGroup()->CommandId(
+            CEikButtonGroupContainer::EMiddleSoftkeyPosition ) );
+    TRAP_IGNORE( aCba.AddCommandToStackL(
+        CEikButtonGroupContainer::EMiddleSoftkeyPosition,
+        EAknSoftkeyEmpty, // no action
+        KNullDesC() ) ); // empty label
+
+#else
+    (void)aCba;
+    ASSERT(0);
+#endif // __ENABLE_MSK
+    }
+
+// ---------------------------------------------------------------------------
+// Sets middle softkey icon.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonUiHelper::SetMiddleSoftKeyIconL(
+    CEikButtonGroupContainer& aCba,
+    CFbsBitmap* aBitmap,
+    CFbsBitmap* aMask )
+    {
+#ifdef __ENABLE_MSK
+    MPX_FUNC( "CMPXCommonUiHelper::SetMiddleSoftKeyIconL" );
+    aCba.RemoveCommandFromStack(
+        CEikButtonGroupContainer::EMiddleSoftkeyPosition,
+        aCba.ButtonGroup()->CommandId(
+            CEikButtonGroupContainer::EMiddleSoftkeyPosition ) );
+    aCba.AddCommandToStackL(
+        CEikButtonGroupContainer::EMiddleSoftkeyPosition,
+        EAknSoftkeyContextOptions,
+        *aBitmap,
+        *aMask );
+
+#else
+    (void)aCba;
+    (void)aBitmap;
+    (void)aMask;
+    User::Leave( KErrNotSupported );
+#endif // __ENABLE_MSK
+    }
+
+// ---------------------------------------------------------------------------
+// Generate the next available title from the given title
+// ---------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CMPXCommonUiHelper::GenerateTitleL( TMPXGeneralCategory aCategory,
+                                                    const TDesC& aBaseTitle )
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::GenerateTitleL" );
+
+    //
+    // Find titles of all playlists in the collection
+    //
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    attrs.Append( KMPXMediaGeneralTitle );
+
+    CMPXMedia* results = FindAllL(aCategory, attrs.Array());
+    CleanupStack::PopAndDestroy(&attrs);
+    CleanupStack::PushL(results);
+
+    if (!results->IsSupported(KMPXMediaArrayContents))
+        {
+        User::Leave(KErrArgument);
+        }
+    const CMPXMediaArray* resultArray = results->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+    User::LeaveIfNull( const_cast<CMPXMediaArray*>( resultArray ));
+
+    //
+    // shorten this list by removing those that do not contain this pattern:
+    // aBaseTitle(*)
+    //
+    HBufC* matchingPattern = HBufC::NewLC(aBaseTitle.Length()+KWildCardCharacter().Length()+2);
+    matchingPattern->Des().Format(KAutoNamingFormat, &aBaseTitle, &KWildCardCharacter);
+
+    CMPXMediaArray* medias = CMPXMediaArray::NewL();
+    CleanupStack::PushL(medias);
+
+    TInt count(resultArray->Count());
+
+    for (TInt i=0; i<count; i++)
+        {
+        const CMPXMedia* media( resultArray->AtL( i ));
+
+        if (!media->IsSupported(KMPXMediaGeneralTitle))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        if (media->ValueText(KMPXMediaGeneralTitle).Match(*matchingPattern) != KErrNotFound)
+            {
+            medias->AppendL(*media);
+            }
+        }
+
+    CleanupStack::Pop(medias);
+    CleanupStack::PopAndDestroy(2, results); // matchingPattern & results
+    CleanupStack::PushL(medias);
+
+    //
+    // determine if the suggested title is already used, if so, suggest another one;
+    // otherwise, return the suggested title
+    //
+    TBool found(EFalse);
+    TUint autoNumber(0);
+
+    HBufC* autoNumberTextBuf = HBufC::NewLC(KMaxFileName);
+    TPtr autoNumberText = autoNumberTextBuf->Des();
+
+    HBufC* suggestedTitle(NULL);
+
+    count = medias->Count();
+
+    while (!found)
+        {
+        autoNumberText.Format(
+            ++autoNumber < 10 ? KAutoNumberPaddedFormat() : KAutoNumberFormat(), autoNumber);
+
+        AknTextUtils::LanguageSpecificNumberConversion(autoNumberText);
+
+        HBufC* testTitle = HBufC::NewLC(aBaseTitle.Length()+autoNumberText.Length()+2);
+        testTitle->Des().Format(KAutoNamingFormat, &aBaseTitle, autoNumberTextBuf);
+        MPX_DEBUG2("testTitle = %S", testTitle);
+
+        TBool exists(EFalse);
+        for (TInt i=0; i<count && !exists; i++)
+            {
+            if (testTitle->Compare((*medias)[i]->ValueText(KMPXMediaGeneralTitle)) == 0)
+                {
+                exists = ETrue;
+                }
+            }
+
+        if (!exists)
+            {
+            found = ETrue;
+            suggestedTitle = testTitle;
+            CleanupStack::Pop(testTitle);
+            }
+        else
+            {
+            CleanupStack::PopAndDestroy(testTitle);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(2, medias); // autoNumberTextBuf & medias
+
+    MPX_DEBUG2("SuggestedTitle = %S", suggestedTitle);
+
+    return suggestedTitle;
+    }
+
+// ---------------------------------------------------------------------------
+// Checks if Exit option should be hidden
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonUiHelper::ExitOptionHiddenL()
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::ExitOptionHiddenL" );
+    TInt flags( 0 );
+    CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
+    repository->Get( KMPXMPLocalVariation, flags );
+    delete repository;
+    return !static_cast<TBool>( flags & KMPXEnableExitOption );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets standalone mode process ID
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonUiHelper::SetStandAloneModePId( TInt64 aPId )
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::SetStandAloneModePId" );
+    TInt err( RProperty::Define(
+        KAppUidMusicPlayerX, KMPXStandAloneProcessIDTop32, RProperty::EInt ) );
+    MPX_DEBUG2( "CMPXCommonUiHelper::SetStandAloneModePId() RProperty top err = %d", err );
+    if ( err == KErrNone || err == KErrAlreadyExists )
+        {
+        err = RProperty::Define(
+            KAppUidMusicPlayerX, KMPXStandAloneProcessIDBottom32, RProperty::EInt );
+        MPX_DEBUG2( "CMPXCommonUiHelper::SetStandAloneModePId() RProperty bottom err = %d", err );
+        }
+    if ( err == KErrNone || err == KErrAlreadyExists )
+        {
+        MPX_DEBUG2( "CMPXCommonUiHelper::SetStandAloneModePId() proc id = 0x%lx", aPId );
+        TInt top32( aPId >> 32 );
+        TInt bottom32( aPId & 0xFFFFFFFF );
+        err = RProperty::Set( KAppUidMusicPlayerX,
+                    KMPXStandAloneProcessIDTop32,
+                    top32 );
+        MPX_DEBUG2( "CMPXCommonUiHelper::SetStandAloneModePId() set top err = %d", err );
+        err = RProperty::Set( KAppUidMusicPlayerX,
+                    KMPXStandAloneProcessIDBottom32,
+                    bottom32 );
+        MPX_DEBUG2( "CMPXCommonUiHelper::SetStandAloneModePId() set bottom err = %d", err );
+        }
+    return ( err == KErrNone ? ETrue : EFalse );
+    }
+
+// ---------------------------------------------------------------------------
+// Gets stand alone mode's process id
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt64 CMPXCommonUiHelper::StandAloneModePId()
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::StandAloneModePId" );
+    TInt ret( 0 );
+    TInt64 procId( 0 );
+    TInt err( RProperty::Get(
+        KAppUidMusicPlayerX, KMPXStandAloneProcessIDTop32, ret ) );
+    if ( err == KErrNone )
+        {
+        procId = TInt64( ret ) << 32;
+        err = RProperty::Get(
+            KAppUidMusicPlayerX, KMPXStandAloneProcessIDBottom32, ret );
+        if ( err == KErrNone )
+            {
+            procId += ret;
+            }
+        else
+            {
+            procId = 0;
+            }
+        }
+    MPX_DEBUG2( "CMPXCommonUiHelper::StandAloneModePId() combined proc id = 0x%lx", procId );
+    return procId;
+    }
+
+// ---------------------------------------------------------------------------
+// Checks if the application with the provided window group id is in foreground
+// This method is required because AppUi()->IsForeground() does not work properly
+// when the screen saver is active
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonUiHelper::IsForegroundApplication(TInt aWindowGroupId)
+    {
+    TBool applicationInForeground(EFalse);
+    TApaTaskList taskList(CCoeEnv::Static()->WsSession());
+    TApaTask taskInForeground = taskList.FindByPos( 0 );
+    if ( taskInForeground.Exists() &&
+         (taskInForeground.WgId() == aWindowGroupId))
+        {
+        applicationInForeground = ETrue;
+    	}
+    return applicationInForeground;
+    }
+
+EXPORT_C TInt CMPXCommonUiHelper::MMCDriveNumber()
+    {
+#ifdef RD_MULTIPLE_DRIVE
+    TInt mmc( 0 );
+    TInt r = DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRemovableMassStorage, mmc );
+    if (r != KErrNone)
+        mmc = r;
+#else
+    TParsePtrC memorycardparse( PathInfo::MemoryCardRootPath() );
+    TDriveUnit mmc( memorycardparse.Drive() );
+#endif // RD_MULTIPLE_DRIVE
+    return mmc;
+    }
+
+// ----------------------------------------------------------------------------
+// Cancel subsequent operations scheduled by CollectionUiHelper
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonUiHelper::CancelCollectionOperation()
+    {
+    iCollectionUiHelper->Cancel();
+    }
+
+// ----------------------------------------------------------------------------
+// MPlayerCommonUi::IsMemoryCardWritable
+// ----------------------------------------------------------------------------
+//
+TBool CMPXCommonUiHelper::IsMemoryCardWritable( TChar& aDrive )
+    {
+    TBool ret = EFalse;
+    TDriveList driveList;
+    TInt driveNum( EDriveE );
+    CEikonEnv* eikEnv( CEikonEnv::Static() );
+    RFs& fs( eikEnv->FsSession() );
+    TInt err( fs.DriveList( driveList ) );
+
+    if ( err == KErrNone )
+        {
+        // search from drive E to drive N (10 drives)
+        for (; driveNum <= EDriveN; ++driveNum )
+            {
+            // Check that volume is valid (ie. not corrupted)
+            TVolumeInfo volumeInfo;
+            err = eikEnv->FsSession().Volume( volumeInfo, driveNum );
+
+            if ( ( err == KErrNone ) &&
+                ( RFs::DriveToChar( driveNum, aDrive ) == KErrNone ) )
+                {
+                ret = ETrue;
+                break;
+                }
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonUiHelper::PlaylistCreationQueriesL
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCommonUiHelper::PlaylistCreationQueriesL( TDes& aPath )
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::PlaylistCreationQueriesL" );
+
+    TBool ret = EFalse;
+
+    // Get playlist filename
+    HBufC* playlistFileName = HBufC::NewLC( KMPXMaxPlaylistPathLen );
+    TPtr playlistFileNamePtr = playlistFileName->Des();
+    playlistFileNamePtr.Copy( aPath );
+    User::LeaveIfError( GetNextPlaylistNameL( playlistFileNamePtr ) );
+    TParsePtrC parse( playlistFileNamePtr );
+
+    HBufC* playlistName =
+        HBufC::NewLC( KMPXMaxPlaylistPathLen );
+    TPtr playlistNamePtr = playlistName->Des();
+    playlistNamePtr.Copy( parse.NameAndExt() );
+
+    if ( aPath.Length() > 0 )
+        {
+        ret = PlaylistCreateNameExistL( playlistNamePtr , parse );
+        if ( ret )
+            {
+            aPath = parse.DriveAndPath();
+            aPath.Append( playlistName->Des() );
+            }
+        }
+    else
+        {
+        HBufC* saveTitle =
+            StringLoader::LoadLC( R_MPX_PLAYLIST_NAME_QUERY_TITLE );
+        aPath.Copy( playlistNamePtr );
+
+        ret = AknCommonDialogs::RunSaveDlgNoDirectorySelectionLD( aPath,
+            R_MPX_PLAYLIST_MEMORY_SELECTION_LOCATIONS, *saveTitle );
+
+        CleanupStack::PopAndDestroy( saveTitle );
+        }
+
+    CleanupStack::PopAndDestroy( playlistName );
+    CleanupStack::PopAndDestroy( playlistFileName );
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Get next available playlist full pathname based on the information passed.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonUiHelper::GetNextPlaylistNameL( TDes& aBuf )
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::GetNextPlaylistNameL" );
+    // Keep track of playlist file path
+    HBufC* filePath = aBuf.AllocLC();
+    TParsePtrC pathParse( *filePath );
+    HBufC* origPlaylistName( NULL );
+    if ( !pathParse.NamePresent() )
+        {
+        // Load default name if filename is missing
+        origPlaylistName =
+            StringLoader::LoadLC( R_MPX_CUI_DEFAULT_PLAYLIST_NAME );
+        }
+    else
+        {
+        origPlaylistName = pathParse.Name().AllocLC();
+        }
+
+    if ( !iCollectionUiHelper )
+        {
+        iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+        }
+    if ( iCollectionUiHelper->TitleExistsL( EMPXPlaylist, *origPlaylistName ) )
+        {
+        HBufC* newTitle = GenerateTitleL( EMPXPlaylist, *origPlaylistName );
+        aBuf.Copy( pathParse.DriveAndPath() );
+        aBuf.Append( *newTitle );
+        delete newTitle;
+        }
+    else
+        {
+        aBuf.Copy( pathParse.DriveAndPath() );
+        aBuf.Append( *origPlaylistName );
+        }
+    CleanupStack::PopAndDestroy( 2, filePath );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// Finds all items in the specified category
+// -----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXCommonUiHelper::FindAllL(TMPXGeneralCategory aCategory, const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC( "CMPXCommonUiHelper::FindAllL" );
+
+    if (!iCollectionUtility)
+        {
+        User::Leave(KErrArgument);
+        }
+
+    CMPXMedia* ret( NULL );
+    CMPXMedia* criteria = CMPXMedia::NewL();
+    CleanupStack::PushL( criteria );
+    criteria->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXGroup );
+    criteria->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, aCategory );
+
+    // Look up collection UID and set to criteria
+    //
+    RArray<TUid> ary;
+    CleanupClosePushL( ary );
+    ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) );
+    TUid musicCollection = iCollectionUtility->CollectionIDL( ary.Array() );
+    CleanupStack::PopAndDestroy( &ary );
+
+    criteria->SetTObjectValueL<TUid>( KMPXMediaGeneralCollectionId, musicCollection );
+
+    ret = iCollectionUtility->Collection().FindAllL( *criteria, aAttrs );
+    CleanupStack::PopAndDestroy( criteria );
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Handles the completion of setting a media event.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonUiHelper::HandleOperationCompleteL( TCHelperOperation aOperation,
+                                                   TInt aErr,
+                                                   void* aArgument )
+    {
+    if ( iAddObserver )
+        {
+        iAddObserver->HandleOperationCompleteL( aOperation, aErr, aArgument );
+        }
+    iAddObserver = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXCommonUiHelper::PlaylistCreateNameExistL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXCommonUiHelper::PlaylistCreateNameExistL( TDes& aName, const TParseBase& aParse )
+    {
+    TBool ret( EFalse );
+    CMPXFileNameQueryDlg* nameDlg = CMPXFileNameQueryDlg::NewL(
+                                    aName, aName, aParse.DriveAndPath(),
+                                    EMPXPlaylist, this );
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+        nameDlg->PublishDialogL(
+            EMPlayerQueryCreatePlaylist,
+            KMPlayerNoteCategory);
+//#endif
+// Cover UI end
+    ret = nameDlg->ExecuteLD( R_MPX_CREATE_PLAYLIST_NAME_QUERY );
+
+    if ( ret )
+        {
+        if ( iCollectionUiHelper->TitleExistsL( EMPXPlaylist, aName, EMPXOtherType ) )
+            {
+            HBufC* info = StringLoader::LoadLC( R_MPX_PLAYLIST_NAME_EXIST, aName );
+
+            if( CEikonEnv::Static()->QueryWinL( KNullDesC, *info ) )
+                {
+                if ( !PlaylistCreateNameExistL( aName, aParse ) )
+                    {
+                    ret = EFalse;
+                    }
+                }
+             else
+                {
+                ret = EFalse;
+                }
+             CleanupStack::PopAndDestroy( info );//query ,info
+             }
+        }
+
+    return ret;
+    }    
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/src/mpxdrmuihelper.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,536 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper utility for Common UI
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <eikenv.h>
+#include <mpxmedia.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <caf/caferr.h>
+#include <mpxcommonui.rsg>
+#include <StringLoader.h>
+// S60 Specific
+
+#include <mpxconstants.h>
+#include "mpxdrmuihelper.h"
+#include "mpxcommonuihelper.h"
+#include "mpxlog.h"
+
+#ifdef CAMESE_IN_DRM_UTILITY
+#include <drmutility.h>
+#include <drmuihandling.h>
+#include <drmerrorhandling.h>
+#include <caf/caf.h>
+#include <caf/data.h>
+#include <caf/caftypes.h>
+#else
+#include <drmhelper.h>
+#endif
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXDrmUiHelper* CMPXDrmUiHelper::NewL( CMPXCommonUiHelper* aHelper )
+    {
+    CMPXDrmUiHelper* self = new ( ELeave ) CMPXDrmUiHelper( aHelper );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXDrmUiHelper::ConstructL()
+    {
+    CCoeEnv* coeEnv = CEikonEnv::Static();
+#ifdef CAMESE_IN_DRM_UTILITY	
+    iDrmUiHandler = DRM::CDrmUiHandling::NewL();
+#else
+    iDrmHelper = CDRMHelper::NewL( *coeEnv );
+#endif
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXDrmUiHelper::CMPXDrmUiHelper( CMPXCommonUiHelper* aHelper )
+    : iCommonUiHelper( aHelper )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXDrmUiHelper::~CMPXDrmUiHelper()
+    {
+#ifdef CAMESE_IN_DRM_UTILITY	
+    delete iDrmUiHandler;
+#else
+    delete iDrmHelper;
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// Handles displaying the error message for given error code
+// according to the media object provided
+// -----------------------------------------------------------------------------
+//
+TInt CMPXDrmUiHelper::HandleDrmErrorL(
+    TInt aError,
+    const CMPXMedia* aMedia, /*=NULL*/
+    RFile* aFile /*=NULL*/ )
+    {
+    MPX_DEBUG2("CMPXDrmUiHelper::HandleErrorL(%d) entering", aError);
+
+    TInt ret( KErrNone );
+    if ( aMedia )
+        {
+        if ( aMedia->IsSupported( KMPXMediaDrmType ) )
+            {
+#ifdef CAMESE_IN_DRM_UTILITY
+            // all cases will be handled with same logic now
+            ret = HandleOMAErrorL( aError, aMedia, aFile );
+#else
+            TMPXMediaDrmType type(
+                    aMedia->ValueTObjectL<TMPXMediaDrmType>( KMPXMediaDrmType ));
+
+            if ( EMPXDrmTypeOMA == type )
+                {
+                ret = HandleOMAErrorL( aError, aMedia, aFile );
+                }
+            else if ( EMPXDrmTypeWMA == type )
+                {
+                ret = HandleWMAErrorL( aError, aMedia, aFile );
+                }
+#endif
+            }
+        }
+
+    MPX_DEBUG2("CMPXDrmUiHelper::HandleErrorL() exiting, returning %d", ret);
+    return ret;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Handles OMA specific error messages
+// -----------------------------------------------------------------------------
+//
+TInt CMPXDrmUiHelper::HandleOMAErrorL(
+    TInt aError,
+    const CMPXMedia* aMedia,
+    RFile* aFile )
+    {
+    MPX_DEBUG2("CMPXDrmUiHelper::HandleOMAErrorL(%d) entering", aError);
+    HBufC8* previewUrl = NULL;
+
+    // Get filename of media
+    TInt ret( KErrNone );
+    TFileName filename( KNullDesC );
+    if ( aMedia->IsSupported( KMPXMediaGeneralUri ) )
+        {
+        filename = aMedia->ValueText( KMPXMediaGeneralUri );
+        }
+
+    TBool useFile( EFalse );
+    if ( aFile )
+        {
+        if ( aFile->SubSessionHandle() )
+            {
+            useFile = ETrue;
+            }
+        }
+#ifdef CAMESE_IN_DRM_UTILITY
+    switch ( aError )
+        {
+        case KMPXRightsAboutToExpire:
+        case KErrCANoRights:
+            {
+            iRightsValid = EFalse;
+            
+            // This will ask from user if new rights are acquired
+            if ( useFile )
+                {
+                iDrmUiHandler->CheckRightsAmountL( *aFile,
+                		ContentAccess::EPlay, this );
+                }
+            else if ( filename.CompareF( KNullDesC ) != 0 )
+                {
+                ContentAccess::TVirtualPathPtr virtualPath( filename, ContentAccess::KDefaultContentObject );
+                ContentAccess::CData* content( NULL );
+                TRAPD( r, content = ContentAccess::CData::NewL( 
+                		virtualPath, ContentAccess::EPeek, 
+                		ContentAccess::EContentShareReadWrite ) );
+                if ( r == KErrInUse )
+                    {
+                    content = ContentAccess::CData::NewL( virtualPath, ContentAccess::EPeek, 
+                    		ContentAccess::EContentShareReadOnly );
+                    }
+                else
+                    {
+                    User::LeaveIfError( r );
+                    }
+                CleanupStack::PushL( content );
+                
+                iDrmUiHandler->CheckRightsAmountL( *content,
+                	ContentAccess::EPlay, this );
+                
+                CleanupStack::PopAndDestroy( content );
+                }
+            if( !iRightsValid )
+            	{
+            	// Rights still not valid. Cancel the operation.
+            	ret = KErrCancel;
+            	}
+            break;
+            }
+        default:
+            {
+			if ( useFile )
+                {
+                DRM::MDrmErrorHandling& errorHandler = iDrmUiHandler->GetErrorHandler();
+                errorHandler.HandleErrorL( *aFile, ContentAccess::EPlay, aError, NULL );
+                }
+            else if ( filename.CompareF( KNullDesC ) != 0 )
+                {
+				ContentAccess::TVirtualPathPtr virtualPath( filename, ContentAccess::KDefaultContentObject );
+                ContentAccess::CData* content( NULL );
+                TRAPD( r, content = ContentAccess::CData::NewL( 
+                		virtualPath, ContentAccess::EPeek, 
+                		ContentAccess::EContentShareReadWrite ) );
+                if ( r == KErrInUse )
+                    {
+                    content = ContentAccess::CData::NewL( virtualPath, ContentAccess::EPeek, 
+                    		ContentAccess::EContentShareReadOnly );
+                    }
+                else
+                    {
+                    User::LeaveIfError( r );
+                    }
+                CleanupStack::PushL( content );
+                
+                DRM::MDrmErrorHandling& errorHandler = iDrmUiHandler->GetErrorHandler();
+                errorHandler.HandleErrorL( *content, ContentAccess::EPlay, aError, NULL );
+
+                CleanupStack::PopAndDestroy( content );
+                }
+            break;
+            }
+#else
+            switch ( aError )
+                {
+                case KMPXRightsAboutToExpire:
+                    {
+                    if ( useFile )
+                        {
+                        ret = iDrmHelper->CheckRightsAmountL( *aFile );
+                        }
+                    else if ( filename.CompareF( KNullDesC ) != 0 )
+                        {
+                        ret = iDrmHelper->CheckRightsAmountL( filename );
+                        }
+                    break;
+                    }
+                default:
+                    {
+                    if ( useFile )
+                        {
+                        ret = iDrmHelper->HandleErrorOrPreviewL( aError, *aFile, previewUrl );
+                        if( previewUrl )
+                            {
+                            delete previewUrl;
+                            }
+                        }
+                    else if ( filename.CompareF( KNullDesC ) != 0 )
+                        {
+                        ret = iDrmHelper->HandleErrorOrPreviewL( aError, filename, previewUrl );
+                        if( previewUrl )
+                            {
+                            delete previewUrl;
+                            }
+                        }
+                    break;
+                    }
+
+#endif			
+                }
+
+    MPX_DEBUG2("CMPXDrmUiHelper::HandleOMAErrorL(%d) exiting, returning %d", ret);
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Handles WMA specific error messages
+// -----------------------------------------------------------------------------
+//
+TInt CMPXDrmUiHelper::HandleWMAErrorL(
+    TInt aError,
+    const CMPXMedia* aMedia,
+    RFile* /*aFile*/ )
+    {
+    MPX_DEBUG2("CMPXDrmUiHelper::HandleWMAErrorL(%d) entering", aError);
+
+    TInt ret( KErrNone );
+    HBufC* notificationText( NULL );
+
+    // Get filename of media
+    TFileName filename( KNullDesC );
+    if ( aMedia->IsSupported( KMPXMediaGeneralUri ) )
+        {
+        filename = aMedia->ValueText( KMPXMediaGeneralUri );
+        }
+
+    switch ( aError )
+        {
+        case KMPXRightsAboutToExpire:
+            {
+/*
+            if ( aMedia->IsSupported( EMPXMediaDrmRightsType ))
+                {
+                TMPXMediaDrmRightsType type =
+                    aMedia->ValueTObject<TMPXMediaDrmRightsType>(
+                        EMPXMediaDrmRightsType );
+                switch ( type )
+                    {
+                    case EMPXDrmRightsTypeTime:
+                        {
+                        TTime endTime = *aMedia->Value<TTime>(
+                                            EMPXMediaDrmEndTime );
+                        TTime currentTime;
+                        currentTime.HomeTime();
+                        TTimeIntervalDays daysRemain =
+                            endTime.DaysFrom( currentTime );
+                        TInt days( daysRemain.Int() );
+                        if ( days < 1 )
+                            {
+                            notificationText = StringLoader::LoadLC(
+                                R_MPX_CUI_WMDRM_RIGHTS_ABOUT_EXPIRE_NOTIFICATION );
+                            }
+                        else if ( days == 1 )
+                            {
+                            notificationText = StringLoader::LoadLC(
+                                R_MPX_CUI_WMDRM_RIGHTS_ABOUT_EXPIRE_ONE_DAY_NOTIFICATION );
+                            }
+                        else
+                            {
+                            notificationText = StringLoader::LoadLC(
+                                R_MUSICPLAYER_CUI_WMDRM_RIGHTS_ABOUT_EXPIRE_MULTIPLE_DAY_NOTIFICATION );
+                            }
+                        break;
+                        }   // end case EMPXDrmRightsTypeTime
+                    case EMPXDrmRightsTypeCount:
+                    case EMPXDrmRightsTypeTimeCount:
+                        {
+                        TUint32 count(
+                            aMedia->ValueTObject<TUint32>(
+                                EMPXMediaDrmCount ));
+                        if ( count <= KMPXWmaDrmAboutToExpireCount )
+                            {
+                            if ( count == 1 )
+                                {
+                                notificationText = StringLoader::LoadLC(
+                                    R_MUSICPLAYER_CUI_WMDRM_RIGHTS_ACTIVATION_KEY_ONE_COUNT_NOTIFICATION );
+                                }
+                            else if ( count > 1 )
+                                {
+                                notificationText = StringLoader::LoadLC(
+                                    R_MUSICPLAYER_CUI_WMDRM_RIGHTS_ACTIVATION_KEY_MORE_THAN_ONE_COUNT_NOTIFICATION );
+                                }
+                            }
+                        }   // end case EMPXDrmRightsTypeCount, EMPXDrmRightsTypeTimeCount
+                    default:
+                        {
+                        // do nothing
+                        break;
+                        }
+                    }
+                }
+*/
+            }   // end case KMPXRightsAboutToExpire
+        case KErrCANotSupported:
+        case KErrCANoPermission:
+        case KErrCANoRights:
+//        case KErrCANoAgent:
+//        case KErrCAOutOfRange:
+//        case KErrCAPendingRights:
+//        case KErrCASizeNotDetermined:
+//        case KErrCANewFileHandleRequired:
+            {
+            if ( filename.CompareF( KNullDesC ) != 0 )
+                {
+                TParsePtrC parse( filename );
+                notificationText = StringLoader::LoadLC(
+                    R_MPX_DRM_EXPIRED_PLAYBACK, parse.Name() );
+                iCommonUiHelper->DisplayInfoNoteL( *notificationText );
+                CleanupStack::PopAndDestroy( notificationText );
+                notificationText = NULL;
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+
+    MPX_DEBUG2("CMPXDrmUiHelper::HandleWMAErrorL(%d) exiting, returning %d", ret);
+    return ret;
+    }
+#ifdef CAMESE_IN_DRM_UTILITY
+// ----------------------------------------------------------------------------
+// Called when valid rights are found
+// ----------------------------------------------------------------------------
+//
+DRM::TCheckRightsAction CMPXDrmUiHelper::RightsLeft(
+            TInt /*aOperationId*/,
+            TBool /*aUnconstrained*/,
+            TTimeIntervalSeconds /*aTime*/,
+            TInt /*aCounts*/,
+            TTimeIntervalSeconds /*aAccumulated*/ )
+	{
+	iRightsValid = ETrue;
+	return DRM::EUHCheckRightsActionIgnore;
+	}
+ 
+// ----------------------------------------------------------------------------
+// Called when there is no valid rights
+// ----------------------------------------------------------------------------
+//
+DRM::TCheckRightsAction CMPXDrmUiHelper::RightsNotValid(
+            TInt /*aOperationId*/,
+            DRM::TCheckRightsStatus /*aRightsStatus*/,
+            TInt /*aReason*/ )
+	{
+	iRightsValid = EFalse;
+
+	// DrmUiHandling will ask for more rights
+	return DRM::EUHCheckRightsActionDefault;
+	}
+
+// ----------------------------------------------------------------------------
+// Unused observation method
+// ----------------------------------------------------------------------------
+//
+DRM::TEmbeddedPreviewAction CMPXDrmUiHelper::EmbeddedPreviewAvailable(
+            TInt /*aOperationId*/,
+            const TDesC& /*aUniqueId*/,
+            TInt /*aRightsStatus*/,
+            TInt /*aReason*/ )
+	{
+	return DRM::EUEmbeddedPreviewActionIgnore;
+	}
+
+// ----------------------------------------------------------------------------
+// Unused observation method
+// ----------------------------------------------------------------------------
+//
+DRM::TPreviewRightsAction CMPXDrmUiHelper::PreviewRightsUrlAvailable(
+            TInt /*aOperationId*/,
+            const TDesC& /*aPreviewRightsUrl*/,
+            TInt /*aRightsStatus*/,
+            TInt /*aReason*/ )
+	{
+	return DRM::EUPreviewRightsActionIgnore;
+	}
+
+// ----------------------------------------------------------------------------
+// Unused observation method
+// ----------------------------------------------------------------------------
+//
+DRM::TSilentRightsAction CMPXDrmUiHelper::SilentRightsUrlAvailable(
+            TInt /*aOperationId*/,
+            const TDesC& /*aSilentRightsUrl*/,
+            TInt /*aRightsStatus*/,
+            TInt /*aReason*/ )
+	{
+	return DRM::EUSilentRightsActionDefault;
+	}
+
+// ----------------------------------------------------------------------------
+// Unused observation method
+// ----------------------------------------------------------------------------
+//
+DRM::TRightsAction CMPXDrmUiHelper::RightsUrlAvailable(
+            TInt /*aOperationId*/,
+            const TDesC& /*aRightsUrl*/,
+            TInt /*aRightsStatus*/,
+            TInt /*aReason*/,
+            TInt /*aUrlType*/ )
+	{
+	return DRM::EURightsActionDefault;
+	}
+
+// ----------------------------------------------------------------------------
+// Unused observation method
+// ----------------------------------------------------------------------------
+//
+void CMPXDrmUiHelper::PreviewRightsAvailable(
+            TInt /*aOperationId*/,
+            TInt /*aError*/ )
+	{
+	}
+
+// ----------------------------------------------------------------------------
+// Unused observation method
+// ----------------------------------------------------------------------------
+//
+void CMPXDrmUiHelper::SilentRightsAvailable(
+            TInt /*aOperationId*/,
+            TInt /*aError*/ )
+	{
+    }
+
+// ----------------------------------------------------------------------------
+// Unused observation method
+// ----------------------------------------------------------------------------
+//
+void CMPXDrmUiHelper::RightsAvailable(
+            TInt /*aOperationId*/,
+            TInt /*aError*/ )
+	{
+	}
+
+// ----------------------------------------------------------------------------
+// Unused observation method
+// ----------------------------------------------------------------------------
+//
+void CMPXDrmUiHelper::PlayEmbeddedPreviewSelected(
+        TInt /*aOperationId*/,
+        const TDesC& /*aUniqueId*/ )
+	{
+	}
+
+// ----------------------------------------------------------------------------
+// Unused observation method
+// ----------------------------------------------------------------------------
+//
+void CMPXDrmUiHelper::OperationCompleted( 
+		TInt /*aOperationId*/, TInt /*aOperationStatus*/ )
+	{
+	}
+#endif		
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/src/mpxfilenamequerydlg.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,323 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  rename dialog for Common UI
+*
+*/
+
+
+// INCLUDE FILES
+#include <coeutils.h>
+#include <eikapp.h>
+#include <StringLoader.h>
+#include <aknnotewrappers.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcommonui.rsg>
+#include <mpxlog.h>
+
+#include "mpxcommonuihelper.h"
+#include "mpxfilenamequerydlg.h"
+
+// CONSTANTS
+const TInt KMPXMaxPlaylistPathLen ( 200 );
+
+_LIT( KBackslash, "\\" );
+_LIT( KDirectionalChars, "\x202A\x202B\x202C\x202D\x200E\x200F" );
+
+const TUint16 KIllegalChars[] = {
+    '<', '>', '"', '/', '\\', '|', ':', '*', '?',
+    0xFF02, // Full width quote
+    0xFF0A, // Full width asterisk
+    0xFF0F, // Full width slash
+    0xFF1A, // Full width colon
+    0xFF1C, // Full width left arrow
+    0xFF1E, // Full width right arrow
+    0xFF1F, // Full width question mark
+    0xFF3C, // Full width back slash
+    0xFF5C, // Full width pipe
+    0x201C, // Left quote
+    0x201D, // Right quote
+    0x201F, // Reversed quote
+    0, // Array terminator
+};
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXFileNameQueryDlg* CMPXFileNameQueryDlg::NewL(
+        const TDesC& aOldName,
+        TDes& aNewName,
+        const TDesC& aPath,
+        TMPXGeneralCategory aCategory,
+        CMPXCommonUiHelper* aParent )
+    {
+    MPX_FUNC( "CMPXFileNameQueryDlg::NewL" );
+    CMPXFileNameQueryDlg* self =
+        new( ELeave ) CMPXFileNameQueryDlg( aNewName, aCategory, aParent );
+
+    CleanupStack::PushL( self );
+    self->ConstructL( aOldName, aPath );
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXFileNameQueryDlg::CMPXFileNameQueryDlg(
+    TDes& aNewName,
+    TMPXGeneralCategory aCategory,
+    CMPXCommonUiHelper* aParent ) :
+    CAknTextQueryDialog( aNewName ),
+    iParent( aParent ),
+    iCategory( aCategory )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXFileNameQueryDlg::ConstructL(
+    const TDesC& aOldName, const TDesC& aPath )
+    {
+    MPX_FUNC( "CMPXFileNameQueryDlg::ConstructL" );
+    TParsePtrC name( aOldName );
+    iOldName = aOldName.AllocL();
+    iPath = aPath.AllocL();
+    // Strip any directionality markers to get pure name
+    TPtr ptr( iOldName->Des() );
+    AknTextUtils::StripCharacters( ptr, KDirectionalChars );
+    TInt extLength( 0 );
+    if ( iCategory == EMPXPlaylist )
+        {
+        Text().Copy( name.NameAndExt() );
+        }
+    else
+        {
+        Text().Copy( name.Name() );
+        if ( name.ExtPresent() )
+            {
+            extLength = name.Ext().Length();
+            }
+        }
+    TInt maxLength( KMPXMaxPlaylistPathLen - aPath.Length() - extLength );
+    MPX_DEBUG2( "CMPXFileNameQueryDlg::ConstructL setting max length = %d", maxLength );
+    SetMaxLength( maxLength );
+    iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXFileNameQueryDlg::~CMPXFileNameQueryDlg()
+    {
+    if ( iCollectionUiHelper )
+        {
+        iCollectionUiHelper->Close();
+        }
+    delete iOldName;
+    delete iPath;
+    }
+
+// ---------------------------------------------------------------------------
+// CFileManagerFileNameQueryDlg::OkToExitL
+// ---------------------------------------------------------------------------
+//
+TBool CMPXFileNameQueryDlg::OkToExitL( TInt aButtonId )
+    {
+    MPX_FUNC( "CMPXFileNameQueryDlg::OkToExitL" );
+    TBool result( CAknTextQueryDialog::OkToExitL( aButtonId ) );
+
+    HBufC* userText = Text().AllocLC();
+    TPtr ptrUserText( userText->Des() );
+
+    // Strip any directionality markers to get pure name
+    AknTextUtils::StripCharacters( ptrUserText, KDirectionalChars );
+
+    TParsePtrC currentPath( *iPath );
+    // Check file name
+    TBool isValidName = IsValidName( currentPath.DriveAndPath(), *userText, EFalse );
+    if( !isValidName )
+        {
+        if( IllegalChars( *userText ) )
+            {
+            iParent->DisplayInfoNoteL(
+                R_MPX_QTN_FLDR_ILLEGAL_CHARACTERS );
+            }
+        else
+            {
+            iParent->DisplayInfoNoteL(
+                R_MPX_QTN_FLDR_BAD_FILE_NAME );
+            }
+        CAknQueryControl* queryControl = QueryControl();
+        if ( queryControl )
+            {
+            CEikEdwin* edwin = static_cast< CEikEdwin* >(
+                queryControl->ControlByLayoutOrNull( EDataLayout ) );
+            if (edwin)
+                {
+                edwin->SetSelectionL( edwin->TextLength(), 0 );
+                }
+            }
+        CleanupStack::PopAndDestroy( userText );
+        return EFalse;
+        }
+
+    // if some other entry found with same name
+    // not ok except if name same as original
+    if ( iCategory != EMPXPlaylist )
+        {
+        if ( iCollectionUiHelper->TitleExistsL( iCategory, *userText ) )
+            {
+            TBool overWrite( EFalse );
+            HBufC* text = StringLoader::LoadLC( R_MPX_QTN_FLDR_OVERWRITE_QUERY, Text() );
+            CAknQueryDialog* dlg = CAknQueryDialog::NewL();
+            overWrite = dlg->ExecuteLD( R_MPX_CONFIRM_QUERY_WITH_YES_NO, *text );
+            CleanupStack::PopAndDestroy( text );
+            if( !overWrite )
+                {
+                CAknQueryControl* queryControl = QueryControl();
+                if (queryControl)
+                    {
+                    CEikEdwin* edwin = static_cast< CEikEdwin* >(
+                        queryControl->ControlByLayoutOrNull( EDataLayout ) );
+
+                    HBufC* newTitle = iParent->GenerateTitleL( iCategory, *userText );
+                    CleanupStack::PushL(newTitle);
+
+                    if ( edwin )
+                        {
+                        edwin->SetTextL( newTitle );
+                        edwin->SetSelectionL( edwin->TextLength(), 0 );
+                        }
+                    CleanupStack::PopAndDestroy(newTitle);
+                    }
+                result = EFalse;
+                }
+            }
+        }
+    CleanupStack::PopAndDestroy( userText );
+    if ( result && iCategory != EMPXPlaylist )
+        {
+        // playlist has no extension, don't need to do this
+        TParsePtrC oldName( *iOldName );
+        iDataText.Append( oldName.Ext() );
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXFileNameQueryDlg::IsValidName
+// -----------------------------------------------------------------------------
+//
+TBool CMPXFileNameQueryDlg::IsValidName(
+        const TDesC& aDriveAndPath, const TDesC& aName, TBool aIsFolder ) const
+    {
+    MPX_FUNC( "CMPXFileNameQueryDlg::IsValidName" );
+    // Check name for bad chars
+    const TUint16 KMinAllowedChar = 0x0020;
+    const TUint16 KParagraphSeparator = 0x2029;
+    const TUint16 KDot = '.';
+    TInt nameLen( aName.Length() );
+    if ( !nameLen )
+        {
+        return EFalse;
+        }
+    for ( TInt i( 0 ); i < nameLen; i++ )
+        {
+        TUint16 ch( aName[ i ] );
+        if ( ch < KMinAllowedChar || ch == KParagraphSeparator )
+            {
+            return EFalse;
+            }
+        }
+    // File system ignores totally dot in the end of name, so
+    // we set here as not valid name, so that user gets correctly informed
+    if ( aName[ nameLen - 1 ] == KDot || IllegalChars( aName ) )
+        {
+        return EFalse;
+        }
+    // Get full path length
+    TPtrC pathPtr( aDriveAndPath );
+    TInt pathLen( pathPtr.Length() );
+    if ( !pathLen )
+        {
+        return EFalse;
+        }
+    TInt fullPathLen( pathLen );
+    if ( pathPtr[ pathLen - 1 ] != KBackslash()[ 0 ] )
+        {
+        ++fullPathLen; // Add backslash before name
+        }
+    fullPathLen += nameLen;
+    if ( aIsFolder )
+        {
+        ++fullPathLen; // Add folder final backslash
+        }
+
+    TBool ret( EFalse );
+    if ( fullPathLen <= KMaxFileName )
+        {
+        // Check full path
+        HBufC* fullPath = HBufC::New( KMaxFileName );
+        if ( fullPath )
+            {
+            TPtr ptr( fullPath->Des() );
+            ptr.Copy( pathPtr );
+            if ( pathPtr[ pathLen - 1 ] != KBackslash()[ 0 ] )
+                {
+                ptr.Append( KBackslash ); // Add backslash before name
+                }
+            ptr.Append( aName );
+            RFs fs;
+            TInt connectError = fs.Connect();
+            if ( connectError == KErrNone )
+            {
+                ret = fs.IsValidName( ptr );
+                fs.Close();
+            }
+            delete fullPath;
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXFileNameQueryDlg::IllegalChars
+// -----------------------------------------------------------------------------
+//
+TBool CMPXFileNameQueryDlg::IllegalChars( const TDesC& aName ) const
+    {
+    MPX_FUNC( "CMPXFileNameQueryDlg::IllegalChars" );
+    for ( TInt i( 0 ); KIllegalChars[ i ]; i++ )
+        {
+        if ( aName.Locate( KIllegalChars[ i ] ) != KErrNotFound )
+            {
+            return ETrue;
+            }
+        }
+    return EFalse;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/src/mpximageutil.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,393 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of CMPXImageUtil.
+*
+*/
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <e32base.h>
+#include <bitmaptransforms.h>
+#include <mda/common/video.h>
+#include <eikenv.h>
+#include <icl/imagedata.h>
+#include <imageconversion.h>
+#include <IclExtJpegApi.h>
+
+#include "mpximageutil.h"
+
+//This value is used to stretch so the image fills the container.
+const TReal MaxStretchRatio = 1.1f;
+
+LOCAL_C TInt Stretch (TInt aValue, TInt aLimit)
+    {
+    TInt ret( aValue * MaxStretchRatio );
+    ret = (ret>aLimit) ? aLimit : ret;
+    return ret;
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMPXImageUtil* CMPXImageUtil::NewL(
+                                    MMPXAlbumArtUtilObserver& aObserver)
+    {
+    CMPXImageUtil* self = new ( ELeave ) CMPXImageUtil(aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(); // self
+    return self; 
+    }
+
+// -----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXImageUtil::CMPXImageUtil(MMPXAlbumArtUtilObserver& aObserver) 
+:   CActive(EPriorityStandard), iObserver(aObserver) 
+    {
+    iBitmap = NULL;
+    iState = EIdle;
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMPXImageUtil::ConstructL()
+    {
+    iScaler = CBitmapScaler::NewL();
+    User::LeaveIfError(iFs.Connect());
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CMPXImageUtil::~CMPXImageUtil()
+    {
+    Cancel();
+    delete iImageDecoder; // CImageDecoder must be deleted before the 
+    delete iScaler;
+    iFs.Close();
+    delete iImageData;
+    }
+
+// -----------------------------------------------------------------------------
+// Starts to decode an image from a file. 
+// -----------------------------------------------------------------------------
+//
+void CMPXImageUtil::StartToDecodeL(const TDesC& aFileName, 
+                                      const TSize& aSize, 
+                                      TDisplayMode aDisplayMode /*=EColor64K*/)
+    {
+    if(iState)
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    delete iImageDecoder; 
+    iImageDecoder = NULL;
+    delete iBitmap; 
+    iBitmap = NULL;
+    delete iImageData;
+    iImageData = NULL;
+    
+    // create the decoder
+
+    TRAPD( err, iImageDecoder = CExtJpegDecoder::FileNewL( 
+            CExtJpegDecoder::EHwImplementation, 
+            iFs, 
+            aFileName, 
+            CImageDecoder::EOptionNone ) );
+    if (KErrNone != err)
+        {
+            TRAP(err,iImageDecoder = CExtJpegDecoder::FileNewL( 
+                    CExtJpegDecoder::ESwImplementation, 
+                    iFs, 
+                    aFileName, 
+                    CImageDecoder::EOptionNone ) );
+        if (KErrNone != err)
+            {
+            iImageDecoder = CImageDecoder::FileNewL(
+                    iFs, 
+                    aFileName,
+                    CImageDecoder::EOptionNone);
+            }
+        }
+
+    // Get image size
+    TSize bitmapSize = CalculateDecodeSize(aSize);
+    // create the destination bitmap
+    iBitmap = new (ELeave) CFbsBitmap();
+    User::LeaveIfError(iBitmap->Create(bitmapSize, aDisplayMode)); 
+
+    // start conversion to bitmap
+    iState = EDecoding;
+    iImageDecoder->Convert(&iStatus, *iBitmap);
+    
+    iObserver.ExtractAlbumArtStarted();
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXImageUtil::DoCancel
+// Implementation of CActive
+// -----------------------------------------------------------------------------
+//
+void CMPXImageUtil::DoCancel()
+    {
+    switch ( iState )
+        {
+        case EDecoding:
+            {
+            iImageDecoder->Cancel();
+            // need to delete bitmap as we have are still the owner until the 
+            // operation completes
+            if ( iBitmap )
+                {
+                delete iBitmap;
+                iBitmap = NULL;
+                }
+            break;
+            }
+        case EScaling:
+            {
+            iScaler->Cancel();
+            if ( iBitmap )
+                {
+                delete iBitmap;
+                iBitmap = NULL;
+                }
+            break;
+            }
+        default: // No Asynchronous events are taking place, do nothing.
+            {
+            break;
+            }
+        }
+
+    delete iImageData;
+    iImageData = NULL;
+    delete iImageDecoder;
+    iImageDecoder = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// Implementation of CActive
+// -----------------------------------------------------------------------------
+//
+void CMPXImageUtil::RunL()
+    {
+    TInt deleteDecoder( ETrue );
+    switch( iState ) 
+        {
+        case EDecoding:
+            {
+            if( iStatus == KErrNone ) 
+                {
+                if ( !iScaleRquired )
+                    {   
+                    iState = EIdle;
+                    iObserver.ExtractAlbumArtCompleted(iBitmap,KErrNone);
+                    iBitmap = NULL;
+                    }
+                else 
+                    {
+                    deleteDecoder = EFalse;
+                    ScaleL();
+                    }
+                break;
+                }
+            else
+                {
+                // some error
+                if ( iBitmap )
+                    {
+                    delete iBitmap;
+                    iBitmap = NULL;                        
+                    }
+                iState = EIdle;
+                iObserver.ExtractAlbumArtCompleted(iBitmap, iStatus.Int());
+                break;   
+                }
+            }
+        case EScaling:
+            {
+            iState = EIdle;
+            iObserver.ExtractAlbumArtCompleted(iBitmap,iStatus.Int());
+            iBitmap = NULL; 
+            }
+            break;
+
+        default: // some error
+            {
+            iState = EIdle;
+            iObserver.ExtractAlbumArtCompleted(iBitmap,iStatus.Int());
+            break;
+            }
+        }
+
+    // It's safe to destroy iImageData here
+    delete iImageData;
+    iImageData = NULL;
+    
+    if ( deleteDecoder )
+        {
+        delete iImageDecoder;
+        iImageDecoder = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Scales iBitmap by iSize
+// -----------------------------------------------------------------------------
+//
+void CMPXImageUtil::ScaleL()
+    {
+    iScaler->Scale(&iStatus, *iBitmap, iSize, EFalse);
+    iState = EScaling;
+    SetActive();
+    }
+
+// -----------------------------------------------------------------------------
+// Starts to decode an image from a buffer. 
+// -----------------------------------------------------------------------------
+//
+void CMPXImageUtil::StartToDecodeL( const TSize& aSize,
+        HBufC8* aAlbumArt, TDisplayMode aDisplayMode/*=EColor64K*/ )
+    {
+    if(iState)
+        {
+        User::Leave( KErrNotReady );
+        }
+                               
+    delete iImageDecoder; 
+    iImageDecoder = NULL;
+    delete iBitmap; 
+    iBitmap = NULL;
+    delete iImageData;
+    iImageData = NULL;
+    // storing the pointer to aAlbumArt, ownership was transferred to us.
+    iImageData = aAlbumArt;
+    // create the decoder
+    
+    
+    TRAPD( err, iImageDecoder = CExtJpegDecoder::DataNewL( 
+            CExtJpegDecoder::EHwImplementation, 
+            iFs, 
+            *iImageData, 
+            CImageDecoder::EOptionNone ) );
+    if ( KErrNone != err )
+        {
+        TRAP(err,iImageDecoder = CExtJpegDecoder::DataNewL( 
+                CExtJpegDecoder::ESwImplementation, 
+                iFs, 
+                *iImageData, 
+                CImageDecoder::EOptionNone ) );
+        if ( KErrNone != err )
+            {
+            iImageDecoder = CImageDecoder::DataNewL( 
+                    iFs, 
+                    *iImageData, 
+                    CImageDecoder::EOptionNone );
+            }
+        }
+    
+    
+
+    
+    TSize bitmapSize = CalculateDecodeSize( aSize );
+
+    // create the destination bitmap
+    iBitmap = new ( ELeave ) CFbsBitmap();
+    User::LeaveIfError( iBitmap->Create( bitmapSize, aDisplayMode ) );
+    // start conversion to bitmap
+    iState = EDecoding;
+    iImageDecoder->Convert( &iStatus, *iBitmap );
+    
+    iObserver.ExtractAlbumArtStarted();
+    SetActive();
+    }
+// -----------------------------------------------------------------------------
+// Calculates the decode size and prepares members for scaling. 
+// -----------------------------------------------------------------------------
+//
+TSize CMPXImageUtil::CalculateDecodeSize(const TSize& aSize)
+    {
+    const TFrameInfo& frameInfo = iImageDecoder->FrameInfo();
+    TSize bitmapSize = frameInfo.iOverallSizeInPixels;
+    TReal sourceAspectRatio( TReal( bitmapSize.iWidth) / bitmapSize.iHeight );
+    TReal destinationAspectRatio( TReal( aSize.iWidth ) / aSize.iHeight );
+    TReal xScale = TReal( bitmapSize.iWidth ) / aSize.iWidth;
+    TReal yScale = TReal( bitmapSize.iHeight ) / aSize.iHeight;
+    TReal scale(0.0f);
+    
+    if ( sourceAspectRatio > destinationAspectRatio )
+        {
+        scale = xScale;
+        iSize.iWidth = aSize.iWidth;
+        iSize.iHeight = Stretch( TReal( bitmapSize.iHeight ) / scale , 
+                                 aSize.iHeight );
+        }
+    else
+        {
+        scale = yScale;
+        iSize.iWidth = Stretch( TReal( bitmapSize.iWidth ) / scale ,
+                                aSize.iWidth);
+        iSize.iHeight = aSize.iHeight;
+        }
+     
+    if ((frameInfo.iFlags & TFrameInfo::EFullyScaleable))
+        {
+        iScaleRquired = EFalse;
+        bitmapSize = iSize;
+        }
+    else
+        //Decoder only supports 2, 4 and 8 scallyng, the image will need 
+        //to be reescaled after decoding.
+        //Decoding to a scale that is just a bit bigger thant the target,
+        //this will save memory and resources and we will get a sharp image 
+        //after scaling.
+        {
+        TInt intscale = ( scale >= 8 ) ? 8 : 
+                ( scale >= 4 ) ? 4 :
+                ( scale >= 2 ) ? 2 : 1;
+        TUint xCorrection = ( bitmapSize.iWidth % intscale ) ? 1 : 0;
+        TUint yCorrection = ( bitmapSize.iHeight % intscale ) ? 1 : 0;
+        bitmapSize.iWidth /= intscale;
+        bitmapSize.iHeight /= intscale;
+        bitmapSize += TSize( xCorrection, yCorrection );
+        iScaleRquired = ETrue;
+        }
+    return bitmapSize;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXImageUtil::CancelRequest
+// Cancel Asynch requests
+// -----------------------------------------------------------------------------
+//
+void CMPXImageUtil::CancelRequest()
+    {
+    Cancel();
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/src/mpxlbxextendedfeatures.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1042 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of CMPXLbxExtendedFeatures
+*
+*/
+
+
+// INCLUDE FILES
+#include <eiktxlbx.h>
+#include <eiktxlbm.h>
+#include <aknconsts.h>
+#include <aknsoundsystem.h>
+#include <aknViewAppUi.h>
+#include <aknnavide.h>
+#include <aknnavilabel.h>
+#include <eikspane.h>
+#include <aknappui.h>
+#include <StringLoader.h>
+#include <centralrepository.h>
+#include <AknUtils.h>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+#include <MProfileEngine.h>
+#include <MProfile.h>
+#include <MProfileTones.h>
+#include <TProfileToneSettings.h>
+#include <AudioPreference.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxsubscription.h>
+#include <mpxuser.h>
+#include <mpxcommonui.rsg>
+#include <mpxcollectionutility.h>
+#include "mpxinternalcrkeys.h"
+#include "mpxlbxextendedfeatures.h"
+#include "mpxlog.h"
+
+// CONSTANTS
+const TInt KMPXDefaultKeyRepeatInitDelay = KAknKeyboardRepeatInitialDelay;
+const TInt KMPMicroSecPerMilliSec = 1000;
+const TInt KSoundInterval = 1000000;  // 1 second
+const TInt KMaxVolumeLevel = 3;
+const TInt KSpeedScrollSetIndexInterval = 5;
+
+_LIT( KMPXCommonUiRscPath, "mpxcommonui.rsc" );
+//_LIT8( KPhoneNormalBeepSequence, "\x00\x11\x0A\x71\x06\x0B" );
+_LIT8( KPhoneFastBeepSequence, "\x00\x11\x0A\x76\x06\x0B" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::CMPXLbxExtendedFeatures
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXLbxExtendedFeatures::CMPXLbxExtendedFeatures(
+    CEikTextListBox* aLbx,
+    TBool aEnableSetIndex ) :
+    iLbx( aLbx ),
+    iKeyStatus( EMPXKeyOther ),
+    iScrollingState( EMPXScrollingIdle ),
+    iNaviEnabled( ETrue ),
+    iKeysoundEnabled( ETrue ),
+    iEnableSetIndex( aEnableSetIndex )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::ConstructL()
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::ConstructL" );
+
+    CCoeEnv* coeEnv = CEikonEnv::Static();
+    TParse parse;
+    parse.Set( KMPXCommonUiRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    // connect to window server for scrolling speed setting
+    iWsSession = CEikonEnv::Static()->WsSession();
+    TUid naviPaneUid;
+    naviPaneUid.iUid = EEikStatusPaneUidNavi;
+    iNaviPane =
+        static_cast<CAknNavigationControlContainer*>
+        ( iAvkonViewAppUi->StatusPane()->ControlL( naviPaneUid ) );
+
+    GetInfoFromCenRepL();
+
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC );
+    //Create label to change text in Navi pane
+    iNaviLabel = static_cast<CAknNaviLabel*>
+            ( iNaviDecorator->DecoratedControl() );
+
+    iTimer = CPeriodic::NewL( CActive::EPriorityIdle );
+
+    iToneUtility = CMdaAudioToneUtility::NewL( *this, NULL );
+    iToneUtility->SetPriority(
+        KAudioPriorityKeyPress,
+        static_cast<TMdaPriorityPreference>( KAudioPrefKeyPressNonDTMF ) );
+    iToneUtility->SetRepeats( 1,
+        TTimeIntervalMicroSeconds( KSoundInterval ) );
+
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
+
+#ifdef __USE_MESSAGE_SUBSCRIPTION
+    // Subscribe to only a few messages from collection utility
+    CMPXSubscription* subscription( CMPXSubscription::NewL() );
+    CleanupStack::PushL( subscription );
+    CMPXSubscriptionItem* subItem1( CMPXSubscriptionItem::NewL() );
+    CleanupStack::PushL( subItem1 );
+    subItem1->SetTObjectValueL( KMPXMessageGeneralId, KMPXMessageGeneral );
+    subItem1->SetTObjectValueL( KMPXMessageGeneralEvent, TMPXCollectionMessage::EPathChanged );
+    subItem1->SetTObjectValueL( KMPXMessageGeneralType, EMcPathChangedByOpen );
+    subscription->AddItemL( *subItem1 );
+    iCollectionUtility->Collection().AddSubscriptionL( *subscription );
+    CleanupStack::PopAndDestroy( subItem1 );
+    CleanupStack::PopAndDestroy( subscription );
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXLbxExtendedFeatures* CMPXLbxExtendedFeatures::NewL(
+    CEikTextListBox* aLbx, TBool aEnableSetIndex )
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::NewL" );
+    __ASSERT_DEBUG( aLbx, User::Panic( _L("NewL"), KErrArgument ) );
+
+    CMPXLbxExtendedFeatures* self =
+        new ( ELeave ) CMPXLbxExtendedFeatures( aLbx, aEnableSetIndex );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXLbxExtendedFeatures::~CMPXLbxExtendedFeatures()
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::~CMPXLbxExtendedFeatures" );
+    delete iTimer;
+
+    iWsSession.SetKeyboardRepeatRate(
+        KAknKeyboardRepeatInitialDelay, KAknStandardKeyboardRepeatRate );
+    iWsSession.Flush();
+
+    if ( !iKeysoundEnabled )
+        {
+        // Enable keysound if it's not already enabled
+        iAvkonViewAppUi->KeySounds()->PopContext();
+        }
+
+    if ( iNaviDecorator )
+        {
+        delete iNaviDecorator;
+        }
+
+    if ( iResourceOffset )
+        {
+        CEikonEnv::Static()->DeleteResourceFile( iResourceOffset );
+        }
+
+    if( iToneUtility )
+        {
+        if( iToneUtility->State() == EMdaAudioToneUtilityPlaying )
+            {
+            iToneUtility->CancelPlay();
+            }
+        else
+            {
+            iToneUtility->CancelPrepare();
+            }
+        delete iToneUtility;
+        }
+
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::HandleLbxKeyEventL
+// Handle key events
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TKeyResponse CMPXLbxExtendedFeatures::HandleLbxKeyEventL(
+    const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    //MPX_FUNC( "CMPXLbxExtendedFeatures::HandleLbxKeyEventL" );
+    TKeyResponse keyResponse = EKeyWasNotConsumed;
+
+    if ( iSpeedScrollEnabled )
+        {
+        //MPX_DEBUG2( "CMPXLbxExtendedFeatures::HandleLbxKeyEventL EventType: %d", aType );
+        if ( aType == EEventKeyDown )
+            {
+            MPX_PERF_CHECKPT("Key down issued")
+            // pass it to listbox to handle
+            keyResponse = iLbx->OfferKeyEventL( aKeyEvent, aType );
+            keyResponse = HandleEventKeyDownL( aKeyEvent );
+            iFirstKeyEvent = ETrue;
+            }
+        else if ( aType == EEventKeyUp )
+            {
+            // pass it to listbox to handle
+            keyResponse = iLbx->OfferKeyEventL( aKeyEvent, aType );
+            keyResponse = HandleEventKeyUpL( aKeyEvent );
+            }
+        else if ( aType == EEventKey )
+            {
+            if ( ( aKeyEvent.iScanCode == EStdKeyLeftArrow ) ||
+                ( aKeyEvent.iScanCode == EStdKeyRightArrow ) )
+                {
+                keyResponse = iLbx->OfferKeyEventL(
+                              aKeyEvent, aType );
+                }
+            else if ( !CheckBoundaryCases( iKeyStatus ) )
+                {
+                if ( !iSkipEvent )
+                    {
+                    keyResponse = iLbx->OfferKeyEventL(
+                        aKeyEvent, aType );
+
+                    if ( ( ( aKeyEvent.iScanCode == EStdKeyUpArrow ) ||
+                         ( aKeyEvent.iScanCode == EStdKeyDownArrow ) ) &&
+                         iEnableSetIndex )
+                        {
+                        // Get current listbox item index
+                        TInt currentItem = iLbx->CurrentItemIndex();
+                        if ( currentItem != KErrNotFound )
+                            {
+                            SetIndexToCollectionL( currentItem );
+                            }
+                        }
+                    }
+                else
+                    {
+                    // Simulate the key event to activate the updated scrolling speed
+                    iWsSession.SimulateKeyEvent(aKeyEvent);
+                    keyResponse = EKeyWasConsumed;
+                    }
+                }
+            else
+                {
+                // bump effect
+                if ( iFirstKeyEvent )
+                    {
+                    iSkipEvent = ETrue;
+                    keyResponse = iLbx->OfferKeyEventL(
+                        aKeyEvent, aType );
+
+                    if ( ( ( aKeyEvent.iScanCode == EStdKeyUpArrow ) ||
+                         ( aKeyEvent.iScanCode == EStdKeyDownArrow ) ) &&
+                         iEnableSetIndex )
+                        {
+                        TInt currentItem = iLbx->CurrentItemIndex();
+                        if ( currentItem != KErrNotFound )
+                            {
+                            SetIndexToCollectionL( currentItem );
+                            }
+                        }
+
+                    iKeyStatus = EMPXKeyDown;
+                    if ( aKeyEvent.iScanCode == EStdKeyUpArrow )
+                        {
+                        iKeyStatus = EMPXKeyUp;
+                        }
+
+                    // reset scrolling speed to normal
+                    iScrollingState = EMPXScrollingIdle;
+                    UpdateScrollingSpeed( iKeyStatus );
+                    iScrollingState = EMPXScrolling1stBufferTime;
+
+                    // after crossing the boundary, start timer again
+                    StopTimer();
+                    StartTimerL();
+                    }
+                EnableKeySoundL( EFalse );
+                keyResponse = EKeyWasConsumed;
+                MPX_PERF_CHECKPT("End of list reaches - bump effect");
+                }
+            iFirstKeyEvent = EFalse;
+            iSkipEvent = EFalse;
+            }
+        else
+            {
+            // Other TEventCode; do nothing
+            }
+        } // end if iSpeedScrollEnabled
+    else // iSpeedScrollEnabled is false
+        {
+        // pass it to listbox to handle
+        keyResponse = iLbx->OfferKeyEventL( aKeyEvent, aType );
+
+        // Get current listbox item index
+        if ( ( ( aKeyEvent.iScanCode == EStdKeyUpArrow ) ||
+             ( aKeyEvent.iScanCode == EStdKeyDownArrow ) ) &&
+             iEnableSetIndex )
+            {
+            TInt currentItem = iLbx->CurrentItemIndex();
+            if ( currentItem != KErrNotFound )
+                {
+                SetIndexToCollectionL( currentItem );
+                }
+            }
+        }
+
+    return keyResponse;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::EnableSpeedScroll
+// Enable/disable speed scroll
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXLbxExtendedFeatures::EnableSpeedScrollL( TBool aIsEnable )
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::EnableSpeedScrollL" );
+    iSpeedScrollEnabled = aIsEnable;
+
+    if ( !aIsEnable )
+        {
+        Reset();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::SpeedNaviUpdating
+// Enable or disable speedscroll specific navi labelling
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXLbxExtendedFeatures::SpeedNaviUpdating( TBool aNaviEnable )
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::SpeedNaviUpdating" );
+    iNaviEnabled = aNaviEnable;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::Reset
+// Reset everything to default (eg. scrolling speed)
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::Reset()
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::Reset" );
+    StopTimer();
+
+    // Reset all states to idle
+    iKeyStatus = EMPXKeyOther;
+    iScrollingState = EMPXScrollingIdle;
+
+    // Revert to original speed
+    UpdateScrollingSpeed( iKeyStatus );
+    TRAP_IGNORE( EnableKeySoundL( ETrue ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::EnableAutoLoop
+// Enable/disable auto loop
+// (other items were commented in a header)
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::EnableAutoLoop( TBool aIsEnable )
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::EnableAutoLoop" );
+    iAutoLoopEnabled = aIsEnable;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::StartTimer
+// Start the timer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::StartTimerL()
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::StartTimerL" );
+    TInt bufferTime = 0;
+    TBool enabled = EFalse;
+
+    switch ( iScrollingState )
+        {
+        case EMPXScrolling1stBufferTime:
+            {
+            // Enable 1st buffer timer
+            bufferTime = iFirstBufferTime;
+            enabled = ETrue;
+            break;
+            }
+        case EMPXScrolling2ndBufferTime:
+            {
+            // Enable 2nd buffer timer
+            bufferTime = iSecondBufferTime;
+            enabled = ETrue;
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+
+    if ( enabled )
+        {
+        StopTimer();
+
+        iTimer->Start( TTimeIntervalMicroSeconds32(
+                            bufferTime * KMPMicroSecPerMilliSec ),
+                       TTimeIntervalMicroSeconds32(
+                            bufferTime * KMPMicroSecPerMilliSec ),
+                       TCallBack( TimerCallBack, this ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::StopTimer
+// Stop the timer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::StopTimer()
+    {
+    //MPX_FUNC( "CMPXLbxExtendedFeatures::StopTimer" );
+    if ( iTimer && iTimer->IsActive() )
+        {
+        iTimer->Cancel();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::TimerCallBack
+// Callback function for the timer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXLbxExtendedFeatures::TimerCallBack( TAny* aPtr )
+    {
+    //MPX_FUNC( "CMPXLbxExtendedFeatures::TimerCallBack" );
+    CMPXLbxExtendedFeatures *p = ( CMPXLbxExtendedFeatures* )aPtr;
+    p->BufferTimerHandler();
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::BufferTimerHandler
+// Change scrolling status, called by TimerCallBack()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::BufferTimerHandler()
+    {
+    //MPX_FUNC( "CMPXLbxExtendedFeatures::BufferTimerHandler" );
+    StopTimer();
+    switch ( iScrollingState )
+        {
+        case EMPXScrolling1stBufferTime:
+            {
+            iScrollingState = EMPXScrolling1stSpeed;
+            // Goto first speed
+            UpdateScrollingSpeed( iKeyStatus );
+            TRAP_IGNORE( EnableKeySoundL( EFalse ) );
+            break;
+            }
+        default:
+            {
+            // Reset all states if timeout
+            Reset();
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::UpdateScrollingSpeed
+// Update and return scrolling speed
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::UpdateScrollingSpeed( TMPXKeyStatus aKeyStatus )
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::UpdateScrollingSpeed" );
+    TInt rate = 0;
+    TInt repeatInitDelay = 0;
+    TBool updated = EFalse;
+
+    switch ( iScrollingState )
+        {
+        case EMPXScrolling1stSpeed:
+            {
+            MPX_DEBUG1( ">>>CMPXLbxExtendedFeatures::UpdateScrollingSpeed rate changed: first speed" );
+            repeatInitDelay = iFirstSpeed * KMPMicroSecPerMilliSec;
+            rate = iFirstSpeed * KMPMicroSecPerMilliSec;
+            updated = ETrue;
+
+            iSkipPlaying = EFalse;
+            // TO-DO: timing problem with CMdaAudioToneUtility in S60 3.0,
+            // enable this may crash, should be fixed in 3.1?
+            iToneUtility->PrepareToPlayDesSequence( KPhoneFastBeepSequence() );
+            break;
+            }
+        case EMPXScrolling2ndSpeed:
+            {
+            MPX_DEBUG1( ">>>CMPXLbxExtendedFeatures::UpdateScrollingSpeed rate changed: second speed" );
+            repeatInitDelay = iSecondSpeed * KMPMicroSecPerMilliSec;
+            rate = iSecondSpeed * KMPMicroSecPerMilliSec;
+            updated = ETrue;
+
+            iSkipPlaying = EFalse;
+            // TO-DO: timing problem with CMdaAudioToneUtility in S60 3.0,
+            // enable this may crash, should be fixed in 3.1?
+            iToneUtility->CancelPrepare();
+            iToneUtility->PrepareToPlayDesSequence( KPhoneFastBeepSequence() );
+            break;
+            }
+        case EMPXScrollingIdle:
+            {
+            MPX_DEBUG1( ">>>CMPXLbxExtendedFeatures::UpdateScrollingSpeed rate changed: idle" );
+            repeatInitDelay = KMPXDefaultKeyRepeatInitDelay;
+            rate = iFirstSpeed * KMPMicroSecPerMilliSec;
+            updated = ETrue;
+
+            if( iToneUtility->State() == EMdaAudioToneUtilityPlaying )
+                {
+                MPX_DEBUG1( ">>>CMPXLbxExtendedFeatures::UpdateScrollingSpeed rate changed: idle cancel play" );
+                iSkipPlaying = EFalse;
+                iToneUtility->CancelPlay();
+                }
+
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+
+    if ( updated )
+        {
+        if( !CheckBoundaryCases( aKeyStatus ) )
+            {
+            TRAP_IGNORE( SetNaviSpeedTextL( EFalse ) );
+            }
+        // Change scrolling speed
+        iWsSession.SetKeyboardRepeatRate( repeatInitDelay, rate );
+        iWsSession.Flush();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::CheckBoundaryCases
+// Check whether boundary is reached
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CMPXLbxExtendedFeatures::CheckBoundaryCases(
+    TMPXKeyStatus aKeyStatus )
+    {
+    //MPX_FUNC( "CMPXLbxExtendedFeatures::CheckBoundaryCases" );
+    __ASSERT_DEBUG( iLbx, User::Panic( _L("CheckBoundaryCases"), KErrArgument ) );
+
+    TBool reached = EFalse;
+
+    if ( !iAutoLoopEnabled )
+        {
+        // Get total number of items in the listbox
+        TInt totalCount = iLbx->Model()->NumberOfItems();
+
+        // Get current listbox item index
+        TInt currentItem = iLbx->CurrentItemIndex();
+
+        //CHECK BOUNDARIES
+        if ( aKeyStatus == EMPXKeyUp && currentItem == 0 )
+            {
+            reached = ETrue;
+            }
+        if ( aKeyStatus == EMPXKeyDown && ( currentItem == totalCount - 1 ) )
+            {
+            reached = ETrue;
+            }
+        }
+
+    if( reached )
+        {
+        // boundary reached, stop all keytones
+        if( iToneUtility->State() == EMdaAudioToneUtilityPlaying )
+            {
+            MPX_DEBUG1( ">>>CMPXLbxExtendedFeatures::CheckBoundaryCases cancel play" );
+            iSkipPlaying = ETrue;
+            iToneUtility->CancelPlay();
+            }
+
+        TRAP_IGNORE( SetNaviSpeedTextL( reached ) );
+        }
+
+    return reached;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::GetInfoFromCenRepL
+// Get info (eg. scrolling speed) from the cenrep
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::GetInfoFromCenRepL()
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::GetInfoFromCenRepL" );
+    CRepository* repository = CRepository::NewLC( KCRUidMPXMPExtendedFeatures );
+
+    User::LeaveIfError( repository->Get( KMPXMPSpeedScrollFirBuffTime,
+        iFirstBufferTime ) );
+    User::LeaveIfError( repository->Get( KMPXMPSpeedScrollSecBuffTime,
+        iSecondBufferTime ) );
+    User::LeaveIfError( repository->Get( KMPXMPSpeedScrollFirSpeed,
+        iFirstSpeed ) );
+    User::LeaveIfError( repository->Get( KMPXMPSpeedScrollSecSpeed,
+        iSecondSpeed ) );
+
+    CleanupStack::PopAndDestroy(); // repository
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::SetNaviSpeedTextL
+// Update navi pane label for speed scrolling.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::SetNaviSpeedTextL( TBool boundaryReached )
+    {
+    //MPX_FUNC( "CMPXLbxExtendedFeatures::SetNaviSpeedTextL" );
+    if ( iNaviEnabled )
+        {
+        if( iScrollingState == EMPXScrolling2ndSpeed
+            && !boundaryReached )
+            {
+            HBufC* speedFast =
+                StringLoader::LoadLC( R_MPX_CUI_SCROLL_SPEED_FAST );
+            iNaviLabel->SetTextL( *speedFast );
+            CleanupStack::PopAndDestroy();
+
+            iNaviPane->PushL( *iNaviDecorator );
+            iNaviPane->DrawNow();
+            }
+        // Boundary or idle
+        else
+            {
+            iNaviPane->Pop( iNaviDecorator );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::HandleEventKeyDownL
+// Handles key down event
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CMPXLbxExtendedFeatures::HandleEventKeyDownL(
+    const TKeyEvent& aKeyEvent )
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::HandleEventKeyDown" );
+
+    TKeyResponse keyResponse = EKeyWasNotConsumed;
+    // Stop the timer
+    StopTimer();
+    iSkipPlaying = EFalse;
+
+    // if not up or down arrow key, don't start timer
+    if ( ( aKeyEvent.iScanCode == EStdKeyUpArrow ) ||
+        ( aKeyEvent.iScanCode == EStdKeyDownArrow ) )
+        {
+        keyResponse = EKeyWasConsumed;
+
+        // current key event
+        // used to compare with previous key event
+        TMPXKeyStatus currentKeyStatus = EMPXKeyDown;
+
+        if ( aKeyEvent.iScanCode == EStdKeyUpArrow )
+            {
+            currentKeyStatus = EMPXKeyUp;
+            }
+
+        if ( CheckBoundaryCases( currentKeyStatus ) )
+            {
+            EnableKeySoundL( EFalse );
+            }
+        else
+            {
+            EnableKeySoundL( ETrue );
+            }
+
+        if ( iKeyStatus == currentKeyStatus )
+            {
+            switch ( iScrollingState )
+                {
+                case EMPXScrolling2ndBufferTime:
+                    {
+                    iScrollingState = EMPXScrolling2ndSpeed;
+                    iIndexCount = 0; // reset counter
+                    // Goto second speed
+                    UpdateScrollingSpeed( iKeyStatus );
+                    EnableKeySoundL( EFalse );
+                    break;
+                    }
+                default:
+                    {
+                    // Do nothing
+                    break;
+                    }
+                }
+            }
+        else // if current key is opposite from previous
+            {
+            switch ( iScrollingState )
+                {
+                case EMPXScrolling1stSpeed:
+                case EMPXScrolling2ndBufferTime:
+                case EMPXScrolling2ndSpeed:
+                    {
+                    // Need to activate the updated scrolling speed
+                    iSkipEvent = ETrue;
+                    break;
+                    }
+                default:
+                    {
+                    break;
+                    }
+                }
+
+            // Reset to idle state
+            Reset();
+            // Update key status
+            iKeyStatus = currentKeyStatus;
+            // Start the 1st buffer timer for next key
+            iScrollingState = EMPXScrolling1stBufferTime;
+            StartTimerL();
+            }
+        }
+    else
+        {
+        // Reset everything to idle state
+        Reset();
+        }
+    return keyResponse;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::HandleEventKeyUpL
+// Handles key down event
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CMPXLbxExtendedFeatures::HandleEventKeyUpL(
+    const TKeyEvent& aKeyEvent )
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::HandleEventKeyUp" );
+    TKeyResponse keyResponse = EKeyWasNotConsumed;
+    iSkipPlaying = EFalse;
+
+    // if not up or down arrow key, don't reset timer
+    if ( ( aKeyEvent.iScanCode == EStdKeyUpArrow ) ||
+        ( aKeyEvent.iScanCode == EStdKeyDownArrow ) )
+        {
+        switch ( iScrollingState )
+            {
+            case EMPXScrolling2ndSpeed:
+                {
+                // leaving speed scrolling, set index
+                SetIndexToCollectionL( iLbx->CurrentItemIndex(), ETrue );
+                } // fall through
+            case EMPXScrolling1stSpeed:
+                {
+                // Enable 2nd buffer timer
+                iScrollingState = EMPXScrolling2ndBufferTime;
+                StartTimerL();
+                EnableKeySoundL( ETrue );
+                break;
+                }
+            default:
+                {
+                // Reset all states for other scrolling states
+                Reset();
+                break;
+                }
+            }
+        keyResponse = EKeyWasConsumed;
+        }
+    return keyResponse;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::EnableKeySoundL
+// Enables/Disables Keysound
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::EnableKeySoundL( TBool aEnable )
+    {
+    //MPX_FUNC( "CMPXLbxExtendedFeatures::EnableKeySoundL" );
+    //MPX_DEBUG2( "CMPXLbxExtendedFeatures::EnableKeySoundL: aEnable: %d", aEnable );
+
+    if ( aEnable )
+        {
+        if ( !iKeysoundEnabled )
+            {
+            MPX_DEBUG1( "CMPXLbxExtendedFeatures::EnableKeySoundL: aEnable: pop" );
+            iKeysoundEnabled = ETrue;
+            // Enable keysound if it's not already enabled
+            iAvkonViewAppUi->KeySounds()->PopContext();
+            MPX_DEBUG2( "CMPXLbxExtendedFeatures::EnableKeySoundL: aEnable: %d", aEnable );
+            }
+        }
+    else
+        {
+        if ( iKeysoundEnabled )
+            {
+            MPX_DEBUG1( "CMPXLbxExtendedFeatures::EnableKeySoundL: aEnable: push" );
+            iKeysoundEnabled = EFalse;
+            // Disable keysound if it's enabled
+            iAvkonViewAppUi->KeySounds()->PushContextL(
+                R_MPX_CUI_UP_DOWN_KEYS_SILENT );
+            MPX_DEBUG2( "CMPXLbxExtendedFeatures::EnableKeySoundL: aEnable: %d", aEnable );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::SetIndexToCollectionL
+// Send a select index command to collection async
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::SetIndexToCollectionL(
+    TInt aIndex, TBool aForceSet )
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::SetIndexToCollectionL" );
+    // In case we are speed scrolling, we may flood w/ many unfinished selects
+    //
+    TBool okToSet( ETrue );
+    if ( !aForceSet && iScrollingState == EMPXScrolling2ndSpeed )
+        {
+        iIndexCount++;
+        if ( iIndexCount < KSpeedScrollSetIndexInterval )
+            {
+            okToSet = EFalse;
+            }
+        else
+            {
+            iIndexCount = 0;
+            }
+        }
+    if ( okToSet )
+        {
+        MPX_DEBUG1( "CMPXLbxExtendedFeatures::SetIndexToCollectionL ok to set" );
+        CMPXCommand* command = CMPXCommand::NewL();
+        CleanupStack::PushL( command );
+        command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId,
+                                                  KMPXCommandIdCollectionSelect );
+        command->SetTObjectValueL( KMPXCommandCollectionSelectIndex, aIndex );
+
+        iCollectionUtility->Collection().CommandL( *command );
+        CleanupStack::PopAndDestroy( command );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::DoHandleCollectionMessageL
+// -----------------------------------------------------------------------------
+void CMPXLbxExtendedFeatures::DoHandleCollectionMessageL(
+    CMPXMessage* aMessage,
+    TInt /*aError*/ )
+    {
+    MPX_FUNC("CMPXLbxExtendedFeatures::DoHandleCollectionMessageL()");
+
+    TMPXMessageId id( aMessage->ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage->ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt type( aMessage->ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        if ( event == TMPXCollectionMessage::EPathChanged &&
+             type == EMcPathChangedByOpen )
+            {
+            iCollectionUtility->Collection().CancelRequest();
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::MatoPrepareComplete
+//
+// Once tone initialization is complete, set tone settings and start playing
+// the tone.
+//
+// There's no fallback mechanism for tone player
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::MatoPrepareComplete( TInt aError )
+    {
+    //MPX_FUNC( "CMPXLbxExtendedFeatures::MatoPrepareComplete" );
+    MPX_DEBUG2( "CMPXLbxExtendedFeatures::MatoPrepareComplete START: aError = %d", aError );
+
+    MProfileEngine* profileEngine = NULL;
+    MProfile* profile = NULL;
+    TInt profileVolume = 0;
+
+    MPX_TRAPD( err, profileEngine = CreateProfileEngineL() );
+    if( err )
+        {
+        profileEngine = NULL;
+        }
+
+    if( profileEngine )
+        {
+        TRAP_IGNORE( profile = profileEngine->ActiveProfileL() );
+
+        if( profile )
+            {
+            const TProfileToneSettings& setting =
+                profile->ProfileTones().ToneSettings();
+            profileVolume = ( setting.iRingingType == EProfileRingingTypeSilent ?
+                0 : setting.iKeypadVolume );
+            profile->Release();
+            }
+        profileEngine->Release();
+        }
+
+    TInt toneVolume = iToneUtility->MaxVolume() *
+        profileVolume / KMaxVolumeLevel;
+    iToneUtility->SetVolume( toneVolume );
+
+    MPX_DEBUG1( "CMPXLbxExtendedFeatures::MatoPrepareComplete start playing" );
+    if ( KErrNone == aError )
+        {
+        iSkipPlaying = EFalse;
+        iToneUtility->Play();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXLbxExtendedFeatures::MatoPlayComplete
+// -----------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::MatoPlayComplete( TInt aError )
+    {
+    //MPX_FUNC( "CMPXLbxExtendedFeatures::MatoPlayComplete" );
+    MPX_DEBUG4( "CMPXLbxExtendedFeatures::MatoPlayComplete START: iScrollingState = %d, iSkipPlaying = %d, aError = %d",
+        iScrollingState, iSkipPlaying, aError);
+    if ( ( KErrNone == aError ) && ( !iSkipPlaying ) )
+        {
+        iToneUtility->Play();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handle collection message.
+// ---------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::HandleCollectionMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::HandleCollectionMessage" );
+    TRAP_IGNORE( DoHandleCollectionMessageL( aMessage, aError ));
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d a folder
+// ---------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::HandleOpenL(
+    const CMPXMedia& /*aEntries*/,
+    TInt /*aIndex*/,
+    TBool /*aComplete*/,
+    TInt /*aError*/ )
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::HandleOpenL" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d an item. Client typically responds by
+// 'playing' the item
+// ---------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::HandleOpenL(
+    const CMPXCollectionPlaylist& /*aPlaylist*/,
+    TInt /*aError*/ )
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::HandleOpenL 2" );
+    // Do Nothing: playback/fetch client should handle this stage
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle media properties
+// ---------------------------------------------------------------------------
+//
+void CMPXLbxExtendedFeatures::HandleCollectionMediaL(
+    const CMPXMedia& /*aMedia*/,
+    TInt /*aError*/)
+    {
+    MPX_FUNC( "CMPXLbxExtendedFeatures::HandleCollectionMediaL" );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/src/mpxsavehelper.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX asynchronour save helper API 
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxsavehelper.h"
+
+#include <eikenv.h>
+#include <pathinfo.h>
+#include <sysutil.h>
+#include <mpxlog.h>
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXSaveHelper::CMPXSaveHelper
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXSaveHelper::CMPXSaveHelper( MMPXSaveHelperObserver* aObserver ) 
+    : CActive( EPriorityStandard )
+    {
+    iObserver = aObserver;
+    }
+
+    
+// -----------------------------------------------------------------------------
+// CMPXSaveHelper::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMPXSaveHelper::ConstructL(MFileManObserver* aFMObserver )
+    {
+    iFileMan = CFileMan::NewL( CEikonEnv::Static()->FsSession(), aFMObserver );
+
+    // Add this active object to the scheduler.
+    CActiveScheduler::Add( this );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXSaveHelper::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXSaveHelper* CMPXSaveHelper::NewL( MMPXSaveHelperObserver* aObserver, MFileManObserver* aFMObserver )
+    {
+    CMPXSaveHelper* self = new( ELeave ) CMPXSaveHelper( aObserver );   
+    CleanupStack::PushL( self );
+    self->ConstructL( aFMObserver );
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXSaveHelper::~CMPXSaveHelper   
+// Destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXSaveHelper::~CMPXSaveHelper()
+    {
+    delete iFileMan;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXSaveHelper::StartCopyOperationL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXSaveHelper::StartCopyOperationL( 
+    const TDesC& anOld, 
+    const TDesC& aNew,
+    TBool aMove /*=EFalse*/ )
+    {
+    if (!IsActive())
+        {
+        if ( aMove )
+            {
+            iFileMan->Move( anOld, aNew, CFileMan::EOverWrite, iStatus );
+            }
+        else
+            {
+            iFileMan->Copy( anOld, aNew, CFileMan::EOverWrite, iStatus );
+            }
+        SetActive();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXSaveHelper::StartCopyOperationL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXSaveHelper::StartCopyOperationL( 
+    RFile& anOldFile, 
+    const TDesC& aNew,
+    TBool aMove /*=EFalse*/,
+    TBool aSync )
+    {
+    if ( !aSync )
+        {
+        if ( !IsActive())
+            {
+            if ( aMove )
+                {
+                TFileName filename;
+                anOldFile.FullName( filename );
+                User::LeaveIfError( iFileMan->Move( filename, aNew, CFileMan::EOverWrite, iStatus ));
+                }
+            else
+                {
+                User::LeaveIfError( iFileMan->Copy( anOldFile, aNew, CFileMan::EOverWrite, iStatus ));
+                }
+                
+            SetActive();
+            }
+        }
+    else
+        {
+        TInt err = iFileMan->Copy( anOldFile, aNew, CFileMan::EOverWrite);
+        if ( !err && iObserver )
+            {
+            iObserver->HandleSaveComplete( iStatus.Int() );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXSaveHelper::RunL
+// -----------------------------------------------------------------------------
+//
+void CMPXSaveHelper::RunL() 
+    {   
+    MPX_DEBUG1("CMPXSaveHelper::RunL(): entering");
+    if ( iObserver )
+        {
+        iObserver->HandleSaveComplete( iStatus.Int() );
+        }
+    MPX_DEBUG1("CMPXSaveHelper::RunL(): exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXSaveHelper::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CMPXSaveHelper::DoCancel()
+    {
+    MPX_DEBUG1("CMPXSaveHelper::DoCancel(): entering");
+    
+    if ( iObserver )
+        {
+        iObserver->HandleSaveComplete( KErrCancel );
+        }
+
+    MPX_DEBUG1("CMPXSaveHelper::DoCancel(): exiting");
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/commonui/src/mpxtlshelper.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of TLS Helper
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxtlshelper.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Initialize TLS for storing application information.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void MPXTlsHelper::InitializeL()
+    {
+    TMPXTlsStruct* tls = reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( !tls )
+        {
+        TMPXTlsStruct* tls = new ( ELeave ) TMPXTlsStruct;
+        tls->iHostUid = KNullUid;
+        tls->iNeedSave = EFalse;
+        tls->iAllowMove = EFalse;
+        tls->iLaunchMode = EMPXLaunchModeStopped;
+        tls->useCount = 1;
+        Dll::SetTls( reinterpret_cast<TAny*>( tls ) );
+        }
+    else
+        {
+        tls->useCount++;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Uninitialize TLS data storage. Must be called
+// before exiting application to unload resources.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void MPXTlsHelper::Uninitialize()
+    {
+    TMPXTlsStruct* tls =  reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( tls && !( --tls->useCount ) )
+        {
+        delete tls;
+        tls = NULL;
+        Dll::SetTls( NULL );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Store host application UID to TLS.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void MPXTlsHelper::SetHostUidL(
+    const TUid& aUid )
+    {
+    TMPXTlsStruct* tls =  reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( tls )
+        {
+        tls->iHostUid = aUid;
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Store file path of saved clip.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void MPXTlsHelper::SetFilePath(
+    const TDesC& aFilePath )
+    {
+    TMPXTlsStruct* tls =  reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( tls )
+        {
+        tls->iFilePath = (TFileName) aFilePath;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Store file path of saved clip.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TFileName MPXTlsHelper::FilePath()
+    {
+    TMPXTlsStruct* tls =  reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( tls )
+        {
+        return (TFileName)tls->iFilePath;
+        }
+
+    return TFileName(NULL);
+    }
+
+// ---------------------------------------------------------------------------
+// Fetch host application UID from TLS.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TUid MPXTlsHelper::HostUid()
+    {
+    TUid hostUid( KNullUid );
+
+    TMPXTlsStruct* tls =  reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( tls )
+        {
+        hostUid = tls->iHostUid;
+        }
+
+    return hostUid;
+    }
+
+// ---------------------------------------------------------------------------
+// Set 'need save' flag.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void MPXTlsHelper::SetNeedSave( TBool aNeedSave )
+    {
+    TMPXTlsStruct* tls =  reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( tls )
+        {
+        tls->iNeedSave = aNeedSave;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get 'need save' flag.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool MPXTlsHelper::NeedSave()
+    {
+    TBool needSave( EFalse );
+
+    TMPXTlsStruct* tls =  reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( tls )
+        {
+        needSave = tls->iNeedSave;
+        }
+
+    return needSave;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets Allow Move flag.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void MPXTlsHelper::SetAllowMove( TBool aAllowMove )
+    {
+    TMPXTlsStruct* tls =  reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( tls )
+        {
+        tls->iAllowMove = aAllowMove;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Gets Allow Move flag.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool MPXTlsHelper::AllowMove()
+    {
+    TBool allowMove( EFalse );
+
+    TMPXTlsStruct* tls =  reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( tls )
+        {
+        allowMove = tls->iAllowMove;
+        }
+
+    return allowMove;
+    }
+
+// ---------------------------------------------------------------------------
+// Set launch mode.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void MPXTlsHelper::SetLaunchModeL( TMPXLaunchMode aMode )
+    {
+    TMPXTlsStruct* tls =  reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( tls )
+        {
+        tls->iLaunchMode = aMode;
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get launch mode.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TMPXLaunchMode MPXTlsHelper::LaunchMode()
+    {
+    TMPXLaunchMode mode( EMPXLaunchModeUnknown );
+
+    TMPXTlsStruct* tls =  reinterpret_cast<TMPXTlsStruct*>( Dll::Tls() );
+    if ( tls )
+        {
+        mode = tls->iLaunchMode;
+        }
+
+    return mode;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/group/backup_registration.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration version="1.0">
+    <proxy_data_manager sid = "0x10202BE9" />
+    <restore requires_reboot = "no"/>
+</backup_registration>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project MPX Music Player.
+*
+*/
+
+
+#include <platform_paths.hrh>
+#include "../help/group/bld.inf"
+#include "../commonui/group/bld.inf"
+#include "../activeidle/group/bld.inf"
+#include "../metadatahandler/group/bld.inf"
+#include "../mediakeyhandler/group/bld.inf"
+#include "../app/group/bld.inf"
+
+#if 0
+// TSP should be owned by product programs and we only provide a reference design of TSP.
+// remove the if 0 statement if you want to use this on winscw
+#include "../internal/remcontsp/group/bld.inf"
+#endif
+
+PRJ_MMPFILES
+
+#ifdef MARM
+ //gnumakefile mpxmusicplayerstubsis.mk
+#endif
+
+PRJ_EXPORTS
+../rom/mpxmusicplayer.iby       CORE_APP_LAYER_IBY_EXPORT_PATH(mpxmusicplayer.iby)
+
+../Conf/mpxmusicplayer.confml             APP_LAYER_CONFML(mpxmusicplayer.confml)
+../Conf/mpxmusicplayer_101F880D.crml 	 APP_LAYER_CRML(mpxmusicplayer_101F880D.crml)
+../Conf/mpxmusicplayer_101FFCD0.crml 	 APP_LAYER_CRML(mpxmusicplayer_101FFCD0.crml)
+../Conf/mpxmusicplayer_101FFCD1.crml 	 APP_LAYER_CRML(mpxmusicplayer_101FFCD1.crml)
+../Conf/mpxmusicplayer_101FFCDC.crml 	 APP_LAYER_CRML(mpxmusicplayer_101FFCDC.crml)
+
+mpxmusicplayerstub.sis              /epoc32/data/z/system/install/mpxmusicplayerstub.sis
+// Secure backup & restore
+backup_registration.xml /epoc32/release/winscw/urel/z/private/102072c3/backup_registration.xml
+backup_registration.xml /epoc32/release/winscw/udeb/z/private/102072c3/backup_registration.xml
+backup_registration.xml /epoc32/data/z/private/102072c3/backup_registration.xml
Binary file mpxmusicplayer/group/mpxmusicplayerstub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/group/mpxmusicplayerstubsis.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,58 @@
+#
+# Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  generates stub sis for mpx music player
+#
+
+
+TARGETDIR=$(EPOCROOT)EPOC32\Data\Z\System\Install
+
+SISNAME=mpxmusicplayerstub
+PKGNAME=mpxmusicplayerstub
+
+$(TARGETDIR) :
+	@perl -S emkdir.pl "$(TARGETDIR)"
+
+do_nothing :
+	rem do_nothing
+
+SISFILE=$(TARGETDIR)\$(SISNAME).sis
+
+$(SISFILE) : ..\sis\$(PKGNAME).pkg
+	makesis -s $? $@ 
+
+#
+# The targets invoked by bld...
+#
+
+MAKMAKE : do_nothing
+
+RESOURCE : do_nothing
+
+SAVESPACE : do_nothing
+
+BLD : do_nothing
+
+FREEZE : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+FINAL : $(TARGETDIR) $(SISFILE)
+
+CLEAN : 
+	-erase $(SISFILE)
+
+RELEASABLES : 
+	@echo $(SISFILE)
Binary file mpxmusicplayer/help/data/xhtml.zip has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/help/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - Initial contribution
+* 
+* Contributors:
+* 
+* 
+* Description:
+* Export help related files.
+*
+*/
+
+#include <platform_paths.hrh>				
+PRJ_EXPORTS
+:zip ../data/xhtml.zip   /epoc32/data/z/resource/ overwrite
+:zip ../data/xhtml.zip   /epoc32/winscw/c/resource/ overwrite
+
+../inc/mus.hlp.hrh	MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/mus.hlp.hrh)
+../rom/mpxmusicplayerhelps_variant.iby		CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(mpxmusicplayerhelps_variant.iby)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/help/inc/mus.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description:
+*
+*/
+	
+//
+// mus.hlp.hrh generated by CSXHelp Utilities.
+//           
+
+#ifndef __MUS_HLP_HRH__
+#define __MUS_HLP_HRH__
+
+_LIT(KMUS_HLP_MUSIC_SUITE_VIEW, "MUS_HLP_MUSIC_SUITE_VIEW"); // 
+_LIT(KMUS_HLP_TRACKS_VIEW, "MUS_HLP_TRACKS_VIEW"); // 
+_LIT(KMUS_HLP_CATEGORY_VIEW, "MUS_HLP_CATEGORY_VIEW"); // 
+_LIT(KMUS_HLP_PODCAST_MAIN_VIEW, "MUS_HLP_PODCAST_MAIN_VIEW"); // 
+_LIT(KMUS_HLP_PODCAST_EPISODES, "MUS_HLP_PODCAST_EPISODES"); // 
+_LIT(KMUS_HLP_PLAYLISTS_VIEW, "MUS_HLP_PLAYLISTS_VIEW"); // 
+_LIT(KMUS_HLP_DOWNLOAD_PLAYBACK_VIEW, "MUS_HLP_DOWNLOAD_PLAYBACK_VIEW"); // 
+_LIT(KMUS_HLP_PLAYBACK_VIEW, "MUS_HLP_PLAYBACK_VIEW"); // 
+_LIT(KMUS_HLP_LIB_MAIN_VIEW, "MUS_HLP_LIB_MAIN_VIEW"); // 
+_LIT(KMUS_HLP_METADATA_EDITING, "MUS_HLP_METADATA_EDITING"); // 
+_LIT(KMUS_HLP_ALBUM_ART_EDITING, "MUS_HLP_ALBUM_ART_EDITING"); // 
+_LIT(KMUS_HLP_AUDIO_SETT, "MUS_HLP_AUDIO_SETT"); // 
+
+#endif 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/help/rom/mpxmusicplayerhelps_variant.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Help IBY file
+*
+*/
+
+
+#ifndef __MPXMUSICPLAYERHELPS_VARIANT_IBY__
+#define __MPXMUSICPLAYERHELPS_VARIANT_IBY__
+
+#if defined(FF_S60_HELPS_IN_USE) 
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x102072C3\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x102072C3\contents.zip)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x102072C3\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x102072C3\index.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x102072C3\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x102072C3\keywords.xml)
+    data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x102072C3\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x102072C3\meta.xml)
+#endif
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/inc/mpxmetadatahandler.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX metadata handler interface definition
+*
+*/
+
+
+
+#ifndef C_MMPXMETADATAHANDLER_H
+#define C_MMPXMETADATAHANDLER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <remconinterfaceselector.h>
+
+// DATA TYPES
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+ *  MPX metadata handler interface.
+ *
+ *  @lib mpxmetadatahandler.lib
+ *  @since S60 5.1
+ */
+NONSHARABLE_CLASS( MMPXMetaDataHandler )
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.1
+     * @param aFlags Flags for creating popups.
+     * @param aObserver Media key command observer
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static MMPXMetaDataHandler* NewL(CRemConInterfaceSelector &aInterfaceSelector);
+
+    /**
+     * Destructor.
+     */
+    virtual ~MMPXMetaDataHandler();
+    };
+
+#endif  // C_MMPXMETADATAHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/inc/mpxsavehelper.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX asynchronous save helper utility
+*
+*/
+
+
+
+#ifndef CMPXSAVEHELPER_H
+#define CMPXSAVEHELPER_H
+
+//  INCLUDES
+#include <f32file.h>
+#include <e32base.h>
+
+// INTERFACE DEFINITION
+/**
+*  Observer class for Async operation
+*/
+NONSHARABLE_CLASS(MMPXSaveHelperObserver)
+    {
+public:
+    /**
+    * 
+    *  @param aBitmap a converted image.
+    *  @param aErr error code
+    */
+    virtual void HandleSaveComplete( TInt aErr ) = 0;
+    };
+
+
+
+// CLASS DECLARATION
+
+/**
+*  CMPXSaveHelper
+*/
+NONSHARABLE_CLASS(CMPXSaveHelper) : public CActive
+    {
+    public:  // Constructors and destructor
+        
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CMPXSaveHelper* NewL( MMPXSaveHelperObserver* aObserver, MFileManObserver* aFMObserver );
+                 
+        /**
+        * Destructor.
+        */
+        IMPORT_C virtual ~CMPXSaveHelper();
+
+    public: // New functions
+        
+        /**
+        * Starts async copy operation
+        * @param anOld source
+        * @param aNew target
+        * @param aMove flag whether to move or just copy
+        * @return void
+        */
+        IMPORT_C void StartCopyOperationL( const TDesC& anOld,
+                                           const TDesC& aNew,
+                                           TBool aMove=EFalse );
+
+        /**
+        * Starts async copy operation
+        * @param anOldFile source
+        * @param aNew target
+        * @param aMove flag whether to move or just copy
+        * @return void
+        */
+        IMPORT_C void StartCopyOperationL( RFile& anOldFile, 
+                                           const TDesC& aNew,
+                                           TBool aMove=EFalse,
+                                           TBool aSync=EFalse );
+
+   private: // Constructors
+
+        /**
+        * C++ default constructor.
+        */
+        CMPXSaveHelper( MMPXSaveHelperObserver* aObserver );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL( MFileManObserver* aFMObserver );
+
+    private: 
+        
+        // From CActive
+        
+        /** @see CActive::RunL() */
+        void RunL();
+        
+        /** @see CActive::DoCancel() */
+        void DoCancel();
+
+    private:    // Data
+        CFileMan* iFileMan;
+        MMPXSaveHelperObserver* iObserver; // not owned
+    };
+
+#endif      // CMPXSAVEHELPER_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/bwinscw/mpxmediakeyhandlerU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@MMPXMediaKeyHandler@@SAPAV1@HPAVMMPXMediaKeyHandlerObserver@@@Z @ 1 NONAME ; class MMPXMediaKeyHandler * MMPXMediaKeyHandler::NewL(int, class MMPXMediaKeyHandlerObserver *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/data/mpxmediakeyhandler.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxmediakeyhandler
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MXMK // 4 letter ID
+
+// INCLUDES
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+
+#include <mpxmediakeyhandler.loc>
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// -----------------------------------------------------------------------------
+// r_mpx_volume_popup_text
+// Text shown in volume popup dialog.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_volume_popup_text
+    {
+    buf = qtn_svk_title_music_player;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_time_durat_hhhmmss_with_zero
+// 103:55:23, 003:15:12 (hours, minutes and seconds) 
+// (separators are locale dependent)
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_time_durat_hhhmmss_with_zero
+    {
+    buf = "%:0%N%:1%T%:2%S%:3";
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_media_key_not_supported
+// Display when media keys aren't supported by player
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_media_key_not_supported
+    {
+    buf = qtn_nmp_note_no_media_key;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_volume_keys_not_supported
+// Display when volume isn't supported by player
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_volume_keys_not_supported
+    {
+    buf = qtn_nmp_note_no_volume_control;
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/eabi/mpxmediakeyhandlerU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_ZN19MMPXMediaKeyHandler4NewLEiP27MMPXMediaKeyHandlerObserver @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxmediakeyhandler.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/mpxmediakeyhandler.iby       CORE_APP_LAYER_IBY_EXPORT_PATH(mpxmediakeyhandler.iby)
+../rom/mpxmediakeyhandlerrsc.iby    LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxmediakeyhandlerrsc.iby)
+../loc/mpxmediakeyhandler.loc	    APP_LAYER_LOC_EXPORT_PATH(mpxmediakeyhandler.loc)
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxmediakeyhandler.mif
+OPTION HEADERFILE mpxmediakeyhandler.mbg
+OPTION SOURCES -c8,8 qgn_graf_mup_status_pop_pause -c8,8 qgn_graf_mup_status_pop_play \
+               -c8,8 qgn_indi_mup_forw -c8,8 qgn_indi_mup_rew \
+               -c8,8 qgn_indi_mup_pause -c8,8 qgn_indi_mup_play
+END
+PRJ_MMPFILES
+
+
+mpxmediakeyhandler.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,6 @@
+/c8,8 qgn_graf_mup_status_pop_pause
+/c8,8 qgn_graf_mup_status_pop_play
+/c8,8 qgn_indi_mup_forw
+/c8,8 qgn_indi_mup_rew
+/c8,8 qgn_indi_mup_pause
+/c8,8 qgn_indi_mup_play
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/group/mpxmediakeyhandler.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxmediakeyhandler.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxmediakeyhandler.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC65
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 10.0
+
+#ifdef IAD_INCLUDE_UPNP 
+MACRO UPNP_INCLUDED
+#endif
+
+MACRO __S60_NOTIFIER_EXTRA_ICONS
+MACRO __S60_AVKON_LAYOUTS
+SOURCEPATH      ../src
+SOURCE          mpxmediakeyhandler.cpp
+SOURCE          mpxmediakeyhandlerimp.cpp
+SOURCE          mpxremconkeyresponse.cpp
+SOURCE          mpxnotifierdialog.cpp
+
+START RESOURCE  ../data/mpxmediakeyhandler.rss
+TARGETPATH      APP_RESOURCE_DIR
+HEADER
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+SYSTEMINCLUDE	/epoc32/include/mmf/server
+LIBRARY			mmfdevsound.lib 
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         apgrfx.lib
+LIBRARY         ws32.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         cdlengine.lib
+LIBRARY         commonengine.lib
+LIBRARY         remconcoreapi.lib
+LIBRARY         remconinterfacebase.lib
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcommon.lib
+#ifdef IAD_INCLUDE_UPNP
+LIBRARY         upnpcommand.lib
+#endif
+LIBRARY         mpxmetadatahandler.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/group/mpxmediakeyhandlericons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxmediakeyhandler
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxmediakeyhandler.mif
+HEADERFILENAME=$(HEADERDIR)/mpxmediakeyhandler.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/inc/mpxmediakeyhandlerimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,389 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of media key handler
+*
+*/
+
+
+
+#ifndef C_CMPXMEDIAKEYHANDLERIMP_H
+#define C_CMPXMEDIAKEYHANDLERIMP_H
+
+
+// INCLUDES
+#include <remconcoreapitargetobserver.h>
+#include <coecntrl.h>
+#include <mpxplaybackobserver.h>
+#include <mpxplaybackframeworkdefs.h>
+
+
+// FORWARD DECLARATIONS
+class CRemConInterfaceSelector;
+class CRemConCoreApiTarget;
+class CRepository;
+class CMPXRemConKeyResponse;
+class MMPXPlaybackUtility;
+class CAknVolumePopup;
+class CMPXNotifierDialog;
+class MMPXMediaKeyHandlerObserver;
+class MMPXMetaDataHandler;
+#ifdef UPNP_INCLUDED
+class CUpnpCopyCommand;
+#endif
+// CLASS DECLARATION
+
+/**
+ *  Media hard key handler implementation class
+ *
+ *  @lib mpxmediakeyhandler.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXMediaKeyHandlerImp ): public CBase,
+                                             public MMPXMediaKeyHandler,
+                                             public MRemConCoreApiTargetObserver,
+                                             public MMPXPlaybackObserver,
+                                             public MCoeControlObserver,
+                                             public MMPXPlaybackCallback
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.1
+     * @param aFlags Flags for creating popups.
+     * @param aObserver Observer for media key handling.
+     * @return Pointer to newly created object.
+     */
+    static MMPXMediaKeyHandler* NewL(
+        TMPXMediaKeyPopupFlags aFlags,
+        MMPXMediaKeyHandlerObserver* aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXMediaKeyHandlerImp();
+
+private:
+
+    /**
+     * C++ default constructor.
+     *
+     * @param aFlags Flags for creating popups.
+     * @param aObserver Custom command observer for media key handling.
+     */
+    CMPXMediaKeyHandlerImp( MMPXMediaKeyHandlerObserver* aObserver );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL( TMPXMediaKeyPopupFlags aFlags );
+
+    /**
+     * Filter and send command to playback utility.
+     *
+     * @param aCommandId command Id to be sent.
+     */
+    void FilterAndSendCommand( TMPXPlaybackCommand aCommandId );
+
+    /**
+     * Help filter and send command to playback utility.
+     *
+     * @param aCommandId command Id to be sent.
+     */
+    void DoFilterAndSendCommandL( TMPXPlaybackCommand aCommandId );
+
+    /**
+     *  Handle playback message
+     *
+     *  @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+    /**
+     *  Handle playback property
+     *
+     *  @param aProperty the property
+     *  @param aValue the value of the property
+     *  @param aError error code
+     */
+    void DoHandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError );
+
+    /**
+     *  Handle media properties.
+     *
+     *  @param aMedia media properties
+     *  @param aError error code
+     */
+    void DoHandleMediaL( const CMPXMedia& aMedia, TInt aError );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     */
+    void DoHandleStateChangedL( TMPXPlaybackState aState );
+
+    /**
+     * Callback for timer
+     *
+     * @param aPtr Pointer pass to this callback function.
+     * @return Zero if callback function doesn't need to be called again.
+     *         Otherwise, non-zero.
+     */
+    static TInt TimerCallback( TAny* aPtr );
+
+    /**
+     * Handle repeat event
+     */
+    void HandleRepeatEvent();
+
+    /**
+     * Retrieves the current player name and type
+     */
+    void GetSubPlayerInfoL(
+        TDes& aSubPlayerName,
+        TMPXPlaybackPlayerType& aCurrentPlayerType );
+
+    /**
+     * Sets the volume popup title to current remote player
+     */
+    void SetVolumePopupTitleL();
+
+    /**
+     * Checks if UPnP is set up and available
+     */
+    TBool IsUpnpVisibleL();
+
+    /**
+     * Updates the volume and the volume command
+     */
+	void UpdateVolume();
+
+// from base class MMPXMediaKeyHandler
+
+    /**
+     * From MMPXMediaKeyHandler
+     * Show playback popup
+     *
+     * @param aMode Playback popup behaviour mode
+     */
+    void ShowPlaybackPopupL( TMPXPlaybackPopupModes aMode );
+
+    /**
+     * From MMPXMediaKeyHandler
+     * Show Volume popup
+     */
+    void ShowVolumePopupL();
+
+    /**
+     * From MMPXMediaKeyHandler
+     * Dismiss notifier popup.
+     *
+     * @param aFlags Popup flag to determine which popup(s) should
+     *               be dismissed.
+     */
+    void DismissNotifier( TMPXMediaKeyPopupFlags aFlags );
+
+    /**
+     * Enable or disable Media Key behavior
+     * @since 3.1
+     * @param aEnable, ETrue, media keys are sent to observers
+     *                 EFalse, media keys are ignored
+     */
+    void SetEnableMediaKeys( TBool aEnable );
+    
+    /**
+     * Gets called when orientation change begins
+     */    
+    void NotifyOrientationChangeBegin();
+    
+// from base class MMPXPlaybackObserver
+
+    /**
+     * From MMPXPlaybackObserver
+     * Handle playback message
+     *
+     * @param aMessage playback message
+     * @param aErr system error code.
+     */
+    void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+// from base class MMPXPlaybackCallback
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle playback property
+     *
+     * @param aProperty the property
+     * @param aValue the value of the property
+     * @param aError error code
+     */
+    void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError );
+
+    /**
+     * 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
+     *
+     * @param aPlayer UID of the subplayer
+     * @param aSubPlayers a list of sub players
+     * @param aComplete ETrue no more sub players. EFalse more subplayer
+     *                  expected
+     * @param aError error code
+     */
+    void HandleSubPlayerNamesL(
+        TUid aPlayer,
+        const MDesCArray* aSubPlayers,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle media properties
+     *
+     * @param aMedia media
+     * @param aError error code
+     */
+    void HandleMediaL( const CMPXMedia& aMedia, TInt aError );
+
+// from base class MRemConCoreApiTargetObserver
+
+    /**
+     * From MRemConCoreApiTargetObserver
+     * A 'play' command has been received.
+     *
+     * @param aSpeed The playback speed.
+     * @param aButtonAct The button action associated with the command.
+     */
+    void MrccatoPlay(
+        TRemConCoreApiPlaybackSpeed aSpeed,
+        TRemConCoreApiButtonAction aButtonAct );
+
+    /**
+     * From MRemConCoreApiTargetObserver
+     * A command has been received.
+     *
+     * @param aOperationId The operation ID of the command.
+     * @param aButtonAct The button action associated with the command.
+     */
+    void MrccatoCommand(
+        TRemConCoreApiOperationId aOperationId,
+        TRemConCoreApiButtonAction aButtonAct );
+
+    /**
+     * From MRemConCoreApiTargetObserver
+     * A 'tune function' command has been received.
+     *
+     * @param aTwoPart Determine which channel to be used.
+     * @param aMajorChannel The major channel number.
+     * @param aMinorChannel The minor channel number.
+     * @param aButtonAct The button action associated with the command.
+     */
+    void MrccatoTuneFunction(
+        TBool aTwoPart,
+        TUint aMajorChannel,
+        TUint aMinorChannel,
+        TRemConCoreApiButtonAction aButtonAct );
+
+    /**
+     * From MRemConCoreApiTargetObserver
+     * A 'select disk function' has been received.
+     *
+     * @param aDisk The disk.
+     * @param aButtonAct The button action associated with the command.
+     */
+    void MrccatoSelectDiskFunction(
+        TUint aDisk,
+        TRemConCoreApiButtonAction aButtonAct );
+
+    /**
+     * From MRemConCoreApiTargetObserver
+     * A 'select AV input function' has been received.
+     *
+     * @param aAvInputSignalNumber The AV input.
+     * @param aButtonAct The button action associated with the command.
+     */
+    void MrccatoSelectAvInputFunction(
+        TUint8 aAvInputSignalNumber,
+        TRemConCoreApiButtonAction aButtonAct );
+
+    /**
+     * From MRemConCoreApiTargetObserver
+     * A 'select audio input function' has been received.
+     *
+     * @param aAudioInputSignalNumber The audio input.
+     * @param aButtonAct The button action associated with the command.
+     */
+    void MrccatoSelectAudioInputFunction(
+        TUint8 aAudioInputSignalNumber,
+        TRemConCoreApiButtonAction aButtonAct );
+
+	/**
+	* From MCoeControlObserver. To handle the volume events.
+	*/
+	void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
+
+    /**
+     * Check the mpx app is foreground.
+     * 
+     * @return The check result. If mpx is foreground, return true.
+     */
+    TBool IsAppForeground();
+
+private:    // Data
+
+    CRemConInterfaceSelector* iInterfaceSelector;   // owned
+    CRemConCoreApiTarget* iCoreTarget;              // not own
+    CPeriodic* iTimer;                              // owned
+    CMPXRemConKeyResponse* iResponseHandler;        // owned
+    CRepository* iSettingsRepository;               // owned
+    CAknVolumePopup* iVolPopup;                     // owned
+    CMPXNotifierDialog* iPlaybackPopup;             // owned
+
+    MMPXPlaybackUtility* iPlaybackUtility;          // not own
+    MMPXMediaKeyHandlerObserver* iObserver;         // not own
+
+    // RemCon target for handling AVRCP 1.3 metadata commands
+    MMPXMetaDataHandler* iMetaDataHandler;  				// own
+
+    TInt iResourceOffset;                           // must be freed
+    TInt iShowPopups;                               // Indicate which popup(s) should be shown
+    TMPXPlaybackCommand iCommandId;                 // Command ID for repeat key events
+    TBool iEnable;                                  // Media Key enabled / disabled
+    TBool iUpnpFrameworkSupport;                    // UPnP framework support
+
+    /**
+     * Current track's info
+     */
+    HBufC* iTrackTitle;                             // owned
+    TMPXPlaybackState iPlayerState;
+    TInt iPlaybackPosition; // in seconds
+    TBool iSkipping;
+    TInt iCurrentVol;
+    TBool iIncreaseVol;
+    TBool iMuted;
+    TInt iTouchVolEventCount;
+    TInt iVolumeEventCount;
+    TInt iVolumeSteps;			// Number of volume steps in ui
+    #ifdef UPNP_INCLUDED
+    CUpnpCopyCommand* iUpnpCopyCommand;
+    #endif
+    TInt iUpnpVolume; // absolute upnp volume value
+    };
+
+#endif  // C_CMPXMEDIAKEYHANDLERIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/inc/mpxnotifierdialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of media key handler
+*
+*/
+
+
+
+#ifndef C_CMPXNOTIFIERDIALOG_H
+#define C_CMPXNOTIFIERDIALOG_H
+
+
+// INCLUDES
+#include <coecntrl.h>
+#include <mpxpskeyobserver.h>   // MMPXPSKeyObserver
+#include <mpxmediakeyhandlerdefs.h>
+
+
+// FORWARD DECLARATIONS
+class MAknsSkinInstance;
+class TAknsItemID;
+class CEikLabel;
+class CEikImage;
+class CMPXPSKeyWatcher;
+
+// CLASS DECLARATION
+
+/**
+ *  Music Player playback info popup.
+ *
+ *  @lib mpxmediakeyhandler.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXNotifierDialog ) : public CCoeControl,
+										  public MMPXPSKeyObserver
+    {
+public:
+
+    enum TMPXPlaybackPopupIcons
+        {
+        EMPXPopupNoneIcon = 0,
+        EMPXPopupPlayIcon,
+        EMPXPopupPauseIcon,
+        EMPXPopupFFIcon,
+        EMPXPopupFRIcon
+        };
+
+    enum TMPXPlaybackPopupComponents
+        {
+        EMPXPlayIcon = 0,
+        EMPXPauseIcon,
+        EMPXFFIcon,
+        EMPXFRIcon,
+        EMPXTrackLabel,
+        EMPXTimeLabel,
+        EMPXComponentsCount
+        };
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXNotifierDialog* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXNotifierDialog();
+
+    /**
+     * Shows pop-up dialog.
+     *
+     * @since 3.0
+     * @param aIcon used icon
+     * @param aTitle song tittle
+     * @param aTime playback time in seconds
+     * @param aMode Mode to determine the popup's behaviour
+     */
+    void ShowInfoPopupL(
+        TMPXPlaybackPopupIcons aIcon,
+        const TDesC& aTitle,
+        TInt aTime,
+        TMPXPlaybackPopupModes aMode );
+
+    /**
+     * Removes pop-up from screen.
+     *
+     * @since 3.0
+     */
+    void CancelInfoPopup();
+
+    /**
+     * Gets called when orientation change begins
+     */        
+    void NotifyOrientationChangeBegin();
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXNotifierDialog();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Updates pop-up dialog contents.
+     *
+     * @param aIcon used icon
+     * @param aTitle song tittle
+     * @param aTime playback time in seconds
+     */
+    void UpdateInfoPopupL(
+        TMPXPlaybackPopupIcons aIcon,
+        const TDesC& aTitle,
+        TInt aTime );
+
+    /**
+     * Create icons.
+     */
+    void CreateIconsL();
+
+    /**
+     * Constructs skinnable icon.
+     *
+     * @param aImage Pointer to the skinnable icon on return.
+     * @param aSkin Pointer to the current skin instance.
+     * @param aId Item ID of the masked bitmap to be created.
+     * @param aColorId Item ID of the color table.
+     * @param aColorIndex Index in the color table.
+     * @param aBitmapId mbm id of the bitmap
+     * @param aMaskId   mbm id of the mask
+     */
+    void ConstructImageL(
+        CEikImage* aImage,
+        MAknsSkinInstance* aSkin,
+        const TAknsItemID& aId,
+        const TAknsItemID& aColorId,
+        TInt aColorIndex,
+        TInt aBitmapId,
+        TInt aMaskId );
+
+    /**
+     * Resize info popup.
+     */
+    void ResizeInfoPopup();
+
+    /**
+     * Sets pop-up layouts.
+     */
+    void SetLayoutsL( TBool aLong = EFalse );
+
+    /**
+     * Show playback icon.
+     *
+     * @param aIcon Icon to be displayed.
+     * @return ETrue if it's ok to displayed. Otherwise, EFalse.
+     */
+    void ShowIcon(
+        TMPXPlaybackPopupIcons aIcon );
+
+    /**
+     * Callback for timer
+     *
+     * @param aPtr Pointer pass to this callback function.
+     * @return Zero if callback function doesn't need to be called again.
+     *         Otherwise, non-zero.
+     */
+    static TInt TimerCallback( TAny* aPtr );
+
+    /**
+     * Convert to displayable duration
+     *
+     * @since S60 v3.0
+     * @param aduration Duration in seconds
+     * @return A heap descriptor that contains displayable duration
+     *         (ownership transferred). Caller must destroy this object
+     *         after use.
+     */
+    HBufC* DisplayableDurationL(
+        TInt aDuration );
+
+// from base class CoeControl
+
+    /**
+     * From CCoeControl.
+     * Draws the control.
+     *
+     * @param aRect The rectangular region of the control to be drawn.
+     */
+    void Draw( const TRect& aRect ) const;
+
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );
+
+    /**
+     * From CCoeControl.
+     * Responds to changes to the size and position of the contents of this
+     * control.
+     */
+    void SizeChanged();
+
+    /**
+     * From CCoeControl.
+     * Gets the number of controls contained in a compound control.
+     *
+     * @return The number of component controls contained by this control.
+     */
+    TInt CountComponentControls() const;
+
+    /**
+     * From CCoeControl.
+     * Gets an indexed component of a compound control.
+     *
+     * @param aIndex The index of the control.
+     * @return The component control with an index of aIndex.
+     */
+    CCoeControl* ComponentControl( TInt aIndex ) const;
+protected:    // from MMPXPSKeyObserver
+
+	/**
+	* From MMPXPSKeyObserver
+	* Handle PS event
+	*
+	* @param aUid The UID that identifies the property category
+	* @param aKey The property sub-key
+	*/
+	void HandlePSEvent( TUid aUid, TInt aKey );
+    
+	
+private:    // Data
+
+    CEikLabel* iSongLabel;  // own
+    CEikLabel* iTimeLabel;  // own
+    CEikImage* iPlayIcon;   // own
+    CEikImage* iPauseIcon;  // own
+    CEikImage* iFFIcon;   // own
+    CEikImage* iFRIcon;  // own
+    CPeriodic* iTimer;      // own
+    RWindowGroup iWindowGroup;  // own
+    CMPXPSKeyWatcher* iPSKeyWatcher;    // own
+
+    TMPXPlaybackPopupIcons iIconShown;
+    
+    TBool iReopenDialog;
+    };
+
+#endif  // C_CMPXNOTIFIERDIALOG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/inc/mpxremconkeyresponse.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class for sending response back to RemCon Framework.
+*
+*/
+
+
+
+#ifndef C_CMPXREMCONKEYRESPONSE_H
+#define C_CMPXREMCONKEYRESPONSE_H
+
+
+// INCLUDE FILES
+#include <remconcoreapitarget.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  Helper class for sending response back to 
+ *  Remote Controller Framework.
+ *  All events must be completed.
+ *
+ *  @lib mpxmediakeyhandler.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXRemConKeyResponse ) : public CActive
+    {
+public:
+        
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @param aRemConCoreApiTarget RemCon core target object.
+     * @return Pointer to newly created object.
+     */
+    static CMPXRemConKeyResponse* NewL( 
+        CRemConCoreApiTarget& aRemConCoreApiTarget );
+        
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXRemConKeyResponse();
+   
+    /**
+     * Send the any key response back to Remcon server
+     *
+     * @since 3.0
+     * @param aOperationId RemCon operation Id.
+     */
+    void CompleteAnyKey( TRemConCoreApiOperationId aOperationId );
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXRemConKeyResponse(
+        CRemConCoreApiTarget& aRemConCoreApiTarget );
+
+// from base class CActive
+
+    /**
+     * From CActive
+     * Handles an active object's request completion event.
+     */
+    void RunL();
+
+    /**
+     * From CActive
+     * Implements cancellation of an outstanding request.
+     */
+    void DoCancel();
+
+private:    // Data
+
+    /**
+     * Response array.
+     * Own.
+     */
+    RArray<TRemConCoreApiOperationId> iResponseArray;
+    
+    /**
+     * Remote controller.
+     * Not own.
+     */
+    CRemConCoreApiTarget& iRemConCoreApiTarget;
+    }; 
+
+#endif  // C_CMPXREMCONKEYRESPONSE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/loc/mpxmediakeyhandler.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxmediakeyhandler
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:A string in the volume pop up control.
+// d:Shown when the user is changing volume and
+// d:application is active.
+// l:popup_side_volume_key_window_t1
+// r:3.1
+//
+#define qtn_svk_title_music_player "Music Player"
+
+// d:Media keypress not supported error note
+// d:Display when media key event isn't supported by player
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_no_media_key   "Media key event not supported by player"
+
+// d:Volume not supported error note
+// d:Display when volume isn't supported by player
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_no_volume_control  "Volume control not supported by player"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/rom/mpxmediakeyhandler.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project MPX Media Key Handler.
+*
+*/
+
+
+#ifndef MPXMEDIAKEYHANDLER_IBY
+#define MPXMEDIAKEYHANDLER_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxmediakeyhandler.dll       SHARED_LIB_DIR\mpxmediakeyhandler.dll
+SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, mpxmediakeyhandler )
+
+#endif  // MPXMEDIAKEYHANDLER_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/rom/mpxmediakeyhandlerrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project MPX Media Key Handler.
+*
+*/
+
+
+#ifndef MPXMEDIAKEYHANDLERRSC_IBY
+#define MPXMEDIAKEYHANDLERRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxmediakeyhandler.rsc     APP_RESOURCE_DIR\mpxmediakeyhandler.rsc
+
+#endif  // MPXMEDIAKEYHANDLERRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/src/mpxmediakeyhandler.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Media key handler interface
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <mpxmediakeyhandler.h>
+#include "mpxmediakeyhandlerimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MMPXMediaKeyHandler* MMPXMediaKeyHandler::NewL(
+    TMPXMediaKeyPopupFlags aFlags,
+    MMPXMediaKeyHandlerObserver* aObserver )
+    {
+    return CMPXMediaKeyHandlerImp::NewL( aFlags, aObserver );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+MMPXMediaKeyHandler::~MMPXMediaKeyHandler()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/src/mpxmediakeyhandlerimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1277 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of media key handler
+*
+*/
+
+
+// INCLUDE FILES
+#include <bldvariant.hrh>
+#include <remconcoreapitarget.h>
+#include <remconcoreapitargetobserver.h>
+#include <remconinterfaceselector.h>
+#include <aknconsts.h>
+#include <AknUtils.h>
+#include <eikenv.h>
+#include <bautils.h>
+#include <StringLoader.h>
+#include <apgwgnam.h>
+
+#ifdef UPNP_INCLUDED
+#include <upnpcopycommand.h>  
+#endif
+
+
+#include <aknnotewrappers.h>  // AknErrorNote
+#include <AknVolumePopup.h>
+
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxmediakeyhandler.rsg>
+#include <mpxmedia.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessagedefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxuser.h>
+#include <mpxmediakeyhandler.h>
+#include <mpxlog.h>
+#include <layoutmetadata.cdl.h>
+#include <mpxconstants.h>
+
+#include "mpxmetadatahandler.h"
+#include <mpxplaybackframeworkdefs.h>
+#include <sounddevice.h>
+#include "mpxmediakeyhandlerimp.h"
+#include "mpxremconkeyresponse.h"
+#include "mpxnotifierdialog.h"
+
+
+// CONSTANTS
+const TInt KFirstTimerExpiryInterval( 1 ); // Expire immediately
+const TInt KTimerExpiryInterval( KAknStandardKeyboardRepeatRate );
+const TInt KMPXOneSecInMilliSecs( 1000 );
+const TInt KMPXMinVolume(0);
+const TInt KMPXMaxVolume(100);		// Max volume used in volume popup
+const TInt KMPXVolumeSteps(1);
+const TInt KTenStepsVolume = 10;   
+const TInt KTwentyStepsVolume = 20;
+
+_LIT( KMPXMediaKeyHandlerRscPath, "mpxmediakeyhandler.rsc" );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXMediaKeyHandlerImp::CMPXMediaKeyHandlerImp(
+    MMPXMediaKeyHandlerObserver* aObserver ) :
+    iObserver( aObserver ),
+    iEnable( ETrue ),
+    iCurrentVol( KErrNotFound ),
+    iVolumeSteps(KMPXMaxVolume)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::ConstructL(
+	TMPXMediaKeyPopupFlags aFlags )
+    {
+	ASSERT( iObserver );
+    CCoeEnv* coeEnv = CEikonEnv::Static();
+    TParse parse;
+    parse.Set( KMPXMediaKeyHandlerRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    // Register to remote control framework
+    iInterfaceSelector = CRemConInterfaceSelector::NewL();
+    iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
+    // For handling AVRCP 1.3 metadata
+    iMetaDataHandler = MMPXMetaDataHandler::NewL(*iInterfaceSelector);
+    iInterfaceSelector->OpenTargetL();
+    iResponseHandler = CMPXRemConKeyResponse::NewL( *iCoreTarget );
+
+    // Timer for implementing repeat
+    iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+
+    // Get the playback utility instance from engine.
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+    iPlaybackUtility->AddObserverL( *this );
+    // get the current Volume and Max Volume
+    iPlaybackUtility->PropertyL(*this, EPbPropertyVolume);
+    iPlaybackUtility->PropertyL(*this, EPbPropertyMute);
+    CMMFDevSound* devsound = CMMFDevSound::NewL();	
+    MPX_DEBUG2( "CMPXMediaKeyHandlerImp::Constructdevsound->MaxVolume()%d",devsound->MaxVolume());
+    iVolumeSteps = KTenStepsVolume; //Default 10 steps
+    if ( devsound && devsound->MaxVolume() >= KTwentyStepsVolume ) 
+        {
+         // set 20-steps volume
+         iVolumeSteps = KTwentyStepsVolume;
+        }    
+    delete devsound;
+    if ( aFlags & EDisplayVolumePopup )
+        {
+        // Popup volume control
+        iVolPopup = CAknVolumePopup::NewL(NULL, ETrue);
+        iVolPopup->SetObserver(this);
+        iVolPopup->SetRange(KMPXMinVolume, iVolumeSteps);
+        iVolPopup->SetStepSize(KMPXVolumeSteps);
+
+        HBufC* popupText = StringLoader::LoadLC( R_MPX_VOLUME_POPUP_TEXT );
+        iVolPopup->SetTitleTextL( *popupText );
+        CleanupStack::PopAndDestroy( popupText );
+        }
+
+    if ( aFlags & EDisplayMediaPopup )
+        {
+        // Playback popup
+        iPlaybackPopup = CMPXNotifierDialog::NewL();
+        }
+
+    MMPXSource* s = iPlaybackUtility->Source();
+    if ( s )
+        {
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        attrs.Append( KMPXMediaGeneralTitle );
+        s->MediaL( attrs.Array(), *this );
+        CleanupStack::PopAndDestroy( &attrs );
+        }
+    else
+        {
+        // No current track.
+        // This is constructed so that the first popup will display
+        // it doesn't hold anything.
+        iTrackTitle = HBufC::NewL( 1 );
+        }
+#ifdef UPNP_INCLUDED
+    if (!iUpnpCopyCommand )
+        {
+        MPX_TRAPD ( error, iUpnpCopyCommand = CUpnpCopyCommand::NewL() );   
+		    if ( error == KErrNone )
+            {
+            iUpnpFrameworkSupport = ETrue;
+            }
+        else
+            {
+            iUpnpFrameworkSupport = EFalse;
+			iUpnpCopyCommand = NULL;
+            }
+        }
+#endif
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+MMPXMediaKeyHandler* CMPXMediaKeyHandlerImp::NewL(
+    TMPXMediaKeyPopupFlags aFlags,
+    MMPXMediaKeyHandlerObserver* aObserver )
+    {
+    CMPXMediaKeyHandlerImp* self =
+        new(ELeave)CMPXMediaKeyHandlerImp( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL( aFlags );
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXMediaKeyHandlerImp::~CMPXMediaKeyHandlerImp()
+    {
+    if ( iPlaybackUtility )
+        {
+        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+        iPlaybackUtility->Close();
+        }
+
+    delete iMetaDataHandler;
+
+    delete iResponseHandler;
+    delete iInterfaceSelector;
+
+    if( iTimer )
+        {
+        iTimer->Cancel();
+        delete iTimer;
+        }
+
+    if ( iResourceOffset )
+        {
+        CEikonEnv::Static()->DeleteResourceFile( iResourceOffset );
+        }
+
+    delete iTrackTitle;
+    delete iVolPopup;
+    delete iPlaybackPopup;
+#ifdef UPNP_INCLUDED
+    if ( iUpnpCopyCommand)
+        {
+        delete iUpnpCopyCommand;
+        }
+#endif
+    }
+
+// ---------------------------------------------------------------------------
+// Filter and send command to playback utility.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::FilterAndSendCommand(
+    TMPXPlaybackCommand aCommandId )
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::FilterAndSendCommand" );
+    TRAP_IGNORE( DoFilterAndSendCommandL( aCommandId ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Help filter and send command to playback utility.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::DoFilterAndSendCommandL(
+    TMPXPlaybackCommand aCommandId )
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::DoFilterAndSendCommandL" );
+    // Only send media key events if the media key component is enabled
+    if( iEnable )
+        {
+        TBool forwardCommand = ETrue;
+        if ( iUpnpFrameworkSupport )
+            {
+            switch ( aCommandId )
+                {
+                case EPbCmdStartSeekForward:
+                case EPbCmdStartSeekBackward:
+                    {
+                    if ( IsUpnpVisibleL() )
+                        {
+                        TFileName subPlayerName;
+                        TMPXPlaybackPlayerType currentPlayerType = EPbLocal;
+                        GetSubPlayerInfoL(subPlayerName, currentPlayerType);
+
+                        if ( currentPlayerType != EPbLocal)
+                            {
+                            //show error note
+                            HBufC* dialogText = StringLoader::LoadLC(R_MPX_MEDIA_KEY_NOT_SUPPORTED);
+                            CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+                            errNote->SetTimeout(CAknNoteDialog::ELongTimeout);
+                            errNote->ExecuteLD( *dialogText );
+                            CleanupStack::PopAndDestroy( dialogText );
+                            forwardCommand = EFalse;
+                            }
+                        }
+                    break;
+                    }
+                default:
+                    {
+                    //do nothing
+                    break;
+                    }
+                }
+            }
+
+        if ( forwardCommand )
+            {
+            iVolumeEventCount++;
+            
+            TInt volume = iUpnpVolume % ( KPbPlaybackVolumeLevelMax / iVolumeSteps )
+                    + iCurrentVol * KPbPlaybackVolumeLevelMax / iVolumeSteps;
+
+			if ( volume < KMPXMinVolume )
+				{
+				volume = KMPXMinVolume;
+				}
+			if ( volume > KMPXMaxVolume )
+				{
+				volume = KMPXMaxVolume;
+				}
+			
+			iObserver->HandleMediaKeyCommand( aCommandId, volume );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::DoHandlePlaybackMessageL(CMPXMessage)");
+
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessagePbMediaChanged == id )
+        {
+        if ( aMessage.IsSupported( KMPXMessagePbMedia ) )
+            {
+            CMPXMedia* media( aMessage.Value<CMPXMedia>( KMPXMessagePbMedia ) );
+            User::LeaveIfNull( media );
+            iPlaybackPosition = 0;
+            DoHandleMediaL( *media, KErrNone );
+            }
+        }
+    else if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ));
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ));
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EPropertyChanged:
+                {
+                TMPXPlaybackProperty property(
+                    static_cast<TMPXPlaybackProperty>( type ) );
+                TInt error( KErrNone );
+
+                DoHandlePropertyL( property, data, error );
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                MPX_DEBUG2( "CMPXMediaKeyHandlerImp::HandlePlaybackMessageL - EStateChanged(%d)", type );
+
+                TMPXPlaybackState state =
+                    static_cast<TMPXPlaybackState>( type );
+                DoHandleStateChangedL( state );
+                break;
+                }
+            case TMPXPlaybackMessage::EMediaChanged:
+                {
+                MMPXSource* s = iPlaybackUtility->Source();
+                if ( s )
+                    {
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL(attrs);
+                    attrs.Append( KMPXMediaGeneralTitle );
+                    MPX_DEBUG1( "CMPXMediaKeyHandlerImp::HandlePlaybackMessageL Media changed, calling MediaL to refresh" );
+                    s->MediaL( attrs.Array(), *this );
+                    CleanupStack::PopAndDestroy( &attrs );
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::ECommandReceived:
+                {
+                MPX_DEBUG2( "CMPXMediaKeyHandlerImp::HandlePlaybackMessageL - ECommandReceived(%d)", type );
+                break;
+                }
+            case TMPXPlaybackMessage::ESkipping:
+                {
+                iSkipping = ETrue;
+                break;
+                }
+            case TMPXPlaybackMessage::ESkipEnd:
+                {
+                iSkipping = EFalse;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::DoHandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::DoHandlePropertyL" );
+    MPX_DEBUG4( "CMPXMediaKeyHandlerImp::HandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError );
+
+    iUpnpVolume = aValue; 
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty	)
+            {
+            case EPbPropertyPosition:
+                {
+                iPlaybackPosition = aValue / KMPXOneSecInMilliSecs;
+                ShowPlaybackPopupL( EMPXPopupShowIfVisible );
+                break;
+                }
+            case EPbPropertyMute:
+            	{
+                if ( iTouchVolEventCount > 0 )
+                    {
+                    --iTouchVolEventCount;
+                    }
+                if ( iVolumeEventCount > 0 )
+                	{
+                	--iVolumeEventCount;
+                	}
+            	iMuted = aValue;
+            	if ( iMuted )
+            	    {
+            	    iVolPopup->SetValue( 0 );
+            	    }
+            	else
+            		{
+            		iVolPopup->SetValue( iCurrentVol );
+            		}
+				break;
+				}
+			case EPbPropertyVolume:
+                {
+				if ( iVolPopup )
+					{
+	                if ( iTouchVolEventCount > 0 )
+	                    {
+	                    --iTouchVolEventCount;
+	                    }
+					// Avkon Volume has 10 steps, but the rest of the framework
+                    // has 100 steps. Need to scale it to 10 steps.
+                    if ( aValue > 0 )
+                        {
+                        aValue = aValue * iVolumeSteps;
+                        aValue = aValue / KPbPlaybackVolumeLevelMax;
+                        if ( aValue > iVolumeSteps )
+                        	{
+                        	aValue = iVolumeSteps;
+                        	}
+                        }
+
+					if( iMuted && aValue > 0 ) // unmute
+			            {
+			            iMuted = EFalse;
+			            iCurrentVol = aValue;
+			            iVolPopup->SetValue( iCurrentVol );
+			            }
+		            else if( aValue == 0 ) // mute
+			            {
+			            if( !iMuted ) 
+				            {
+				            iMuted = ETrue;
+				            iVolPopup->SetValue( 0 );
+				            }
+			            }
+                    else if ( aValue != iCurrentVol && !iTouchVolEventCount && !iVolumeEventCount )
+					    {
+					    if ( aValue != 0 )
+					        {
+					        iCurrentVol = aValue;
+					        }
+				        iVolPopup->SetValue( iCurrentVol );
+					    }
+
+				    if ( iVolumeEventCount > 0 )
+				    	{
+				    	--iVolumeEventCount;
+					    }
+
+                    // send a command to UI to display Volume bar on device when controlling volume via UPnP  
+                    if ( IsUpnpVisibleL() && iPlayerState != EPbStateNotInitialised )
+                        {
+                        TFileName subPlayerName;
+                        TMPXPlaybackPlayerType currentPlayerType = EPbLocal;
+                        GetSubPlayerInfoL( subPlayerName, currentPlayerType );
+
+                        if ( currentPlayerType != EPbLocal )
+                            {
+                            iObserver->HandleMediaKeyCommand( EPbCmdSetVolume, iUpnpVolume ); 
+                            }            
+                        }
+							  
+					if ( iUpnpFrameworkSupport )
+						{
+						SetVolumePopupTitleL();
+						}
+					}
+				break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else
+        {
+        switch ( aProperty	)
+            {
+            case EPbPropertyVolume:
+            case EPbPropertyMute:
+                {
+                if ( iVolPopup && iShowPopups & EDisplayVolumePopup )
+                    {
+                    //show error note
+                    HBufC* dialogText = StringLoader::LoadLC(R_MPX_VOLUME_KEYS_NOT_SUPPORTED);
+                    CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+                    errNote->SetTimeout(CAknNoteDialog::ELongTimeout);
+                    errNote->ExecuteLD( *dialogText );
+                    CleanupStack::PopAndDestroy( dialogText );
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aProperties.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::DoHandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::DoHandleMediaL" );
+
+    // Delete old title no matter there's error or not
+    if ( iTrackTitle )
+        {
+        delete iTrackTitle;
+        iTrackTitle = NULL;
+        }
+
+    if ( KErrNone == aError )
+        {
+        // Keep track of the current track's title
+        iTrackTitle = aMedia.ValueText( KMPXMediaGeneralTitle ).AllocL();
+
+        // Update popup if visible
+        if ( iShowPopups & EDisplayMediaPopup )
+            {
+            MPX_DEBUG1( "CMPXMediaKeyHandlerImp::DoHandleMediaL EMPXPopupTimeout" );
+            ShowPlaybackPopupL( EMPXPopupTimeout );
+            }
+        else
+            {
+            ShowPlaybackPopupL( EMPXPopupShowIfVisible );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::DoHandleStateChangedL(
+    TMPXPlaybackState aState )
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::DoHandleStateChangedL" );
+    switch ( aState )
+        {
+        case EPbStateStopped:
+            {
+            iPlayerState = aState;
+            ShowPlaybackPopupL( EMPXPopupShowIfVisible );
+            break;
+            }
+        case EPbStatePlaying:
+        case EPbStatePaused:
+            {
+            iPlayerState = aState;
+            // Start the time if needed, otherwise, update content if visible
+            if ( iShowPopups & EDisplayMediaPopup )
+                {
+                MPX_DEBUG1( "CMPXMediaKeyHandlerImp::DoHandleStateChangedL EMPXPopupTimeout" );
+                ShowPlaybackPopupL( EMPXPopupTimeout );
+                }
+            else
+                {
+                ShowPlaybackPopupL( EMPXPopupShowIfVisibleRestartTimer );
+                }
+            break;
+            }
+        default:
+            {
+            // do nothing
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Callback for timer
+// ---------------------------------------------------------------------------
+//
+TInt CMPXMediaKeyHandlerImp::TimerCallback( TAny* aPtr )
+    {
+    static_cast<CMPXMediaKeyHandlerImp*>( aPtr )->HandleRepeatEvent();
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle repeat event
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::HandleRepeatEvent()
+    {
+	UpdateVolume();
+    FilterAndSendCommand( iCommandId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMediaKeyHandlerImp::GetSubPlayerInfoL
+// Retrieves the current player name and sets the volume popup title
+// -----------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::GetSubPlayerInfoL(
+    TDes& aSubPlayerName,
+    TMPXPlaybackPlayerType& aCurrentPlayerType )
+    {
+    aCurrentPlayerType = EPbLocal;
+    aSubPlayerName = KNullDesC;
+
+//#ifdef __UPNP_FRAMEWORK_2_0_
+    if ( iUpnpFrameworkSupport )
+        {
+        MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+        TUid currentlyUsedPlayer;
+        TInt currentlyUsedSubPlayer;
+        HBufC* subPlayerName = NULL;
+        TRAP_IGNORE( manager.GetSelectionL( aCurrentPlayerType,
+                                            currentlyUsedPlayer,
+                                            currentlyUsedSubPlayer,
+                                            subPlayerName ) );
+        if ( subPlayerName )
+            {
+            aSubPlayerName = (*subPlayerName);
+            delete subPlayerName;
+            }
+        }
+//#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMediaKeyHandlerImp::SetVolumePopupTitleL
+// Retrieves the current player name and sets the volume popup title
+// -----------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::SetVolumePopupTitleL()
+    {
+    if ( iUpnpFrameworkSupport && IsUpnpVisibleL() )
+        {
+        TFileName subPlayerName;
+        TMPXPlaybackPlayerType currentPlayerType = EPbLocal;
+
+        GetSubPlayerInfoL(subPlayerName, currentPlayerType);
+        if ( currentPlayerType != EPbLocal)
+            {
+            iVolPopup->SetTitleTextL( subPlayerName );
+            }
+        else  // need to restore original title
+            {
+            HBufC* popupText = StringLoader::LoadLC( R_MPX_VOLUME_POPUP_TEXT );
+            iVolPopup->SetTitleTextL( *popupText );
+            CleanupStack::PopAndDestroy( popupText );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMediaKeyHandlerImp::IsUpnpVisibleL
+// Taken from Gallery upnp support implementation
+// -----------------------------------------------------------------------------
+//
+TBool CMPXMediaKeyHandlerImp::IsUpnpVisibleL()
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::IsUpnpVisible" );
+    TBool returnValue = EFalse;
+#ifdef UPNP_INCLUDED
+   	if ( iUpnpCopyCommand && iUpnpFrameworkSupport ) 	  
+   	    {
+        returnValue = iUpnpCopyCommand->IsAvailableL();   
+        }
+#endif
+    return returnValue; 
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the volume and the volume command
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::UpdateVolume()
+	{
+	// Current volume level is not yet initialised
+    if( iCurrentVol < 0 )
+        {
+        MPX_DEBUG1( "CMPXMediaKeyHandlerImp::UpdateVolume not initialised");
+        return;
+        }
+
+	if ( iIncreaseVol )
+		{
+		if ( iMuted )
+			{
+			iMuted = EFalse;
+			iCommandId = EPbCmdUnMuteVolume;
+			iVolPopup->SetValue( iCurrentVol );
+			}
+		else
+			{
+			iCommandId = EPbCmdSetVolume;
+			iCurrentVol = iCurrentVol < iVolumeSteps ? (iCurrentVol + 1) : iCurrentVol;	// +KMPXVolumeSteps; ?
+			iVolPopup->SetValue( iCurrentVol );
+			}
+		}
+	else
+		{
+		if ( iCurrentVol == 1 )
+			{
+			iMuted = ETrue;
+			iCommandId = EPbCmdMuteVolume;
+			iVolPopup->SetValue( 0 );
+			}
+		else if ( iMuted )	// Muted && volume > 1
+			{
+			iMuted = EFalse;
+			iCommandId = EPbCmdUnMuteVolume;
+			iVolPopup->SetValue( iCurrentVol );
+			}
+		else
+			{
+			iCommandId = EPbCmdSetVolume;
+			iCurrentVol = iCurrentVol - 1;	// KMPXVolumeSteps ?
+			iVolPopup->SetValue( iCurrentVol );
+			}
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// From MMPXMediaKeyHandler
+// Show playback popup.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::ShowPlaybackPopupL(
+    TMPXPlaybackPopupModes aMode )
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::ShowPlaybackPopupL" );
+
+    // Check to see is it ok to display popup
+    if ( !iPlaybackPopup || !iTrackTitle )
+        {
+        return;
+        }
+
+    switch ( aMode )
+        {
+        case EMPXPopupShowIfVisibleRestartTimer:
+        case EMPXPopupTimeout:
+            {
+            iShowPopups &= ~EDisplayMediaPopup;
+            break;
+            }
+        case EMPXPopupNoTimeout:
+            {
+            iShowPopups |= EDisplayMediaPopup;
+            break;
+            }
+        case EMPXPopupShowIfVisible:
+            {
+            if ( iShowPopups & EDisplayMediaPopup )
+                {
+                aMode = EMPXPopupNoTimeout;
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+
+    CMPXNotifierDialog::TMPXPlaybackPopupIcons icon(
+        CMPXNotifierDialog::EMPXPopupNoneIcon );
+    TMPXPlaybackState playerState( EPbStateNotInitialised );
+
+    // Get current playback state from playback utility
+    playerState = iPlaybackUtility->StateL();
+    switch ( playerState )
+        {
+        case EPbStatePlaying:
+            {
+            icon = CMPXNotifierDialog::EMPXPopupPlayIcon;
+            break;
+            }
+        case EPbStatePaused:
+            {
+            icon = CMPXNotifierDialog::EMPXPopupPauseIcon;
+            break;
+            }
+        case EPbStateSeekingForward:
+            icon = CMPXNotifierDialog::EMPXPopupFFIcon;
+            break;
+        case EPbStateSeekingBackward:
+            {
+            icon = CMPXNotifierDialog::EMPXPopupFRIcon;
+            break;
+            }
+        case EPbStateStopped:
+            {
+            // no icon if in stopped state
+            break;
+            }
+        default:
+            {
+            // not to display popup in other states
+            return;
+            }
+        }
+
+    if ( iTrackTitle->Length() )
+        {
+        MPX_DEBUG2( "CMPXMediaKeyHandlerImp::ShowPlaybackPopupL aMode = %d", aMode );
+        iPlaybackPopup->ShowInfoPopupL(
+            icon, *iTrackTitle, iSkipping ? KErrNotFound : iPlaybackPosition, aMode );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXMediaKeyHandler
+// Show Volume popup
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::ShowVolumePopupL()
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::ShowVolumePopupL" );
+    if ( iVolPopup )
+        {
+        iShowPopups |= EDisplayVolumePopup;
+        iVolPopup->ShowVolumePopupL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXMediaKeyHandler
+// Dismiss notifier popup.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::DismissNotifier(
+    TMPXMediaKeyPopupFlags aFlags )
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::DismissNotifier" );
+    if ( aFlags & EDisplayMediaPopup && iPlaybackPopup )
+        {
+        iPlaybackPopup->CancelInfoPopup();
+        iShowPopups &= ~EDisplayMediaPopup;
+        }
+
+    if ( aFlags & EDisplayVolumePopup && iVolPopup )
+        {
+        iVolPopup->CloseVolumePopup();
+        iShowPopups &= ~EDisplayVolumePopup;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXMediaKeyHandler
+// Enable or disable media keys
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::SetEnableMediaKeys( TBool aEnable )
+    {
+    iEnable = aEnable;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXMediaKeyHandler
+// Gets called when orientation change begins
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::NotifyOrientationChangeBegin()
+	{
+	iPlaybackPopup->NotifyOrientationChangeBegin();
+	}
+
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::HandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    TRAP_IGNORE( DoHandlePropertyL( aProperty, aValue, aError ) );
+    }
+
+// ---------------------------------------------------------------------------
+// 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 CMPXMediaKeyHandlerImp::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::HandleSubPlayerNamesL" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aMedia.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::HandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::HandleMediaL" );
+    TRAP_IGNORE( DoHandleMediaL( aMedia, aError ) );
+    }
+
+// ---------------------------------------------------------------------------
+// A 'play' command has been received.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::MrccatoPlay(
+    TRemConCoreApiPlaybackSpeed /* aSpeed */,
+    TRemConCoreApiButtonAction aButtonAct )
+    {
+    MPX_DEBUG2( "-->CMPXMediaKeyHandlerImp::MrccatoPlay(aButtonAct=%d)", aButtonAct );
+
+    if ( ( aButtonAct == ERemConCoreApiButtonClick ) ||
+        ( aButtonAct == ERemConCoreApiButtonPress ) )
+        {
+        FilterAndSendCommand( EPbCmdPlay );
+        }
+    iResponseHandler->CompleteAnyKey( ERemConCoreApiPlay );
+    MPX_DEBUG1( "<--CMPXMediaKeyHandlerImp::MrccatoPlay");
+    }
+
+// ---------------------------------------------------------------------------
+// A command has been received.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::MrccatoCommand(
+    TRemConCoreApiOperationId aOperationId,
+    TRemConCoreApiButtonAction aButtonAct )
+    {
+    MPX_DEBUG3( "CMPXMediaKeyHandlerImp::MrccatoCommand(aOperationId=%d, aButtonAct=%d)", aOperationId, aButtonAct );
+
+    switch (aOperationId)
+        {
+        case ERemConCoreApiPausePlayFunction:
+            {
+            if ( aButtonAct == ERemConCoreApiButtonClick )
+                {
+                FilterAndSendCommand( EPbCmdPlayPause );
+                }
+            break;
+            }
+        case ERemConCoreApiPlay:
+            {
+            if ( ( aButtonAct == ERemConCoreApiButtonClick ) ||
+                ( aButtonAct == ERemConCoreApiButtonPress ) )
+                {
+                FilterAndSendCommand( EPbCmdPlay );
+                }
+            break;
+            }
+        case ERemConCoreApiStop:
+            {
+            if ( ( aButtonAct == ERemConCoreApiButtonClick ) ||
+                ( aButtonAct == ERemConCoreApiButtonPress ) )
+                {
+                FilterAndSendCommand( EPbCmdStop );
+                }
+            break;
+            }
+        case ERemConCoreApiPause:
+            {
+            if ( ( aButtonAct == ERemConCoreApiButtonClick ) ||
+                ( aButtonAct == ERemConCoreApiButtonPress ) )
+                {
+                FilterAndSendCommand( EPbCmdPause );
+                }
+            break;
+            }
+        case ERemConCoreApiRewind:
+            {
+            switch ( aButtonAct )
+                {
+                case ERemConCoreApiButtonPress:
+                    {
+                    FilterAndSendCommand( EPbCmdStartSeekBackward );
+                    break;
+                    }
+                case ERemConCoreApiButtonRelease:
+                    {
+                    FilterAndSendCommand( EPbCmdStopSeeking );
+                    break;
+                    }
+                default:
+                    {
+                    break;
+                    }
+                }
+            break;
+            }
+        case ERemConCoreApiFastForward:
+            {
+            switch ( aButtonAct )
+                {
+                case ERemConCoreApiButtonPress:
+                    {
+                    FilterAndSendCommand( EPbCmdStartSeekForward );
+                    break;
+                    }
+                case ERemConCoreApiButtonRelease:
+                    {
+                    FilterAndSendCommand( EPbCmdStopSeeking );
+                    break;
+                    }
+                default:
+                    {
+                    break;
+                    }
+                }
+            break;
+            }
+        case ERemConCoreApiBackward:
+            {
+            if ( aButtonAct == ERemConCoreApiButtonClick )
+                {
+                FilterAndSendCommand( EPbCmdPrevious );
+                }
+            break;
+            }
+        case ERemConCoreApiForward:
+            {
+            if ( aButtonAct == ERemConCoreApiButtonClick )
+                {
+                FilterAndSendCommand( EPbCmdNext );
+                }
+            break;
+            }
+        case ERemConCoreApiVolumeUp:
+        case ERemConCoreApiVolumeDown:
+            {
+            iTimer->Cancel();
+            
+            MMPXPlaybackUtility* pbUtil = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
+            CleanupClosePushL(*pbUtil);
+                
+            TMPXPlaybackState playerState( EPbStateNotInitialised );
+            playerState = pbUtil->StateL();
+                    
+            CleanupStack::PopAndDestroy(pbUtil);
+            
+            if( playerState == EPbStatePlaying || IsAppForeground() )
+                {
+                iIncreaseVol = (aOperationId == ERemConCoreApiVolumeUp ? ETrue: EFalse);
+                switch (aButtonAct)
+                    {
+                    case ERemConCoreApiButtonPress:
+                        {
+                        //Start Timer
+                        iTimer->Start(
+                            KFirstTimerExpiryInterval,
+                            KTimerExpiryInterval,
+                            TCallBack( TimerCallback, this ) );
+                        break;
+                        }
+                    case ERemConCoreApiButtonClick:
+                        {
+                        UpdateVolume();
+                        FilterAndSendCommand( iCommandId );
+                        break;
+                        }
+                    case ERemConCoreApiButtonRelease:
+                    default:
+                        {
+                        break;
+                        }
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    iResponseHandler->CompleteAnyKey( aOperationId );
+    MPX_DEBUG1( "<--CMPXMediaKeyHandlerImp::MrccatoCommand");
+    }
+
+// ---------------------------------------------------------------------------
+// A 'tune function' command has been received.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::MrccatoTuneFunction(
+    TBool /* aTwoPart */,
+    TUint /* aMajorChannel */,
+    TUint /* aMinorChannel */,
+    TRemConCoreApiButtonAction /* aButtonAct */ )
+    {
+    iResponseHandler->CompleteAnyKey(
+        ERemConCoreApiTuneFunction );
+    }
+
+// ---------------------------------------------------------------------------
+// A 'select disk function' has been received.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::MrccatoSelectDiskFunction(
+    TUint /* aDisk */,
+    TRemConCoreApiButtonAction /* aButtonAct */ )
+    {
+    iResponseHandler->CompleteAnyKey(
+        ERemConCoreApiSelectDiskFunction );
+    }
+
+// ---------------------------------------------------------------------------
+// A 'select AV input function' has been received.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::MrccatoSelectAvInputFunction(
+    TUint8 /* aAvInputSignalNumber */,
+    TRemConCoreApiButtonAction /* aButtonAct */ )
+    {
+    iResponseHandler->CompleteAnyKey(
+        ERemConCoreApiSelectAvInputFunction );
+    }
+
+// ---------------------------------------------------------------------------
+// A 'select audio input function' has been received.
+// ---------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::MrccatoSelectAudioInputFunction(
+    TUint8 /* aAudioInputSignalNumber */,
+    TRemConCoreApiButtonAction /* aButtonAct */ )
+    {
+    iResponseHandler->CompleteAnyKey(
+        ERemConCoreApiSelectAudioInputFunction );
+    }
+
+// ----------------------------------------------------------------------------
+// void CMPlayerBaseView::HandleControlEventL
+// ----------------------------------------------------------------------------
+//
+void CMPXMediaKeyHandlerImp::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
+	{
+	if ( !AknLayoutUtils::PenEnabled() )
+		{
+		return;
+		}
+
+	if( (aEventType == EEventStateChanged) && (aControl == iVolPopup) )
+		{
+		TInt vol = iVolPopup->Value();
+		if ( vol == iCurrentVol )
+		    {
+            if ( iMuted )
+                {
+                iMuted = EFalse;
+                FilterAndSendCommand( EPbCmdUnMuteVolume );
+                iTouchVolEventCount++;
+                }
+            else
+                {
+                return;
+                }
+		    }
+
+		if ( vol == 0 )
+			{
+			if ( iMuted )
+			    {
+			    return;
+			    }
+			else
+			    {
+			    iMuted = ETrue;
+			    FilterAndSendCommand( EPbCmdMuteVolume );
+			    iTouchVolEventCount++;
+			    }
+			}
+		else
+			{
+			if ( iMuted )
+				{
+				iMuted = EFalse;
+				iVolPopup->SetValue( iCurrentVol );
+				FilterAndSendCommand( EPbCmdUnMuteVolume );
+				iTouchVolEventCount++;
+				}
+			else
+				{
+				iCurrentVol = vol;
+				FilterAndSendCommand( EPbCmdSetVolume );
+				iTouchVolEventCount++;
+				}
+			}
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// Check the mpx app is foreground.
+// ---------------------------------------------------------------------------
+//
+TBool CMPXMediaKeyHandlerImp::IsAppForeground()
+    {
+    TBool isForeground( EFalse );
+    // Gets the window group id of the app in foreground
+    RWsSession& wsSession = CCoeEnv::Static()->WsSession();
+    TInt windowGroupId = wsSession.GetFocusWindowGroup();
+    if ( windowGroupId >= 0 )
+        {
+        TRAP_IGNORE(
+            {
+            CApaWindowGroupName* wgName = CApaWindowGroupName::NewL(
+                wsSession, windowGroupId );
+
+            isForeground = ( wgName->AppUid() == KAppUidMusicPlayerX );
+            delete wgName;
+            } );
+        }
+
+    return isForeground;
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/src/mpxnotifierdialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,710 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of media key handler
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <eikenv.h>
+#include <apgwgnam.h>
+#include <eikimage.h>
+#include <eikappui.h>
+#include <gulfont.h>
+#include <fontids.hrh>
+#include <AknUtils.h>
+#include <AknsBasicBackgroundControlContext.h>
+#include <AknsUtils.h>
+#include <AknsConstants.h>
+#include <AknsDrawUtils.h>
+#include <avkon.rsg>
+#include <eiklabel.h>
+#include <data_caging_path_literals.hrh>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <skinlayout.cdl.h>
+#include <mpxmediakeyhandler.mbg>
+#include <mpxmediakeyhandler.rsg>
+#include <StringLoader.h>
+#include <mpxuser.h>
+#include <activeidle2domainpskeys.h>
+#include <mpxpskeywatcher.h>
+
+#include "mpxlog.h"
+#include "mpxnotifierdialog.h"
+
+using namespace AknLayoutScalable_Apps;
+
+
+// CONSTANTS
+const TInt KMPXComponentsCount = CMPXNotifierDialog::EMPXComponentsCount;
+
+const TInt KMPXOneSecInMicroSecs( 1000000 );
+const TInt KMPXOneHourInSeconds( 3600 );
+const TInt KMPXOneHundredHoursInSecs( 360000 );
+const TInt KMPXDurationDisplayResvLen( 10 );
+
+const TInt KMPXWindowPosition = 10;             // window group's priority
+const TInt KMPXInactivityTime = 4000000;        // 4 seconds - close window after this
+_LIT( KMPXInfoPopupWgName, "MPXInfoPopup" );    // window groups name
+
+_LIT( KMPXMediaKeyHandlerMbmFile, "mpxmediakeyhandler.mbm" );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXNotifierDialog::CMPXNotifierDialog()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::ConstructL()
+    {
+    // create a window group for popup
+    // needed to prevent apps noticing this window
+    RWsSession& wsSession = iCoeEnv->WsSession();
+    iWindowGroup = RWindowGroup( wsSession );
+    User::LeaveIfError( iWindowGroup.Construct( ( TUint32 )&iWindowGroup, EFalse ) );
+    iWindowGroup.AutoForeground( EFalse );
+    iEikonEnv->EikAppUi()->AddToStackL( this );
+
+    CApaWindowGroupName* name = CApaWindowGroupName::NewLC(
+        wsSession, ( TUint32 )&iWindowGroup );
+    name->SetHidden( ETrue );
+    name->SetCaptionL( KMPXInfoPopupWgName ); // Available to OOM watcher so this won't be closed
+    User::LeaveIfError( name->SetWindowGroupName( iWindowGroup ) );
+    CleanupStack::PopAndDestroy( name );
+
+    iWindowGroup.SetOrdinalPosition( 0, ECoeWinPriorityNeverAtFront );
+
+    // create control's window to own window group
+    CreateWindowL( &iWindowGroup );
+
+    // create icon & label controls
+    iSongLabel = new ( ELeave ) CEikLabel();
+    iSongLabel->SetContainerWindowL( *this );
+    iSongLabel->SetTextL( KNullDesC );
+
+    iTimeLabel = new ( ELeave ) CEikLabel();
+    iTimeLabel->SetContainerWindowL( *this );
+    iTimeLabel->SetTextL( KNullDesC );
+
+    CreateIconsL();
+
+    // Timer
+    iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+
+    // for watching when we go active idle
+    iPSKeyWatcher = CMPXPSKeyWatcher::NewL( KPSUidAiInformation, KActiveIdleState, this );
+
+    MakeVisible( EFalse );
+    ResizeInfoPopup();
+    ActivateL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXNotifierDialog* CMPXNotifierDialog::NewL()
+    {
+    CMPXNotifierDialog* self = new( ELeave ) CMPXNotifierDialog();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXNotifierDialog::~CMPXNotifierDialog()
+    {
+    iEikonEnv->EikAppUi()->RemoveFromStack( this );
+    delete iPSKeyWatcher;
+    iWindowGroup.Close();
+    if (iTimer)
+        iTimer->Cancel();
+    delete iTimer;
+    delete iSongLabel;
+    delete iTimeLabel;
+    delete iPlayIcon;
+    delete iPauseIcon;
+    delete iFFIcon;
+    delete iFRIcon;
+    }
+
+// ---------------------------------------------------------------------------
+// Shows pop-up dialog.
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::ShowInfoPopupL(
+    TMPXPlaybackPopupIcons aIcon,
+    const TDesC& aTitle,
+    TInt aTime,
+    TMPXPlaybackPopupModes aMode )
+    {
+    MPX_DEBUG2( "CMPXNotifierDialog::ShowInfoPopupL aMode = %d", aMode );
+    if ( ( EMPXPopupShowIfVisible == aMode && !IsVisible() ) ||
+        ( EMPXPopupShowIfVisibleRestartTimer == aMode && !IsVisible() ) )
+        {
+        MPX_DEBUG1( "CMPXNotifierDialog::ShowInfoPopupL do nothing" );
+        return;
+        }
+
+    UpdateInfoPopupL( aIcon, aTitle, aTime );
+
+    if ( EMPXPopupTimeout == aMode ||
+        EMPXPopupShowIfVisibleRestartTimer == aMode )
+        {
+        MPX_DEBUG1( "CMPXNotifierDialog::ShowInfoPopupL starting timer" );
+        iTimer->Cancel();
+        iTimer->Start(
+            KMPXInactivityTime,
+            KMPXInactivityTime,
+            TCallBack( TimerCallback, this ) );
+        }
+    else if ( EMPXPopupNoTimeout == aMode )
+        {
+        MPX_DEBUG1( "CMPXNotifierDialog::ShowInfoPopupL canceling timer" );
+        iTimer->Cancel();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Removes pop-up from screen.
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::CancelInfoPopup()
+    {
+    MPX_DEBUG1( "CMPXNotifierDialog::CancelInfoPopup" );
+    iTimer->Cancel();
+    if ( IsVisible() )
+        {
+        iWindowGroup.SetOrdinalPosition( 0, ECoeWinPriorityNeverAtFront );
+        MakeVisible( EFalse );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Gets notified when display orientation hange is started
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::NotifyOrientationChangeBegin()
+	{
+	// ::HandeResourceChange() will unhide the dialog as soon as the
+	// orientation change has been completed. KEikDynamicLayoutVariantSwitch comes
+	// too late so the layout is not correct from the beginning 
+	if( IsVisible() )
+		{
+		MakeVisible( EFalse );
+		iReopenDialog = ETrue;
+		}
+	}
+
+// Updates pop-up dialog contents.
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::UpdateInfoPopupL(
+    TMPXPlaybackPopupIcons aIcon,
+    const TDesC& aTitle,
+    TInt aTime )
+    {
+    ShowIcon( aIcon );
+
+    // Set label text
+    // magic: allocate 3 chars more (make sure "..." fits).
+    HBufC* buf = HBufC::NewLC( aTitle.Length() + 3 );
+    *buf = aTitle;
+    TPtr ptr( buf->Des() );
+    AknTextUtils::ClipToFit(
+        ptr,
+        *iSongLabel->Font(),
+        iSongLabel->Rect().Width() );
+    iSongLabel->SetTextL( *buf );
+    CleanupStack::PopAndDestroy( buf );
+
+    // Set duration label
+    if ( aTime != KErrNotFound )
+        {
+        HBufC* duration = DisplayableDurationL( aTime );
+        CleanupStack::PushL( duration );
+        iTimeLabel->SetTextL( *duration );
+        CleanupStack::PopAndDestroy( duration );
+        }
+    else
+        {
+        iTimeLabel->SetTextL( KNullDesC );
+        }
+
+    if ( !IsVisible() )
+        {
+        // make this window visible
+        iWindowGroup.SetOrdinalPosition( 0, KMPXWindowPosition );
+        MakeVisible( ETrue );
+        }
+    DrawDeferred();
+    }
+
+// ---------------------------------------------------------------------------
+// Create icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::CreateIconsL()
+    {
+    delete iPlayIcon;
+    iPlayIcon = NULL;
+    iPlayIcon = new ( ELeave ) CEikImage();
+    iPlayIcon->SetContainerWindowL( *this );
+    ConstructImageL(
+        iPlayIcon,
+        AknsUtils::SkinInstance(),
+        KAknsIIDQgnIndiMupPlay,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        EMbmMpxmediakeyhandlerQgn_indi_mup_play,
+        EMbmMpxmediakeyhandlerQgn_indi_mup_play_mask );
+
+    delete iPauseIcon;
+    iPauseIcon = NULL;
+    iPauseIcon = new ( ELeave ) CEikImage();
+    iPauseIcon->SetContainerWindowL( *this );
+    ConstructImageL(
+        iPauseIcon,
+        AknsUtils::SkinInstance(),
+        KAknsIIDQgnIndiMupPause,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        EMbmMpxmediakeyhandlerQgn_indi_mup_pause,
+        EMbmMpxmediakeyhandlerQgn_indi_mup_pause_mask );
+    delete iFFIcon;
+    iFFIcon = NULL;
+    iFFIcon = new ( ELeave ) CEikImage();
+    iFFIcon->SetContainerWindowL( *this );
+    ConstructImageL(
+        iFFIcon,
+        AknsUtils::SkinInstance(),
+        KAknsIIDQgnIndiMupForw,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        EMbmMpxmediakeyhandlerQgn_indi_mup_forw,
+        EMbmMpxmediakeyhandlerQgn_indi_mup_forw_mask );
+
+    delete iFRIcon;
+    iFRIcon = NULL;
+    iFRIcon = new ( ELeave ) CEikImage();
+    iFRIcon->SetContainerWindowL( *this );
+    ConstructImageL(
+        iFRIcon,
+        AknsUtils::SkinInstance(),
+        KAknsIIDQgnIndiMupRew,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        EMbmMpxmediakeyhandlerQgn_indi_mup_rew,
+        EMbmMpxmediakeyhandlerQgn_indi_mup_rew_mask );
+    }
+
+// ---------------------------------------------------------------------------
+// Constructs skinnable icon.
+// ---------------------------------------------------------------------------
+//
+void  CMPXNotifierDialog::ConstructImageL(
+    CEikImage* aImage,
+    MAknsSkinInstance* aSkin,
+    const TAknsItemID& aId,
+    const TAknsItemID& aColorId,
+    TInt aColorIndex,
+    TInt aBitmapId,
+    TInt aMaskId )
+    {
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    TParse parse;
+    parse.Set( KMPXMediaKeyHandlerMbmFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    AknsUtils::CreateColorIconL(
+        aSkin,
+        aId,
+        aColorId,
+        aColorIndex,
+        bitmap,
+        mask,
+        iconFile,
+        aBitmapId,
+        aMaskId,
+        KRgbBlack );
+
+    aImage->SetPicture( bitmap, mask ); // Owership transferred to CEikImage
+    }
+
+// ---------------------------------------------------------------------------
+// Resize info popup.
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::ResizeInfoPopup()
+    {
+    TRect appRect = iEikonEnv->EikAppUi()->ApplicationRect();
+
+    // get parent rectangle (status pane)
+    TAknWindowLineLayout statusPane = AknLayout::status_pane( appRect, 0 );
+    TAknLayoutRect res;
+    res.LayoutRect( appRect, statusPane );
+    TRect parentRect = res.Rect();
+
+    // set the rectangle
+    TAknWindowComponentLayout l = popup_mup_playback_window();
+    res.LayoutRect( parentRect, l.LayoutLine() );
+    SetRect( res.Rect() );
+    DrawNow();
+    }
+
+// ---------------------------------------------------------------------------
+// Sets pop-up layouts.
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::SetLayoutsL( TBool aLong )
+    {
+    TAknWindowComponentLayout l;
+    // play icon
+    l = popup_mup_playback_window_g1();
+    AknLayoutUtils::LayoutImage( iPlayIcon, Rect(), l.LayoutLine() );
+    // pause icon
+    l = popup_mup_playback_window_g1();
+    AknLayoutUtils::LayoutImage( iPauseIcon, Rect(), l.LayoutLine() );
+    // FF icon
+    l = popup_mup_playback_window_g1();
+    AknLayoutUtils::LayoutImage( iFFIcon, Rect(), l.LayoutLine() );
+    // FR icon
+    l = popup_mup_playback_window_g1();
+    AknLayoutUtils::LayoutImage( iFRIcon, Rect(), l.LayoutLine() );
+    // song label
+    TAknTextComponentLayout t = popup_mup_playback_window_t1();
+    AknLayoutUtils::LayoutLabel( iSongLabel, Rect(), t.LayoutLine() );
+    // time label
+    if( aLong )
+        {
+        t = popup_mup_playback_window_t2( 1 );
+        }
+    else
+        {
+        t = popup_mup_playback_window_t2();
+        }
+
+    AknLayoutUtils::LayoutLabel( iTimeLabel, Rect(), t.LayoutLine() );
+
+    // Set label color
+    TRgb color;
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TInt error = AknsUtils::GetCachedColor(
+        skin,
+        color,
+        KAknsIIDQsnTextColors,
+        EAknsCIQsnTextColorsCG19 );
+    if ( !error )
+        {
+        AknLayoutUtils::OverrideControlColorL(
+            *iSongLabel,
+            EColorLabelText,
+            color );
+
+        AknLayoutUtils::OverrideControlColorL(
+            *iTimeLabel,
+            EColorLabelText,
+            color );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Show playback icon.
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::ShowIcon(
+    TMPXPlaybackPopupIcons aIcon )
+    {
+
+    switch ( aIcon )
+        {
+        case EMPXPopupPlayIcon:
+            {
+            iIconShown = EMPXPopupPlayIcon;
+            iPlayIcon->MakeVisible( ETrue );
+            iPauseIcon->MakeVisible( EFalse );
+            iFFIcon->MakeVisible( EFalse );
+            iFRIcon->MakeVisible( EFalse );
+            break;
+            }
+        case EMPXPopupPauseIcon:
+            {
+            iIconShown = EMPXPopupPauseIcon;
+            iPlayIcon->MakeVisible( EFalse );
+            iPauseIcon->MakeVisible( ETrue );
+            iFFIcon->MakeVisible( EFalse );
+            iFRIcon->MakeVisible( EFalse );
+            break;
+            }
+        case EMPXPopupFFIcon:
+            {
+            iIconShown = EMPXPopupFFIcon;
+            iFFIcon->MakeVisible( ETrue );
+            iPlayIcon->MakeVisible( EFalse );
+            iPauseIcon->MakeVisible( EFalse );
+            iFRIcon->MakeVisible( EFalse );
+            break;
+            }
+        case EMPXPopupFRIcon:
+            {
+            iIconShown = EMPXPopupFFIcon;
+            iPlayIcon->MakeVisible( EFalse );
+            iPauseIcon->MakeVisible( EFalse );
+            iFFIcon->MakeVisible( EFalse );
+            iFRIcon->MakeVisible( ETrue );
+            break;
+            }
+        default:
+            {
+            iIconShown = EMPXPopupNoneIcon;
+            iPlayIcon->MakeVisible( EFalse );
+            iPauseIcon->MakeVisible( EFalse );
+            iFFIcon->MakeVisible( EFalse );
+            iFRIcon->MakeVisible( EFalse );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Callback for timer
+// ---------------------------------------------------------------------------
+//
+TInt CMPXNotifierDialog::TimerCallback( TAny* aPtr )
+    {
+    MPX_DEBUG1( "CMPXNotifierDialog::TimerCallback" );
+    static_cast<CMPXNotifierDialog*>( aPtr )->CancelInfoPopup();
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Convert to displayable duration.
+// ---------------------------------------------------------------------------
+//
+HBufC* CMPXNotifierDialog::DisplayableDurationL(
+    TInt aDuration )
+    {
+    TInt resId;
+    HBufC* format = NULL;
+    if ( aDuration >= KMPXOneHundredHoursInSecs )
+        {
+        resId = R_MPX_TIME_DURAT_HHHMMSS_WITH_ZERO;
+        format = StringLoader::LoadLC(
+            resId, aDuration / KMPXOneHourInSeconds );
+        }
+    else
+        {
+        resId = R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO;
+        if ( aDuration >= KMPXOneHourInSeconds )
+            {
+            resId = R_QTN_TIME_DURAT_LONG_WITH_ZERO;
+            }
+        format = StringLoader::LoadLC( resId );
+        }
+
+    SetLayoutsL( aDuration > KMPXOneHourInSeconds? ETrue: EFalse);
+
+    // Convert total playing time to texts.
+    TTime durTime( (TInt64)aDuration * KMPXOneSecInMicroSecs );
+
+    HBufC* buf =
+        HBufC::NewLC( format->Length() + KMPXDurationDisplayResvLen );
+    TPtr bufTPtr( buf->Des() );
+
+    durTime.FormatL( bufTPtr, *format );
+    AknTextUtils::LanguageSpecificNumberConversion( bufTPtr );
+    CleanupStack::Pop( buf );
+    CleanupStack::PopAndDestroy( format );
+
+    return buf;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Draws the control.
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::Draw( const TRect& /* aRect */ ) const
+    {
+    CWindowGc& gc = SystemGc();
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+
+    // background
+    AknsDrawUtils::Background( skin, cc, gc, Rect() );
+
+    // skin stuff - find out size of the corner piece
+    TAknLayoutRect cornerRect;
+    // skinned draw uses submenu popup window skin (skinned border)
+    cornerRect.LayoutRect(
+        Rect(),
+        SkinLayout::Submenu_skin_placing_Line_2() );
+
+    TRect innerRect( Rect() );
+    innerRect.Shrink( cornerRect.Rect().Width(), cornerRect.Rect().Height() );
+
+    if ( !AknsDrawUtils::DrawFrame(
+            skin,
+            gc,
+            Rect(),
+            innerRect,
+            KAknsIIDQsnFrPopupSub,
+            KAknsIIDQsnFrPopupCenterSubmenu ) )
+        {
+        // skinned border failed -> black border
+        gc.SetPenStyle( CGraphicsContext::ESolidPen );
+        gc.SetBrushColor( KRgbBlack );
+        gc.DrawRect( Rect() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType );
+
+    if ( aType == KAknsMessageSkinChange )
+        {
+        // Reload icons & layout
+        TRAP_IGNORE(
+            {
+            CreateIconsL();
+            ShowIcon( iIconShown );
+            SetLayoutsL();
+            } );
+        }
+    else if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        ResizeInfoPopup();
+        if( iReopenDialog )
+          {
+          MakeVisible( ETrue );
+          iReopenDialog = EFalse;
+          }
+        }
+    else
+        {
+        // pass
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Responds to changes to the size and position of the contents of this
+// control.
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::SizeChanged()
+    {
+    TRAP_IGNORE( SetLayoutsL() );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the number of controls contained in a compound control.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXNotifierDialog::CountComponentControls() const
+    {
+    return KMPXComponentsCount;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets an indexed component of a compound control.
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CMPXNotifierDialog::ComponentControl( TInt aIndex ) const
+    {
+    CCoeControl* control = NULL;
+
+    switch ( aIndex )
+        {
+        case EMPXTrackLabel:
+            {
+            control = iSongLabel;
+            break;
+            }
+        case EMPXTimeLabel:
+            {
+            control = iTimeLabel;
+            break;
+            }
+        case EMPXPlayIcon:
+            {
+            control = iPlayIcon;
+            break;
+            }
+        case EMPXPauseIcon:
+            {
+            control = iPauseIcon;
+            break;
+            }
+        case EMPXFFIcon:
+            {
+            control = iFFIcon;
+            break;
+            }
+        case EMPXFRIcon:
+            {
+            control = iFRIcon;
+            break;
+            }
+        default:
+            {
+            // Pass
+            break;
+            }
+        }
+
+    return control;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPSKeyObserver
+// Handle PS event
+// ---------------------------------------------------------------------------
+//
+void CMPXNotifierDialog::HandlePSEvent( TUid aUid, TInt aKey )
+    {
+    if ( ( aUid == KPSUidAiInformation ) && ( aKey == KActiveIdleState ) )
+        {
+        //we want to cancel popup when going to active idle
+        CancelInfoPopup();
+        }
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/mediakeyhandler/src/mpxremconkeyresponse.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class for sending response back to RemCon Framework.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxremconkeyresponse.h"
+#include "mpxlog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXRemConKeyResponse::CMPXRemConKeyResponse( 
+    CRemConCoreApiTarget& aRemConCoreApiTarget ) : 
+    CActive( CActive::EPriorityStandard ),
+    iRemConCoreApiTarget( aRemConCoreApiTarget )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXRemConKeyResponse* CMPXRemConKeyResponse::NewL(
+    CRemConCoreApiTarget& aRemConCoreApiTarget )
+    {
+    CMPXRemConKeyResponse* self = 
+        new (ELeave) CMPXRemConKeyResponse( aRemConCoreApiTarget );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXRemConKeyResponse::~CMPXRemConKeyResponse()
+    {
+    Cancel();
+    iResponseArray.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Send the any key response back to Remcon server
+// ---------------------------------------------------------------------------
+//
+void CMPXRemConKeyResponse::CompleteAnyKey( 
+    TRemConCoreApiOperationId aOperationId )
+    {
+    if ( !IsActive() )
+        {
+        switch ( aOperationId )
+            {
+            case ERemConCoreApiVolumeUp:
+                {
+                iRemConCoreApiTarget.VolumeUpResponse( iStatus, KErrNone );
+                SetActive();
+                break;
+                }
+            case ERemConCoreApiVolumeDown:
+                {
+                iRemConCoreApiTarget.VolumeDownResponse( iStatus, KErrNone );
+                SetActive();
+                break;
+                }
+            default:
+                {
+                TInt error = KErrNone;
+                iRemConCoreApiTarget.SendResponse(
+                    iStatus, aOperationId, error );
+                SetActive();
+                break;
+                }
+            }
+        }
+    // already active. Append to array and complete later.
+    else
+        {
+        iResponseArray.Append( aOperationId );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// Implements cancellation of an outstanding request.
+// ---------------------------------------------------------------------------
+//
+void CMPXRemConKeyResponse::DoCancel()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Handles an active object's request completion event.
+// ---------------------------------------------------------------------------
+//
+void CMPXRemConKeyResponse::RunL()
+    {
+    MPX_DEBUG2( "CMPXRemConKeyResponse.RunL() -- iStatus=%d", iStatus.Int() );
+
+    // if any existing -> Send response
+    if ( iResponseArray.Count() )
+        {
+        CompleteAnyKey( iResponseArray[0] );
+        // Remove already completed key
+        iResponseArray.Remove( 0 );
+        iResponseArray.Compress();
+        }
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/metadatahandler/bwinscw/mpxmetadatahandleru.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@MMPXMetaDataHandler@@SAPAV1@AAVCRemConInterfaceSelector@@@Z @ 1 NONAME ; class MMPXMetaDataHandler * MMPXMetaDataHandler::NewL(class CRemConInterfaceSelector &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/metadatahandler/data/mplayeravrcpsettings.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project AVRCP 1.3 player settings
+*
+*/
+
+
+#include "settings.rh"
+//#include <musicplayer2.loc>
+//#include "mplayerplaybackui.hrh"
+
+UID2 KUidAVRCPResourceFile  // Identifies this as an AVRCP settings file
+
+#define KBassBoostMode 0x80
+#define KStereoWideningMode 0x81
+
+// ---------------------------------------------------------------------------
+// r_mplayer_avrcp_settings
+// Definition of player settings indicated to a remote controller.
+// ---------------------------------------------------------------------------
+//
+RESOURCE SETTINGS r_mplayer_avrcp_settings
+    {
+    settings =
+        {
+        SETTING
+            {
+            attribute = KEqualizerMode;
+            initialValue = KOff;
+            description = "Equalizer Mode";
+            definedValues = 
+                {
+                VALUE
+                    {
+                    valueId = KOff;
+                    description = "Off";  // No own value for equalizer
+                    },
+                VALUE
+                    {
+                    valueId = KOn;
+                    description = "On";   // No own value for equalizer
+                    }
+                };
+            },
+        SETTING
+            {
+            attribute = KRepeatMode;
+            initialValue = KOff;
+            description = "Repeat Mode";
+            definedValues = 
+                {
+                VALUE
+                    {
+                    valueId = KOff;
+                    description = "Off";
+                    },
+                VALUE
+                    {
+                    valueId = KSingleTrackRepeat;
+                    description = "Single track repeat";
+                    },
+                VALUE
+                    {
+                    valueId = KAllTracksRepeat;
+                    description = "All tracks repeat";
+                    }
+                };
+            },
+        SETTING
+            {
+            attribute = KShuffleMode;
+            initialValue = KOff;
+            description = "Shuffle Mode";
+            definedValues = 
+                {
+                VALUE
+                    {
+                    valueId = KOff;
+                    description = "Off";
+                    },
+                VALUE
+                    {
+                    valueId = KOn;
+                    description = "On";
+                    }
+                };
+            }
+#if defined (__BASS_BOOST_EFFECT_UI) && defined (__AUDIO_EFFECTS_API)
+        , SETTING
+            {
+            attribute = KBassBoostMode;
+            initialValue = KOff;
+            description = "Bass Boost";
+            definedValues = 
+                {
+                VALUE
+                    {
+                    valueId = KOff;
+                    description = "Off";
+                    },
+                VALUE
+                    {
+                    valueId = KOn;
+                    description = "On";
+                    }
+                };
+            }
+#endif  //defined (__BASS_BOOST_EFFECT_UI) && defined (__AUDIO_EFFECTS_API)
+#if defined (__STEREO_WIDENING_EFFECT_UI) && defined (__AUDIO_EFFECTS_API)
+        , SETTING
+            {
+            attribute = KStereoWideningMode;
+            initialValue = KOff;
+            description = "Stereo Widening";
+            definedValues = 
+                {
+                VALUE
+                    {
+                    valueId = KOff;
+                    description = "Off";
+                    },
+                VALUE
+                    {
+                    valueId = KOn;
+                    description = "On";
+                    }
+                };
+            }
+#endif  //defined (__STEREO_WIDENING_EFFECT_UI) && defined (__AUDIO_EFFECTS_API)
+        };
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/metadatahandler/data/settings.rh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource header for project metadatahandler
+*
+*/
+
+
+/**
+@file settings.rh
+Resource header for AVRCP resource files.
+@publishedPartner
+@released
+*/
+
+#ifndef SETTINGS_RH
+#define SETTINGS_RH
+
+/** 
+This resource header file defines the structures and constants required
+for the AVRCP Player Application Settings and Values, as defined in
+Appendix F of the Bluetooth Specification (AVRCP), page 80.
+
+A setting file consists of an arbitrary number of settings. This file
+will be parsed and used to set values for a media application at
+startup time, to be queried through the AVRCP profile.
+
+A setting file has the following structure
+
+UID2 KUidAVRCPResourceFile    // Identifies this as an AVRCP settings file
+
+RESOURCE SETTINGS mysettings
+    {
+    settings =
+        {
+        SETTING
+            {
+            // definition of setting 1
+            },
+        SETTING
+            {
+            // definition of setting 2
+            },
+        // etc
+        };
+    }
+*/
+
+#define KUidAVRCPResourceFile       0x10285ACD
+
+#define KIllegal        0x00
+#define KEqualizerMode  0x01
+#define KRepeatMode     0x02
+#define KShuffleMode    0x03
+#define KScanMode       0x04
+
+#define KOff            0x01
+#define KOn             0x02
+
+// Off                      0x01
+#define KSingleTrackRepeat  0x02
+#define KAllTracksRepeat    0x03
+#define KGroupRepeat        0x04
+
+// Off                      0x01
+#define KAllTracksShuffle   0x02
+#define KGroupShuffle       0x03
+
+// Off                      0x01
+#define KAllTracksScan      0x02
+
+#define KUserDefined        0x80
+
+// Defines a single setting
+STRUCT SETTING
+    {
+    // The player application setting attribute
+    // e.g. 0x00 illegal, not to be used
+    //      0x01 equalizer status
+    //      0x02 repeat mode status
+    //      0x03 shuffle mode status
+    //      0x04 scan mode status
+    //      0x05 - 0x7f reserved for future use
+    //      0x80 - 0xff provided for TG driver static media player menu extension by CT
+    BYTE    attribute = 0;
+
+    // The defined settings for this attribute
+    BYTE    initialValue = 0;
+
+    // An string which describes this setting
+    // This can be localised into the target language
+    LTEXT8   description = "";
+
+    // The values and descriptions that this attribute can take
+    STRUCT  definedValues[];
+    }
+
+// Defines a single setting
+STRUCT VALUE
+    {
+    // The setting value id in hex
+    BYTE    valueId = 0;
+
+    // An string which describes this value
+    // This can be localised into the target language
+    LTEXT8   description = "";
+    }
+
+// Defines a set of settings and the implementations UIDs of the default
+// setting evaluator and dialog creator plug-ins.
+STRUCT SETTINGS
+    {
+    // Version of the AVRCP resource file.
+    // Settings files MUST NOT change this value.
+    // This must match with the number defined in settingsresource.cpp
+    WORD version = 1;
+
+    // An array of SETTING structures
+    STRUCT settings[];
+    }
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/metadatahandler/eabi/mpxmetadatahandleru.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_ZN19MMPXMetaDataHandler4NewLER24CRemConInterfaceSelector @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/metadatahandler/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxmetadatahandler.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/mpxmetadatahandler.iby       CORE_APP_LAYER_IBY_EXPORT_PATH(mpxmetadatahandler.iby)
+
+PRJ_MMPFILES
+
+mpxmetadatahandler.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/metadatahandler/group/mpxmetadatahandler.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxmetadatahandler.
+*
+*/
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxmetadatahandler.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x2001E26D
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 10.0
+
+SOURCEPATH      ../src
+SOURCE          mpxmetadatahandler.cpp
+SOURCE          mpxmetadatahandlerimp.cpp
+
+START RESOURCE  ../data/mplayeravrcpsettings.rss
+HEADER
+TARGETPATH      RESOURCE_FILES_DIR
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+LIBRARY     euser.lib                           // standard user library
+LIBRARY     efsrv.lib                           // file server
+LIBRARY     bafl.lib                            // resource files
+LIBRARY     remconinterfacebase.lib             // remcon interface selector
+LIBRARY     mpxplaybackutility.lib              // the playback properties
+LIBRARY     mpxcommon.lib                       // common MPX FW definitions
+LIBRARY     remconplayerinformation.lib         // AVRCP 1.3 API
+LIBRARY     remconmediainformationapi.lib       // AVRCP 1.3 API
+LIBRARY     remcongroupnavigationapi.lib        // AVRCP 1.3 API
+LIBRARY     charconv.lib                        // Unicode character conversions
+LIBRARY     mpxcollectionutility.lib            // access the music collection
+LIBRARY     centralrepository.lib               // access the equalizer
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/metadatahandler/inc/mpxmetadatahandlerimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,499 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of metadata handler
+*
+*/
+
+
+
+#ifndef C_CMPXMETADATAHANDLERIMP_H
+#define C_CMPXMETADATAHANDLERIMP_H
+
+// INCLUDES
+#include <mpxplaybackobserver.h>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxcollectionplaylistobserver.h>
+
+#include <remconmediainformationtarget.h>
+#include <playerinformationtargetobserver.h>
+#include <remcongroupnavigationtargetobserver.h>
+
+// FORWARD DECLARATIONS
+class CRemConInterfaceSelector;
+class CRepository;
+class MMPXPlaybackUtility;
+class MPlayerCapabilitiesObserver;
+class MPlayerApplicationSettingsObserver;
+class MPlayerEventsObserver;
+class CRemConGroupNavigationApiTarget;
+class CPlayerInfoTarget;
+class CEqualizerPresetChangeListener;
+
+
+/**
+ *  Observer class for equalizer preset changes.
+ *
+ *  @lib mpxmetadatahandler.lib
+ *  @since S60 v5.1
+ */
+class MEqualizerPresetChangeListenerObserver
+    {
+public:
+
+    /**
+     * Callback for receiving changes in the equalizer preset settings.
+     *
+     * @since S60 v5.1
+     * @param aNewPreset The ID of the new equalizer preset
+     */
+    virtual void EqualizerPresetChangedL(TInt aNewPreset) = 0;
+
+    };
+
+
+/**
+ *  AVRCP 1.3 metadata handler implementation class
+ *
+ *  @lib mpxmetadatahandler.lib
+ *  @since S60 v5.1
+ */
+NONSHARABLE_CLASS( CMPXMetaDataHandlerImp ): public CBase,
+											 public MMPXMetaDataHandler,
+											 public MMPXPlaybackObserver,
+											 public MMPXPlaybackCallback,
+											 public MPlayerApplicationSettingsNotify,
+											 public MRemConMediaInformationTargetObserver,
+											 public MRemConGroupNavigationTargetObserver,
+											 public MMPXCollectionPlaylistObserver,
+											 public MEqualizerPresetChangeListenerObserver
+	{
+public:
+
+	/**
+	 * Two-phased constructor.
+	 *
+	 * @since v5.1
+	 * @param aInterfaceSelector RemCon interface selector.
+	 * @return Pointer to newly created object.
+	 */
+	static MMPXMetaDataHandler* NewL(CRemConInterfaceSelector &aInterfaceSelector);
+
+	/**
+	 * Destructor.
+	 */
+	virtual ~CMPXMetaDataHandlerImp();
+
+private:
+
+	/**
+	 * C++ default constructor.
+	 *
+     * @since S60 v5.1
+	 */
+	CMPXMetaDataHandlerImp();
+
+	/**
+	 * By default Symbian 2nd phase constructor is private.
+	 * 
+     * @since S60 v5.1
+     * @param aInterfaceSelector RemCon interface selector.
+	 */
+	void ConstructL(CRemConInterfaceSelector &aInterfaceSelector);
+
+	/**
+	 * Handle playback message
+	 *
+     * @since S60 v5.1
+	 * @param aMessage playback message
+	 */
+	void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+	/**
+	 * Handle playback property
+	 *
+     * @since S60 v5.1
+	 * @param aProperty the property
+	 * @param aValue the value of the property
+	 * @param aError error code
+	 */
+	void DoHandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError );
+
+	/**
+	 * Handle media properties.
+	 *
+     * @since S60 v5.1
+	 * @param aMedia media properties
+	 * @param aError error code
+	 */
+	void DoHandleMediaL( const CMPXMedia& aMedia, TInt aError );
+
+	/**
+	 * Handle playback state changed.
+	 *
+     * @since S60 v5.1
+	 * @param aState New Playback state
+	 */
+	void DoHandleStateChangedL( TMPXPlaybackState aState );
+
+// from base class MMPXPlaybackObserver
+
+	/**
+	 * From MMPXPlaybackObserver
+	 * Handle playback message
+	 *
+     * @since S60 v5.1
+	 * @param aMessage playback message
+	 * @param aErr system error code.
+	 */
+	void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+// from base class MMPXPlaybackCallback
+
+	/**
+	 * From MMPXPlaybackCallback
+	 * Handle playback property
+	 *
+     * @since S60 v5.1
+	 * @param aProperty the property
+	 * @param aValue the value of the property
+	 * @param aError error code
+	 */
+	void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError );
+
+	/**
+	 * 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
+	 *
+     * @since S60 v5.1
+	 * @param aPlayer UID of the subplayer
+	 * @param aSubPlayers a list of sub players
+	 * @param aComplete ETrue no more sub players. EFalse more subplayer expected
+	 * @param aError error code
+	 */
+	void HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, 
+	                            TBool aComplete, TInt aError );
+
+	/**
+	 * From MMPXPlaybackCallback
+	 * Handle media properties
+	 *
+     * @since S60 v5.1
+	 * @param aMedia media
+	 * @param aError error code
+	 */
+	void HandleMediaL( const CMPXMedia& aMedia, TInt aError );
+
+// From base class MMPXCollectionPlaylistObserver
+
+    /**
+     * From MMPXCollectionPlaylistObserver
+     * Handle collection playlist change.
+     *
+     * @since S60 v5.1
+     * @param aError KErrNotFound - Playlist is updated, current item removed
+     *               KErrNone - Playlist is updated, current item is valid
+     *               KErrEof - Playlist is updated, current item removed and
+     *                          reached to the end of playlist
+     */
+	void HandleCollectionPlaylistChange(TInt aError);
+
+// From base class MPlayerApplicationSettingsNotify
+
+	/**
+	 * From MPlayerApplicationSettingsNotify
+	 * This is called when the controller has changed a setting
+	 *
+     * @since S60 v5.1
+	 * @param aAttributeID A list of attribute IDs whose value has changed.
+	 * @param aAttributeValue A list of new values for the attributes listed in aAttributeID.
+	 */
+	virtual void MpasnSetPlayerApplicationValueL(const RArray<TInt>& aAttributeID, const RArray<TInt>& aAttributeValue);
+
+// From base class MRemConMediaInformationTargetObserver
+
+	/**
+	 * From MRemConMediaInformationTargetObserver
+	 * For each element in aAttributeList the client should respond by calling
+	 * CRemConMediaInformationTarget::AttributeValue(). After all attributes have
+	 * been supplied the client should call CRemConMediaInformationTarget::Completed().
+	 *
+     * @since S60 v5.1
+	 * @param aAttributeList A list of TAttributeID requested by the controller
+	 */
+	virtual void MrcmitoGetCurrentlyPlayingMetadata( TMediaAttributeIter& aAttributeIter );
+
+	/**
+	 * From MRemConGroupNavigationTargetObserver
+	 * Clients must implement this interface in order to instantiate objects of type
+	 * CRemConGroupNavigation. This interface passes incoming commands from RemCon to
+	 * the client.
+	 * A 'Next Group' has been received.
+	 * 
+     * @since S60 v5.1
+	 * @param aButtonAct The button action associated with the command.
+	 */
+	virtual void MrcgntoNextGroup(TRemConCoreApiButtonAction aButtonAct);
+
+	/**
+	 * From MRemConGroupNavigationTargetObserver
+	 * For each element in aAttributeList the client should respond by calling
+	 * CRemConMediaInformationTarget::AttributeValue(). After all attributes have
+	 * been supplied the client should call CRemConMediaInformationTarget::Completed().
+	 * A 'Previous Group' has been received.
+	 * 
+     * @since S60 v5.1
+	 * @param aButtonAct The button action associated with the command.
+	 */
+	virtual void MrcgntoPreviousGroup(TRemConCoreApiButtonAction aButtonAct);
+
+// From base class MEqualizerPresetChangeListenerObserver
+
+    /**
+     * From MEqualizerPresetChangeListenerObserver
+     * Callback for receiving changes in the equalizer preset settings.
+     *
+     * @since S60 v5.1
+     * @param aNewPreset The ID of the new equalizer preset
+     */
+	virtual void EqualizerPresetChangedL(TInt aNewPreset);
+
+private:    // Data
+
+    /**
+     * The current player state (playing, paused, stopped).
+     */
+    TMPXPlaybackState iPlayerState;
+
+    /**
+     * Current track's position info (in seconds)
+     */
+    TInt iPlaybackPosition;
+
+    /**
+     * Current track's playing time info (in milliseconds)
+     */
+    TInt iPlayingTime;
+
+    /**
+     * Current track number
+     */
+    TInt iTrackNumber;
+
+    /**
+     * Last selected equalizer preset settings
+     */
+    TInt iLastEqPresetId;
+
+	/**
+	 * Current track's title info
+     * Own.
+	 */
+	HBufC* iTrackTitle;
+
+    /**
+     * Current track's artist info
+     * Own.
+     */
+	HBufC* iArtist;
+
+	/**
+     * Current track's album info
+     * Own.
+     */
+	HBufC* iAlbum;
+
+	/**
+     * Current track's genre info
+     * Own.
+     */
+	HBufC* iGenre;
+	
+	/**
+     * Current track's unique id info
+     * Own.
+     */
+	
+	TUid iColId;
+
+    /**
+     * Observer for equalizer preset changes
+     * Own.
+     */
+    CEqualizerPresetChangeListener* iEqPresetListener;
+
+    /**
+     * Main interface to the player.
+     * Not own.
+     */
+    MMPXPlaybackUtility* iPlaybackUtility;
+
+    /**
+     * Container for player information responses
+     * Not own.
+     */
+    CPlayerInfoTarget* iPlayerInformationTarget;
+
+    /**
+     * Observer of this player's capabilities.
+     * Not own.
+     */
+	MPlayerCapabilitiesObserver* iPlayerCapabilitiesObserver;
+
+    /**
+     * Observer of this player's settings.
+     * Not own.
+     */
+	MPlayerApplicationSettingsObserver* iPlayerApplicationSettingsObserver;
+
+	/**
+     * Observer of player events.
+     * Not own.
+     */
+	MPlayerEventsObserver* iPlayerEventsObserver;
+
+	/**
+     * Interface for sending media information
+     * Not own.
+     */
+	CRemConMediaInformationTarget* iMediaInfoTarget;
+
+	/**
+     * Interface for group navigation responses
+     * Not own.
+     */
+	CRemConGroupNavigationApiTarget* iGroupNavigationTarget;
+
+	};
+
+
+/**
+ *  Helper class for receiving equalizer preset changed events.
+ *
+ *  @lib mpxmetadatahandler.lib
+ *  @since S60 v5.1
+ */
+NONSHARABLE_CLASS(CEqualizerPresetChangeListener): public CActive
+	{
+public:
+
+	/**
+	 * Two-phased constructor.
+	 *
+	 * @since v5.1
+	 * @param aFlags Flags for creating popups.
+	 * @param aObserver Custom command observer for media key handling.
+	 * @return Pointer to newly created object.
+	 */
+	static CEqualizerPresetChangeListener* NewL(MEqualizerPresetChangeListenerObserver& aObserver);
+
+	/**
+	 * Destructor.
+	 */
+	virtual ~CEqualizerPresetChangeListener();
+
+    /**
+     * Get the current equalizer preset ID
+     *
+     * @since S60 v5.1
+     * @return The current preset ID
+     */
+	TInt GetCurrentPresetL();
+
+    /**
+     * Set the equalizer preset
+     *
+     * @since S60 v5.1
+     * @param aNewPreset The ID of the preset to be activated
+     */
+	void ChangePresetL(TInt aNewPreset);
+
+    /**
+     * Start listening to equalizer preset changes
+     *
+     * @since S60 v5.1
+     */
+	void StartL();
+
+	/**
+     * Stop listening to equalizer preset changes
+     *
+     * @since S60 v5.1
+     * @return The current preset ID
+     */
+	void Stop();
+
+private:
+
+	/**
+	 * C++ default constructor.
+	 *
+     * @since S60 v5.1
+	 * @param aObserver Client for receiving equalizer preset changed events
+	 */
+	CEqualizerPresetChangeListener(MEqualizerPresetChangeListenerObserver& aObserver);
+
+	/**
+     * Symbian 2nd-phase constructor
+     *
+     * @since S60 v5.1
+	 */
+	void ConstructL();
+
+// from base class CActive
+
+    /**
+     * From CActive.
+     * Called by the active scheduler when the request has been cancelled.
+     *
+     * @since S60 v5.1
+     */
+    virtual void DoCancel();
+    
+    /**
+     * From CActive.
+     * Called by the active scheduler when the request has been completed.
+     *
+     * @since S60 v5.1
+     */
+    virtual void RunL();
+
+    /**
+     * From CActive.
+     * Called by the active scheduler when an error in RunL has occurred.
+     *
+     * @since S60 v5.1
+     */
+    TInt RunError( TInt aError );
+
+private:    // Data
+
+    /**
+     * Handle to Central Repository
+     * Own.
+     */
+    CRepository* iRepository;
+
+    /**
+     * Client for receiving equalizer preset changed events
+     * Not own.
+     */
+    MEqualizerPresetChangeListenerObserver& iObserver;
+
+	};
+
+#endif  // C_CMPXMETADATAHANDLERIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/metadatahandler/loc/mpxmetadatahandler.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxmediakeyhandler
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:A string in the volume pop up control.
+// d:Shown when the user is changing volume and
+// d:application is active.
+// l:popup_side_volume_key_window_t1
+// r:3.1
+//
+#define qtn_svk_title_music_player "Music Player"
+
+// d:Media keypress not supported error note
+// d:Display when media key event isn't supported by player
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_no_media_key   "Media key event not supported by player"
+
+// d:Volume not supported error note
+// d:Display when volume isn't supported by player
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_no_volume_control  "Volume control not supported by player"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/metadatahandler/rom/mpxmetadatahandler.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project MPX Metadata Handler.
+*
+*/
+
+
+#ifndef MPXMETADATAHANDLER_IBY
+#define MPXMETADATAHANDLER_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxmetadatahandler.dll       SHARED_LIB_DIR\mpxmetadatahandler.dll
+// Temporary avrcpsettings rsc file
+data=DATAZ_\RESOURCE_FILES_DIR\mplayeravrcpsettings.rsc  RESOURCE_FILES_DIR\mplayeravrcpsettings.rsc 
+
+#endif  // MPXMETADATAHANDLER_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/metadatahandler/src/mpxmetadatahandler.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Metadata handler interface
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxmetadatahandler.h" 
+#include "mpxmetadatahandlerimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MMPXMetaDataHandler* MMPXMetaDataHandler::NewL(CRemConInterfaceSelector &aInterfaceSelector)
+    {
+    return CMPXMetaDataHandlerImp::NewL(aInterfaceSelector);
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+MMPXMetaDataHandler::~MMPXMetaDataHandler()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/metadatahandler/src/mpxmetadatahandlerimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,849 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of metadata handler
+*
+*/
+
+
+#include <bldvariant.hrh>
+#include <remconinterfaceselector.h>
+
+#include <bautils.h>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxplaybackmessage.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxmedia.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessagedefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxuser.h>
+#include <mpxlog.h>
+#include <playerinformationtarget.h>
+#include <remcongroupnavigationtarget.h>
+#include <utf.h>
+#include <remcon/avrcpspec.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionpath.h>
+#include <EqualizerConstants.h>
+#include <centralrepository.h>
+#include "mpxmetadatahandler.h"
+#include "mpxmetadatahandlerimp.h"
+
+// CONSTANTS
+const TInt KMPXOneSecInMilliSecs( 1000 );
+
+// Definition of remotely controllable application settings
+// The commented settings are not used here, included for reference.
+_LIT( KMPlayerSettingsDefs, "mplayeravrcpsettings.rsc" );
+const TInt KAvrcpEqualizerMode = 0x01;
+const TInt KAvrcpRepeatMode = 0x02;
+const TInt KAvrcpShuffleMode = 0x03;
+//const TInt KAvrcpScanMode = 0x04;
+
+const TInt KAvrcpOff = 0x01;
+const TInt KAvrcpOn = 0x02;
+
+// Off                      0x01
+//const TInt KAvrcpSingleTrackRepeat = 0x02;
+//const TInt KAvrcpAllTracksRepeat = 0x03;
+//const TInt KAvrcpGroupRepeat = 0x04;
+
+// Off                      0x01
+const TInt KAvrcpAllTracksShuffle = 0x02;
+//const TInt KAvrcpGroupShuffle = 0x03;
+
+// Extended settings defined for Music Player
+// Note that these are also defined in mplayeravrcpsettings.rss
+const TInt KAvrcpBassBoostMode = 0x80;
+const TInt KAvrcpStereoWideningMode = 0x81;
+
+const TUid KCRUidMusicPlayerSettings = {0x101FFCDC};
+const TUint32 KMPlayerEqPresetId = 0x00000001;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXMetaDataHandlerImp::CMPXMetaDataHandlerImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::ConstructL(CRemConInterfaceSelector &aInterfaceSelector)
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::ConstructL(CRemConInterfaceSelector)");
+
+    iPlayerInformationTarget = CPlayerInfoTarget::NewL(aInterfaceSelector, 
+                                                iPlayerCapabilitiesObserver, 
+                                                iPlayerApplicationSettingsObserver, 
+                                                iPlayerEventsObserver, *this);
+    iMediaInfoTarget = CRemConMediaInformationTarget::NewL( aInterfaceSelector, *this );
+
+    iGroupNavigationTarget = CRemConGroupNavigationApiTarget::NewL( aInterfaceSelector, *this );
+
+    // Get the playback utility instance from engine.
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+    iPlaybackUtility->AddObserverL( *this );
+
+    MMPXSource* s = iPlaybackUtility->Source();
+    if ( s )
+        {
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        (void) attrs.Append( KMPXMediaGeneralTitle );
+        (void) attrs.Append( KMPXMediaGeneralDuration );
+        (void) attrs.Append( KMPXMediaGeneralId );
+        (void) attrs.Append( KMPXMediaMusicArtist );
+        (void) attrs.Append( KMPXMediaMusicAlbum );
+        (void) attrs.Append( KMPXMediaMusicGenre );
+        s->MediaL( attrs.Array(), *this, NULL );
+        CleanupStack::PopAndDestroy( &attrs );
+        }
+
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL( fs );
+
+    TParse parse;   
+    parse.Set( KMPlayerSettingsDefs, &KDC_RESOURCE_FILES_DIR, NULL );
+    
+    TFileName resourceFile( parse.FullName() );
+
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( fs, resourceFile );
+    CResourceFile* playerSettingsResourceFile = CResourceFile::NewLC( fs, resourceFile, 0, 0 );
+    PlayerApplicationSettingsResourceInit::DefineAttributesL( *iPlayerApplicationSettingsObserver, *playerSettingsResourceFile );
+    CleanupStack::PopAndDestroy( playerSettingsResourceFile );
+    CleanupStack::PopAndDestroy( &fs );
+
+        // Adding two optional events, mandatory ERegisterNotificationPlaybackStatusChanged 
+        // and ERegisterNotificationTrackChanged are added by SOS.
+    User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationPlaybackPosChanged));
+    User::LeaveIfError( iPlayerCapabilitiesObserver->AddEvent(ERegisterNotificationPlayerApplicationSettingChanged));
+
+    iEqPresetListener = CEqualizerPresetChangeListener::NewL(*this);
+    iLastEqPresetId = iEqPresetListener->GetCurrentPresetL();
+    iEqPresetListener->StartL();
+    iTrackNumber = 0;
+    iColId.iUid = -1;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+MMPXMetaDataHandler* CMPXMetaDataHandlerImp::NewL(CRemConInterfaceSelector &aInterfaceSelector)
+    {
+    CMPXMetaDataHandlerImp* self = new(ELeave)CMPXMetaDataHandlerImp();
+    CleanupStack::PushL( self );
+    self->ConstructL(aInterfaceSelector);
+    CleanupStack::Pop(self);
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXMetaDataHandlerImp::~CMPXMetaDataHandlerImp()
+    {
+    if( iEqPresetListener )
+        {
+        iEqPresetListener->Stop();
+        delete iEqPresetListener;
+        }
+    if( iPlaybackUtility )
+        {
+        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+        iPlaybackUtility->Close();
+        }
+
+    delete iTrackTitle;
+    delete iArtist;
+    delete iAlbum;
+    delete iGenre;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::DoHandlePlaybackMessageL(CMPXMessage)");
+
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessagePbMediaChanged == id )
+        {
+        if ( aMessage.IsSupported( KMPXMessagePbMedia ) )
+            {
+            CMPXMedia* media( aMessage.Value<CMPXMedia>( KMPXMessagePbMedia ) );
+            User::LeaveIfNull( media );
+            iPlaybackPosition = 0;
+            DoHandleMediaL( *media, KErrNone );
+            }
+        }
+    else if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ));
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ));
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EPropertyChanged:
+                {
+                TMPXPlaybackProperty property( static_cast<TMPXPlaybackProperty>( type ) );
+                TInt error( KErrNone );
+                DoHandlePropertyL( property, data, error );
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                MPX_DEBUG2( "CMPXMetaDataHandlerImp::HandlePlaybackMessageL - EStateChanged(%d)", type );
+
+                TMPXPlaybackState state = static_cast<TMPXPlaybackState>( type );
+                DoHandleStateChangedL( state );
+                break;
+                }
+            case TMPXPlaybackMessage::EMediaChanged:
+                {
+                MMPXSource* s = iPlaybackUtility->Source();
+                if ( s )
+                    {
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL(attrs);
+                    (void) attrs.Append( KMPXMediaGeneralTitle );
+                    (void) attrs.Append( KMPXMediaGeneralDuration );
+                    (void) attrs.Append( KMPXMediaGeneralId );
+                    (void) attrs.Append( KMPXMediaMusicArtist );
+                    (void) attrs.Append( KMPXMediaMusicAlbum );
+                    (void) attrs.Append( KMPXMediaMusicGenre );
+                    MPX_DEBUG1( "CMPXMetaDataHandlerImp::HandlePlaybackMessageL Media changed, calling MediaL to refresh" );
+                    s->MediaL( attrs.Array(), *this, NULL );
+                    CleanupStack::PopAndDestroy( &attrs );
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::DoHandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::DoHandlePropertyL" );
+    MPX_DEBUG4( "CMPXMetaDataHandlerImp::HandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError );
+
+    TInt attr = 0;
+    TInt val = KAvrcpOff;
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty )
+            {
+            case EPbPropertyPosition:
+                {
+                iPlaybackPosition = aValue / KMPXOneSecInMilliSecs;
+                    // AVRCP 1.3 - inform remote device of the new position 
+                    // ( Todo: check that we don't call too often)
+                iPlayerEventsObserver->SetPlaybackPosition(aValue); // aPlaybackPosInMicroSeconds is converted to 32 bit value
+                break;
+                }
+            case EPbPropertyRepeatMode:
+                {
+                attr = KAvrcpRepeatMode; // Repeat mode status
+                    // TMPlayerRepeatMode values are in the same order as AVRCP 1.3, 
+                    // but starting at 0 instead of 1.
+                val = (TInt) aValue + 1;
+                break;
+                }
+            case EPbPropertyRandomMode:
+                {
+                attr = KAvrcpShuffleMode;    // Shuffle on/off status
+                TBool random = aValue;
+                if( random )
+                    {
+                    val = KAvrcpAllTracksShuffle;
+                    }
+                break;
+              }
+            default:
+                {
+                break;
+                }
+            }
+        if( attr )
+            {
+            iPlayerApplicationSettingsObserver->SetAttributeL( attr, val );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aProperties.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::DoHandleMediaL(
+    const CMPXMedia& aMedia, TInt aError )
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::DoHandleMediaL" );
+
+    // Delete old title no matter there's error or not
+    delete iTrackTitle;
+    iTrackTitle = NULL;
+    delete iArtist;
+    iArtist = NULL;
+    delete iAlbum;
+    iAlbum = NULL;
+    delete iGenre;
+    iGenre = NULL;
+    TInt lastTrackNumber = -1;
+    if ( KErrNone == aError )
+        {
+        // Keep track of the current track's title
+        iTrackTitle = aMedia.ValueText( KMPXMediaGeneralTitle ).AllocL();
+        TInt *playingTime = aMedia.Value<TInt>( KMPXMediaGeneralDuration );
+        if(playingTime)
+            {
+            iPlayingTime = *playingTime; // In milliseconds.
+            }
+        MMPXSource* s = iPlaybackUtility->Source();
+        if ( s )
+            {
+            CMPXCollectionPlaylist* pl = s->PlaylistL();
+            if( pl )
+                {
+                lastTrackNumber = pl->Path().Index() + 1; // What if PlaylistItemCount is zero?
+                delete pl;
+                }
+            }
+
+        iArtist = aMedia.ValueText( KMPXMediaMusicArtist ).AllocL();
+        iAlbum = aMedia.ValueText( KMPXMediaMusicAlbum ).AllocL();
+        iGenre = aMedia.ValueText( KMPXMediaMusicGenre ).AllocL();
+
+        TUid colId = aMedia.ValueTObjectL<TUid>(KMPXMediaGeneralId);
+
+        
+        MPX_DEBUG2( "CMPXMetaDataHandlerImp::DoHandleMediaL - Track title(%S)", iTrackTitle);
+        MPX_DEBUG4( "CMPXMetaDataHandlerImp::DoHandleMediaL - Artist(%S); Album(%S); Genre(%S)", iArtist, iAlbum, iGenre );
+        MPX_DEBUG4( "CMPXMetaDataHandlerImp::DoHandleMediaL - Playing time(%d); Track number(%d); UID(%d)", iPlayingTime, lastTrackNumber, colId.iUid);
+                
+        if ( colId.iUid != iColId.iUid || lastTrackNumber != iTrackNumber )
+            {
+            iColId = colId;
+            iTrackNumber = lastTrackNumber;
+            iPlayerEventsObserver->TrackChanged(iColId.iUid, iPlayingTime);
+            }
+        else
+            {
+            MPX_DEBUG1( "CMPXMetaDataHandlerImp::DoHandleMediaL DUPLICATE Trace Change Received" );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::DoHandleStateChangedL(
+    TMPXPlaybackState aState )
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::DoHandleStateChangedL" );
+    switch ( aState )
+        {
+        case EPbStateStopped:
+            {
+            iPlayerState = aState;
+            iPlayerEventsObserver->PlaybackStatusChanged(MPlayerEventsObserver::EStopped);
+            break;
+            }
+        case EPbStatePlaying:
+            iPlayerState = aState;
+            // Start the time if needed, otherwise, update content if visible
+            iPlayerEventsObserver->PlaybackStatusChanged(MPlayerEventsObserver::EPlaying);
+            break;
+        case EPbStatePaused:
+            {
+            iPlayerState = aState;
+            // Start the time if needed, otherwise, update content if visible
+            iPlayerEventsObserver->PlaybackStatusChanged(MPlayerEventsObserver::EPaused);
+            break;
+            }
+        case EPbStateSeekingForward:
+            {
+            iPlayerEventsObserver->PlaybackStatusChanged(MPlayerEventsObserver::EFwdSeek);
+            break;
+            }
+        case EPbStateSeekingBackward:
+            {
+            iPlayerEventsObserver->PlaybackStatusChanged(MPlayerEventsObserver::ERevSeek);
+            break;
+            }
+        default:
+            {
+            // do nothing
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::HandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    TRAP_IGNORE( DoHandlePropertyL( aProperty, aValue, aError ) );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle sub player names.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    MPX_FUNC( "CMPXMediaKeyHandlerImp::HandleSubPlayerNamesL" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aMedia.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::HandleMediaL(
+    const CMPXMedia& aMedia, TInt aError )
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::HandleMediaL" );
+    TRAP_IGNORE( DoHandleMediaL( aMedia, aError ) );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionPlaylistObserver
+// Handle collection playlist change.
+// Notes: aError values:
+// KErrNotFound - Playlist is updated, current item removed
+// KErrNone - Playlist is updated, current item is valid
+// KErrEof - Playlist is updated, current item removed and reached to the end of playlist
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::HandleCollectionPlaylistChange(TInt aError)
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::HandleCollectionPlaylistChange" );
+
+    if( aError )
+        {
+            // Update the media item.
+        MMPXSource* s = iPlaybackUtility->Source();
+        if ( s )
+            {
+            RArray<TMPXAttribute> attrs;
+                // Failing the next operations here is not fatal.
+            (void) attrs.Append( KMPXMediaGeneralTitle );
+            (void) attrs.Append( KMPXMediaGeneralDuration );
+            (void) attrs.Append( KMPXMediaGeneralId );
+            (void) attrs.Append( KMPXMediaMusicArtist );
+            (void) attrs.Append( KMPXMediaMusicAlbum );
+            (void) attrs.Append( KMPXMediaMusicGenre );
+                // Ignore the leave. If this occurs, we just don't get 
+                // an updated media information for time being.
+            TRAP_IGNORE(s->MediaL( attrs.Array(), *this, NULL ));
+            attrs.Close();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MPlayerApplicationSettingsNotify
+// This is called when the controller has changed a setting
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::MpasnSetPlayerApplicationValueL(
+    const RArray<TInt>& aAttributeID, const RArray<TInt>& aAttributeValue )
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::MpasnSetPlayerApplicationValueL" );
+
+    for( TInt i = 0; i < aAttributeID.Count(); i++ )
+        {
+        switch( aAttributeID[ i ] )
+            {
+            case KAvrcpEqualizerMode:
+                {
+                TInt equalizer = aAttributeValue[ i ] == KAvrcpOff ? KEqualizerPresetNone : iLastEqPresetId;
+                iEqPresetListener->ChangePresetL(equalizer);
+//                iLastEqPresetId = equalizer;
+                break;
+                }
+            case KAvrcpRepeatMode:
+                {
+                    // TMPlayerRepeatMode values are in the same order 
+                    // as AVRCP 1.3, but starting at 0 instead of 1.
+                TInt repeat = aAttributeValue[ i ] - 1;
+                iPlaybackUtility->SetL(EPbPropertyRepeatMode, repeat);
+                break;
+                }
+            case KAvrcpShuffleMode:
+                {
+                TBool random = aAttributeValue[ i ] == KAvrcpOff ? EFalse : ETrue;
+                iPlaybackUtility->SetL(EPbPropertyRandomMode, random);
+                break;
+                }
+            case KAvrcpBassBoostMode:
+                {
+                TBool boost = aAttributeValue[ i ] == KAvrcpOff ? EFalse : ETrue;
+//                iSettingModel->SetBassBoostL( boost );
+                break;
+                }
+            case KAvrcpStereoWideningMode:
+                {
+                TBool widening = aAttributeValue[ i ] == KAvrcpOff ? EFalse : ETrue;
+//                iSettingModel->SetStereoWideningL( widening );
+                break;
+                }
+            default:
+                {
+                // Leaving results in sending an error back to the controller.
+                User::Leave( KErrNotSupported );
+                break;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From MRemConMediaInformationTargetObserver
+// For each element in aAttributeList the client should respond by calling 
+// CRemConMediaInformationTarget::AttributeValue(). After all attributes have 
+// been supplied the client should call CRemConMediaInformationTarget::Completed().
+// @param aAttributeList A list of TAttributeID requested by the controller
+// -----------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::MrcmitoGetCurrentlyPlayingMetadata( 
+    TMediaAttributeIter& aAttributeIter )
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::MrcmitoGetCurrentlyPlayingMetadata" );
+    const TInt KMaxMediaAttrLen = 50;   // Replace with suitable value
+    TBuf8<KMaxMediaAttrLen> attrBuf;
+    TMediaAttributeId attrId;
+    aAttributeIter.Start();
+    while( aAttributeIter.Next( attrId ) )
+        {
+        TInt err = KErrNotFound;
+        HBufC* detail = NULL;
+        TInt64 val = 0;
+        switch( attrId )
+            {
+            case ETitleOfMedia:
+                {
+                detail = iTrackTitle;
+                break;
+                }
+            case ENameOfArtist:
+                {
+                detail = iArtist;
+                break;
+                }
+            case ENameOfAlbum:
+                {
+                detail = iAlbum;
+                break;
+                }
+            case ETrackNumber:
+                {
+                val = iTrackNumber;
+                break;
+                }
+            case ENumberOfTracks:
+                {
+                MMPXSource* s = iPlaybackUtility->Source();
+                if ( s )
+                    {
+                    CMPXCollectionPlaylist* pl = NULL;
+                    TRAP(err, pl = s->PlaylistL());
+                    if( !err && pl )
+                        {
+                        val = pl->Count(); // What if PlaylistItemCount is zero?
+                        }
+                    delete pl;
+                    }
+                break;
+                }
+            case EGenre:
+                {
+                detail = iGenre;
+                break;
+                }
+            case EPlayingTime:
+                {
+                // No need to check for boundaries, assuming the file length < 10^15 seconds
+                val = iPlayingTime; // If playing time does not exist, what then?
+                break;
+                }
+            default:
+                break;
+            }
+        if( val )
+            {
+            // 'val' and 'detail' are mutually exclusive. We still set detail to 
+            // null, to avoid the possiblility that "delete detail" will delete 
+            // a member variable if NewL fails.
+            detail = NULL;
+            TRAP_IGNORE( detail = HBufC::NewL( KMaxMediaAttrLen ) );
+            if( detail )
+                {
+                detail->Des().NumUC( val );
+                }
+            }
+        if( detail )
+            {
+            if( CnvUtfConverter::ConvertFromUnicodeToUtf8( attrBuf, *detail ) )
+                {
+                attrBuf.Zero();     // Check if this generates the right response
+                }
+            }
+        if( val )
+            {
+            delete detail;
+            detail = NULL;
+            }
+        iMediaInfoTarget->AttributeValue( attrId, attrBuf );
+        }
+    iMediaInfoTarget->Completed();
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// From class MRemConGroupNavigationTargetObserver.
+// A 'Next Group' command has been received.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::MrcgntoNextGroup(TRemConCoreApiButtonAction aButtonAct)
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::MrcgntoNextGroup" );
+    (void) aButtonAct;
+    // Not supported yet, return an error.
+    TRequestStatus* status = NULL;
+    iGroupNavigationTarget->NextGroupResponse( status, KErrAvrcpMetadataInvalidParameter );
+    }
+
+// ---------------------------------------------------------------------------
+// From class MRemConGroupNavigationTargetObserver.
+// A 'Previous Group' command has been received.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::MrcgntoPreviousGroup(TRemConCoreApiButtonAction aButtonAct)
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::MrcgntoPreviousGroup" );
+    (void) aButtonAct;
+    // Not supported yet, return an error.
+    TRequestStatus* status = NULL;
+    iGroupNavigationTarget->PreviousGroupResponse( status, KErrAvrcpMetadataInvalidParameter );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From class MEqualizerPresetChangeListenerObserver
+// Callback for receiving changes in the equalizer preset settings.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetaDataHandlerImp::EqualizerPresetChangedL(TInt aNewPreset)
+    {
+    MPX_FUNC( "CMPXMetaDataHandlerImp::EqualizerPresetChanged" );
+    TInt val = KAvrcpOff;
+    if( aNewPreset != KEqualizerPresetNone)
+      {
+      iLastEqPresetId = aNewPreset; // Store last used preset
+      val = KAvrcpOn;
+      }
+    iPlayerApplicationSettingsObserver->SetAttributeL( KAvrcpEqualizerMode, val );
+    }
+
+
+// ---------------------------------------------------------------------------
+// C++ default constructor
+// ---------------------------------------------------------------------------
+//
+CEqualizerPresetChangeListener::CEqualizerPresetChangeListener(MEqualizerPresetChangeListenerObserver& aObserver)
+:   CActive(EPriorityStandard), 
+    iObserver(aObserver)
+    {
+    MPX_FUNC( "CEqualizerPresetChangeListener::CEqualizerPresetChangeListener" );
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CEqualizerPresetChangeListener::ConstructL()
+    {
+    MPX_FUNC( "CEqualizerPresetChangeListener::ConstructL" );
+    CActiveScheduler::Add( this );
+    iRepository = CRepository::NewL(KCRUidMusicPlayerSettings);
+    }
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+CEqualizerPresetChangeListener* CEqualizerPresetChangeListener::NewL(MEqualizerPresetChangeListenerObserver& aObserver)
+    {
+    MPX_FUNC( "CEqualizerPresetChangeListener::NewL" );
+    CEqualizerPresetChangeListener* self = new(ELeave)CEqualizerPresetChangeListener( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CEqualizerPresetChangeListener::~CEqualizerPresetChangeListener()
+    {
+    MPX_FUNC( "CEqualizerPresetChangeListener::~CEqualizerPresetChangeListener" );
+    Stop();
+    delete iRepository;
+    }
+
+// ---------------------------------------------------------------------------
+// Get the current equalizer preset ID
+// ---------------------------------------------------------------------------
+//
+TInt CEqualizerPresetChangeListener::GetCurrentPresetL()
+    {
+    MPX_FUNC( "CEqualizerPresetChangeListener::GetCurrentPresetL" );
+    TInt preset;
+    User::LeaveIfError(iRepository->Get(KMPlayerEqPresetId, preset));
+    return preset;
+    }
+
+// ---------------------------------------------------------------------------
+// Set the equalizer preset
+// ---------------------------------------------------------------------------
+//
+void CEqualizerPresetChangeListener::ChangePresetL(TInt aNewPreset)
+    {
+    MPX_FUNC( "CEqualizerPresetChangeListener::ChangePresetL" );
+    User::LeaveIfError(iRepository->Set(KMPlayerEqPresetId, aNewPreset));
+    }
+
+// ---------------------------------------------------------------------------
+// Start listening to equalizer preset changes
+// ---------------------------------------------------------------------------
+//
+void CEqualizerPresetChangeListener::StartL()
+    {
+    MPX_FUNC( "CEqualizerPresetChangeListener::StartL" );
+    User::LeaveIfError(iRepository->NotifyRequest(KMPlayerEqPresetId, iStatus));
+    SetActive();
+    }
+
+// ---------------------------------------------------------------------------
+// Stop listening to equalizer preset changes
+// ---------------------------------------------------------------------------
+//
+void CEqualizerPresetChangeListener::Stop()
+    {
+    MPX_FUNC( "CEqualizerPresetChangeListener::Stop" );
+    Cancel();
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// Called by the active scheduler when the request has been completed.
+// ---------------------------------------------------------------------------
+//
+void CEqualizerPresetChangeListener::RunL()
+    {
+    MPX_FUNC( "CEqualizerPresetChangeListener::RunL" );
+    iObserver.EqualizerPresetChangedL(GetCurrentPresetL());
+    StartL();
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// Called by the active scheduler when the request has been cancelled.
+// ---------------------------------------------------------------------------
+//
+void CEqualizerPresetChangeListener::DoCancel()
+    {
+    MPX_FUNC( "CEqualizerPresetChangeListener::DoCancel" );
+    iRepository->NotifyCancel(KMPlayerEqPresetId);
+    delete iRepository;
+    iRepository = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// From class CActive.
+// Called by the active scheduler when an error in RunL has occurred.
+// ---------------------------------------------------------------------------
+//
+TInt CEqualizerPresetChangeListener::RunError( TInt aError )
+    {
+    MPX_FUNC( "CEqualizerPresetChangeListener::RunError" );
+    (void) aError;
+    // In case of an exception in RunL, re-subscribe to Central Repository, 
+    // and ignore the return value. If it fails we just won't be sending 
+    // equalizer updates anymore.
+    if( !iRepository->NotifyRequest( KMPlayerEqPresetId, iStatus ) )
+        {
+        SetActive();
+        }
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/rom/mpxmusicplayer.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project MPX Music Player.
+*
+*/
+
+
+#ifndef MPXMUSICPLAYER_IBY
+#define MPXMUSICPLAYER_IBY
+
+// Include stub sis file in ROM
+data=\epoc32\data\z\system\install\mpxmusicplayerstub.sis   system\install\mpxmusicplayerstub.sis
+
+// Backup & restore
+data=ZPRIVATE\102072c3\backup_registration.xml      private\102072c3\backup_registration.xml
+
+#endif  // MPXMUSICPLAYER_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/rom/mpxmusicplayerrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project MPX Music Player.
+*
+*/
+
+
+#ifndef MPXMUSICPLAYERRSC_IBY
+#define MPXMUSICPLAYERRSC_IBY
+
+#include "../../inc/musicplayerbldvariant.hrh"
+
+// Localizable resource files
+
+#include "mpxcommonuirsc.iby"
+#include "mpxmediakeyhandlerrsc.iby"
+#include "mpxmusicplayerapprsc.iby"
+
+// Collection plugins
+#include "mpxsqlitedbpluginrsc.iby"
+#include "mpxsqlitepodcastdbpluginrsc.iby"
+
+// Screen saver plugins
+#include "mpxscreensaverpluginrsc.iby"
+
+// Views
+#include "mpxembeddedplaybackviewrsc.iby"
+#include "mpxcommonplaybackviewrsc.iby"
+#include "mpxcommoncontainerrsc.iby"
+#include "mpxcollectionviewrsc.iby"
+#include "mpxaudioeffectsviewrsc.iby"
+#include "mpxaddtracksdialogrsc.iby"
+#include "mpxwaitnotedialogrsc.iby"
+#include "mpxplaybackviewrsc.iby"
+#include "mpxpdplaybackviewrsc.iby"
+#include "mpxmetadataeditordialogrsc.iby"
+#include "mpxmainviewrsc.iby"
+#include "mpxalbumarteditordialogrsc.iby"
+#include "mpxpodcastviewrsc.iby"
+#include "mpxpodcastplaybackviewrsc.iby"
+
+#ifdef IAD_INCLUDE_UPNP
+#include "mpxupnpplaybackviewrsc.iby"
+#include "mpxupnpbrowsedialogrsc.iby"
+#include "mpxupnpplaybackdialogrsc.iby"
+#endif	 // IAD_INCLUDE_UPNP
+
+#endif  // MPXMUSICPLAYERRSC_IBY
Binary file mpxmusicplayer/sis/101ffcd0.cre has changed
Binary file mpxmusicplayer/sis/101ffcd1.cre has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/sis/101ffcdc.cre	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+7      ? …iw?   ÜüÃr               "ÿÿÿÿÿÿÿ"ÿÿÿÿÿÿ           "ÿÿÿÿÿÿÿ" ÿÿÿÿÿÿÿ           "ÿÿÿÿÿÿÿ" ÿÿÿÿÿÿÿ           "ÿÿÿÿÿÿÿ" ÿÿÿÿÿÿÿ           "ÿÿÿÿÿÿÿ"ÿÿÿÿÿÿ           "ÿÿÿÿÿÿÿ" ÿÿÿÿÿÿÿ           "ÿÿÿÿÿÿÿ" ÿÿÿÿÿÿÿ           "ÿÿÿÿÿÿÿ" ÿÿÿÿÿÿÿ	           "ÿÿÿÿÿÿÿ" ÿÿÿÿÿÿÿ
+           "ÿÿÿÿÿÿÿ" ÿÿÿÿÿÿÿ           "ÿÿÿÿÿÿÿ"ÿÿÿÿÿÿ           "ÿÿÿÿÿÿÿ"ÿÿÿÿÿÿ    "ÿÿÿÿÿÿÿ" ÿÿÿÿÿÿÿ                          ÿÿÿÿ                   ûQ                               ¢V o d a f o n e   M u s i c   S t o r e          Y       rV o d a f o n e   M u s i c 	           
+       Òh t t p : / / 1 0 . 4 8 . 2 . 5 1 / l a n . h t m l                           
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/sis/build-sisx.bat	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,18 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:  Delete old sis file, creating new sis package and sign it.
+rem
+
+makesis -v mpxmusicplayer.pkg
+signsis mpxmusicplayer.sis mpxmusicplayer_0x101FFC62_v15.0.0911_SA_S60.50_Eng.sis Nokia_RnDCert_02.der Nokia_RnDCert_02.key
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/sis/hgmpxcollectionview.pkg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,94 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Package file for Huriganes music player
+;
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"HgMPXCollectionView"},(0x101FFC62),13,2,0906,TYPE=SA, RU
+
+%{"Nokia"}
+:"Nokia"
+
+; VIEWS
+;common container
+"\epoc32\release\armv5\udeb\mpxcommoncontainer.dll"     -"c:\sys\bin\mpxcommoncontainer.dll"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.rsc"   -"c:\resource\apps\mpxcommoncontainer.rsc"
+;collection
+"\epoc32\release\armv5\udeb\mpxcollectionview.dll"      -"c:\sys\bin\mpxcollectionview.dll"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.mif"    -"c:\resource\apps\mpxcollectionview.mif"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.rsc"    -"c:\resource\apps\mpxcollectionview.rsc"
+;podcast
+"\epoc32\release\armv5\udeb\mpxpodcastcollectionview.dll"      -"c:\sys\bin\mpxpodcastcollectionview.dll"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.mif"    -"c:\resource\apps\mpxpodcastcollectionview.mif"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.rsc"    -"c:\resource\apps\mpxpodcastcollectionview.rsc"
+;albumeditdialog  TNM integration
+"\epoc32\release\armv5\UDEB\mpxalbumarteditordialog.dll"    -"c:\sys\bin\mpxalbumarteditordialog.dll"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.rsc"  -"c:\resource\apps\mpxalbumarteditordialog.rsc"
+
+"\epoc32\release\armv5\UDEB\mpxcollectionviewplugin.dll"        -"c:\sys\bin\mpxcollectionviewplugin.dll"
+"\epoc32\data\Z\resource\plugins\mpxcollectionviewplugin.rsc"   -"c:\resource\plugins\mpxcollectionviewplugin.rsc"
+
+
+;Service Plugins: DB changes
+;mpxsqlitedbcommon
+"\epoc32\release\armv5\udeb\mpxsqlitedbcommon.dll"           -"c:\sys\bin\mpxsqlitedbcommon.dll"
+;mpxsqlitedbplugin
+"\epoc32\release\armv5\udeb\mpxsqlitedbplugin.dll"          -"c:\sys\bin\mpxsqlitedbplugin.dll"
+"\epoc32\data\Z\resource\plugins\mpxsqlitedbplugin.rsc"     -"c:\resource\plugins\mpxsqlitedbplugin.rsc"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.rsc"       -"c:\resource\apps\mpxcollectiondbres.rsc"
+"\epoc32\data\Z\resource\apps\pcres.rsc"                        -"c:\resource\apps\pcres.rsc"
+;podcast db plugin
+"\epoc32\release\armv5\udeb\mpxsqlitepodcastdbplugin.dll"    -"c:\sys\bin\mpxsqlitepodcastdbplugin.dll"
+"\epoc32\data\Z\resource\plugins\mpxsqlitepodcastdbplugin.rsc"  -"c:\resource\plugins\mpxsqlitepodcastdbplugin.rsc"
+
+;mpx frameworks: 
+; From Common Framework
+"\epoc32\release\armv5\UREL\mpxcommon.dll"                      -"c:\sys\bin\mpxcommon.dll"
+
+; From Collection Framework
+"\epoc32\release\armv5\UREL\mpxcollectionutility.dll"           -"c:\sys\bin\mpxcollectionutility.dll"
+"\epoc32\release\armv5\UREL\mpxcollectionserver.exe"            -"c:\sys\bin\mpxcollectionserver.exe"
+"\epoc32\release\armv5\UREL\mpxcollectionengine.dll"            -"c:\sys\bin\mpxcollectionengine.dll"
+
+; From Playback Framework
+"\epoc32\release\armv5\UREL\mpxplaybackengine.dll"              -"c:\sys\bin\mpxplaybackengine.dll"
+"\epoc32\release\armv5\UREL\mpxplaybackserver.exe"              -"c:\sys\bin\mpxplaybackserver.exe"
+"\epoc32\release\armv5\UREL\mpxplaybackutility.dll"             -"c:\sys\bin\mpxplaybackutility.dll"
+
+; From Harvester
+"\epoc32\release\armv5\UREL\mpxharvesterserver.exe"             -"c:\sys\bin\mpxharvesterserver.exe"
+"\epoc32\release\armv5\UREL\mpxfilehandler.dll"                 -"c:\sys\bin\mpxfilehandler.dll"
+"\epoc32\release\armv5\UREL\mpxharvesterutility.dll"            -"c:\sys\bin\mpxharvesterutility.dll"
+"\epoc32\release\armv5\UREL\mpxcollectionmediator.dll"          -"c:\sys\bin\mpxcollectionmediator.dll"
+"\epoc32\release\armv5\UREL\mpxmetadataextractor.dll"           -"c:\sys\bin\mpxmetadataextractor.dll"
+"\epoc32\data\Z\resource\apps\mpxmediator.rsc"                  -"c:\resource\apps\mpxmediator.rsc"
+
+; From Playlist Engine
+"\epoc32\release\armv5\UREL\mpxplaylistengine.dll"              -"c:\sys\bin\mpxplaylistengine.dll"
+"\epoc32\release\armv5\UREL\mpxplaylistrecognizer.dll"          -"c:\sys\bin\mpxplaylistrecognizer.dll"
+"\epoc32\data\Z\resource\plugins\mpxplaylistrecognizer.rsc"     -"c:\resource\plugins\mpxplaylistrecognizer.rsc"
+"\epoc32\data\Z\resource\mpxplaylisttopcharacterset.rsc"        -"c:\resource\mpxplaylisttopcharacterset.rsc"
+
+; From View Framework
+"\epoc32\release\armv5\UREL\mpxviewutility.dll"                 -"c:\sys\bin\mpxviewutility.dll"
+"\epoc32\release\armv5\UREL\mpxviewplugin.dll"                  -"c:\sys\bin\mpxviewplugin.dll"
+
+; Other pieces
+"\epoc32\release\armv5\UREL\mpxalbumartutility.dll"             -"c:\sys\bin\mpxalbumartutility.dll"
+"\epoc32\release\armv5\UREL\mpxcollectionhelper.dll"            -"c:\sys\bin\mpxcollectionhelper.dll"
+
+; Add missing dll files
+"\epoc32\release\armv5\UREL\MPSettEngine.dll"             -"!:\sys\bin\MPSettEngine.dll"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/sis/mpxmusicplayer.pkg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2322 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Package file for MPX music player
+;
+
+
+;Languages
+&EN, FR, GE, SP, IT, SW, DA, NO, FI, AM, PO, TU, IC, RU, HU, DU, CS, SK, PL, SL, TC, HK, ZH, JA, TH, AR, TL, BG, CA, 
+HR, ET, FA, CF, EL, HE, IN, LV, LT, MS, BP, RO, SR, LS, UK, UR, VI, BA, GL, 129, 157, 158, 159, 160, 161, 326, 327
+
+
+;Header
+#{"MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", 
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", 
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", 
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", 
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", 
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", 
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", 
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer",
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer",
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer",
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer",
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer",
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer",
+  "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer", "MPXMusicPlayer"
+  }, (0x101FFC62), 15, 0, 0911, TYPE=SA, RU
+; dlls version uses 13.2
+
+
+; Localised vendor names
+%{"Nokia", "Nokia", "Nokia", "Nokia", 
+  "Nokia", "Nokia", "Nokia", "Nokia", 
+  "Nokia", "Nokia", "Nokia", "Nokia", 
+  "Nokia", "Nokia", "Nokia", "Nokia", 
+  "Nokia", "Nokia", "Nokia", "Nokia", 
+  "Nokia", "Nokia", "Nokia", "Nokia", 
+  "Nokia", "Nokia", "Nokia", "Nokia", 
+  "Nokia", "Nokia", "Nokia", "Nokia",
+  "Nokia", "Nokia", "Nokia", "Nokia",
+  "Nokia", "Nokia", "Nokia", "Nokia",
+  "Nokia", "Nokia", "Nokia", "Nokia",
+  "Nokia", "Nokia", "Nokia", "Nokia",
+  "Nokia", "Nokia", "Nokia", "Nokia",
+  "Nokia", "Nokia", "Nokia", "Nokia"
+  }
+
+; Unique, global vendor name  
+:"Nokia"
+
+;Files to install
+
+"\epoc32\release\armv5\urel\mpxcommonui.dll"                	-"!:\sys\bin\mpxcommonui.dll"
+"\epoc32\release\armv5\urel\mpxmediakeyhandler.dll"         	-"!:\sys\bin\mpxmediakeyhandler.dll"
+"\epoc32\release\armv5\urel\mpxsqlitedbcommon.dll"           	-"!:\sys\bin\mpxsqlitedbcommon.dll"
+"\epoc32\release\armv5\urel\mpxsqlitedbplugin.dll"          	-"!:\sys\bin\mpxsqlitedbplugin.dll"
+"\epoc32\release\armv5\urel\mpxsqlitepodcastdbplugin.dll"   	-"!:\sys\bin\mpxsqlitepodcastdbplugin.dll"
+"\epoc32\release\armv5\urel\mpxinmemoryplugin.dll"          	-"!:\sys\bin\mpxinmemoryplugin.dll"
+"\epoc32\release\armv5\urel\mpxlocalaudioplayback.dll"      	-"!:\sys\bin\mpxlocalaudioplayback.dll"
+"\epoc32\release\armv5\urel\mpxaudioeffectengine.dll"       	-"!:\sys\bin\mpxaudioeffectengine.dll"
+"\epoc32\release\armv5\urel\mpxm3uplaylistparsers.dll"      	-"!:\sys\bin\mpxm3uplaylistparsers.dll"
+"\epoc32\release\armv5\urel\mpxm3uplaylistplugin.dll"       	-"!:\sys\bin\mpxm3uplaylistplugin.dll"
+"\epoc32\release\armv5\urel\mpxscreensaverplugin.dll"       	-"!:\sys\bin\mpxscreensaverplugin.dll"
+"\epoc32\release\armv5\urel\mpxvisualizationplugins.dll"        -"!:\sys\bin\mpxvisualizationplugins.dll"
+"\epoc32\release\armv5\urel\mpxmainviewplugin.dll"          	-"!:\sys\bin\mpxmainviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxplaybackviewplugin.dll"      	-"!:\sys\bin\mpxplaybackviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxpodcastplaybackviewplugin.dll"   -"!:\sys\bin\mpxpodcastplaybackviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxembeddedplaybackviewplugin.dll"  -"!:\sys\bin\mpxembeddedplaybackviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxpdplaybackviewplugin.dll"        -"!:\sys\bin\mpxpdplaybackviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxcollectionviewplugin.dll"        -"!:\sys\bin\mpxcollectionviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxequalizerviewplugin.dll"         -"!:\sys\bin\mpxequalizerviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxaudioeffectsviewplugin.dll"      -"!:\sys\bin\mpxaudioeffectsviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxwaitnotedialogplugin.dll"        -"!:\sys\bin\mpxwaitnotedialogplugin.dll"
+"\epoc32\release\armv5\urel\mpxmetadataeditordialogplugin.dll" 	-"!:\sys\bin\mpxmetadataeditordialogplugin.dll"
+"\epoc32\release\armv5\urel\mpxalbumarteditordialogplugin.dll" 	-"!:\sys\bin\mpxalbumarteditordialogplugin.dll"
+"\epoc32\release\armv5\urel\mpxaddtracksdialogplugin.dll"      	-"!:\sys\bin\mpxaddtracksdialogplugin.dll"
+"\epoc32\release\armv5\urel\mpxvisualizationviewplugin.dll"     -"!:\sys\bin\mpxvisualizationviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxvisualizationmenudialogplugin.dll"	-"!:\sys\bin\mpxvisualizationmenudialogplugin.dll"
+
+"\epoc32\release\armv5\urel\mpxupnpplaybackviewplugin.dll"      -"!:\sys\bin\mpxupnpplaybackviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxupnpbrowsedialogplugin.dll"      -"!:\sys\bin\mpxupnpbrowsedialogplugin.dll"
+"\epoc32\release\armv5\urel\mpxupnpplaybackdialogplugin.dll"    -"!:\sys\bin\mpxupnpplaybackdialogplugin.dll"
+"\epoc32\release\armv5\urel\mpxupnpbrowsedialog.dll"   		-"!:\sys\bin\mpxupnpbrowsedialog.dll"
+"\epoc32\release\armv5\urel\mpxupnpplaybackview.dll"   		-"!:\sys\bin\mpxupnpplaybackview.dll"
+"\epoc32\release\armv5\urel\mpxupnpplaybackdialog.dll"   	-"!:\sys\bin\mpxupnpplaybackdialog.dll"
+"\epoc32\release\armv5\urel\mpxplaybackview.dll"        	-"!:\sys\bin\mpxplaybackview.dll"
+"\epoc32\release\armv5\urel\mpxpodcastplaybackview.dll"        	-"!:\sys\bin\mpxpodcastplaybackview.dll"
+"\epoc32\release\armv5\urel\mpxaddtracksdialog.dll"     	-"!:\sys\bin\mpxaddtracksdialog.dll"
+"\epoc32\release\armv5\urel\mpxalbumarteditordialog.dll"    	-"!:\sys\bin\mpxalbumarteditordialog.dll"
+"\epoc32\release\armv5\urel\mpxaudioeffectsview.dll"    	-"!:\sys\bin\mpxaudioeffectsview.dll"
+"\epoc32\release\armv5\urel\mpxcollectionview.dll"      	-"!:\sys\bin\mpxcollectionview.dll"
+"\epoc32\release\armv5\urel\mpxcommoncontainer.dll"     	-"!:\sys\bin\mpxcommoncontainer.dll"
+"\epoc32\release\armv5\urel\mpxcommonplaybackview.dll"      	-"!:\sys\bin\mpxcommonplaybackview.dll"
+"\epoc32\release\armv5\urel\mpxembeddedplaybackview.dll"    	-"!:\sys\bin\mpxembeddedplaybackview.dll"
+"\epoc32\release\armv5\urel\mpxequalizerview.dll"       	-"!:\sys\bin\mpxequalizerview.dll"
+"\epoc32\release\armv5\urel\mpxmainview.dll"        		-"!:\sys\bin\mpxmainview.dll"
+"\epoc32\release\armv5\urel\mpxmetadataeditordialog.dll"    	-"!:\sys\bin\mpxmetadataeditordialog.dll"
+"\epoc32\release\armv5\urel\mpxpdplaybackview.dll"      	-"!:\sys\bin\mpxpdplaybackview.dll"
+"\epoc32\release\armv5\urel\mpxwaitnotedialog.dll"      	-"!:\sys\bin\mpxwaitnotedialog.dll"
+"\epoc32\release\armv5\urel\mpxvisualizationmenudialog.dll"     -"!:\sys\bin\mpxvisualizationmenudialog.dll"
+"\epoc32\release\armv5\urel\mpxvisualizationview.dll"           -"!:\sys\bin\mpxvisualizationview.dll"
+"\epoc32\release\armv5\urel\aiplayerplugin2.dll"                -"!:\sys\bin\aiplayerplugin2.dll"
+"\epoc32\release\armv5\urel\mpx.exe"                        	-"!:\sys\bin\mpx.exe"
+"\epoc32\release\armv5\urel\MusicVisualizationPlugin.dll" 	-"!:\sys\bin\MusicVisualizationPlugin.dll"
+
+; Need these when we enable camese ui
+;"\epoc32\release\armv5\urel\camesebrowserview.dll"             -"!:\sys\bin\camesebrowserview.dll"
+;"\epoc32\release\armv5\urel\camesebrowserviewplugin.dll"       -"!:\sys\bin\camesebrowserviewplugin.dll"
+;"\epoc32\release\armv5\urel\cameseuicommon.dll"                -"!:\sys\bin\cameseuicommon.dll"
+;"\epoc32\release\armv5\urel\camesedrmhandler.dll"              -"!:\sys\bin\camesedrmhandler.dll"
+
+"\epoc32\release\armv5\urel\mcpmusicplayer.dll"                	-"!:\sys\bin\mcpmusicplayer.dll"
+"\epoc32\release\armv5\urel\mpxcollectionpublisher.dll"        	-"!:\sys\bin\mpxcollectionpublisher.dll"
+"\epoc32\release\armv5\urel\musiccontentpublisher.dll"         	-"!:\sys\bin\musiccontentpublisher.dll"
+"\epoc32\release\armv5\urel\musicplayeractionhandlerplugin.dll" -"!:\sys\bin\musicplayeractionhandlerplugin.dll"
+"\epoc32\release\armv5\urel\dummyMusic.dll"                	-"!:\sys\bin\dummyMusic.dll"
+"\epoc32\release\armv5\urel\mpxprogressdownload.dll"       	-"!:\sys\bin\mpxprogressdownload.dll"
+"\epoc32\release\armv5\urel\mpxprogressdownloadsb.dll" 		-"!:\sys\bin\mpxprogressdownloadsb.dll"
+"\epoc32\release\armv5\urel\mpxpdsbplaybackviewplugin.dll"	-"!:\sys\bin\mpxpdsbplaybackviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxpdsbplaybackview.dll"            -"!:\sys\bin\mpxpdsbplaybackview.dll"
+"\epoc32\release\armv5\urel\mpxpodcastcollectionview.dll"       -"!:\sys\bin\mpxpodcastcollectionview.dll"
+"\epoc32\release\armv5\urel\mpxpodcastcollectionviewplugin.dll" -"!:\sys\bin\mpxpodcastcollectionviewplugin.dll"
+"\epoc32\release\armv5\urel\mpxmetadatahandler.dll"             -"!:\sys\bin\mpxmetadatahandler.dll"
+
+"\epoc32\data\Z\private\102072C3\background_256x256.jpg"        -"!:\private\102072C3\background_256x256.jpg"
+"\epoc32\data\Z\private\102072C3\background_large.jpg"          -"!:\private\102072C3\background_large.jpg"
+"\epoc32\data\Z\private\102072C3\background_small.jpg"          -"!:\private\102072C3\background_small.jpg"
+"\epoc32\data\Z\private\102072C3\homer_256.jpg"                 -"!:\private\102072C3\homer_256.jpg"
+"\epoc32\data\Z\private\102072C3\homer_256_mask.jpg"            -"!:\private\102072C3\homer_256_mask.jpg"
+"\epoc32\data\Z\private\102072C3\scope.jpg"                     -"!:\private\102072C3\scope.jpg"
+"\epoc32\data\Z\private\102072C3\test.jpg"                      -"!:\private\102072C3\test.jpg"
+"\epoc32\data\Z\private\102072C3\testmask.jpg"                  -"!:\private\102072C3\testmask.jpg"
+"\epoc32\data\Z\private\102072C3\qgn_graf_mup_vis_bg02.jpg"     -"!:\private\102072C3\qgn_graf_mup_vis_bg02.jpg"
+"\epoc32\data\Z\system\data\nullsound.mp3"          		-"!:\system\data\nullsound.mp3"
+
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.mif"       	-"!:\resource\apps\mpxmediakeyhandler.mif"
+"\epoc32\data\Z\resource\apps\mpxcommonui.mif"              	-"!:\resource\apps\mpxcommonui.mif"
+"\epoc32\data\Z\resource\apps\mpxdbplugin.mif"              	-"!:\resource\apps\mpxdbplugin.mif"
+"\epoc32\data\Z\resource\apps\mpxpodcastdbplugin.mif"           -"!:\resource\apps\mpxpodcastdbplugin.mif"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.mif"     	-"!:\resource\apps\mpxscreensaverplugin.mif"
+"\epoc32\data\Z\resource\apps\mpxvisualizationplugins.mif"      -"!:\resource\apps\mpxvisualizationplugins.mif"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.mif"   	-"!:\resource\apps\mpxaddtracksdialog.mif"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.mif"    	-"!:\resource\apps\mpxcollectionview.mif"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.mif"    	-"!:\resource\apps\mpxcommonplaybackview.mif"
+"\epoc32\data\Z\resource\apps\mpxmainview.mif"      		-"!:\resource\apps\mpxmainview.mif"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.mif"         -"!:\resource\apps\mpxvisualizationview.mif"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.mif"      	-"!:\resource\apps\mpxpodcastplaybackview.mif"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.mif"	-"!:\resource\apps\mpxembeddedplaybackview.mif"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.mif"    	-"!:\resource\apps\mpxupnpplaybackview.mif"
+"\epoc32\data\Z\resource\apps\musichomescreenicons.mif"   	-"!:\resource\apps\musichomescreenicons.mif"
+"\epoc32\data\Z\resource\apps\mpx_aif.mif"                  	-"!:\resource\apps\mpx_aif.mif"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.mif"     -"!:\resource\apps\mpxpodcastcollectionview.mif"
+
+; Music Suite Matrix Menu
+"\epoc32\include\musichomescreen.rsg" -"!:\resource\apps\musichomescreen.rsg"
+"\epoc32\data\z\private\101F4CD2\import\suites\musicsuite\suite.xml" -"!:\private\101F4CD2\import\suites\musicsuite\suite.xml"
+"\epoc32\data\z\private\101F4CD2\import\suites\musicsuite\music_matrix_items.xml" -"!:\private\101F4CD2\import\suites\musicsuite\music_matrix_items.xml" 
+
+; cenrep files
+"101ffcd0.cre"           -"!:\private\10202BE9\101ffcd0.cre"
+"101ffcd1.cre"           -"!:\private\10202BE9\101ffcd1.cre"
+"101ffcdc.cre"           -"!:\private\10202BE9\101ffcdc.cre"
+
+; Interface resources
+"\epoc32\data\Z\resource\plugins\mpxsqlitedbplugin.rsc"     		-"!:\resource\plugins\mpxsqlitedbplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxsqlitepodcastdbplugin.rsc"  	-"!:\resource\plugins\mpxsqlitepodcastdbplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxinmemoryplugin.rsc"     		-"!:\resource\plugins\mpxinmemoryplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxlocalaudioplayback.rsc" 		-"!:\resource\plugins\mpxlocalaudioplayback.rsc"
+"\epoc32\data\Z\resource\plugins\mpxm3uplaylistplugin.rsc"  		-"!:\resource\plugins\mpxm3uplaylistplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxmainviewplugin.rsc"     		-"!:\resource\plugins\mpxmainviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxplaybackviewplugin.rsc" 		-"!:\resource\plugins\mpxplaybackviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxpodcastplaybackviewplugin.rsc" 	-"!:\resource\plugins\mpxpodcastplaybackviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxembeddedplaybackviewplugin.rsc" 	-"!:\resource\plugins\mpxembeddedplaybackviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxpdplaybackviewplugin.rsc"   	-"!:\resource\plugins\mpxpdplaybackviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxcollectionviewplugin.rsc"   	-"!:\resource\plugins\mpxcollectionviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxequalizerviewplugin.rsc"    	-"!:\resource\plugins\mpxequalizerviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxaudioeffectsviewplugin.rsc" 	-"!:\resource\plugins\mpxaudioeffectsviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxwaitnotedialogplugin.rsc"   	-"!:\resource\plugins\mpxwaitnotedialogplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxmetadataeditordialogplugin.rsc" 	-"!:\resource\plugins\mpxmetadataeditordialogplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxalbumarteditordialogplugin.rsc" 	-"!:\resource\plugins\mpxalbumarteditordialogplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxaddtracksdialogplugin.rsc" 		-"!:\resource\plugins\mpxaddtracksdialogplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationviewplugin.rsc"    	-"!:\resource\plugins\mpxvisualizationviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationmenudialogplugin.rsc"  -"!:\resource\plugins\mpxvisualizationmenudialogplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxupnpplaybackviewplugin.rsc" 	-"!:\resource\plugins\mpxupnpplaybackviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxupnpbrowsedialogplugin.rsc" 	-"!:\resource\plugins\mpxupnpbrowsedialogplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxupnpplaybackdialogplugin.rsc" 	-"!:\resource\plugins\mpxupnpplaybackdialogplugin.rsc"
+"\epoc32\data\Z\resource\plugins\aiplayerplugin2.rsc"           	-"!:\resource\plugins\aiplayerplugin2.rsc"
+"\epoc32\data\Z\resource\plugins\musicplayeractionhandlerplugin.rsc"    -"!:\resource\plugins\musicplayeractionhandlerplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxpdsbplaybackviewplugin.rsc"     	-"!:\resource\plugins\mpxpdsbplaybackviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxpodcastcollectionviewplugin.rsc"    -"!:\resource\plugins\mpxpodcastcollectionviewplugin.rsc"
+"\epoc32\data\Z\resource\plugins\mpxprogressdownload.rsc"      		-"!:\resource\plugins\mpxprogressdownload.rsc"
+"\epoc32\data\Z\resource\plugins\mpxprogressdownloadsb.rsc"      	-"!:\resource\plugins\mpxprogressdownloadsb.rsc"
+"\epoc32\data\Z\resource\plugins\mcpmusicplayer.rsc"      		-"!:\resource\apps\mcpmusicplayer.rsc"
+"\epoc32\data\Z\resource\plugins\mpxcollectionpublisher.rsc"      	-"!:\resource\apps\mpxcollectionpublisher.rsc"
+"\epoc32\data\Z\resource\plugins\musiccontentpublisher.rsc"      	-"!:\resource\apps\musiccontentpublisher.rsc"
+"\epoc32\data\Z\resource\plugins\mpxscreensaverplugin.rsc"  		-"!:\resource\plugins\mpxscreensaverplugin.rsc"
+"\epoc32\data\Z\private\10003a3f\apps\mpx_reg.rsc"          		-"!:\private\10003a3f\import\apps\mpx_reg.rsc"
+"\epoc32\data\Z\resource\mplayeravrcpsettings.rsc"      		-"!:\resource\mplayeravrcpsettings.rsc"
+
+
+; Need these when we enable camese ui
+;"\epoc32\data\Z\resource\apps\camesebrowserview.rsc"      	-"!:\resource\apps\camesebrowserview.rsc"
+;"\epoc32\data\Z\resource\apps\cameseuicommon.rsc"      	-"!:\resource\apps\cameseuicommon.rsc"
+;"\epoc32\data\Z\resource\plugins\camesebrowserviewplugin.rsc"	-"!:\resource\plugins\camesebrowserviewplugin.rsc"
+
+
+; Localised string resources
+
+{
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r01"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r02"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r03"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r04"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r05"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r06"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r07"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r08"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r09"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r10"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r13"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r14"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r15"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r16"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r17"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r18"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r25"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r26"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r27"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r28"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r29"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r30"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r31"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r32"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r33"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r37"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r39"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r42"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r44"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r45"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r49"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r50"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r51"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r54"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r57"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r59"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r67"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r68"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r70"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r76"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r78"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r79"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r83"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r93"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r94"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r96"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r102"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r103"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r129"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r157"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r158"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r159"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r160"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r161"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r326"
+"\epoc32\data\Z\resource\apps\mpxplaybackview.r327"
+} - "!:\resource\apps\mpxplaybackview.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r01"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r02"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r03"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r04"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r05"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r06"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r07"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r08"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r09"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r10"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r13"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r14"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r15"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r16"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r17"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r18"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r25"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r26"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r27"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r28"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r29"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r30"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r31"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r32"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r33"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r37"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r39"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r42"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r44"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r45"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r49"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r50"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r51"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r54"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r57"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r59"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r67"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r68"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r70"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r76"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r78"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r79"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r83"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r93"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r94"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r96"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r102"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r103"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r129"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r157"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r158"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r159"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r160"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r161"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r326"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackdialog.r327"
+} - "!:\resource\apps\mpxupnpplaybackdialog.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxcommonui.r01"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r02"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r03"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r04"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r05"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r06"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r07"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r08"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r09"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r10"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r13"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r14"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r15"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r16"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r17"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r18"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r25"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r26"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r27"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r28"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r29"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r30"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r31"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r32"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r33"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r37"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r39"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r42"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r44"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r45"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r49"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r50"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r51"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r54"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r57"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r59"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r67"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r68"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r70"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r76"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r78"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r79"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r83"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r93"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r94"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r96"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r102"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r103"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r129"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r157"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r158"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r159"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r160"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r161"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r326"
+"\epoc32\data\Z\resource\apps\mpxcommonui.r327"
+} - "!:\resource\apps\mpxcommonui.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r01"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r02"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r03"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r04"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r05"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r06"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r07"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r08"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r09"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r10"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r13"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r14"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r15"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r16"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r17"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r18"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r25"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r26"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r27"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r28"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r29"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r30"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r31"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r32"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r33"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r37"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r39"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r42"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r44"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r45"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r49"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r50"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r51"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r54"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r57"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r59"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r67"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r68"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r70"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r76"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r78"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r79"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r83"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r93"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r94"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r96"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r102"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r103"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r129"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r157"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r158"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r159"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r160"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r161"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r326"
+"\epoc32\data\Z\resource\apps\mpxmediakeyhandler.r327"
+} - "!:\resource\apps\mpxmediakeyhandler.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r01"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r02"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r03"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r04"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r05"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r06"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r07"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r08"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r09"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r10"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r13"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r14"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r15"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r16"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r17"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r18"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r25"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r26"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r27"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r28"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r29"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r30"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r31"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r32"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r33"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r37"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r39"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r42"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r44"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r45"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r49"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r50"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r51"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r54"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r57"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r59"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r67"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r68"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r70"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r76"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r78"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r79"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r83"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r93"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r94"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r96"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r102"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r103"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r129"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r157"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r158"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r159"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r160"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r161"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r326"
+"\epoc32\data\Z\resource\apps\mpxcollectiondbres.r327"
+} - "!:\resource\apps\mpxcollectiondbres.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\pcres.r01"
+"\epoc32\data\Z\resource\apps\pcres.r02"
+"\epoc32\data\Z\resource\apps\pcres.r03"
+"\epoc32\data\Z\resource\apps\pcres.r04"
+"\epoc32\data\Z\resource\apps\pcres.r05"
+"\epoc32\data\Z\resource\apps\pcres.r06"
+"\epoc32\data\Z\resource\apps\pcres.r07"
+"\epoc32\data\Z\resource\apps\pcres.r08"
+"\epoc32\data\Z\resource\apps\pcres.r09"
+"\epoc32\data\Z\resource\apps\pcres.r10"
+"\epoc32\data\Z\resource\apps\pcres.r13"
+"\epoc32\data\Z\resource\apps\pcres.r14"
+"\epoc32\data\Z\resource\apps\pcres.r15"
+"\epoc32\data\Z\resource\apps\pcres.r16"
+"\epoc32\data\Z\resource\apps\pcres.r17"
+"\epoc32\data\Z\resource\apps\pcres.r18"
+"\epoc32\data\Z\resource\apps\pcres.r25"
+"\epoc32\data\Z\resource\apps\pcres.r26"
+"\epoc32\data\Z\resource\apps\pcres.r27"
+"\epoc32\data\Z\resource\apps\pcres.r28"
+"\epoc32\data\Z\resource\apps\pcres.r29"
+"\epoc32\data\Z\resource\apps\pcres.r30"
+"\epoc32\data\Z\resource\apps\pcres.r31"
+"\epoc32\data\Z\resource\apps\pcres.r32"
+"\epoc32\data\Z\resource\apps\pcres.r33"
+"\epoc32\data\Z\resource\apps\pcres.r37"
+"\epoc32\data\Z\resource\apps\pcres.r39"
+"\epoc32\data\Z\resource\apps\pcres.r42"
+"\epoc32\data\Z\resource\apps\pcres.r44"
+"\epoc32\data\Z\resource\apps\pcres.r45"
+"\epoc32\data\Z\resource\apps\pcres.r49"
+"\epoc32\data\Z\resource\apps\pcres.r50"
+"\epoc32\data\Z\resource\apps\pcres.r51"
+"\epoc32\data\Z\resource\apps\pcres.r54"
+"\epoc32\data\Z\resource\apps\pcres.r57"
+"\epoc32\data\Z\resource\apps\pcres.r59"
+"\epoc32\data\Z\resource\apps\pcres.r67"
+"\epoc32\data\Z\resource\apps\pcres.r68"
+"\epoc32\data\Z\resource\apps\pcres.r70"
+"\epoc32\data\Z\resource\apps\pcres.r76"
+"\epoc32\data\Z\resource\apps\pcres.r78"
+"\epoc32\data\Z\resource\apps\pcres.r79"
+"\epoc32\data\Z\resource\apps\pcres.r83"
+"\epoc32\data\Z\resource\apps\pcres.r93"
+"\epoc32\data\Z\resource\apps\pcres.r94"
+"\epoc32\data\Z\resource\apps\pcres.r96"
+"\epoc32\data\Z\resource\apps\pcres.r102"
+"\epoc32\data\Z\resource\apps\pcres.r103"
+"\epoc32\data\Z\resource\apps\pcres.r129"
+"\epoc32\data\Z\resource\apps\pcres.r157"
+"\epoc32\data\Z\resource\apps\pcres.r158"
+"\epoc32\data\Z\resource\apps\pcres.r159"
+"\epoc32\data\Z\resource\apps\pcres.r160"
+"\epoc32\data\Z\resource\apps\pcres.r161"
+"\epoc32\data\Z\resource\apps\pcres.r326"
+"\epoc32\data\Z\resource\apps\pcres.r327"
+} - "!:\resource\apps\pcres.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r01"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r02"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r03"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r04"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r05"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r06"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r07"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r08"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r09"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r10"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r13"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r14"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r15"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r16"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r17"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r18"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r25"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r26"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r27"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r28"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r29"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r30"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r31"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r32"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r33"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r37"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r39"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r42"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r44"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r45"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r49"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r50"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r51"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r54"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r57"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r59"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r67"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r68"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r70"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r76"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r78"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r79"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r83"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r93"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r94"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r96"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r102"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r103"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r129"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r157"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r158"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r159"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r160"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r161"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r326"
+"\epoc32\data\Z\resource\apps\mpxscreensaverplugin.r327"
+} - "!:\resource\apps\mpxscreensaverplugin.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r01"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r02"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r03"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r04"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r05"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r06"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r07"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r08"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r09"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r10"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r13"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r14"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r15"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r16"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r17"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r18"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r25"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r26"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r27"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r28"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r29"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r30"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r31"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r32"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r33"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r37"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r39"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r42"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r44"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r45"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r49"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r50"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r51"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r54"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r57"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r59"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r67"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r68"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r70"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r76"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r78"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r79"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r83"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r93"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r94"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r96"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r102"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r103"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r129"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r157"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r158"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r159"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r160"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r161"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r326"
+"\epoc32\data\Z\resource\apps\mpxupnpbrowsedialog.r327"
+} - "!:\resource\apps\mpxupnpbrowsedialog.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r01"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r02"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r03"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r04"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r05"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r06"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r07"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r08"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r09"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r10"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r13"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r14"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r15"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r16"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r17"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r18"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r25"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r26"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r27"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r28"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r29"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r30"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r31"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r32"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r33"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r37"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r39"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r42"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r44"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r45"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r49"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r50"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r51"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r54"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r57"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r59"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r67"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r68"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r70"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r76"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r78"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r79"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r83"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r93"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r94"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r96"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r102"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r103"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r129"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r157"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r158"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r159"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r160"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r161"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r326"
+"\epoc32\data\Z\resource\apps\mpxupnpplaybackview.r327"
+} - "!:\resource\apps\mpxupnpplaybackview.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r01"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r02"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r03"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r04"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r05"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r06"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r07"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r08"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r09"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r10"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r13"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r14"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r15"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r16"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r17"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r18"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r25"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r26"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r27"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r28"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r29"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r30"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r31"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r32"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r33"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r37"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r39"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r42"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r44"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r45"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r49"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r50"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r51"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r54"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r57"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r59"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r67"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r68"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r70"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r76"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r78"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r79"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r83"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r93"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r94"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r96"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r102"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r103"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r129"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r157"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r158"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r159"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r160"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r161"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r326"
+"\epoc32\data\Z\resource\apps\mpxpodcastplaybackview.r327"
+} - "!:\resource\apps\mpxpodcastplaybackview.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r01"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r02"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r03"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r04"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r05"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r06"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r07"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r08"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r09"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r10"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r13"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r14"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r15"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r16"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r17"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r18"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r25"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r26"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r27"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r28"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r29"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r30"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r31"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r32"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r33"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r37"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r39"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r42"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r44"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r45"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r49"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r50"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r51"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r54"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r57"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r59"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r67"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r68"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r70"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r76"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r78"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r79"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r83"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r93"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r94"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r96"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r102"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r103"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r129"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r157"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r158"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r159"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r160"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r161"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r326"
+"\epoc32\data\Z\resource\apps\mpxaddtracksdialog.r327"
+} - "!:\resource\apps\mpxaddtracksdialog.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r01"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r02"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r03"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r04"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r05"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r06"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r07"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r08"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r09"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r10"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r13"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r14"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r15"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r16"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r17"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r18"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r25"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r26"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r27"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r28"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r29"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r30"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r31"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r32"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r33"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r37"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r39"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r42"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r44"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r45"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r49"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r50"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r51"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r54"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r57"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r59"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r67"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r68"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r70"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r76"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r78"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r79"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r83"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r93"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r94"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r96"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r102"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r103"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r129"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r157"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r158"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r159"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r160"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r161"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r326"
+"\epoc32\data\Z\resource\apps\mpxalbumarteditordialog.r327"
+} - "!:\resource\apps\mpxalbumarteditordialog.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r01"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r02"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r03"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r04"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r05"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r06"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r07"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r08"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r09"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r10"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r13"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r14"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r15"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r16"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r17"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r18"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r25"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r26"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r27"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r28"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r29"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r30"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r31"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r32"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r33"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r37"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r39"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r42"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r44"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r45"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r49"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r50"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r51"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r54"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r57"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r59"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r67"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r68"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r70"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r76"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r78"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r79"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r83"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r93"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r94"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r96"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r102"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r103"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r129"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r157"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r158"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r159"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r160"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r161"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r326"
+"\epoc32\data\Z\resource\apps\mpxaudioeffectsview.r327"
+} - "!:\resource\apps\mpxaudioeffectsview.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r01"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r02"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r03"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r04"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r05"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r06"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r07"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r08"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r09"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r10"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r13"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r14"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r15"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r16"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r17"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r18"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r25"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r26"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r27"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r28"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r29"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r30"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r31"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r32"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r33"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r37"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r39"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r42"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r44"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r45"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r49"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r50"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r51"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r54"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r57"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r59"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r67"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r68"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r70"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r76"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r78"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r79"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r83"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r93"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r94"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r96"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r102"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r103"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r129"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r157"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r158"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r159"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r160"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r161"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r326"
+"\epoc32\data\Z\resource\apps\mpxcollectionview.r327"
+} - "!:\resource\apps\mpxcollectionview.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r01"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r02"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r03"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r04"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r05"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r06"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r07"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r08"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r09"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r10"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r13"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r14"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r15"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r16"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r17"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r18"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r25"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r26"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r27"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r28"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r29"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r30"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r31"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r32"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r33"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r37"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r39"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r42"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r44"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r45"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r49"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r50"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r51"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r54"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r57"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r59"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r67"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r68"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r70"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r76"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r78"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r79"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r83"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r93"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r94"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r96"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r102"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r103"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r129"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r157"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r158"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r159"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r160"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r161"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r326"
+"\epoc32\data\Z\resource\apps\mpxcommoncontainer.r327"
+} - "!:\resource\apps\mpxcommoncontainer.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r01"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r02"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r03"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r04"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r05"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r06"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r07"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r08"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r09"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r10"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r13"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r14"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r15"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r16"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r17"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r18"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r25"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r26"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r27"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r28"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r29"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r30"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r31"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r32"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r33"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r37"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r39"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r42"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r44"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r45"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r49"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r50"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r51"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r54"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r57"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r59"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r67"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r68"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r70"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r76"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r78"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r79"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r83"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r93"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r94"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r96"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r102"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r103"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r129"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r157"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r158"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r159"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r160"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r161"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r326"
+"\epoc32\data\Z\resource\apps\mpxcommonplaybackview.r327"
+} - "!:\resource\apps\mpxcommonplaybackview.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxfmtx.r01"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r02"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r03"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r04"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r05"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r06"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r07"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r08"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r09"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r10"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r13"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r14"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r15"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r16"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r17"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r18"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r25"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r26"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r27"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r28"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r29"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r30"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r31"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r32"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r33"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r37"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r39"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r42"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r44"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r45"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r49"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r50"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r51"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r54"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r57"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r59"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r67"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r68"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r70"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r76"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r78"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r79"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r83"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r93"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r94"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r96"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r102"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r103"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r129"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r157"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r158"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r159"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r160"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r161"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r326"
+"\epoc32\data\Z\resource\apps\mpxfmtx.r327"
+} - "!:\resource\apps\mpxfmtx.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r01"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r02"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r03"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r04"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r05"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r06"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r07"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r08"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r09"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r10"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r13"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r14"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r15"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r16"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r17"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r18"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r25"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r26"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r27"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r28"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r29"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r30"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r31"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r32"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r33"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r37"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r39"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r42"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r44"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r45"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r49"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r50"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r51"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r54"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r57"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r59"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r67"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r68"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r70"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r76"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r78"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r79"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r83"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r93"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r94"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r96"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r102"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r103"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r129"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r157"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r158"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r159"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r160"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r161"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r326"
+"\epoc32\data\Z\resource\apps\mpxembeddedplaybackview.r327"
+} - "!:\resource\apps\mpxembeddedplaybackview.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxmainview.r01"
+"\epoc32\data\Z\resource\apps\mpxmainview.r02"
+"\epoc32\data\Z\resource\apps\mpxmainview.r03"
+"\epoc32\data\Z\resource\apps\mpxmainview.r04"
+"\epoc32\data\Z\resource\apps\mpxmainview.r05"
+"\epoc32\data\Z\resource\apps\mpxmainview.r06"
+"\epoc32\data\Z\resource\apps\mpxmainview.r07"
+"\epoc32\data\Z\resource\apps\mpxmainview.r08"
+"\epoc32\data\Z\resource\apps\mpxmainview.r09"
+"\epoc32\data\Z\resource\apps\mpxmainview.r10"
+"\epoc32\data\Z\resource\apps\mpxmainview.r13"
+"\epoc32\data\Z\resource\apps\mpxmainview.r14"
+"\epoc32\data\Z\resource\apps\mpxmainview.r15"
+"\epoc32\data\Z\resource\apps\mpxmainview.r16"
+"\epoc32\data\Z\resource\apps\mpxmainview.r17"
+"\epoc32\data\Z\resource\apps\mpxmainview.r18"
+"\epoc32\data\Z\resource\apps\mpxmainview.r25"
+"\epoc32\data\Z\resource\apps\mpxmainview.r26"
+"\epoc32\data\Z\resource\apps\mpxmainview.r27"
+"\epoc32\data\Z\resource\apps\mpxmainview.r28"
+"\epoc32\data\Z\resource\apps\mpxmainview.r29"
+"\epoc32\data\Z\resource\apps\mpxmainview.r30"
+"\epoc32\data\Z\resource\apps\mpxmainview.r31"
+"\epoc32\data\Z\resource\apps\mpxmainview.r32"
+"\epoc32\data\Z\resource\apps\mpxmainview.r33"
+"\epoc32\data\Z\resource\apps\mpxmainview.r37"
+"\epoc32\data\Z\resource\apps\mpxmainview.r39"
+"\epoc32\data\Z\resource\apps\mpxmainview.r42"
+"\epoc32\data\Z\resource\apps\mpxmainview.r44"
+"\epoc32\data\Z\resource\apps\mpxmainview.r45"
+"\epoc32\data\Z\resource\apps\mpxmainview.r49"
+"\epoc32\data\Z\resource\apps\mpxmainview.r50"
+"\epoc32\data\Z\resource\apps\mpxmainview.r51"
+"\epoc32\data\Z\resource\apps\mpxmainview.r54"
+"\epoc32\data\Z\resource\apps\mpxmainview.r57"
+"\epoc32\data\Z\resource\apps\mpxmainview.r59"
+"\epoc32\data\Z\resource\apps\mpxmainview.r67"
+"\epoc32\data\Z\resource\apps\mpxmainview.r68"
+"\epoc32\data\Z\resource\apps\mpxmainview.r70"
+"\epoc32\data\Z\resource\apps\mpxmainview.r76"
+"\epoc32\data\Z\resource\apps\mpxmainview.r78"
+"\epoc32\data\Z\resource\apps\mpxmainview.r79"
+"\epoc32\data\Z\resource\apps\mpxmainview.r83"
+"\epoc32\data\Z\resource\apps\mpxmainview.r93"
+"\epoc32\data\Z\resource\apps\mpxmainview.r94"
+"\epoc32\data\Z\resource\apps\mpxmainview.r96"
+"\epoc32\data\Z\resource\apps\mpxmainview.r102"
+"\epoc32\data\Z\resource\apps\mpxmainview.r103"
+"\epoc32\data\Z\resource\apps\mpxmainview.r129"
+"\epoc32\data\Z\resource\apps\mpxmainview.r157"
+"\epoc32\data\Z\resource\apps\mpxmainview.r158"
+"\epoc32\data\Z\resource\apps\mpxmainview.r159"
+"\epoc32\data\Z\resource\apps\mpxmainview.r160"
+"\epoc32\data\Z\resource\apps\mpxmainview.r161"
+"\epoc32\data\Z\resource\apps\mpxmainview.r326"
+"\epoc32\data\Z\resource\apps\mpxmainview.r327"
+} - "!:\resource\apps\mpxmainview.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r01"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r02"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r03"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r04"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r05"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r06"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r07"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r08"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r09"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r10"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r13"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r14"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r15"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r16"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r17"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r18"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r25"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r26"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r27"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r28"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r29"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r30"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r31"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r32"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r33"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r37"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r39"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r42"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r44"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r45"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r49"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r50"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r51"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r54"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r57"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r59"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r67"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r68"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r70"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r76"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r78"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r79"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r83"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r93"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r94"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r96"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r102"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r103"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r129"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r157"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r158"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r159"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r160"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r161"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r326"
+"\epoc32\data\Z\resource\apps\mpxmetadataeditordialog.r327"
+} - "!:\resource\apps\mpxmetadataeditordialog.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r01"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r02"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r03"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r04"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r05"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r06"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r07"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r08"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r09"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r10"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r13"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r14"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r15"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r16"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r17"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r18"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r25"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r26"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r27"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r28"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r29"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r30"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r31"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r32"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r33"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r37"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r39"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r42"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r44"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r45"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r49"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r50"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r51"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r54"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r57"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r59"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r67"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r68"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r70"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r76"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r78"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r79"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r83"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r93"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r94"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r96"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r102"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r103"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r129"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r157"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r158"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r159"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r160"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r161"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r326"
+"\epoc32\data\Z\resource\apps\mpxpdplaybackview.r327"
+} - "!:\resource\apps\mpxpdplaybackview.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r01"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r02"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r03"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r04"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r05"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r06"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r07"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r08"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r09"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r10"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r13"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r14"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r15"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r16"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r17"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r18"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r25"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r26"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r27"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r28"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r29"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r30"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r31"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r32"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r33"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r37"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r39"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r42"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r44"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r45"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r49"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r50"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r51"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r54"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r57"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r59"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r67"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r68"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r70"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r76"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r78"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r79"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r83"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r93"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r94"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r96"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r102"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r103"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r129"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r157"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r158"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r159"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r160"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r161"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r326"
+"\epoc32\data\Z\resource\apps\mpxwaitnotedialog.r327"
+} - "!:\resource\apps\mpxwaitnotedialog.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r01"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r02"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r03"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r04"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r05"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r06"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r07"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r08"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r09"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r10"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r13"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r14"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r15"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r16"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r17"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r18"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r25"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r26"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r27"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r28"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r29"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r30"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r31"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r32"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r33"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r37"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r39"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r42"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r44"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r45"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r49"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r50"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r51"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r54"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r57"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r59"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r67"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r68"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r70"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r76"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r78"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r79"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r83"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r93"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r94"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r96"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r102"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r103"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r129"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r157"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r158"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r159"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r160"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r161"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r326"
+"\epoc32\data\Z\resource\apps\mpxvisualizationmenudialog.r327"
+} - "!:\resource\apps\mpxvisualizationmenudialog.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r01"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r02"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r03"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r04"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r05"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r06"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r07"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r08"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r09"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r10"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r13"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r14"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r15"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r16"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r17"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r18"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r25"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r26"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r27"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r28"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r29"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r30"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r31"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r32"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r33"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r37"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r39"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r42"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r44"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r45"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r49"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r50"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r51"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r54"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r57"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r59"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r67"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r68"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r70"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r76"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r78"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r79"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r83"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r93"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r94"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r96"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r102"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r103"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r129"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r157"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r158"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r159"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r160"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r161"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r326"
+"\epoc32\data\Z\resource\apps\mpxvisualizationview.r327"
+} - "!:\resource\apps\mpxvisualizationview.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpx.r01"
+"\epoc32\data\Z\resource\apps\mpx.r02"
+"\epoc32\data\Z\resource\apps\mpx.r03"
+"\epoc32\data\Z\resource\apps\mpx.r04"
+"\epoc32\data\Z\resource\apps\mpx.r05"
+"\epoc32\data\Z\resource\apps\mpx.r06"
+"\epoc32\data\Z\resource\apps\mpx.r07"
+"\epoc32\data\Z\resource\apps\mpx.r08"
+"\epoc32\data\Z\resource\apps\mpx.r09"
+"\epoc32\data\Z\resource\apps\mpx.r10"
+"\epoc32\data\Z\resource\apps\mpx.r13"
+"\epoc32\data\Z\resource\apps\mpx.r14"
+"\epoc32\data\Z\resource\apps\mpx.r15"
+"\epoc32\data\Z\resource\apps\mpx.r16"
+"\epoc32\data\Z\resource\apps\mpx.r17"
+"\epoc32\data\Z\resource\apps\mpx.r18"
+"\epoc32\data\Z\resource\apps\mpx.r25"
+"\epoc32\data\Z\resource\apps\mpx.r26"
+"\epoc32\data\Z\resource\apps\mpx.r27"
+"\epoc32\data\Z\resource\apps\mpx.r28"
+"\epoc32\data\Z\resource\apps\mpx.r29"
+"\epoc32\data\Z\resource\apps\mpx.r30"
+"\epoc32\data\Z\resource\apps\mpx.r31"
+"\epoc32\data\Z\resource\apps\mpx.r32"
+"\epoc32\data\Z\resource\apps\mpx.r33"
+"\epoc32\data\Z\resource\apps\mpx.r37"
+"\epoc32\data\Z\resource\apps\mpx.r39"
+"\epoc32\data\Z\resource\apps\mpx.r42"
+"\epoc32\data\Z\resource\apps\mpx.r44"
+"\epoc32\data\Z\resource\apps\mpx.r45"
+"\epoc32\data\Z\resource\apps\mpx.r49"
+"\epoc32\data\Z\resource\apps\mpx.r50"
+"\epoc32\data\Z\resource\apps\mpx.r51"
+"\epoc32\data\Z\resource\apps\mpx.r54"
+"\epoc32\data\Z\resource\apps\mpx.r57"
+"\epoc32\data\Z\resource\apps\mpx.r59"
+"\epoc32\data\Z\resource\apps\mpx.r67"
+"\epoc32\data\Z\resource\apps\mpx.r68"
+"\epoc32\data\Z\resource\apps\mpx.r70"
+"\epoc32\data\Z\resource\apps\mpx.r76"
+"\epoc32\data\Z\resource\apps\mpx.r78"
+"\epoc32\data\Z\resource\apps\mpx.r79"
+"\epoc32\data\Z\resource\apps\mpx.r83"
+"\epoc32\data\Z\resource\apps\mpx.r93"
+"\epoc32\data\Z\resource\apps\mpx.r94"
+"\epoc32\data\Z\resource\apps\mpx.r96"
+"\epoc32\data\Z\resource\apps\mpx.r102"
+"\epoc32\data\Z\resource\apps\mpx.r103"
+"\epoc32\data\Z\resource\apps\mpx.r129"
+"\epoc32\data\Z\resource\apps\mpx.r157"
+"\epoc32\data\Z\resource\apps\mpx.r158"
+"\epoc32\data\Z\resource\apps\mpx.r159"
+"\epoc32\data\Z\resource\apps\mpx.r160"
+"\epoc32\data\Z\resource\apps\mpx.r161"
+"\epoc32\data\Z\resource\apps\mpx.r326"
+"\epoc32\data\Z\resource\apps\mpx.r327"
+} - "!:\resource\apps\mpx.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r01"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r02"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r03"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r04"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r05"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r06"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r07"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r08"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r09"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r10"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r13"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r14"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r15"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r16"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r17"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r18"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r25"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r26"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r27"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r28"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r29"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r30"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r31"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r32"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r33"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r37"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r39"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r42"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r44"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r45"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r49"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r50"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r51"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r54"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r57"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r59"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r67"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r68"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r70"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r76"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r78"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r79"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r83"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r93"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r94"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r96"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r102"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r103"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r129"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r157"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r158"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r159"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r160"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r161"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r326"
+"\epoc32\data\Z\resource\apps\aiplayerpluginresource.r327"
+} - "!:\resource\apps\aiplayerpluginresource.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\musichomescreen.r01"
+"\epoc32\data\Z\resource\apps\musichomescreen.r02"
+"\epoc32\data\Z\resource\apps\musichomescreen.r03"
+"\epoc32\data\Z\resource\apps\musichomescreen.r04"
+"\epoc32\data\Z\resource\apps\musichomescreen.r05"
+"\epoc32\data\Z\resource\apps\musichomescreen.r06"
+"\epoc32\data\Z\resource\apps\musichomescreen.r07"
+"\epoc32\data\Z\resource\apps\musichomescreen.r08"
+"\epoc32\data\Z\resource\apps\musichomescreen.r09"
+"\epoc32\data\Z\resource\apps\musichomescreen.r10"
+"\epoc32\data\Z\resource\apps\musichomescreen.r13"
+"\epoc32\data\Z\resource\apps\musichomescreen.r14"
+"\epoc32\data\Z\resource\apps\musichomescreen.r15"
+"\epoc32\data\Z\resource\apps\musichomescreen.r16"
+"\epoc32\data\Z\resource\apps\musichomescreen.r17"
+"\epoc32\data\Z\resource\apps\musichomescreen.r18"
+"\epoc32\data\Z\resource\apps\musichomescreen.r25"
+"\epoc32\data\Z\resource\apps\musichomescreen.r26"
+"\epoc32\data\Z\resource\apps\musichomescreen.r27"
+"\epoc32\data\Z\resource\apps\musichomescreen.r28"
+"\epoc32\data\Z\resource\apps\musichomescreen.r29"
+"\epoc32\data\Z\resource\apps\musichomescreen.r30"
+"\epoc32\data\Z\resource\apps\musichomescreen.r31"
+"\epoc32\data\Z\resource\apps\musichomescreen.r32"
+"\epoc32\data\Z\resource\apps\musichomescreen.r33"
+"\epoc32\data\Z\resource\apps\musichomescreen.r37"
+"\epoc32\data\Z\resource\apps\musichomescreen.r39"
+"\epoc32\data\Z\resource\apps\musichomescreen.r42"
+"\epoc32\data\Z\resource\apps\musichomescreen.r44"
+"\epoc32\data\Z\resource\apps\musichomescreen.r45"
+"\epoc32\data\Z\resource\apps\musichomescreen.r49"
+"\epoc32\data\Z\resource\apps\musichomescreen.r50"
+"\epoc32\data\Z\resource\apps\musichomescreen.r51"
+"\epoc32\data\Z\resource\apps\musichomescreen.r54"
+"\epoc32\data\Z\resource\apps\musichomescreen.r57"
+"\epoc32\data\Z\resource\apps\musichomescreen.r59"
+"\epoc32\data\Z\resource\apps\musichomescreen.r67"
+"\epoc32\data\Z\resource\apps\musichomescreen.r68"
+"\epoc32\data\Z\resource\apps\musichomescreen.r70"
+"\epoc32\data\Z\resource\apps\musichomescreen.r76"
+"\epoc32\data\Z\resource\apps\musichomescreen.r78"
+"\epoc32\data\Z\resource\apps\musichomescreen.r79"
+"\epoc32\data\Z\resource\apps\musichomescreen.r83"
+"\epoc32\data\Z\resource\apps\musichomescreen.r93"
+"\epoc32\data\Z\resource\apps\musichomescreen.r94"
+"\epoc32\data\Z\resource\apps\musichomescreen.r96"
+"\epoc32\data\Z\resource\apps\musichomescreen.r102"
+"\epoc32\data\Z\resource\apps\musichomescreen.r103"
+"\epoc32\data\Z\resource\apps\musichomescreen.r129"
+"\epoc32\data\Z\resource\apps\musichomescreen.r157"
+"\epoc32\data\Z\resource\apps\musichomescreen.r158"
+"\epoc32\data\Z\resource\apps\musichomescreen.r159"
+"\epoc32\data\Z\resource\apps\musichomescreen.r160"
+"\epoc32\data\Z\resource\apps\musichomescreen.r161"
+"\epoc32\data\Z\resource\apps\musichomescreen.r326"
+"\epoc32\data\Z\resource\apps\musichomescreen.r327"
+} - "!:\resource\apps\musichomescreen.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r01"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r02"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r03"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r04"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r05"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r06"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r07"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r08"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r09"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r10"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r13"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r14"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r15"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r16"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r17"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r18"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r25"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r26"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r27"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r28"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r29"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r30"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r31"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r32"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r33"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r37"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r39"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r42"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r44"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r45"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r49"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r50"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r51"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r54"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r57"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r59"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r67"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r68"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r70"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r76"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r78"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r79"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r83"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r93"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r94"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r96"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r102"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r103"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r129"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r157"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r158"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r159"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r160"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r161"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r326"
+"\epoc32\data\Z\resource\apps\mpxpdsbplaybackview.r327"
+} - "!:\resource\apps\mpxpdsbplaybackview.rsc"
+
+{
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r01"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r02"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r03"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r04"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r05"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r06"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r07"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r08"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r09"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r10"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r13"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r14"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r15"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r16"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r17"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r18"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r25"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r26"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r27"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r28"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r29"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r30"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r31"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r32"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r33"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r37"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r39"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r42"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r44"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r45"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r49"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r50"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r51"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r54"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r57"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r59"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r67"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r68"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r70"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r76"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r78"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r79"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r83"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r93"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r94"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r96"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r102"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r103"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r129"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r157"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r158"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r159"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r160"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r161"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r326"
+"\epoc32\data\Z\resource\apps\mpxpodcastcollectionview.r327"
+} - "!:\resource\apps\mpxpodcastcollectionview.rsc"
+
+{
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r01"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r02"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r03"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r04"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r05"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r06"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r07"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r08"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r09"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r10"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r13"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r14"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r15"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r16"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r17"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r18"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r25"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r26"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r27"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r28"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r29"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r30"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r31"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r32"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r33"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r37"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r39"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r42"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r44"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r45"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r49"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r50"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r51"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r54"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r57"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r59"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r67"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r68"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r70"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r76"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r78"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r79"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r83"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r93"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r94"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r96"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r102"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r103"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r129"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r157"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r158"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r159"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r160"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r161"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r326"
+"\epoc32\data\Z\resource\plugins\mpxvisualizationplugins.r327"
+} - "!:\resource\plugins\mpxvisualizationplugins.rsc"
+
+; Localised help files
+
+IF (LANGUAGE=01)
+"\epoc32\data\Z\resource\xhtml\01\0x102072C3\contents.zip"    -"!:\resource\xhtml\01\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\01\0x102072C3\index.xml"       -"!:\resource\xhtml\01\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\01\0x102072C3\keywords.xml"    -"!:\resource\xhtml\01\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\01\0x102072C3\meta.xml"        -"!:\resource\xhtml\01\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=02)
+"\epoc32\data\Z\resource\xhtml\02\0x102072C3\contents.zip"   -"!:\resource\xhtml\02\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\02\0x102072C3\index.xml"      -"!:\resource\xhtml\02\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\02\0x102072C3\keywords.xml"   -"!:\resource\xhtml\02\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\02\0x102072C3\meta.xml"       -"!:\resource\xhtml\02\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=03)
+"\epoc32\data\Z\resource\xhtml\03\0x102072C3\contents.zip"   -"!:\resource\xhtml\03\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\03\0x102072C3\index.xml"      -"!:\resource\xhtml\03\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\03\0x102072C3\keywords.xml"   -"!:\resource\xhtml\03\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\03\0x102072C3\meta.xml"       -"!:\resource\xhtml\03\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=04)
+"\epoc32\data\Z\resource\xhtml\04\0x102072C3\contents.zip"   -"!:\resource\xhtml\04\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\04\0x102072C3\index.xml"      -"!:\resource\xhtml\04\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\04\0x102072C3\keywords.xml"   -"!:\resource\xhtml\04\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\04\0x102072C3\meta.xml"       -"!:\resource\xhtml\04\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=05)
+"\epoc32\data\Z\resource\xhtml\05\0x102072C3\contents.zip"   -"!:\resource\xhtml\05\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\05\0x102072C3\index.xml"      -"!:\resource\xhtml\05\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\05\0x102072C3\keywords.xml"   -"!:\resource\xhtml\05\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\05\0x102072C3\meta.xml"       -"!:\resource\xhtml\05\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=06)
+"\epoc32\data\Z\resource\xhtml\06\0x102072C3\contents.zip"   -"!:\resource\xhtml\06\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\06\0x102072C3\index.xml"      -"!:\resource\xhtml\06\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\06\0x102072C3\keywords.xml"   -"!:\resource\xhtml\06\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\06\0x102072C3\meta.xml"       -"!:\resource\xhtml\06\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=07)
+"\epoc32\data\Z\resource\xhtml\07\0x102072C3\contents.zip"   -"!:\resource\xhtml\07\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\07\0x102072C3\index.xml"      -"!:\resource\xhtml\07\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\07\0x102072C3\keywords.xml"   -"!:\resource\xhtml\07\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\07\0x102072C3\meta.xml"       -"!:\resource\xhtml\07\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=08)
+"\epoc32\data\Z\resource\xhtml\08\0x102072C3\contents.zip"   -"!:\resource\xhtml\08\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\08\0x102072C3\index.xml"      -"!:\resource\xhtml\08\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\08\0x102072C3\keywords.xml"   -"!:\resource\xhtml\08\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\08\0x102072C3\meta.xml"       -"!:\resource\xhtml\08\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=09)
+"\epoc32\data\Z\resource\xhtml\09\0x102072C3\contents.zip"   -"!:\resource\xhtml\09\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\09\0x102072C3\index.xml"      -"!:\resource\xhtml\09\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\09\0x102072C3\keywords.xml"   -"!:\resource\xhtml\09\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\09\0x102072C3\meta.xml"       -"!:\resource\xhtml\09\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=10)
+"\epoc32\data\Z\resource\xhtml\10\0x102072C3\contents.zip"   -"!:\resource\xhtml\10\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\10\0x102072C3\index.xml"      -"!:\resource\xhtml\10\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\10\0x102072C3\keywords.xml"   -"!:\resource\xhtml\10\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\10\0x102072C3\meta.xml"       -"!:\resource\xhtml\10\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=13)
+"\epoc32\data\Z\resource\xhtml\13\0x102072C3\contents.zip"   -"!:\resource\xhtml\13\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\13\0x102072C3\index.xml"      -"!:\resource\xhtml\13\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\13\0x102072C3\keywords.xml"   -"!:\resource\xhtml\13\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\13\0x102072C3\meta.xml"       -"!:\resource\xhtml\13\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=14)
+"\epoc32\data\Z\resource\xhtml\14\0x102072C3\contents.zip"   -"!:\resource\xhtml\14\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\14\0x102072C3\index.xml"      -"!:\resource\xhtml\14\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\14\0x102072C3\keywords.xml"   -"!:\resource\xhtml\14\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\14\0x102072C3\meta.xml"       -"!:\resource\xhtml\14\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=15)
+"\epoc32\data\Z\resource\xhtml\15\0x102072C3\contents.zip"   -"!:\resource\xhtml\15\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\15\0x102072C3\index.xml"      -"!:\resource\xhtml\15\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\15\0x102072C3\keywords.xml"   -"!:\resource\xhtml\15\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\15\0x102072C3\meta.xml"       -"!:\resource\xhtml\15\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=16)
+"\epoc32\data\Z\resource\xhtml\16\0x102072C3\contents.zip"   -"!:\resource\xhtml\16\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\16\0x102072C3\index.xml"      -"!:\resource\xhtml\16\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\16\0x102072C3\keywords.xml"   -"!:\resource\xhtml\16\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\16\0x102072C3\meta.xml"       -"!:\resource\xhtml\16\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=17)
+"\epoc32\data\Z\resource\xhtml\17\0x102072C3\contents.zip"   -"!:\resource\xhtml\17\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\17\0x102072C3\index.xml"      -"!:\resource\xhtml\17\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\17\0x102072C3\keywords.xml"   -"!:\resource\xhtml\17\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\17\0x102072C3\meta.xml"       -"!:\resource\xhtml\17\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=18)
+"\epoc32\data\Z\resource\xhtml\18\0x102072C3\contents.zip"   -"!:\resource\xhtml\18\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\18\0x102072C3\index.xml"      -"!:\resource\xhtml\18\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\18\0x102072C3\keywords.xml"   -"!:\resource\xhtml\18\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\18\0x102072C3\meta.xml"       -"!:\resource\xhtml\18\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=25)
+"\epoc32\data\Z\resource\xhtml\25\0x102072C3\contents.zip"   -"!:\resource\xhtml\25\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\25\0x102072C3\index.xml"      -"!:\resource\xhtml\25\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\25\0x102072C3\keywords.xml"   -"!:\resource\xhtml\25\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\25\0x102072C3\meta.xml"       -"!:\resource\xhtml\25\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=26)
+"\epoc32\data\Z\resource\xhtml\26\0x102072C3\contents.zip"   -"!:\resource\xhtml\26\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\26\0x102072C3\index.xml"      -"!:\resource\xhtml\26\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\26\0x102072C3\keywords.xml"   -"!:\resource\xhtml\26\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\26\0x102072C3\meta.xml"       -"!:\resource\xhtml\26\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=27)
+"\epoc32\data\Z\resource\xhtml\27\0x102072C3\contents.zip"   -"!:\resource\xhtml\27\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\27\0x102072C3\index.xml"      -"!:\resource\xhtml\27\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\27\0x102072C3\keywords.xml"   -"!:\resource\xhtml\27\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\27\0x102072C3\meta.xml"       -"!:\resource\xhtml\27\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=28)
+"\epoc32\data\Z\resource\xhtml\28\0x102072C3\contents.zip"   -"!:\resource\xhtml\28\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\28\0x102072C3\index.xml"      -"!:\resource\xhtml\28\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\28\0x102072C3\keywords.xml"   -"!:\resource\xhtml\28\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\28\0x102072C3\meta.xml"       -"!:\resource\xhtml\28\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=29)
+"\epoc32\data\Z\resource\xhtml\29\0x102072C3\contents.zip"   -"!:\resource\xhtml\29\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\29\0x102072C3\index.xml"      -"!:\resource\xhtml\29\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\29\0x102072C3\keywords.xml"   -"!:\resource\xhtml\29\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\29\0x102072C3\meta.xml"       -"!:\resource\xhtml\29\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=30)
+"\epoc32\data\Z\resource\xhtml\30\0x102072C3\contents.zip"   -"!:\resource\xhtml\30\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\30\0x102072C3\index.xml"      -"!:\resource\xhtml\30\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\30\0x102072C3\keywords.xml"   -"!:\resource\xhtml\30\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\30\0x102072C3\meta.xml"       -"!:\resource\xhtml\30\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=31)
+"\epoc32\data\Z\resource\xhtml\31\0x102072C3\contents.zip"   -"!:\resource\xhtml\31\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\31\0x102072C3\index.xml"      -"!:\resource\xhtml\31\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\31\0x102072C3\keywords.xml"   -"!:\resource\xhtml\31\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\31\0x102072C3\meta.xml"       -"!:\resource\xhtml\31\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=32)
+"\epoc32\data\Z\resource\xhtml\32\0x102072C3\contents.zip"   -"!:\resource\xhtml\32\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\32\0x102072C3\index.xml"      -"!:\resource\xhtml\32\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\32\0x102072C3\keywords.xml"   -"!:\resource\xhtml\32\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\32\0x102072C3\meta.xml"       -"!:\resource\xhtml\32\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=33)
+"\epoc32\data\Z\resource\xhtml\33\0x102072C3\contents.zip"   -"!:\resource\xhtml\33\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\33\0x102072C3\index.xml"      -"!:\resource\xhtml\33\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\33\0x102072C3\keywords.xml"   -"!:\resource\xhtml\33\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\33\0x102072C3\meta.xml"       -"!:\resource\xhtml\33\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=37)
+"\epoc32\data\Z\resource\xhtml\37\0x102072C3\contents.zip"   -"!:\resource\xhtml\37\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\37\0x102072C3\index.xml"      -"!:\resource\xhtml\37\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\37\0x102072C3\keywords.xml"   -"!:\resource\xhtml\37\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\37\0x102072C3\meta.xml"       -"!:\resource\xhtml\37\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=39)
+"\epoc32\data\Z\resource\xhtml\39\0x102072C3\contents.zip"   -"!:\resource\xhtml\39\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\39\0x102072C3\index.xml"      -"!:\resource\xhtml\39\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\39\0x102072C3\keywords.xml"   -"!:\resource\xhtml\39\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\39\0x102072C3\meta.xml"       -"!:\resource\xhtml\39\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=42)
+"\epoc32\data\Z\resource\xhtml\42\0x102072C3\contents.zip"   -"!:\resource\xhtml\42\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\42\0x102072C3\index.xml"      -"!:\resource\xhtml\42\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\42\0x102072C3\keywords.xml"   -"!:\resource\xhtml\42\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\42\0x102072C3\meta.xml"       -"!:\resource\xhtml\42\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=44)
+"\epoc32\data\Z\resource\xhtml\44\0x102072C3\contents.zip"   -"!:\resource\xhtml\44\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\44\0x102072C3\index.xml"      -"!:\resource\xhtml\44\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\44\0x102072C3\keywords.xml"   -"!:\resource\xhtml\44\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\44\0x102072C3\meta.xml"       -"!:\resource\xhtml\44\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=45)
+"\epoc32\data\Z\resource\xhtml\45\0x102072C3\contents.zip"   -"!:\resource\xhtml\45\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\45\0x102072C3\index.xml"      -"!:\resource\xhtml\45\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\45\0x102072C3\keywords.xml"   -"!:\resource\xhtml\45\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\45\0x102072C3\meta.xml"       -"!:\resource\xhtml\45\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=49)
+"\epoc32\data\Z\resource\xhtml\49\0x102072C3\contents.zip"   -"!:\resource\xhtml\49\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\49\0x102072C3\index.xml"      -"!:\resource\xhtml\49\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\49\0x102072C3\keywords.xml"   -"!:\resource\xhtml\49\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\49\0x102072C3\meta.xml"       -"!:\resource\xhtml\49\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=50)
+"\epoc32\data\Z\resource\xhtml\50\0x102072C3\contents.zip"   -"!:\resource\xhtml\50\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\50\0x102072C3\index.xml"      -"!:\resource\xhtml\50\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\50\0x102072C3\keywords.xml"   -"!:\resource\xhtml\50\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\50\0x102072C3\meta.xml"       -"!:\resource\xhtml\50\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=51)
+"\epoc32\data\Z\resource\xhtml\51\0x102072C3\contents.zip"   -"!:\resource\xhtml\51\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\51\0x102072C3\index.xml"      -"!:\resource\xhtml\51\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\51\0x102072C3\keywords.xml"   -"!:\resource\xhtml\51\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\51\0x102072C3\meta.xml"       -"!:\resource\xhtml\51\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=54)
+"\epoc32\data\Z\resource\xhtml\54\0x102072C3\contents.zip"   -"!:\resource\xhtml\54\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\54\0x102072C3\index.xml"      -"!:\resource\xhtml\54\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\54\0x102072C3\keywords.xml"   -"!:\resource\xhtml\54\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\54\0x102072C3\meta.xml"       -"!:\resource\xhtml\54\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=57)
+"\epoc32\data\Z\resource\xhtml\57\0x102072C3\contents.zip"   -"!:\resource\xhtml\57\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\57\0x102072C3\index.xml"      -"!:\resource\xhtml\57\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\57\0x102072C3\keywords.xml"   -"!:\resource\xhtml\57\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\57\0x102072C3\meta.xml"       -"!:\resource\xhtml\57\0x102072C3\meta.xml"
+
+IF (LANGUAGE=58)
+"\epoc32\data\Z\resource\xhtml\58\0x102072C3\contents.zip"   -"!:\resource\xhtml\58\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\58\0x102072C3\index.xml"      -"!:\resource\xhtml\58\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\58\0x102072C3\keywords.xml"   -"!:\resource\xhtml\58\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\58\0x102072C3\meta.xml"       -"!:\resource\xhtml\58\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=59)
+"\epoc32\data\Z\resource\xhtml\59\0x102072C3\contents.zip"   -"!:\resource\xhtml\59\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\59\0x102072C3\index.xml"      -"!:\resource\xhtml\59\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\59\0x102072C3\keywords.xml"   -"!:\resource\xhtml\59\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\59\0x102072C3\meta.xml"       -"!:\resource\xhtml\59\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=67)
+"\epoc32\data\Z\resource\xhtml\67\0x102072C3\contents.zip"   -"!:\resource\xhtml\67\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\67\0x102072C3\index.xml"      -"!:\resource\xhtml\67\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\67\0x102072C3\keywords.xml"   -"!:\resource\xhtml\67\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\67\0x102072C3\meta.xml"       -"!:\resource\xhtml\67\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=68)
+"\epoc32\data\Z\resource\xhtml\68\0x102072C3\contents.zip"   -"!:\resource\xhtml\68\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\68\0x102072C3\index.xml"      -"!:\resource\xhtml\68\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\68\0x102072C3\keywords.xml"   -"!:\resource\xhtml\68\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\68\0x102072C3\meta.xml"       -"!:\resource\xhtml\68\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=70)
+"\epoc32\data\Z\resource\xhtml\70\0x102072C3\contents.zip"   -"!:\resource\xhtml\70\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\70\0x102072C3\index.xml"      -"!:\resource\xhtml\70\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\70\0x102072C3\keywords.xml"   -"!:\resource\xhtml\70\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\70\0x102072C3\meta.xml"       -"!:\resource\xhtml\70\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=76)
+"\epoc32\data\Z\resource\xhtml\76\0x102072C3\contents.zip"   -"!:\resource\xhtml\76\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\76\0x102072C3\index.xml"      -"!:\resource\xhtml\76\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\76\0x102072C3\keywords.xml"   -"!:\resource\xhtml\76\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\76\0x102072C3\meta.xml"       -"!:\resource\xhtml\76\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=78)
+"\epoc32\data\Z\resource\xhtml\78\0x102072C3\contents.zip"   -"!:\resource\xhtml\78\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\78\0x102072C3\index.xml"      -"!:\resource\xhtml\78\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\78\0x102072C3\keywords.xml"   -"!:\resource\xhtml\78\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\78\0x102072C3\meta.xml"       -"!:\resource\xhtml\78\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=79)
+"\epoc32\data\Z\resource\xhtml\79\0x102072C3\contents.zip"   -"!:\resource\xhtml\79\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\79\0x102072C3\index.xml"      -"!:\resource\xhtml\79\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\79\0x102072C3\keywords.xml"   -"!:\resource\xhtml\79\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\79\0x102072C3\meta.xml"       -"!:\resource\xhtml\79\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=83)
+"\epoc32\data\Z\resource\xhtml\83\0x102072C3\contents.zip"   -"!:\resource\xhtml\83\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\83\0x102072C3\index.xml"      -"!:\resource\xhtml\83\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\83\0x102072C3\keywords.xml"   -"!:\resource\xhtml\83\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\83\0x102072C3\meta.xml"       -"!:\resource\xhtml\83\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=93)
+"\epoc32\data\Z\resource\xhtml\93\0x102072C3\contents.zip"   -"!:\resource\xhtml\93\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\93\0x102072C3\index.xml"      -"!:\resource\xhtml\93\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\93\0x102072C3\keywords.xml"   -"!:\resource\xhtml\93\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\93\0x102072C3\meta.xml"       -"!:\resource\xhtml\93\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=94)
+"\epoc32\data\Z\resource\xhtml\94\0x102072C3\contents.zip"   -"!:\resource\xhtml\94\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\94\0x102072C3\index.xml"      -"!:\resource\xhtml\94\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\94\0x102072C3\keywords.xml"   -"!:\resource\xhtml\94\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\94\0x102072C3\meta.xml"       -"!:\resource\xhtml\94\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=96)
+"\epoc32\data\Z\resource\xhtml\96\0x102072C3\contents.zip"   -"!:\resource\xhtml\96\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\96\0x102072C3\index.xml"      -"!:\resource\xhtml\96\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\96\0x102072C3\keywords.xml"   -"!:\resource\xhtml\96\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\96\0x102072C3\meta.xml"       -"!:\resource\xhtml\96\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=129)
+"\epoc32\data\Z\resource\xhtml\129\0x102072C3\contents.zip"   -"!:\resource\xhtml\129\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\129\0x102072C3\index.xml"      -"!:\resource\xhtml\129\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\129\0x102072C3\keywords.xml"   -"!:\resource\xhtml\129\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\129\0x102072C3\meta.xml"       -"!:\resource\xhtml\129\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=157)
+"\epoc32\data\Z\resource\xhtml\157\0x102072C3\contents.zip"   -"!:\resource\xhtml\157\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\157\0x102072C3\index.xml"      -"!:\resource\xhtml\157\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\157\0x102072C3\keywords.xml"   -"!:\resource\xhtml\157\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\157\0x102072C3\meta.xml"       -"!:\resource\xhtml\157\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=158)
+"\epoc32\data\Z\resource\xhtml\158\0x102072C3\contents.zip"   -"!:\resource\xhtml\158\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\158\0x102072C3\index.xml"      -"!:\resource\xhtml\158\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\158\0x102072C3\keywords.xml"   -"!:\resource\xhtml\158\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\158\0x102072C3\meta.xml"       -"!:\resource\xhtml\158\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=159)
+"\epoc32\data\Z\resource\xhtml\159\0x102072C3\contents.zip"   -"!:\resource\xhtml\159\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\159\0x102072C3\index.xml"      -"!:\resource\xhtml\159\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\159\0x102072C3\keywords.xml"   -"!:\resource\xhtml\159\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\159\0x102072C3\meta.xml"       -"!:\resource\xhtml\159\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=160)
+"\epoc32\data\Z\resource\xhtml\160\0x102072C3\contents.zip"   -"!:\resource\xhtml\160\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\160\0x102072C3\index.xml"      -"!:\resource\xhtml\160\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\160\0x102072C3\keywords.xml"   -"!:\resource\xhtml\160\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\160\0x102072C3\meta.xml"       -"!:\resource\xhtml\160\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=161)
+"\epoc32\data\Z\resource\xhtml\161\0x102072C3\contents.zip"   -"!:\resource\xhtml\161\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\161\0x102072C3\index.xml"      -"!:\resource\xhtml\161\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\161\0x102072C3\keywords.xml"   -"!:\resource\xhtml\161\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\161\0x102072C3\meta.xml"       -"!:\resource\xhtml\161\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=401)
+"\epoc32\data\Z\resource\xhtml\401\0x102072C3\contents.zip"   -"!:\resource\xhtml\401\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\401\0x102072C3\index.xml"      -"!:\resource\xhtml\401\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\401\0x102072C3\keywords.xml"   -"!:\resource\xhtml\401\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\401\0x102072C3\meta.xml"       -"!:\resource\xhtml\401\0x102072C3\meta.xml"
+
+ELSEIF (LANGUAGE=402)
+"\epoc32\data\Z\resource\xhtml\402\0x102072C3\contents.zip"   -"!:\resource\xhtml\402\0x102072C3\contents.zip"
+"\epoc32\data\Z\resource\xhtml\402\0x102072C3\index.xml"      -"!:\resource\xhtml\402\0x102072C3\index.xml"
+"\epoc32\data\Z\resource\xhtml\402\0x102072C3\keywords.xml"   -"!:\resource\xhtml\402\0x102072C3\keywords.xml"
+"\epoc32\data\Z\resource\xhtml\402\0x102072C3\meta.xml"       -"!:\resource\xhtml\402\0x102072C3\meta.xml"
+ENDIF
+
Binary file mpxmusicplayer/sis/mpxmusicplayer.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/sis/mpxmusicplayer.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ad:metadata xmlns="http://nokia.com/arrow/repository/ia_component"
+  xmlns:ad="http://nokia.com/arrow/application_metadata">
+  <!-- 
+  The appResources element contains all the language metadata of one IAC. 
+  IAC may have one or more language-specific component names 
+  and descriptions inside appResource element.
+  
+  Language ID 1 should be always defined as this is the default language
+  in case other languages supported by the client cannot be found.
+  -->
+  <appResources>
+    <appResource>
+      <!-- Language ID -->
+      <language>1</language>
+      <!-- Name in given language -->
+      <iacName>S60 MusicPlayer Kinetic Scrolling</iacName>
+      <!-- Description in given language -->
+      <iacDescription>MPX MusicPlayer with kinetic scrolling support</iacDescription>
+    </appResource>
+  </appResources>
+  <!-- Specifies for what versions of what platform this component is for. -->
+  <swPlatformDep>
+    <!-- platform code -->
+    <platform>S60</platform>
+    <versionFrom>
+      <!--
+        platform version number separated in major and minor number (i.e. 
+        3.0 has 3 as major and 0 as minor)
+      -->    
+      <major>5</major>
+      <minor>0</minor>
+      <!--
+        date-element can be used to pinpoint platform version number to even 
+        more specific one. It is not currently used in the system.
+      -->
+      <date>
+        <year>2008</year>
+        <week>46</week>
+      </date>
+    </versionFrom>
+    <!-- the latest platform version this component is for -->
+    <versionTo>
+      <major>9</major>
+      <minor>1</minor>
+      <date>
+        <year>2010</year>
+        <week>1</week>
+      </date>
+    </versionTo>
+  </swPlatformDep>
+  <!-- specifies dependencies to other IACs -->
+  <interDeps>
+     <interDep>
+        <sisxUid>0x101FFC63</sisxUid>
+        <versionFrom>
+           <major>11</major>
+           <minor>0</minor>
+           <build>1</build>
+        </versionFrom>
+        <versionTo>
+           <major>11</major>
+           <minor>0</minor>
+           <build>2</build>
+        </versionTo>
+     </interDep>
+     <interDep>
+        <sisxUid>0x102830AB</sisxUid>
+        <versionFrom>
+           <major>2</major>
+           <minor>0</minor>
+           <build>0</build>
+        </versionFrom>
+        <versionTo>
+           <major>3</major>
+           <minor>0</minor>
+           <build>0</build>
+        </versionTo>
+     </interDep>
+     <interDep>
+        <sisxUid>0x2001CBE2</sisxUid>
+        <versionFrom>
+           <major>1</major>
+           <minor>0</minor>
+           <build>0</build>
+        </versionFrom>
+        <versionTo>
+           <major>2</major>
+           <minor>0</minor>
+           <build>0</build>
+        </versionTo>
+     </interDep>
+  </interDeps>
+</ad:metadata>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/sis/mpxmusicplayer_cenrep.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<dependencies xmlns="http://nokia.com/arrow/repository/ia_component">
+  <appResources>
+     <appResource>
+        <language>1</language>
+        <iacName>MusicPlayer</iacName>
+        <iacDescription>MPX MusicPlayer</iacDescription>
+     </appResource>
+  </appResources>
+  <swPlatformDep>
+     <platform>S60</platform>
+     <versionFrom>
+        <major>3</major>
+        <minor>2</minor>
+        <date>
+           <year>2008</year>
+           <week>24</week>
+        </date>
+     </versionFrom>
+     <versionTo>
+        <major>3</major>
+        <minor>2</minor>
+        <date>
+           <year>2010</year>
+           <week>1</week>
+        </date>
+     </versionTo>
+  </swPlatformDep>
+  <interDeps>
+     <interDep>
+        <sisxUid>0x10202BE9</sisxUid>
+        <versionFrom>
+           <major>1</major>
+           <minor>0</minor>
+           <build>0</build>
+        </versionFrom>
+        <versionTo>
+           <major>5</major>
+           <minor>0</minor>
+           <build>0</build>
+        </versionTo>
+     </interDep>
+  </interDeps>
+</dependencies>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/sis/mpxmusicplayercenrep.pkg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,33 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Package file for MPX music player Cenrep
+;
+;Languages
+&EN
+
+; Header
+#{ "MPX MusicPlayer CenRep files"}, (0x10202BE9), 1, 0, 1, TYPE=SP
+
+; Supports Series 60 v3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+;Localised Vendor Name
+%{"Nokia"}
+
+;Unique Vendor Name
+:"Nokia"
+
+"101ffcd0.cre"           -"!:\private\10202BE9\101ffcd0.cre"
+"101ffcd1.cre"           -"!:\private\10202BE9\101ffcd1.cre"
+"101ffcdc.cre"           -"!:\private\10202BE9\101ffcdc.cre"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxmusicplayer/sis/mpxmusicplayerstub.pkg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,23 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: Package file for MPX music player stub
+;
+
+&EN
+
+#{"MPXMusicPlayer"}, (0x101ffc62), 13, 1, 0906, TYPE=SA
+; dlls version uses 13.1
+%{"Nokia"}
+:"Nokia"
+
Binary file mpxmusicplayer/sis/mpxmusicplayerstub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for mpxplugins domain
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+mpxplugins_stub.sis                             /epoc32/data/z/system/install/mpxplugins_stub.sis
+
+PRJ_MMPFILES
+#include "../serviceplugins/group/bld.inf"
+#include "../viewplugins/group/bld.inf"
+
Binary file mpxplugins/group/mpxplugins_stub.sis has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/inc/mpxaudioeffectengine.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio effect engine
+*
+*/
+
+
+#ifndef _MPXAUDIOEFFECTENGINE_H_
+#define _MPXAUDIOEFFECTENGINE_H_
+#define _LOUDNESS
+//#undef _LOUDNESS
+//#define _BASSBOOST
+#undef _BASSBOOST
+#define _REVERB
+//#undef _REVERB
+#define _STEREO
+
+
+// INCLUDES
+const TInt KAudioEffectsID = 0x101FFC02;
+const TInt KEqualizerID = 0x101FFC76;
+
+// System Includes
+#include <e32base.h>
+#include <mdaaudiosampleplayer.h>
+
+#include <mpxplaybackobserver.h>
+#include "mpxaudioeffectproperties.h"
+
+// FORWARD DECLARATIONS
+class CMdaAudioPlayerUtility;
+class CEnvironmentalReverbUtility;
+class CStereoWidening;
+class CBassBoost;
+class CLoudness;
+class CAudioEqualizerUtility;
+
+class MMPXPlaybackUtility;
+class TMPXPlaybackMessage;
+
+/**
+*  Audio effect engine Class
+*
+*  @lib mpxaudioeffectengine.dll
+*  @since Series 60 3.0
+*/
+class CMPXAudioEffectEngine : public CBase
+{
+public: 
+
+    /**
+    * Two-phased constructor
+    *
+    * @param aPlayer audio player utility
+    * @return object of constructed
+    */
+	IMPORT_C static CMPXAudioEffectEngine* NewL(
+	                                    CMdaAudioPlayerUtility* aPlayer);
+	
+    /**
+    * Destructor
+    */
+	IMPORT_C ~CMPXAudioEffectEngine();
+	
+    /**
+    * Set balance
+    */
+ 	IMPORT_C void SetBalanceL();
+
+    /**
+    * Set bass boost
+    */
+	IMPORT_C void SetBassBoostL();
+
+    /**
+    * Set stero widening
+    */
+	IMPORT_C void SetStereoWideningL();
+
+    /**
+    * Set reverberation
+    */
+ 	IMPORT_C void SetReverberationL();
+
+    /**
+    * Set loundness
+    */
+    IMPORT_C void SetLoudnessL();
+
+    /**
+    * Sets the equalizer preset
+    * This function will check MPX cenrep for preset id
+    */
+    IMPORT_C void SetEqualizerL();
+    
+    /**
+     * Creates the audio effects
+     */
+    IMPORT_C void CreateAudioEffectsL();
+
+    /**
+    * Destroy audio effect objects
+    */
+    IMPORT_C void DestroyAudioEffect();
+   
+private:
+    /**
+    * C++ constructor
+    *
+    * @param aPlayer audio player utility
+    */
+	CMPXAudioEffectEngine(CMdaAudioPlayerUtility* aPlayer);
+
+    /**
+    * Second phase constructor
+    */
+    void ConstructL();
+ 
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     */
+    void DoHandleStateChangedL(
+        TMPXPlaybackState aState );
+
+private: //Data
+	
+    CMPXAudioEffectProperties* iProp;
+    
+private:
+	CMdaAudioPlayerUtility* iMdaPlayer;  // Not owned
+	
+	CEnvironmentalReverbUtility* iReverbEffect;
+	CStereoWidening* iStereoEffect;
+	CBassBoost* iBassBoostEffect;
+	CLoudness*  iLoudnessEffect;
+	CAudioEqualizerUtility* iEqualizerEffect;
+	};
+
+#endif // _MPXAUDIOEFFECTENGINE_H_
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/inc/mpxaudioeffectproperties.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Container of properties for audio effect
+*
+*/
+
+ 
+
+#ifndef CMPXAUDIOEFFECTPROPERTIES_H
+#define CMPXAUDIOEFFECTPROPERTIES_H
+
+
+#include <e32base.h>
+#include <s32strm.h>
+
+
+/**
+*  Supports 'standard' a attributes. Streamable object
+*/
+class CMPXAudioEffectProperties : public CBase
+    {
+public: 
+    inline virtual ~CMPXAudioEffectProperties();
+public:
+    inline TInt Balance() const;
+    inline TInt Reverb() const;
+    inline TBool Stereo() const;  
+    inline TBool BassBoost() const;
+    inline TBool Loudness() const;
+
+public:
+    inline void SetBalance(TInt aBalance);
+    inline void SetReverb(TInt aReverb);
+    inline void SetStereo(TBool aStereo);  
+    inline void SetBassBoost(TBool aBassBoost);  
+    inline void SetLoudness(TBool aLoudness);  
+    inline void Reset();
+public:
+    inline void ExternalizeL(RWriteStream& aStream) const;
+    inline void InternalizeL(RReadStream& aStream);
+    inline void SaveToFileL() const;
+    inline void LoadFromFileL();
+private:
+    enum TDesProperty 
+        { 
+        //EDesPresetName, // Not used yet. EQ
+        EDesNumItems = 0
+        };
+
+    enum TIntProperty 
+        { 
+        EIntBalance, //(From -100 to 100, 0 = center)
+        EIntReverb, //(from 1 to 8, 0 = default)
+        EIntStereo, //(default off)
+        EIntBassBoost, //(default off)
+        EIntLoudness, //(default off)
+        EIntNumItems 
+        };
+private:
+    inline const TDesC& Value(TDesProperty aProperty) const;
+    inline TInt Value(TIntProperty aProperty) const;
+    inline void SetValue(TDesProperty aProperty,const TDesC& aValue);
+    inline void SetValue(TIntProperty aProperty,TInt aValue);
+private:
+    //TFixedArray<HBufC*,EDesNumItems> iDesValues;
+    TFixedArray<TInt,EIntNumItems> iIntValues;
+    };
+
+#include "mpxaudioeffectproperties.inl"
+
+#endif // CMPXAUDIOEFFECTPROPERTIES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/inc/mpxaudioeffectproperties.inl	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,279 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Inline implementation of audio effect properties
+*
+*/
+
+#include  <s32file.h>
+#include  <s32std.h>
+#include <f32file.h>
+#include <mpxlog.h>
+
+_LIT( KMPXAudioEffectFileName, "c:\\system\\data\\mpxaudioeffect.dat" );
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+inline CMPXAudioEffectProperties::~CMPXAudioEffectProperties()
+    {
+    //iDesValues.DeleteAll();
+    }
+
+
+// -----------------------------------------------------------------------------
+// Return balance
+// -----------------------------------------------------------------------------
+//
+inline TInt CMPXAudioEffectProperties::Balance() const
+    {
+    return Value(EIntBalance);
+    }
+
+// -----------------------------------------------------------------------------
+// Set balance
+// -----------------------------------------------------------------------------
+//
+inline void CMPXAudioEffectProperties::SetBalance(TInt aBalance)
+    {
+    SetValue(EIntBalance, aBalance);
+    }
+
+// -----------------------------------------------------------------------------
+// Reverb value
+// -----------------------------------------------------------------------------
+//
+inline TInt CMPXAudioEffectProperties::Reverb() const
+    {
+    return Value(EIntReverb);
+    }
+
+// -----------------------------------------------------------------------------
+// Set reverb
+// -----------------------------------------------------------------------------
+//
+inline void CMPXAudioEffectProperties::SetReverb(TInt aReverb)
+    {
+    SetValue(EIntReverb, aReverb);
+    }
+
+// -----------------------------------------------------------------------------
+// Stereo value
+// -----------------------------------------------------------------------------
+//
+inline TBool CMPXAudioEffectProperties::Stereo() const
+    {
+    return Value(EIntStereo);
+    }
+
+// -----------------------------------------------------------------------------
+// Set bass boost
+// -----------------------------------------------------------------------------
+//
+inline void CMPXAudioEffectProperties::SetStereo(TBool aStereo)
+    {
+    SetValue(EIntStereo, aStereo);
+    }
+
+// -----------------------------------------------------------------------------
+// Bass boost value
+// -----------------------------------------------------------------------------
+//
+inline TBool CMPXAudioEffectProperties::BassBoost() const
+    {
+    return Value(EIntBassBoost);
+    }
+
+// -----------------------------------------------------------------------------
+// Set bass boost
+// -----------------------------------------------------------------------------
+//
+inline void CMPXAudioEffectProperties::SetBassBoost(TBool aBassBoost)
+    {
+    SetValue(EIntBassBoost, aBassBoost);
+    }
+
+// -----------------------------------------------------------------------------
+// Bass boost value
+// -----------------------------------------------------------------------------
+//
+inline TBool CMPXAudioEffectProperties::Loudness() const
+    {
+    return Value(EIntLoudness);
+    }
+
+// -----------------------------------------------------------------------------
+// Set loudness
+// -----------------------------------------------------------------------------
+//
+inline void CMPXAudioEffectProperties::SetLoudness(TBool aLoudness)
+    {
+    SetValue(EIntLoudness, aLoudness);
+    }
+    
+// -----------------------------------------------------------------------------
+// Externalize properties
+// -----------------------------------------------------------------------------
+//
+inline void CMPXAudioEffectProperties::ExternalizeL(RWriteStream& aStream) const
+    {
+    MPX_DEBUG1("CMPXAudioEffectProperties::ExternalizeL <---");
+    for (TInt i=0;i<EIntNumItems;++i)
+        {
+        aStream.WriteInt32L(iIntValues[i]);
+        MPX_DEBUG2("CMPXAudioEffectProperties::ExternalizeL  -- %i", iIntValues[i]);
+        }
+
+    //for (TInt ii=0;ii<EDesNumItems;++ii)
+    //    {
+    //    aStream.WriteInt32L(Value(static_cast<TDesProperty>(ii)).Length());
+    //    aStream << Value(static_cast<TDesProperty>(ii));
+    //    }
+    MPX_DEBUG1("CMPXAudioEffectProperties::ExternalizeL --->");
+    }
+
+// -----------------------------------------------------------------------------
+// Internalize properties
+// -----------------------------------------------------------------------------
+//
+inline void CMPXAudioEffectProperties::InternalizeL(RReadStream& aStream)
+    {
+    MPX_DEBUG1("CMPXAudioEffectProperties::InternalizeL <---");
+    for (TInt i=0;i<EIntNumItems;++i)
+        {
+        iIntValues[i]=aStream.ReadInt32L();
+        MPX_DEBUG2("CMPXAudioEffectProperties::InternalizeL  -- %i", iIntValues[i]);
+        }
+    //for (TInt ii=0;ii<EDesNumItems;++ii)
+    //    {
+    //    delete iDesValues[ii];
+    //    iDesValues[ii] = NULL;
+    //    iDesValues[ii] = HBufC::NewL(aStream,aStream.ReadInt32L());
+    //    }
+    MPX_DEBUG1("CMPXAudioEffectProperties::InternalizeL --->");
+    }
+
+// -----------------------------------------------------------------------------
+// Get value of a descriptor property
+// -----------------------------------------------------------------------------
+//
+inline const TDesC& CMPXAudioEffectProperties::Value(TDesProperty /*aProperty*/) const
+    {
+    //return iDesValues[aProperty] ? 
+    //       static_cast<const TDesC&>(*iDesValues[aProperty]) : KNullDesC;
+    return KNullDesC;
+    }
+
+// -----------------------------------------------------------------------------
+// Get value of an integer property
+// -----------------------------------------------------------------------------
+//
+inline TInt CMPXAudioEffectProperties::Value(TIntProperty aProperty) const
+    {
+    return iIntValues[aProperty];
+    }
+    
+// -----------------------------------------------------------------------------
+// Set value of a descriptor property
+// -----------------------------------------------------------------------------
+//
+inline void CMPXAudioEffectProperties::SetValue(TDesProperty /*aProperty*/,
+                                          const TDesC& /*aValue*/)
+    {
+    //delete iDesValues[aProperty];
+    //iDesValues[aProperty]=aValue.Alloc();
+    }
+    
+// -----------------------------------------------------------------------------
+// Set value of an integer property
+// -----------------------------------------------------------------------------
+//
+inline void CMPXAudioEffectProperties::SetValue(TIntProperty aProperty,TInt aValue)
+    {
+    iIntValues[aProperty]=aValue;
+    }
+
+// -----------------------------------------------------------------------------
+// Reset all values to 0 or NULL
+// -----------------------------------------------------------------------------
+//
+inline void CMPXAudioEffectProperties::Reset()
+    {
+    MPX_DEBUG1("CMPXAudioEffectProperties::Reset");
+    for (TInt i=0;i<EIntNumItems;++i)
+        {
+        iIntValues[i] =0;
+        }
+    //for (TInt ii=0;ii<EDesNumItems;++ii)
+    //    {
+    //    delete iDesValues[ii];
+    //    iDesValues[ii]=NULL;
+    //    }
+    }
+   
+// -----------------------------------------------------------------------------
+// Save to file
+// -----------------------------------------------------------------------------
+// 
+inline void CMPXAudioEffectProperties::SaveToFileL() const
+    {
+    MPX_DEBUG1("CMPXAudioEffectProperties::SaveToFileL <---");
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL(fs);
+    fs.MkDirAll( KMPXAudioEffectFileName  );
+    TParse parsedName;
+    fs.Parse( KMPXAudioEffectFileName, parsedName );
+    CFileStore* store = CDirectFileStore::ReplaceLC(fs, 
+                                                    parsedName.FullName(), 
+                                                    EFileWrite);
+    store->SetTypeL( KDirectFileStoreLayoutUid );
+    RStoreWriteStream stream;
+    TStreamId id = stream.CreateLC( *store );
+    this->ExternalizeL(stream);
+    stream.CommitL();
+    CleanupStack::PopAndDestroy();
+    store->SetRootL( id );
+    store->CommitL();
+    CleanupStack::PopAndDestroy();
+    CleanupStack::PopAndDestroy(&fs);
+    MPX_DEBUG1("CMPXAudioEffectProperties::SaveToFileL --->");
+    }
+
+// -----------------------------------------------------------------------------
+// Load from file
+// -----------------------------------------------------------------------------
+//  
+inline void CMPXAudioEffectProperties::LoadFromFileL()
+    {
+    MPX_DEBUG1("CMPXAudioEffectProperties::LoadFromFileL <---");
+    RFs fs;
+    User::LeaveIfError( fs.Connect() );
+    CleanupClosePushL(fs);
+    fs.MkDirAll( KMPXAudioEffectFileName );
+    TParse parsedName;
+
+    fs.Parse( KMPXAudioEffectFileName, parsedName );
+    CFileStore* store = CDirectFileStore::OpenLC(fs, 
+                                                 parsedName.FullName(), 
+                                                 EFileRead );
+    RStoreReadStream stream;
+    stream.OpenLC( *store, store->Root() );
+    this->InternalizeL(stream);
+    CleanupStack::PopAndDestroy(); //store
+    CleanupStack::PopAndDestroy(); //stream
+    CleanupStack::PopAndDestroy(&fs);
+    MPX_DEBUG1("CMPXAudioEffectProperties::LoadFromFileL --->");
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project collection plugins
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../mpxsqlitedbcommon/group/bld.inf"
+#include "../mpxsqlitedbplugin/group/bld.inf"
+#include "../mpxsqlitedbhgplugin/group/bld.inf"
+#include "../mpxinmemoryplugin/group/bld.inf"
+#include "../mpxsqlitepodcastdbplugin/group/bld.inf"
+
+PRJ_EXPORTS
+../rom/mpxsqlitedbcommon.iby                CORE_APP_LAYER_IBY_EXPORT_PATH(mpxsqlitedbcommon.iby)
+../rom/mpxsqlitedbplugin.iby                CORE_APP_LAYER_IBY_EXPORT_PATH(mpxsqlitedbplugin.iby)
+../rom/mpxsqlitedbpluginrsc.iby             LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxsqlitedbpluginrsc.iby)
+../rom/mpxsqlitedbhgplugin.iby              CORE_APP_LAYER_IBY_EXPORT_PATH(mpxsqlitedbhgplugin.iby)
+../rom/mpxsqlitedbhgpluginrsc.iby           LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxsqlitedbhgpluginrsc.iby)
+../rom/mpxinmemplugin.iby                   CORE_APP_LAYER_IBY_EXPORT_PATH(mpxinmemplugin.iby)
+../rom/mpxsqlitepodcastdbplugin.iby         CORE_APP_LAYER_IBY_EXPORT_PATH(mpxsqlitepodcastdbplugin.iby)
+../rom/mpxsqlitepodcastdbpluginrsc.iby      LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxsqlitepodcastdbpluginrsc.iby)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/inc/mpxdbactivetask.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,152 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Active object to split up long running tasks
+*
+*/
+
+
+#ifndef C_MPXDBACTIVETASK_H
+#define C_MPXDBACTIVETASK_H
+
+#include <mpxcommand.h>
+#include <mpxmessage2.h>
+
+/**
+* Observer class to the active task object
+*/
+NONSHARABLE_CLASS( MMPXDbActiveTaskObserver )
+    {
+public:
+    /**
+    * Handle the execution of a step
+    * @return ETrue if complete, EFalse if more to do
+    */
+    virtual TBool HandleStepL() = 0;
+    /**
+    * Handle the completion of the operation
+    */
+    virtual void HandleOperationCompleted( TInt aErr ) = 0;
+    };
+
+/**
+ *  Active object to execute tasks in multiple steps
+ *  Each collection plugin has its own task queue, which serializes all
+ *  operations for a plugin
+ *  @lib mpxdbplugin
+ *  @since S60
+ */
+NONSHARABLE_CLASS( CMPXDbActiveTask ) : public CActive
+    {
+public:
+    /**
+    * Two-phased constructor
+    */
+    IMPORT_C static CMPXDbActiveTask* NewL( MMPXDbActiveTaskObserver& aObserver );
+
+    /**
+    * Destructor
+    */
+    IMPORT_C virtual ~CMPXDbActiveTask();
+
+public:    // Accessor functions
+
+    /**
+    * Start the async command task
+    * @param aTask task id
+    * @param aCommand command for the operation
+    */
+    IMPORT_C void StartL( TMPXCommandId aTask, const CMPXCommand& aCommand );
+
+    /**
+    * Get the current step for the current task
+    * @return the current step
+    */
+    IMPORT_C TInt GetStep();
+
+    /*
+    * Get the command for the current task
+    * @return the current task
+    */
+    IMPORT_C TMPXCommandId GetTask();
+
+    /**
+    * Get the command for the current task
+    * @return the current command
+    */
+    IMPORT_C CMPXCommand& GetCommand();
+
+    /**
+    * Get the current change message array
+    * @return get the change messages
+    */
+    IMPORT_C CMPXMessageArray& GetChangeMessages();
+
+    enum TChangeVisibility
+        {
+        ENotVisibile,
+        ESingleVisible,
+        EAllVisible
+        };
+    /**
+    * Set if the change is visible
+    * @param aChange change state
+    */
+    IMPORT_C void SetVisibleChange( TChangeVisibility aChange );
+
+    /**
+    * Return if the change is visible
+    * @return visible change state
+    */
+    IMPORT_C TChangeVisibility GetVisibleChange();
+
+protected: // From base class
+
+    /**
+    * From CActive
+    */
+    IMPORT_C void RunL();
+
+    /**
+    * From CActive
+    */
+    IMPORT_C void DoCancel();
+
+    /**
+    * From CActive
+    */
+    IMPORT_C TInt RunError( TInt aError );
+
+private:
+
+    /**
+    * Default Constructor
+    */
+    CMPXDbActiveTask(MMPXDbActiveTaskObserver& aObserver);
+
+    /**
+    * 2nd-phase Constructor
+    */
+    void ConstructL();
+
+private: // data
+
+    CMPXCommand*  iCurCommand;  // Current Command
+    TMPXCommandId iCurTask;  // The task command id
+    TInt          iCurStep;  // The n-th stop in the operation
+    TChangeVisibility iCurVisibleChange; // Is the operation UI visible
+    CMPXMessageArray* iChangeMessages; // Change message array
+    MMPXDbActiveTaskObserver& iObserver; // Observer
+    };
+
+#endif // C_MPXDBACTIVETASK_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/inc/mpxdbcommondef.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This header file contains macro definitions used by the database
+*                subsystem.
+*
+*/
+
+#ifndef MPXDBCOMMONDEF_H
+#define MPXDBCOMMONDEF_H
+
+#include <e32def.h>
+#include <e32cmn.h>
+
+// Literals to speed up mcdb by not having to create TPtr's at runtime */
+_LIT(KMCSingleQuote, "'");
+_LIT(KMCBackSlash, "\\");
+_LIT(KMCPercentage, "%");
+_LIT(KMCUnderscore, "_");
+_LIT(KMCCommaSign, ",");
+_LIT(KMCEqualSign, " = ");
+_LIT(KMCOpenBracket, "(");
+_LIT(KMCCloseBracket, ")");
+_LIT(KMCAndKeyword," AND ");
+_LIT(KMCOrKeyword, " OR ");
+
+#endif // MPXDBCOMMONDEF_H
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/inc/mpxdbcommonstd.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This header file contains constants definitions and type
+*                definition
+*
+*/
+
+
+#ifndef MPXDBCOMMONSTD_H
+#define MPXDBCOMMONSTD_H
+
+//  INCLUDES
+#include <e32std.h>
+#include <f32file.h>
+
+// MACROS
+#define SET_BIT(x,y) (x |= y)
+#define GET_BIT(x,y) (x & y)
+#define RESET_BIT(x,y) (x &= ~y)
+
+#define MPX_ITEM_CATEGORY(x) static_cast<TMPXGeneralCategory>((x >> 28) & KMCCategoryMask)
+
+// CONSTANTS
+const TInt KMCIntegerLen          = 11; //-2147483648
+const TInt KMCInt64Len            = 20; //-9223372036854775808
+
+const TInt KMCPathStartWithColon  = 1;  // Look for ":\\"
+const TInt KMCPathStartPos        = 2;  // e.g. "C:\\Path\\Name.Ext"
+const TInt KMCCategoryMask        = 0x0F;
+
+// Maximum number of deleted records kept in DB
+const TInt KMCMaxSavedDeletedRecords = 2000;
+
+// DRM types used
+enum TMCDrmType
+    {
+    EMCDrmNone,
+    EMCDrmOmaDrm,
+    EMCDrmWmdrm
+    };
+
+// Reasons for collection server Panic
+enum TMCDbPanic
+    {
+    };
+
+// FUNCTION PROTOTYPES
+GLREF_C void MCDbPanic(TMCDbPanic aPanic);
+
+#endif // MPXDBCOMMONSTD_H
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/inc/mpxdbcommonutil.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,431 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The class MPXDbCommonUtil which contains utilities functions
+*
+*/
+
+
+#ifndef MPXDBCOMMONUTIL_H
+#define MPXDBCOMMONUTIL_H
+
+// INCLUDES
+#include <apmstd.h>
+#include <f32file.h>
+#include <badesca.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxmessage2.h>
+#include <mpxcollectionpath.h>
+
+#include "mpxdbcommonstd.h"
+
+
+// FORWARD DECLARATIONS
+class CMPXRowSet;
+class CMPXDatabase;
+class CMPXMedia;
+class CMPXMediaArray;
+class RSqlStatement;
+
+// CLASS DECLARATION
+
+/**
+* This static class contains utilities functions used by MPX Collection DB Plugins
+*/
+class MPXDbCommonUtil
+    {
+
+    public:
+
+        /**
+        * Set HBufC data member.
+        * Free the memory and set the aBuf to the new location.
+        * @param aBuf, the buf to be set
+        * @param aSource, source descriptor
+        * @param aMaxLen, max length allowed in aBuf, -1 is unlimited.
+        * @return KErrOverflow if the length of source is greater than MaxLen
+        */
+        IMPORT_C static TInt SetHBuf(HBufC*& aBuf,
+                            const TDesC* aSource,
+                            TInt aMaxLen = -1);
+
+        /**
+        * Replace the single quote in the SQL string
+        * @param aSrc source descriptor
+        * @param aTrg target descriptor
+        */
+        IMPORT_C static void FindAndReplaceSingleQuote(const TDesC& aSrc, TDes& aTrg);
+
+        /**
+        * Delete from file system (includes read-only files)
+        * @param aFs File server session handle
+        * @param aFile File path to be deleted
+        * @return KErrNone if file deleted successfully
+        *         System-wide error code otherwise
+        */
+        IMPORT_C static TInt DeleteFile(RFs& aFs, const TDesC& aFile);
+
+        /**
+        * Get the drive Id with a given volume unique Id
+        * @param aFs File server session handle
+        * @param aVolumeId volume ID to match
+        * @return drive Id. If volume Id not found, return KErrNotFound
+        */
+        IMPORT_C static TInt GetDriveIdMatchVolIdL(RFs& aFs, TUint aVolumeId);
+
+        /**
+        * Get the volume Id with a given drive Id
+        * @param aFs File server session handle
+        * @param aDriveId: a drive ID to match
+        * @return volume Id. If no correspending media is found for given
+        *         aDriveId, 0 will return
+        */
+        IMPORT_C static TUint GetVolIdMatchDriveIdL(RFs& aFs, TInt aDriveId);
+
+        /**
+        * Generate a 32bits Unique Id with MD5
+        * If the input is a filename, only the path part will be hashed
+        * The drive part of the path will be replaced by the corresponding
+        * volume Id in order to maintain uniquenss as one media may mount as
+        * different drive letter in different devices
+        * @param aFs File server session handle
+        * @param aTableId Use category as table Id
+        * @param aName Category name or file name as input to encoder
+        * @param aCaseSensitve ETrue if case sensitivity should be taken
+        *                      into account when generating unique ID
+        * @return unique Id
+        * NOTE If aName given is a path and the drive/media doesn't
+        * exist (e.g. MMC not inserted), full path will be hashed
+        */
+        IMPORT_C static TUint32 GenerateUniqueIdL(RFs& aFs, TMPXGeneralCategory aTableId,
+            const TDesC& aName, TBool aCaseSensitive);
+
+        /**
+        * Create a media object with title, type, category and ID and append it to the media array
+        * @param aArray media array
+        * @param aTitle title
+        * @param aType attribute type
+        * @param aCat attribute category
+        * @param aId unique ID
+        * @param aNonPermissibleActions bitmask specifying the non-permissible actions for the entry
+        * @param aDbflag Dbflag value for the new media entry
+        */
+        IMPORT_C static void AppendMediaL(CMPXMediaArray& aArray, const TDesC& aTitle, TMPXGeneralType aType,
+            TMPXGeneralCategory aCat, TMPXItemId aId = 0, TInt aNonPermissibleActions = 0,
+            TUint aDbflag = 0);
+
+        /**
+        * Create a media object with title, type, category and ID and prepend it to the media array
+        * @param aArray media array
+        * @param aTitle title
+        * @param aType attribute type
+        * @param aCat attribute category
+        * @param aId unique ID
+        * @param aNonPermissibleActions bitmask specifying the non-permissible actions for the entry
+        * @param aDbflag Dbflag value for the new media entry
+        * @param aPos postion of the new item, 0 is the first item
+        */
+        IMPORT_C static void PrependMediaL(CMPXMediaArray& aArray, const TDesC& aTitle, TMPXGeneralType aType,
+            TMPXGeneralCategory aCat, TMPXItemId aId = 0, TInt aNonPermissibleActions = 0,
+            TUint aDbflag = 0,
+            TInt aPos = 0);
+
+        /**
+        * Fill in the supported UID array based on what is requested in the attribute array
+        * @param aAttrs requested attributes
+        * @param aSupportedIds supported UID array
+        */
+        IMPORT_C static void FillInSupportedUIDsL(const TArray<TMPXAttribute>& aAttrs, RArray<TInt>& aSupportedIds);
+
+        /**
+        * Fill in the message with item changed information
+        * @param aMessage a message to be filled with the supplied information
+        * @param aId item id
+        * @param aChangeType change type
+        * @param aCategory category of the item changed
+        * @param aUid plugin UID
+        * @param aDeprecatedId deprecated id of the item after it's been moved/renamed
+        */
+        IMPORT_C static void FillItemChangedMessageL(CMPXMessage& aMessage, TMPXItemId aId,
+            TMPXChangeEventType aChangeType, TMPXGeneralCategory aCategory, TUint aUid,
+            TMPXItemId aDeprecatedId = 0);
+
+        /**
+        * Constructs an item changed message and adds it to the array
+        * @param aMessageArray array to add the message to
+        * @param aId item ID
+        * @param aChangeType change type
+        * @param aCategory category of the item changed
+        * @param aUid plugin UID
+        * @param aDeprecatedId deprecated id of the item after it's been moved/renamed
+        */
+        IMPORT_C static void AddItemChangedMessageL(CMPXMessageArray& aMessageArray, TMPXItemId aId,
+            TMPXChangeEventType aChangeType, TMPXGeneralCategory aCategory, TUint aUid,
+            TMPXItemId aDeprecatedId = 0);
+
+        /**
+        * Find the matching item changed message from the array
+        * @param aMessageArray array containing item changed messages
+        * @param aMessage the message to search for in the array.
+        * @return KErrNotFound if the message cannot be found in the array; otherwise,
+        *         the index of the 1st matching message in the array.
+        */
+        IMPORT_C static TInt FindItemChangedMessageL(const CMPXMessageArray& aMessageArray,
+            const CMPXMessage& aMessage);
+
+        /**
+        * Get the DRM protection type of the file
+        * @param aFile the file to retrieve the DRM type
+        * @return DRM protection type of the file
+        */
+        IMPORT_C static TMCDrmType GetDRMTypeL(const TDesC& aFile);
+
+        /**
+        * Processes the string for single quotes
+        * @param aString source string
+        * @return processed string
+        */
+        IMPORT_C static HBufC* ProcessSingleQuotesLC(const TDesC& aString);
+
+        /**
+        * Processes the string for pattern characters so that they will be treated
+        * as normal characters.
+        * @param aString source string
+        * @return processed string where those pattern characters will no longer be
+        *         treated as special characters, they will be treated as regular
+        *         characters.
+        */
+        IMPORT_C static HBufC* ProcessPatternCharsLC(const TDesC& aString);
+
+        /**
+        * Constructs an SQL criterion (name = value)
+        * @param aCriterion name string
+        * @param aValue value
+        * @return criterion string on the CS
+        */
+        IMPORT_C static HBufC* SqlCriterionLC(
+            const TDesC& aCriterion, TInt aValue);
+
+        /**
+        * Constructs an SQL criterion (name = value)
+        * @param aCriterion name string
+        * @param aValue value
+        * @return criterion string on the CS
+        */
+        IMPORT_C static HBufC* SqlCriterion64LC(
+            const TDesC& aCriterion, TInt64 aValue);
+
+        /**
+        * Constructs an SQL criterion (name = value)
+        * @param aCriterion name string
+        * @param aValue1 value1
+        * @param aValue2 value2
+        * @return criterion string on the CS
+        */
+        IMPORT_C static HBufC* SqlCriterionLC(
+            const TDesC& aCriterion, TInt aValue1, TInt aValue2);
+
+        /**
+        * Constructs an SQL criterion (name = value)
+        * @param aCriterion name string
+        * @param aValue1 TInt64 value1
+        * @param aValue2 TInt64 value2
+        * @return criterion string on the CS
+        */
+        IMPORT_C static HBufC* SqlCriterion64LC(
+            const TDesC& aCriterion, TInt64 aValue1, TInt64 aValue2);
+
+        /**
+        * Constructs an SQL criterion (name = value)
+        * @param aCriterion name string
+        * @param aValue value string
+        * @return criterion string on the CS
+        */
+        IMPORT_C static HBufC* SqlCriterionLC(
+            const TDesC& aCriterion, const TDesC& aValue);
+
+        /**
+        * Constructs an SQL criterion (name = value)
+        * @param aCriterion name string
+        * @param aValue1 value1
+        * @param aValue2 value2
+        * @return criterion string on the CS
+        */
+        IMPORT_C static HBufC* SqlCriterionLC(
+            const TDesC& aCriterion, const TDesC& aValue1, const TDesC& aValue2);
+
+        /**
+        * Constructs an SQL criterion (name = value)
+        * @param aCriterion name string
+        * @param aValue1 value1
+        * @param aValue2 value2
+        * @param aValue3 value3
+        * @param aValue4 value4
+        * @return criterion string on the CS
+        */
+        IMPORT_C static HBufC* SqlCriterionLC(
+            const TDesC& aCriterion, const TDesC& aValue1, TInt aValue2,
+            const TDesC& aValue3, TInt aValue4);
+
+        /**
+        * Constructs an SQL criterion (name = value) and adds it to the array
+        * @param aCriteriaArray array to add the criterion to
+        * @param aCriterion name
+        * @param aValue value
+        * @return number of characters in the criterion string
+        */
+        IMPORT_C static TInt AddSqlCriterionL(CDesCArray& aCriteriaArray, const TDesC& aCriterion,
+            TInt aValue);
+
+        /**
+        * Constructs an SQL criterion (name = value) and adds it to the array
+        * @param aCriteriaArray array to add the criterion to
+        * @param aCriterion name
+        * @param aValue value
+        * @return number of characters in the criterion string
+        */
+        IMPORT_C static TInt AddSqlCriterionL(CDesCArray& aCriteriaArray, const TDesC& aCriterion,
+            const TDesC& aValue);
+
+        /**
+        * Create a full path with input drive Id and path
+        * @param aDriveId a drive Id to added in front of path
+        * @param aPath path contains path and filename
+        * @return created full path, ownership transferred to client
+        */
+        IMPORT_C static HBufC* CreateFullPathL(TInt aDriveId, const TDesC& aPath);
+
+        /**
+        * Appends a name and a string value to the parameter arrays.
+        * @param aFields field names array to append to
+        * @param aValues field values array to append to
+        * @param aField field name
+        * @param aValue field value
+        */
+        IMPORT_C static void AppendValueL(CDesCArray& aFields, CDesCArray& aValues,
+            const TDesC& aField, const TDesC& aValue);
+
+        /**
+        * Appends a name and an int value to the parameter arrays.
+        * @param aFields field names array to append to
+        * @param aValues field values array to append to
+        * @param aField field name
+        * @param aValue field value
+        */
+        IMPORT_C static void AppendValueL(CDesCArray& aFields, CDesCArray& aValues,
+            const TDesC& aField, TUint32 aValue);
+
+        /**
+        * Returns the MIME type for a given URI
+        * @param aUri URI
+        * @return the MIME type
+        */
+        IMPORT_C static TDataType GetMimeTypeForUriL(const TDesC& aUri);
+
+        /**
+        * Constructs a string from the specified array like:
+        *   <item1>aSeparator<item2>aSeparator...<itemN>
+        * @param aArray source array
+        * @param aSeparator separator string
+        * @return constructed string on the CS
+        */
+        IMPORT_C static HBufC* StringFromArrayLC(const CDesCArray& aArray, const TDesC& aSeparator);
+
+        /**
+        * Constructs a string from two arrays like:
+        *   <aNameArray.item1>aValueSeparator<aValueArray.item1>aEntitySeparator...
+        * @param aNameArray array containing the names
+        * @param aValueArray array containing the values
+        * @param aValueSeparator value separator
+        * @param aEntitySeparator entity separator
+        * @return constructed string on the CS
+        */
+        IMPORT_C static HBufC* StringFromArraysLC(const CDesCArray& aNameArray,
+            const CDesCArray& aValueArray, const TDesC& aValueSeparator,
+            const TDesC& aEntitySeparator);
+
+        /**
+        * Converts TTime to a datetime string representation.
+        * @param aTime TTime object
+        * @return string containing date and time on the CS
+        */
+        IMPORT_C static HBufC* TTimeToDesLC(const TTime& aTime);
+
+        /**
+        * Converts string representation of datetime into TTime.
+        * @param aDateTime string, containing date and time
+        * @return aTime TTime object
+        */
+        IMPORT_C static TTime DesToTTimeL(const TDesC& aDateTime);
+
+        /**
+        * Returns the current time in the string format used by the database.
+        * @return string containing current date and time on the CS
+        */
+        IMPORT_C static HBufC* CurrentTimeDesLC();
+
+        /**
+        * Returns the current date in the string format used by the database.
+        * @return string containing current date on the CS
+        */
+        IMPORT_C static HBufC* CurrentDateDesLC();
+
+        /**
+        * Fills the drive from the URI. if the URI does not include a drive letter
+        * the method does not modify aDrive and returns KErrNotFound
+        * @param aUri URI to be analysed
+        * @param aDrive returns the drive
+        * @return system error code
+        */
+        IMPORT_C static TInt GetDriveL(const TDesC& aUri, TDriveUnit& aDrive);
+
+        /**
+        * Checks if a specified attribute exists in the attribute array
+        * @param aAttrs attribute array
+        * @param aAttribute attribute to be checked
+        * @return ETrue if the attribute exists, Efalse otherwise
+        */
+        IMPORT_C static TBool AttributeExists(const TArray<TMPXAttribute>& aAttrs,
+            const TMPXAttribute& aAttribute);
+
+        /**
+        * Reads the value of a text field. This method is required because on ARMv5
+        * the RSqlStatement::ColumnTextL method does not return KNullDesC for empty
+        * text fields.
+        * @param aStatement recordset to read the field from
+        * @param aField field index
+        * @return Text field value or KNullDesC if empty
+        */
+        IMPORT_C static TPtrC GetColumnTextL(RSqlStatement& aStatement, TInt aField);
+
+    private:
+        /**
+        * Create a media object with title, type, category and ID and push onto the CS.
+        * @param aTitle title
+        * @param aType attribute type
+        * @param aCat attribute category
+        * @param aId unique ID
+        * @param aNonPermissibleActions bitmask specifying the non-permissible actions for the entry
+        * @param aDbflag Dbflag value for the new media entry
+        */
+        static CMPXMedia* ConstructMediaLC(const TDesC& aTitle, TMPXGeneralType aType,
+            TMPXGeneralCategory aCat, TMPXItemId aId, TInt aNonPermissibleActions,
+            TUint aDbflag);
+    };
+
+#endif // MPXDBCOMMONUTIL_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/inc/mpxdbmanager.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,497 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for managing all of music collection
+*                databases.
+*
+*/
+
+
+#ifndef MPXDBMANAGER_H
+#define MPXDBMANAGER_H
+
+// INCLUDES
+
+#include <e32base.h>
+#include <f32file.h>
+#include <sqldb.h>
+#include <badesca.h>
+
+// FORWARD DECLARATIONS
+
+class MMPXTable;
+class RSqlStatement;
+
+// CONSTANTS
+
+const TInt KDbManagerAllDrives = 0;
+
+// CLASS DECLARATION
+
+/**
+* Generic class responsible for managing databases on multiple drives.
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbManager :
+    public CBase
+    {
+    protected: //   Constructors
+
+        /**
+        * C++ default constructor
+        * @param aFs file server session
+        */
+        IMPORT_C CMPXDbManager(RFs& aFs);
+
+        /**
+        * The second phase constructor to safely construct things
+        * that can leave
+        * @param aDatabaseFile database filename
+        */
+        IMPORT_C void ConstructL(const TFileName& aDatabaseFile);
+
+    public:
+
+        /**
+        * Destructor
+        */
+        IMPORT_C virtual ~CMPXDbManager();
+
+    public: // New methods
+
+        /**
+        * Checks if all databases have been initialized.
+        * @return ETrue if initialized, EFalse otherwise
+        */
+        IMPORT_C TBool IsInitialized();
+
+        /**
+        * Begins a transaction on all databases.
+        */
+        IMPORT_C void BeginL();
+
+        /**
+        * Commits a transaction on all databases.
+        */
+        IMPORT_C void CommitL();
+
+        /**
+        * Rolls back a transaction on all databases.
+        */
+        IMPORT_C void RollbackL();
+
+        /**
+        * Checks if the database is currently in a transaction
+        *
+        * @return ETrue if database is currently in a transaction, EFalse otherwise
+        */
+        IMPORT_C TBool InTransaction();
+
+        /**
+        * Tries to create and open the databases on all specified drives.
+        * If a drive is not valid (like an MC not plugged in) it will be skipped.
+        * @param aDrives array of drives to create and open databases on.
+        */
+        IMPORT_C void InitDatabasesL(RArray<TInt> aDrives);
+
+        /**
+        * Opens a specified database.
+        * @param aDrive identifies the drive index of the database to open
+        */
+        IMPORT_C void OpenDatabaseL(TInt aDrive);
+
+        /**
+        * Closes a specified database.
+        * @param aDrive identifies the drive index of the database to close
+        */
+        IMPORT_C void CloseDatabaseL(TInt aDrive);
+
+        /**
+        * Closes all open databases.
+        */
+        IMPORT_C void CloseAllDatabases();
+
+        /**
+        * Opens all open databases.
+        */
+        IMPORT_C void OpenAllDatabasesL();
+
+        /**
+        * Checks if the database on a specified drive is open.
+        * @param aDrive identifies the drive index of the database to check
+        * @return ETrue if the database is open, EFalse otherwise
+        */
+        IMPORT_C TBool IsOpen(TInt aDrive) const;
+
+        /**
+        * Returns the number of currently open databases.
+        * @return Number of databases
+        */
+        IMPORT_C TInt DatabaseCount() const;
+
+        /**
+        * Returns the drive corresponding to a give index.
+        * @param aIndex identifies the index in the list of drives the database uses
+        * @return Drive index the database uses.
+        */
+        IMPORT_C TInt DbDrive(TInt aIndex) const;
+
+        /**
+        * Recreate a specified database.
+        * @param aDrive identifies the drive index ro recreate the database
+        */
+        IMPORT_C void RecreateDatabaseL(TInt aDrive);
+
+        /**
+        * Recreate all databases.
+        */
+        IMPORT_C void RecreateAllDatabasesL();
+
+        /**
+        * Return current DB version
+        * @return the version of db structure
+        */
+        IMPORT_C TVersion Version() const;
+
+        /**
+        * Return current DB version
+        * @return the version of db structure
+        */
+        IMPORT_C void RegisterTableL(MMPXTable& aTable);
+
+        /**
+        * Executes a select query with variable number of parameters on all
+        * available drives.
+        * @param aFmt query format string
+        * @return resulted result set
+        */
+        IMPORT_C RSqlStatement ExecuteSelectQueryL(TRefByValue<const TDesC> aFmt, ...);
+
+        /**
+        * Executes a select query with variable number of parameters
+        * against a specified drive
+        * @param aDrive to execute query on
+        * @param aFmt query format string
+        * @return resulted result set
+        */
+        IMPORT_C RSqlStatement ExecuteSelectQueryL(TInt aDrive, TRefByValue<const TDesC> aFmt,
+            ...);
+
+        /**
+        * Executes a select query with variable number of parameters
+        * on all available drives. Two values will be bound to the statement
+        * @param aStatementId unique id of a statement to bind to
+        *                     creates a new statement if the id is not found
+        * @param aFirstValue TInt Value to bind as first argument
+        * @param aSecondValue TInt Value to bind as second argument
+        * @param aFmt query format string
+        * @return resulted result set. The ownership is not passed so the caller should
+        *         not destroy this as it may be reused in future calls.
+        */
+        IMPORT_C RSqlStatement& ExecuteSelectQueryL( TUint aStatementId,
+                                                     TInt aFirstValue, TInt aSecondValue,
+                                                     TRefByValue<const TDesC> aFmt, ...);
+
+        /**
+        * Executes a select query with variable number of parameters
+        * on all available drives. Two values will be bound to the statement
+        * @param aStatementId unique id of a statement to bind to
+        *                     creates a new statement if the id is not found
+        * @param aFirstValue TDesC Value to bind as first argument
+        * @param aSecondValue TInt Value to bind as second argument
+        * @param aFmt query format string
+        * @return resulted result set. The ownership is not passed so the caller should
+        *         not destroy this as it may be reused in future calls.
+        */
+        IMPORT_C RSqlStatement& ExecuteSelectQueryL( TUint aStatementId,
+                                                     const TDesC& aFirstValue,
+                                                     TInt aSecondValue,
+                                                     TRefByValue<const TDesC> aFmt, ...);
+        /**
+        * Executes a query that does not return a record set
+        * @param aDrive to execute query on
+        * @param aFmt query format string
+        */
+        IMPORT_C void ExecuteQueryL(TInt aDrive, TRefByValue<const TDesC> aFmt, ...);
+
+        /**
+        * Prints the contents of all the databases to the log file
+        * @param aDrive to execute query on
+        */
+        IMPORT_C void PrintDatabaseL();
+
+        /**
+        * Returns the file server session.
+        * @return file server session
+        */
+        IMPORT_C RFs& Fs();
+
+        /**
+        * Checks if the space on the specified drive(s) is above the critical level
+        * @param aDrive drive ID or KDbManagerAllDrives
+        * @leave KErrDiskFull if the space on the specified drive(s) is below the
+        *        critical level
+        */
+        IMPORT_C void CheckDiskSpaceL(TInt aDrive);
+
+        /**
+        * Completely recreate all databases.
+        */
+        IMPORT_C void RegenerateAllDatabasesL();
+        
+        /**
+         * Checks if the spefified drive is a remove drive
+         */      
+        IMPORT_C TBool IsRemoteDrive(TDriveNumber aDrive);
+
+    protected:
+
+        /**
+        * Creates a database on a specified drive.
+        * @param aDrive identifies the database
+        */
+        IMPORT_C void CreateDatabaseL(TInt aDrive);
+
+        /**
+        * Remove the database
+        * @param aDrive identifies the database
+        */
+        IMPORT_C void RemoveDatabaseL(TInt aDrive);
+
+        /**
+        * Create the all tables
+        * @param aDatabase the database to add tables to
+        */
+        IMPORT_C void CreateTablesL(RSqlDatabase& aDatabase);
+
+        /**
+        * Drop all tables
+        * @param aDatabase the database to drop tables from
+        */
+        IMPORT_C void DropTablesL(RSqlDatabase& aDatabase);
+        
+    public:
+    	
+        /**
+        * Executes a select query with variable number of parameters
+        * against a specified drive
+        * @param aDrive to execute query on
+        * @param aFmt query format string
+        * @return resulted result set
+        */
+        IMPORT_C RSqlStatement ExecuteSelectQueryOnAllDrivesL(TInt aDrive, TRefByValue<const TDesC> aFmt,
+            ...);
+
+    protected:  // Types
+
+        typedef struct
+            {
+            TInt iDrive;
+            TBool iOpen;
+            HBufC* iAliasname;
+            } DatabaseHandle;
+
+    protected:  // Data
+
+        HBufC* iDbFile;
+        RArray<MMPXTable*> iTables;
+        RSqlDatabase iDatabase;
+        RArray<DatabaseHandle> iDatabaseHandles;
+
+    private:
+
+        /**
+        * Create the all tables
+        * @param aDatabase the database to add tables to
+        * @param aCorrupt specifies whether the database is corrupted or not
+        */
+        void CreateTablesL(RSqlDatabase& aDatabase, TBool aCorrupt);
+
+        /**
+        * Opens a specified database.
+        * @param aDrive identifies the drive unit of the database to open
+        */
+        void OpenDatabaseL(TDriveUnit aDrive);
+
+        /**
+        * Creates a specified database.
+        * @param aDrive identifies the drive unit of the database to create
+        */
+        void CreateDatabaseL(TDriveUnit aDrive);
+
+        /**
+        * Attached a specified database.
+        * @param aDrive identifies the drive unit of the database to attach
+        */
+        void AttachDatabaseL(TDriveUnit aDrive);
+
+        /**
+        * Detach a specified database.
+        * @param aDrive identifies the drive unit of the database to detach
+        */
+        void DetachDatabaseL(TDriveUnit aDrive);
+
+        /**
+        * Create filename on a specified drive unit.
+        * @param aDrive identifies the drive unit
+        */
+        HBufC* CreateFilenameL(TDriveUnit aDrive);
+
+
+        /**
+        * Replaces specially formatted query symbols with a specified alias.
+        * @param aAlias identifies the alias name to use in query
+        */
+        void ReplaceDriveAlias(TDes& aQuery, const TDesC& aAlias);
+
+        /**
+        * Replaces specially formatted query symbols with a specified alias.
+        * @param aAlias identifies the alias name to use in query
+        * @param aToKen replace by aAlias
+        */
+        void ReplaceDriveAlias(TDes& aQuery, const TDesC& aAlias, const TDesC& aToKen);
+
+        /**
+        * Removes specially formatted query symbols from the query
+        * @param aQuery identifies the query to remove specially formatted symbols
+        */
+        void RemoveDriveAlias(TDes& aQuery);
+        
+        /**
+        * Removes specially formatted query symbols from the query
+        * @param aQuery identifies the query to remove specially formatted symbols
+        * @param aToKen identifies need remove string
+        */
+        void RemoveDriveAlias(TDes& aQuery, const TDesC& aToKen);
+
+        /**
+        * Attempts to recreate database by dropping and creating tables
+        * used inside RecreateDatabaseL
+        * @param aFilename database filename
+        */
+        void DoRecreateDatabaseL(HBufC * aFilename);
+
+        /**
+         * Executes SQL statement against the database.
+         *
+         * @param aDatabase database handle
+         * @param aStatement sql statement buffer
+         * @return KErrNone if successfull, error code otherwise.
+         *
+         */
+        TInt ExecuteSqlStatement(RSqlDatabase& aDatabase, const TDesC& aStatement);
+
+        /**
+        * Formats the query.
+        * @param aFmt query format
+        * @param aList variable parameter list
+        * @return formatted query, the ownership is transferred.
+        */
+        HBufC* FormatQueryLC(TRefByValue<const TDesC> aFmt, VA_LIST aList);
+
+        /**
+        * Executes an SQL query on all drives
+        * @param aQuery query string
+        * @return prepared SQL statement
+        */
+        RSqlStatement ExecuteSelectQueryOnAllDrivesL(TPtr aQuery);
+        
+        /**
+        * Executes an SQL query on all drives
+        * @param aDrive drive to execute the query on
+        * @param aQuery query string
+        * @return prepared SQL statement
+        */
+        RSqlStatement ExecuteSelectQueryOnAllDrivesL(TInt aDrive,TPtr aQuery);
+
+        /**
+        * Executes an SQL query on a specified drive
+        * @param aDrive drive to execute the query on
+        * @param aQuery query string
+        * @return prepared SQL statement
+        */
+        RSqlStatement ExecuteSelectQueryOnDriveL(TInt aDrive, TPtr aQuery);
+
+        /**
+        * Prepares an sql query given the statment
+        * @param aStatementId unique identifier of the statement
+        * @param aFmt query format string
+        * @param aList variable parameter list
+        * @return reference to the SQL statement
+        */
+        RSqlStatement& PrepareQueryL( TUint aStatementId,
+                                      TRefByValue<const TDesC> aFmt,
+                                      VA_LIST aList );
+
+        /**
+        * Resets all prepared queries
+        */
+        void ResetPreparedQueries();
+
+        /**
+        * Create Database
+        */
+        void DoCreateDatabaseL( TDriveUnit aDrive );
+        
+#ifdef _DEBUG
+
+        /**
+        * Returns the number of columns from a specified SQL statement
+        * @param aStatement identifies the SQL query to check
+        */
+        TInt GetColumnCountL(RSqlStatement& aStatement);
+
+        /**
+        * Prints the table of results from a specified SQL query to the debug log
+        * @param aStatement identifies the SQL query made
+        */
+        void PrintTableValuesL(RSqlStatement& aStatement);
+
+        /**
+        * Finds all the tables on the main or attached drives
+        * @param aAlias identifies the alias name to use if a attached drive KNullDesC if main drive
+        * @param aTableName identifies the array of table names on the main or attached drive
+        */
+        void FindAllTablesL(const TDesC& aAlias, RArray<HBufC*>& aTableName);
+
+        /**
+        * Prints the table on the main or attached drives
+        * @param aAlias identifies the alias name to use if a attached drive KNullDesC if main drive
+        * @param aTableName identifies the table name on the main or attached drive
+        */
+        void PrintTableL(const TDesC& aAlias, const TDesC& aTableName);
+
+#endif
+    private:
+
+        /*
+        * Structure to hold the state of a sql statement
+        */
+        NONSHARABLE_STRUCT( TSqlStatementState )
+            {
+            TBool iPrepared;
+            TUint iId;
+            };
+
+    private:
+
+        TBool iInitialized;
+        TInt iTransactionCount;
+        RFs& iFs;
+
+        RArray<TSqlStatementState> iPreparedStatements;
+        RPointerArray<RSqlStatement> iStatements;
+    };
+
+#endif  // MPXDBMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/inc/mpxdbtable.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,383 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Base class for all table classes.
+*
+*/
+
+
+#ifndef MPXDBTABLE_H
+#define MPXDBTABLE_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxattribute.h>
+#include "mpxtable.h"
+
+// CLASS FORWARDS
+class CMPXDbManager;
+class RSqlStatement;
+class CMPXMedia;
+class CMPXMediaArray;
+
+// CONSTANTS
+const TInt KMPXTableDefaultIndex = 0;
+
+// CLASS DECLARATION
+
+/**
+* Base class for all table classes
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbTable :
+    public CBase,
+    public MMPXTable
+    {
+    protected:
+
+        /**
+        * C++ constructor
+        * @param aDbManager database manager instance
+        */
+        IMPORT_C CMPXDbTable(CMPXDbManager& aDbManager);
+
+        /**
+        * Safely construct things that can leave
+        */
+        IMPORT_C void BaseConstructL();
+
+        /**
+        * Destructor
+        */
+        IMPORT_C virtual ~CMPXDbTable();
+
+    protected:
+
+        /**
+        * Update the media from the table. To be implemeted by derived classes, the default
+        * implemetation does nothing.
+        * @param aRecord table view
+        * @param aAttrs the attributes to return
+        * @param aMedia updated with the table info
+        */
+        IMPORT_C virtual void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Executes a query that retrieves information in a media array.
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aQuery query to be executed
+        */
+        IMPORT_C void ExecuteMediaQueryL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray, const TDesC& aQuery);
+
+        /**
+        * Executes a query that retrieves information in a media array.
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aAsc if the block is in ascending order
+        * @param aQuery query to be executed
+        */
+        IMPORT_C void ExecuteMediaQueryL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray, const TBool aAsc, const TDesC& aQuery);
+
+        /**
+        * Executes a query with an int parameter that retrieves information in a media array.
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aQuery query to be executed
+        * @param aValue integer parameter
+        */
+        IMPORT_C void ExecuteMediaQueryL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray, const TDesC& aQuery, TInt aValue);
+
+        /**
+        * Executes a query with one parameter that retrieves information in a media array.
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aQuery query to be executed
+        * @param aValue1 string parameter
+        * @param aValue2 integer parameter
+        */
+        IMPORT_C void ExecuteMediaQueryL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray, const TDesC& aQuery, const TDesC& aValue);
+
+        /**
+        * Executes a query with two int parameters that retrieves information in a media array.
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aQuery query to be executed
+        * @param aValue1 integer parameter
+        * @param aValue2 integer parameter
+        */
+        IMPORT_C void ExecuteMediaQueryL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray, const TDesC& aQuery, TInt aValue1, TInt aValue2);
+
+        /**
+        * Executes a query with two parameters that retrieves information in a media array.
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aQuery query to be executed
+        * @param aValue1 string parameter
+        * @param aValue2 integer parameter
+        */
+        IMPORT_C void ExecuteMediaQueryL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray, const TDesC& aQuery, const TDesC& aValue1, TInt aValue2);
+
+        /**
+        * Executes a query with two parameters that retrieves information in a media array.
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aQuery query to be executed
+        * @param aValue1 string parameter
+        * @param aValue2 string parameter
+        */
+        IMPORT_C void ExecuteMediaQueryL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray, const TDesC& aQuery, const TDesC& aValue1, const TDesC& aValue2);
+
+        /**
+        * Executes a query with four parameters that retrieves information in a media array.
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aQuery query to be executed
+        * @param aValue1 string parameter
+        * @param aValue2 integer parameter
+        * @param aValue3 string parameter
+        * @param aValue4 integer parameter
+        */
+        IMPORT_C void ExecuteMediaQueryL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray, const TDesC& aQuery,
+                const TDesC& aValue1, TInt aValue2,
+                const TDesC& aValue3, TInt aValue4);
+
+        /**
+        * Executes a query that retrieves information in a media item.
+        * @param aAttrs the attributes to return
+        * @param aMedia on return contains the result
+        * @param aQuery query to be executed
+        */
+        IMPORT_C void ExecuteMediaQueryL(const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia,
+            const TDesC& aQuery);
+
+        /**
+        * Executes a query with an int that retrieves information in a media item.
+        * @param aAttrs the attributes to return
+        * @param aMedia on return contains the result
+        * @param aQuery query to be executed
+        * @param aValue integer parameter
+        */
+        IMPORT_C void ExecuteMediaQueryL(const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia,
+            const TDesC& aQuery, TInt aValue);
+
+        /**
+        * Executes a query that returns an int field.
+        * @param aQuery query to be executed
+        * @return returned field value
+        */
+        IMPORT_C TUint32 ExecuteIntQueryL(const TDesC& aQuery);
+
+        /**
+        * Executes a query with an int parameter that returns an int field.
+        * @param aQuery query to be executed
+        * @param aValue integer parameter
+        * @return returned field value
+        */
+        IMPORT_C TUint32 ExecuteIntQueryL(const TDesC& aQuery, TUint32 aValue);
+
+        /**
+        * Executes a query with a string parameter that returns an int field.
+        * @param aQuery query to be executed
+        * @param aValue string parameter
+        * @return returned field value
+        */
+        IMPORT_C TUint32 ExecuteIntQueryL(const TDesC& aQuery, const TDesC& aValue);
+
+        /**
+        * Executes a query with a string and an int parameter that returns an int field.
+        * @param aQuery query to be executed
+        * @param aValue1 string parameter
+        * @param aValue2 int parameter
+        * @return returned field value
+        */
+        IMPORT_C TUint32 ExecuteIntQueryL(const TDesC& aQuery, const TDesC& aValue1, TUint32 aValue2);
+
+        /**
+        * Executes a query with two int parameters that returns an int field.
+        * @param aQuery query to be executed
+        * @param aValue1 int parameter
+        * @param aValue2 int parameter
+        * @return returned field value
+        */
+        IMPORT_C TUint32 ExecuteIntQueryL(const TDesC& aQuery, TUint32 aValue1, TUint32 aValue2);
+
+        /**
+         * Executes a query that returns an int field.
+         * @param aDriveID drive identifier
+         * @param aQuery query to be executed
+         * @return returned field value
+         */
+         IMPORT_C TUint32 ExecuteIntQueryL(TInt aDriveID,const TDesC& aQuery);
+
+        /**
+        * Executes a query that returns one or multiple records with one int field each.
+        * The int values are summed and the result returned.
+        * @param aQuery query to be executed
+        * @return sum of int values
+        */
+        IMPORT_C TInt ExecuteSumQueryL(const TDesC& aQuery);
+
+        /**
+        * Executes a sum query with an int parameter.
+        * @param aQuery query to be executed
+        * @param aValue int parameter
+        * @return sum of int values
+        */
+        IMPORT_C TInt ExecuteSumQueryL(const TDesC& aQuery, TUint32 aValue);
+
+        /**
+        * Executes a sum query with two int parameters.
+        * @param aQuery query to be executed
+        * @param aValue1 int parameter
+        * @param aValue2 int parameter
+        * @return sum of int values
+        */
+        IMPORT_C TInt ExecuteSumQueryL(const TDesC& aQuery,
+            TUint32 aValue1, TUint32 aValue2);
+
+        /**
+        * Executes a sum query with a string and an int parameter.
+        * @param aQuery query to be executed
+        * @param aValue1 string parameter
+        * @param aValue2 int parameter
+        * @return sum of int values
+        */
+        IMPORT_C TUint32 ExecuteSumQueryL(const TDesC& aQuery,
+            const TDesC& aValue1, TUint32 aValue2);
+
+        /**
+        * Executes a sum query with three int parameters.
+        * @param aQuery query to be executed
+        * @param aValue1 int parameter
+        * @param aValue2 int parameter
+        * @param aValue3 int parameter
+        * @return sum of int values
+        */
+        IMPORT_C TInt ExecuteSumQueryL(const TDesC& aQuery,
+            TUint32 aValue1, TUint32 aValue2, TUint32 aValue3);
+
+        /**
+        * Executes a sum query with a string and an int parameter.
+        * @param aQuery query to be executed
+        * @param aValue1 string parameter
+        * @param aValue2 string parameter
+        * @return sum of int values
+        */
+        IMPORT_C TInt ExecuteSumQueryL(const TDesC& aQuery,
+            const TDesC& aValue1, const TDesC& aValue2);
+
+        /**
+        * Executes a sum query with a string and an int parameter.
+        * @param aQuery query to be executed
+        * @param aValue string parameter
+        * @return sum of int values
+        */
+        IMPORT_C TInt ExecuteSumQueryL(const TDesC& aQuery, const TDesC& aValue);
+
+        /**
+        * Executes a sum query with a string and an int parameter.
+        * @param aQuery query to be executed
+        * @param aValue1 string parameter
+        * @param aValue2 int parameter
+        * @param aValue3 string parameter
+        * @param aValue4 int parameter
+        * @return sum of int values
+        */
+        IMPORT_C TInt ExecuteSumQueryL(const TDesC& aQuery,
+            const TDesC& aValue1, TUint32 aValue2, const TDesC& aValue3, TUint32 aValue4);
+
+
+        /**
+        * Executes a media query that is bound to a specific query id.
+        * If the query has not been prepared it will be prepared
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aQuery query to be executed
+        * @param aValue1 TInt value to be bound to the query
+        * @param aValue2 TInt value to be bound to the query
+        * @param aQueryId unique ID to identify the query
+        */
+        IMPORT_C void ExecuteMediaQueryL( const TArray<TMPXAttribute>& aAttrs,
+                                          CMPXMediaArray& aMediaArray,
+                                          const TDesC& aQuery,
+                                          TInt aValue1,
+                                          TInt aValue2,
+                                          TUint aQueryId );
+
+        /**
+        * Executes a media query that is bound to a specific query id.
+        * If the query has not been prepared it will be prepared
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aQuery query to be executed
+        * @param aValue1 value to be bound to the query
+        * @param aValue2 value to be bound to the query
+        * @param aAsc ascending or descending data retrival
+        * @param aQueryId unique ID to identify the query
+        */
+        IMPORT_C void ExecuteMediaQueryL( const TArray<TMPXAttribute>& aAttrs,
+                                          CMPXMediaArray& aMediaArray,
+                                          const TDesC& aQuery,
+                                          const TDesC& aTitle,
+                                          TInt aCount,
+                                          TBool aAsc,
+                                          TUint aQueryId );
+
+        /**
+        * Checks that the specified query can be executed.
+        * @param aDatabase database to execute the query on
+        * @param aQuery query to execute
+        * @return ETrue if the query can be executed, EFalse otherwise
+        */
+        IMPORT_C TBool DoCheckTable(RSqlDatabase& aDatabase, const TDesC& aQuery);
+
+        /**
+        * Executes a query with four parameters that retrieves information in a media array.
+        * @param aDrive integer parameter
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aQuery query to be executed
+        * @param aPlaylistId string parameter
+        */
+        IMPORT_C void ExecuteMediaQueryL(TInt aDrive, const TArray<TMPXAttribute>& aAttrs,
+        	CMPXMediaArray& aMediaArray,const TDesC& aQuery,TInt aPlaylistId);
+       
+        /**
+        * Executes a query with an int parameter that retrieves information in a media array.
+        * @param aDrive integer parameter
+        * @param aAttrs the attributes to return
+        * @param aMediaArray on return contains the results
+        * @param aQuery query to be executed
+        */
+        IMPORT_C void ExecuteMediaQueryOnDriveL(TInt aDrive,const TArray<TMPXAttribute>& aAttrs,
+        	    CMPXMediaArray& aMediaArray, const TDesC& aQuery);
+            
+    protected:    // Data
+
+        CMPXDbManager& iDbManager;
+    };
+
+#endif // MPXDBTABLE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/inc/mpxpluginresource.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers mpx collection plugins
+*
+*/
+
+
+#ifndef MPXCOLLECTIONPLUGIN_HRH
+#define MPXCOLLECTIONPLUGIN_HRH
+
+enum TMPXCollectionPluginNotCacheableIds
+    {
+    EDRMContentId = 0x101FFC45
+    };
+
+enum TMPXCollectionPluginFlags
+    {
+    EPreloadAndCache = 0x00010001 // EMPXPluginFlagPreLoad|EMPXCollectionPluginFlagCacheable
+    };
+
+#endif // MPXCOLLECTIONPLUGIN_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/inc/mpxresource.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class provide API to read resource from resource file
+*
+*/
+
+
+#ifndef CMPXRESOURCE_H
+#define CMPXRESOURCE_H
+
+//INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <barsc.h>
+
+// CLASS DECLARATION
+
+/**
+*  Resource class
+*  Singleton for one thread
+*/
+class CMPXResource : public CBase
+    {
+    public: // Factory and Release
+
+        /**
+        * Factory function, create the object.
+        * Note that calls to this must be matched with a call to Release().
+        *
+        * @param aResourceFile the resource file
+        *        In order to support installation of individual plugin.
+        *        aResourceFile must be a final name, including full file path.
+        *        All parse should be done in the plugin side.
+        *
+        * @return the resource object pointer
+        */
+        IMPORT_C static CMPXResource* NewL(const TDesC& aResourceFile);
+
+        /**
+        * Factory function, create the object.
+        * Note that calls to this must be matched with a call to Release().
+        * @param aResourceFile the resource file
+        *        In order to support installation of individual plugin.
+        *        aResourceFile must be a final name, including full file path.
+        *        All parse should be done in the plugin side.
+        *
+        * @return the resource object pointer
+        */
+        IMPORT_C static CMPXResource* NewLC(const TDesC& aResourceFile);
+
+        /**
+        * Decrements the reference count, and delete the object if it is 0
+        */
+        IMPORT_C void Release();
+
+    public: // New functions
+
+        /**
+        * Read array of descriptors
+        * @param aResourceId resource id
+        * @return array of descriptors. Ownership is abandoned.
+        */
+        IMPORT_C CDesCArrayFlat* ReadDesCArrayL(TInt aResourceId);
+
+        /**
+        * Read array of descriptors
+        * @param aResourceId resource id
+        * @return array of descriptors. Ownership is abandoned.
+        */
+        IMPORT_C CDesCArrayFlat* ReadDesCArrayLC(TInt aResourceId);
+
+        /**
+        * Get a heap descriptor from the resource file
+        * @param aResourceId resource id
+        * @return pointer to the heap descriptor.  Ownership is abandoned.
+        */
+        IMPORT_C HBufC* ReadHBufCL(TInt aResourceId);
+
+        /**
+        * Read array of menu items
+        * @param aResourceId resource id
+        * @param aIdArray array of Id within the specified resource
+        * @return array of descriptors
+        */
+        IMPORT_C CDesCArrayFlat* ReadMenuArrayL(TInt aResourceId, RArray<TInt>& aIdArray);
+
+        /**
+        * Read array of menu items
+        * @param aResourceId resource id
+        * @param aIdArray array of Id within the specified resource
+        * @return array of descriptors
+        */
+        IMPORT_C CDesCArrayFlat* ReadMenuArrayLC(TInt aResourceId, RArray<TInt>& aIdArray);
+
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CMPXResource();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL(const TDesC& aResourceFile);
+
+        /**
+        * Don't allow users to delete this object
+        * Release has to be called
+        */
+        virtual ~CMPXResource();
+
+
+    private: // Data
+        // Member variables
+        RFs               iFs;
+        RResourceFile     iResourceFile;
+    };
+
+#endif // CMPXRESOURCE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/inc/mpxtable.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is the interface required to be implemented by
+*                table classes used by the mpxdbmanager.
+*
+*/
+
+#ifndef MPXTABLE_H
+#define MPXTABLE_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class RSqlDatabase;
+
+// CLASS DECLARATION
+class MMPXTable
+{
+    public:
+    /**
+    * Create table query in the database
+    * @param aDatabase the database to create the table
+    * @param aCorruptTable indicates that the table is created because it was corrupt
+    * in the database
+    */
+    virtual void  CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable) = 0;
+
+    /**
+    * Drop table query in the database
+    * @param aDatabase the database to drop the table
+    */
+    virtual void DropTableL(RSqlDatabase& aDatabase) = 0;
+
+    /**
+    * Check that table is valid in the database
+    * @param aDatabase the database to check that the table exists and has correct fields
+    */
+    virtual TBool CheckTableL(RSqlDatabase& aDatabase) = 0;
+};
+
+#endif  // MPXTABLE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/data/101FFCD9.RSS	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+#include <mpxcollectionplugin.hrh>
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: Supported plugin types.
+ *  E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. for music plugin will be: 0x101FFCDA
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags, not used now
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXCollectionPluginPriorities. This value determines
+ *  the returning order when several plugins can support the same set of Uids. 
+ *  Default value of this field is EMPXCollectionPluginPriorityNormal.
+ */
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFCD9;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXCollectionPluginInterfaceUid;
+            implementations = 
+                {
+                /*
+                * Normal In memory plugin, can be used for any collection 
+                * To resolve this plugin, Resolve with UID: EMPXCollectionPluginTemporary
+                */
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x101FFCD8;
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "";
+                    opaque_data = "<t>"EMPXCollectionPluginHidden"</t>"
+                                  "<p>"EMPXCollectionPluginTemporary"</p>"
+                                  "<i>"EMPXPluginPriorityNormal"</i>"
+                                  "<f>"EMPXPluginFlagPreLoad"</f>";
+                    },
+                /*
+                * Normal In memory plugin, can be used for any collection 
+                * To resolve this plugin, Resolve with UID: EMPXCollectionPluginTemporary AND
+                *                                           EMPXCollectionPluginMusic         
+                */
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10282960;
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "";
+                    opaque_data = "<t>"EMPXCollectionPluginHidden"</t>"
+                                  "<p>"EMPXCollectionPluginTemporary"</p>"
+                                  "<p>"EMPXCollectionPluginMusic"</p>"
+                                  "<i>"EMPXPluginPriorityNormal"</i>"
+                                  "<f>"EMPXPluginFlagPreLoad"</f>";
+                    }
+                };
+            }
+        };
+    }
+            
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxinmemoryplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxinmemoryplugin.mmp
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/group/mpxinmemoryplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Collection file db plugin project specification
+*
+*/
+
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxinmemoryplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFCD9
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxinmemoryplugin.cpp
+SOURCE          mpxmusicmemoryplugin.cpp
+SOURCE          mpxinmemorypluginproxy.cpp
+
+SOURCEPATH      ../data
+START RESOURCE  101FFCD9.RSS
+TARGET          mpxinmemoryplugin.rsc
+END
+
+USERINCLUDE     ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+LIBRARY         apgrfx.lib
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+LIBRARY         bafl.lib 
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxmetadataextractor.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/inc/mpxinmemoryplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Simple plugin to cache media objects
+*
+*/
+
+
+
+#ifndef CMPXINMEMORYPLUGIN_H
+#define CMPXINMEMORYPLUGIN_H
+
+// INCLUDES
+#include <e32cmn.h>
+#include <mpxcollectionplugin.h>
+#include <mpxcollectionmessagedefs.h>
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXMediaArray;
+class CMPXDrmMediaUtility;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+*  CMPXInMemoryPlugin class 
+*
+*  Plug-in basically provides temporary in memory browsing
+*  @lib mpxinmemoryplugin.lib
+*/
+NONSHARABLE_CLASS(CMPXInMemoryPlugin) : public CMPXCollectionPlugin
+    {
+public: // Constructors and destructor
+
+    
+    /**
+    * Two-phased constructor
+    *
+    * @param aInitParams, initialization parameter
+    * @return object of constructed
+    */
+    static CMPXInMemoryPlugin* NewL();
+
+    /**
+    * Destructor
+    */
+    virtual ~CMPXInMemoryPlugin();
+    
+protected: // Functions from base classes
+    /**
+    *  from CMPXCollectionPlugin
+    */
+
+    /** 
+    * From CMPXCollectionPlugin
+    * Navigates to the given path
+    * @param aPath: a path
+    * @param aAttrs, attributes requested
+    * @param aFilter, filter to apply or NULL if none
+    */
+    void OpenL(const CMPXCollectionPath& aPath,
+               const TArray<TMPXAttribute>& aAttrs,
+               CMPXFilter* aFilter); 
+    
+    /**
+    * From CMPXCollectionPlugin     
+    * Get the extended properties of the current file (async)
+    * @param aPath: a path   
+    * @param aAttrs: array of attributes requested             
+    * @param aCaps platsec capabilities of client requesting media; plug-in should also
+    *        verify its process capabilities
+    * @aParam aSpecs, specifications for attributes
+    */
+    void MediaL(const CMPXCollectionPath& aPath, 
+                const TArray<TMPXAttribute>& aAttrs,
+                const TArray<TCapability>& aCaps,
+                CMPXAttributeSpecs* aSpecs);
+            
+    /** 
+    * Cancel outstanding request
+    */
+    void CancelRequest();
+
+    /** 
+    * Executes a command on the selected collection
+    *
+    * @param aCmd a command
+    */
+    void CommandL(TMPXCollectionCommand aCmd, TInt aArg);
+
+    /**
+    * From CMPXCollectionPlugin
+    */
+    void CommandL(CMPXCommand& aCmd);
+    
+    /**
+    *  Adds item(s) to the collection
+    *
+    *  @param aNewProperties, Properties of the item
+    */
+    void AddL(const CMPXMedia& aNewMedia);
+    
+    /**
+    * Remove a collection path
+    * @param aPath, path to remove
+    *
+    */
+    void RemoveL(const CMPXCollectionPath& aPath );
+    
+    /**
+    *  Remove an item or items from the collection
+    *
+    *  @param aProperties, Properties of the item. It may cantain URI only
+    *                      or meta data, all of items matched properties 
+    *                      will be removed.
+    */
+    void RemoveL(const CMPXMedia& aMedia);
+    
+    /**
+    *  Sets/updates the media for the item
+    *  specified in the path
+    *
+    *  @param aMedia, new value
+    */
+    void SetL(const CMPXMedia& aMedia);
+    
+    /**
+    *  Find a list of items matched 
+    *
+    *  @param aMedia, properties to be searched
+    *  @param aAttrs, attributes to return from find
+    */
+    void FindAllL(const CMPXMedia& aMedia, const TArray<TMPXAttribute>& aAttrs);
+
+    /**
+    * Find a list of items matched (sync)
+    *
+    *  @param aMedia, properties to be searched
+    *  @param aAttrs, attributes to return
+    *  @return results of the search        
+    */
+    CMPXMedia* FindAllSyncL(const CMPXMedia& aMedia,
+                            const TArray<TMPXAttribute>& aAttrs);
+                            
+    /**
+    * Get the list of supported capabilities
+    *
+    * @return TCollectionCapability, bitmask of supported capabilities
+    */
+    TCollectionCapability GetCapabilities();
+                        
+protected: // New Functions
+    
+    /**
+    * Send change events back to the observer
+    * @param aId, embedded context that was changed
+    * @param aChange, change type
+    */
+    void HandleChangeL(const TMPXItemId& aId, TMPXChangeEventType aChange );
+
+    /**
+    * Internal function to Add a Media
+    * @param aMedia media to add
+    */
+    void DoAddL( const CMPXMedia& aMedia );
+    
+    /**
+    * Internal function to Set a Media
+    * @param aMedia media to set
+    */
+    void DoSetL( const CMPXMedia& aMedia );
+        
+protected: 
+    /**
+    * Constructor
+    */
+    CMPXInMemoryPlugin();
+    
+    /**
+    *  2nd phase constructor
+    */
+    void ConstructL();
+    
+protected:
+    CMPXDrmMediaUtility*     iDrmMediaUtility;
+    RPointerArray<CMPXMedia> iTemporaryData;
+    RArray<TInt>             iEmbeddedContext;
+    };
+
+#endif      // CMPXINMEMORYPLUGIN_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/inc/mpxmusicmemoryplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music derivative of the in-memory plugin
+*
+*/
+
+
+#ifndef CMPXMUSICMEMORYPLUGIN_H
+#define CMPXMUSICMEMORYPLUGIN_H
+
+#include <apgcli.h>
+#include "mpxinmemoryplugin.h"
+
+// FORWARD DECLARATIONS
+class CMPXMetadataExtractor;
+
+/**
+ *  Music Specific memory plugin
+ *
+ *  @lib mpx
+ *  @since S60 ?S60_version *** for example, S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXMusicMemoryPlugin ) : public CMPXInMemoryPlugin
+    {
+public:
+
+    /**
+    * Two-phased constructor
+    *
+    * @param aInitParams, initialization parameter
+    * @return object of constructed
+    */
+    static CMPXMusicMemoryPlugin* NewL();
+
+    /**
+    * destructor
+    */
+    virtual ~CMPXMusicMemoryPlugin();
+
+private:
+
+    /**
+    * From CMPXCollectionPlugin     
+    * Get the extended properties of the current file (async)
+    * @param aPath: a path   
+    * @param aAttrs: array of attributes requested             
+    * @param aCaps platsec capabilities of client requesting media; plug-in should also
+    *        verify its process capabilities
+    * @aParam aSpecs, specifications for attributes
+    */
+    void MediaL(const CMPXCollectionPath& aPath, 
+                const TArray<TMPXAttribute>& aAttrs,
+                const TArray<TCapability>& aCaps,
+                CMPXAttributeSpecs* aSpecs);
+
+    /**
+    * Extract metadata for a given media object
+    * metadata will be extracted if a URI exists
+    * @param aUri, uri for the item
+    * @param attrs, attributes requested
+    * @return new CMPXMedia object or NULL if bad
+    */
+    CMPXMedia* ExtractMetadataL( const TDesC& aUri, 
+                                 const TArray<TMPXAttribute>& aAttrs );
+    
+                                                                       
+    /**
+    * Set all the attributes in CMPXMedia corresponding to KMPXMediaIdDrm
+    * @param aMedia, media to update
+    * @param aDrmAttributes, bitwise or of the flags we want
+    * @param aDrmMedia, aMedia with drm attributes
+    */
+    void DoSetMediaDrmL(CMPXMedia& aMedia, 
+                        const TArray<TMPXAttribute>& aAttrs, 
+                        const TDesC& aLocation );
+private:
+
+    /**
+    * Constructor
+    */
+    CMPXMusicMemoryPlugin();
+
+    /**
+    * 2nd phased constructor
+    */
+    void ConstructL();
+
+private: // data
+    CMPXMetadataExtractor*  iMetadataExtractor; // Metadata extractor
+    RFs                     iFs;                // File Session
+    RApaLsSession           iAppArc;            // App arc, dummy
+    RArray<TMPXAttribute>   iAttributes;        // List of attributes to fetch
+    };
+
+#endif // CMPXMUSICMEMORYPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/src/mpxinmemoryplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,632 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Simple plugin to cache media objects
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32cmn.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionpluginobserver.h>
+#include <mpxcmn.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxdrmmediautility.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxlog.h>
+
+#include "mpxinmemoryplugin.h"
+
+// CONSTANTS
+const TInt KIMPluginUid  = 0x101FFCD8;
+
+// ============================ MEMBER FUNCTIONS ==============================
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXInMemoryPlugin* CMPXInMemoryPlugin::NewL()
+    {
+    CMPXInMemoryPlugin* p = new (ELeave) CMPXInMemoryPlugin();
+    CleanupStack::PushL(p);
+    p->ConstructL();
+    CleanupStack::Pop(p);
+    return p;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXInMemoryPlugin::~CMPXInMemoryPlugin()
+    {
+    delete iDrmMediaUtility;
+
+    // Cleanup Arrays
+    iTemporaryData.ResetAndDestroy();
+    iTemporaryData.Close();
+    iEmbeddedContext.Reset();
+    iEmbeddedContext.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXInMemoryPlugin::CMPXInMemoryPlugin()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::ConstructL()
+    {
+    iDrmMediaUtility = CMPXDrmMediaUtility::NewL();
+    }
+
+// ----------------------------------------------------------------------------
+// Navigates to the given path
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::OpenL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& /*aAttrs*/,
+    CMPXFilter* /*aFilter*/)
+    {
+    // Media object to return
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    supportedIds.AppendL(KMPXMediaIdContainer);
+    supportedIds.AppendL(KMPXMediaIdGeneral);
+    CMPXMedia* entries=CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PushL(entries);
+
+    // Media array for items
+    CMPXMediaArray* array=CMPXMediaArray::NewL();
+    CleanupStack::PushL(array);
+
+    // Based on Path, what is the embedded client context id?
+    TInt depth = aPath.Levels();
+    TBool oneSong = EFalse;
+    TInt err = KErrNone;
+    switch( depth )
+        {
+        case 1: // should not have anything
+            {
+            User::Leave( KErrArgument );
+            break;
+            }
+        case 2: // an item or a playlist
+            {
+            TInt context = aPath.Id(1);
+            TInt contextIndex = iEmbeddedContext.Find( context );
+            if( contextIndex >= KErrNone )
+                {
+                CMPXMedia& media = *iTemporaryData[contextIndex];
+
+                TMPXGeneralCategory cat = *media.Value<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+                if( cat == EMPXPlaylist )
+                    {
+                    const CMPXMediaArray* plarray = media.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+                    for( TInt i=0; i<plarray->Count(); ++i )
+                        {
+                        CMPXMedia* item = (*plarray)[i];
+                        CMPXMedia* copy = CMPXMedia::NewL(*item);
+
+                        // item id is the index in the array
+                        copy->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, i );
+                        array->AppendL( copy ); // ownership x-fer
+                        }
+
+
+                    // Insert dummy media objects if the "specified" count is > actual
+                    // number of media objects
+                    TInt count(0);
+                    if( media.IsSupported(KMPXMediaArrayCount) )
+                        {
+                        count = *media.Value<TInt>(KMPXMediaArrayCount);
+                        }
+                    if( count > 0 && count > plarray->Count() )
+                        {
+                        for( TInt i=plarray->Count(); i<count; ++i )
+                            {
+                            // Insert dummies
+                            CMPXMedia* copy = CMPXMedia::NewL();
+                            copy->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, i );
+                            copy->SetTObjectValueL( KMPXMediaGeneralType,
+                                                    EMPXItem );
+                            copy->SetTObjectValueL( KMPXMediaGeneralCategory,
+                                                    EMPXSong );
+                            array->AppendL( copy ); // ownership x-fer
+                            }
+                        }
+
+                    // Set the title for the playlist
+                    //
+                    if( media.IsSupported( KMPXMediaGeneralTitle ) )
+                        {
+                        const TDesC& title = media.ValueText( KMPXMediaGeneralTitle );
+                        entries->SetTextValueL( KMPXMediaGeneralTitle,
+                                                title );
+                        }
+                    }
+                else // assume it is an item then
+                    {
+                    // Set one song to true
+                    oneSong = ETrue;
+                    }
+                }
+            else
+                {
+                err = KErrNotFound;
+                }
+            break;
+            }
+        case 3:  // item in a playlist
+            {
+            oneSong = ETrue;
+            break;
+            }
+        default:
+        break;
+        }
+
+    // Set array if not one song
+    if( !oneSong )
+        {
+        entries->SetCObjectValueL(KMPXMediaArrayContents,array);
+        entries->SetTObjectValueL(KMPXMediaArrayCount,
+                                  array->Count());
+        entries->SetTObjectValueL( KMPXMediaGeneralType,
+                                   EMPXGroup );
+        entries->SetTObjectValueL( KMPXMediaGeneralCategory,
+                                   EMPXPlaylist );
+        }
+    else
+        {
+        entries->SetTObjectValueL( KMPXMediaGeneralType,
+                                   EMPXItem );
+        entries->SetTObjectValueL( KMPXMediaGeneralCategory,
+                                   EMPXSong );
+        }
+
+    if(oneSong)
+        {
+        iObs->HandleOpen(const_cast<CMPXCollectionPath*>(&aPath), err );
+        }
+    else
+        {
+        entries->SetCObjectValueL( KMPXMediaGeneralContainerPath,
+                                   const_cast<CMPXCollectionPath*>(&aPath) );
+        iObs->HandleOpen(entries, err );
+        }
+    CleanupStack::PopAndDestroy(array);
+    CleanupStack::PopAndDestroy(entries);
+    CleanupStack::PopAndDestroy(&supportedIds);
+    }
+
+// ----------------------------------------------------------------------------
+// Extended properties of the current file (async)
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::MediaL (
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    const TArray<TCapability>& /*aCaps*/,
+    CMPXAttributeSpecs* /*aSpecs*/)
+    {
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    supportedIds.AppendL(KMPXMediaIdGeneral);
+    CMPXMedia* entries=CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entries);
+
+    // Based on Path, what is the embedded client context id?
+    //
+    TInt err = KErrNone;
+    TInt depth = aPath.Levels();
+    switch( depth )
+        {
+        case 2:  // Playlist / Song level
+        case 3:  // Song in a playlist level, fall through
+            {
+            TInt context = aPath.Id(1);
+            TInt contextIndex = iEmbeddedContext.Find( context );
+            if( contextIndex >= KErrNone )
+                {
+                CMPXMedia& media = *iTemporaryData[contextIndex];
+
+                TMPXGeneralCategory cat;
+                cat = *media.Value<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+
+                // Playlist media
+                //
+                if( cat == EMPXPlaylist && depth == 2)
+                    {
+                    // Get
+                    const TDesC& title = media.ValueText( KMPXMediaGeneralTitle );
+                    const TDesC& uri = media.ValueText( KMPXMediaGeneralUri );
+                    // Set
+                    entries->SetTextValueL( KMPXMediaGeneralTitle,
+                                            title );
+                    entries->SetTextValueL( KMPXMediaGeneralUri,
+                                            uri );
+                    entries->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId,
+                                                    TUid::Uid(KIMPluginUid) );
+                    }
+                // Item in a playlist media
+                //
+                else if( cat == EMPXPlaylist && depth == 3 )
+                    {
+                    const CMPXMediaArray* plarray = media.Value<CMPXMediaArray>(
+                                                        KMPXMediaArrayContents );
+                    TInt selection = aPath.Id( 2 );
+                    TInt count = plarray->Count();
+                    if( selection < count )
+                        {
+                        *entries = *(*plarray)[selection];
+
+                        entries->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId,
+                                                        TUid::Uid(KIMPluginUid) );
+                        }
+                    else
+                       {
+                       // Bounds check
+                       err = KErrArgument;
+                       }
+                    }
+                // Otherwise, assume it is a song
+                //
+                else // cat == song/image/video/etc
+                    {
+                    *entries = media;
+
+                    entries->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId,
+                                                    TUid::Uid(KIMPluginUid) );
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            // Return Nothing because a MediaL at this depth contains nothing
+            break;
+            }
+        }
+    //
+    for (TInt i=aAttrs.Count();--i>=0;)
+        {
+        if (aAttrs[i]==KMPXMediaGeneralPath)
+            {
+            entries->SetCObjectValueL(KMPXMediaGeneralPath,
+                                      const_cast<CMPXCollectionPath*>(&aPath));
+            break;
+            }
+        }
+
+    // Full metadata is not available from this plugin
+    entries->SetTObjectValueL( KMPXMediaColDetailMediaNotAvailable,
+                               ETrue );
+    //
+    iObs->HandleMedia(entries, err );
+    CleanupStack::PopAndDestroy(entries);
+    }
+
+// ----------------------------------------------------------------------------
+// Cancel outstanding request
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::CancelRequest()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Executes a command on the selected collection
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::CommandL(TMPXCollectionCommand /*aCmd*/, TInt /*aArg*/)
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Executes a command on the selected collection
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::CommandL(CMPXCommand& aCmd)
+    {
+    if (!aCmd.IsSupported(TMPXAttribute(KMPXCommandContentIdGeneral, EMPXCommandGeneralId)))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TMPXCommandId commandId =
+        *aCmd.Value<TMPXCommandId>(
+            TMPXAttribute(KMPXCommandContentIdGeneral, EMPXCommandGeneralId));
+
+    TBool syncOp(EFalse);
+    if( aCmd.IsSupported(KMPXCommandGeneralDoSync) )
+        {
+        syncOp = *aCmd.Value<TBool>(KMPXCommandGeneralDoSync);
+        }
+
+    // Handle each operation
+    //
+    switch( commandId )
+        {
+        case KMPXCommandIdCollectionAdd:
+            {
+            DoAddL( *aCmd.Value<CMPXMedia>(KMPXCommandColAddMedia) );
+            break;
+            }
+        case KMPXCommandIdCollectionSet:
+            {
+            DoSetL( *aCmd.Value<CMPXMedia>(KMPXCommandColSetMedia) );
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    // Complete Async operations
+    //
+    if( !syncOp )
+        {
+        iObs->HandleCommandComplete( NULL, KErrNone );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Adds item(s) to the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::AddL(
+    const CMPXMedia& aNewMedia)
+    {
+    DoAddL( aNewMedia );
+    }
+
+// ----------------------------------------------------------------------------
+// Remove by collection path
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::RemoveL(const CMPXCollectionPath& aPath )
+    {
+    (void) aPath;
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item or items under a group from the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::RemoveL(const CMPXMedia& aMedia)
+    {
+    (void)aMedia;
+    }
+
+// ----------------------------------------------------------------------------
+// Sets/updates the media for the item
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::SetL(
+    const CMPXMedia& aMedia)
+    {
+    DoSetL( aMedia );
+    }
+
+// ----------------------------------------------------------------------------
+// Find based on media properties
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::FindAllL(const CMPXMedia& aMedia,
+                                      const TArray<TMPXAttribute>& aAttrs )
+    {
+    (void)aMedia;
+    (void)aAttrs;
+    }
+
+// ----------------------------------------------------------------------------
+// Find based on media properties
+// ----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXInMemoryPlugin::FindAllSyncL(const CMPXMedia& aMedia,
+                                            const TArray<TMPXAttribute>& aAttrs )
+    {
+    (void)aMedia;
+    (void)aAttrs;
+    User::Leave(KErrNotSupported);
+    return NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// Find the capabilities of this plugin
+// ----------------------------------------------------------------------------
+//
+TCollectionCapability CMPXInMemoryPlugin::GetCapabilities()
+    {
+    return 0; // nothing special supported
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Handle change
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::HandleChangeL(const TMPXItemId& aId, TMPXChangeEventType aChange )
+    {
+    // Construct the message
+    //
+    CMPXMessage* message = CMPXMedia::NewL();
+    CleanupStack::PushL( message );
+
+    // Set attributes
+    //
+    message->SetTObjectValueL<TMPXMessageId>(KMPXMessageGeneralId, KMPXMessageIdItemChanged);
+
+    message->SetTObjectValueL<TUid>(KMPXMessageCollectionId, TUid::Uid(KIMPluginUid));
+
+    message->SetTObjectValueL<TMPXChangeEventType>(KMPXMessageChangeEventType, aChange);
+
+    message->SetTObjectValueL<TMPXItemId>(KMPXMessageMediaGeneralId, aId);
+
+    // Callback to observer and destroy
+    //
+    iObs->HandleMessage( *message );
+    CleanupStack::PopAndDestroy( message );
+    }
+
+// ----------------------------------------------------------------------------
+// Adds item(s) to the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::DoAddL(
+    const CMPXMedia& aNewMedia)
+    {
+    TInt context = *aNewMedia.Value<TInt>( TMPXAttribute(KMPXMediaIdGeneral,
+                                                         EMPXMediaGeneralId ) );
+
+    // Only 1 set of data per embedded context
+    TInt index = iEmbeddedContext.Find( context );
+    if( index != KErrNotFound )
+        {
+        iEmbeddedContext.Remove( index );
+        iTemporaryData.Remove( index );
+        iEmbeddedContext.Compress();
+        iTemporaryData.Compress();
+        }
+    // Push onto list
+    iEmbeddedContext.Append( context );
+
+    CMPXMedia* copy = CMPXMedia::NewL();
+    *copy = aNewMedia;
+    iTemporaryData.AppendL( copy );  // ownership transferred.
+    }
+
+// ----------------------------------------------------------------------------
+// Sets/updates the media for the item
+// ----------------------------------------------------------------------------
+//
+void CMPXInMemoryPlugin::DoSetL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_DEBUG1("CMPXInMemoryPlugin::DoSetL <---");
+    if( !aMedia.IsSupported(KMPXMediaGeneralId) )
+        {
+        User::Leave( KErrArgument );
+        }
+
+    TInt context = *aMedia.Value<TMPXItemId>(KMPXMediaGeneralId);
+    TInt index = iEmbeddedContext.Find( context );
+
+    MPX_DEBUG2("CMPXInMemoryPlugin::DoSetL index %i", index);
+    if( index != KErrNotFound )
+        {
+        TMPXAttribute att( KMPXMediaArrayContents );
+
+        // Make sure it has a media array
+        //
+        if( aMedia.IsSupported( att ) )
+            {
+            MPX_DEBUG1("CMPXInMemoryPlugin::DoSetL 1");
+
+            // Grab the 2 media arrays
+            //
+            CMPXMediaArray* currentMedia =
+                           const_cast<CMPXMediaArray*>(iTemporaryData[index]->Value<CMPXMediaArray>(att));
+            const CMPXMediaArray* newMedia = aMedia.Value<CMPXMediaArray>(att);
+
+            MPX_DEBUG1("CMPXInMemoryPlugin::DoSetL 2");
+            // Copy all entries from newMedia into currentMedia
+            //
+            TInt newCount = newMedia->Count();
+            for( TInt i=0; i<newCount; ++i )
+                {
+                MPX_DEBUG1("CMPXInMemoryPlugin::DoSetL 3");
+                CMPXMedia* copy = CMPXMedia::NewL(*(*newMedia)[i]);
+                CleanupStack::PushL( copy );
+
+                // If the item contains an item ID, we use it as an index to insert
+                // into the array, otherwise, append item to the end
+                //
+                MPX_DEBUG1("CMPXInMemoryPlugin::DoSetL 4");
+                if( copy->IsSupported(KMPXMediaGeneralId) )
+                    {
+                    TInt index = *copy->Value<TMPXItemId>(KMPXMediaGeneralId);
+                    MPX_DEBUG2("CMPXInMemoryPlugin::DoSetL index count %i", index);
+                    // index is 0th based, like an array
+                    //
+                    TInt currentCount = currentMedia->Count();
+                    if( index > currentCount )
+                        {
+                        // Fill in blanks then append the item we want
+                        //
+                        for( TInt j=currentCount; j<index; ++j )
+                            {
+                            CMPXMedia* blank = CMPXMedia::NewL();
+                            CleanupStack::PushL( blank );
+                            currentMedia->AppendL( blank ); // ownership xfer
+                            CleanupStack::Pop( blank );
+                            }
+                        currentMedia->AppendL( copy ); // ownership xfer
+                        }
+                    else
+                        {
+                        // Replace item at index with this new version
+                        //
+                        currentMedia->Remove(index);
+                        currentMedia->Insert( copy, index ); // ownership xfer
+                        }
+                    }
+                else
+                    {
+                    currentMedia->AppendL( copy );  // ownership xfer
+                    }
+                MPX_DEBUG1("CMPXInMemoryPlugin::DoSetL 5");
+                CleanupStack::Pop(copy);
+                }
+
+            // Set the new array into the media
+            //
+            MPX_DEBUG1("CMPXInMemoryPlugin::DoSetL 6");
+            iTemporaryData[index]->SetCObjectValueL(att, currentMedia );
+
+            // Tell collection client context that something was added
+            //
+            MPX_DEBUG1("CMPXInMemoryPlugin::DoSetL 7");
+            HandleChangeL( context, EMPXItemInserted );
+            MPX_DEBUG1("CMPXInMemoryPlugin::DoSetL 8");
+            }
+        }
+    else
+        {
+        MPX_DEBUG1("CMPXInMemoryPlugin::DoSetL KErrArgument");
+        User::Leave( KErrArgument );
+        }
+    MPX_DEBUG1("CMPXInMemoryPlugin::DoSetL --->");
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/src/mpxinmemorypluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+#include <implementationproxy.h>
+#include "mpxinmemoryplugin.h"
+#include "mpxmusicmemoryplugin.h"
+
+#if (!defined IMPLEMENTATION_PROXY_ENTRY)
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) 
+                                        {{aUid},(TProxyNewLPtr)(aFuncPtr)}
+#endif
+
+// ----------------------------------------------------------------------------
+// The list of implementations
+// ----------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { IMPLEMENTATION_PROXY_ENTRY(0x101FFCD8, CMPXInMemoryPlugin::NewL),
+      IMPLEMENTATION_PROXY_ENTRY(0x10282960, CMPXMusicMemoryPlugin::NewL) };
+
+// ----------------------------------------------------------------------------
+// The proxy of implementations
+// ----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount)
+    {
+    aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxinmemoryplugin/src/mpxmusicmemoryplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,432 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music specific memory plugin
+*
+*/
+
+
+#include <e32base.h>
+#include <f32file.h>
+#include <badesca.h>
+#include <apgcli.h>
+#include <mpxcollectiontype.h>
+#include <mpxcollectionpath.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediaarray.h>
+#include <mpxcollectionpluginobserver.h>
+#include <mpxdrmmediautility.h>
+
+#include <mpxmetadataextractor.h>
+#include "mpxmusicmemoryplugin.h"
+
+// CONSTANTS
+const TInt KIMMusicPluginUid  = 0x10282960;
+const TMPXAttributeData KMPXMediaFetched = {KIMMusicPluginUid, 0x01}; // TInt
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Default Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXMusicMemoryPlugin::CMPXMusicMemoryPlugin()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// 2nd phased constructor
+// ---------------------------------------------------------------------------
+//
+void CMPXMusicMemoryPlugin::ConstructL()
+    {
+    User::LeaveIfError( iFs.Connect() );
+    User::LeaveIfError( iAppArc.Connect() );
+    RPointerArray<CMPXCollectionType> dummy;
+    CleanupClosePushL( dummy );
+    iMetadataExtractor = CMPXMetadataExtractor::NewL( iFs, iAppArc, dummy );
+    dummy.ResetAndDestroy();
+    CleanupStack::PopAndDestroy( &dummy );
+    
+    iAttributes.AppendL(KMPXMediaDrmAll);
+    
+    // Base class construction
+    CMPXInMemoryPlugin::ConstructL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CMPXMusicMemoryPlugin* CMPXMusicMemoryPlugin::NewL()
+    {
+    CMPXMusicMemoryPlugin* self = new(ELeave) CMPXMusicMemoryPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Virtual destructor
+// ---------------------------------------------------------------------------
+//
+CMPXMusicMemoryPlugin::~CMPXMusicMemoryPlugin()
+    {
+    iFs.Close();
+    iAppArc.Close();
+    delete iMetadataExtractor;
+    iAttributes.Close();
+    }
+
+
+// ----------------------------------------------------------------------------
+// Extended properties of the current file (async)
+// ----------------------------------------------------------------------------
+//
+void CMPXMusicMemoryPlugin::MediaL (
+    const CMPXCollectionPath& aPath, 
+    const TArray<TMPXAttribute>& aAttrs,
+    const TArray<TCapability>& /*aCaps*/,
+    CMPXAttributeSpecs* /*aSpecs*/)
+    {
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    supportedIds.AppendL(KMPXMediaIdGeneral);
+    CMPXMedia* entries=CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entries);
+    
+    // Based on Path, what is the embedded client context id?
+    //
+    TInt err = KErrNone;
+    TInt depth = aPath.Levels();
+    switch( depth )
+        {
+        case 2:  // Playlist / Song level
+        case 3:  // Song in a playlist level, fall through
+            {
+            TInt context = aPath.Id(1);
+            TInt contextIndex = iEmbeddedContext.Find( context );
+            if( contextIndex >= KErrNone )
+                {
+                CMPXMedia& media = *iTemporaryData[contextIndex];
+                
+                TMPXGeneralCategory cat;
+                cat = *media.Value<TMPXGeneralCategory>(KMPXMediaGeneralCategory);
+                
+                // Playlist media
+                //
+                if( cat == EMPXPlaylist && depth == 2)
+                    {
+                    // Get
+                    const TDesC& title = media.ValueText( KMPXMediaGeneralTitle );
+                    const TDesC& uri = media.ValueText( KMPXMediaGeneralUri );
+                    // Set
+                    entries->SetTextValueL( KMPXMediaGeneralTitle, title );
+                    entries->SetTextValueL( KMPXMediaGeneralUri, uri );
+                    entries->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId, 
+                                                    TUid::Uid(KIMMusicPluginUid) );
+                    }
+                // Item in a playlist media
+                //
+                else if( cat == EMPXPlaylist && depth == 3 )
+                    {
+                    const CMPXMediaArray* plarray = media.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+                    TInt selection = aPath.Id(2);
+                    TInt count = plarray->Count();
+                    if( selection < count )
+                        {
+                        if( (*plarray)[selection]->IsSupported(KMPXMediaFetched) )
+                            {
+                            *entries = *(*plarray)[selection];
+                            }
+                        else  // not fetched yet
+                            {
+                            // Extract the data
+                            const TDesC& uri = (*plarray)[selection]->ValueText( KMPXMediaGeneralUri );
+                            CMPXMedia* metadata = ExtractMetadataL( uri, iAttributes.Array() );
+                            CleanupStack::PushL( metadata );                                            
+                            
+                            // Return to client
+                            *entries = *metadata;
+                            
+                            // Save the data
+                            *(*plarray)[selection] = *metadata;         
+                            (*plarray)[selection]->SetTObjectValueL(KMPXMediaFetched, ETrue);
+                            
+                            CleanupStack::PopAndDestroy( metadata );
+                            }
+                        entries->SetTObjectValueL<TUid>( KMPXMediaGeneralCollectionId, 
+                                                         TUid::Uid(KIMMusicPluginUid) );
+                        }
+                    else
+                       {
+                       // Bounds check
+                       err = KErrArgument; 
+                       }
+                    }
+                // Otherwise, assume it is a song
+                //
+                else // cat == song/image/video/etc
+                    {
+                    if( media.IsSupported(KMPXMediaFetched) )
+                        {
+                        *entries = media;    
+                        }
+                    else
+                        {
+                        const TDesC& uri = media.ValueText( KMPXMediaGeneralUri );
+                        CMPXMedia* metadata = ExtractMetadataL( uri, iAttributes.Array() );
+                        CleanupStack::PushL( metadata );
+                        // Return to client
+                        *entries = *metadata;
+                        
+                        //Save the data
+                        media = *metadata;
+                        media.SetTObjectValueL(KMPXMediaFetched, ETrue);
+                        
+                        CleanupStack::PopAndDestroy( metadata );    
+                        }
+                    entries->SetTObjectValueL<TUid>( KMPXMediaGeneralCollectionId, 
+                                                     TUid::Uid(KIMMusicPluginUid) );
+                    }
+                }
+            break;    
+            }  
+        default:
+            {
+            // Return Nothing because a MediaL at this depth contains nothing
+            break;    
+            }
+        }
+    // Copy Path
+    TMPXAttribute pathAttr(KMPXMediaGeneralPath);
+    for (TInt i=aAttrs.Count();--i>=0;)
+        {
+        if (aAttrs[i]==pathAttr)
+            {
+            entries->SetCObjectValueL(pathAttr,
+                                         const_cast<CMPXCollectionPath*>(&aPath));
+            break;
+            }
+        }
+    // Callback to collection client context
+    iObs->HandleMedia( entries, err );
+    CleanupStack::PopAndDestroy(entries);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Set all the attributes in CMPXMedia corresponding to KMPXMediaIdDrm
+// ----------------------------------------------------------------------------------------------------------
+//
+CMPXMedia* CMPXMusicMemoryPlugin::ExtractMetadataL( const TDesC& aUri, 
+                                                    const TArray<TMPXAttribute>& aAttrs )
+    {
+    CMPXMedia* media( NULL );
+    iMetadataExtractor->CreateMediaL( aUri, media, ETrue );
+    
+    // Also set drm 
+    if( media )
+        {
+        CleanupStack::PushL( media );
+        DoSetMediaDrmL( *media, aAttrs, aUri );
+        CleanupStack::Pop( media );
+        }
+    return media;  // ownership transferred
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Set all the attributes in CMPXMedia corresponding to KMPXMediaIdDrm
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXMusicMemoryPlugin::DoSetMediaDrmL(CMPXMedia& aMedia, 
+                                           const TArray<TMPXAttribute>& aAttrs, 
+                                           const TDesC& aLocation )
+    {
+    // Gather all DRM attributes
+    TUint aDrmAttributes(0);
+    for( TInt i=0; i<aAttrs.Count(); ++i )
+        {
+        if( aAttrs[i].ContentId() == KMPXMediaIdDrm )
+            {
+            aDrmAttributes |= aAttrs[i].AttributeId();
+            }
+        }
+    
+    iDrmMediaUtility->InitL(aLocation);
+    const CMPXMedia* drmMedia( iDrmMediaUtility->GetMediaL( aDrmAttributes ));   
+    
+    // Only get attributes if it's a DRM file
+    if ( drmMedia )
+        {
+        if ( aDrmAttributes & KMPXMediaDrmType.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmType );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TInt val( *drmMedia->Value<TInt>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmRightsStatus.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmRightsStatus );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TInt val( *drmMedia->Value<TInt>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmRightsType.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmRightsType );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TInt val( *drmMedia->Value<TInt>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmCount.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmCount );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TInt val( *drmMedia->Value<TInt>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmProtected.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmProtected );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TBool val( *drmMedia->Value<TBool>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmSendingAllowed.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmSendingAllowed );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TBool val( *drmMedia->Value<TBool>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmCanSetAutomated.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmCanSetAutomated );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TBool val( *drmMedia->Value<TBool>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmHasInfoUrl.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmHasInfoUrl );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TBool val( *drmMedia->Value<TBool>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmHasPreviewUrl.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmHasPreviewUrl );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TBool val( *drmMedia->Value<TBool>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmAboutToExpire.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmAboutToExpire );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TBool val( *drmMedia->Value<TBool>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmStartTime.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmStartTime );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TInt64 val( *drmMedia->Value<TInt64>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmEndTime.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmEndTime );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TInt64 val( *drmMedia->Value<TInt64>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmIntervalStartTime.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmIntervalStartTime );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TInt64 val( *drmMedia->Value<TInt64>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmAccumulatedTime.iAttributeId )
+            {                        
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, 
+                                  EMPXMediaDrmAccumulatedTime );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TInt64 val( *drmMedia->Value<TInt64>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        if ( aDrmAttributes & KMPXMediaDrmInterval.iAttributeId )
+            {
+            TMPXAttribute mpxAtt( KMPXMediaIdDrm, EMPXMediaDrmInterval );
+            if ( drmMedia->IsSupported( mpxAtt ))
+                {
+                TTimeIntervalSeconds val(
+                    *drmMedia->Value<TTimeIntervalSeconds>( mpxAtt ));
+                aMedia.SetTObjectValueL( mpxAtt, val );
+                }
+            }
+        }
+    iDrmMediaUtility->Close();        
+    }
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/bwinscw/mpxsqlitedbcommonu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,124 @@
+EXPORTS
+	??0CMPXDbManager@@IAE@AAVRFs@@@Z @ 1 NONAME ; CMPXDbManager::CMPXDbManager(class RFs &)
+	??0CMPXDbTable@@IAE@AAVCMPXDbManager@@@Z @ 2 NONAME ; CMPXDbTable::CMPXDbTable(class CMPXDbManager &)
+	??1CMPXDbActiveTask@@UAE@XZ @ 3 NONAME ; CMPXDbActiveTask::~CMPXDbActiveTask(void)
+	??1CMPXDbManager@@UAE@XZ @ 4 NONAME ; CMPXDbManager::~CMPXDbManager(void)
+	??1CMPXDbTable@@MAE@XZ @ 5 NONAME ; CMPXDbTable::~CMPXDbTable(void)
+	?AddItemChangedMessageL@MPXDbCommonUtil@@SAXAAVCMPXMediaArray@@VTMPXItemId@@W4TMPXChangeEventType@@W4TMPXGeneralCategory@@I1@Z @ 6 NONAME ; void MPXDbCommonUtil::AddItemChangedMessageL(class CMPXMediaArray &, class TMPXItemId, enum TMPXChangeEventType, enum TMPXGeneralCategory, unsigned int, class TMPXItemId)
+	?AddSqlCriterionL@MPXDbCommonUtil@@SAHAAVCDesC16Array@@ABVTDesC16@@1@Z @ 7 NONAME ; int MPXDbCommonUtil::AddSqlCriterionL(class CDesC16Array &, class TDesC16 const &, class TDesC16 const &)
+	?AddSqlCriterionL@MPXDbCommonUtil@@SAHAAVCDesC16Array@@ABVTDesC16@@H@Z @ 8 NONAME ; int MPXDbCommonUtil::AddSqlCriterionL(class CDesC16Array &, class TDesC16 const &, int)
+	?AppendMediaL@MPXDbCommonUtil@@SAXAAVCMPXMediaArray@@ABVTDesC16@@W4TMPXGeneralType@@W4TMPXGeneralCategory@@VTMPXItemId@@HI@Z @ 9 NONAME ; void MPXDbCommonUtil::AppendMediaL(class CMPXMediaArray &, class TDesC16 const &, enum TMPXGeneralType, enum TMPXGeneralCategory, class TMPXItemId, int, unsigned int)
+	?AppendValueL@MPXDbCommonUtil@@SAXAAVCDesC16Array@@0ABVTDesC16@@1@Z @ 10 NONAME ; void MPXDbCommonUtil::AppendValueL(class CDesC16Array &, class CDesC16Array &, class TDesC16 const &, class TDesC16 const &)
+	?AppendValueL@MPXDbCommonUtil@@SAXAAVCDesC16Array@@0ABVTDesC16@@K@Z @ 11 NONAME ; void MPXDbCommonUtil::AppendValueL(class CDesC16Array &, class CDesC16Array &, class TDesC16 const &, unsigned long)
+	?AttributeExists@MPXDbCommonUtil@@SAHABV?$TArray@VTMPXAttribute@@@@ABVTMPXAttribute@@@Z @ 12 NONAME ; int MPXDbCommonUtil::AttributeExists(class TArray<class TMPXAttribute> const &, class TMPXAttribute const &)
+	?BaseConstructL@CMPXDbTable@@IAEXXZ @ 13 NONAME ; void CMPXDbTable::BaseConstructL(void)
+	?BeginL@CMPXDbManager@@QAEXXZ @ 14 NONAME ; void CMPXDbManager::BeginL(void)
+	?CheckDiskSpaceL@CMPXDbManager@@QAEXH@Z @ 15 NONAME ; void CMPXDbManager::CheckDiskSpaceL(int)
+	?CloseAllDatabases@CMPXDbManager@@QAEXXZ @ 16 NONAME ; void CMPXDbManager::CloseAllDatabases(void)
+	?CloseDatabaseL@CMPXDbManager@@QAEXH@Z @ 17 NONAME ; void CMPXDbManager::CloseDatabaseL(int)
+	?CommitL@CMPXDbManager@@QAEXXZ @ 18 NONAME ; void CMPXDbManager::CommitL(void)
+	?ConstructL@CMPXDbManager@@IAEXABV?$TBuf@$0BAA@@@@Z @ 19 NONAME ; void CMPXDbManager::ConstructL(class TBuf<256> const &)
+	?CreateFullPathL@MPXDbCommonUtil@@SAPAVHBufC16@@HABVTDesC16@@@Z @ 20 NONAME ; class HBufC16 * MPXDbCommonUtil::CreateFullPathL(int, class TDesC16 const &)
+	?CreateTablesL@CMPXDbManager@@IAEXAAVRSqlDatabase@@@Z @ 21 NONAME ; void CMPXDbManager::CreateTablesL(class RSqlDatabase &)
+	?CurrentDateDesLC@MPXDbCommonUtil@@SAPAVHBufC16@@XZ @ 22 NONAME ; class HBufC16 * MPXDbCommonUtil::CurrentDateDesLC(void)
+	?CurrentTimeDesLC@MPXDbCommonUtil@@SAPAVHBufC16@@XZ @ 23 NONAME ; class HBufC16 * MPXDbCommonUtil::CurrentTimeDesLC(void)
+	?DatabaseCount@CMPXDbManager@@QBEHXZ @ 24 NONAME ; int CMPXDbManager::DatabaseCount(void) const
+	?DbDrive@CMPXDbManager@@QBEHH@Z @ 25 NONAME ; int CMPXDbManager::DbDrive(int) const
+	?DeleteFile@MPXDbCommonUtil@@SAHAAVRFs@@ABVTDesC16@@@Z @ 26 NONAME ; int MPXDbCommonUtil::DeleteFile(class RFs &, class TDesC16 const &)
+	?DesToTTimeL@MPXDbCommonUtil@@SA?AVTTime@@ABVTDesC16@@@Z @ 27 NONAME ; class TTime MPXDbCommonUtil::DesToTTimeL(class TDesC16 const &)
+	?DoCancel@CMPXDbActiveTask@@MAEXXZ @ 28 NONAME ; void CMPXDbActiveTask::DoCancel(void)
+	?DoCheckTable@CMPXDbTable@@IAEHAAVRSqlDatabase@@ABVTDesC16@@@Z @ 29 NONAME ; int CMPXDbTable::DoCheckTable(class RSqlDatabase &, class TDesC16 const &)
+	?ExecuteIntQueryL@CMPXDbTable@@IAEKABVTDesC16@@0@Z @ 30 NONAME ; unsigned long CMPXDbTable::ExecuteIntQueryL(class TDesC16 const &, class TDesC16 const &)
+	?ExecuteIntQueryL@CMPXDbTable@@IAEKABVTDesC16@@0K@Z @ 31 NONAME ; unsigned long CMPXDbTable::ExecuteIntQueryL(class TDesC16 const &, class TDesC16 const &, unsigned long)
+	?ExecuteIntQueryL@CMPXDbTable@@IAEKABVTDesC16@@@Z @ 32 NONAME ; unsigned long CMPXDbTable::ExecuteIntQueryL(class TDesC16 const &)
+	?ExecuteIntQueryL@CMPXDbTable@@IAEKABVTDesC16@@K@Z @ 33 NONAME ; unsigned long CMPXDbTable::ExecuteIntQueryL(class TDesC16 const &, unsigned long)
+	?ExecuteIntQueryL@CMPXDbTable@@IAEKABVTDesC16@@KK@Z @ 34 NONAME ; unsigned long CMPXDbTable::ExecuteIntQueryL(class TDesC16 const &, unsigned long, unsigned long)
+	?ExecuteIntQueryL@CMPXDbTable@@IAEKHABVTDesC16@@@Z @ 35 NONAME ; unsigned long CMPXDbTable::ExecuteIntQueryL(int, class TDesC16 const &)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMedia@@ABVTDesC16@@@Z @ 36 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMedia &, class TDesC16 const &)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMedia@@ABVTDesC16@@H@Z @ 37 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMedia &, class TDesC16 const &, int)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@ABVTDesC16@@22@Z @ 38 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@ABVTDesC16@@2@Z @ 39 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, class TDesC16 const &, class TDesC16 const &)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@ABVTDesC16@@2H2H@Z @ 40 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, class TDesC16 const &, class TDesC16 const &, int, class TDesC16 const &, int)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@ABVTDesC16@@2H@Z @ 41 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, class TDesC16 const &, class TDesC16 const &, int)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@ABVTDesC16@@2HHI@Z @ 42 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, class TDesC16 const &, class TDesC16 const &, int, int, unsigned int)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@ABVTDesC16@@@Z @ 43 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, class TDesC16 const &)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@ABVTDesC16@@H@Z @ 44 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, class TDesC16 const &, int)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@ABVTDesC16@@HH@Z @ 45 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, class TDesC16 const &, int, int)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@ABVTDesC16@@HHI@Z @ 46 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, class TDesC16 const &, int, int, unsigned int)
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@HABVTDesC16@@@Z @ 47 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, int, class TDesC16 const &)
+	?ExecuteQueryL@CMPXDbManager@@QAAXHV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 48 NONAME ; void CMPXDbManager::ExecuteQueryL(int, class TRefByValue<class TDesC16 const >, ...)
+	?ExecuteSelectQueryL@CMPXDbManager@@QAA?AVRSqlStatement@@HV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 49 NONAME ; class RSqlStatement CMPXDbManager::ExecuteSelectQueryL(int, class TRefByValue<class TDesC16 const >, ...)
+	?ExecuteSelectQueryL@CMPXDbManager@@QAA?AVRSqlStatement@@V?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 50 NONAME ; class RSqlStatement CMPXDbManager::ExecuteSelectQueryL(class TRefByValue<class TDesC16 const >, ...)
+	?ExecuteSelectQueryL@CMPXDbManager@@QAAAAVRSqlStatement@@IABVTDesC16@@HV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 51 NONAME ; class RSqlStatement & CMPXDbManager::ExecuteSelectQueryL(unsigned int, class TDesC16 const &, int, class TRefByValue<class TDesC16 const >, ...)
+	?ExecuteSelectQueryL@CMPXDbManager@@QAAAAVRSqlStatement@@IHHV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 52 NONAME ; class RSqlStatement & CMPXDbManager::ExecuteSelectQueryL(unsigned int, int, int, class TRefByValue<class TDesC16 const >, ...)
+	?ExecuteSumQueryL@CMPXDbTable@@IAEHABVTDesC16@@00@Z @ 53 NONAME ; int CMPXDbTable::ExecuteSumQueryL(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+	?ExecuteSumQueryL@CMPXDbTable@@IAEHABVTDesC16@@0@Z @ 54 NONAME ; int CMPXDbTable::ExecuteSumQueryL(class TDesC16 const &, class TDesC16 const &)
+	?ExecuteSumQueryL@CMPXDbTable@@IAEHABVTDesC16@@0K0K@Z @ 55 NONAME ; int CMPXDbTable::ExecuteSumQueryL(class TDesC16 const &, class TDesC16 const &, unsigned long, class TDesC16 const &, unsigned long)
+	?ExecuteSumQueryL@CMPXDbTable@@IAEHABVTDesC16@@@Z @ 56 NONAME ; int CMPXDbTable::ExecuteSumQueryL(class TDesC16 const &)
+	?ExecuteSumQueryL@CMPXDbTable@@IAEHABVTDesC16@@K@Z @ 57 NONAME ; int CMPXDbTable::ExecuteSumQueryL(class TDesC16 const &, unsigned long)
+	?ExecuteSumQueryL@CMPXDbTable@@IAEHABVTDesC16@@KK@Z @ 58 NONAME ; int CMPXDbTable::ExecuteSumQueryL(class TDesC16 const &, unsigned long, unsigned long)
+	?ExecuteSumQueryL@CMPXDbTable@@IAEHABVTDesC16@@KKK@Z @ 59 NONAME ; int CMPXDbTable::ExecuteSumQueryL(class TDesC16 const &, unsigned long, unsigned long, unsigned long)
+	?ExecuteSumQueryL@CMPXDbTable@@IAEKABVTDesC16@@0K@Z @ 60 NONAME ; unsigned long CMPXDbTable::ExecuteSumQueryL(class TDesC16 const &, class TDesC16 const &, unsigned long)
+	?FillInSupportedUIDsL@MPXDbCommonUtil@@SAXABV?$TArray@VTMPXAttribute@@@@AAV?$RArray@H@@@Z @ 61 NONAME ; void MPXDbCommonUtil::FillInSupportedUIDsL(class TArray<class TMPXAttribute> const &, class RArray<int> &)
+	?FillItemChangedMessageL@MPXDbCommonUtil@@SAXAAVCMPXMedia@@VTMPXItemId@@W4TMPXChangeEventType@@W4TMPXGeneralCategory@@I1@Z @ 62 NONAME ; void MPXDbCommonUtil::FillItemChangedMessageL(class CMPXMedia &, class TMPXItemId, enum TMPXChangeEventType, enum TMPXGeneralCategory, unsigned int, class TMPXItemId)
+	?FindAndReplaceSingleQuote@MPXDbCommonUtil@@SAXABVTDesC16@@AAVTDes16@@@Z @ 63 NONAME ; void MPXDbCommonUtil::FindAndReplaceSingleQuote(class TDesC16 const &, class TDes16 &)
+	?FindItemChangedMessageL@MPXDbCommonUtil@@SAHABVCMPXMediaArray@@ABVCMPXMedia@@@Z @ 64 NONAME ; int MPXDbCommonUtil::FindItemChangedMessageL(class CMPXMediaArray const &, class CMPXMedia const &)
+	?Fs@CMPXDbManager@@QAEAAVRFs@@XZ @ 65 NONAME ; class RFs & CMPXDbManager::Fs(void)
+	?GenerateUniqueIdL@MPXDbCommonUtil@@SAKAAVRFs@@W4TMPXGeneralCategory@@ABVTDesC16@@H@Z @ 66 NONAME ; unsigned long MPXDbCommonUtil::GenerateUniqueIdL(class RFs &, enum TMPXGeneralCategory, class TDesC16 const &, int)
+	?GetChangeMessages@CMPXDbActiveTask@@QAEAAVCMPXMediaArray@@XZ @ 67 NONAME ; class CMPXMediaArray & CMPXDbActiveTask::GetChangeMessages(void)
+	?GetColumnTextL@MPXDbCommonUtil@@SA?AVTPtrC16@@AAVRSqlStatement@@H@Z @ 68 NONAME ; class TPtrC16 MPXDbCommonUtil::GetColumnTextL(class RSqlStatement &, int)
+	?GetCommand@CMPXDbActiveTask@@QAEAAVCMPXMedia@@XZ @ 69 NONAME ; class CMPXMedia & CMPXDbActiveTask::GetCommand(void)
+	?GetDRMTypeL@MPXDbCommonUtil@@SA?AW4TMCDrmType@@ABVTDesC16@@@Z @ 70 NONAME ; enum TMCDrmType MPXDbCommonUtil::GetDRMTypeL(class TDesC16 const &)
+	?GetDriveIdMatchVolIdL@MPXDbCommonUtil@@SAHAAVRFs@@I@Z @ 71 NONAME ; int MPXDbCommonUtil::GetDriveIdMatchVolIdL(class RFs &, unsigned int)
+	?GetDriveL@MPXDbCommonUtil@@SAHABVTDesC16@@AAVTDriveUnit@@@Z @ 72 NONAME ; int MPXDbCommonUtil::GetDriveL(class TDesC16 const &, class TDriveUnit &)
+	?GetMimeTypeForUriL@MPXDbCommonUtil@@SA?AVTDataType@@ABVTDesC16@@@Z @ 73 NONAME ; class TDataType MPXDbCommonUtil::GetMimeTypeForUriL(class TDesC16 const &)
+	?GetStep@CMPXDbActiveTask@@QAEHXZ @ 74 NONAME ; int CMPXDbActiveTask::GetStep(void)
+	?GetTask@CMPXDbActiveTask@@QAEKXZ @ 75 NONAME ; unsigned long CMPXDbActiveTask::GetTask(void)
+	?GetVisibleChange@CMPXDbActiveTask@@QAE?AW4TChangeVisibility@1@XZ @ 76 NONAME ; enum CMPXDbActiveTask::TChangeVisibility CMPXDbActiveTask::GetVisibleChange(void)
+	?GetVolIdMatchDriveIdL@MPXDbCommonUtil@@SAIAAVRFs@@H@Z @ 77 NONAME ; unsigned int MPXDbCommonUtil::GetVolIdMatchDriveIdL(class RFs &, int)
+	?InTransaction@CMPXDbManager@@QAEHXZ @ 78 NONAME ; int CMPXDbManager::InTransaction(void)
+	?InitDatabasesL@CMPXDbManager@@QAEXV?$RArray@H@@@Z @ 79 NONAME ; void CMPXDbManager::InitDatabasesL(class RArray<int>)
+	?IsInitialized@CMPXDbManager@@QAEHXZ @ 80 NONAME ; int CMPXDbManager::IsInitialized(void)
+	?IsOpen@CMPXDbManager@@QBEHH@Z @ 81 NONAME ; int CMPXDbManager::IsOpen(int) const
+	?IsRemoteDrive@CMPXDbManager@@QAEHW4TDriveNumber@@@Z @ 82 NONAME ; int CMPXDbManager::IsRemoteDrive(enum TDriveNumber)
+	?NewL@CMPXDbActiveTask@@SAPAV1@AAVMMPXDbActiveTaskObserver@@@Z @ 83 NONAME ; class CMPXDbActiveTask * CMPXDbActiveTask::NewL(class MMPXDbActiveTaskObserver &)
+	?NewL@CMPXResource@@SAPAV1@ABVTDesC16@@@Z @ 84 NONAME ; class CMPXResource * CMPXResource::NewL(class TDesC16 const &)
+	?NewLC@CMPXResource@@SAPAV1@ABVTDesC16@@@Z @ 85 NONAME ; class CMPXResource * CMPXResource::NewLC(class TDesC16 const &)
+	?OpenAllDatabasesL@CMPXDbManager@@QAEXXZ @ 86 NONAME ; void CMPXDbManager::OpenAllDatabasesL(void)
+	?OpenDatabaseL@CMPXDbManager@@QAEXH@Z @ 87 NONAME ; void CMPXDbManager::OpenDatabaseL(int)
+	?PrependMediaL@MPXDbCommonUtil@@SAXAAVCMPXMediaArray@@ABVTDesC16@@W4TMPXGeneralType@@W4TMPXGeneralCategory@@VTMPXItemId@@HIH@Z @ 88 NONAME ; void MPXDbCommonUtil::PrependMediaL(class CMPXMediaArray &, class TDesC16 const &, enum TMPXGeneralType, enum TMPXGeneralCategory, class TMPXItemId, int, unsigned int, int)
+	?PrintDatabaseL@CMPXDbManager@@QAEXXZ @ 89 NONAME ; void CMPXDbManager::PrintDatabaseL(void)
+	?ProcessPatternCharsLC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVTDesC16@@@Z @ 90 NONAME ; class HBufC16 * MPXDbCommonUtil::ProcessPatternCharsLC(class TDesC16 const &)
+	?ProcessSingleQuotesLC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVTDesC16@@@Z @ 91 NONAME ; class HBufC16 * MPXDbCommonUtil::ProcessSingleQuotesLC(class TDesC16 const &)
+	?ReadDesCArrayL@CMPXResource@@QAEPAVCDesC16ArrayFlat@@H@Z @ 92 NONAME ; class CDesC16ArrayFlat * CMPXResource::ReadDesCArrayL(int)
+	?ReadDesCArrayLC@CMPXResource@@QAEPAVCDesC16ArrayFlat@@H@Z @ 93 NONAME ; class CDesC16ArrayFlat * CMPXResource::ReadDesCArrayLC(int)
+	?ReadHBufCL@CMPXResource@@QAEPAVHBufC16@@H@Z @ 94 NONAME ; class HBufC16 * CMPXResource::ReadHBufCL(int)
+	?ReadMenuArrayL@CMPXResource@@QAEPAVCDesC16ArrayFlat@@HAAV?$RArray@H@@@Z @ 95 NONAME ; class CDesC16ArrayFlat * CMPXResource::ReadMenuArrayL(int, class RArray<int> &)
+	?ReadMenuArrayLC@CMPXResource@@QAEPAVCDesC16ArrayFlat@@HAAV?$RArray@H@@@Z @ 96 NONAME ; class CDesC16ArrayFlat * CMPXResource::ReadMenuArrayLC(int, class RArray<int> &)
+	?RecreateAllDatabasesL@CMPXDbManager@@QAEXXZ @ 97 NONAME ; void CMPXDbManager::RecreateAllDatabasesL(void)
+	?RecreateDatabaseL@CMPXDbManager@@QAEXH@Z @ 98 NONAME ; void CMPXDbManager::RecreateDatabaseL(int)
+	?RegenerateAllDatabasesL@CMPXDbManager@@QAEXXZ @ 99 NONAME ; void CMPXDbManager::RegenerateAllDatabasesL(void)
+	?RegisterTableL@CMPXDbManager@@QAEXAAVMMPXTable@@@Z @ 100 NONAME ; void CMPXDbManager::RegisterTableL(class MMPXTable &)
+	?Release@CMPXResource@@QAEXXZ @ 101 NONAME ; void CMPXResource::Release(void)
+	?RollbackL@CMPXDbManager@@QAEXXZ @ 102 NONAME ; void CMPXDbManager::RollbackL(void)
+	?RunError@CMPXDbActiveTask@@MAEHH@Z @ 103 NONAME ; int CMPXDbActiveTask::RunError(int)
+	?RunL@CMPXDbActiveTask@@MAEXXZ @ 104 NONAME ; void CMPXDbActiveTask::RunL(void)
+	?SetHBuf@MPXDbCommonUtil@@SAHAAPAVHBufC16@@PBVTDesC16@@H@Z @ 105 NONAME ; int MPXDbCommonUtil::SetHBuf(class HBufC16 * &, class TDesC16 const *, int)
+	?SetVisibleChange@CMPXDbActiveTask@@QAEXW4TChangeVisibility@1@@Z @ 106 NONAME ; void CMPXDbActiveTask::SetVisibleChange(enum CMPXDbActiveTask::TChangeVisibility)
+	?SqlCriterion64LC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVTDesC16@@_J1@Z @ 107 NONAME ; class HBufC16 * MPXDbCommonUtil::SqlCriterion64LC(class TDesC16 const &, long long, long long)
+	?SqlCriterion64LC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVTDesC16@@_J@Z @ 108 NONAME ; class HBufC16 * MPXDbCommonUtil::SqlCriterion64LC(class TDesC16 const &, long long)
+	?SqlCriterionLC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVTDesC16@@00@Z @ 109 NONAME ; class HBufC16 * MPXDbCommonUtil::SqlCriterionLC(class TDesC16 const &, class TDesC16 const &, class TDesC16 const &)
+	?SqlCriterionLC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVTDesC16@@0@Z @ 110 NONAME ; class HBufC16 * MPXDbCommonUtil::SqlCriterionLC(class TDesC16 const &, class TDesC16 const &)
+	?SqlCriterionLC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVTDesC16@@0H0H@Z @ 111 NONAME ; class HBufC16 * MPXDbCommonUtil::SqlCriterionLC(class TDesC16 const &, class TDesC16 const &, int, class TDesC16 const &, int)
+	?SqlCriterionLC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVTDesC16@@H@Z @ 112 NONAME ; class HBufC16 * MPXDbCommonUtil::SqlCriterionLC(class TDesC16 const &, int)
+	?SqlCriterionLC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVTDesC16@@HH@Z @ 113 NONAME ; class HBufC16 * MPXDbCommonUtil::SqlCriterionLC(class TDesC16 const &, int, int)
+	?StartL@CMPXDbActiveTask@@QAEXKABVCMPXMedia@@@Z @ 114 NONAME ; void CMPXDbActiveTask::StartL(unsigned long, class CMPXMedia const &)
+	?StringFromArrayLC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVCDesC16Array@@ABVTDesC16@@@Z @ 115 NONAME ; class HBufC16 * MPXDbCommonUtil::StringFromArrayLC(class CDesC16Array const &, class TDesC16 const &)
+	?StringFromArraysLC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVCDesC16Array@@0ABVTDesC16@@1@Z @ 116 NONAME ; class HBufC16 * MPXDbCommonUtil::StringFromArraysLC(class CDesC16Array const &, class CDesC16Array const &, class TDesC16 const &, class TDesC16 const &)
+	?TTimeToDesLC@MPXDbCommonUtil@@SAPAVHBufC16@@ABVTTime@@@Z @ 117 NONAME ; class HBufC16 * MPXDbCommonUtil::TTimeToDesLC(class TTime const &)
+	?UpdateMediaL@CMPXDbTable@@MAEXAAVRSqlStatement@@ABV?$TArray@VTMPXAttribute@@@@AAVCMPXMedia@@@Z @ 118 NONAME ; void CMPXDbTable::UpdateMediaL(class RSqlStatement &, class TArray<class TMPXAttribute> const &, class CMPXMedia &)
+	?Version@CMPXDbManager@@QBE?AVTVersion@@XZ @ 119 NONAME ; class TVersion CMPXDbManager::Version(void) const
+	?ExecuteMediaQueryL@CMPXDbTable@@IAEXHABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@ABVTDesC16@@H@Z @ 120 NONAME ; void CMPXDbTable::ExecuteMediaQueryL(int, class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, class TDesC16 const &, int)
+	?ExecuteMediaQueryOnDriveL@CMPXDbTable@@IAEXHABV?$TArray@VTMPXAttribute@@@@AAVCMPXMediaArray@@ABVTDesC16@@@Z @ 121 NONAME ; void CMPXDbTable::ExecuteMediaQueryOnDriveL(int, class TArray<class TMPXAttribute> const &, class CMPXMediaArray &, class TDesC16 const &)
+	?ExecuteSelectQueryOnAllDrivesL@CMPXDbManager@@QAA?AVRSqlStatement@@HV?$TRefByValue@$$CBVTDesC16@@@@ZZ @ 122 NONAME ; class RSqlStatement CMPXDbManager::ExecuteSelectQueryOnAllDrivesL(int, class TRefByValue<class TDesC16 const >, ...)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/eabi/mpxsqlitedbcommonu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,137 @@
+EXPORTS
+	_ZN11CMPXDbTable12DoCheckTableER12RSqlDatabaseRK7TDesC16 @ 1 NONAME
+	_ZN11CMPXDbTable12UpdateMediaLER13RSqlStatementRK6TArrayI13TMPXAttributeER9CMPXMedia @ 2 NONAME
+	_ZN11CMPXDbTable14BaseConstructLEv @ 3 NONAME
+	_ZN11CMPXDbTable16ExecuteIntQueryLERK7TDesC16 @ 4 NONAME
+	_ZN11CMPXDbTable16ExecuteIntQueryLERK7TDesC16S2_ @ 5 NONAME
+	_ZN11CMPXDbTable16ExecuteIntQueryLERK7TDesC16S2_m @ 6 NONAME
+	_ZN11CMPXDbTable16ExecuteIntQueryLERK7TDesC16m @ 7 NONAME
+	_ZN11CMPXDbTable16ExecuteIntQueryLERK7TDesC16mm @ 8 NONAME
+	_ZN11CMPXDbTable16ExecuteIntQueryLEiRK7TDesC16 @ 9 NONAME
+	_ZN11CMPXDbTable16ExecuteSumQueryLERK7TDesC16 @ 10 NONAME
+	_ZN11CMPXDbTable16ExecuteSumQueryLERK7TDesC16S2_ @ 11 NONAME
+	_ZN11CMPXDbTable16ExecuteSumQueryLERK7TDesC16S2_S2_ @ 12 NONAME
+	_ZN11CMPXDbTable16ExecuteSumQueryLERK7TDesC16S2_m @ 13 NONAME
+	_ZN11CMPXDbTable16ExecuteSumQueryLERK7TDesC16S2_mS2_m @ 14 NONAME
+	_ZN11CMPXDbTable16ExecuteSumQueryLERK7TDesC16m @ 15 NONAME
+	_ZN11CMPXDbTable16ExecuteSumQueryLERK7TDesC16mm @ 16 NONAME
+	_ZN11CMPXDbTable16ExecuteSumQueryLERK7TDesC16mmm @ 17 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER14CMPXMediaArrayRK7TDesC16 @ 18 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER14CMPXMediaArrayRK7TDesC16S9_ @ 19 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER14CMPXMediaArrayRK7TDesC16S9_S9_ @ 20 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER14CMPXMediaArrayRK7TDesC16S9_i @ 21 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER14CMPXMediaArrayRK7TDesC16S9_iS9_i @ 22 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER14CMPXMediaArrayRK7TDesC16S9_iij @ 23 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER14CMPXMediaArrayRK7TDesC16i @ 24 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER14CMPXMediaArrayRK7TDesC16ii @ 25 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER14CMPXMediaArrayRK7TDesC16iij @ 26 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER14CMPXMediaArrayiRK7TDesC16 @ 27 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER9CMPXMediaRK7TDesC16 @ 28 NONAME
+	_ZN11CMPXDbTable18ExecuteMediaQueryLERK6TArrayI13TMPXAttributeER9CMPXMediaRK7TDesC16i @ 29 NONAME
+	_ZN11CMPXDbTableC2ER13CMPXDbManager @ 30 NONAME
+	_ZN11CMPXDbTableD0Ev @ 31 NONAME
+	_ZN11CMPXDbTableD1Ev @ 32 NONAME
+	_ZN11CMPXDbTableD2Ev @ 33 NONAME
+	_ZN12CMPXResource10ReadHBufCLEi @ 34 NONAME
+	_ZN12CMPXResource14ReadDesCArrayLEi @ 35 NONAME
+	_ZN12CMPXResource14ReadMenuArrayLEiR6RArrayIiE @ 36 NONAME
+	_ZN12CMPXResource15ReadDesCArrayLCEi @ 37 NONAME
+	_ZN12CMPXResource15ReadMenuArrayLCEiR6RArrayIiE @ 38 NONAME
+	_ZN12CMPXResource4NewLERK7TDesC16 @ 39 NONAME
+	_ZN12CMPXResource5NewLCERK7TDesC16 @ 40 NONAME
+	_ZN12CMPXResource7ReleaseEv @ 41 NONAME
+	_ZN13CMPXDbManager10ConstructLERK4TBufILi256EE @ 42 NONAME
+	_ZN13CMPXDbManager13CreateTablesLER12RSqlDatabase @ 43 NONAME
+	_ZN13CMPXDbManager13ExecuteQueryLEi11TRefByValueIK7TDesC16Ez @ 44 NONAME
+	_ZN13CMPXDbManager13InTransactionEv @ 45 NONAME
+	_ZN13CMPXDbManager13IsInitializedEv @ 46 NONAME
+	_ZN13CMPXDbManager13IsRemoteDriveE12TDriveNumber @ 47 NONAME
+	_ZN13CMPXDbManager13OpenDatabaseLEi @ 48 NONAME
+	_ZN13CMPXDbManager14CloseDatabaseLEi @ 49 NONAME
+	_ZN13CMPXDbManager14InitDatabasesLE6RArrayIiE @ 50 NONAME
+	_ZN13CMPXDbManager14PrintDatabaseLEv @ 51 NONAME
+	_ZN13CMPXDbManager14RegisterTableLER9MMPXTable @ 52 NONAME
+	_ZN13CMPXDbManager15CheckDiskSpaceLEi @ 53 NONAME
+	_ZN13CMPXDbManager17CloseAllDatabasesEv @ 54 NONAME
+	_ZN13CMPXDbManager17OpenAllDatabasesLEv @ 55 NONAME
+	_ZN13CMPXDbManager17RecreateDatabaseLEi @ 56 NONAME
+	_ZN13CMPXDbManager19ExecuteSelectQueryLE11TRefByValueIK7TDesC16Ez @ 57 NONAME
+	_ZN13CMPXDbManager19ExecuteSelectQueryLEi11TRefByValueIK7TDesC16Ez @ 58 NONAME
+	_ZN13CMPXDbManager19ExecuteSelectQueryLEjRK7TDesC16i11TRefByValueIS1_Ez @ 59 NONAME
+	_ZN13CMPXDbManager19ExecuteSelectQueryLEjii11TRefByValueIK7TDesC16Ez @ 60 NONAME
+	_ZN13CMPXDbManager21RecreateAllDatabasesLEv @ 61 NONAME
+	_ZN13CMPXDbManager23RegenerateAllDatabasesLEv @ 62 NONAME
+	_ZN13CMPXDbManager2FsEv @ 63 NONAME
+	_ZN13CMPXDbManager6BeginLEv @ 64 NONAME
+	_ZN13CMPXDbManager7CommitLEv @ 65 NONAME
+	_ZN13CMPXDbManager9RollbackLEv @ 66 NONAME
+	_ZN13CMPXDbManagerC1ER3RFs @ 67 NONAME
+	_ZN13CMPXDbManagerC2ER3RFs @ 68 NONAME
+	_ZN13CMPXDbManagerD0Ev @ 69 NONAME
+	_ZN13CMPXDbManagerD1Ev @ 70 NONAME
+	_ZN13CMPXDbManagerD2Ev @ 71 NONAME
+	_ZN15MPXDbCommonUtil10DeleteFileER3RFsRK7TDesC16 @ 72 NONAME
+	_ZN15MPXDbCommonUtil11DesToTTimeLERK7TDesC16 @ 73 NONAME
+	_ZN15MPXDbCommonUtil11GetDRMTypeLERK7TDesC16 @ 74 NONAME
+	_ZN15MPXDbCommonUtil12AppendMediaLER14CMPXMediaArrayRK7TDesC1615TMPXGeneralType19TMPXGeneralCategory10TMPXItemIdij @ 75 NONAME
+	_ZN15MPXDbCommonUtil12AppendValueLER12CDesC16ArrayS1_RK7TDesC16S4_ @ 76 NONAME
+	_ZN15MPXDbCommonUtil12AppendValueLER12CDesC16ArrayS1_RK7TDesC16m @ 77 NONAME
+	_ZN15MPXDbCommonUtil12TTimeToDesLCERK5TTime @ 78 NONAME
+	_ZN15MPXDbCommonUtil13PrependMediaLER14CMPXMediaArrayRK7TDesC1615TMPXGeneralType19TMPXGeneralCategory10TMPXItemIdiji @ 79 NONAME
+	_ZN15MPXDbCommonUtil14GetColumnTextLER13RSqlStatementi @ 80 NONAME
+	_ZN15MPXDbCommonUtil14SqlCriterionLCERK7TDesC16S2_ @ 81 NONAME
+	_ZN15MPXDbCommonUtil14SqlCriterionLCERK7TDesC16S2_S2_ @ 82 NONAME
+	_ZN15MPXDbCommonUtil14SqlCriterionLCERK7TDesC16S2_iS2_i @ 83 NONAME
+	_ZN15MPXDbCommonUtil14SqlCriterionLCERK7TDesC16i @ 84 NONAME
+	_ZN15MPXDbCommonUtil14SqlCriterionLCERK7TDesC16ii @ 85 NONAME
+	_ZN15MPXDbCommonUtil15AttributeExistsERK6TArrayI13TMPXAttributeERKS1_ @ 86 NONAME
+	_ZN15MPXDbCommonUtil15CreateFullPathLEiRK7TDesC16 @ 87 NONAME
+	_ZN15MPXDbCommonUtil16AddSqlCriterionLER12CDesC16ArrayRK7TDesC16S4_ @ 88 NONAME
+	_ZN15MPXDbCommonUtil16AddSqlCriterionLER12CDesC16ArrayRK7TDesC16i @ 89 NONAME
+	_ZN15MPXDbCommonUtil16CurrentDateDesLCEv @ 90 NONAME
+	_ZN15MPXDbCommonUtil16CurrentTimeDesLCEv @ 91 NONAME
+	_ZN15MPXDbCommonUtil16SqlCriterion64LCERK7TDesC16x @ 92 NONAME
+	_ZN15MPXDbCommonUtil16SqlCriterion64LCERK7TDesC16xx @ 93 NONAME
+	_ZN15MPXDbCommonUtil17GenerateUniqueIdLER3RFs19TMPXGeneralCategoryRK7TDesC16i @ 94 NONAME
+	_ZN15MPXDbCommonUtil17StringFromArrayLCERK12CDesC16ArrayRK7TDesC16 @ 95 NONAME
+	_ZN15MPXDbCommonUtil18GetMimeTypeForUriLERK7TDesC16 @ 96 NONAME
+	_ZN15MPXDbCommonUtil18StringFromArraysLCERK12CDesC16ArrayS2_RK7TDesC16S5_ @ 97 NONAME
+	_ZN15MPXDbCommonUtil20FillInSupportedUIDsLERK6TArrayI13TMPXAttributeER6RArrayIiE @ 98 NONAME
+	_ZN15MPXDbCommonUtil21GetDriveIdMatchVolIdLER3RFsj @ 99 NONAME
+	_ZN15MPXDbCommonUtil21GetVolIdMatchDriveIdLER3RFsi @ 100 NONAME
+	_ZN15MPXDbCommonUtil21ProcessPatternCharsLCERK7TDesC16 @ 101 NONAME
+	_ZN15MPXDbCommonUtil21ProcessSingleQuotesLCERK7TDesC16 @ 102 NONAME
+	_ZN15MPXDbCommonUtil22AddItemChangedMessageLER14CMPXMediaArray10TMPXItemId19TMPXChangeEventType19TMPXGeneralCategoryjS2_ @ 103 NONAME
+	_ZN15MPXDbCommonUtil23FillItemChangedMessageLER9CMPXMedia10TMPXItemId19TMPXChangeEventType19TMPXGeneralCategoryjS2_ @ 104 NONAME
+	_ZN15MPXDbCommonUtil23FindItemChangedMessageLERK14CMPXMediaArrayRK9CMPXMedia @ 105 NONAME
+	_ZN15MPXDbCommonUtil25FindAndReplaceSingleQuoteERK7TDesC16R6TDes16 @ 106 NONAME
+	_ZN15MPXDbCommonUtil7SetHBufERP7HBufC16PK7TDesC16i @ 107 NONAME
+	_ZN15MPXDbCommonUtil9GetDriveLERK7TDesC16R10TDriveUnit @ 108 NONAME
+	_ZN16CMPXDbActiveTask10GetCommandEv @ 109 NONAME
+	_ZN16CMPXDbActiveTask16GetVisibleChangeEv @ 110 NONAME
+	_ZN16CMPXDbActiveTask16SetVisibleChangeENS_17TChangeVisibilityE @ 111 NONAME
+	_ZN16CMPXDbActiveTask17GetChangeMessagesEv @ 112 NONAME
+	_ZN16CMPXDbActiveTask4NewLER24MMPXDbActiveTaskObserver @ 113 NONAME
+	_ZN16CMPXDbActiveTask4RunLEv @ 114 NONAME
+	_ZN16CMPXDbActiveTask6StartLEmRK9CMPXMedia @ 115 NONAME
+	_ZN16CMPXDbActiveTask7GetStepEv @ 116 NONAME
+	_ZN16CMPXDbActiveTask7GetTaskEv @ 117 NONAME
+	_ZN16CMPXDbActiveTask8DoCancelEv @ 118 NONAME
+	_ZN16CMPXDbActiveTask8RunErrorEi @ 119 NONAME
+	_ZN16CMPXDbActiveTaskD0Ev @ 120 NONAME
+	_ZN16CMPXDbActiveTaskD1Ev @ 121 NONAME
+	_ZN16CMPXDbActiveTaskD2Ev @ 122 NONAME
+	_ZNK13CMPXDbManager13DatabaseCountEv @ 123 NONAME
+	_ZNK13CMPXDbManager6IsOpenEi @ 124 NONAME
+	_ZNK13CMPXDbManager7DbDriveEi @ 125 NONAME
+	_ZNK13CMPXDbManager7VersionEv @ 126 NONAME
+	_ZTI11CMPXDbTable @ 127 NONAME ; #<TI>#
+	_ZTI12CMPXResource @ 128 NONAME ; #<TI>#
+	_ZTI13CMPXDbManager @ 129 NONAME ; #<TI>#
+	_ZTV11CMPXDbTable @ 130 NONAME ; #<VT>#
+	_ZTV12CMPXResource @ 131 NONAME ; #<VT>#
+	_ZTV13CMPXDbManager @ 132 NONAME ; #<VT>#
+	_ZN11CMPXDbTable18ExecuteMediaQueryLEiRK6TArrayI13TMPXAttributeER14CMPXMediaArrayRK7TDesC16i @ 133 NONAME
+	_ZN11CMPXDbTable25ExecuteMediaQueryOnDriveLEiRK6TArrayI13TMPXAttributeER14CMPXMediaArrayRK7TDesC16 @ 134 NONAME
+	_ZN13CMPXDbManager30ExecuteSelectQueryOnAllDrivesLEi11TRefByValueIK7TDesC16Ez @ 135 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project Collection SQLite common.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxsqlitedbcommon.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/group/mpxsqlitedbcommon.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxsqlitedbcommon.
+*
+*/
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxsqlitedbcommon.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x101FFCAE
+VENDORID        VID_DEFAULT
+
+CAPABILITY      CAP_GENERAL_DLL
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxdbcommonutil.cpp
+SOURCE          mpxresource.cpp
+SOURCE          mpxdbmanager.cpp
+SOURCE          mpxdbtable.cpp
+SOURCE          mpxdbactivetask.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+SYSTEMINCLUDE   /epoc32/include/mmf/server
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         sqldb.lib
+LIBRARY         sysutil.lib
+LIBRARY         caf.lib
+LIBRARY         cafutils.lib
+LIBRARY         apgrfx.lib
+LIBRARY         apmime.lib
+LIBRARY         hash.lib
+
+LIBRARY         estor.lib
+LIBRARY         mmfcontrollerframework.lib   // CMMFMetaDataEntry
+LIBRARY         mmfstandardcustomcommands.lib
+LIBRARY         bafl.lib
+LIBRARY         ecom.lib // DestroyedImplementation
+LIBRARY         mpxcommon.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbactivetask.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Active object to split up long running db tasks
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <mpxlog.h>
+#include "mpxdbactivetask.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXDbActiveTask::CMPXDbActiveTask( MMPXDbActiveTaskObserver& aObserver ) :
+    CActive( CActive::EPriorityStandard ),
+    iObserver( aObserver )
+    {
+    MPX_FUNC("CMPXDbActiveTask::CMPXDbActiveTask");
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CMPXDbActiveTask::ConstructL()
+    {
+    MPX_FUNC("CMPXDbActiveTask::ConstructL");
+    }
+
+// ---------------------------------------------------------------------------
+// Two-Phase Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXDbActiveTask* CMPXDbActiveTask::NewL( MMPXDbActiveTaskObserver& aObserver )
+    {
+    MPX_FUNC("CMPXDbActiveTask::NewL");
+
+    CMPXDbActiveTask* self = new(ELeave) CMPXDbActiveTask( aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXDbActiveTask::~CMPXDbActiveTask()
+    {
+    MPX_FUNC("CMPXDbActiveTask::~CMPXDbActiveTask");
+
+    Cancel();
+    delete iChangeMessages;
+    delete iCurCommand;
+    }
+
+// ---------------------------------------------------------------------------
+// Start the operation
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbActiveTask::StartL( TMPXCommandId aTask, const CMPXCommand& aCommand )
+    {
+    delete iCurCommand;
+    iCurCommand = NULL;
+    iCurCommand = CMPXMedia::NewL( aCommand );
+    iCurTask = aTask;
+    iCurStep = 0;
+    delete iChangeMessages;
+    iChangeMessages = NULL;
+    iChangeMessages = CMPXMessageArray::NewL();
+    iCurVisibleChange = ENotVisibile;
+
+    // Start the AO
+    iStatus = KRequestPending;
+    SetActive();
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete( status, KErrNone );
+    }
+
+// ---------------------------------------------------------------------------
+// Get the current step
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXDbActiveTask::GetStep()
+    {
+    MPX_FUNC("CMPXDbActiveTask::GetStep");
+    return iCurStep;
+    }
+
+// ---------------------------------------------------------------------------
+// Get the current task
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TMPXCommandId CMPXDbActiveTask::GetTask()
+    {
+    MPX_FUNC("CMPXDbActiveTask::GetTask");
+    return iCurTask;
+    }
+
+// ---------------------------------------------------------------------------
+// Get the current media
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXMedia& CMPXDbActiveTask::GetCommand()
+    {
+    MPX_FUNC("CMPXDbActiveTask::GetCommand");
+    return *iCurCommand;
+    }
+
+// ---------------------------------------------------------------------------
+// Get the current change messages
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXMessageArray& CMPXDbActiveTask::GetChangeMessages()
+    {
+    MPX_FUNC("CMPXDbActiveTask::GetChangeMessages");
+    return *iChangeMessages;
+    }
+
+// ---------------------------------------------------------------------------
+// Set the visible change flag
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbActiveTask::SetVisibleChange( TChangeVisibility aChange )
+    {
+    MPX_FUNC("CMPXDbActiveTask::SetVisibleChange");
+    iCurVisibleChange = aChange;
+    }
+
+// ---------------------------------------------------------------------------
+// Get the visible change flag
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXDbActiveTask::TChangeVisibility CMPXDbActiveTask::GetVisibleChange()
+    {
+    MPX_FUNC("CMPXDbActiveTask::GetVisibleChange");
+    return iCurVisibleChange;
+    }
+
+// ---------------------------------------------------------------------------
+// From CActive
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbActiveTask::RunL()
+    {
+    MPX_FUNC("CMPXDbActiveTask::RunL");
+
+    // ETrue is done, EFalse is more to do
+    //
+    if( iObserver.HandleStepL() )
+        {
+        iObserver.HandleOperationCompleted( KErrNone );
+        delete iCurCommand;
+        iCurCommand = NULL;
+        delete iChangeMessages;
+        iChangeMessages = NULL;
+        }
+    else
+        {
+        ++iCurStep;
+        iStatus = KRequestPending;
+        SetActive();
+        TRequestStatus* status = &iStatus;
+        User::RequestComplete( status, KErrNone );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CActive
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbActiveTask::DoCancel()
+    {
+    MPX_FUNC("CMPXDbActiveTask::DoCancel");
+
+    // Callback and cleanup
+    iObserver.HandleOperationCompleted( KErrCancel );
+    delete iCurCommand;
+    iCurCommand = NULL;
+    iChangeMessages->Reset();
+    }
+
+// ---------------------------------------------------------------------------
+// From CActive
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXDbActiveTask::RunError( TInt aError )
+    {
+    MPX_FUNC("CMPXDbActiveTask::RunError");
+
+    // Callback and cleanup
+    iObserver.HandleOperationCompleted( aError );
+    delete iCurCommand;
+    iCurCommand = NULL;
+    iChangeMessages->Reset();
+
+    return KErrNone;
+    }
+
+// END OF FILE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbcommonutil.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1171 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The class CMPXDbCommonUtil which contains utilities functions
+*
+*/
+
+
+// INCLUDE FILES
+#include <bautils.h>
+#include <caf/data.h>
+#include <caf/virtualpathptr.h>
+#include <hash.h>
+#include <apgcli.h>
+#include <apmstd.h>
+#include <sqldb.h>
+
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxlog.h>
+
+#include "mpxdbcommonstd.h"
+#include "mpxdbcommondef.h"
+#include "mpxdbcommonutil.h"
+
+// CONSTANTS
+_LIT(KPathStart, ":\\");
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------------------------------------
+// Set HBufC data member.
+// ----------------------------------------------------------------------------------------------------------
+//
+EXPORT_C TInt MPXDbCommonUtil::SetHBuf(
+    HBufC*& aBuf,
+    const TDesC* aSource,
+    TInt aMaxLen /*= -1*/)
+    {
+    TInt ret( KErrNone );
+    delete aBuf;
+    aBuf = NULL;
+
+    if (aSource)
+        {
+        if (aMaxLen != -1 && aSource->Length() > aMaxLen)
+            {
+            aBuf = aSource->Left(aMaxLen).Alloc();
+            ret = KErrOverflow;
+            }
+        else
+            {
+            aBuf = aSource->Alloc();
+            }
+        }
+    else
+        {
+        aBuf = HBufC::New(0);
+        }
+
+    if (!aBuf)
+        {
+        ret = KErrNoMemory;
+        }
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Replace single quotes `'` with two single quotes `''` as text queries are
+// delimited by single quotes
+// also replace 0x00 and '\t' as they will cause crash in SQLite and UI respectively
+// ----------------------------------------------------------------------------------------------------------
+//
+EXPORT_C void MPXDbCommonUtil::FindAndReplaceSingleQuote(const TDesC& aSrc, TDes& aTrg)
+    {
+    TText ch;
+    TInt srcLen(aSrc.Length());
+
+    for (TInt i = 0; i < srcLen; ++i)
+        {
+        ch = aSrc[i];
+        if((ch == 0) || (ch == TText('\t')))
+            {
+            aTrg.Append(TText(' '));
+            }
+        else
+            {
+            aTrg.Append(ch);
+            if (ch == TText('\''))
+                {
+                aTrg.Append(ch);
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Delete file from file system
+// ----------------------------------------------------------------------------------------------------------
+//
+EXPORT_C TInt MPXDbCommonUtil::DeleteFile(
+    RFs& aFs,
+    const TDesC& aFile)
+    {
+    TInt ret(KErrNone);
+    if(BaflUtils::FileExists(aFs, aFile))
+        {
+         ret = aFs.Delete(aFile);
+
+        if (ret == KErrAccessDenied)
+            {
+            aFs.SetAtt(aFile,KEntryAttNormal,KEntryAttReadOnly);
+            ret = aFs.Delete(aFile);
+            }
+        }
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Get the drive Id with a given volume unique Id
+// ----------------------------------------------------------------------------------------------------------
+//
+EXPORT_C TInt MPXDbCommonUtil::GetDriveIdMatchVolIdL(
+    RFs& aFs,
+    TUint aVolumeId)
+    {
+    TDriveList driveList;
+    TBool found(EFalse);
+    TInt driveNum(EDriveA);
+
+    User::LeaveIfError(aFs.DriveList(driveList));
+    for (; driveNum <= EDriveZ; ++driveNum)
+        {
+        if (driveList[driveNum])
+            {
+            TVolumeInfo volInfo;
+
+            if ((aFs.Volume(volInfo, driveNum) == KErrNone) &&
+                (volInfo.iUniqueID == aVolumeId))
+                {
+                found = ETrue;
+                break;
+                }
+            }
+        }
+
+    if (!found)
+        {
+        driveNum = KErrNotFound;
+        }
+
+    return driveNum;
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Get the volume Id with a given drive Id
+// ----------------------------------------------------------------------------------------------------------
+//
+EXPORT_C TUint MPXDbCommonUtil::GetVolIdMatchDriveIdL(
+    RFs& aFs,
+    TInt aDriveId)
+    {
+    TUint volId (0);
+    TVolumeInfo volInfo;
+    TInt err = aFs.Volume(volInfo, aDriveId);
+    if (err == KErrNone)
+        {
+        volId = volInfo.iUniqueID;
+        }
+    else if (err == KErrNotReady)
+        {
+        volId = 0;
+        }
+    else
+        {
+        User::Leave(err);
+        }
+
+    return volId;
+    }
+
+// ----------------------------------------------------------------------------
+// Generate a 32bits Unique Id with MD5
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 MPXDbCommonUtil::GenerateUniqueIdL(
+    RFs& aFs,
+    TMPXGeneralCategory aTableId,
+    const TDesC& aName,
+    TBool aCaseSensitive)
+    {
+    MPX_FUNC("MPXDbCommonUtil::GenerateUniqueIdL");
+
+    TInt extractPos(0);
+
+    if( aName.Find(KPathStart) == KMCPathStartWithColon )
+        {
+        // aName is a filename
+        extractPos = KMCPathStartPos;     // c:\..., include first '\' of the path
+        }
+
+    TBuf<KMaxFileName+KMCIntegerLen> fileName;
+    if( extractPos )
+        {
+        // append volume's unique Id to path to maintain uniqueness
+        TDriveUnit driveUnit( aName );
+        TUint volId = MPXDbCommonUtil::GetVolIdMatchDriveIdL(aFs, driveUnit);
+        if( volId )
+            {
+            fileName.AppendNum( volId );
+            }
+        else
+            {
+            // If media/drive doesn't exist, using whole path
+            extractPos = 0;
+            }
+        }
+
+    // append the path part
+    fileName.Append( aName.Mid( extractPos ) );
+
+    if( !aCaseSensitive )
+        {
+        fileName.LowerCase();
+        }
+
+    TInt narrowFileLen(0);
+    TPtrC8 narrowFileName;
+    #if defined(_UNICODE)
+        narrowFileLen = fileName.Length() * 2;
+        narrowFileName.Set((TUint8*)fileName.Ptr(), narrowFileLen);
+    #else
+        narrowFileLen = fileName.Length();
+        narrowFileName.Set(fileName.Ptr(), narrowFileLen);
+    #endif
+
+    CMD5* hasher = CMD5::NewL();
+    CleanupStack::PushL( hasher );
+    hasher->Reset();
+    TBuf8<16> hash( hasher->Hash( narrowFileName ) );   //hashed to 128bits
+    CleanupStack::PopAndDestroy( hasher );
+
+    const TText8* ptr = hash.Ptr();
+
+    TUint32 uniqueId(0);
+    uniqueId = aTableId << 28;
+    uniqueId |= (ptr[3]&0x0F)<<24 | (ptr[2]<<16) | (ptr[1]<<8) | ptr[0];
+    return uniqueId;
+    }
+
+// ---------------------------------------------------------------------------
+// Append an item into the media array
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void MPXDbCommonUtil::AppendMediaL(
+    CMPXMediaArray& aArray,
+    const TDesC& aTitle,
+    TMPXGeneralType aType,
+    TMPXGeneralCategory aCat,
+    TMPXItemId aId,
+    TInt aNonPermissibleActions,
+    TUint aDbflag)
+    {
+    MPX_FUNC("MPXDbCommonUtil::AppendMediaL");
+
+    CMPXMedia* entry = ConstructMediaLC(aTitle, aType, aCat, aId, aNonPermissibleActions, aDbflag);
+    aArray.AppendL(*entry);
+    CleanupStack::PopAndDestroy(entry);
+    }
+
+// ----------------------------------------------------------------------------
+// Append an item into the media array
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void MPXDbCommonUtil::PrependMediaL(
+    CMPXMediaArray& aArray,
+    const TDesC& aTitle,
+    TMPXGeneralType aType,
+    TMPXGeneralCategory aCat,
+    TMPXItemId aId /* = 0 */,
+    TInt aNonPermissibleActions /* = 0 */,
+    TUint aDbflag /* = 0 */,
+    TInt aPos /* = 0 */)
+    {
+    MPX_FUNC("MPXDbCommonUtil::PrependMediaL");
+
+    CMPXMedia* entry = ConstructMediaLC(aTitle, aType, aCat, aId, aNonPermissibleActions, aDbflag);
+    User::LeaveIfError(aArray.Insert(*entry, aPos));
+    CleanupStack::PopAndDestroy(entry);
+    }
+
+// ----------------------------------------------------------------------------
+// Append an item into the media array
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void MPXDbCommonUtil::FillInSupportedUIDsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    RArray<TInt>& aSupportedIds)
+    {
+    MPX_FUNC("MPXDbCommonUtil::FillInSupportedUIDs");
+
+    TInt attrCount(aAttrs.Count());
+    for (TInt i = 0; i < attrCount; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdGeneral)
+            {
+            aSupportedIds.AppendL(KMPXMediaIdGeneral);
+            }
+        else if (aAttrs[i].ContentId() == KMPXMediaIdMusic)
+            {
+            aSupportedIds.AppendL(KMPXMediaIdMusic);
+            }
+        else if (aAttrs[i].ContentId() == KMPXMediaIdAudio)
+            {
+            aSupportedIds.AppendL(KMPXMediaIdAudio);
+            }
+        else if (aAttrs[i].ContentId() == KMPXMediaIdDrm)
+            {
+            aSupportedIds.AppendL(KMPXMediaIdDrm);
+            }
+        else if (aAttrs[i].ContentId() == KMPXMediaIdCollectionDetails)
+            {
+            aSupportedIds.AppendL(KMPXMediaIdCollectionDetails);
+            }
+        else
+            {
+            // ignore attribute
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Fill in change event message with the given info
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void MPXDbCommonUtil::FillItemChangedMessageL(
+    CMPXMessage& aMessage,
+    TMPXItemId aId,
+    TMPXChangeEventType aChangeType,
+    TMPXGeneralCategory aCategory,
+    TUint aUid,
+    TMPXItemId aDeprecatedId)
+    {
+    MPX_FUNC("MPXDbCommonUtil::FillItemChangedMessageL");
+    MPX_DEBUG5("MPXDbCommonUtil::FillItemChangedMessageL: type [%d], category [%d], id[0x%x], oldId[0x%x]",
+               aChangeType, aCategory, aId.iId1, aDeprecatedId.iId1);
+
+    aMessage.SetTObjectValueL<TMPXMessageId>(KMPXMessageGeneralId, KMPXMessageIdItemChanged);
+    aMessage.SetTObjectValueL<TUid>(KMPXMessageCollectionId, TUid::Uid(aUid));
+    aMessage.SetTObjectValueL<TMPXChangeEventType>(KMPXMessageChangeEventType, aChangeType);
+    aMessage.SetTObjectValueL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory, aCategory);
+    aMessage.SetTObjectValueL<TMPXItemId>(KMPXMessageMediaGeneralId, aId);
+
+    if ((aDeprecatedId != 0) && (aId != aDeprecatedId))
+        {
+        if ( aCategory == EMPXAlbum && aChangeType == EMPXItemModified )
+            {
+            aMessage.SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, aId);
+            }
+        else
+            {
+            aMessage.SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, aDeprecatedId);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Add an item changed message to the message array
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void MPXDbCommonUtil::AddItemChangedMessageL(
+    CMPXMessageArray& aMessageArray,
+    TMPXItemId aId,
+    TMPXChangeEventType aChangeType,
+    TMPXGeneralCategory aCategory,
+    TUint aUid,
+    TMPXItemId aDeprecatedId /* = 0 */)
+    {
+    MPX_FUNC("MPXDbCommonUtil::AddItemChangedMessageL");
+    CMPXMessage* message = CMPXMedia::NewL();
+    CleanupStack::PushL(message);
+
+    FillItemChangedMessageL(*message, aId, aChangeType, aCategory, aUid, aDeprecatedId);
+    if (FindItemChangedMessageL(aMessageArray, *message) == KErrNotFound)
+        {
+        aMessageArray.AppendL(*message); // ownership xfer
+        }
+    CleanupStack::PopAndDestroy(message);
+    }
+
+// ----------------------------------------------------------------------------
+// Find the message in the array, if not KErrNotFound is returned; otherwise the
+// index of the first matching message is returned
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt MPXDbCommonUtil::FindItemChangedMessageL(
+    const CMPXMessageArray& aMessageArray,
+    const CMPXMessage& aMessage)
+    {
+    MPX_FUNC("MPXDbCommonUtil::FindItemChangedMessageL");
+
+    TInt index(KErrNotFound);
+    TInt messageCount(aMessageArray.Count());
+
+    for (TInt i = 0; i < messageCount; ++i)
+        {
+        CMPXMessage* message = aMessageArray.AtL(i);
+        
+        if (message->IsSupported(KMPXMessageGeneralId) &&
+            message->IsSupported(KMPXMessageCollectionId) &&
+            message->IsSupported(KMPXMessageChangeEventType) &&
+            message->IsSupported(KMPXMessageMediaGeneralCategory) &&
+            message->IsSupported(KMPXMessageMediaGeneralId) &&
+            aMessage.IsSupported(KMPXMessageGeneralId) &&
+            aMessage.IsSupported(KMPXMessageCollectionId) &&
+            aMessage.IsSupported(KMPXMessageChangeEventType) &&
+            aMessage.IsSupported(KMPXMessageMediaGeneralCategory) &&
+            aMessage.IsSupported(KMPXMessageMediaGeneralId))
+            {
+            if (message->ValueTObjectL<TMPXMessageId>(KMPXMessageGeneralId) == aMessage.ValueTObjectL<TMPXMessageId>(KMPXMessageGeneralId) &&
+                message->ValueTObjectL<TUid>(KMPXMessageCollectionId) == aMessage.ValueTObjectL<TUid>(KMPXMessageCollectionId) &&
+                message->ValueTObjectL<TMPXChangeEventType>(KMPXMessageChangeEventType) == aMessage.ValueTObjectL<TMPXChangeEventType>(KMPXMessageChangeEventType) &&
+                message->ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory) == aMessage.ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory) &&
+                message->ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId) == aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId))
+                {
+                if (!message->IsSupported(KMPXMessageMediaDeprecatedId) &&
+                    !aMessage.IsSupported(KMPXMessageMediaDeprecatedId))
+                    {
+                    index = i;
+                    break;
+                    }
+                else if (message->IsSupported(KMPXMessageMediaDeprecatedId) &&
+                         aMessage.IsSupported(KMPXMessageMediaDeprecatedId))
+                    {
+                    if (message->ValueTObjectL<TMPXItemId>(KMPXMessageMediaDeprecatedId) ==
+                        aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageMediaDeprecatedId))
+                        {
+                        index = i;
+                        break;
+                       }
+                    }
+                else
+                    {
+                    // else do nothing
+                    }
+                }
+            }
+        }
+
+    return index;
+    }
+
+// ----------------------------------------------------------------------------
+// Get the DRM protection type of the file
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TMCDrmType MPXDbCommonUtil::GetDRMTypeL(const TDesC& aFile)
+    {
+    MPX_FUNC("MPXDbCommonUtil::GetDRMTypeL");
+
+    using namespace ContentAccess;
+    TInt drmProtected(0);
+    TVirtualPathPtr virtualPath(aFile, KDefaultContentObject);
+    CData* content = CData::NewL(virtualPath, EPeek, EContentShareReadOnly);
+    CleanupStack::PushL(content);
+    User::LeaveIfError(content->GetAttribute(EIsProtected, drmProtected));
+    CleanupStack::PopAndDestroy( content );
+    return drmProtected? EMCDrmOmaDrm : EMCDrmNone;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbUtil::ProcessSingleQuotesLC
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::ProcessSingleQuotesLC(
+    const TDesC& aString)
+    {
+    MPX_FUNC("MPXDbCommonUtil::ProcessSingleQuotesLC");
+
+    // reserve space for all single quotes (double the size)
+    HBufC* value = HBufC::NewLC(aString.Length() * 2);
+    TPtr valuePtr(value->Des());
+
+    MPXDbCommonUtil::FindAndReplaceSingleQuote(aString, valuePtr);
+
+    return value;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbUtil::ProcessPatternCharsLC
+// 1) a percentage needs to be escaped for sqlite followed by
+//    another percentage sign for escaping % for descriptor formatting, i.e.
+//    % --> %% (this percentage will be treated as a percentage instead of
+//    pattern matching)
+// 2) since back slash is used for escaping the pattern characters, user
+//    specified back slash should be escapped as well, i.e. \ --> \\
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::ProcessPatternCharsLC(
+    const TDesC& aString)
+    {
+    MPX_FUNC("MPXDbCommonUtil::ProcessPatternCharsLC");
+
+    // reserve space for all percentage signs (triple the size because % should
+    // be replaced by %%)
+    TInt srcLen(aString.Length());
+    HBufC* targetString = HBufC::NewLC(aString.Length() * 3);
+    TPtr targetStringPtr(targetString->Des());
+
+    TPtrC ch;
+    for (TInt i = 0; i < srcLen; ++i)
+        {
+        ch.Set(&aString[i], 1);
+        if (ch.CompareF(KMCPercentage) == 0)
+            {
+            targetStringPtr.Append(KMCPercentage);
+            }
+           else if ( ch.CompareF( KMCBackSlash ) == 0 )
+            {
+            targetStringPtr.Append(KMCBackSlash);
+            }
+        targetStringPtr.Append(ch);            
+        }
+
+    MPX_DEBUG3("    original=%S, new=%S", &aString, targetString);
+    
+    return targetString;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructs an int SQL criterion
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::SqlCriterionLC(
+    const TDesC& aCriterion,
+    TInt aValue)
+    {
+    MPX_FUNC("MPXDbCommonUtil::SqlCriterionLC");
+
+    HBufC* sqlCriterion = HBufC::NewLC(aCriterion.Length() + KMCIntegerLen);
+    TPtr ptr = sqlCriterion->Des();
+    ptr.Format(aCriterion, aValue);
+    return sqlCriterion;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructs an int64 SQL criterion
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::SqlCriterion64LC(
+    const TDesC& aCriterion,
+    TInt64 aValue)
+    {
+    MPX_FUNC("MPXDbCommonUtil::SqlCriterion64LC");
+
+    HBufC* sqlCriterion = HBufC::NewLC(aCriterion.Length() + KMCInt64Len);
+    TPtr ptr = sqlCriterion->Des();
+    ptr.Format(aCriterion, aValue);
+    return sqlCriterion;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructs an SQL criterion using two int values
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::SqlCriterionLC(
+    const TDesC& aCriterion,
+    TInt aValue1,
+    TInt aValue2)
+    {
+    MPX_FUNC("MPXDbCommonUtil::SqlCriterionLC 2");
+
+    HBufC* sqlCriterion = HBufC::NewLC(aCriterion.Length() + 2 * KMCIntegerLen);
+    TPtr ptr = sqlCriterion->Des();
+    ptr.Format(aCriterion, aValue1, aValue2);
+    return sqlCriterion;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructs an SQL criterion using two int64 values
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::SqlCriterion64LC(
+    const TDesC& aCriterion,
+    TInt64 aValue1,
+    TInt64 aValue2)
+    {
+    MPX_FUNC("MPXDbCommonUtil::SqlCriterion64LC 2");
+
+    HBufC* sqlCriterion = HBufC::NewLC(aCriterion.Length() + 2 * KMCInt64Len);
+    TPtr ptr = sqlCriterion->Des();
+    ptr.Format(aCriterion, aValue1, aValue2);
+    return sqlCriterion;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructs a descriptor SQL criterion
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::SqlCriterionLC(
+    const TDesC& aCriterion,
+    const TDesC& aValue)
+    {
+    MPX_FUNC("MPXDbCommonUtil::SqlCriterionLC 3");
+
+    HBufC* value = ProcessSingleQuotesLC(aValue);
+
+    HBufC* sqlCriterion = HBufC::NewL(aCriterion.Length() + value->Length());
+    TPtr ptr(sqlCriterion->Des());
+    ptr.Format(aCriterion, value);
+
+    CleanupStack::PopAndDestroy(value);
+    CleanupStack::PushL(sqlCriterion);
+    return sqlCriterion;
+    }
+    
+// ----------------------------------------------------------------------------
+// Constructs a descriptor SQL criterion
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::SqlCriterionLC(
+    const TDesC& aCriterion,
+    const TDesC& aValue1,
+    const TDesC& aValue2)
+    {
+    MPX_FUNC("MPXDbCommonUtil::SqlCriterionLC 3");
+
+    HBufC* value1 = ProcessSingleQuotesLC(aValue1);
+    HBufC* value2 = ProcessSingleQuotesLC(aValue2);
+
+    HBufC* sqlCriterion = HBufC::NewL(aCriterion.Length() + 
+                                      value1->Length() + 
+                                      value2->Length());
+    TPtr ptr(sqlCriterion->Des());
+    ptr.Format(aCriterion, value1, value2);
+
+    CleanupStack::PopAndDestroy(value2);
+    CleanupStack::PopAndDestroy(value1);
+    CleanupStack::PushL(sqlCriterion);
+    return sqlCriterion;
+    }
+    
+// ----------------------------------------------------------------------------
+// Constructs a descriptor SQL criterion
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::SqlCriterionLC(
+    const TDesC& aCriterion,
+    const TDesC& aValue1,
+    TInt aValue2,
+    const TDesC& aValue3,
+    TInt aValue4)
+    {
+    MPX_FUNC("MPXDbCommonUtil::SqlCriterionLC 3");
+
+    HBufC* value1 = ProcessSingleQuotesLC(aValue1);
+    HBufC* value3 = ProcessSingleQuotesLC(aValue3);
+
+    HBufC* sqlCriterion = HBufC::NewL(aCriterion.Length() + 
+                                      value1->Length() + 
+                                      value3->Length() + 
+                                      2 * KMCIntegerLen);
+    TPtr ptr(sqlCriterion->Des());
+    ptr.Format(aCriterion, value1, aValue2, value3, aValue4);
+
+    CleanupStack::PopAndDestroy(value3);
+    CleanupStack::PopAndDestroy(value1);
+    CleanupStack::PushL(sqlCriterion);
+    return sqlCriterion;
+    }    
+
+// ----------------------------------------------------------------------------
+// Constructs and adds an int SQL criterion to the criteria array
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt MPXDbCommonUtil::AddSqlCriterionL(
+    CDesCArray& aSqlCriteria,
+    const TDesC& aCriterion,
+    TInt aValue)
+    {
+    MPX_FUNC("MPXDbCommonUtil::AddSqlCriterionL");
+
+    HBufC* sqlCriterion = SqlCriterionLC(aCriterion, aValue);
+    TInt length = sqlCriterion->Length();
+    aSqlCriteria.AppendL(*sqlCriterion);
+    CleanupStack::PopAndDestroy(sqlCriterion);
+    return length;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructs and adds a string SQL criterion to the criteria array
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt MPXDbCommonUtil::AddSqlCriterionL(
+    CDesCArray& aSqlCriteria,
+    const TDesC& aCriterion,
+    const TDesC& aValue)
+    {
+    MPX_FUNC("MPXDbCommonUtil::AddSqlCriterionL");
+
+    HBufC* sqlCriterion = SqlCriterionLC(aCriterion, aValue);
+    TInt length = sqlCriterion->Length();
+    aSqlCriteria.AppendL(*sqlCriterion);
+    CleanupStack::PopAndDestroy(sqlCriterion);
+    return length;
+    }
+
+
+// ----------------------------------------------------------------------------
+// Create a full path with input drive Id and path
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::CreateFullPathL(
+    TInt aDriveId,
+    const TDesC& aPath)
+    {
+    MPX_FUNC("MPXDbCommonUtil::CreateFullPathL");
+
+    HBufC* hbuf = HBufC::NewLC(aPath.Length() + KMaxDriveName);
+    TPtr fullPath(hbuf->Des());
+
+    if (aDriveId != KErrNotFound)
+        {
+        TDriveUnit driveUnit(aDriveId);
+        fullPath.Copy(driveUnit.Name());
+        }
+
+    fullPath.Append(aPath);
+    CleanupStack::Pop(hbuf);
+    return hbuf;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::AppendValueL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void MPXDbCommonUtil::AppendValueL(
+    CDesCArray& aFields,
+    CDesCArray& aValues,
+    const TDesC& aField,
+    const TDesC& aValue)
+    {
+    MPX_FUNC("MPXDbCommonUtil::AppendValueL");
+
+    aFields.AppendL(aField);
+
+    HBufC* value = HBufC::NewLC(aValue.Length() * 2 + 2);
+    TPtr valuePtr(value->Des());
+
+    MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue, valuePtr);
+
+    // use 'value' instead of value, 0 length strings should be ''
+    //
+    if( valuePtr.Length() )
+        {
+        valuePtr.Insert(0, KMCSingleQuote);
+        valuePtr.Append(KMCSingleQuote);
+        }
+    else
+        {
+        valuePtr.Append(KMCSingleQuote);
+        valuePtr.Append(KMCSingleQuote);
+        }
+    aValues.AppendL(valuePtr);
+
+    CleanupStack::PopAndDestroy(value);
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::AppendValueL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void MPXDbCommonUtil::AppendValueL(
+    CDesCArray& aFields,
+    CDesCArray& aValues,
+    const TDesC& aField,
+    TUint32 aValue)
+    {
+    MPX_FUNC("MPXDbCommonUtil::AppendValueL");
+
+    aFields.AppendL(aField);
+    TBuf<KMCIntegerLen> value;
+    value.AppendNum(static_cast<TInt64>(aValue));
+    aValues.AppendL(value);
+    }
+
+// ----------------------------------------------------------------------------
+// Gets the MIME type for a specified URI
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TDataType MPXDbCommonUtil::GetMimeTypeForUriL(
+    const TDesC& aUri)
+    {
+    MPX_FUNC("MPXDbUtil::GetMimeTypeForUriL");
+
+    TParsePtrC parse(aUri);
+    RApaLsSession appArc;
+    User::LeaveIfError(appArc.Connect());
+    CleanupClosePushL(appArc);
+    TUid dummyUid(KNullUid);
+    TDataType mimeType;
+    appArc.AppForDocument(aUri, dummyUid, mimeType);
+    CleanupStack::PopAndDestroy(&appArc);
+
+    return mimeType;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::StringFromArrayLC
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::StringFromArrayLC(
+    const CDesCArray& aArray,
+    const TDesC& aSeparator)
+    {
+    MPX_FUNC("MPXDbCommonUtil::StringFromArrayLC");
+
+    HBufC* str(NULL);
+    TInt count(aArray.Count());
+    if (count)
+        {
+        TInt len(0);
+        TInt index(0);
+        for (index = 0; index < count; ++index)
+            {
+            len += aArray[index].Length();
+            }
+
+        str = HBufC::NewLC(len + (aSeparator.Length() * (count - 1)));
+        TPtr ptr(str->Des());
+        TPtrC16 item;
+        for (index = 0; index < count; ++index)
+            {
+            item.Set(aArray[index]);
+            ptr.Append(item);
+            MPX_DEBUG2("aArray[index] %S", &item);
+            if (index < (count - 1))
+                {
+                ptr.Append(aSeparator);
+                }
+            }
+        }
+    else
+        {
+        str = HBufC::NewLC(0);
+        }
+
+    return str;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::StringFromArraysLC
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::StringFromArraysLC(
+    const CDesCArray& aNameArray,
+    const CDesCArray& aValueArray,
+    const TDesC& aValueSeparator,
+    const TDesC& aEntitySeparator)
+    {
+    MPX_FUNC("MPXDbCommonUtil::StringFromArraysLC");
+
+    // calculate the length of the SET string
+    TInt len(0);
+    TInt index(0);
+    TInt count(aNameArray.Count());
+    for (index = 0; index < count; ++index)
+        {
+        len += aNameArray[index].Length() + aValueArray[index].Length();
+        }
+
+    // construct the result string
+    HBufC* result = HBufC::NewLC(len +
+        ((aValueSeparator.Length() + aEntitySeparator.Length()) * count));
+    TPtr resultPtr(result->Des());
+    for (index = 0; index < count; ++index)
+        {
+        resultPtr.Append(aNameArray[index]);
+        resultPtr.Append(aValueSeparator);
+        resultPtr.Append(aValueArray[index]);
+
+        if (index < count - 1)
+            {
+            resultPtr.Append(aEntitySeparator);
+            }
+        }
+
+    return result;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::TTimeToDesLC
+// Converts a TTime to the internal SQLite format (YYYY-MM-DD HH:MM:SS).
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::TTimeToDesLC(
+    const TTime& aTime)
+    {
+    MPX_FUNC("MPXDbCommonUtil::TTimeToDesLC");
+
+    HBufC* dateTime;
+    if (aTime == Time::NullTTime())
+        {
+        dateTime = HBufC::NewLC(0);
+        }
+    else
+        {
+        _LIT(KDateTimeFormat, "%04d-%02d-%02d %02d:%02d:%02d");
+        
+        TTime time(0);
+
+        // negative time means BC, but format string will be invalid with our format,
+        // i.e. %04d in KDateTimeFormat when year is -1 will result in "00-1" and
+        // the whole string becomes "00-1-01-01 00:00:00" which will result in error,
+        // so set to 0 in such cases
+        TDateTime dt = aTime>time ? aTime.DateTime() : time.DateTime();
+        TInt dateTimeLen = KDateTimeFormat().Length();
+        dateTime = HBufC::NewLC(dateTimeLen);
+        TPtr dateTimePtr = dateTime->Des();
+        dateTimePtr.Format(KDateTimeFormat,
+                        dt.Year(),
+                        dt.Month() + 1, // zero based
+                        dt.Day() + 1,   // zero based
+                        dt.Hour(),
+                        dt.Minute(),
+                        dt.Second());
+        }
+    return dateTime;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::DesToTTimeL
+// Converts a date time string in the internal SQLite format (YYYY-MM-DD HH:MM:SS)
+// to a TTime. TTime can only parse in the DD-MM-YYYY HH:MM:SS format.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TTime MPXDbCommonUtil::DesToTTimeL(
+    const TDesC& aDateTime)
+    {
+    MPX_FUNC("MPXDbCommonUtil::DesToTTimeL");
+
+    TTime time(0);
+    if (aDateTime.Length() != 0)
+        {
+        _LIT(KDash, "-");
+        _LIT(KSpace, " ");
+
+        TLocale locale;
+        TDateFormat iDateFormat = locale.DateFormat();
+
+        HBufC* dateTime = HBufC::NewLC(aDateTime.Length());
+        TPtr dateTimePtr = dateTime->Des();
+
+        //as TTime::Parse is locale dependent, check it:
+        if(iDateFormat==EDateEuropean)
+            {
+            dateTimePtr.Append(aDateTime.Mid(8, 2));//day DD
+            dateTimePtr.Append(KDash);
+            dateTimePtr.Append(aDateTime.Mid(5, 2));//month MM
+            dateTimePtr.Append(KDash);
+            dateTimePtr.Append(aDateTime.Left(4));//year YYYY
+            dateTimePtr.Append(KSpace);
+            }
+        else if(iDateFormat==EDateJapanese)
+            {
+            dateTimePtr.Append(aDateTime.Left(4));//year YYYY
+            dateTimePtr.Append(KDash);
+            dateTimePtr.Append(aDateTime.Mid(5, 2));//month MM
+            dateTimePtr.Append(KDash);
+            dateTimePtr.Append(aDateTime.Mid(8, 2));//day DD
+            dateTimePtr.Append(KSpace);
+            }
+        else //iDateFormat==EDateAmerican
+            {
+            dateTimePtr.Append(aDateTime.Mid(5, 2));//month MM
+            dateTimePtr.Append(KDash);
+            dateTimePtr.Append(aDateTime.Mid(8, 2));//day DD
+            dateTimePtr.Append(KDash);
+            dateTimePtr.Append(aDateTime.Left(4));//year YYYY
+            dateTimePtr.Append(KSpace);            
+            }
+
+		    // When colon (:) is set as Date separator in Date and Time setting, 
+		    // colon in Time descriptors is parsed as Date separator. 
+        if ( locale.DateSeparator(1) == ':')
+            {
+            _LIT(KDot, ".");
+        
+        		// time HH.MM.SS
+            dateTimePtr.Append( aDateTime.Mid(11, 2) );
+            dateTimePtr.Append( KDot );
+            dateTimePtr.Append( aDateTime.Mid(14, 2) );
+            dateTimePtr.Append( KDot );
+            dateTimePtr.Append( aDateTime.Mid(17, 2) );
+            }
+        else
+            {
+            dateTimePtr.Append(aDateTime.Right(8));//time HH:MM:SS
+            }
+
+        User::LeaveIfError(time.Parse(dateTimePtr));
+        CleanupStack::PopAndDestroy(dateTime);
+        }
+    else
+        {
+        time = Time::NullTTime();
+        }
+    return time;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::CurrentTimeDesLC
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::CurrentTimeDesLC()
+    {
+    MPX_FUNC("MPXDbCommonUtil::CurrentTimeDesLC");
+
+    TTime time;
+    time.HomeTime();
+
+    return TTimeToDesLC(time);
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::CurrentDateDesLC
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* MPXDbCommonUtil::CurrentDateDesLC()
+    {
+    MPX_FUNC("MPXDbCommonUtil::CurrentDateDesLC");
+
+    TTime time;
+    time.HomeTime();
+
+    // Round off to the nearest hour
+    TDateTime date(time.DateTime());
+    date.SetMinute(0);
+    date.SetSecond(0);
+    date.SetMicroSecond(0);
+
+    return TTimeToDesLC(TTime(date));
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::GetDriveL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt MPXDbCommonUtil::GetDriveL(
+    const TDesC& aUri,
+    TDriveUnit& aDrive)
+    {
+    MPX_FUNC("MPXDbCommonUtil::GetDriveL");
+
+    TInt err(KErrNotFound);
+    TParsePtrC parser(aUri);
+    if (parser.Drive().Length())
+        {
+        aDrive = TDriveUnit(aUri);
+        err = KErrNone;
+        }
+
+    return err;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::AttributeExistsL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TBool MPXDbCommonUtil::AttributeExists(
+    const TArray<TMPXAttribute>& aAttrs,
+    const TMPXAttribute& aAttribute)
+    {
+    MPX_FUNC("MPXDbCommonUtil::AttributeExists");
+
+    TBool ret(EFalse);
+
+    TUint content(aAttribute.ContentId());
+    TUint attribute(aAttribute.AttributeId());
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if ((aAttrs[i].ContentId() == content) &&
+            (aAttrs[i].AttributeId() & attribute))
+            {
+            ret = ETrue;
+            break;
+            }
+        }
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::ConstructMediaLC
+// ----------------------------------------------------------------------------
+//
+CMPXMedia* MPXDbCommonUtil::ConstructMediaLC(
+    const TDesC& aTitle,
+    TMPXGeneralType aType,
+    TMPXGeneralCategory aCat,
+    TMPXItemId aId,
+    TInt aNonPermissibleActions,
+    TUint aDbflag)
+    {
+    MPX_FUNC("MPXDbCommonUtil::ConstructMediaLC");
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    supportedIds.AppendL(KMPXMediaIdGeneral);
+    CMPXMedia* entry = CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entry);
+    entry->SetTextValueL(KMPXMediaGeneralTitle, aTitle);
+    entry->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, aType);
+    entry->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, aCat);
+    entry->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aId);
+    entry->SetTObjectValueL<TUint>(KMPXMediaGeneralFlags, aDbflag);
+
+    if (aNonPermissibleActions)
+        {
+        // set non-permissible actions
+        entry->SetTObjectValueL<TMPXGeneralNonPermissibleActions>(KMPXMediaGeneralNonPermissibleActions,
+            static_cast<TMPXGeneralNonPermissibleActions>(aNonPermissibleActions));
+        }
+
+    return entry;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbCommonUtil::GetColumnTextL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TPtrC MPXDbCommonUtil::GetColumnTextL(
+	RSqlStatement& aStatement, 
+	TInt aField)
+	{
+    MPX_FUNC("MPXDbCommonUtil::GetColumnTextL");
+    
+    TPtrC text;
+	if (aStatement.ColumnSize(aField))
+		{
+	    text.Set(aStatement.ColumnTextL(aField));
+		}
+	else
+		{
+	    text.Set(KNullDesC);    	        		
+		}	
+
+    return text;
+	}
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbmanager.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2052 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for managing all database access
+*                databases.
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <sqldb.h>
+#include <badesca.h>
+#include <f32file.h>
+// PREQ2536 the files sqlrowsetutil.h and sqlrowsetutil.cpp has been removed
+//#ifdef __WINSCW__    
+//#include <sqlrowsetutil.h>
+//#endif
+#include <sysutil.h>
+
+#include <mpxlog.h>
+
+#include "mpxdbcommondef.h"
+#include "mpxtable.h"
+#include "mpxdbmanager.h"
+
+// CONSTANTS
+
+// Version of   Database
+const   TInt KMPXDbVersion[] = {6,0,0};
+
+_LIT8( KMCSqlConfig, "cache_size=1024; page_size=16384; " );
+
+_LIT(KSecureFilePath,   "%S[%x]%S");
+_LIT(KRootDrive, "C:");
+_LIT(KAliasName, "%1SDrive");
+_LIT(KBeginTransaction, "BEGIN TRANSACTION");
+_LIT(KCommitTransaction, "COMMIT TRANSACTION");
+_LIT(KRollbackTransaction, "ROLLBACK TRANSACTION");
+_LIT(KOrderByToken, "ORDER BY");
+_LIT(KDBNameToken, ":dbname");
+_LIT(KPlDBNameToken, ":pldbname");
+_LIT(KUnionAllToken, " UNION ALL ");
+_LIT(KSelectToken, "SELECT");
+
+//for database deletion
+_LIT( KDBFilePath, "\\private\\10281e17\\" );
+_LIT( KDBFilePattern, "*.db*" );    
+
+#ifdef _DEBUG
+_LIT(KTableQuery, "SELECT * FROM %S");
+_LIT(KAttachedTableQuery, "SELECT * FROM :dbname.%S");
+_LIT(KFindAllCDriveTablesQuery, "SELECT name FROM   sqlite_master WHERE type = 'table' ORDER BY name");
+_LIT(KFindAllAttachedTablesQuery, "SELECT name FROM :dbname.sqlite_master WHERE type = 'table' ORDER BY name");
+_LIT(KNameColumn, "name");
+#endif
+
+const TInt KMaxLogQuery = 248;
+const TInt KBufIncrement = 10;
+
+// Used to suppress overflow when appending formatted text to a buffer.
+class TOverflowHandle :
+    public TDesOverflow
+    {
+    public:
+        TOverflowHandle() :
+            iFlag(EFalse)
+            {
+            }
+
+        virtual void Overflow(TDes& /* aDes */)
+            {
+            iFlag = ETrue;
+            return;
+            }
+
+        TBool GetOverflowFlag()
+            {
+            TBool flag(iFlag);
+            iFlag = EFalse;
+            return flag;
+            }
+    protected:
+        TBool iFlag;
+    };
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CMPXDbManager::CMPXDbManager(
+    RFs& aFs) :
+    iFs(aFs)
+    {
+    MPX_FUNC("CMPXDbManager::CMPXDbManager");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::ConstructL(
+    const TFileName& aDatabaseFile)
+    {
+    MPX_FUNC("CMPXDbManager::ConstructL");
+    iDbFile = aDatabaseFile.AllocL();
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CMPXDbManager::~CMPXDbManager()
+    {
+    MPX_FUNC("CMPXDbManager::~CMPXDbManager");
+
+    // Close the state array
+    iPreparedStatements.Close();
+
+    // Close and destroy all RSQLStatements
+    TInt c( iStatements.Count() );
+    for( TInt i=0; i<c; ++i )
+        {
+        iStatements[i]->Close();
+        }
+    iStatements.ResetAndDestroy();
+
+    iTables.Close();
+    CloseAllDatabases();
+
+    delete iDbFile;
+    }
+
+// ----------------------------------------------------------------------------
+// Checks if all databases have been initialized.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXDbManager::IsInitialized()
+    {
+    MPX_FUNC("CMPXDbManager::IsInitialized");
+    return iInitialized;
+    }
+
+// ----------------------------------------------------------------------------
+// Begins a transaction on all databases.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::BeginL()
+    {
+    MPX_FUNC("CMPXDbManager::BeginL");
+
+    ASSERT(iTransactionCount >= 0);
+
+    if (++iTransactionCount == 1)
+        {
+        TInt err = iDatabase.Exec(KBeginTransaction);
+        
+        // transforms SQL error to KErrNotReady
+        if( (err <= KSqlErrGeneral && err >= KSqlErrNotDb) || err == KSqlErrStmtExpired )
+            {
+            User::Leave(KErrNotReady);
+            }
+        else
+            {
+            User::LeaveIfError(err);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Commits a transaction on all databases.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::CommitL()
+    {
+    MPX_FUNC("CMPXDbManager::CommitL");
+
+    if(iTransactionCount > 0)
+        {
+        if (--iTransactionCount == 0)
+            {
+            TInt err = iDatabase.Exec(KCommitTransaction);
+            
+            // transforms SQL error to KErrNotReady
+            if( (err <= KSqlErrGeneral && err >= KSqlErrNotDb) || err == KSqlErrStmtExpired )
+                {
+                User::Leave(KErrNotReady);
+                }
+            else
+                {
+                User::LeaveIfError(err);
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Rolls back a transaction on all databases.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::RollbackL()
+    {
+    MPX_FUNC("CMPXDbManager::RollbackL");
+
+    if(iTransactionCount > 0)
+        {
+        if (--iTransactionCount == 0)
+            {
+            TInt err = iDatabase.Exec(KRollbackTransaction);
+            
+            // transforms SQL error to KErrNotReady
+            if( (err <= KSqlErrGeneral && err >= KSqlErrNotDb) || err == KSqlErrStmtExpired )
+                {
+                User::Leave(KErrNotReady);  
+                }
+            else
+                {
+                User::LeaveIfError(err);
+                }
+            }
+    	}
+    }
+
+// ----------------------------------------------------------------------------
+// Rolls back a transaction on all databases.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXDbManager::InTransaction()
+    {
+    MPX_FUNC("CMPXDbManager::InTransaction");
+    return iDatabase.InTransaction();
+    }
+
+// ----------------------------------------------------------------------------
+// Tries to create and open the databases on all specified drives.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::InitDatabasesL(
+    RArray<TInt> aDrives)
+    {
+    MPX_FUNC("CMPXDbManager::InitDatabasesL");
+
+    CloseAllDatabases();
+
+    TDriveUnit cdrive(KRootDrive());
+
+    CreateDatabaseL(cdrive);
+    OpenDatabaseL(cdrive);
+
+    TInt count(aDrives.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TDriveUnit drive(aDrives[i]);
+        if ((drive != cdrive) && !IsRemoteDrive(static_cast<TDriveNumber>(aDrives[i])))
+            {
+            const TDesC& driveName = drive.Name();
+
+            DatabaseHandle handle;
+
+            handle.iDrive = aDrives[i];
+            handle.iAliasname = HBufC::NewL(KAliasName().Length());
+            handle.iAliasname->Des().Format(KAliasName, &driveName);
+            handle.iOpen = EFalse;
+
+            iDatabaseHandles.AppendL(handle);
+
+            TVolumeInfo vol;
+            if (iFs.Volume(vol, drive) == KErrNone)
+                {
+                CreateDatabaseL(drive);
+                AttachDatabaseL(drive);
+                }
+            }
+        }
+
+    iInitialized = ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// Opens a specified database.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::OpenDatabaseL(
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbManager::OpenDatabaseL");
+
+    if (iInitialized == EFalse)
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    TDriveUnit drive(aDrive);
+    TDriveUnit cdrive(KRootDrive());
+    TBool found(EFalse);
+
+    if ((drive != cdrive) && !IsRemoteDrive(static_cast<TDriveNumber>(aDrive)))
+        {
+        TInt count(iDatabaseHandles.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            if (iDatabaseHandles[i].iDrive == aDrive)
+                {
+                if (!iDatabaseHandles[i].iOpen)
+                    {
+                    // make sure the database is created
+					CreateDatabaseL(drive);
+
+					// attach
+                    AttachDatabaseL(drive);
+                    }
+
+                found = ETrue;
+                break;
+                }
+            }
+        }
+    if (!found)
+        {
+        User::Leave(KErrArgument);
+        }
+
+    // Close all prepared statements if a db is opened
+    //
+    ResetPreparedQueries();
+    }
+
+// ----------------------------------------------------------------------------
+// Closes a specified database.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::CloseDatabaseL(
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbManager::CloseDatabaseL");
+
+    if (iInitialized == EFalse)
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    // Close all prepared statements if a db is closed
+    //
+    ResetPreparedQueries();
+
+    TDriveUnit drive(aDrive);
+    TDriveUnit cdrive(KRootDrive());
+    TBool found(EFalse);
+
+    if ((drive != cdrive) && !IsRemoteDrive(static_cast<TDriveNumber>(aDrive)))
+        {
+        TInt count(iDatabaseHandles.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            if (iDatabaseHandles[i].iDrive == aDrive)
+                {
+                if (iDatabaseHandles[i].iOpen)
+                    {
+                    DetachDatabaseL(drive);
+                    }
+
+                found = ETrue;
+                break;
+                }
+            }
+        }
+    if (!found)
+        {
+        User::Leave(KErrArgument);
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// Closes all databases.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::CloseAllDatabases()
+    {
+    MPX_FUNC("CMPXDbManager::CloseAllDatabases");
+
+    if (iInitialized)
+        {
+        // Close all prepared statements if a db is closed
+        //
+        ResetPreparedQueries();
+
+        TInt count(iDatabaseHandles.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            delete iDatabaseHandles[i].iAliasname;
+            }
+
+        iDatabaseHandles.Reset();
+        iDatabase.Close();
+        iInitialized = EFalse;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Open all databases.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::OpenAllDatabasesL()
+    {
+    MPX_FUNC("CMPXDbManager::OpenAllDatabasesL");
+
+    if (!iInitialized)
+        {
+        TDriveUnit cdrive(KRootDrive());
+        OpenDatabaseL(cdrive);
+        }
+
+    TInt count(iDatabaseHandles.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TVolumeInfo vol;
+        if (iFs.Volume(vol, iDatabaseHandles[i].iDrive) == KErrNone)
+            {
+            AttachDatabaseL(iDatabaseHandles[i].iDrive);
+            }
+        }
+    iInitialized = ETrue;
+
+    // Close all prepared statements if a db is closed
+    //
+    ResetPreparedQueries();
+    }
+
+// ----------------------------------------------------------------------------
+// Checks if the database on a specified drive is open.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXDbManager::IsOpen(
+    TInt aDrive) const
+    {
+    MPX_FUNC("CMPXDbManager::IsOpen");
+
+    TDriveUnit drive(aDrive);
+    TDriveUnit cdrive(KRootDrive());
+
+    if (!iInitialized)
+        {
+        return EFalse;
+        }
+    else if (drive == cdrive)
+        {
+        return ETrue;
+        }
+    else
+        {
+        TInt count(iDatabaseHandles.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            if (iDatabaseHandles[i].iDrive == aDrive)
+                {
+                return iDatabaseHandles[i].iOpen;
+                }
+            }
+        }
+
+    return EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+// Returns the number of currently open databases.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXDbManager::DatabaseCount() const
+    {
+    MPX_FUNC("CMPXDbManager::DatabaseCount");
+
+    TInt openCount(0);
+    if (iInitialized)
+        {
+        ++openCount;
+
+        TInt count(iDatabaseHandles.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            if (iDatabaseHandles[i].iOpen)
+                {
+                ++openCount;
+                }
+            }
+        }
+
+    return openCount;
+    }
+
+// ----------------------------------------------------------------------------
+// Returns the drive corresponding to a given index.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXDbManager::DbDrive(
+    TInt aIndex) const
+    {
+    MPX_FUNC("CMPXDbManager::DbDrive");
+
+    ASSERT((aIndex >= 0) || (aIndex < iDatabaseHandles.Count()));
+    return iDatabaseHandles[aIndex].iDrive;
+    }
+
+// ----------------------------------------------------------------------------
+// Recreate a specified database.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::RecreateDatabaseL(
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbManager::RecreateDatabaseL");
+
+    if (iInitialized == EFalse)
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    TBool found(EFalse);
+
+    if (aDrive == EDriveC)
+        {
+        found = ETrue;
+        }
+    else
+        {
+        TInt count(iDatabaseHandles.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            if ((iDatabaseHandles[i].iDrive == aDrive) && (iDatabaseHandles[i].iOpen))
+                {
+                found = ETrue;
+                break;
+                }
+            }
+        }
+    if (found)
+        {
+        HBufC * filename = CreateFilenameL(aDrive);
+        CleanupStack::PushL(filename);
+
+        TRAPD(err, DoRecreateDatabaseL(filename));
+        if(err < 0)
+            {
+            TDriveUnit drive_unit(aDrive);
+
+            if(aDrive == EDriveC)
+                {
+                iDatabase.Close();
+                iInitialized = EFalse;
+
+                RSqlDatabase::Delete(*filename);
+                CreateDatabaseL(drive_unit);
+
+                User::LeaveIfError(iDatabase.Open(*filename));
+                iInitialized = ETrue;
+                }
+            else
+                {
+                DetachDatabaseL(drive_unit);
+
+                RSqlDatabase::Delete(*filename);
+                CreateDatabaseL(drive_unit);
+
+                AttachDatabaseL(drive_unit);
+                }
+            }
+
+        CleanupStack::PopAndDestroy(filename);
+        }
+    else
+        {
+        User::Leave(KErrNotFound);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Recreate all databases.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::RecreateAllDatabasesL()
+    {
+    MPX_FUNC("CMPXDbManager::RecreateAllDatabasesL");
+
+    if (iInitialized == EFalse)
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    // Recreate on drive C
+    RecreateDatabaseL(EDriveC);
+
+    // Recreate all attached drives
+    TInt count(iDatabaseHandles.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (iDatabaseHandles[i].iOpen)
+            {
+            RecreateDatabaseL(iDatabaseHandles[i].iDrive);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Returns current DB version
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TVersion CMPXDbManager::Version() const
+    {
+    MPX_FUNC("CMPXDbManager::Version");
+    return TVersion(KMPXDbVersion[0], KMPXDbVersion[1], KMPXDbVersion[2]);
+    }
+
+// ----------------------------------------------------------------------------
+// Registes a table with the database
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::RegisterTableL(
+    MMPXTable& aTable)
+    {
+    MPX_FUNC("CMPXDbManager::RegisterTableL");
+    iTables.AppendL(&aTable);
+    }
+
+// ----------------------------------------------------------------------------
+// Executes a select query with variable number of parameters
+// The query is executed on all available databases with a format like:
+//
+//      <query on database1> UNION ALL <query on database2> ...
+//
+// The query string passed in by the caller must have the ":dbname" prefix for all
+// the tables in the FROM clause. This will be replaced with the right alias for
+// attached databases or with no alias for the C database.
+//
+// In case the original query contains an ORDER BY clause, this will be extracted
+// and added at the end of the union query.
+//
+// Note: Running the union query seems to be similar in speed even if one of the
+// databases is empty and therefore no optimization was done for this case.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C RSqlStatement CMPXDbManager::ExecuteSelectQueryL(
+    TRefByValue<const TDesC> aFmt,
+    ...)
+    {
+    MPX_FUNC("CMPXDatabase::ExecuteSelectQueryL");
+
+    VA_LIST list;
+    VA_START(list, aFmt);
+
+    // Will reallocate
+    HBufC* selectBuf = FormatQueryLC(aFmt, list);
+    RSqlStatement statement = ExecuteSelectQueryOnAllDrivesL(selectBuf->Des());
+    CleanupStack::PopAndDestroy(selectBuf);
+
+    VA_END(list);
+
+    return statement;
+    }
+
+// ----------------------------------------------------------------------------
+// Executes a select query against a specified drive
+// ----------------------------------------------------------------------------
+//
+EXPORT_C RSqlStatement CMPXDbManager::ExecuteSelectQueryL(
+    TInt aDrive,
+    TRefByValue<const TDesC> aFmt,
+    ...)
+    {
+    MPX_FUNC("CMPXDatabase::ExecuteSelectQueryL");
+
+    VA_LIST list;
+    VA_START(list, aFmt);
+
+    // Will reallocate
+    HBufC* selectBuf = FormatQueryLC(aFmt, list);
+    RSqlStatement statement = ExecuteSelectQueryOnDriveL(aDrive, selectBuf->Des());
+    CleanupStack::PopAndDestroy(selectBuf);
+
+    VA_END(list);
+
+    return statement;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbManager::ExecuteSelectQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C RSqlStatement& CMPXDbManager::ExecuteSelectQueryL(
+    TUint aStatementId,
+    TInt aFirstValue,
+    TInt aSecondValue,
+    TRefByValue<const TDesC> aFmt,
+    ...)
+    {
+    MPX_FUNC("CMPXDatabase::ExecuteOffsetSelectQueryL");
+
+    // Prepare the Query first
+    VA_LIST list;
+    VA_START(list, aFmt);
+    RSqlStatement& statement = PrepareQueryL( aStatementId, aFmt, list );
+    VA_END(list);
+
+    // Bind the Limit and Offset variables
+    User::LeaveIfError(statement.BindInt(0, aFirstValue));
+    User::LeaveIfError(statement.BindInt(1, aSecondValue));
+
+    return statement;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbManager::ExecuteSelectQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C RSqlStatement& CMPXDbManager::ExecuteSelectQueryL( TUint aStatementId,
+                                                            const TDesC& aFirstValue,
+                                                            TInt aSecondValue,
+                                                            TRefByValue<const TDesC> aFmt, ...)
+    {
+    MPX_FUNC("CMPXDbManager::ExecuteMediaAscQueryL");
+
+    // Prepare the Query first
+    VA_LIST list;
+    VA_START(list, aFmt);
+    RSqlStatement& statement = PrepareQueryL( aStatementId, aFmt, list );
+    VA_END(list);
+
+    // bind the title and limit values
+    User::LeaveIfError(statement.BindText(0, aFirstValue));
+    User::LeaveIfError(statement.BindInt(1, aSecondValue));
+
+    return statement;
+    }
+
+// ----------------------------------------------------------------------------
+// Executes a query that does not return a record set (INSERT, UPDATE, DELETE,
+// CREATE, DROP, etc).
+//
+// If a valid drive is specified then the query is only executed only on
+// that drive. If KDbManagerAllDrives is specified then the query is executed
+// separately on each available drive.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::ExecuteQueryL(
+    TInt aDrive,
+    TRefByValue<const TDesC> aFmt,
+    ...)
+    {
+    MPX_FUNC("CMPXDatabase::ExecuteQueryL");
+
+    // make sure there is enough space on all drives affected
+    CheckDiskSpaceL(aDrive);
+
+    VA_LIST list;
+    VA_START(list, aFmt);
+
+    HBufC* selectBuf = FormatQueryLC(aFmt, list);
+    TPtr selectBufPtr = selectBuf->Des();
+    TInt dbCount(iDatabaseHandles.Count());
+
+    // a specified drive or all drives
+    TInt loopCount = (aDrive == KDbManagerAllDrives) ? (dbCount + 1) : 1;
+    TBool queryExecuted(EFalse); // flag to check if the query was executed at least once
+    for (TInt j = 0; j < loopCount; ++j)
+        {
+        HBufC* query = HBufC::NewLC(selectBufPtr.Length() + KBufIncrement);
+        TPtr queryPtr = query->Des();
+        queryPtr.Copy(selectBufPtr);
+        if (aDrive == EDriveC) // if C drive only
+            {
+            RemoveDriveAlias(queryPtr);
+            }
+        else // all drives or a particular drive other than C drive
+            {
+            if (aDrive == 0) // all drives
+                {
+                if (j == dbCount) // C drive
+                    {
+                    RemoveDriveAlias(queryPtr);
+                    }
+                else //all other drives, except C drive
+                    {
+                    if (iDatabaseHandles[j].iOpen)
+                        {
+                        ReplaceDriveAlias(queryPtr, *(iDatabaseHandles[j].iAliasname));
+                        }
+                    }
+                }
+            else //a particular drive, other than C drive
+                {
+                for (TInt i = 0; i < dbCount; ++i)
+                    {
+                    if (iDatabaseHandles[i].iOpen && iDatabaseHandles[i].iDrive == aDrive)
+                        {
+                        ReplaceDriveAlias(queryPtr, *(iDatabaseHandles[i].iAliasname));
+                        break;
+                        }
+                    }
+                }
+            }
+        TInt dbnamePos = queryPtr.Find(KDBNameToken);// check if the query was created correctly
+        if (dbnamePos == KErrNotFound)
+            {
+            // log the query
+            TPtrC ptr(query->Left(KMaxLogQuery));
+            MPX_DEBUG2("Query: %S", &ptr);
+
+            User::LeaveIfError(ExecuteSqlStatement(iDatabase, queryPtr));
+            queryExecuted = ETrue;
+            }
+        CleanupStack::PopAndDestroy(query);
+        }   //for (TInt j = 0; j < loopCount; ++j)
+    CleanupStack::PopAndDestroy(selectBuf);
+    VA_END(list);
+    if (!queryExecuted && aDrive !=   0)
+        {
+        // the requested drive(s) is not open
+        User::Leave(KErrNotFound);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbManager::FormatQueryLC
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbManager::FormatQueryLC(
+    TRefByValue<const TDesC> aFmt,
+    VA_LIST aList)
+    {
+    MPX_FUNC("CMPXDatabase::FormatQueryLC");
+
+    TOverflowHandle overflow;
+
+    HBufC* selectBuf = HBufC::NewLC(TDesC(aFmt).Length());//will reallocate
+    selectBuf->Des().AppendFormatList(aFmt, aList, &overflow);
+    while (overflow.GetOverflowFlag())
+        {
+        TInt len = selectBuf->Des().MaxLength() + KBufIncrement;
+        CleanupStack::PopAndDestroy(selectBuf);
+        selectBuf = HBufC::NewLC(len);
+        selectBuf->Des().AppendFormatList(aFmt, aList, &overflow);
+        }
+
+    return selectBuf;
+    }
+
+// ----------------------------------------------------------------------------
+// Executes a select query against a specified drive
+// ----------------------------------------------------------------------------
+//
+EXPORT_C RSqlStatement CMPXDbManager::ExecuteSelectQueryOnAllDrivesL(
+    TInt aDrive,
+    TRefByValue<const TDesC> aFmt,
+    ...)
+    {
+    MPX_FUNC("CMPXDatabase::ExecuteSelectQueryL");
+
+    VA_LIST list;
+    VA_START(list, aFmt);
+
+    // Will reallocate
+    HBufC* selectBuf = FormatQueryLC(aFmt, list);
+    RSqlStatement statement = ExecuteSelectQueryOnAllDrivesL(aDrive, selectBuf->Des());
+    CleanupStack::PopAndDestroy(selectBuf);
+
+    VA_END(list);
+
+    return statement;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbManager::ExecuteSelectQueryOnAllDrivesL
+// ----------------------------------------------------------------------------
+//
+RSqlStatement CMPXDbManager::ExecuteSelectQueryOnAllDrivesL(
+    TPtr aQuery)
+    {
+    MPX_FUNC("CMPXDatabase::ExecuteSelectQueryOnAllDrivesL");
+
+    TInt dbCount = iDatabaseHandles.Count();
+    HBufC* query = HBufC::NewLC(aQuery.Length() * (dbCount + 1) +
+        KUnionAllToken().Length() * dbCount);
+    TPtr queryPtr = query->Des();
+    HBufC* selectOutBuf = NULL;
+    TInt enclosed = aQuery.Mid(1, aQuery.Length() - 1).Find(KSelectToken);
+    if (enclosed != KErrNotFound)
+        {
+        enclosed++;//to compensate the indent
+        selectOutBuf = HBufC::NewLC(aQuery.Length() * (dbCount + 1) +
+            KUnionAllToken().Length() * dbCount);
+        selectOutBuf->Des().Copy(aQuery.Left(enclosed));
+        selectOutBuf->Des().Append(aQuery.Right(1));//the closing bracket
+        aQuery.Delete(0, enclosed);
+        aQuery.Delete(aQuery.Length() - 1, 1);
+        }
+
+    HBufC* orderBuf = NULL;
+    TInt orderPos = aQuery.Find(KOrderByToken);
+    if (orderPos != KErrNotFound)
+        {
+        orderBuf = aQuery.Right(aQuery.Length() - orderPos).AllocL();
+        aQuery.Delete(orderPos, aQuery.Length() - orderPos);
+        }
+    queryPtr.Append(aQuery);// for cdrive
+    RemoveDriveAlias(queryPtr);
+    for (TInt i = 0; i < dbCount; ++i)//for other drives
+        {
+        if (iDatabaseHandles[i].iOpen)
+            {
+            queryPtr.Append(KUnionAllToken);
+            queryPtr.Append(aQuery);
+            ReplaceDriveAlias(queryPtr, *(iDatabaseHandles[i].iAliasname));
+            }
+        }
+    if (orderBuf)
+        {
+        queryPtr.Append(orderBuf->Des());
+        }
+    delete orderBuf;
+    if (enclosed != KErrNotFound)
+        {
+        selectOutBuf->Des().Insert(enclosed, query->Des());
+        queryPtr.Copy(selectOutBuf->Des());
+        CleanupStack::PopAndDestroy(selectOutBuf);
+        }
+
+    // Log the query string before execution
+    TPtrC ptr(query->Left(KMaxLogQuery));
+    MPX_DEBUG2("Query: %S", &ptr);
+
+    // Return a temporary statement and not a member variable.
+    // This ensures that a copy is done and a second embedded query can be
+    // executed while the first result set is processed.
+    RSqlStatement statement;
+    User::LeaveIfError(statement.Prepare(iDatabase, queryPtr));
+    CleanupStack::PopAndDestroy(query);
+
+    return statement;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbManager::ExecuteSelectQueryOnAllDrivesL
+// ----------------------------------------------------------------------------
+//
+RSqlStatement CMPXDbManager::ExecuteSelectQueryOnAllDrivesL( TInt aDrive,
+    TPtr aQuery)
+    {
+    MPX_FUNC("CMPXDatabase::ExecuteSelectQueryOnAllDrivesL");
+
+    TInt dbCount = iDatabaseHandles.Count();
+    HBufC* query = HBufC::NewLC(aQuery.Length() * (dbCount + 1) +
+        KUnionAllToken().Length() * dbCount);
+    TPtr queryPtr = query->Des();
+    HBufC* selectOutBuf = NULL;
+    TInt enclosed = aQuery.Mid(1, aQuery.Length() - 1).Find(KSelectToken);
+    if (enclosed != KErrNotFound)
+        {
+        enclosed++;//to compensate the indent
+        selectOutBuf = HBufC::NewLC(aQuery.Length() * (dbCount + 1) +
+            KUnionAllToken().Length() * dbCount);
+        selectOutBuf->Des().Copy(aQuery.Left(enclosed));
+        selectOutBuf->Des().Append(aQuery.Right(1));//the closing bracket
+        aQuery.Delete(0, enclosed);
+        aQuery.Delete(aQuery.Length() - 1, 1);
+        }
+
+    HBufC* orderBuf = NULL;
+    TInt orderPos = aQuery.Find(KOrderByToken);
+    if (orderPos != KErrNotFound)
+        {
+        orderBuf = aQuery.Right(aQuery.Length() - orderPos).AllocL();
+        aQuery.Delete(orderPos, aQuery.Length() - orderPos);
+        }
+    
+    //remove KPlDBNameToken
+    if ( aDrive == EDriveC )//if playlist on c drive
+    	{
+    	RemoveDriveAlias(aQuery,KPlDBNameToken);
+    	}
+    else
+    	{//for other drives
+	    for (TInt i = 0; i < dbCount; ++i)
+	        {
+	        if (iDatabaseHandles[i].iOpen && (iDatabaseHandles[i].iDrive == aDrive))
+	            {
+	            ReplaceDriveAlias(aQuery, *(iDatabaseHandles[i].iAliasname),
+	            		KPlDBNameToken);
+	            break;
+	            }
+	        }
+    	}
+    
+    queryPtr.Append(aQuery);// for cdrive
+    RemoveDriveAlias(queryPtr);
+    for (TInt i = 0; i < dbCount; ++i)//for other drives
+        {
+        if (iDatabaseHandles[i].iOpen)
+            {
+            queryPtr.Append(KUnionAllToken);
+            queryPtr.Append(aQuery);
+            ReplaceDriveAlias(queryPtr, *(iDatabaseHandles[i].iAliasname));
+            }
+        }
+   
+    if (orderBuf)
+        {
+        queryPtr.Append(orderBuf->Des());
+        }
+    delete orderBuf;
+    if (enclosed != KErrNotFound)
+        {
+        selectOutBuf->Des().Insert(enclosed, query->Des());
+        queryPtr.Copy(selectOutBuf->Des());
+        CleanupStack::PopAndDestroy(selectOutBuf);
+        }
+
+    // Log the query string before execution
+    TPtrC ptr(query->Left(KMaxLogQuery));
+    MPX_DEBUG2("Query: %S", &ptr);
+
+    // Return a temporary statement and not a member variable.
+    // This ensures that a copy is done and a second embedded query can be
+    // executed while the first result set is processed.
+    RSqlStatement statement;
+    TInt err(statement.Prepare(iDatabase, queryPtr));
+    User::LeaveIfError(err);
+    CleanupStack::PopAndDestroy(query);
+
+    return statement;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbManager::ExecuteSelectQueryOnDriveLryLC
+// ----------------------------------------------------------------------------
+//
+RSqlStatement CMPXDbManager::ExecuteSelectQueryOnDriveL(
+    TInt aDrive,
+    TPtr aQuery)
+    {
+    MPX_FUNC("CMPXDatabase::ExecuteSelectQueryOnDriveL");
+
+    RSqlStatement statement;
+    if (KDbManagerAllDrives == aDrive)
+        {
+        statement = ExecuteSelectQueryOnAllDrivesL(aQuery);
+        }
+    else
+        {
+        TInt dbCount(iDatabaseHandles.Count());
+
+        // flag to check if the query was executed at least once
+        TBool queryExecuted = EFalse;
+
+        HBufC* query = HBufC::NewLC(aQuery.Length() + KBufIncrement);
+        TPtr queryPtr = query->Des();
+        queryPtr.Copy(aQuery);
+        if (aDrive == EDriveC) //if C drive
+            {
+            RemoveDriveAlias(queryPtr);
+            }
+        else // drive other than C drive
+            {
+            for (TInt i = 0; i < dbCount; ++i)
+                {
+                if (iDatabaseHandles[i].iOpen && (iDatabaseHandles[i].iDrive == aDrive))
+                    {
+                    ReplaceDriveAlias(queryPtr, *(iDatabaseHandles[i].iAliasname));
+                    break;
+                    }
+                }
+            }
+
+        TInt dbnamePos = queryPtr.Find(KDBNameToken);// check if the query was created correctly
+        if (dbnamePos == KErrNotFound)
+            {
+            // Log the query string before execution
+            TPtrC ptr(query->Left(KMaxLogQuery));
+            MPX_DEBUG2("Query: %S", &ptr);
+
+            User::LeaveIfError(statement.Prepare(iDatabase, queryPtr));
+            queryExecuted = ETrue;
+            }
+        CleanupStack::PopAndDestroy(query);
+
+        if (!queryExecuted)
+            {
+            // the requested drive(s) is not open
+            User::Leave(KErrNotFound);
+            }
+        }
+
+    return statement;
+    }
+
+// ----------------------------------------------------------------------------
+// Prepare a query for execution on all open database. This query's lifetime
+// is owned by the dbmanager
+// ----------------------------------------------------------------------------
+//
+RSqlStatement& CMPXDbManager::PrepareQueryL( TUint aStatementId,
+                                             TRefByValue<const TDesC> aFmt,
+                                             VA_LIST aList )
+    {
+    // Try to find the query first if it has been created
+    TInt index(KErrNotFound);
+    TInt c(iPreparedStatements.Count());
+
+    for( TInt i=0; i<c; ++i )
+        {
+        if( iPreparedStatements[i].iId == aStatementId )
+            {
+            index = i;
+            break;
+            }
+        }
+
+    // If the index isn't found we create a new query statement
+    //
+    if( index == KErrNotFound )
+        {
+        RSqlStatement* newStatement = new(ELeave) RSqlStatement();
+        CleanupStack::PushL(newStatement);
+
+        TSqlStatementState newState;
+        newState.iId = aStatementId;
+        newState.iPrepared = EFalse;
+        iPreparedStatements.AppendL( newState );
+
+        TInt err = iStatements.Append( newStatement ); // ownership x-fer
+        if (err != KErrNone)
+            {
+            iPreparedStatements.Remove(c);
+            User::Leave(err);
+            }
+        CleanupStack::Pop(newStatement);
+        index = c;
+        }
+
+    // Finally create the statement
+    if ( !iPreparedStatements[index].iPrepared )
+        {
+
+        // Will reallocate
+        HBufC* selectBuf = FormatQueryLC(aFmt, aList);
+        TPtr selectBufPtr = selectBuf->Des();
+        TInt dbCount = iDatabaseHandles.Count();
+        HBufC* query = HBufC::NewLC(selectBufPtr.Length() * (dbCount + 1) +
+            KUnionAllToken().Length() * dbCount);
+        TPtr queryPtr = query->Des();
+        HBufC* selectOutBuf = NULL;
+        TInt enclosed = selectBufPtr.Mid(1,selectBufPtr.Length() - 1).Find(KSelectToken);
+        if (enclosed != KErrNotFound)
+            {
+            enclosed++;//to compensate the indent
+            selectOutBuf = HBufC::NewLC(selectBufPtr.Length() * (dbCount + 1) +
+                KUnionAllToken().Length() * dbCount);
+            selectOutBuf->Des().Copy(selectBufPtr.Left(enclosed));
+            selectOutBuf->Des().Append(selectBufPtr.Right(1));//the closing bracket
+            selectBufPtr.Delete(0, enclosed);
+            selectBufPtr.Delete(selectBufPtr.Length()   -   1, 1);
+            }
+
+        HBufC* orderBuf = NULL;
+        TInt orderPos = selectBufPtr.Find(KOrderByToken);
+        if (orderPos != KErrNotFound)
+            {
+            orderBuf = selectBufPtr.Right(selectBufPtr.Length() - orderPos).AllocL();
+            selectBufPtr.Delete(orderPos,   selectBufPtr.Length() - orderPos);
+            }
+        queryPtr.Append(selectBufPtr);// for cdrive
+        RemoveDriveAlias(queryPtr);
+        for (TInt i = 0; i < dbCount; ++i)//for other drives
+            {
+            if (iDatabaseHandles[i].iOpen)
+                {
+                queryPtr.Append(KUnionAllToken);
+                queryPtr.Append(selectBufPtr);
+                ReplaceDriveAlias(queryPtr, *(iDatabaseHandles[i].iAliasname));
+                }
+            }
+        if (orderBuf)
+            {
+            queryPtr.Append(orderBuf->Des());
+            }
+        delete orderBuf;
+        if (enclosed != KErrNotFound)
+            {
+            selectOutBuf->Des().Insert(enclosed, query->Des());
+            queryPtr.Copy(selectOutBuf->Des());
+            CleanupStack::PopAndDestroy(selectOutBuf);
+            }
+
+        // Log the query string before execution
+        TPtrC ptr(query->Left(KMaxLogQuery));
+        MPX_DEBUG2("Query: %S", &ptr);
+
+        // use the member variable statement
+        User::LeaveIfError(iStatements[index]->Prepare(iDatabase, queryPtr));
+        CleanupStack::PopAndDestroy(2, selectBuf); //query
+
+        iPreparedStatements[index].iPrepared = ETrue;
+        }
+    else
+        {
+        iStatements[index]->Reset();
+        }
+
+    return *iStatements[index];
+    }
+
+// ----------------------------------------------------------------------------
+// Resets all prepared queries
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::ResetPreparedQueries()
+    {
+    iPreparedStatements.Reset();
+
+    TInt c( iStatements.Count() );
+    for( TInt i=0; i<c; ++i )
+        {
+        iStatements[i]->Close();
+        }
+    iStatements.ResetAndDestroy();
+    }
+
+// ----------------------------------------------------------------------------
+// Asks all registered tables to create themselves
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::CreateTablesL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbManager::CreateTablesL");
+
+	CreateTablesL(aDatabase, EFalse);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbManager::CreateTablesL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::CreateTablesL(
+	RSqlDatabase& aDatabase,
+	TBool aCorrupt)
+	{
+    TInt count(iTables.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        iTables[i]->CreateTableL(aDatabase, aCorrupt);
+        }
+	}
+
+// ----------------------------------------------------------------------------
+// Opens a specified database.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::OpenDatabaseL(
+    TDriveUnit aDrive)
+    {
+    MPX_FUNC("CMPXDbManager::OpenDatabaseL");
+
+    HBufC * filename = CreateFilenameL(aDrive);
+    CleanupStack::PushL(filename);
+    User::LeaveIfError(iDatabase.Open(filename->Des()));
+
+    CleanupStack::PopAndDestroy(filename);
+    }
+
+// ----------------------------------------------------------------------------
+// Creates a specified database.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::CreateDatabaseL(
+    TDriveUnit aDrive)
+    {
+    MPX_FUNC("CMPXDbManager::CreateDatabaseL");
+
+    RSqlDatabase database;
+    CleanupClosePushL(database);
+
+    HBufC* filename = CreateFilenameL(aDrive);
+    CleanupStack::PushL(filename);
+
+    if (database.Open(filename->Des()) != KErrNone)
+        {
+        MPX_DEBUG2("CMPXDbManager::CreateDatabaseL - cannot open the database on drive %d", TInt(aDrive));
+
+        // close the database first
+        database.Close();
+        DoCreateDatabaseL( aDrive );
+        }
+    else
+        {
+        TBool tableOK(ETrue);
+
+        // try to detect any corrupt tables
+        TInt count(iTables.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            // ask the table to check its structure
+            if (!iTables[i]->CheckTableL(database))
+                {
+                tableOK = EFalse;
+                break;
+                }
+            }
+
+        if (!tableOK)
+            {
+            // close the database first
+            database.Close();
+			
+			// delete database and create database
+            DoCreateDatabaseL( aDrive );
+            }
+        }
+    CleanupStack::PopAndDestroy(filename);
+    CleanupStack::PopAndDestroy(&database);
+    }
+
+// ----------------------------------------------------------------------------
+// Attaches a specified database.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::AttachDatabaseL(
+    TDriveUnit aDrive)
+    {
+    MPX_FUNC("CMPXDbManager::AttachDatabaseL");
+
+    TBool found(EFalse);
+
+    TInt count(iDatabaseHandles.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (iDatabaseHandles[i].iDrive == aDrive)
+            {
+            if (!iDatabaseHandles[i].iOpen)
+                {
+                HBufC* filename = CreateFilenameL(aDrive);
+                CleanupStack::PushL(filename);
+
+                User::LeaveIfError(iDatabase.Attach(filename->Des(),
+                    *(iDatabaseHandles[i].iAliasname)));
+                iDatabaseHandles[i].iOpen = ETrue;
+
+                CleanupStack::PopAndDestroy(filename);
+                }
+            found = ETrue;
+            break;
+            }
+        }
+    if (!found)
+        {
+        User::Leave(KErrNotFound);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Detaches a specified database.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::DetachDatabaseL(
+    TDriveUnit aDrive)
+    {
+    MPX_FUNC("CMPXDbManager::DetachDatabaseL");
+
+    ASSERT(iInitialized);
+    TBool found(EFalse);
+
+    TInt count(iDatabaseHandles.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (iDatabaseHandles[i].iDrive == aDrive)
+            {
+            if (iDatabaseHandles[i].iOpen)
+                {
+                User::LeaveIfError(iDatabase.Detach(*(iDatabaseHandles[i].iAliasname)));
+                iDatabaseHandles[i].iOpen = EFalse;
+                }
+
+            found = ETrue;
+            break;
+            }
+        }
+    if (!found)
+        {
+        User::Leave(KErrNotFound);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Creates the absolute database filename on a specified drive.
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbManager::CreateFilenameL(
+    TDriveUnit aDrive)
+    {
+    MPX_FUNC("CMPXDbManager::CreateFilenameL");
+
+    HBufC* filename = HBufC::NewL(KMaxFileName);
+
+    const TDesC& securefilePath = KSecureFilePath;
+    TDriveUnit cdrive(KRootDrive());
+
+    const TDesC& driveName = aDrive.Name();
+    filename->Des().Format(securefilePath, &driveName, User::Identity().iUid, iDbFile);
+    return filename;
+    }
+
+// ----------------------------------------------------------------------------
+// Replaces :dbname with a drive alias
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::ReplaceDriveAlias(
+    TDes& aQuery,
+    const TDesC& aAlias)
+    {
+//  MPX_FUNC("CMPXDbManager::ReplaceDriveAlias");
+
+    TInt dbnamePos(aQuery.Find(KDBNameToken));
+    while (dbnamePos != KErrNotFound)
+        {
+        aQuery.Delete(dbnamePos, KDBNameToken().Length());
+        aQuery.Insert(dbnamePos, aAlias);
+        dbnamePos = aQuery.Find(KDBNameToken);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Replaces :dbname with a drive alias
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::ReplaceDriveAlias(
+    TDes& aQuery,
+    const TDesC& aAlias,
+    const TDesC& aToKen)
+    {
+    
+    TInt dbnamePos(aQuery.Find(aToKen));
+    while (dbnamePos != KErrNotFound)
+        {
+        aQuery.Delete(dbnamePos, aToKen.Length());
+        aQuery.Insert(dbnamePos, aAlias);
+        dbnamePos = aQuery.Find(aToKen);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Removes :dbname
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::RemoveDriveAlias(
+    TDes& aQuery)
+    {
+    MPX_FUNC("CMPXDbManager::RemoveDriveAlias");
+
+    TInt dbnamePos(aQuery.Find(KDBNameToken));
+    while (dbnamePos != KErrNotFound)
+        {
+        aQuery.Delete(dbnamePos, KDBNameToken().Length() + 1);
+        dbnamePos = aQuery.Find(KDBNameToken);
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// Removes :dbname
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::RemoveDriveAlias(
+    TDes& aQuery,const TDesC& aToKen)
+    {
+    MPX_FUNC("CMPXDbManager::RemoveDriveAlias");
+
+    TInt dbnamePos(aQuery.Find(aToKen));
+    while (dbnamePos != KErrNotFound)
+        {
+        aQuery.Delete(dbnamePos, aToKen.Length() + 1);
+        dbnamePos = aQuery.Find(aToKen);
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CMPXDbManager::CheckDiskSpaceL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::CheckDiskSpaceL(
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbManager::CheckDiskSpaceL");
+    
+    // LTAN-7GH6BZ, crash if eject memory card when adding song to existing playlist
+    // due to special timing issue, it is possible drive number is -1 and create a
+    // panic when use for TDriveUnit
+    MPX_DEBUG2("aDrive = %d", aDrive);
+    
+    if (aDrive < 0)
+        {
+        MPX_DEBUG1("invalid driveId, leave with KErrNotReady");
+        User::Leave(KErrNotReady);
+        }
+
+    // handle the case of C drive
+    TDriveUnit drive(aDrive);
+    TDriveUnit cdrive(KRootDrive());
+
+    if(drive == cdrive)
+        {
+        if (SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, 0, aDrive))
+            {
+            User::Leave(KErrDiskFull);
+            }
+
+        return;
+        }
+
+    // handle other drives (eg. removable EDriveE)
+    TInt count(iDatabaseHandles.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+
+        if (((KDbManagerAllDrives == aDrive) ||
+            (aDrive == iDatabaseHandles[i].iDrive)) &&
+            iDatabaseHandles[i].iOpen)
+            {
+            if (SysUtil::DiskSpaceBelowCriticalLevelL(&iFs, 0,
+                iDatabaseHandles[i].iDrive))
+                {
+                User::Leave(KErrDiskFull);
+                }
+            }
+
+        if (aDrive == iDatabaseHandles[i].iDrive)
+            {
+            // exit if just one drive to check
+            break;
+            }
+        }
+    }
+    
+// ----------------------------------------------------------------------------
+// Regenerate all databases.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::RegenerateAllDatabasesL()
+    {
+    MPX_DEBUG1("CMPXDbManager::RegenerateAllDatabasesL Enter");
+    ResetPreparedQueries(); //just in case ...
+    TInt handles(iDatabaseHandles.Count());
+    for (TInt i = 0; i < handles; ++i)
+        {
+        iDatabaseHandles[i].iOpen = EFalse; //attach will open them again
+        }    
+    iDatabase.Close(); //close the database before deleting the file
+    iInitialized = EFalse;
+
+    MPX_DEBUG1("RegenerateAllDatabasesL: Regenerating main DB on C:");
+    HBufC * filename = CreateFilenameL(EDriveC);
+    CleanupStack::PushL(filename);
+    RSqlDatabase::Delete(*filename);
+    TDriveUnit cdrive(KRootDrive());
+    CreateDatabaseL(cdrive);
+    User::LeaveIfError(iDatabase.Open(*filename)); // will set handle status later
+    CleanupStack::PopAndDestroy(filename);
+    MPX_DEBUG1("RegenerateAllDatabasesL: DB regeneration complete");
+    
+    // Recreate all attached drives
+    TInt count(iDatabaseHandles.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (iDatabaseHandles[i].iDrive != EDriveC)
+            {
+            MPX_DEBUG2("RegenerateAllDatabasesL: Regenerating DB on %d",iDatabaseHandles[i].iDrive);
+            TVolumeInfo volumeInfo; 
+            TInt err = iFs.Volume(volumeInfo,iDatabaseHandles[i].iDrive);
+            if(err != KErrNone)
+                {
+                continue; //if drive is not currently accessible, skip
+                }
+            filename = CreateFilenameL(iDatabaseHandles[i].iDrive);
+            CleanupStack::PushL(filename);
+            MPX_DEBUG1("RegenerateAllDatabasesL: Detaching DB");
+            err = iDatabase.Detach(*(iDatabaseHandles[i].iAliasname)); //ignore the error if any
+            MPX_DEBUG2("RegenerateAllDatabasesL: Detached[err=%d]; Deleting DB",err);
+            err = RSqlDatabase::Delete(*filename);
+            MPX_DEBUG2("RegenerateAllDatabasesL: Deleted[err=%d]; Creating new DB",err);
+            TDriveUnit drive(iDatabaseHandles[i].iDrive);
+            CreateDatabaseL(drive);
+            MPX_DEBUG1("RegenerateAllDatabasesL: Attaching new DB");
+            AttachDatabaseL(drive);    
+            MPX_DEBUG1("RegenerateAllDatabasesL: DB regeneration complete");
+            CleanupStack::PopAndDestroy(filename);
+            }
+        else
+            {
+            iDatabaseHandles[i].iOpen = ETrue; //if we got here it is opened
+            }
+        }
+    iInitialized = ETrue;
+    MPX_DEBUG1("CMPXDbManager::RegenerateAllDatabasesL Exit");
+    }    
+
+// ----------------------------------------------------------------------------
+// CMPXDbManager::DoRecreateDatabaseL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::DoRecreateDatabaseL(HBufC * aFilename)
+    {
+    RSqlDatabase database;
+    CleanupClosePushL(database);
+
+    User::LeaveIfError(database.Open(aFilename->Des()));
+
+    TInt count(iTables.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        iTables[i]->DropTableL(database);
+        iTables[i]->CreateTableL(database, EFalse);
+        }
+    CleanupStack::PopAndDestroy(&database);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbManager::ExecuteSqlStatement
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbManager::ExecuteSqlStatement(RSqlDatabase& aDatabase,const TDesC& aStatement)
+    {
+    MPX_FUNC("CMPXDbManager::ExecuteSqlStatement");
+    TInt result( KErrNone );
+    RSqlStatement sqlStatement;
+    //Prepare and execute SQL statement
+    result = sqlStatement.Prepare(aDatabase, aStatement);
+    if (result == KErrNone)
+        {
+        result = sqlStatement.Exec();
+        //If the database schema was changed or the session expired repeat all the steps
+        if((result == KSqlErrStmtExpired) || (result == KSqlErrSchema))
+            {
+            sqlStatement.Close();
+            result = sqlStatement.Prepare(aDatabase, aStatement);
+            if (result == KErrNone)
+                {
+                result = sqlStatement.Exec();
+                }
+            }
+        sqlStatement.Close();
+        }
+    return result;
+    }
+
+#ifdef _DEBUG
+
+// ----------------------------------------------------------------------------
+// Returns the number of columns from a specified SQL statement
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbManager::GetColumnCountL(
+    RSqlStatement& aStatement)
+    {
+    TInt columnCount(0);
+
+// Using TSqlRowSetUtil causes linker errors on ARMv5 UDEB
+// Enabling this functionality for WINSCW UDEB only
+// PREQ2536 the files sqlrowsetutil.h and sqlrowsetutil.cpp has been removed
+//#ifdef __WINSCW__
+//
+//    HBufC* headers = TSqlRowSetUtil::GetDeclColumnTypesL(aStatement);
+//    CleanupStack::PushL(headers);
+//
+//    // Count the number of semicolons to get the number of columns
+//    TPtr headerPtr = headers->Des();
+//    TInt location(headerPtr.Locate(';'));
+//    while ((location != KErrNotFound) && (location < headers->Length()))
+//        {
+//        ++columnCount;
+//        if (++location < headers->Length())
+//            {
+//            headerPtr = headers->Des().Mid(location);
+//            location = headerPtr.Locate(';');
+//            }
+//        }
+//    CleanupStack::PopAndDestroy(headers);
+//
+//#else
+	(void)aStatement;
+//#endif
+
+    return columnCount;
+    }
+
+// ----------------------------------------------------------------------------
+// Prints the table values from a specified SQL query
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::PrintTableValuesL(
+    RSqlStatement& aStatement)
+    {
+    TInt columnCount(GetColumnCountL(aStatement));
+    TInt err(KErrNone);
+    HBufC* tableRow = HBufC::NewLC(255 * columnCount);
+    TPtr tableRowPtr = tableRow->Des();
+
+    while ((err = aStatement.Next()) == KSqlAtRow)
+        {
+        tableRowPtr.Zero();
+        TInt error(KErrNone);
+        for (TInt index = 0; (error == KErrNone) && (index < columnCount); ++index)
+            {
+            if (index !=0)
+                {
+                tableRowPtr.Append(',');
+                }
+            switch (aStatement.ColumnType(index))
+                {
+                case ESqlNull:
+                    tableRowPtr.Append(_L("<NULL>"));
+                    break;
+
+                case ESqlInt:
+                    {
+                    tableRowPtr.AppendFormat(_L("%u"), aStatement.ColumnInt(index));
+                    }
+                    break;
+
+                case ESqlInt64:
+                    {
+                    tableRowPtr.AppendFormat(_L("%lu"), aStatement.ColumnInt64(index));
+                    }
+                    break;
+
+                case ESqlReal:
+                    {
+                    tableRowPtr.AppendFormat(_L("%f"), aStatement.ColumnReal(index));
+                    }
+                    break;
+
+                case ESqlText:
+                    {
+                    TPtrC columnValue;
+                    error = aStatement.ColumnText(index, columnValue);
+                    if (error == KErrNone)
+                        {
+                        tableRowPtr.AppendFormat(_L("%S"), &columnValue);
+                        }
+                    }
+                    break;
+
+                case ESqlBinary:
+                    {
+                    TPtrC8 columnValue;
+                    error = aStatement.ColumnBinary(index, columnValue);
+                    if (error == KErrNone)
+                        {
+                        tableRowPtr.AppendFormat(_L("%S"), &columnValue);
+                        }
+                    }
+                    break;
+
+                default :
+                    ASSERT(EFalse);
+                }
+
+            if (tableRowPtr.Length() > 255)
+                {
+                tableRowPtr.SetLength(255);
+                MPX_DEBUG2("%S", tableRow);
+                tableRowPtr.Zero();
+                }
+            }
+        if (tableRowPtr.Length() > 0)
+            {
+            tableRowPtr.SetLength(Min(tableRowPtr.Length(), 255));
+            MPX_DEBUG2("%S", tableRow);
+            }
+        }
+    CleanupStack::PopAndDestroy(tableRow);
+    if (err != KSqlAtEnd)
+        {
+        User::Leave(err);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Finds all the tables on the main or attached drives
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::FindAllTablesL(
+    const TDesC& aAlias,
+    RArray<HBufC*>& aTableName)
+    {
+    RSqlStatement statement;
+    CleanupClosePushL(statement);
+
+    if (aAlias == KNullDesC)
+        {
+        statement.Prepare(iDatabase, KFindAllCDriveTablesQuery);
+        }
+    else
+        {
+        HBufC* query = KFindAllAttachedTablesQuery().AllocL();
+        CleanupStack::PushL(query);
+        TPtr queryPtr = query->Des();
+        ReplaceDriveAlias(queryPtr, aAlias);
+        statement.Prepare(iDatabase, queryPtr);
+        CleanupStack::PopAndDestroy(query);
+        }
+
+    TInt err(KErrNone);
+
+    while ((err = statement.Next()) == KSqlAtRow)
+        {
+        TPtrC val = statement.ColumnTextL(statement.ColumnIndex(KNameColumn));
+        aTableName.AppendL(val.AllocL());
+        }
+    if (err != KSqlAtEnd)
+        {
+        User::Leave(err);
+        }
+
+    CleanupStack::PopAndDestroy(&statement);
+    }
+
+// ----------------------------------------------------------------------------
+// Prints the tables on the main or attached drives
+// ----------------------------------------------------------------------------
+//
+void CMPXDbManager::PrintTableL(
+    const TDesC& aAlias,
+    const TDesC& aTableName)
+    {
+    RSqlStatement statement;
+    CleanupClosePushL(statement);
+
+    if (aAlias == KNullDesC)
+        {
+        HBufC* selectQuery = HBufC::NewLC(KTableQuery().Length() + aTableName.Length());
+        selectQuery->Des().Format(KTableQuery, &aTableName);
+        User::LeaveIfError(statement.Prepare(iDatabase, *selectQuery));
+        CleanupStack::PopAndDestroy(selectQuery);
+        }
+    else
+        {
+        HBufC* selectQuery = HBufC::NewLC(KAttachedTableQuery().Length() + aTableName.Length());
+        selectQuery->Des().Format(KAttachedTableQuery, &aTableName);
+
+        TPtr selectQueryPtr(selectQuery->Des());
+        ReplaceDriveAlias(selectQueryPtr, aAlias);
+        User::LeaveIfError(statement.Prepare(iDatabase, *selectQuery));
+
+        CleanupStack::PopAndDestroy(selectQuery);
+        }
+
+    PrintTableValuesL(statement);
+    CleanupStack::PopAndDestroy(&statement);
+    }
+
+#endif
+
+// ----------------------------------------------------------------------------
+// Prints all the tables on the main and attached drives
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbManager::PrintDatabaseL()
+    {
+#ifdef _DEBUG
+    if (iInitialized)
+        {
+        // C-Drive
+        RArray<HBufC*> tableNames;
+        FindAllTablesL(KNullDesC(), tableNames);
+
+        MPX_DEBUG1("### Drive C ###");
+
+        TInt tableCount(tableNames.Count());
+        for (TInt i = 0; i < tableCount; ++i)
+            {
+            MPX_DEBUG2("# %S #", tableNames[i]);
+            MPX_TRAPD(error, PrintTableL(KNullDesC, *tableNames[i]));
+            delete tableNames[i];
+            if (error != KErrNone)
+                {
+                if (error != KErrPermissionDenied)
+                    {
+                    User::Leave(error);
+                    }
+                else
+                    {
+                    MPX_DEBUG1("Unable to print table");
+                    }
+                }
+            }
+        tableNames.Close();
+
+        // Each attached drive
+        TInt count(iDatabaseHandles.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            if (iDatabaseHandles[i].iOpen)
+                {
+                FindAllTablesL(iDatabaseHandles[i].iAliasname->Des(), tableNames);
+
+                TDriveUnit driveUnit(iDatabaseHandles[i].iDrive);
+                const   TDesC& name = driveUnit.Name();
+                MPX_DEBUG2("### Drive %S ###", &name);
+
+                for (TInt j = 0; j < tableCount; ++j)
+                    {
+                    MPX_DEBUG2("# %S #", tableNames[j]);
+                    MPX_TRAPD(error, PrintTableL(iDatabaseHandles[i].iAliasname->Des(), *tableNames[j]));
+                    delete tableNames[j];
+                    if (error != KErrNone)
+                        {
+                        if (error != KErrPermissionDenied)
+                            {
+                            User::Leave(error);
+                            }
+                        else
+                            {
+                            MPX_DEBUG1("Unable to print table");
+                            }
+                        }
+                    }
+                tableNames.Close();
+                }
+            }
+        }
+#endif
+    }
+
+// ----------------------------------------------------------------------------
+// Prints all the tables on the main and attached drives
+// ----------------------------------------------------------------------------
+//
+EXPORT_C RFs& CMPXDbManager::Fs()
+    {
+    return iFs;
+    }
+
+
+
+// ---------------------------------------------------------------------------
+// CMPXDbManager::IsRemoteDrive
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXDbManager::IsRemoteDrive(TDriveNumber aDrive)
+    {
+    TDriveInfo driveInfo;
+    TBool isRemoteDrive(EFalse);
+    if (iFs.Drive(driveInfo, aDrive) == KErrNone)
+        {
+        isRemoteDrive = driveInfo.iDriveAtt & KDriveAttRemote;
+        }
+    return isRemoteDrive;
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXDbManager::DoCreateDatabaseL
+// ---------------------------------------------------------------------------
+//
+void CMPXDbManager::DoCreateDatabaseL( TDriveUnit aDrive )
+    {
+	MPX_FUNC( "CMPXDbManager::DoCreateDatabaseL" );
+	
+    RSqlDatabase database;
+    CleanupClosePushL(database);
+
+    HBufC* filename = CreateFilenameL(aDrive);
+    CleanupStack::PushL(filename);
+    
+    // remove old databases before creating/replacing new database
+    TInt driveNameLen = aDrive.Name().Length();
+    
+    TFileName dbFileName(aDrive.Name()); //initialise with drive name        
+    dbFileName.Append(KDBFilePath);  // append private path
+    
+    //append file name
+    dbFileName.Append(filename->Right((filename->Length())- driveNameLen));     
+    
+    // locate the offset position where version info starts in file name
+    TInt pos = dbFileName.LocateReverse('v');
+
+    //replace version info with wildcards 
+    dbFileName.Replace(pos, (dbFileName.Length()- pos), KDBFilePattern);
+
+    CFileMan* fileManager = CFileMan::NewL(iFs);
+    TInt ret = fileManager->Delete(dbFileName);
+    delete fileManager;
+    fileManager = NULL;
+    
+    // create the database now
+    RSqlSecurityPolicy securityPolicy;
+    CleanupClosePushL(securityPolicy);
+
+    TSecurityPolicy policy(TSecurityPolicy::EAlwaysPass);
+    securityPolicy.Create(policy);
+
+    TSecurityPolicy schemaPolicy(TSecurityPolicy::EAlwaysPass);
+    TSecurityPolicy readPolicy(TSecurityPolicy::EAlwaysPass);
+    TSecurityPolicy writePolicy(TSecurityPolicy::EAlwaysPass);
+
+    User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::ESchemaPolicy, schemaPolicy));
+    User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::EReadPolicy, readPolicy));
+    User::LeaveIfError(securityPolicy.SetDbPolicy(RSqlSecurityPolicy::EWritePolicy, writePolicy));
+
+    
+    const TDesC8& config = KMCSqlConfig;
+    
+    TBool corrupt(EFalse);
+    TInt err = database.Create(filename->Des(), securityPolicy, &config);
+    if (KErrAlreadyExists == err)
+        {
+        MPX_DEBUG1("CMPXDbManager::DoCreateDatabaseL - could not create the database");
+
+        // the file already exists and it is corrupted
+        // make sure we delete the file
+        User::LeaveIfError(database.Delete(*filename));
+
+        MPX_DEBUG1("CMPXDbManager::DoCreateDatabaseL - deleted the database");
+
+        // try again
+        err = database.Create(filename->Des(), securityPolicy, &config);
+
+        // the database could not be opened but the file exists
+        corrupt = ETrue;
+        }
+    User::LeaveIfError(err);
+
+    MPX_DEBUG1("CMPXDbManager::DoCreateDatabaseL - created the database");
+
+    CleanupStack::PopAndDestroy(&securityPolicy);
+
+    CreateTablesL(database, corrupt);
+
+    CleanupStack::PopAndDestroy(filename);
+    CleanupStack::PopAndDestroy(&database);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxdbtable.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,872 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Base class for all table classes.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+
+#include "mpxdbcommonstd.h"
+#include "mpxdbcommonutil.h"
+#include "mpxdbmanager.h"
+#include "mpxdbtable.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CMPXDbTable::CMPXDbTable(
+    CMPXDbManager& aDbManager) :
+    iDbManager(aDbManager)
+    {
+    MPX_FUNC("CMPXDbTable::CMPXDbTable");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::BaseConstructL()
+    {
+    MPX_FUNC("CMPXDbTable::BaseConstructL");
+    iDbManager.RegisterTableL(*this);
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CMPXDbTable::~CMPXDbTable()
+    {
+    MPX_FUNC("CMPXDbTable::~CMPXDbTable");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::UpdateMediaL default implementation
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::UpdateMediaL(
+    RSqlStatement& /* aRecord */,
+    const TArray<TMPXAttribute>& /* aAttrs */,
+    CMPXMedia& /* aMedia */)
+    {
+    // do nothing
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    const TDesC& aQuery,
+    TInt aValue)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + KMCIntegerLen);
+    query->Des().Format(aQuery, aValue);
+    ExecuteMediaQueryL(aAttrs, aMediaArray, *query);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    const TDesC& aQuery,
+    const TDesC& aValue)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + aValue.Length());
+    query->Des().Format(aQuery, &aValue);
+    ExecuteMediaQueryL(aAttrs, aMediaArray, *query);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    const TDesC& aQuery,
+    TInt aValue1,
+    TInt aValue2)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + 2 * KMCIntegerLen);
+    query->Des().Format(aQuery, aValue1, aValue2);
+    ExecuteMediaQueryL(aAttrs, aMediaArray, *query);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    const TDesC& aQuery,
+    const TDesC& aValue1,
+    TInt aValue2)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + aValue1.Length() + KMCIntegerLen);
+    query->Des().Format(aQuery, &aValue1, aValue2);
+    ExecuteMediaQueryL(aAttrs, aMediaArray, *query);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    const TDesC& aQuery,
+    const TDesC& aValue1,
+    TInt aValue2,
+    const TDesC& aValue3,
+    TInt aValue4)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() +
+                                aValue1.Length() +
+                                aValue3.Length() +
+                                2*KMCIntegerLen);
+    query->Des().Format(aQuery, &aValue1, aValue2, &aValue3, aValue4);
+    ExecuteMediaQueryL(aAttrs, aMediaArray, *query);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    const TDesC& aQuery)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aQuery));
+    CleanupClosePushL(recordset);
+
+    TInt pPath(0);
+    if (aMediaArray.Count())
+        {
+        CMPXMedia* pMedia = aMediaArray[0];
+        if (pMedia->IsSupported(KMPXMediaGeneralValue))
+            { // Query excuted by OpenL
+            pPath = pMedia->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+            MPX_ASSERT(pPath);
+            }
+        }
+
+    TInt err(KErrNone);
+    RArray<TMPXItemId> ids;
+    CleanupClosePushL(ids);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        UpdateMediaL(recordset, aAttrs, *media);
+        if (media->IsSupported(KMPXMediaGeneralId) && pPath)
+            {
+            ids.AppendL(media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+            }
+        aMediaArray.AppendL(*media);
+        CleanupStack::PopAndDestroy(media);
+        }
+
+    // Append ids to the returned path
+    if (pPath)
+        {
+        ((CMPXCollectionPath*)pPath)->AppendL(ids.Array());
+        }
+    CleanupStack::PopAndDestroy(&ids);
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+	TInt aDrive,
+	const TArray<TMPXAttribute>& aAttrs,
+	CMPXMediaArray& aMediaArray,
+	const TDesC& aQuery,
+	TInt aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + KMCIntegerLen);
+    query->Des().Format(aQuery, aPlaylistId);
+    ExecuteMediaQueryOnDriveL(aDrive, aAttrs, aMediaArray, *query);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryOnDriveL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryOnDriveL(
+	TInt aDrive,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    const TDesC& aQuery)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryOnAllDrivesL(aDrive,aQuery));
+    CleanupClosePushL(recordset);
+
+    TInt pPath(0);
+    if (aMediaArray.Count())
+        {
+        CMPXMedia* pMedia = aMediaArray[0];
+        if (pMedia->IsSupported(KMPXMediaGeneralValue))
+            { // Query excuted by OpenL
+            pPath = pMedia->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+            MPX_ASSERT(pPath);
+            }
+        }
+
+    TInt err(KErrNone);
+    RArray<TMPXItemId> ids;
+    CleanupClosePushL(ids);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        UpdateMediaL(recordset, aAttrs, *media);
+        if (media->IsSupported(KMPXMediaGeneralId) && pPath)
+            {
+            ids.AppendL(media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+            }
+        aMediaArray.AppendL(*media);
+        CleanupStack::PopAndDestroy(media);
+        }
+
+    // Append ids to the returned path
+    if (pPath)
+        {
+        ((CMPXCollectionPath*)pPath)->AppendL(ids.Array());
+        }
+    CleanupStack::PopAndDestroy(&ids);
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    const TBool aAsc,
+    const TDesC& aQuery)
+    {
+
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aQuery));
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        UpdateMediaL(recordset, aAttrs, *media);
+        if (aAsc != EFalse)
+            {
+            aMediaArray.AppendL(*media);
+            }
+        else
+            {
+            aMediaArray.InsertL(*media, 0);
+            }
+        CleanupStack::PopAndDestroy(media);
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia,
+    const TDesC& aQuery)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aQuery));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    UpdateMediaL(recordset, aAttrs, aMedia);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia,
+    const TDesC& aQuery,
+    TInt aValue)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + KMCIntegerLen);
+    query->Des().Format(aQuery, aValue);
+    ExecuteMediaQueryL(aAttrs, aMedia, *query);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    const TDesC& aQuery,
+    const TDesC& aValue1,
+    const TDesC& aValue2)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + aValue1.Length() + aValue2.Length());
+    query->Des().Format(aQuery, &aValue1, &aValue2);
+    ExecuteMediaQueryL(aAttrs, aMediaArray, *query);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteIntQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CMPXDbTable::ExecuteIntQueryL(
+    const TDesC& aQuery)
+    {
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aQuery));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    TUint32 value(recordset.ColumnInt64(KMPXTableDefaultIndex));
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return value;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteIntQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CMPXDbTable::ExecuteIntQueryL(
+    const TDesC& aQuery,
+    TUint32 aValue)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteIntQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + KMCIntegerLen);
+    query->Des().Format(aQuery, aValue);
+    TUint32 ret(ExecuteIntQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteIntQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CMPXDbTable::ExecuteIntQueryL(
+    const TDesC& aQuery,
+    const TDesC& aValue1,
+    TUint32 aValue2)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteIntQueryL");
+
+    // replace single quotes
+    // reserve double the value length for single quote duplicates
+    HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
+    TPtr value1Ptr(value1->Des());
+    MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
+
+    // construct the query
+    HBufC* query = HBufC::NewLC(aQuery.Length() + value1Ptr.Length() + KMCIntegerLen);
+    query->Des().Format(aQuery, value1, aValue2);
+
+    // execute the query
+    TUint32 ret(ExecuteIntQueryL(*query));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(value1);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteIntQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CMPXDbTable::ExecuteIntQueryL(
+    const TDesC& aQuery,
+    const TDesC& aValue)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteIntQueryL");
+
+    // replace single quotes
+    HBufC* value = HBufC::NewLC(aValue.Length() * 2);
+    TPtr valuePtr(value->Des());
+    MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue, valuePtr);
+
+    // construct the query
+    HBufC* query = HBufC::NewLC(aQuery.Length() + valuePtr.Length());
+    query->Des().Format(aQuery, value);
+
+    // execute the query
+    TUint32 ret(ExecuteIntQueryL(*query));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(value);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteIntQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CMPXDbTable::ExecuteIntQueryL(
+    const TDesC& aQuery,
+    TUint32 aValue1,
+    TUint32 aValue2)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteIntQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + 2 * KMCIntegerLen);
+    query->Des().Format(aQuery, aValue1, aValue2);
+    TUint32 ret(ExecuteIntQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteIntQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CMPXDbTable::ExecuteIntQueryL(TInt aDriveID,const TDesC& aQuery)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteIntQueryL");
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDriveID,aQuery));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    TUint32 value(recordset.ColumnInt64(KMPXTableDefaultIndex));
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return value;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteSumQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXDbTable::ExecuteSumQueryL(
+    const TDesC& aQuery)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aQuery));
+    CleanupClosePushL(recordset);
+
+    TInt sum(0);
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        sum += recordset.ColumnInt64(KMPXTableDefaultIndex);
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err != KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    return sum;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteSumQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXDbTable::ExecuteSumQueryL(
+    const TDesC& aQuery,
+    TUint32 aValue)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + KMCIntegerLen);
+    query->Des().Format(aQuery, aValue);
+    TUint32 ret(ExecuteSumQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteSumQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXDbTable::ExecuteSumQueryL(
+    const TDesC& aQuery,
+    TUint32 aValue1,
+    TUint32 aValue2)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + 2 * KMCIntegerLen);
+    query->Des().Format(aQuery, aValue1, aValue2);
+    TUint32 ret(ExecuteSumQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteSumQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXDbTable::ExecuteSumQueryL(
+    const TDesC& aQuery,
+    TUint32 aValue1,
+    TUint32 aValue2,
+    TUint32 aValue3)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + 3 * KMCIntegerLen);
+    query->Des().Format(aQuery, aValue1, aValue2, aValue3);
+    TUint32 ret(ExecuteSumQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteSumQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TUint32 CMPXDbTable::ExecuteSumQueryL(
+    const TDesC& aQuery,
+    const TDesC& aValue1,
+    TUint32 aValue2)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
+
+    // replace single quotes
+    // reserve double the value length for single quote duplicates
+    HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
+    TPtr value1Ptr(value1->Des());
+    MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
+
+    // construct the query
+    HBufC* query = HBufC::NewLC(aQuery.Length() + value1Ptr.Length() + KMCIntegerLen);
+    query->Des().Format(aQuery, value1, aValue2);
+
+    // execute the query
+    TUint32 ret(ExecuteSumQueryL(*query));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(value1);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteSumQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXDbTable::ExecuteSumQueryL(
+    const TDesC& aQuery,
+    const TDesC& aValue1,
+    const TDesC& aValue2)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
+
+    // replace single quotes
+    // reserve double the value length for single quote duplicates
+    HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
+    TPtr value1Ptr(value1->Des());
+    MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
+
+    HBufC* value2 = HBufC::NewLC(aValue2.Length() * 2);
+    TPtr value2Ptr(value2->Des());
+    MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue2, value2Ptr);
+
+    // construct the query
+    HBufC* query = HBufC::NewLC(aQuery.Length() + value1Ptr.Length() + value2Ptr.Length());
+    query->Des().Format(aQuery, value1, value2);
+
+    // execute the query
+    TUint32 ret(ExecuteSumQueryL(*query));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(value2);
+    CleanupStack::PopAndDestroy(value1);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteSumQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXDbTable::ExecuteSumQueryL(
+    const TDesC& aQuery,
+    const TDesC& aValue)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
+
+    // replace single quotes
+    // reserve double the value length for single quote duplicates
+    HBufC* value = HBufC::NewLC(aValue.Length() * 2);
+    TPtr valuePtr(value->Des());
+    MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue, valuePtr);
+
+    // construct the query
+    HBufC* query = HBufC::NewLC(aQuery.Length() + valuePtr.Length());
+    query->Des().Format(aQuery, value);
+
+    // execute the query
+    TUint32 ret(ExecuteSumQueryL(*query));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(value);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteSumQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXDbTable::ExecuteSumQueryL(
+    const TDesC& aQuery,
+    const TDesC& aValue1,
+    TUint32 aValue2,
+    const TDesC& aValue3,
+    TUint32 aValue4)
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteSumQueryL");
+
+    // replace single quotes
+    // reserve double the value length for single quote duplicates
+    HBufC* value1 = HBufC::NewLC(aValue1.Length() * 2);
+    TPtr value1Ptr(value1->Des());
+    MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue1, value1Ptr);
+
+    // replace single quotes
+    // reserve double the value length for single quote duplicates
+    HBufC* value3 = HBufC::NewLC(aValue3.Length() * 2);
+    TPtr value3Ptr(value3->Des());
+    MPXDbCommonUtil::FindAndReplaceSingleQuote(aValue3, value3Ptr);
+
+    // construct the query
+    HBufC* query = HBufC::NewLC( aQuery.Length() +
+                                 value1Ptr.Length() +
+                                 2 * KMCIntegerLen +
+                                 value3Ptr.Length() );
+    query->Des().Format(aQuery, value1, aValue2, value3, aValue4);
+
+    // execute the query
+    TUint32 ret(ExecuteSumQueryL(*query));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(value3);
+    CleanupStack::PopAndDestroy(value1);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    const TDesC& aQuery,
+    TInt aValue1,
+    TInt aValue2,
+    TUint aQueryId )
+    {
+    MPX_FUNC("CMPXDbTable::ExecuteMediaOffsetQueryL");
+
+    RSqlStatement& recordset(iDbManager.ExecuteSelectQueryL(aQueryId,
+                                                            aValue1,
+                                                            aValue2,
+                                                            aQuery));
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        UpdateMediaL(recordset, aAttrs, *media);
+
+        aMediaArray.AppendL(*media);
+        CleanupStack::PopAndDestroy(media);
+        }
+    CleanupStack::Pop(&recordset);
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::ExecuteMediaQueryL
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXDbTable::ExecuteMediaQueryL( const TArray<TMPXAttribute>& aAttrs,
+                                               CMPXMediaArray& aMediaArray,
+                                               const TDesC& aQuery,
+                                               const TDesC& aValue1,
+                                               TInt aValue2,
+                                               TBool aAsc,
+                                               TUint aQueryId )
+    {
+    MPX_DEBUG1("CMPXDbTable::ExecuteMediaAscQueryL  <--");
+
+    RSqlStatement& recordset(iDbManager.ExecuteSelectQueryL(aQueryId,
+                                                            aValue1,
+                                                            aValue2,
+                                                            aQuery));
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        UpdateMediaL(recordset, aAttrs, *media);
+
+        if( aAsc )
+            {
+            aMediaArray.AppendL(*media);
+            }
+        else
+            {
+            aMediaArray.InsertL(*media, 0);
+            }
+        CleanupStack::PopAndDestroy(media);
+        }
+
+    CleanupStack::Pop(&recordset);
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    MPX_DEBUG1("CMPXDbTable::ExecuteMediaAscQueryL  -->");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbTable::DoCheckTable
+// ----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXDbTable::DoCheckTable(
+    RSqlDatabase& aDatabase,
+    const TDesC& aQuery)
+    {
+    MPX_FUNC("CMPXDbTable::DoCheckTable");
+
+    RSqlStatement statement;
+    TInt err(statement.Prepare(aDatabase, aQuery));
+    statement.Close();
+
+    return (err == KErrNone);
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbcommon/src/mpxresource.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class provide API to read resource from resource file
+*
+*/
+
+
+// INCLUDE FILES
+#include <barsread.h>
+#include <mpxuser.h>
+#include <mpxlog.h>
+#include "mpxresource.h"
+
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Factory function
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CMPXResource* CMPXResource::NewL(const TDesC& aResourceFile)
+    {
+    CMPXResource* resObj = NewLC(aResourceFile);
+    CleanupStack::Pop(resObj);
+    return resObj;
+    }
+
+// ----------------------------------------------------------------------------
+// Factory function
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CMPXResource* CMPXResource::NewLC(const TDesC& aResourceFile)
+    {
+    MPX_DEBUG1("CMPXResource::NewLC");
+    CMPXResource* self = new (ELeave) CMPXResource();
+    CleanupStack::PushL (self);
+    self->ConstructL(aResourceFile);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Decrements the reference count, and delete the object if it is 0
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXResource::Release()
+    {
+    delete this;
+    }
+
+// ----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that might leave
+// ----------------------------------------------------------------------------
+//
+CMPXResource::CMPXResource()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Contruct the object
+// ----------------------------------------------------------------------------
+//
+void CMPXResource::ConstructL(const TDesC& aResourceFile)
+    {
+    // In order to support installation of individual plugin.
+    // aResourceFile must be a final name.
+    // All parse should be done in the plugin side.
+    MPX_DEBUG1("CMPXResource::ConstructL");
+    User::LeaveIfError(iFs.Connect());
+    MPX_DEBUG2("Open resource file %S", &aResourceFile);
+    iResourceFile.OpenL(iFs, aResourceFile);
+    iResourceFile.ConfirmSignatureL(0);
+    MPX_DEBUG1("CMPXResource::ConstructL End");
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXResource::~CMPXResource()
+    {
+    iResourceFile.Close();
+    iFs.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of descriptors
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CDesCArrayFlat* CMPXResource::ReadDesCArrayL(TInt aResourceId)
+    {
+    CDesCArrayFlat* descArray = ReadDesCArrayLC(aResourceId);
+    CleanupStack::Pop(descArray);
+    return descArray;
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of descriptors, leave on cleanup stack
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CDesCArrayFlat* CMPXResource::ReadDesCArrayLC(TInt aResourceId)
+    {
+    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC");
+    TResourceReader resReader;
+    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
+    resReader.SetBuffer(readBuffer);
+    CDesCArrayFlat* descArray = resReader.ReadDesCArrayL();
+    CleanupStack::PopAndDestroy(readBuffer);
+    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC End");
+    CleanupStack::PushL(descArray);
+    return descArray;
+    }
+
+// ----------------------------------------------------------------------------
+// Get a heap descriptor from the resource file
+// ----------------------------------------------------------------------------
+//
+EXPORT_C HBufC* CMPXResource::ReadHBufCL(TInt aResourceId)
+    {
+    //MPX_DEBUG1("CMPXResource::ReadHBufCL");
+    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
+    TResourceReader resReader;
+    resReader.SetBuffer(readBuffer);
+    //resource type has to be LBUF
+    HBufC* hbuf = resReader.ReadHBufCL();
+    CleanupStack::PopAndDestroy(readBuffer);
+    return hbuf;
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of menu items
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CDesCArrayFlat* CMPXResource::ReadMenuArrayL(TInt aResourceId, RArray<TInt>& aIdArray)
+    {
+    CDesCArrayFlat* menuArray = ReadMenuArrayLC(aResourceId, aIdArray);
+    CleanupStack::Pop(menuArray);
+    return menuArray;
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of menu items, leave on cleanup stack
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CDesCArrayFlat* CMPXResource::ReadMenuArrayLC(TInt aResourceId, RArray<TInt>& aIdArray)
+    {
+    //MPX_DEBUG1("CMPXResource::ReadMenuArrayLC");
+    TResourceReader resReader;
+    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
+    resReader.SetBuffer(readBuffer);
+    TInt count(resReader.ReadInt16());
+    CDesCArrayFlat* descArray = new (ELeave) CDesCArrayFlat(count); ;
+    for (TInt k = 0; k < count; k++)
+              {
+              aIdArray.AppendL (resReader.ReadInt32());
+              HBufC* hbuf = resReader.ReadHBufCL();
+              CleanupStack::PushL(hbuf);
+              descArray->AppendL (*hbuf);
+              CleanupStack::PopAndDestroy(hbuf);
+        }
+    CleanupStack::PopAndDestroy(readBuffer);
+    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC End");
+    CleanupStack::PushL(descArray);
+    return descArray;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/data/10207C85.RSS	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+#include <mpxcollectionplugin.hrh>
+#include "mpxpluginresource.hrh"
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: Supported plugin types.
+ *  E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. for music plugin will be: 0x101FFCDA
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags
+ *         Collection specific flags include:
+ *                EMPXCollectionPluginFlagCacheable - Are media results cachable in the collection cache
+ *         General flags include: 
+ *                EMPXPluginFlagPreLoad - Should the plugin be pre loaded when the collection starts
+ *                
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXCollectionPluginPriorities. This value determines
+ *  the returning order when several plugins can support the same set of Uids. 
+ *  Default value of this field is EMPXCollectionPluginPriorityNormal.
+ *
+ * <c>non-cacheable attributes</c> optional
+ *  List of content IDs that cannot be cached in the collection cache.
+ *  The list is a list of hexidecimal numbers, semicolon seperated
+ *  For example, <c>0x101FFC45</c> not cache media objects w/ drm attributes
+ *
+ */
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x10207C85;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXCollectionPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x101FFC3A;
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "audio/mp3;audio/x-mp3;audio/mp4;audio/3gpp;audio/3gpp2;audio/wav;audio/x-wav;audio/x-au;audio/au;audio/3gp;audio/mpeg;audio/aac;audio/x-ms-wma;x-caf-audio/x-ms-wma;audio/x-pn-realaudio;audio/x-realaudio;audio/vnd.rn-realaudio";
+                    opaque_data = "<s>*<e>.mp3;.aac;.3gp;.3gpp;.3g2;.3gpp2;.m4a;.wav;.mp4;.wma;.dcf;.odf;.asf;.m3u;.rm;.ra;.o4a;.dm;.3ga"
+                                  "<t>"EMPXCollectionPluginMusic"</t>"
+                                  "<i>"EMPXPluginPriorityHighest"</i>"
+                                  "<c>"EDRMContentId"</c>" // DRM
+                                  "<f>"EPreloadAndCache"</f>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/data/mpxcollectiondbhgres.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,298 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file contains all the resources for the Music Collection
+*
+*/
+
+
+//  INCLUDES
+#include <bldvariant.hrh>
+#include <badef.rh>
+#include <pathconfiguration.hrh>
+#include "mpxcollectiondb.hrh"
+#include <mpxcollectiondbhg.loc>
+
+STRUCT MENU_ITEM
+    {
+    LONG   id;
+    STRUCT name;
+    }
+
+STRUCT MENU_ITEM_ARRAY
+    {
+    STRUCT array_of_menu_items[];
+    }
+
+//  RESOURCE IDENTIFIER
+NAME    OAMC // 4 letter ID
+
+//  RESOURCE DEFINITIONS
+
+RESOURCE BA_RSS_SIGNATURE { }
+
+//----------------------------------------------------
+//
+//    r_mc_music_library_menu_items
+//    Menu items to be displayed in the music library view
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_ITEM_ARRAY r_mc_menu_items_array
+    {
+    array_of_menu_items =
+        {
+        MENU_ITEM {id = EBrowseAll;      name = LBUF {txt = qtn_mus_all_tracks;};},
+        MENU_ITEM {id = EBrowsePlaylist; name = LBUF {txt = qtn_mus_playlists;};},
+        MENU_ITEM {id = EBrowseArtist;   name = LBUF {txt = qtn_mus_artists;};},
+        MENU_ITEM {id = EBrowseAlbum;    name = LBUF {txt = qtn_mus_albums;};},
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU        
+        MENU_ITEM {id = EBrowsePodcasts; name = LBUF {txt = qtn_mus_podcasts;};},
+#endif
+        MENU_ITEM {id = EBrowseGenre;    name = LBUF {txt = qtn_mus_genres;};},
+        MENU_ITEM {id = EBrowseComposer; name = LBUF {txt = qtn_mus_composers;};}        
+        };
+    }
+
+RESOURCE TBUF { buf="MPXCOLLECTIONDBRES"; }
+
+//----------------------------------------------------
+//
+//    r_mc_music_library_title_items
+//    titles to be displayed in the music player
+//
+//    added album for ganes
+//----------------------------------------------------
+//
+RESOURCE MENU_ITEM_ARRAY r_mc_title_items_array
+    {
+    array_of_menu_items =
+        {
+        MENU_ITEM {id = EBrowseAll;      name = LBUF {txt = qtn_mus_title_all_tracks;};},
+        MENU_ITEM {id = EBrowsePlaylist; name = LBUF {txt = qtn_mus_title_pls;};},
+        MENU_ITEM {id = EBrowseArtist;   name = LBUF {txt = qtn_mus_title_artists;};},
+        MENU_ITEM {id = EBrowseAlbum;    name = LBUF {txt = qtn_mus_title_albums;};},
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU                
+        MENU_ITEM {id = EBrowsePodcasts; name = LBUF {txt = qtn_mus_podcasts;};},
+#endif        
+        MENU_ITEM {id = EBrowseGenre;    name = LBUF {txt = qtn_mus_title_genres;};},
+        MENU_ITEM {id = EBrowseComposer; name = LBUF {txt = qtn_mus_title_composers;};},     
+        MENU_ITEM {id = EBrowseAlbumSong;    name = LBUF {txt = qtn_mus_title_album;};}
+        };
+    }
+
+
+// ** DEFAULT MUSIC FOLDER STRINGS
+
+//----------------------------------------------------
+//
+//    r_mc_default_music_folders
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_default_music_folders
+    {
+    items =
+        {
+        LBUF {txt = text_memory_card_root_path;},
+        LBUF {txt = text_phone_memory_root_path;}
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_mc_music_file_extensions
+//    file extensions which be scanned by music collection
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_music_file_extensions
+    {
+    items =
+        {
+#if (defined __WMA || defined __WINDOWS_MEDIA)
+        LBUF {txt = ".wma";},
+#endif
+        LBUF {txt = ".mp3";},
+        LBUF {txt = ".m4a";},
+        LBUF {txt = ".aac";}
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_mc_file_extensions_mime
+//    file extensions which can be scanned by music
+//    collection, however, these files types must be
+//    checked whether their MIME types match as well
+//    because they can be DRM or video files
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_file_extensions_mime
+    {
+    items =
+        {
+        LBUF {txt = "";},
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+        LBUF {txt = ".ra";},
+        LBUF {txt = ".rm";},
+#endif
+        LBUF {txt = ".mp4";},
+        LBUF {txt = ".3gpp";},
+        LBUF {txt = ".3gp";},
+        LBUF {txt = ".3gpp2";},
+        LBUF {txt = ".3g2";},
+        LBUF {txt = ".3ga";},
+        LBUF {txt = ".dcf";},
+        LBUF {txt = ".dm";},
+        LBUF {txt = ".odf";}
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_mc_file_extensions_drm
+//    file extensions which can be scanned by music
+//    collection, however, these files types must be
+//    checked which type of DRM is used
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_file_extensions_drm
+    {
+    items =
+        {
+        LBUF {txt = "";},
+        LBUF {txt = ".dcf";},
+        LBUF {txt = ".dm";},
+        LBUF {txt = ".odf";},
+        LBUF {txt = ".o4a";}
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_mc_mime_types
+//    Mime types which be scanned by music collection
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_mime_types
+    {
+    items =
+        {
+#ifdef __WMA
+        LBUF {txt = "audio/x-ms-wma";},
+#endif
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+        LBUF {txt = "audio/x-pn-realaudio";},
+        LBUF {txt = "audio/x-realaudio";},
+        LBUF {txt = "audio/vnd.rn-realaudio";},
+//        LBUF {txt = "application/vnd.rn-realmedia";}
+#endif
+        LBUF {txt = "audio/mpeg";},
+        LBUF {txt = "audio/aac";},
+        LBUF {txt = "audio/mp3";},
+        LBUF {txt = "audio/x-mp3";},
+        LBUF {txt = "audio/mp4";},
+        LBUF {txt = "audio/3gpp";},
+        LBUF {txt = "audio/m4a";},
+        LBUF {txt = "audio/3gpp2";},
+        LBUF {txt = "audio/mpeg4";}
+        };
+    }
+
+// ** All songs for an artist
+RESOURCE LBUF r_mc_all_songs_for_artist
+    {
+    txt = qtn_nmp_all_by;
+    }
+
+// ** Recently played
+RESOURCE LBUF r_mc_recently_played_playlist
+    {
+    txt = qtn_mus_pl_recently_played;
+    }
+
+// ** Most played
+RESOURCE LBUF r_mc_most_played_playlist
+    {
+    txt = qtn_mus_pl_most_played;
+    }
+
+// ** Recently added
+RESOURCE LBUF r_mc_recently_added_playlist
+    {
+    txt = qtn_mus_pl_recently_downloaded;
+    }
+
+// ** Shuffle All
+RESOURCE LBUF r_mc_shuffle_all
+    {
+    txt = "Shuffle All";
+    }
+    
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_music_num_songs
+// Number of songs text
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_music_num_songs
+    {
+    txt = qtn_mus_music_num_songs;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_music_one_song
+// One song text
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_music_one_song
+    {
+    txt = qtn_mus_music_one_song;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_music
+// Collection Plugin Name
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_music
+    {
+    txt = qtn_mus_music;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_title_music_menu
+// Music Menu Title
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_title_music_menu
+    {
+    txt = qtn_mus_title_music_menu;
+    }
+
+#ifdef __ENABLE_MUSIC_TEXT_ALIGNMENT
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mp_title_my_music_menu_nseries
+// My Music Menu Title
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mp_title_my_music_menu_nseries
+    {
+    txt = qtn_mp_title_my_music_menu_nseries;
+    }
+#endif //__ENABLE_MUSIC_TEXT_ALIGNMENT
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project Sqlite Collection plugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxcollectiondbhg.loc    APP_LAYER_LOC_EXPORT_PATH(mpxcollectiondbhg.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxdbhgplugin.mif
+OPTION HEADERFILE mpxdbhgplugin.mbg
+OPTION SOURCES -c8,8 qgn_graf_mup_dlst_music
+END
+
+
+PRJ_MMPFILES
+
+mpxsqlitedbhgplugin.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1 @@
+/c8,8 qgn_graf_mup_dlst_music
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/group/mpxdbpluginiconshg.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  Icons makefile for project mpxdbplugin
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxdbplugin.mif
+HEADERFILENAME=$(HEADERDIR)/mpxdbplugin.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+    mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+        /Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+    @echo $(HEADERFILENAME)&& \
+    @echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/group/mpxsqlitedbhgplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Collection file db plugin project specification
+*
+*/
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxsqlitedbhgplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x10207C85
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN
+
+VERSION 15.0
+
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+#define __ENABLE_PODCAST_IN_MUSIC_MENU
+//MACRO RD_MPX_COLLECTION_CACHE
+
+SOURCEPATH      ../src
+SOURCE          mpxdbplugin.cpp
+SOURCE          mpxdbpluginproxy.cpp
+SOURCE          mpxdbutil.cpp
+
+SOURCE          mpxcollectiondbmanager.cpp
+
+SOURCE          mpxdbcategory.cpp
+SOURCE          mpxdbmusic.cpp
+SOURCE          mpxdbplaylist.cpp
+SOURCE          mpxdbplaylistsongs.cpp
+SOURCE          mpxdbauxiliary.cpp
+SOURCE          mpxdbautoplaylist.cpp
+SOURCE          mpxdbhandler.cpp
+SOURCE          mpxdbartist.cpp
+SOURCE          mpxdbalbum.cpp
+SOURCE          mpxdbgenre.cpp
+SOURCE          mpxdbcomposer.cpp
+
+SOURCEPATH       ../data
+START RESOURCE  mpxcollectiondbhgres.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END
+
+SOURCEPATH      ../data
+START RESOURCE  10207C85.RSS
+TARGET          mpxsqlitedbhgplugin.rsc
+END
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+LIBRARY         sqldb.lib
+LIBRARY         bafl.lib
+LIBRARY         apmime.lib
+LIBRARY         sysutil.lib
+#ifdef __MTP_PROTOCOL_SUPPORT
+LIBRARY         centralrepository.lib
+#endif
+#ifdef RD_MULTIPLE_DRIVE
+LIBRARY         PlatformEnv.lib
+#endif //RD_MULTIPLE_DRIVE
+
+LIBRARY         mpxsqlitedbcommon.lib
+LIBRARY         mpxcommon.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondb.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file contains declarations for constants of Music
+*                Collection. The file can be included in C++ or resource file.
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONDB_HRH
+#define MPXCOLLECTIONDB_HRH
+
+enum TMCBrowseType
+    {
+    EBrowseAll = 0,
+    EBrowsePlaylist,
+    EBrowseArtist,
+    EBrowseAlbum,
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU            
+    EBrowsePodcasts,
+#endif    
+    EBrowseGenre,
+    EBrowseComposer,        
+    EBrowseAlbumSong //added for ganes
+    };
+
+#endif      // MPXCOLLECTIONDB_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbdef.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This header file contains macro definitions used by the
+*                database subsystem.
+*
+*/
+
+#ifndef MPXCOLLECTIONDBDEF_H
+#define MPXCOLLECTIONDBDEF_H
+
+// INCLUDES
+#include <mmfmeta.h>
+
+// CONSTANTS
+
+// ================================== DATABASE ================================
+
+// Db filename
+_LIT(KMCDbFile, "mpxv2_5.db");
+
+// Collection Db resource file
+_LIT(KMPXCollectionDbResourceFile,  "mpxcollectiondbhgres.rsc");
+
+// == TABLE NAMES =============================================================
+// The Auxiliary table stores general database metadata
+_LIT(KMCAuxiliaryTable,             "Auxiliary");
+// The Music table stores songs information
+_LIT(KMCMusicTable,                 "Music");
+// The Playlist table stores playlists information
+_LIT(KMCPlaylistTable,              "Playlist");
+// The PlaylistSongs table stores the song instances for each playlist
+_LIT(KMCPlaylistSongsTable,         "PlaylistSongs");
+// The PlaylistSongInfo table stores the songs that are included in playlists
+_LIT(KMCPlaylistSongInfoTable,      "PlaylistSongInfo");
+// The Artist table stores artist information
+_LIT(KMCArtistTable,                "Artist");
+// The Album table stores albums information
+_LIT(KMCAlbumTable,                 "Album");
+// The Genre table stores genres information
+_LIT(KMCGenreTable,                 "Genre");
+// The Composer table stores composers information
+_LIT(KMCComposerTable,              "Composer");
+
+// == Music TABLE FIELDS ======================================================
+_LIT(KMCMusicUniqueId,          "UniqueId");
+
+// From MMF (MmfMeta.h)
+#define KMCMusicName                KMMFMetaEntrySongTitle           // "title"
+#define KMCMusicArtist              KMMFMetaEntryArtist              // "artist"
+#define KMCMusicAlbum               KMMFMetaEntryAlbum               // "album"
+#define KMCMusicTrackNumber         KMMFMetaEntryAlbumTrack          // "albumtrack"
+#define KMCMusicGenre               KMMFMetaEntryGenre               // "genre"
+#define KMCMusicComposer            KMMFMetaEntryComposer            // "composer"
+#define KMCMusicComment             KMMFMetaEntryComment             // "comment"
+#define KMCMusicCopyright           KMMFMetaEntryCopyright           // "copyright"
+#define KMCMusicOrigArtist          KMMFMetaEntryOriginalArtist      // "originalartist"
+//end of MMF support data
+
+// NOTE: Location will store the path without drive letter
+_LIT(KMCMusicLocation,              "Location");
+_LIT(KMCMusicDuration,              "Duration");
+_LIT(KMCMusicReleaseDate,           "ReleaseDate");
+_LIT(KMCMusicTimeAdded,             "TimeAdded");
+_LIT(KMCMusicPlayCount,             "PlayCount");
+_LIT(KMCMusicTimePlayed,            "TimePlayed");
+_LIT(KMCMusicRating,                "Rating");
+_LIT(KMCMusicArt,                   "Art");
+_LIT(KMCMusicDbFlag,                "DbFlag");
+_LIT(KMCMusicSync,                  "Sync");
+_LIT(KMCMusicMod,                   "Modified");
+_LIT(KMCMusicDel,                   "Deleted");
+_LIT(KMCMusicUrl,                   "Url");
+_LIT(KMCMusicDRM,                   "DRM");
+_LIT(KMCMusicLastPlayPosition,      "LastPlayPosition");
+_LIT(KMCMusicSampleRate,            "SampleRate");
+_LIT(KMCMusicBitRate,               "BitRate");
+_LIT(KMCMusicVolumeId,              "VolumeId");
+
+// Number of channels: required by MTP to support Play4sure
+_LIT(KMCMusicNumChannels,           "NumChannels");
+
+// Audio Codec: required by MTP to support Play4sure
+_LIT(KMCMusicCodec,                 "Codec");
+_LIT(KMCMusicMimeType,              "MimeType");
+_LIT(KMCMusicMTPDrmStatus,          "MTPDrmStatus");
+
+// == Category TABLE FIELDS ===================================================
+_LIT(KMCCategoryUniqueId,           "UniqueId");
+_LIT(KMCCategoryName,               "Name");
+_LIT(KMCCategorySongCount,          "SongCount");
+
+// == Playlist TABLE FIELDS ===================================================
+_LIT(KMCPlaylistUniqueId,           "UniqueId");
+_LIT(KMCPlaylistName,               "Name");
+_LIT(KMCPlaylistUri,                "Uri");
+_LIT(KMCPlaylistVolumeId,           "VolumeId");
+_LIT(KMCPlaylistSync,               "Sync");
+_LIT(KMCPlaylistDbFlag,             "DbFlag");
+_LIT(KMCPlaylistTime,               "Time");
+
+// == PlaylistSongs TABLE FIELDS ==============================================
+_LIT(KMCPlaylistSongsUniqueId,      "UniqueId");
+_LIT(KMCPlaylistSongsSongId,        "SongId");
+_LIT(KMCPlaylistSongsPlaylistId,        "PlaylistId");
+_LIT(KMCPlaylistSongsOrdinal,   "Ordinal");
+
+// == PlaylistSongInfo TABLE FIELDS ===========================================
+_LIT(KMCPlaylistSongInfoSongId,     "SongId");
+_LIT(KMCPlaylistSongInfoUri,        "Uri");
+_LIT(KMCPlaylistSongInfoTitle,      "Title");
+_LIT(KMCPlaylistSongInfoVolumeId,   "VolumeId");
+_LIT(KMCPlaylistSongInfoDbFlag,     "DbFlag");
+
+// == Auxiliary TABLE FIELDS ==================================================
+// Version of database
+// The version integer looks like:
+// 31     23      15           0 bit
+// -----------------------------
+// |Major |Minor  |Build       |
+// -----------------------------
+_LIT(KMCAuxVersion,                 "Version");
+
+// Last time db was refreshed
+_LIT(KMCAuxTimeRefresh,             "TimeRefreshed");
+
+// Last time db was synced
+_LIT(KMCAuxTimeSync,                "TimeSynced");
+
+// Database Corrupted bit
+_LIT(KMCMusicCorruptDB,             "Corrupt");
+
+// Number of records that have been marked as deleted
+_LIT(KMCSavedDeletedRecordCount,    "SaveDeletedRecordCount");
+
+#endif // MPXCOLLECTIONDBDEF_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbmanager.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for managing all of music collection
+*                databases.
+*
+*/
+
+
+#ifndef MPXCOLLECTIONDBMANAGER_H
+#define MPXCOLLECTIONDBMANAGER_H
+
+// INCLUDES
+
+#include "mpxdbmanager.h"
+
+// CLASS DECLARATION
+
+/**
+* Database manager specialization for the collection plugin.
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXCollectionDbManager :
+    public CMPXDbManager
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return The constructed object of CMPXDbManager
+        */
+        static CMPXCollectionDbManager* NewL(RFs& aFs);
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return The constructed object of CMPXDbManager
+        */
+        static CMPXCollectionDbManager* NewLC(RFs& aFs);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXCollectionDbManager();
+
+    private:
+
+        /**
+        * C++ default constructor
+        * @param aFs file server session
+        */
+        CMPXCollectionDbManager(RFs& aFs);
+
+        /**
+        * The second phase constructor ConstructL to safely construct things
+        * that can leave
+        */
+        void ConstructL();
+    };
+
+#endif  // MPXCOLLECTIONDBMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxcollectiondbstd.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2006,2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This header file contains constants definitions and type
+*                definition
+*
+*/
+
+
+#ifndef MPXCOLLECTIONDBSTD_H
+#define MPXCOLLECTIONDBSTD_H
+
+// CONSTANTS
+enum TMPXAutoPlaylistType
+    {
+    EMPXNoAutoPlaylist = -1,
+    EMPXRecentlyPlayedPlaylist,
+    EMPXMostPlayedPlaylist,
+    EMPXRecentlyAddedPlaylist,
+    EMPXAutoPlaylistCount
+    };
+
+const TInt KDBPluginUid = 0x101FFC3A;
+
+const TInt KMPXMaxRecentlyPlayedSongs = 20;
+const TInt KMPXMaxMostPlayedSongs = 20;
+const TInt KMPXRecentlyAddedInterval = 7;
+
+const TInt KMCMaxTextLen          = 255; // Maximum field size for categories is 255
+
+#endif // MPXCOLLECTIONDBSTD_H
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbalbum.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for all category tables (Artist,
+*                Album, Genre, Composer).
+*
+*
+*/
+
+
+#ifndef MPXDBALBUM_H
+#define MPXDBALBUM_H
+
+// INCLUDES
+#include "mpxdbcategory.h"
+
+// CLASS DECLARATION
+
+class MMPXDbAlbumObserver
+    {
+    public:
+        virtual TInt HandleIsUnknownArtistL(TUint32 aId) = 0;
+        virtual TUint32 HandleArtistForAlbumL( const TUint32 aId ) = 0;
+    };
+/**
+* Responsible for managing all music databases
+*
+* @lib MPXDbPlugin.lib
+*/
+
+class CMPXDbAlbum :
+    public CMPXDbCategory
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance.
+        */
+        static CMPXDbAlbum* NewL(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory, MMPXDbAlbumObserver& aObserver);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance on the cleanup stack.
+        */
+        static CMPXDbAlbum* NewLC(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory, MMPXDbAlbumObserver& aObserver);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbAlbum();
+
+    public:
+
+        /**
+        * Add a category item. If the record already exists, its counter will
+        * be incremented.
+        * @param aName: This is the name to be entered into the row
+        * @param aDriveId: The Drive Id the name (category) belongs
+        * @param aNewRecord: indicates to the caller if a new record is created.
+        *        ETrue if a new row is created in the table; otherwise EFalse.
+        * @param aCaseSensitive indicates whether case sensitivity should be taken
+        *        into consideration when generating the unique row id
+        * @return The unique id of the row added.
+        */
+        TUint32 AddItemL(const TDesC& aName, TUint32 aArtist, const TDesC& aArt, TInt aDriveId, TBool& aNewRecord,
+            TBool aCaseSensitive = ETrue);
+
+        /**
+        * Decrement the number of songs for the item. If the count gets to 0, remove
+        * the item.
+        * @param aId: The ID of the category to delete.
+        * @param aDriveId: The drive Id the name (category) belongs to. Songs on different
+        *                  drives may belong to the same album or artist; consequently, one
+        *                  row for each artist/album id and drive ID pair will exist in the
+        *                  lookup table with a count existing for each row that tracks the
+        *                  number number of songs on that drive with that album/artist.
+        * @param aItemChangedMessages if valid on return contains a deleted message if the
+        *                  category was deleted
+        * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete,
+        *        EFalse otherwise
+		* @param aArtist: The ID of the artist
+        */
+        void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
+            CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TUint32 aArtist);
+
+		/**
+	* Gets the details for all category items.
+	* @param aAttrs attributes to be returned
+	* @param aMediaArray returns the requested attributes for all items
+	*/
+		void GetAllCategoryItemsL(const TArray<TMPXAttribute>& aAttrs,
+			CMPXMediaArray& aMediaArray);
+
+		/**
+	* Update a category item.
+	* @param aId: The ID of the category to update
+	* @param aMedia: The media data
+	* @param aDriveId: The Drive Id the name (category) belongs
+	* @param aItemChangedMessages: if valid on return contains a updated message if the
+    *        category was updated
+	*/
+		void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
+
+	public:
+		/**
+	* Get albums count for a specified artist
+	* @param aId: The ID of the artist
+	*/
+	    TInt GetAlbumsCountForArtistL(TUint32 aArtistId);
+
+		/**
+	* Get songs count for a specified album and a specified artist
+	* @param aArtistId: The ID of the artist
+	* @param aAlbumId: The ID of the album
+	*/
+		TInt GetSongsCountInAlbumMatchingArtistL(TUint32 aArtistId, TUint32 aAlbumId);
+
+    private:
+        /**
+        * Updates the media with information from the table
+        * @param aRecord record containing the source fields
+        * @param aAttrs attributes to be returned
+        * @param aMedia returns the requested attributes
+        */
+        void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+         /**
+        * Generate searching criteria for album table from the given criteria
+        * @param aMedia media data
+        * @param aFields fields of Album table
+        * @param aValues values of each field of Album table
+        * @return a string containing the selection criteria. The ownership is passed to the caller.
+        */
+		void GenerateAlbumFieldsValuesL(const CMPXMedia& aMedia,
+			CDesCArray& aFields, CDesCArray& aValues);
+
+
+		TBool IsUnknownArtistL(TUint32 aId);
+
+		TUint32 ArtistForAlbumL(const TUint32 aId);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        */
+        CMPXDbAlbum(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory, MMPXDbAlbumObserver& aObserver);
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL();
+
+    public:
+
+        /**
+        * Column indexes in the category tables
+        */
+        enum TAlbumColumns
+            {
+            EAlbumUniqueId = KMPXTableDefaultIndex,
+            EAlbumName,
+            EAlbumSongCount,
+            EAlbumArtist,
+            EAlbumArt,
+            EAlbumArtistName,
+            EAlbumFieldCount
+            };
+
+    private:    // Data
+        MMPXDbAlbumObserver& iObserver;
+    };
+#endif // MPXDBALBUM_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbartist.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for Artist table.
+*
+*
+*/
+
+
+#ifndef MPXDBARTIST_H
+#define MPXDBARTIST_H
+
+// INCLUDES
+#include "mpxdbcategory.h"
+
+// CLASS DECLARATION
+class MMPXDbArtistObserver
+    {
+    public:
+		virtual TInt HandleGetAlbumsCountForArtistL(TUint32 aId) = 0;
+	};
+
+/**
+* Responsible for managing all music databases
+*
+* @lib MPXDbPlugin.lib
+*/
+
+class CMPXDbArtist :
+    public CMPXDbCategory
+    {
+    public:
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbArtist instance.
+        */
+        static CMPXDbArtist* NewL(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory, MMPXDbArtistObserver& aObserver);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbArtist instance on the cleanup stack.
+        */
+        static CMPXDbArtist* NewLC(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory, MMPXDbArtistObserver& aObserver);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbArtist();
+
+    public:
+        /**
+        * Add a category item. If the record already exists, its counter will
+        * be incremented.
+        * @param aName: This is the name to be entered into the row
+        * @param aDriveId: The Drive Id the name (category) belongs
+        * @param aNewRecord: indicates to the caller if a new record is created.
+        *        ETrue if a new row is created in the table; otherwise EFalse.
+        * @param aCaseSensitive indicates whether case sensitivity should be taken
+        *        into consideration when generating the unique row id
+        * @return The unique id of the row added.
+        */
+        TUint32 AddItemL(const TDesC& aName, const TDesC& aArt, TInt aDriveId, TBool& aNewRecord,
+            TBool aCaseSensitive = ETrue);
+
+        /**
+        * Gets the details for all category items.
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray returns the requested attributes for all items
+        */
+        void GetAllCategoryItemsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Update a category item.
+        * @param aId: The ID of the category to update
+        * @param aMedia: The media data
+        * @param aDriveId: The Drive Id the name (category) belongs
+        * @param aItemChangedMessages: if valid on return contains a updated message if the
+        *        category was updated
+        */
+        void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
+
+        /*
+        * Checks if the specified artist item is unknown
+        * @param aId identifies the artist item
+        * @return ETrue if it is unknown, EFalse otherwise
+        */
+        TBool IsUnknownArtistL(TUint32 aId);
+
+    private:
+
+        /**
+        * Updates the media with information from the table
+        * @param aRecord record containing the source fields
+        * @param aAttrs attributes to be returned
+        * @param aMedia returns the requested attributes
+        */
+        void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Generate searching criteria for artist table from the given criteria
+        * @param aMedia media data
+        * @param aFields fields of Artist table
+        * @param aValues values of each field of Artist table
+        * @return a string containing the selection criteria. The ownership is passed to the caller.
+        */
+        void GenerateArtistFieldsValuesL(const CMPXMedia& aMedia,
+            CDesCArray& aFields, CDesCArray& aValues);
+
+        /**
+        * Gets the Album counts for a Artist item
+        * @param aId identifies the Artist item
+        * @return value of the Album counts
+        */
+        TInt GetAlbumsCountL(TUint32 aId);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        */
+        CMPXDbArtist(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory, MMPXDbArtistObserver& aObserver);
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the category tables
+        */
+        enum TArtistColumns
+            {
+            EArtistUniqueId = KMPXTableDefaultIndex,
+            EArtistName,
+            EArtistSongCount,
+            EArtistArt,
+            EArtistFieldCount
+            };
+
+    private:    // Data
+        MMPXDbArtistObserver& iObserver;
+    };
+#endif // MPXDBARTIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbautoplaylist.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for the auto playlist functionality.
+*
+*/
+
+
+#ifndef MPXDBAUTOPLAYLIST_H
+#define MPXDBAUTOPLAYLIST_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxattribute.h>
+
+// CLASS FORWARDS
+class CMPXMedia;
+class CMPXMediaArray;
+class CMPXDbManager;
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing the music table
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbAutoPlaylist :
+    public CBase
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @return new CMPXDbAutoPlaylist instance.
+        */
+        static CMPXDbAutoPlaylist* NewL(CMPXDbManager& aDbManager, RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Two-phased constructor.
+        * @return new CMPXDbAutoPlaylist instance on the cleanup stack.
+        */
+        static CMPXDbAutoPlaylist* NewLC(CMPXDbManager& aDbManager, RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbAutoPlaylist();
+
+    public:
+
+        /**
+        * Get the playlist ID of an auto-playlist by type
+        * @param aPlaylistType type of the auto-playlist
+        * @return auto playlist ID
+        * @leave KErrNotSupported if invalid playlist type
+        */
+        TUint32 AutoPlaylistIdL(TMPXAutoPlaylistType aPlaylistType);
+
+        /**
+        * Get the name of an auto playlist
+        * @param aPlaylistId identifies the playlist
+        * @return the name of the playlist
+        * @leave KErrNotSupported if invalid playlist ID
+        */
+        TPtrC AutoPlaylistNameL(TUint32 aPlaylistId);
+
+        /**
+        * Checks whether the playlist ID corresponds to an auto playlist or not.
+        * @param aPlaylistId identifies the playlist
+        * @return Auto playlist type or EMPXNoAutoPlaylist if not found
+        */
+        TMPXAutoPlaylistType AutoPlaylistTypeL(TUint32 aPlaylistId);
+
+        /**
+        * Get information on a specified playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aAttrs the attributes to include for the playlists found.
+        * @param aMedia returns the playlist information
+        * @leave KErrNotSupported if invalid playlist ID
+        */
+        void GetPlaylistL(TUint32 aPlaylistId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Get information on all auto playlists
+        * @param aMediaArray returns information on all auto playlists
+        */
+        void GetAllPlaylistsL(CMPXMediaArray& aMediaArray);
+
+    private:
+
+        /**
+        * Get count and duration information of the auto-playlist
+        * @param aType the type of the auto-playlist
+        * @param aCount reference to count to be returned
+        * @param aDuration reference to duration to be returned
+        */
+        void GetPlaylistDetailsL(TMPXAutoPlaylistType aType, TInt& aCount, TInt& aDuration);
+
+        /**
+        * Update the media with information about the auto-playlist
+        * @param aPlaylistId Id of the auto-playlist
+        * @param aAttrs the attributes to include for the playlist matching the
+        *        selection criteria
+        * @param aMedia the playlist details object
+        */
+        void UpdateMediaL(TUint32 aPlaylistId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+    private:
+
+        /**
+        * C++ constructor
+        */
+        CMPXDbAutoPlaylist(CMPXDbManager& aDbManager);
+
+        /**
+        * Second phase constructor
+        */
+        void ConstructL(RFs& aFs, CMPXResource& aResource);
+
+    private:    // Data
+        TUint32             iRecentlyPlayedPlaylistId; // recently played playlist ID
+        TUint32             iMostPlayedPlaylistId;     // most played playlist ID
+        TUint32             iRecentlyAddedPlaylistId;  // recently added playlist ID
+
+        // owned
+        HBufC*              iRecentlyPlayedPlaylist;   // recently played playlist name
+        HBufC*              iMostPlayedPlaylist;       // most played playlist name
+        HBufC*              iRecentlyAddedPlaylist;    // recently added playlist name
+        CMPXDbManager&      iDbManager;
+    };
+
+#endif // MPXDBAUTOPLAYLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbauxiliary.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for interacting with the Auxiliary
+*                table.
+*
+*/
+
+
+#ifndef MPXDBAUXILIARY_H
+#define MPXDBAUXILIARY_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing the playlist tables
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbAuxiliary :
+    public CMPXDbTable
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbManager instance.
+        */
+        static CMPXDbAuxiliary* NewL(CMPXDbManager& aDbManager);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbManager instance on the cleanup stack.
+        */
+        static CMPXDbAuxiliary* NewLC(CMPXDbManager& aDbManager);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbAuxiliary();
+
+    public:
+
+        /**
+        * Sets the last refreshed time in the auxiliary table.
+        * @param aTime the last refreshed time value
+        */
+        void SetLastRefreshedTimeL(TTime aTime);
+
+        /**
+        * Gets the last refreshed time from the auxiliary table.
+        * @return last refreshed time value
+        */
+        TTime LastRefreshedTimeL();
+
+        /**
+        * Sets the db corrupted flag in the auxiliary table.
+        * @param aCorrupted db corrupted flag value
+        */
+        void SetDBCorruptedL(TBool aCorrupted);
+
+        /**
+        * Gets the db corrupted flag value from the auxiliary table.
+        * @return db corrupted flag value
+        */
+        TBool DBCorruptedL();
+
+        /**
+        * Sets the save deleted record count value.
+        * @param aDrive drive identifier
+        * @param aValue new field value
+        *
+        */
+        void SetSaveDeletedRecordCountL(TInt aDrive,TUint32 aValue);
+
+        /**
+        * Gets the save deleted record count field value.
+        * @return field value
+        */
+        TUint32 SaveDeletedRecordCountL();
+
+        /**
+         * Gets the save deleted record count field value.
+         * @param aDrive drive identifier
+         * @return field value
+         */
+         TUint32 SaveDeletedRecordCountL(TInt aDrive);
+
+        /**
+        * Checks if all databases have been refreshed.
+        * @return EFalse if at least one database has not been refreshed.
+        */
+        TBool IsRefreshedL();
+
+        /**
+        * Get the auxilary id for a drive
+        * @param aDrive drive to get the volume id
+        * @return TInt id for the aux database
+        */
+        TInt IdL( TInt aDrive );
+
+        /**
+        * Set the auxilary id for a drive
+        * @param aDrive,
+        * @param aId
+        */
+        void SetIdL( TInt aDrive, TInt aId );
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor
+        * @param aDbManager database manager to use for database interactions
+        */
+        CMPXDbAuxiliary(CMPXDbManager& aDbManager);
+
+        /**
+        * Safely construct things that can leave
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the auxiliary table
+        */
+        enum TAuxiliaryColumns
+            {
+            EAuxiliaryId = KMPXTableDefaultIndex,
+            EAuxiliaryVersion,
+            EAuxiliaryTimeRefreshed,
+            EAuxiliaryTimeSynced,
+            EAuxiliaryCorrupt,
+            EAuxiliarySavedDeletedRecordCount
+            };
+
+    };
+
+#endif // MPXDBAUXILIARY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbcategory.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,268 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for all category tables (Artist,
+*                Album, Genre, Composer).
+*
+*
+*/
+
+
+#ifndef MPXDBCATEGORY_H
+#define MPXDBCATEGORY_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+#include "mpxmediageneraldefs.h"
+#include "mpxmessage2.h"
+
+// CLASS FORWARDS
+class CMPXMedia;
+class CMPXMediaArray;
+class RSqlStatement;
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing all music databases
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbCategory :
+    public CMPXDbTable
+    {
+    protected:
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbCategory();
+
+
+    public:
+
+        /**
+        * Add a category item. If the record already exists, its counter will
+        * be incremented.
+        * @param aName: This is the name to be entered into the row
+        * @param aDriveId: The Drive Id the name (category) belongs
+        * @param aNewRecord: indicates to the caller if a new record is created.
+        *        ETrue if a new row is created in the table; otherwise EFalse.
+        * @param aCaseSensitive indicates whether case sensitivity should be taken
+        *        into consideration when generating the unique row id
+        * @return The unique id of the row added.
+        */
+        TUint32 AddItemL(const TDesC& aName, TInt aDriveId, TBool& aNewRecord,
+            TBool aCaseSensitive = ETrue);
+
+        /**
+        * Get the name field for a given ID.
+        * @param aId identifies the category item
+        * @return name that matches aId. Ownership is abandoned.
+        */
+        HBufC* GetNameL(TUint32 aId);
+
+        /**
+        * Gets the total number of items in the category table.
+        * @return number of items
+        */
+        TInt CountL();
+
+        /**
+        * Find record(s) matching the criteria
+        * @param aCriteria, selection criteria
+        * @param aAttrs, attributes for the matching record(s)
+        * @param aMediaArray returns the matching record(s)
+        */
+        void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Decrement the number of songs for the item. If the count gets to 0, remove
+        * the item.
+        * @param aId: The ID of the category to delete.
+        * @param aDriveId: The drive Id the name (category) belongs to. Songs on different
+        *                  drives may belong to the same album or artist; consequently, one
+        *                  row for each artist/album id and drive ID pair will exist in the
+        *                  lookup table with a count existing for each row that tracks the
+        *                  number number of songs on that drive with that album/artist.
+        * @param aItemChangedMessages if valid on return contains a deleted message if the
+        *                  category was deleted
+        * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete,
+        *        EFalse otherwise
+        */
+        void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
+            CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
+
+        /**
+        * Deletes a category.
+        * @param aId identifies the category
+        * @param aDriveId category drive
+        */
+        void DeleteCategoryL(TUint32 aId, TInt aDriveId);
+
+        /**
+        * Gets the details for multiple category items.
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray inout parameter, on input contains the IDs of the
+        *       category items to be returned, on exit contains the requested
+        *       attributes for these items
+        */
+        void GetCategoryItemsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Gets the details for all category items.
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray returns the requested attributes for all items
+        */
+        void GetAllCategoryItemsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Gets details for one category item.
+        * @param aId identifies the category item
+        * @param aAttrs attributes to be returned
+        * @param aMedia returns the requested attributes for te item
+        * @leave KErrCorrupt if there are multiple items with the same ID
+        *        KErrNotFound if there is no item with the specified ID
+        */
+        void GetCategoryItemL(TUint32 aId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Gets details for the category items under a parent category item.
+        * This applies to albums for a given artist. The method panics if the
+        * category or parent category are invalid.
+        * @param aParentCategory identifies the parent category
+        * @param aParentId identifies the parent item
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray returns the requested attributes for all items
+        */
+        void GetSubCategoryItemsL(TMPXGeneralCategory aParentCategory, TUint32 aParentId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Checks if the specified category item exists.
+        * @param aDriveId drive to check or KDbManagerAllDrives
+        * @param aId identifies the category item
+        * @return ETrue if it exists, EFalse otherwise
+        */
+        TBool CategoryItemExistsL(TInt aDriveId, TUint32 aId);
+
+        /**
+        * Gets the CountSongs field for a category item
+        * @param aDriveId drive to check or KDbManagerAllDrives
+        * @param aId identifies the category item
+        * @return value of the CountSongs field.
+        */
+        TInt GetSongsCountL(TInt aDriveId, TUint32 aId);
+
+		/**
+	    * Update a category item.
+	    * @param aId: The ID of the category to update
+	    * @param aMedia: The media data
+	    * @param aDriveId: The Drive Id the name (category) belongs
+	    * @param aItemChangedMessages: if valid on return contains a updated message if the
+        * category was updated
+        */
+		void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
+
+    protected:
+
+        /**
+        * Updates the media with information from the table
+        * @param aRecord record containing the source fields
+        * @param aAttrs attributes to be returned
+        * @param aMedia returns the requested attributes
+        */
+        void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Returns the category record for a given ID
+        * @param aId identifies the category item
+        * @return rowset
+        */
+        RSqlStatement GetCategoryRecordL(TUint32 aId);
+
+        /**
+        * Replaces the table placeholder in the string parameter with the
+        * category table name.
+        * @param aQuery raw query string
+        * @return processed query string, ownership is transferred.
+        */
+        HBufC* PreProcessStringLC(const TDesC& aQuery);
+
+        /**
+        * Processes a recordset by constructing media instances and adding them
+        * to the specified array.
+        * @param aAttrs attributes to be returned
+        * @param aRecordset recordset to be processed
+        * @param aMediaArray returns the media instances
+        */
+        void ProcessRecordsetL(const TArray<TMPXAttribute>& aAttrs,
+            RSqlStatement& aRecordset, CMPXMediaArray& aMediaArray);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    protected:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        */
+        CMPXDbCategory(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory);
+
+        /**
+        * Second phase constructor.
+        */
+        void BaseConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the category tables
+        */
+        enum TCategoryColumns
+            {
+            ECategoryUniqueId = KMPXTableDefaultIndex,
+            ECategoryName,
+            ECategorySongCount
+            };
+
+    protected:
+
+        HBufC* iTableName;              // owned
+        TMPXGeneralCategory iCategory;
+
+    };
+
+#endif // MPXDBCATEGORY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbcomposer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for all category tables (Artist,
+*                Album, Genre, Composer).
+*
+*
+*/
+
+
+#ifndef MPXDBCOMPOSER_H
+#define MPXDBCOMPOSER_H
+
+// INCLUDES
+#include "mpxdbcategory.h"
+
+// CLASS FORWARDS
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing all music databases
+*
+* @lib MPXDbPlugin.lib
+*/
+
+class CMPXDbComposer :
+    public CMPXDbCategory
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance.
+        */
+        static CMPXDbComposer* NewL(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance on the cleanup stack.
+        */
+        static CMPXDbComposer* NewLC(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbComposer();
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        */
+        CMPXDbComposer(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory);
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the category tables
+        */
+        enum TComposerColumns
+            {
+            EComposerUniqueId = KMPXTableDefaultIndex,
+            EComposerName,
+            EComposerSongCount,
+            EAlbumFieldCount
+            };
+
+    private:    // Data
+
+    };
+#endif // MPXDBCOMPOSER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbgenre.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for all category tables (Artist,
+*                Album, Genre, Composer).
+*
+*
+*/
+
+
+#ifndef MPXDBGENRE_H
+#define MPXDBGENRE_H
+
+// INCLUDES
+#include "mpxdbcategory.h"
+
+// CLASS FORWARDS
+class CMPXMedia;
+class CMPXMediaArray;
+class RSqlStatement;
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing all music databases
+*
+* @lib MPXDbPlugin.lib
+*/
+
+class CMPXDbGenre :
+    public CMPXDbCategory
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance.
+        */
+        static CMPXDbGenre* NewL(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance on the cleanup stack.
+        */
+        static CMPXDbGenre* NewLC(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbGenre();
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        */
+        CMPXDbGenre(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory);
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the category tables
+        */
+        enum TGenreColumns
+            {
+            EGenreUniqueId = KMPXTableDefaultIndex,
+            EGenreName,
+            EGenreSongCount,
+            EGenreFieldCount
+            };
+
+    private:    // Data
+
+    };
+#endif // MPXDBGENRE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbhandler.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1059 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class provides the functions to manipulate the music collection
+*                database.
+*
+*/
+
+
+#ifndef MPXDBHANDLER_H
+#define MPXDBHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <f32file.h>
+
+#include <mpxattribute.h>
+#include <mpxmessage2.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionmessagedefs.h>
+
+#include "mpxcollectiondbstd.h"
+#include "mpxcollectiondb.hrh"
+#include "mpxdbactivetask.h"
+#include "mpxdbmusic.h"     // for MMPXDbMusicObserver
+#include "mpxdbartist.h"    // for MMPXDbArtistObserver
+#include "mpxdbalbum.h"     // for MMPXDbAlbumObserver
+#include "mpxdbplaylist.h"	// for MMPXDbPlaylistObserver
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXMediaArray;
+class CMPXCollectionDbManager;
+class CMPXDbPlaylist;
+class CMPXDbCategory;
+class CMPXDbAuxiliary;
+class CMPXDbAutoPlaylist;
+class CMPXDbArtist;
+class CMPXDbAlbum;
+class CMPXDbGenre;
+class CMPXDbComposer;
+
+// CLASS DECLARATION
+
+/**
+*  Music collection database handler
+*
+*  @lib MPXDbPlugin.lib
+*/
+class CMPXDbHandler :
+    public CBase,
+    public MMPXDbMusicObserver,
+    public MMPXDbArtistObserver,
+    public MMPXDbAlbumObserver,
+	public MMPXDbPlaylistObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return a new CMPXDbHandler instance
+        */
+        static CMPXDbHandler* NewL(RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return a new CMPXDbHandler instance
+        */
+        static CMPXDbHandler* NewLC(RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPXDbHandler();
+
+    public:
+
+        /**
+        * Add a song to the music collection database
+        * @param aMedia media object which contains file path,
+        *           artist, composer, name(title), track, etc...
+        * @param aMessageArray change event message to notify client of the changes
+        * @return TUint32 id of the item added
+        */
+        TUint32 AddSongL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL);
+
+        /**
+        * Add a song to the music collection without a database transaction; it
+        * is assumed the transaction is created at a higher leve
+        * @param aMedia media object which contains file path,
+        *           artist, composer, name(title), track, etc...
+        * @param aMessageArray change event message to notify client of the changes
+        * @return TUint32 id of the item added
+        */
+        TUint32 AddSongWithNoTransactionL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL);
+
+        /**
+        * Add a playlist to the collection
+        * @param aMedia playlist media object with title and URI of the playlist.
+        * @return playlist Id of the playlist created
+        */
+        TUint32 AddPlaylistL(const CMPXMedia& aMedia);
+
+        /**
+        * Add songs to the specified playlist
+        * @param aMedia playlist media object with playlist Id.
+        * @return playlist Id of the playlist
+        */
+        TUint32 AddSongToPlaylistL(const CMPXMedia& aMedia);
+
+        /**
+        * Update song info for a song in the music collection database
+        * @param aMedia songDetails object  which contains file path,
+        *           artist, composer, name(title), track, etc...
+        * @param aItemChangedMessages a list of change events as a result of the
+        *           song update
+        * @return ETrue if UI visible change else EFalse
+        */
+        CMPXDbActiveTask::TChangeVisibility UpdateSongL(const CMPXMedia& aMedia,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Update playlist info in the music collection database
+        * @param aMedia playlist details object which contains file path,
+        *           timestamps etc.
+        * @param aMessageArray change event messages for the playlist update
+        */
+        void UpdatePlaylistL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray);
+
+        /**
+        * Update the songs for a playlist in the music collection database
+        * @param aMedia playlist details object which contains the playlist songs.
+        * @param aMessage change event message for the playlist update
+        */
+        void UpdatePlaylistSongsL(const CMPXMedia& aMedia, CMPXMessage& aMessage);
+
+        /**
+        * Reorder the specified song in the specified playlist
+        * @param aPlaylistId id of the playlist which contains the song to be reordered
+        * @param aSongId id of the song to be reordered
+        * @param aOriginalOrdinal the original ordinal of the song within the playlist.
+        *        Ordinal starts from 0.
+        * @param aNewOrdinal the new ordinal of the song within the playlist. Ordinal
+        *        starts from 0.
+        * @param aMessage change event message for the playlist update
+        */
+        void ReorderPlaylistL(const TMPXItemId& aPlaylistId, const TMPXItemId& aSongId,
+            TUint aOriginalOrdinal, TUint aNewOrdinal, CMPXMessage& aMessage);
+
+        /**
+        * Remove all songs within music collection database
+        */
+        void RemoveEntireCollectionL();
+
+        /**
+        * Remove a song from the music collection database
+        * @param aSongId ID of the song to be removed
+        * @param aUriArray a descriptor array to contain the URI of the deleted file
+        * @param aItemChangedMessages a list of change events as a result of the song removal
+        * @param aDeleteRecord indicates whether the client has explictly requested
+        *                to delete the records from the database. If ETrue, records
+        *                associated with the media will be deleted from the database;
+        *                if EFalse, whether to mark the records as deleted or to delete
+        *                the records will be based on other deciding factors.
+        */
+        void RemoveSongL(TUint32 aSongId, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord = EFalse);
+
+        /**
+        * Removes a category of songs from the music collection, and its
+        * corresponding category in the lookup table
+        * @param aCategory the category to remove
+        * @param aCategoryId ID of the category to remove
+        * @param aUriArray a descriptor array to contain the URI of the deleted songs
+        * @param aItemChangedMessages a list of change events as a result of the song removal
+        */
+        void RemoveSongsMatchingCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+            CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Removes songs from the music collection belonging to the
+        * specified artist and album as well as the actual category
+        * in the lookup table
+        * @param aArtistId id of the artist
+        * @param aAlbumId id of the album
+        * @param aUriArray a descriptor array to contain the URI of the deleted file(s)
+        * @param aItemChangedMessages a list of change events as a result of the song removal
+        */
+        void RemoveSongsMatchingArtistAndAlbumL(TUint32 aArtistId, TUint32 aAlbumId,
+            CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove all playlists from the collection
+        */
+        void RemoveAllPlaylistsL();
+
+        /**
+        * Remove a playlist This will remove all the songs from the playlist
+        * @param aPlaylistId ID of the playlist to remove
+        * @param aUriArray a descriptor array to contain the URI of the deleted file
+        * @param aItemChangedMessages a list of change events as a result of the
+        *        playlist removal
+        */
+        void RemovePlaylistL(TUint32 aPlaylistId, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove a song from the specified playlist.
+        * @param aPlaylistId ID of the playlist to remove the song from
+        * @param aSongId Id of the song in the playlist to be removed
+        * @param aOrdinal the ordinal of the song in the playlist. This uniquely
+        *        identifies which song in the playlist to be removed; whereas song
+        *        Id doesn't because duplicate tracks in the playlist are allowed.
+        *        The position is relative to zero, i.e. zero implies that the song
+        *        at the beginning of the playlist is to be removed.
+        * @param aItemChangedMessages a list of change events as a result of the
+        *        song removal
+        */
+        void RemoveSongFromPlaylistL(TUint32 aPlaylist, const TMPXItemId& aSongId,
+            TInt aOrdinal, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Delete records in all databases which have been marked as deleted
+        */
+        void CleanupDeletedRecordsL();
+
+        /**
+        * Get all songs from the music collection databasee
+        * @param aMediaArray Array to place all the songs' required info
+        * @param aAttrs required attributes
+        */
+        void GetAllSongsL(CMPXMediaArray* aMediaArray,
+            const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Get a limited number of songs from the music collection databasee
+        * @param aMediaArray Array to place all the songs' required info
+        * @param aAttrs required attributes
+        * @param aLimit maximum number of songs to retrieve
+        */
+        void GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs,
+                                 CMPXMediaArray& aMediaArray, TInt aLimit);
+
+        /**
+        * Get songs from the music collection database incrementally
+        * @param aMediaArray Array to place all the songs' required info
+        * @param aAttrs required attributes
+        * @param aTitle title to use as a key
+        * @param aNumOfSongs number of songs to read
+        * @param aAsc ascending or descending data read
+        */
+        void GetSongsInBlockL(CMPXMediaArray* aMediaArray,
+            const TArray<TMPXAttribute>& aAttrs,
+            TPtrC aTitle,
+            TUint aNumOfSongs,
+            TBool aAsc);
+
+
+        /**
+        * Get songs from the music collection starting at a particular offset
+        * ONLY use this as the first query to locate particular item. Should use
+        * GetSongsInBlockL() to fetch in blocks with a particular index
+        * @param aMediaArray Array to store the results
+        * @param aAttrs attributes to fetch
+        * @param aOffset offset to start reading
+        * @param aCount number of items to get
+        */
+        void GetSongsAtOffsetL( CMPXMediaArray* aMediaArray,
+                                const TArray<TMPXAttribute>& aAttrs,
+                                TInt aOffset,
+                                TInt aCount );
+
+        /**
+        * Get all the songs that match the given artist ID
+        * @param aArtistId ID of the artist to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching songs' required
+        *        attributes
+        */
+        void GetSongsMatchingArtistL(TUint aArtistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the songs that match the given album ID
+        * @param aAlbumId ID of the album to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching songs' required info
+        */
+        void GetSongsMatchingAlbumL(TUint aAlbumId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the songs that match the given artist and album ID
+        * @param aArtistId ID of the artist to match
+        * @param aAlbumId ID of the album to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching songs' required info
+        */
+        void GetSongsMatchingArtistAndAlbumL(TUint aArtistId, TUint aAlbumId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the songs that match the given genre ID
+        * @param aGenreId ID of the genre to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching songs' required info
+        */
+        void GetSongsMatchingGenreL(TUint aGenreId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the songs that match the given composer ID
+        * @param aComposerId ID of the composer to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching songs' required info
+        */
+        void GetSongsMatchingComposerL(TUint aComposerId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the songs that match the given playlist ID
+        * @param aPlaylistId ID of the playlist to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the required song info
+        */
+        void GetSongsMatchingPlaylistL(TUint aPlaylistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get the song info that matches the given song ID from Songs table.
+        * @param aSongId ID of the song
+        * @param aAttrs required attributes
+        * @param aMedia returns the song info
+        */
+        void GetSongL(TUint32 aSongId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Appends the media object with the song information to the specified array.
+        * @param aSongId ID of the song
+        * @param aAttrs required attributes
+        * @param aMediaArray on return the song info is appended to this array
+        */
+        void GetSongL(TUint32 aSongId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the song info that matches the given song ID from Songs table.
+        * The song info will first be populated from Playlist table and
+        * if the Songs table exists in the drive where the song is located,
+        * song info will be overwritten from Songs table. This enables the
+        * support for displaying song title in a playlist when the drive
+        * where the song is located is not present.
+        * @aSongId ID of the song
+        * @aPlaylistId ID of the playlist the song belongs to.
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the required song info
+        * @leave KErrNotFound if the song could not be found in the
+        *       PlaylistSongs table
+        */
+        void GetPlaylistSongL(TUint32 aSongId, TUint32 aPlaylistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia);
+
+        /**
+        * Appends the a media object with the song information to the specified array.
+        * @param aSongId ID of the song
+        * @param aPlaylistId ID of the playlist
+        * @param aAttrs required attributes
+        * @param aMediaArray on return the song info is appended to this array
+        */
+        void GetPlaylistSongL(TUint32 aSongId, TUint32 aPlaylistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the song ID of the song that matches the given URI
+        * @param aUri URI to match
+        * @return song ID
+        */
+        TUint32 GetSongIdMatchingUriL(const TDesC& aUri);
+
+        /**
+        * Get all the artist names from the music collection database sorted by name.
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the artists' required info
+        */
+        void GetAllArtistsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the album names from the music collection database sorted by name.
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the albums' required info
+        */
+        void GetAllAlbumsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the albums that match the given artist ID sorted by name.
+        * @param aArtistId ID of the artist to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching albums' required info
+        */
+        void GetAlbumsMatchingArtistL(TUint aArtistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get all the genre names from the collection
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the genres' required info
+        */
+        void GetAllGenresL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the composer names from the collection
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the composers' required info
+        */
+        void GetAllComposersL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get the playlist ID of the playlist that matches the given URI
+        * @param aUri URI to match
+        * @return playlist ID to return
+        */
+        TUint32 GetPlaylistIdMatchingUriL(const TDesC& aUri);
+
+        /**
+        * Checks if the specified ID corresponds to an auto playlist.
+        * @param aPlaylistId ID to be checked
+        * @return ETrue if it corresponds to an auto playlist, EFalse otherwise
+        */
+        TBool IsAutoPlaylistL(TUint32 aPlaylistId);
+
+        /**
+        * Get all the playlist names from the collection
+        * @param aMediaArray Array to place all the playlists' required info
+        * @param aAttrs required attributes
+        */
+        void GetAllPlaylistsL(CMPXMediaArray* aMediaArray,
+            const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Get all the system playlist names from the collection
+        * @param aMediaArray Array to place all the system playlists' required info
+        */
+        void GetAllSystemPlaylistNamesL(CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get title from the Id
+        * @param Id to search for
+        * @return name matching the ID
+        */
+        HBufC* GetNameMatchingIdL(const TUint32 aId) const;
+
+        /**
+        * Get URI from the Id
+        * @param Id to search for
+        * @return URI matching the ID
+        * @leave KErrNotSupported if the ID refers to an invalid category
+        */
+        HBufC* GetUriMatchingIdL(const TUint32 aId) const;
+
+        /**
+        * Retrieve category record with information as specified in the given
+        * attributes
+        * @param aCategoryId Id of the record to be retrieved
+        * @param aCategory category type
+        * @param aAttrs information to return about the specified category
+        * @param aMedia returns the category information
+        */
+        void GetCategoryL(const TUint32 aCategoryId, TMPXGeneralCategory aCategory,
+                const TArray<TMPXAttribute>& aAttrs, CMPXMedia* aMedia);
+
+        /**
+        * Get the duration for all songs
+        * @return duration
+        */
+        TInt GetAllSongsDurationL();
+
+        /**
+        * Get the duration for all songs for a specified artist
+        * @param aArtistId identifies the artist
+        * @return duration
+        */
+        TInt GetArtistDurationL(TInt aArtistId);
+
+        /**
+        * Get the duration for all songs in a specified album
+        * @param aAlbumId identifies the album
+        * @return duration
+        */
+        TInt GetAlbumDurationL(TInt aAlbumId);
+
+        /**
+        * Get the duration for all songs for a specified artist and album
+        * @param aArtistId identifies the artist
+        * @param aAlbumId identifies the album
+        * @return duration
+        */
+        TInt GetArtistAlbumDurationL(TInt aArtistId, TInt aAlbumId);
+
+        /**
+        * Get the duration for all songs for a specified composer
+        * @param aComposerId identifies the composer
+        * @return duration
+        */
+        TInt GetComposerDurationL(TInt aComposerId);
+
+        /**
+        * Get the duration for all songs for a specified genre
+        * @param aGenreId identifies the genre
+        * @return duration
+        */
+        TInt GetGenreDurationL(TInt aGenreId);
+
+        /**
+        * Get the duration for all songs in a user playlist
+        * @param aPlaylistId identifies the playlist
+        * @return duration
+        */
+        TInt GetUserPlaylistDurationL(TInt aPlaylistId);
+
+        /**
+        * Get the duration for all songs for a specified playlist
+        * @param aPlaylistId identifies the playlist
+        * @return duration
+        */
+        TInt GetPlaylistDurationL(TInt aPlaylistId);
+
+        /**
+        * Fetch the total number of items in the specified category
+        * @param aCategory category to be queried
+        * @return number of items.
+        */
+        TInt NumberOfItemsL(TMPXGeneralCategory aCategory);
+
+        /**
+        * Find media(s) from the collection
+        * @param aCriteria selection criteria
+        * @param aAttrs attributes for the matching media
+        * @return matching media. Ownership is transferred.
+        * @leave KErrArgument if the criteria do not include a type
+        *           or category
+        */
+        CMPXMedia* FindAllLC(const CMPXMedia& aCriteria,
+            const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Set the last refreshed time
+        * @param aTime the updated last refresh time
+        */
+        void SetLastRefreshedTimeL(TTime aTime);
+
+        /**
+        * Get the last refreshed time
+        * @return last refreshed time
+        */
+        TTime GetLastRefreshedTimeL();
+
+        /**
+        * Set the db corrupted bit in the aux table for all drives
+        * @param aCorrupted flag indicating whether or not the db is corrupted
+        */
+        void SetDBCorruptedL(TBool aCorrupted);
+
+        /**
+        * Get the db corrupted bit in the aux table ( or of all drives )
+        * @return ETrue if database is corrupted, else EFalse
+        */
+        TBool IsDBCorruptedL();
+
+        /**
+        * Checks if the database has been created
+        * @return ETrue if file has been created
+        */
+        TBool DatabaseCreated();
+
+        /**
+        * Close and re-open the music collection database stored on the
+        * specified drive
+        * @param aDrive drive containing the music collection database to re-open
+        */
+        void OpenDatabaseL(TInt aDrive);
+
+        /**
+        * Close a database for a particular drive
+        * @param aDrive drive to close
+        */
+        void CloseDatabaseL(TInt aDrive);
+
+        /**
+        * Recreate all databases.
+        */
+        void ReCreateDatabasesL();
+
+        /**
+        * Starts a refresh operation.
+        */
+        void RefreshStartL();
+
+        /**
+        * Ends a refresh operation.
+        */
+        void RefreshEndL();
+
+        /**
+        * Notification of mtp start
+        */
+        void MtpStartL();
+
+        /**
+        * Notification of mtp end
+        */
+        void MtpEndL();
+        /**
+        * Get total record count for music in db
+        * @param aDrive, specifies drive number for db selection
+        * @return count
+        */
+        TUint GetMusicCountL(TInt aDrive);
+
+        /**
+        * Get total record count for playlists in db
+        * @param aDrive, specifies drive number for db selection
+        * @return count
+        */
+        TUint GetPlaylistCountL(TInt aDrive);
+
+        /**
+        * Get total record count for music and playlists in db
+        * @param aDrive, specifies drive number for db selection
+        * @return count
+        */
+        TUint GetTotalCountL(TInt aDrive);
+
+        /**
+        * Get URIs for a given amount of songs
+        * @param aDrive, specifies drive number for db selection
+        * @param aFromID, specifies unique ID of last record retrieved
+        * @param aRecords, specifies the number of records to get
+        * @param aUriArr, will contain all URIs on return
+        * @param aLastID, will contain unique ID of a last record in the array
+        */
+        void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                               CDesCArray& aUriArr, TInt& aLastID);
+
+        /**
+        * Get URIs for a given amount of playlists
+        * @param aDrive, specifies drive number for db selection
+        * @param aFromID, specifies unique ID of last record retrieved
+        * @param aRecords, specifies the number of records to get
+        * @param aUriArr, will contain all URIs on return
+        * @param aLastID, will contain unique ID of a last record in the array
+        */
+        void GetPlaylistUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                  CDesCArray& aUriArr, TInt& aLastID);
+
+        /**
+        * Starts a transaction on all open databases.
+        */
+        void BeginTransactionL();
+
+        /**
+        * Commits or rolls back a transaction.
+        * @param aError if error then rolls back the transaction and leaves
+        *               if KErrNone it commits the transaction
+        */
+        void EndTransactionL(TInt aError);
+
+        /**
+        * Checks if the database is currently in a transaction.
+        *
+        * @return ETrue if database is currently in a transaction, EFalse otherwise
+        */
+        TBool InTransaction();
+
+        /**
+         * Notifies the handler that the collection will be closed.
+         * It is called before closing the collection.
+         */
+        void PreCloseCollectionL();
+
+        /**
+         * Notifies the handler that the collection was closed.
+         */
+         void CollectionClosed();
+
+         /**
+         * Notifies the handler that the collection was opened.
+         */
+         void CollectionOpenedL();
+
+         /**
+          * Checks if the spefified drive is a remove drive
+          */
+         TBool IsRemoteDrive(TDriveNumber aDrive);
+
+         /**
+          * Checks if there is a drive that has a low disk space
+          * @leave KErrDiskFull if the space on one of the drives is below the
+          *         critical level
+          */
+         void CheckDiskSpaceOnDrivesL();
+
+    private:
+
+        /**
+        * Add a song to the music collection database
+        * @param aMedia: media object which contains file path,
+        *           artist, composer, name(title), track, etc...
+        * @param aMessage change event message to notify client of the changes
+        * @return Id of the song added
+        * @leave KErrArgument if the media doe snot include the song URI
+        */
+        TUint32 DoAddSongL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray);
+
+        /**
+        * Add a playlist to the collection
+        * @param aMedia playlist media object with title and URI of the playlist.
+        * @return ID of the playlist created
+        */
+        TUint32 DoAddPlaylistL(const CMPXMedia& aMedia);
+
+        /**
+        * Add songs to the specified playlist
+        * @param aMedia playlist media object with playlist Id.
+        * @return playlist Id of the playlist
+        */
+        TUint32 DoAddSongToPlaylistL(const CMPXMedia& aMedia);
+
+        /**
+        * Update song info for a song in the music collection database
+        * @param aMedia songDetails object  which contains file path,
+        *           artist, composer, name(title), track, etc...
+        * @param aItemChangedMessages a list of items changed
+        * @return ETrue if UI visible change
+        * @leave KErrNotSupported if the song ID could not be constructed
+        */
+        CMPXDbActiveTask::TChangeVisibility DoUpdateSongL(const CMPXMedia& aMedia,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Update playlist info in the music collection database
+        * @param aMedia playlist details object which contains file path,
+        *           timestamps etc...
+        * @param aMessage change event message for the playlist update
+        */
+        void DoUpdatePlaylistL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray);
+
+        /**
+        * Replace all songs for a playlist. This method is called when harvester
+        * scans an updated playlist. This will also be called if MTP wants to
+        * replace the contents of an existing playlist. The implementation deleted the
+        * existing songs first and then inserts the new ones.
+        * @param aMedia playlist and songs details object which contains file path,
+        *           timestamps etc...
+        * @param aMessage change event message for the playlist update
+        */
+        void DoUpdatePlaylistSongsL(const CMPXMedia& aMedia, CMPXMessage& aMessage);
+
+        /**
+        * Reorder the specified song in the specified playlist
+        * @param aPlaylistId id of the playlist which contains the song to be reordered
+        * @param aSongId id of the song to be reordered
+        * @param aOriginalOrdinal the original ordinal of the song within the playlist.
+        *        Ordinal starts from 0.
+        * @param aNewOrdinal the new ordinal of the song within the playlist. Ordinal
+        *        starts from 0.
+        * @param aMessage change event message for the playlist update
+        */
+        void DoReorderPlaylistL(const TMPXItemId& aPlaylistId, const TMPXItemId& aSongId,
+            TUint aOriginalOrdinal, TUint aNewOrdinal, CMPXMessage& aMessage);
+
+        /**
+        * Deletes a song. In addition to deleting the song record from the music
+        * table takes care of updating the category and playlist tables.
+        * @param aSongId song to be deleted
+        * @param aUriArray on return contains the URIs of the song deleted.
+        * @param aItemChangedMessages on return contains changed messages for all
+        *        affected items
+        * @param aDeleteRecord ETrue if the record is to be deleted, EFalse if it is
+        *        to be marked as deleted.
+        */
+        void DoRemoveSongL(TUint32 aSongId, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord);
+
+        /**
+         * Deletes the song  from the playlist tables
+         * @param aSongId song to be deleted
+         * @param aItemChangedMessages on return contains changed messages for all
+         *        affected items
+         */
+        void DoRemoveSongFromPlaylistL(TUint32 aSongId,CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Deletes all the songs for a given category. The implementation uses
+        * DoRemoveSongL for the business logic.
+        * @param aCategory category type (artist/album/genre/composer)
+        * @param aCategoryId identifies the category item
+        * @param aUriArray on return contains the URIs of the songs deleted.
+        * @param aItemChangedMessages on return contains changed messages for all
+        *        affected items
+        * @leave KErrNotSupported if invalid category
+        */
+        void DoRemoveSongsMatchingCategoryL(TMPXGeneralCategory aCategory,
+            TUint32 aCategoryId, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Deletes all the songs for a given artist and album.
+        * The implementation uses DoRemoveSongL for the business logic.
+        * @param aArtistId identifies the artist
+        * @param aAlbumId identifies the album
+        * @param aUriArray on return contains the URIs of the songs deleted.
+        * @param aItemChangedMessages on return contains changed messages for all affected items
+        */
+        void DoRemoveSongsMatchingArtistAndAlbumL(TUint32 aArtistId, TUint32 aAlbumId,
+            CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Deletes all the playlists in all databases. Note that the songs are not affected.
+        */
+        void DoRemoveAllPlaylistsL();
+
+        /**
+        * Deletes a specified playlist.
+        * @param aPlaylistId the playlist to be deleted.
+        * @param aUriArray on return contains the URIs of the items deleted.
+        * @param aItemChangedMessages on return contains changed messages for all
+        *        affected items
+        */
+        void DoRemovePlaylistL(TUint32 aPlaylistId, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Deletes a song from a playlist.
+        * @param aPlaylistId identifies the playlist.
+        * @param aSongId song to be deleted.
+        * @param aOrdinal song ordinal in case there are multiple instances of the same
+        *        song in the playlist.
+        * @param aItemChangedMessages on return contains changed messages for all
+        *        affected items
+        */
+        void DoRemoveSongFromPlaylistL(TUint32 aPlaylistId, const TMPXItemId& aSongId,
+            TInt aOrdinal, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Deletes all song records marked as deleted.
+        */
+        void DoCleanupDeletedRecordsL();
+
+        /**
+        * Find items in the collection
+        * @param aCriteria selection criteria
+        * @param aAttrs attributes for the matching media
+        * @param aMediaArray returns the matching entries
+        */
+        void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray* aMediaArray);
+
+        /**
+        * Find a song.
+        * @param aCriteria selection criteria
+        * @param aAttrs attributes for the matching media
+        * @param aMediaArray returns the matching entries
+        */
+        void FindSongL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Gets the songs for a specified playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray returns the matching entries
+        */
+        void GetPlaylistSongsL(TUint32 aPlaylistId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Find an album
+        * @param aCriteria selection criteria
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray returns the matching entries
+        */
+        void FindAlbumL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Extracts the playlist ID and drive ID from the media object.
+        * @param aMedia playlist information
+        * @param aPlaylistId returns the playlist ID
+        * @param aPlaylistDriveId returns the drive ID
+        * @leave KErrArgument if the media does not include the ID and URI
+        */
+        void ProcessPlaylistMediaL(CMPXMedia& aMedia, TUint32& aPlaylistId,
+            TInt& aPlaylistDriveId);
+
+        /**
+        * Updates all the song entries in the playlist media with extra
+        * information from the music table.
+        * @param aMedia inout, contains the playlist/songs information
+        * @leave KErrArgument if the song does not exist in the music table and
+        *        the media does not include a URI
+        */
+        void UpdatePlaylistSongInfoL(CMPXMedia& aMedia);
+
+        /**
+        * Makes sure all the folders specified in the array parameter are created,
+        * otherwise it tries to create them. Updates the iDbDrives member variable
+        * with the drives corresponding to the folders.
+        * @param aFolders contains all the folders to be processed
+        */
+        void ProcessMusicFoldersL(const CDesCArray& aFolders);
+
+        /**
+        * Returns the CMPXDbCategory instance associated with the specified
+        * category type
+        * @param aCategory category type
+        * @return corresponding CMPXDbCategory instance
+        * @leave KErrNotSupported if invalid category
+        */
+        CMPXDbCategory* DbCategoryL(TMPXGeneralCategory aCategory) const;
+
+        /**
+        * Verify the volume id for the databases
+        */
+        void VerifyVolumeIdL();
+
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+        /**
+        * Reads the "save deleted records" MTP flag from CenRep and returns
+        * the value.
+        * @return value of the "save deleted records" MTP flag
+        */
+        TBool SaveDeletedSongs();
+#endif
+
+#ifdef RD_MULTIPLE_DRIVE
+        /**
+        * Retrieve all visible music folder locations.
+        */
+        CDesCArrayFlat* GetMusicFoldersL();
+#endif // RD_MULTIPLE_DRIVE
+
+    private:    // From MMPXDbMusicObserver
+
+        /**
+        * @see MMPXDbMusicObserver
+        */
+        virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory,
+            const TDesC& aName, TInt aDriveId,
+            CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
+
+		virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+			TUint32 aArtist, const TDesC& aArt,
+			TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
+
+		virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+			const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages);
+
+        /**
+        * @see MMPXDbMusicObserver
+        */
+        virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory,
+            TUint32 aCategoryId, TInt aDriveId, CMPXMessageArray* aItemChangedMessages,
+            TBool& aItemExist);
+
+        /**
+        * @see MMPXDbMusicObserver
+        */
+        virtual void HandlePlayCountModifiedL(CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * @see MMPXDbMusicObserver
+        */
+        virtual void HandlePlaybackTimeModifiedL(CMPXMessageArray& aItemChangedMessages);
+    private:    // From MMPXDbArtistObserver
+    /**
+    * @see MMPXDbArtistObser
+    */
+        virtual TInt HandleGetAlbumsCountForArtistL(TUint32 aArtistId);
+
+    private:    // From MMPXDbAlbumObserver
+    /**
+    * @see MMPXDbAlbumObserver
+    */
+        virtual TBool HandleIsUnknownArtistL(TUint32 aArtistId);
+        virtual TUint32 HandleArtistForAlbumL(const TUint32 aAlbumId);
+
+    private:	// From MMPXDbPlaylistObserver
+	/**
+	* @see MMPXDbPlaylistObserver
+	*/
+		virtual TInt HandlePlaylistDurationL(TUint32 aPlaylistId);
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param file session
+        */
+        CMPXDbHandler(RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Symbian 2nd phase constructor..
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // owned member variables
+        CMPXCollectionDbManager* iDbManager;
+        CMPXDbMusic* iDbMusic;
+        CMPXDbPlaylist* iDbPlaylist;
+        CMPXDbArtist* iDbArtist;
+        CMPXDbAlbum* iDbAlbum;
+        CMPXDbGenre* iDbGenre;
+        CMPXDbComposer* iDbComposer;
+        CMPXDbAuxiliary* iDbAuxiliary;
+
+        CMPXDbAutoPlaylist* iAutoPlaylist;
+
+        CDesCArrayFlat* iMimeTypes;         // MIME types supported
+        CDesCArrayFlat* iExtensions;        // file extensions supported
+        CDesCArrayFlat* iExtensionsMime;    // file extensions to check MIME
+        CDesCArrayFlat* iExtensionsDrm;     // file extensions to check DRM type
+        RArray<TInt> iDbDrives;
+
+        // not owned member variables
+        RFs& iFs;
+        CMPXResource& iResource;
+        TBool iOutOfDisk;                   // Are we in out of disk mode?
+        TBool iSynchronizeBasicTable;       // Basic music table was not updated during last refresh
+        TBool iCollectionOpen;              // Databases opened
+        TBool iRefresh;                     // Refresh operation currently performed
+        TBool iMtpInUse;                    // Flag for MTP operation
+        TInt  iOpOnDbCount;                 // Count to provide a min op amount in one transaction
+    };
+
+#endif      // MPXDBHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbmusic.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,762 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for all music table functionality.
+*                The Music table contains one record for each song on the database
+*                drive.
+*
+*
+*/
+
+
+#ifndef MPXDBMUSIC_H
+#define MPXDBMUSIC_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+#include "mpxdbcommonstd.h"
+#include "mpxdbactivetask.h"
+
+// CLASS FORWARDS
+class CMPXMedia;
+class CMPXMediaArray;
+
+// CLASS DECLARATION
+
+/**
+* Observer interface for handling the category ID functionality.
+* This is needed because the incoming CMPXMedia parameters in Add and Update methods
+* contain the names for the category items and the music table has to use IDs linking
+* to the category tables. Using this interface removes the dependency to the category
+* class.
+*
+* Note that this interface is only used when information is written to the Music table,
+* when information is retrieved the query takes care of also retrieving the names from
+* the corresponding category tables so the outgoing CMPXMedia will contain the correct
+* information.
+*/
+class MMPXDbMusicObserver
+    {
+    public:
+        /**
+        * Called when a new category item has to be added to a category table.
+        * @param aCategory category type
+        * @param aName name string
+        * @param aDrive drive to add the category to
+        * @param aItemChangedMessages changed mesages array to be updated or NULL
+        * @param aItemExist Out parameter, ETrue if the item already exist before the add,
+        *        EFalse otherwise
+        * @return the ID of the category item (new or existing)
+        */
+        virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+            TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
+
+		// for Album and Artist table
+		virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+			TUint32 aArtistId, const TDesC& aArt,
+			TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
+        /**
+        * Called when the ID of a category item changed for a Music record, for example when
+        * the artist name changed for a song. The implementation is supposed to update the
+        * category record and add corresponding item changed messages to the array parameter.
+        * @param aCategory category type
+        * @param aCategoryId old category item ID
+        * @param aDrive drive the category item is on
+        * @param aItemChangedMessages changed mesages array to be updated or NULL
+        * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete,
+        *        EFalse otherwise
+        */
+        virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+            TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
+
+        /**
+        * Called when the play count attribute of a song is changed. Should add an item changed
+        * message to the array.
+        * @param aItemChangedMessages array of item changed messages to add to
+        */
+        virtual void HandlePlayCountModifiedL(CMPXMessageArray& aItemChangedMessages) = 0;
+
+        /**
+        * Called when the playback time attribute of a song is changed. Should add an item changed
+        * message to the array.
+        * @param aItemChangedMessages array of item changed messages to add to
+        */
+        virtual void HandlePlaybackTimeModifiedL(CMPXMessageArray& aItemChangedMessages) = 0;
+
+        /**
+         * Called when category item is changed. Should add an item changed
+         * message to the array.
+         * @param aCategory category type
+         * @param aCategoryId old category item ID
+         * @param aDrive drive the category item is on
+         * @param aMedia media data
+         * @param aItemChangedMessages changed mesages array to be updated or NULL
+         */
+		virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+			const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages) = 0;
+    };
+
+/**
+* Responsible for managing the Music table
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbMusic :
+    public CMPXDbTable
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aObserver observer reference
+        * @return New CMPXDbMusic instance.
+        */
+        static CMPXDbMusic* NewL(CMPXDbManager& aDbManager, CMPXResource& aResource,
+            MMPXDbMusicObserver& aObserver);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aObserver observer reference
+        * @return New CMPXDbMusic instance on the cleanup stack.
+        */
+        static CMPXDbMusic* NewLC(CMPXDbManager& aDbManager, CMPXResource& aResource,
+            MMPXDbMusicObserver& aObserver);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbMusic();
+
+    public:
+
+        /**
+        * Add a song to the music table
+        * @param aMedia contains the song details
+        * @param aDrive drive to add the song to
+        * @param aMessageArray change event message to notify client of the changes
+        * @return The unique ID of the song added.
+        */
+        TUint32 AddSongL(const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aMessageArray=NULL);
+
+        /**
+        * Remove a song from the music table
+        * @param aSongId the ID of the song to be removed
+        * @param aDrive song drive
+        * @param aDeleteRecord indicates whether the client has explictly requested
+        *                to delete the records from the database. If ETrue, records
+        *                associated with the media will be deleted from the database;
+        *                if EFalse, whether to mark the records as deleted or to delete
+        *                the records will be based on other deciding factors.
+        */
+        void DeleteSongL(TUint32 aSongId, TInt aDrive, TBool aDeleteRecord = EFalse);
+
+        /**
+        * Remove songs matching a category from the music table
+        * @param aCategory the category to remove
+        * @param aCategoryId ID of the category to remove
+        * @param aUriArray on return will be filled with all the paths that were removed
+        * @param aItemChangedMessages a list of change events as a result of the song removal
+        * @param aDrive drive the category record is on
+        */
+        void DeleteCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+            CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages, TInt aDrive);
+
+        /**
+        * Deletes all songs marked as deleted
+        */
+        void CleanupL();
+
+        /**
+        * Update song info for a song in the music table
+        * @param aSongId song ID
+        * @param aMedia media object which contains file path,
+        *                artist, composer, name(title), track, etc...
+        * @param aItemChangedMessages a list of change events as a result of the song removal
+        * @return ETrue if the change is visible in the UI
+        */
+        CMPXDbActiveTask::TChangeVisibility UpdateSongL(TUint32 aSongId, const CMPXMedia& aMedia,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Get the name of the song that matches the given song ID
+        * @param aSongId ID of the song
+        * @return Song name, ownership is transferred to the caller.
+        */
+        HBufC* GetNameL(TUint32 aSongId);
+
+        /**
+        * Get URI of the song
+        * @param aSongId ID of the song
+        * @return Song URI, ownership is transferred to the caller.
+        */
+        HBufC* GetUriL(TUint32 aSongId);
+
+        /**
+        * Get the drive of the song
+        * @param aSongId ID of the song
+        * @return Song drive
+        */
+        TInt GetDriveL(TUint32 aSongId);
+
+        /**
+        * Get the drive and category IDs for a specified song
+        * @param aSongId song to be retrieved
+        * @param aArtistId returns the artist ID
+        * @param aAlbumId returns the artist ID
+        * @param aGenreId returns the artist ID
+        * @param aComposerId returns the artist ID
+        * @param aDriveId returns the song drive
+        * @return song URI. The ownership is transferred.
+        */
+        HBufC* GetSongInfoL(TUint32 aSongId, TUint32& aArtistId, TUint32& aAlbumId,
+            TUint32& aGenreId, TUint32& aComposerId, TInt& aDriveId);
+
+        /**
+        * Get the song Id, title, URI, and general flags from the given song Id and/or URI
+        * @param aCriteria search the media by song Id and/or URI
+        * @param aMedia returns the song details
+        * @return error code KErrNotFound if unable to find the specified song in the
+        *          collection; otherwise KErrNone
+        */
+        TInt GetSongL(const CMPXMedia& aCriteria, CMPXMedia*& aMedia);
+
+        /**
+        * Get the most recently played songs. Returns a maximum of KMPXMaxRecentlyPlayedSongs
+        * songs.
+        * @param aAttrs attributes to include
+        * @param aMediaArray returns the songs' info
+        */
+        void GetRecentlyPlayedSongsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the most played songs from the music table. Returns a maximum of
+        * KMPXMaxMostPlayedSongs songs.
+        * @param aAttrs attributes to include
+        * @param aMediaArray returns the songs' info
+        */
+        void GetMostPlayedSongsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the recently added songs from the music table (7 days)
+        * @param aAttrs attributes to include
+        * @param aMediaArray returns the songs' info
+        */
+        void GetRecentlyAddedSongsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+       /**
+        * Get the total number of songs
+        * @return total number of songs
+        */
+        TInt CountL();
+
+        /**
+        * Get all the albums for a specified artist
+        * @param aArtistId artist ID
+        * @param aMediaArray returns the album(s) matching the artist
+        */
+        void GetAlbumsForArtistL(TUint32 aArtistId, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns details about the specified song.
+        * @param aSongId identifies the song
+        * @param aAttrs attributes to be retrieved
+        * @param aMedia returns the song information
+        */
+        void GetSongL(TInt aSongId, const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia);
+
+        /**
+        * Returns all songs in the playlist.
+        * @param aDrive identifies in db
+        * @param aPlaylistId identifies the playlist
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetAllSongsL(TInt aDrive,TInt aPlaylistId,const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns all songs in the database.
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetAllSongsL(const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get from all songs with a limit (first N items)
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        * @param aLimit maximum number of songs to retrieve
+        */
+        void GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray, TInt aLimit);
+
+        /**
+        * Returns a block of songs as specified
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        * @param aTitle title of the song that marks the beginning of the block
+        * @param aNumOfSongs the number of songs in the block
+        * @param aAsc
+        */
+        void GetSongsInBlockL( const TArray<TMPXAttribute>& aAttrs,
+                               CMPXMediaArray& aMediaArray,
+                               TPtrC aTitle,
+                               TUint aNumOfSongs,
+                               TBool aAsc);
+
+
+        /**
+        * Get songs from the music collection starting at a particular offset
+        * ONLY use this as the first query to locate particular item. Should use
+        * GetSongsInBlockL() to fetch in blocks with a particular index
+        * @param aMediaArray Array to store the results
+        * @param aAttrs attributes to fetch
+        * @param aOffset offset to start reading
+        * @param aCount number of items to get
+        */
+        void GetSongsAtOffsetL( CMPXMediaArray& aMediaArray,
+                                const TArray<TMPXAttribute>& aAttrs,
+                                TInt aOffset,
+                                TInt aCount );
+
+        /**
+        * Returns all songs for a given artist.
+        * @param aArtistId artist to get the songs for
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetSongsForArtistL(TUint aArtistId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns all songs for a given album.
+        * @param aAlbumId album to get the songs for
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetSongsForAlbumL(TUint aAlbumId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns all songs for a given artist and album.
+        * @param aArtistId artist to get the songs for
+        * @param aAlbumId album to get the songs for
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetSongsForArtistAndAlbumL(TUint aArtistId, TUint aAlbumId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns all songs for a given genre.
+        * @param aGenreId genre to get the songs for
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetSongsForGenreL(TUint aGenreId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns all songs for a given composer.
+        * @param aComposerId composer to get the songs for
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetSongsForComposerL(TUint aComposerId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns the duration of all songs.
+        * @return the duration value
+        */
+        TInt AllSongsDurationL();
+
+        /**
+        * Returns the duration for a specified artist.
+        * @param aArtistId artist to get the duration for
+        * @return the duration value
+        */
+        TInt ArtistDurationL(TUint aArtistId);
+
+        /**
+        * Returns the duration for a specified album.
+        * @param aAlbumId album to get the duration for
+        * @return the duration value
+        */
+        TInt AlbumDurationL(TUint aAlbumId);
+
+        /**
+        * Returns the duration for a specified artist and album.
+        * @param aArtistId artist to get the duration for
+        * @param aAlbumId album to get the duration for
+        * @return the duration value
+        */
+        TInt ArtistAlbumDurationL(TUint aArtistId, TUint aAlbumId);
+
+        /**
+        * Returns the duration for a specified genre.
+        * @param aGenreId genre to get the duration for
+        * @return the duration value
+        */
+        TInt GenreDurationL(TUint aGenreId);
+
+        /**
+        * Returns the duration for a specified composer.
+        * @param aComposerId composer to get the duration for
+        * @return the duration value
+        */
+        TInt ComposerDurationL(TUint aComposerId);
+
+        /**
+        * Returns the duration for the recently played songs.
+        * @return the duration value
+        */
+        TInt RecentlyPlayedDurationL();
+
+        /**
+        * Returns the duration for the most played songs.
+        * @return the duration value
+        */
+        TInt MostPlayedDurationL();
+
+        /**
+        * Returns the duration for the recently added songs.
+        * @return the duration value
+        */
+        TInt RecentlyAddedDurationL();
+
+        /**
+        * Find the songs for the selection criteria
+        * @param aGeneralId selection criteria (could be song/album/artist/genre/composer ID)
+        * @param aContainerId selection criteria (could be artist/album id)
+        * @param aType criteria type (EMPXItem or EMPXGroup)
+        * @param aCriteria selection criteria
+        * @param aAttrs the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray returns the songs
+        */
+        void FindSongsL(TUint32 aGeneralId, TUint32 aContainerId, TMPXGeneralType aType,
+            const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns the track count for a given drive
+        * @param aDrive drive
+        * @return the count
+        */
+        TUint GetDriveTrackCountL(TInt aDrive);
+
+        /**
+        * Get URIs for a given number of tracks
+        * @param aDrive, specifies drive number for db selection
+        * @param aFromID, specifies unique ID of last record retrieved
+        * @param aRecords, specifies the number of records to get
+        * @param aUriArr, will contain all URIs on return
+        * @param aLastID, will contain unique ID of a last record in the array
+        */
+        void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                               CDesCArray& aUriArr, TInt& aLastID);
+
+        /**
+         * Get the ID of Artist which belongs to the specified Album
+		 * @param aId, the ID of Album
+         */
+        TUint32 CMPXDbMusic::ArtistForAlbumL(const TUint32 aId);
+
+        /**
+        * Signals the start of a refresh operation
+        */
+        void RefreshStartL();
+
+        /**
+        * Signals the end of a refresh operation
+        */
+        void RefreshEndL();
+
+        /*
+        * Refresh music basic table
+        */
+        void RefreshBasicTableL();
+
+        /*
+        * Check the integrity of the music basic table
+        */
+        void CheckMusicBasicTableL();
+
+    private:
+
+        /**
+        * Checks if the specified song exists.
+        * @param aId identifies the song
+        * @return ETrue if it exists, EFalse otherwise
+        */
+        TBool SongExistsL(TUint32 aSongId);
+
+        /**
+        * Update the media with information found in the Music table
+        * @param aMusicTable music table record
+        * @param aAttrs the attributes to include
+        * @param aMedia returns the song details
+        */
+        void UpdateMediaL(RSqlStatement& aMusicTable, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Update the media general attributes from the Music table
+        * @param aMusicTable music table view
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaGeneralL(RSqlStatement& aMusicTable, const TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Update the media music attributes from the Music table
+        * @param aMusicTable music table view
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaMusicL(RSqlStatement& aMusicTable, const TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Update the media audio attributes from the Music table
+        * @param aMusicTable music table view
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaAudioL(RSqlStatement& aMusicTable, const TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Update the media MTP attributes from the Music table
+        * @param aMusicTable music table view
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaMTPL(RSqlStatement& aMusicTable, const TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Adds a song to the Music table
+        * @param aSongId identifies the song
+        * @param aMedia contains the song attributes
+        * @param aDrive drive to add the song to
+        * @param aItemChangedMessages item changed messages to update
+        */
+        TBool DoAddSongL(TUint32 aSongId, const CMPXMedia& aMedia, TInt aDrive,
+            CMPXMessageArray* aItemChangedMessages);
+
+        /**
+        * Updates a song in the Music table
+        * @param aSongId identifies the song
+        * @param aMedia contains the song attributes
+        * @param aItemChangedMessages item changed messages to update or NULL
+        */
+        CMPXDbActiveTask::TChangeVisibility DoUpdateSongL(TUint32 aSongId, const CMPXMedia& aMedia,
+            CMPXMessageArray* aItemChangedMessages);
+
+        /**
+        * Updates a song in the Music table
+        * @param aSongId identifies the song
+        * @param aMedia contains the song attributes
+        * @param aDrive drive to add the song to
+        * @param aItemChangedMessages item changed messages to update
+        * @param aRecordset current song record in the Music table.
+        *       Required to detect any field changes.
+        */
+        CMPXDbActiveTask::TChangeVisibility DoUpdateSongL(TUint32 aSongId, const CMPXMedia& aMedia, TInt aDrive,
+            CMPXMessageArray* aItemChangedMessages, RSqlStatement& aRecordset);
+
+        /**
+        * Get the DRM type of the given file
+        * @param aFile file
+        * @return DRM type.
+        */
+        TMCDrmType DRMTypeL(const TDesC& aFile);
+
+        /**
+        * Generate searching criteria for music table from the given criteria
+        * @param aGeneralId selection criteria (could be song/album/artist/genre/composer Id)
+        * @param aContainerId selection criteria (could be artist/album id)
+        * @param aType criteria type (EMPXItem or EMPXGroup)
+        * @param aCriteria input criteria
+        * @return a string containing the selection criteria. The ownership is passed to the caller.
+        */
+        HBufC* GenerateMusicMatchingCriteriaLC(TUint32 aGeneralId, TUint32 aContainerId,
+            TMPXGeneralType aType, const CMPXMedia& aCriteria);
+
+        /**
+        * Constructs the fields and corresponding values to be written into the music
+        * table for update and insert statements.
+        * @param aSongId identifies the song
+        * @param aMedia contains the new song attributes
+        * @param aItemChangedMessages item changed mesages to add to
+        * @param aMusicTable points to the existing record in the Music table for updates or NULL
+        *       for inserts
+        * @param aFields returns the field names to be updated
+        * @param aValues returns the field values to be updated
+        * @param aDrive drive the song is on
+        * @return ETrue if the change is visible in the UI
+        */
+        CMPXDbActiveTask::TChangeVisibility GenerateMusicFieldsValuesL(TUint32 aSongId, const CMPXMedia& aMedia,
+            CMPXMessageArray* aItemChangedMessages, RSqlStatement* aMusicTable,
+            CDesCArray& aFields, CDesCArray& aValues, TInt aDrive);
+
+        /**
+        * Generates the full URI from a music record.
+        * @param aMusicTable music table record
+        * @return Full URI string. The ownership is passed to the caller.
+        */
+        HBufC* ConstructUriL(RSqlStatement& aMusicTable);
+
+        /**
+        * Checks if the specified category field (artist/album/genre/composer)
+        * will change and notifies the observer if so.
+        * @param aCategory identifies the category
+        * @param aMedia contains the new record attributes
+        * @param aAttribute corresponding attribute in the media parameter
+        * @param aColumnIndex column index in the recordset
+        * @param aMusicTable current record in the music table or NULL if this is an insert
+        * @param aDriveId drive ID the update is for
+        * @param aItemChangedMessages item changed messages to append to
+        * @param aItemId returns the category item ID
+        * @return ETrue if the field was modified
+        */
+        TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
+            const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
+            CMPXMessageArray* aItemChangedMessages, TUint32& aItemId);
+
+		TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
+			const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
+			CMPXMessageArray* aItemChangedMessages, TUint32& aItemId, TUint32 aArtistId);
+        /**
+        * Checks if extra attributes are required. The "standard attribute set includes:
+        * EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory,
+        * EMPXMediaGeneralTitle, EMPXMediaGeneralUri, and EMPXMediaGeneralFlags
+        * @param aAttrs attributes to be checked
+        * @return ETrue if extra attributes are required
+        */
+        TBool ExtraFieldsRequired(const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Test whether the given media contains any supported attribute
+        * @param aMedia media to be tested
+        * @return ETrue if the media contains one or more supported attribute;
+        *  otherwise EFalse.
+        */
+		TBool IsSupported(const CMPXMedia& aMedia);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor
+        * @param aDbManager database manager to use for database interactions
+        */
+        CMPXDbMusic(CMPXDbManager& aDbManager, MMPXDbMusicObserver& aObserver);
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL(CMPXResource& aResource);
+
+    private:
+
+        /**
+        * Column indexes in the music table
+        */
+		enum TMusicColumns
+			{
+			EMusicUniqueId = KMPXTableDefaultIndex,
+			EMusicDbFlag,
+			EMusicVolumeId,
+			EMusicTitle,
+			EMusicArtist,
+			EMusicArt,
+			EMusicDeleted,
+			EMusicLocation,
+			EMusicAlbumTrack,
+			EMusicPlayCount,
+			EMusicTimeAdded,
+			EMusicTimePlayed,
+			EMusicDuration,
+			EMusicSync,
+			EMusicModified,
+			EMusicAlbum,
+			EMusicGenre,
+			EMusicComposer,
+			EMusicReleaseDate,
+			EMusicRating,
+			EMusicComment,
+			EMusicCopyright,
+			EMusicUrl,
+			EMusicDRM,
+			EMusicLastPlayPosition,
+			EMusicSampleRate,
+			EMusicBitRate,
+			EMusicNumChannels,
+			EMusicCodec,
+			EMusicMimeType,
+			EMusicMTPDrmStatus,
+			EMusicArtistName,
+			EMusicAlbumName,
+			EMusicGenreName,
+			EMusicComposerName,
+			EMusicFieldCount
+			};
+
+         /*
+         * Unique ID for Queries with a lifetime
+         */
+         enum TMusicStatements
+             {
+             EOffsetQueryBasic = 0xabcd0001,
+             EAscQueryBasic = 0xabcd0002,
+             EDscQueryBasic = 0xabcd0003,
+             EOffSetQuery = 0xabcd0004,
+             EAscQuery = 0xabcd0005,
+             EDscQuery = 0xabcd0006
+             };
+
+    private:    // Data
+
+        // file extensions to check DRM type, owned
+        CDesCArrayFlat* iExtensionsDrm;
+        MMPXDbMusicObserver& iObserver;
+        TBool iRefresh;
+    };
+
+#endif // MPXDBMUSIC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbplaylist.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,335 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class manages the Playlist table and owns a
+*                CMPXPlaylistSongs instance for managing the PlaylistSongs and
+*                PlaylistSongInfo tables.
+*
+*                The Playlist table stores one record for each playlist.
+*
+*
+*/
+
+
+#ifndef MPXDBPLAYLIST_H
+#define MPXDBPLAYLIST_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+
+// CLASS FORWARDS
+class RSqlStatement;
+class CMPXDbPlaylistSongs;
+class CMPXMedia;
+class CMPXMediaArray;
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing the playlist tables
+*
+* @lib MPXDbPlugin.lib
+*/
+class MMPXDbPlaylistObserver
+	{
+	public:
+		virtual TInt HandlePlaylistDurationL(TUint32 aPlaylistId) = 0;
+	};
+class CMPXDbPlaylist : public CMPXDbTable
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbPlaylist instance.
+        */
+        static CMPXDbPlaylist* NewL(CMPXDbManager& aDbManager, MMPXDbPlaylistObserver& aObserver);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbManager instance on the cleanup stack.
+        */
+        static CMPXDbPlaylist* NewLC(CMPXDbManager& aDbManager, MMPXDbPlaylistObserver& aObserver);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbPlaylist();
+
+    public:
+
+        /**
+        * Add a playlist to the playlist table.  If playlist already exists,
+        * it is updated.
+        * @param aMedia playlist media to be added to the collection
+        * @return The unique id of the playlist
+        */
+        TUint32 AddPlaylistL(const CMPXMedia& aMedia);
+
+        /**
+        * Add one or multiple songs to the playlist.
+        * @param aPlaylistId identifies the playlist
+        * @param aMediaArray contains the song information to be added
+        */
+        void AddSongsL(TUint32 aPlaylistId, const CMPXMediaArray& aMediaArray);
+
+        /**
+        * Update playlist info
+        * @param aMedia playlist object which contains playlist Id, file path,
+        *               timestamp, etc... to be updated in the playlist table
+        * @param aMessage change event message for the playlist updated
+        */
+        void UpdatePlaylistL(const CMPXMedia& aMedia, CMPXMessage& aMessage, TInt aDriveId);
+
+        /**
+        * Update a playlist song
+        * @param aMedia song info
+        * @param aResetFlags indicates whether the song db flags should be reset or just updated
+        * @param aItemChangedMessages returns the change messages for the playlists updated
+        * @return ETrue if the change is visible in the UI
+        */
+        TBool UpdateSongL(const CMPXMedia& aMedia, TBool aResetFlags,
+            CMPXMessageArray* aItemChangedMessages = NULL);
+
+        /**
+        * Remove a playlist and return its URI
+        * @param aPlaylistId identifies the playlist
+        * @return HBufC containing the URI. Ownership is transferred.
+        */
+        HBufC* DeletePlaylistL(TUint32 aPlaylistId);
+
+        /**
+        * Remove a playlist
+        * @param aPlaylistId identifies the playlist
+        */
+        void DeletePlaylistNoUriL(TUint32 aPlaylistId);
+
+        /**
+        * Delete a song from the playlist tables.
+        * @param aSongId identifies the song
+        * @param aItemChangedMessages returns the item changed messages
+        */
+        void DeleteSongL(TUint32 aSongId, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Delete a song from the playlist tables.
+        * @param aPlaylistId identifies the playlist
+        * @param aSongId identifies the song
+        * @param aOrdinal song ordinal
+        */
+        void DeleteSongL(TUint32 aPlaylistId, TUint32 aSongId, TInt aOrdinal);
+
+        /**
+        * Remove all playlists.
+        */
+        void DeleteAllPlaylistsL();
+
+        /**
+        * Gets the total number of playlists.
+        * @return number of playlists
+        */
+        TInt CountL();
+
+        /**
+        * Get information on a specified playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aAttrs the attributes to include for the playlists found.
+        * @param aMedia returns the playlist information
+        */
+        void GetPlaylistL(TUint32 aPlaylistId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Get all playlists
+        * @param aAttrs the attributes to include for the playlists found.
+        * @param aMediaArray returns the playlist information
+        */
+        void GetAllPlaylistsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the name of a playlist.
+        * @param aPlaylistId identifies the playlist
+        * @return name matching the specified playlist ID. Ownership is transferred.
+        */
+        HBufC* GetNameL(TUint32 aPlaylistId);
+
+        /**
+        * Get a playlist' uri
+        * @param aPlaylistId identifies the playlist
+        * @return URI matching the specified playlist ID. Ownership is transferred.
+        */
+        HBufC* GetUriL(TUint32 aPlaylistId);
+
+        /**
+        * Return the playlist ID for a specified URI.
+        * @param aUri URI of the playlistId
+        * @return playlist ID
+        */
+        TUint32 GetIdL(const TDesC& aUri);
+
+        /**
+        * Find playlist(s) which match(es) the selection criteria
+        * @param aCriteria selection criteria
+        * @param aAttrs the attributes to include for the playlist(s) matching the
+        *        selection criteria
+        * @param aMediaArray playlist(s) matching the selection criteria
+        */
+        void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Find the drive Id for a playlist
+        * @param aPlaylistId identifies the playlist
+        * @return corresponding drive id
+        */
+        TInt GetDriveIdL(TUint32 aPlaylistId);
+
+        /**
+        * Provides access to the songs for the current playlist.
+        * @return CMPXDbPlaylistSongs reference to be used to access the songs
+        */
+        CMPXDbPlaylistSongs& Songs();
+
+        /**
+        * Returns the playlist count for a given drive
+        * @param aDrive drive
+        * @return the count
+        */
+        TUint GetDrivePlaylistCountL(TInt aDrive);
+
+        /**
+        * Get URIs for a given number of playlists
+        * @param aDrive, specifies drive number for db selection
+        * @param aFromID, specifies unique ID of last record retrieved
+        * @param aRecords, specifies the number of records to get
+        * @param aUriArr, will contain all URIs on return
+        * @param aLastID, will contain unique ID of a last record in the array
+        */
+        void GetPlaylistUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                  CDesCArray& aUriArr, TInt& aLastID);
+
+    private:
+
+        /**
+        * Update the media with information found in the Playlist table
+        * @param aRecord playlist table
+        * @param aAttrs the attributes to include for the playlist matching the
+        *        selection criteria
+        * @param aMedia returns playlist details
+        */
+        void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Create playlist table view and have the current row point to aPlaylistId
+        * @param aPlaylistId ID of the playlist to match
+        * @return RSqlStatement with row pointing to selected aPlaylistId
+        * Function leaves with KErrNotFound if RSqlStatement is unable to initialize
+        * or row cannot be found
+        */
+        RSqlStatement GetPlaylistRecordL(TUint32 aPlaylistId);
+
+        /**
+        * Add a new playlist
+        * @param aMedia contains the playlist info
+        * @param aDriveId drive to add the playlist to
+        * @return ID of the new playlist
+        */
+        TUint32 DoAddPlaylistL(const CMPXMedia& aMedia, TInt aDriveId);
+
+        /**
+        * Update a playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aMedia contains the playlist info
+        * @param aDriveId drive to add the playlist to
+        * @param aMessage change event message for the playlist updated
+        */
+        void DoUpdatePlaylistL(TUint32 aPlaylistId, const CMPXMedia& aMedia, TInt aDriveId,
+            CMPXMessage& aMessage);
+
+        /**
+        * Sets the Time field for all playlists that contain the specified song to the
+        * current time
+        * @param aSongId identifies the song
+        * @param aItemChangedMessages if not NULL item changed messages are added for all
+        *           updated playlists
+        * @param aSongInPlaylists out parameter that flags if the song is part of a playlist or not
+        */
+        void UpdatePlaylistsForSongL(TUint32 aSongId, CMPXMessageArray* aItemChangedMessages,TBool &aSongInPlaylists);
+
+        /**
+        * Sets the Time field for a playlist to the current time.
+        * @param aPlaylistId identifies the playlist
+        * @param aDrive playlist drive
+        */
+        void UpdatePlaylistTimeL(TUint32 aPlaylistId, TInt aDrive);
+
+        TInt GetDrivePlaylistDuration(TUint32 aPlaylistId);
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+     private:
+
+        /**
+        * C++ constructor
+        * @param aDbManager database manager to use for database interactions
+        */
+        CMPXDbPlaylist(CMPXDbManager& aDbManager, MMPXDbPlaylistObserver& aObserver);
+
+        /**
+        * Second phase constructor
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the playlist table
+        */
+        enum TPlaylistColumns
+            {
+            EPlaylistUniqueId = KMPXTableDefaultIndex,
+            EPlaylistVolumeId,
+            EPlaylistDbFlag,
+            EPlaylistSync,
+            EPlaylistName,
+            EPlaylistUri,
+            EPlaylistTime
+            };
+
+    private:    // Data
+
+        CMPXDbPlaylistSongs* iPlaylistSongs;
+		MMPXDbPlaylistObserver& iObserver;
+    };
+
+#endif // MPXDBPLAYLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbplaylistsongs.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,327 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for the functionality related to
+*                playlist songs. The class operates on two tables: PlaylistSongs
+*                and PlaylistSongInfo.
+*
+*                The PlaylistSongs table contains records for all song instances in
+*                playlists. For example if a playlist contains 7 songs, there will be 7
+*                corresponding records in the PlaylistSongs table, even if one song has
+*                multiple instances in the playlist.
+*
+*                The PlaylistSongInfo table contains one record for each song included
+*                in at least one playlist. Redundant song information is stored in this
+*                table to help with songs on different drives than the playlist.
+*
+*
+*/
+
+
+#ifndef MPXDBPLAYLISTSONGS_H
+#define MPXDBPLAYLISTSONGS_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+
+// CLASS FORWARDS
+class CMPXMedia;
+class CMPXMediaArray;
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing the music table
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbPlaylistSongs :
+    public CMPXDbTable
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbPlaylistSongs instance.
+        */
+        static CMPXDbPlaylistSongs* NewL(CMPXDbManager& aDbManager);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbPlaylistSongs instance on the cleanup stack.
+        */
+        static CMPXDbPlaylistSongs* NewLC(CMPXDbManager& aDbManager);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbPlaylistSongs();
+
+    public:
+
+        /**
+        * Add a song/songs to the given playlist
+        * @param aPlaylistId playlist id
+        * @param aMediaArray media array which contains the tracks to be added to the playlist
+        * @param aDriveId Drive Id of corresponding playlist
+        */
+        void AddSongsL(TUint32 aPlaylistId, const CMPXMediaArray& aMediaArray, TInt aDriveId);
+
+        /**
+        * Add a song to playlist songs table for the given playlist
+        * @param aPlaylistId id of the playlist to add the song to
+        * @param aDriveId drive the song is on
+        * @param aMedia song media to be added to the playlist songs table for the playlist
+        * @return song ID
+        */
+        TUint32 AddSongL(TUint32 aPlaylistId, const CMPXMedia& aMedia, TInt aDriveId);
+
+        /**
+        * Add a song to playlist songs table for the given playlist
+        * @param aPlaylistId id of the playlist to add the song to
+        * @param aOrdinal ordinal of the song to be added
+        * @param aDriveId drive the song is on
+        * @param aMedia song media to be added to the playlist songs table for the playlist
+        * @return song ID
+        */
+        TUint32 AddSongL(TUint32 aPlaylistId, TInt aOrdinal, const CMPXMedia& aMedia,
+            TInt aDriveId);
+
+        /**
+        * Update song info for a song in the playlist songs table
+        * @param aSongId identifies the song
+        * @param aMedia song information
+        * @param aResetFlags indicates whether the song db flags should be reset or just updated
+        * @param aUpdated returns ETrue if the song information has changed
+        */
+        TBool UpdateSongL(TUint32 aSongId, const CMPXMedia& aMedia, TBool aResetFlags,
+            TBool& aUpdated);
+
+        /**
+        * Update songs in a playlist to reflect playlist id change
+        * @param aPlaylistId identifies the songs in the playlist
+        * @param aNewPlaylistId specifies the new playlist id the songs should be associated with
+        */
+        void UpdateSongsL(TUint32 aPlaylistId, TUint32 aNewPlaylistId);
+
+        /**
+        * Reorder the song in the playlist
+        * @param aPlaylistId id of the playlist which contains the song to be reordered
+        * @param aSongId id of the song to be reordered
+        * @param aOriginalOrdinal the original ordinal of the song within the playlist.
+        *        Ordinal starts from 0.
+        * @param aNewOrdinal the new ordinal of the song within the playlist. Ordinal
+        *        starts from 0.
+        */
+        void ReorderSongL(const TMPXItemId& aPlaylistId, const TMPXItemId& aSongId,
+            TUint aOriginalOrdinal, TUint aNewOrdinal);
+
+        /**
+        * Remove the given song from all playlists
+        * @param aSongId ID of the song to remove
+        * @param aDriveId identifies the database to be updated
+        */
+        void DeleteSongL(TUint32 aSongId);
+
+        /**
+        * Remove a song from the playlist.
+        * @param aPlaylistId ID of the playlist to remove the song from
+        * @param aSongId Id of the song in the playlist to be removed
+        * @param aOrdinal the ordinal of the song in the playlist. This uniquely
+        *        identifies which song in the playlist to be removed; whereas song
+        *        ID doesn't because duplicate tracks in the playlist are allowed.
+        *        The position is relative to zero, i.e. zero implies that the song
+        *        at the beginning of the playlist is to be removed.
+        * @param aDriveId identifies the database to be updated
+        */
+        void DeleteSongL(TUint32 aPlaylistId, TUint32 aSongId, TInt aOrdinal, TInt aDriveId);
+
+        /**
+        * Remove all songs from the specified playlist
+        * @param aPlaylistId ID of the playlist.
+        * @param aDriveId identifies the database.
+        */
+        void DeleteSongsL(TUint32 aPlaylistId, TInt aDriveId);
+
+        /**
+        * Remove the songs for a given category from all playlists.
+        * @param aCategory identifies the category
+        * @param aCategoryId identifies the category item
+        * @param aDriveId identifies the database to be updated
+        */
+        void DeleteSongsForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+            TInt aDriveId);
+
+        /**
+        * Remove the songs for a given category from all playlists.
+        * @param aCategory identifies the category
+        * @param aCategoryId identifies the category item
+        * @param aDriveId identifies the database to be updated
+        */
+        void DeleteSongsForArtistAndAlbumL(TUint32 aArtistId, TUint32 aAlbumId, TInt aDriveId);
+
+        /**
+        * Remove all songs from the playlist songs table
+        */
+        void DeleteAllSongsL();
+
+        /**
+        * Get ids of all songs in a playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aMediaArray returns songs' id
+        */
+        void GetSongsL(TUint32 aPlaylistId, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get ids of all songs in a playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aAttrs attributes to return
+        * @param aMediaArray returns songs' id
+        */
+        TBool GetSongsL( TUint32 aPlaylistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get information on a song in a playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aSongId identifies the song
+        * @param aAttrs attributes to return
+        * @param aMedia returns song info
+        */
+        TBool GetSongL(TUint32 aPlaylistId, TUint32 aSongId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia);
+
+        /**
+        * Get information on a song
+        * @param aSongId identifies the song
+        * @param aAttrs attributes to return
+        * @param aMedia returns song info
+        */
+        TBool GetSongL(const TMPXItemId& aSongId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia*& aMedia);
+
+
+        /**
+        * Get the number of songs for a playlist
+        * @param aPlaylistId identifies the playlist
+        * @return number of songs
+        */
+        TInt CountL(TUint32 aPlaylistId);
+
+    private:
+
+        /**
+        * Update the media from the table
+        * @param aRecord playlist table view
+        * @param aAttrs the attributes to return
+        * @param aMedia updated with the playlist song info
+        */
+        void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Get the number of instances of a song in a playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aSongId identifies the song
+        * @return number of instances
+        */
+        TInt SongInstanceCountL(TUint32 aPlaylistId, TUint32 aSongId);
+
+        /**
+        * Get the number of instances of a song in the PlaylistSongs table.
+        * @param aSongId identifies the song
+        * @return number of instances
+        */
+        TInt SongCountL(TUint32 aSongId);
+
+        /**
+        * Checks if the specified song exists in the PlaylisySongInfo table.
+        * @param aDriveId drive to check or KDbManagerAllDrives
+        * @param aSongId identifies the song
+        * @return ETrue if it exists, EFalse otherwise
+        */
+        TBool SongInfoExistsL(TInt aDriveId, TUint32 aSongId);
+
+        /**
+        * Deletes all orphaned records in the PlaylistSongInfo table
+        * (songs not included in any playlist).
+        * @param aDriveId database to cleanup
+        */
+        void CleanupSongInfoL(TInt aDriveId);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor
+        * @param aDbManager database manager to use for database interactions
+        */
+        CMPXDbPlaylistSongs(CMPXDbManager& aDbManager);
+
+        /**
+        * Safely construct things that can leave
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the playlist songs query
+        */
+        enum TPlaylistSongsColumns
+            {
+            EPlaylistSongsUniqueId = KMPXTableDefaultIndex,
+            EPlaylistSongsSongId,
+            EPlaylistSongsPlaylistId,
+            EPlaylistSongsOrdinal,
+            EPlaylistSongsVolumeId,
+            EPlaylistSongsDbFlag,
+            EPlaylistSongsUri,
+            EPlaylistSongsTitle
+            };
+
+        /**
+        * Column indexes in the playlist song info table
+        */
+        enum TPlaylistSongInfoColumns
+            {
+            EPlaylistSongInfoSongId = KMPXTableDefaultIndex,
+            EPlaylistSongInfoVolumeId,
+            EPlaylistSongInfoDbFlag,
+            EPlaylistSongInfoUri,
+            EPlaylistSongInfoTitle
+            };
+
+    };
+
+#endif // MPXDBPLAYLISTSONGS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,795 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of collection Database Plugin interface
+*
+*/
+
+
+#ifndef MPXDBPLUGIN_H
+#define MPXDBPLUGIN_H
+
+// INCLUDES
+#include <badesca.h>
+#include <mpxcommonframeworkdefs.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxcollectionplugin.h>
+#include <mpxcollectionpath.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmessage2.h>
+
+#include "mpxdbactivetask.h"
+#include "mpxcollectiondb.hrh"
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXDbHandler;
+class CMPXDrmMediaUtility;
+class CMPXMediaArray;
+class CMPXResource;
+struct TMPXOpenDataBlock;
+
+// CLASS DECLARATION
+
+/**
+* CMPXDbPlugin class
+* Implements the plugin interface.
+*
+* @lib MPXDbPlugin.lib
+*/
+NONSHARABLE_CLASS(CMPXDbPlugin) :
+    public CMPXCollectionPlugin,
+    public MMPXDbActiveTaskObserver
+    {
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor
+    * @param aInitParams: initialization parameters
+    * @return object constructed
+    */
+    static CMPXDbPlugin* NewL (TAny* aInitParams);
+
+    /**
+    * Destructor
+    */
+    virtual ~CMPXDbPlugin();
+
+public: // from base classes
+
+    /**
+    * From CMPXCollectionPlugin
+    * Navigates to the given path. This method is serviced
+    * asynchronously and HandleOpenL is called upon completion
+    * @param aPath a path
+    * @param aAttrs attributes requested
+    * @param aFilter filter to apply or NULL if none
+    */
+    void OpenL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXFilter* aFilter);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Get the extended properties of the item referred to by the
+    * specified collection path.  This method is serviced asynchronously and
+    * HandleMediaL is called upon completion
+    * @param aPath a collection path referring to the item to retrieve the
+    *               extended properties for
+    * @param aAttrs array of attributes requested
+    * @param aCaps platsec capabilities of client requesting media; plug-in
+    *        should also verify its process capabilities (not yet supported)
+    * @aParam aSpecs specifications for attributes (not yet supported)
+    */
+    void MediaL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        const TArray<TCapability>& aCaps, CMPXAttributeSpecs* aSpecs);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Cancel outstanding request. Note*** CancelRequest is not currently
+    * implemented because all requests are processed synchronously
+    */
+    void CancelRequest();
+
+    /**
+    * From CMPXCollectionPlugin
+    * Executes the given TMPXCollectionCommand command on the collection
+    * @param aCmd a command
+    * @param aArg an argument
+    */
+    void CommandL (TMPXCollectionCommand aCmd, TInt aArg = 0);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Executes the given CMPXCommand command on the collection
+    * @param aCmd a command
+    */
+    void CommandL(CMPXCommand& aCmd);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Adds an item (song or playlist) to the collection
+    * @param aMedia Properties of the item
+    */
+    void AddL(const CMPXMedia& aMedia);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Remove an item from the collection database using the given path
+    * Note that the selection indices are hidden within the path
+    * @param aPath path to the item to be removed
+    *
+    */
+    void RemoveL(const CMPXCollectionPath& aPath);
+
+    /**
+    *  Remove item(s) from the collection database using the given media properties
+    *  @param aMedia Properties of the item(s) to be removed. May cantain a URI
+    *           or metadata. All item(s) matching the specified properties
+    *           will be removed.
+    */
+    void RemoveL(const CMPXMedia& aMedia);
+
+    /**
+    *  Sets/updates the specified media for an item in the collection.  Media
+    *  is identified by specifying an ID or URI.
+    *  @param aMedia new property values for the item
+    */
+    void SetL(const CMPXMedia& aMedia);
+
+    /**
+    * From CMPXCollectionPlugin
+    *  Find the items matching the media specifications.  This method is serviced
+    *  asynchronously and HandleFindAllL is called upon completion
+    *  @param aCriteria Properties of the item that is to be found
+    *  @param aAttrs Requested attributes to return
+    */
+    void FindAllL (const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs);
+
+    /**
+    *  From CMPXCollectionPlugin
+    *  Find the items matching the media specifications
+    *  @param aCriteria Properties of the item that is to be found
+    *  @param aAttrs Requested attributes to return
+    *  @return results of the search. Method abandons ownership of results.
+    */
+    CMPXMedia* FindAllSyncL(const CMPXMedia& aCriteria,
+        const TArray<TMPXAttribute>& aAttrs);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Get the list of supported capabilities
+    * @return TCollectionCapability, bitmask of supported capabilities
+    */
+    TCollectionCapability GetCapabilities ();
+
+    /**
+    * From MMPXDbActiveTaskObserver
+    */
+    TBool HandleStepL();
+
+    /**
+    * From MMPXDbActiveTaskObserver
+    */
+    void HandleOperationCompleted(TInt aErr);
+
+private:
+    /**
+    * Constructor
+    */
+    CMPXDbPlugin();
+
+    /**
+    * Symbian 2nd phase constructor.
+    */
+    void ConstructL();
+
+    /**
+    * Process the OpenL command
+    * @param aPath a path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aFilter CMPXFilter Object
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXFilter* aFilter );
+
+    /**
+    * Process the OpenL(EBrowseAll) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowseAllL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process the OpenL(EBrowseArtist) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowseArtistL(const CMPXCollectionPath& aPath,
+        const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process the OpenL(EBrowseAlbum) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowseAlbumL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process the OpenL(EBrowsePlaylist) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowsePlaylistL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process the OpenL(EBrowseGenre) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowseGenreL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+       CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process the OpenL(EBrowseComposer) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowseComposerL(const CMPXCollectionPath& aPath,  const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process an OpenL command with a EMPXOpenPlaylistOnly open mode
+    * @param aPath path that we want to open
+    * @param aAttrs default attributes to fetch
+    * @return CMPXCollectionPath* which is the new valid browse path
+    */
+    CMPXCollectionPath* DoOpenPlaylistL( const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs );
+
+    /**
+    * Process the MediaL command
+    * @param aPath a path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries collection items containing media properties of all items, returned if opening a group of items
+    */
+    void DoMediaL (const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aEntries);
+
+    /**
+    * Get the plugin title, subtitle, icons for this plugin
+    * @param aAttrs attributes to find
+    * @param aMedia media object
+    */
+    void DoRootMediaL(const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia);
+
+    /**
+    * Get the media under ALL SONGS category
+    * @param aPath path that leads to a media under ALL SONGS
+    * @param aAttrs attributes of media to find
+    * @param aEntries the media referred by the path
+    * @param aMediaArray media entries contained in the media referred by the path
+    */
+    void DoAllSongsMediaL(const CMPXCollectionPath& aPath,
+                            const TArray<TMPXAttribute>& aAttrs,
+                            CMPXMedia& aEntries,
+                            CMPXMediaArray& aMediaArray);
+
+    /**
+    * Get the media under ARTISTS category
+    * @param aPath path that leads to a media under ARTISTS
+    * @param aAttrs attributes of media to find
+    * @param aEntries the media referred by the path
+    * @param aMediaArray media entries contained in the media referred by the path
+    */
+    void DoArtistMediaL(const CMPXCollectionPath& aPath,
+                          const TArray<TMPXAttribute>& aAttrs,
+                          CMPXMedia& aEntries,
+                          CMPXMediaArray& aMediaArray);
+
+    /**
+    * Get the root media under ALBUMS/PLAYLISTS/GENRES/COMPOSERS
+    * @param aAttrs attributes of media to find
+    * @param aRootCategoryId Id of the root media in the category, i.e. all albums,
+    *        ...etc.
+    * @param aCategory specifies the category. Will be either EMPXAlbum, EMPXPlaylist,
+    *        EMPXGenre, or EMPXComposer
+    * @param aEntries the media referred by the path
+    */
+    void DoRootCategoryMediaL(const TArray<TMPXAttribute>& aAttrs,
+                               TMPXItemId aRootCategoryId,
+                               TMPXGeneralCategory aCategory,
+                               CMPXMedia& aEntries);
+
+    /**
+    * Get the media under album/playlist/genre/composer category
+    * @param aPath path that leads to a media under ALBUMS/PLAYLISTS/GENRES/COMPOSERS
+    * @param aAttrs attributes of media to find
+    * @param aCategory specifies the category. Will be either EMPXAlbum, EMPXPlaylist,
+    *        EMPXGenre, or EMPXComposer
+    * @param aEntries the media referred by the path
+    * @param aMediaArray medias contained in the media referred by the path
+    */
+    void DoCategoryMediaL(const CMPXCollectionPath& aPath,
+                           const TArray<TMPXAttribute>& aAttrs,
+                           TMPXGeneralCategory aCategory,
+                           CMPXMedia& aEntries,
+                           CMPXMediaArray& aMediaArray);
+
+    /**
+    * Set all the attributes in CMPXMedia corresponding to KMPXMediaIdDrm
+    * @param aMedia, media to update
+    * @param aDrmAttributes, bitwise or of the flags we want
+    * @param aLocation, full file path including filename
+    */
+    void DoSetMediaDrmL(CMPXMedia& aMedia, TUint aDrmAttributes, const TDesC& aLocation);
+
+    /**
+    * Add media objects to the array with attributes from song details
+    * @param aPath a path
+    * @param aAttrs requested attributes
+    * @param aEntry media to contain information about the container if it contains
+    *        than one entry
+    * @param aMediaArray array to contain all the media objects added
+    */
+    void GetSongInfoL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntry, CMPXMediaArray& aMediaArray);
+
+    /**
+    * Add media objects to the array with attributes from song details
+    * @param aAttrs requested attributes
+    * @param aEntryId song ID
+    * @param aPlaylistId corresponding playlist ID, if 0 the attributes will be read from
+    *        the songs table, otherwise they will be read from the playlist table.
+    * @param aEntry media to contain information about the container if it contains
+    *        than one entry
+    */
+    void DoGetSongInfoL(const TArray<TMPXAttribute>& aAttrs, TInt aEntryId, TInt aPlaylistId,
+        CMPXMedia& aEntry);
+
+    /**
+    * Get the collection details from the db
+    * @param aAttrs, attributes to find
+    * @param aMedia, media object
+    */
+    void DoHandleOtherMediaAttributesL(const TArray<TMPXAttribute>& aAttrs,
+        const CMPXCollectionPath& aPath, CMPXMedia& aMedia);
+
+    /**
+    * Remove an item from the collection database using the given path
+    * Note that the selection indices are hidden within the path
+    * @param aPath path to the item to be removed
+    * @param aChangeMsgArray array to store change messages
+    * @return an array of files associated with the removed media entries
+    */
+    CDesCArray* DoRemoveL(const CMPXCollectionPath& aPath,
+        CMPXMessageArray& aChangeMsgArray);
+
+    /**
+    * Remove an item/items from the collection database using the given media properties
+    * @param aMedia: Properties of the item that is to be removed. It may cantain URI only
+    *                or meta data, all of items matched properties will be removed.
+    * @param aDeleteRecord: indicates whether the client has explictly requested
+    *                to delete the records from the database. If ETrue, records
+    *                associated with the media will be deleted from the database;
+    *                if EFalse, whether to mark the records as deleted or to delete
+    *                the records will be based on other deciding factors.
+    */
+    void DoRemoveL(const CMPXMedia& aMedia, TBool aDeleteRecord);
+
+    /**
+    * Remove an item from the collection database using a command
+    * @param aCmd: remove command which contains collection path to the media(s) to be
+    *        removed. This method should be called until all the selected items are
+    *        removed. When that happens, EMPXCommandCompleted flag is set to ETrue.
+    *        see KMPXCommandIdCollectionRemove in mpxcollectioncommanddefs.h
+    */
+    void DoRemovePathL(CMPXCommand& aCmd);
+
+    /**
+    * Remove a media/medias from the collection database using a command
+    * @param aCmd: remove command which contains the media(s) to be removed. This
+    *        will delete the records from the database rather than marking them
+    *        as deleted. Designated caller is MTP.
+    */
+    void DoRemoveMediaL(CMPXCommand& aCmd);
+
+    /**
+    * Remove a media/medias from all songs view
+    * @param aPath, collection path that points to the media items to be removed
+    * @param aSelections, multiple media items selected. This array contains the id
+    *        of the selected media.
+    * @param aUriArray: a descriptor array containing the URI(s) of the deleted file(s)
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void DoRemoveFromAllSongsL(const CMPXCollectionPath& aPath,
+                               const TArray<TMPXItemId>& aSelections,
+                               CDesCArray& aUriArray,
+                               CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media/medias from artists view
+    * @param aPath, collection path that points to the media(s) to be removed
+    * @param aSelections, multiple media items selected. This array contains the id
+    *        of the selected media.
+    * @param aUriArray: a descriptor array to contain the URI of the deleted file
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void DoRemoveFromArtistsL(const CMPXCollectionPath& aPath,
+                              const TArray<TMPXItemId>& aSelections,
+                              CDesCArray& aUriArray,
+                              CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media/medias from artists view
+    * @param aPath, collection path that points to the media(s) to be removed
+    * @param aItemId media item to be removed.
+    * @param aUriArray: a descriptor array to contain the URI of the deleted file
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void RemoveFromArtistsL(const CMPXCollectionPath& aPath,
+                                TUint32 aItemId,
+                                CDesCArray& aUriArray,
+                                CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media entry/entries from albums/genres/composers view
+    * @param aPath, collection path that points to the media entry/entries to be removed
+    * @param aSelections, multiple media entries selected. This array contains the id
+    *        of the selected media.
+    * @param aCategory, indicates one of the 3 categories, EMPXAlbum, EMPXGenre, or
+    *        EMPXComposer
+    * @param aUriArray: a descriptor array to contain the URI(s) of the deleted file(s)
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void DoRemoveFromCategoriesL(const CMPXCollectionPath& aPath,
+                                 const TArray<TMPXItemId>& aSelections,
+                                 TMPXGeneralCategory aCategory,
+                                 CDesCArray& aUriArray,
+                                 CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media entry from albums/genres/composers view
+    * @param aPath, collection path that points to the media entry/entries to be removed
+    * @param aItemId item ID to be removed.
+    * @param aCategory, indicates one of the 3 categories, EMPXAlbum, EMPXGenre, or
+    *        EMPXComposer
+    * @param aUriArray: a descriptor array to contain the URI(s) of the deleted file(s)
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void RemoveFromCategoriesL(const CMPXCollectionPath& aPath,
+                                TUint32 aItemId,
+                                TMPXGeneralCategory aCategory,
+                                CDesCArray& aUriArray,
+                                CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media entry/entries from playlists view
+    * @param aPath, collection path that points to the media(s) to be removed
+    * @param aSelections, multiple medias selected. This array contains the id
+    *        of the selected media.
+    * @param aUriArray: a descriptor array to contain the URI of the deleted file
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void DoRemoveFromPlaylistsL(const CMPXCollectionPath& aPath,
+                                const TArray<TMPXItemId>& aSelections,
+                                CDesCArray& aUriArray,
+                                CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media entry/entries from playlists view
+    * @param aPath, collection path that points to the media(s) to be removed
+    * @param aItemId item to be removed
+    * @param aIndex item index to be removed
+    * @param aUriArray: a descriptor array to contain the URI of the deleted file
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void RemoveFromPlaylistsL(const CMPXCollectionPath& aPath,
+                                const TMPXItemId& aItemId,
+                                TInt aIndex,
+                                CDesCArray& aUriArray,
+                                CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Retrieves URIs associated with the path for file deletion
+    * @param aCmd, command to retrieve associated URIs for the given path. If
+    *        path ends with a particular artist/album/genre/composer, the path
+    *        will be updated to include all songs in that category. If path
+    *        ends with one or more medias in a particular playlist, an array
+    *        of 0 elements will be returned to avoid client deleting them from
+    *        the file system. see KMPXCommandIdCollectionRetrieveUriForDeletion
+    *        defined in mpxcollectioncommanddefs.h
+    */
+    void DoRetrieveUriForDeletionL(CMPXCommand& aCmd);
+
+    /**
+    * Deletes records which have been marked as deleted from the collection
+    * @param aCmd command to cleanup deleted medias.
+    *        see KMPXCommandIdCollectionCleanupDeletedRecords defined in
+    *        mpxcollectioncommanddefs.h
+    */
+    void CleanupDeletedRecordsL(CMPXCommand& aCmd);
+
+    /**
+    * Fetch the duration for a specific category
+    * @param aMedia a media object of which EMPXMediaGeneralDuration is to be
+    *        populated with the duration calculated in this method
+    * @param aFirstCat category of the 1st Id
+    * @param aId id for identifying which category to calculate the duration for
+    * @param aSecondCat category of the 2nd Id
+    * @param aSubId 2nd id for identifying which category to calculate the
+    *        duration for. For example, to calculate the duration of an album of
+    *        a particular artist, 1st Id provided will be the artist Id and the
+    *        2nd Id provided will be the album Id.
+    */
+    TInt DoDurationL(CMPXMedia& aMedia, TMPXGeneralCategory aFirstCat, TMPXItemId aId = 0,
+                      TMPXGeneralCategory aSecondCat = EMPXNoCategory, TMPXItemId aSubId = 0);
+
+    /**
+    * Append a collection level to the collection path
+    * @param aPath, path to append the level to
+    * @param aMedia, media to extract media ids from
+    * @note: Selection will be put on the first song in the collection path
+    */
+    TInt DoAppendLevelL(CMPXCollectionPath& aPath, CMPXMedia& aMedia);
+
+    /**
+    * Append a collection level to the collection path with all songs under the
+    * selected category/categories (e.g. artist/artist-album/album/genre/composer).
+    * Once the level is appended, all songs under the selected category/categories
+    * are selected.
+    * @param aPath, path to append the level to. Path remains unchanged if it's not
+    *        one of the following:
+    *        1) path ends at an artist or selected artists
+    *        2) path ends at an album of an artist or selected albums of an artist
+    *        3) path ends at an album or selected albums
+    *        4) path ends at a genre or selected genres
+    *        5) path ends at a composer or selected composers
+    */
+    void DoAppendLevelL(CMPXCollectionPath& aPath);
+
+    /**
+    * Execute a task step for an asynchronous add
+    */
+    TBool DoAddAsyncL();
+
+    /**
+    * Add a media object to the collection
+    * @param aMedia media to add
+    * @return TUint32 item id of the item added
+    */
+    TUint32 DoAddL(const CMPXMedia& aMedia);
+
+    /**
+    * Add an item into the collection
+    * @param aMedia media to add
+    * @param aMessageArray change message array
+    */
+    TUint32 DoAddItemL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray,
+                        TBool aBatchCommit = EFalse);
+
+    /**
+    * Set a media object to update the collection
+    * @param aMedia media can be an item or a list. The item is treated as a list
+    *               if it contains a media array
+    */
+    void DoSetL(const CMPXMedia& aMedia);
+
+    /**
+    * Execute a task step for an asynchronous set
+    */
+    TBool DoSetAsyncL();
+
+    /**
+    * Set an item media to update the collection
+    * @param aMedia media to update
+    * @param aMessageArray array to append change messages
+    * @return ETrue if the update is UI visible, EFalse otherwise
+    */
+    CMPXDbActiveTask::TChangeVisibility DoSetItemL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray);
+
+    /**
+    * Set the drm properties for an array of medias
+    * @param mediaArray CMPXMediaArray list of medias
+    * @param aAtts attribute list
+    */
+    void DoSetDrmForArrayL(const CMPXMediaArray& mediaArray,
+                            const TArray<TMPXAttribute>& aAttrs);
+
+    /**
+    * Send a change message
+    *
+    * @param aMessage: a change message to be sent
+    */
+    void HandleChangeL(const CMPXMessage& aMessage);
+
+    /**
+    * Construct a CMPXMedia from the array parameter and call HandleChange
+    *
+    * @param aItemChangedMessages: array in the change message to be sent
+    * @param aCommandid command that was executed
+    */
+    void DoHandleChangeL(CMPXMessageArray* aItemChangedMessages,
+                         TMPXCommandId aCommandId = 0 );
+
+    /**
+    * Returns the category for a given browse type.
+    *
+    * @param aBrowseType browse type
+    * @return Category ID
+    */
+    TMPXGeneralCategory CategoryForBrowseType(TMCBrowseType aBrowseType);
+
+    /**
+    * Returns the browse type for a given category ID.
+    *
+    * @param aCategory category ID
+    * @return Browse type
+    */
+    TMCBrowseType BrowseTypeForCategory(TMPXGeneralCategory aCategory);
+
+    /**
+    * Sets the type, category and title attributes in the specified media.
+    *
+    * @param aMedia media instance to be updated
+    * @param aType type attribute value
+    * @param aCategory category attribute value
+    * @param aTitle title attribute value
+    */
+    void SetMediaGeneralAttributesL(CMPXMedia& aMedia, TMPXGeneralType aType,
+        TMPXGeneralCategory aCategory, const TDesC& aTitle);
+
+    /**
+    * Sets the type, category and title attributes in the specified media.
+    *
+    * @param aMedia media instance to be updated
+    * @param aType type attribute value
+    * @param aCategory category attribute value
+    * @param aId ID of the item to the title from
+    */
+    void SetMediaGeneralAttributesL(CMPXMedia& aMedia, TMPXGeneralType aType,
+        TMPXGeneralCategory aCategory, TInt aId);
+
+    /**
+    * Leaving function to handle async op completion
+    * @param aErr error code
+    */
+    void DoHandleOperationCompletedL(TInt aErr);
+
+    /**
+    * Complete a delete operation
+    * Sends out change messages and compacts the database
+    */
+    void DoHandleDeleteCompleteL( CMPXCommand& aCmd );
+
+    /**
+    * Reorder a song in a playlist
+    * @param aCmd command to reoder a song in a playlist
+    *        see KMPXCommandIdReorderPlaylist defined in
+    *        mpxcollectioncommanddefs.h
+    */
+    void DoReorderPlaylistL( const CMPXCommand& aCmd );
+
+    /**
+    * Get total song and playlist count
+    * @param aCmd command to return count
+    *        see KMPXCommandCollectionGetCount defined in
+    *        mpxcollectioncommanddefs.h
+    */
+    void DoGetCollectionCountL( const CMPXCommand& aCmd );
+
+    /**
+    * Get an array of URIs for all songs and playlists in a given db
+    * @param aCmd command to return CDesCArray
+    *        see KMPXCommandCollectionGetURIs defined in
+    *        mpxcollectioncommanddefs.h
+    */
+    void DoGetCollectionUriL( const CMPXCommand& aCmd );
+
+    /**
+    * Perform 1 step of the incremental read operation
+    * @param aCmd Command to process
+    */
+    void DoIncrementalOpenL( const CMPXCommand& aCmd );
+
+    /**
+    * Open the all songs view incrementally
+    * @param aPath path that leads to a media under ALL SONGS
+    * @param aAttrs attributes of media to find
+    * @param aEntries the media referred by the path
+    * @param aMediaArray media entries contained in the media referred by the path
+    */
+    TBool DoOpenIncrementalL( const CMPXCollectionPath& aPath,  const TArray<TMPXAttribute>& aAttrs,
+                              CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Set the attribute list according to current path
+    * @param aPath a path
+    * @param aAttrs attributes array to be filled
+    * @param aSupportedIds array of supported content IDs to be filled
+    */
+    void SetAttributesL( const CMPXCollectionPath& aPath, RArray<TMPXAttribute>& aAttrs,
+                         RArray<TInt>& aSupportedIds );
+
+#ifdef _DEBUG
+    /**
+    * Prints messages for debugging
+    * @param aMessage: message(s) to be printed
+    */
+    void PrintMessagesL(const CMPXMessage& aMessage);
+
+    /**
+    * Prints a single message for debugging
+    * @param aMessage: a message to be printed
+    */
+    void PrintMessage(const CMPXMessage& aMessage);
+#endif // _DEBUG
+
+private:
+    // owned member variables
+    RFs                  iFs;
+    CMPXResource*        iResource;
+    CMPXDbHandler*       iDbHandler;
+    CMPXDrmMediaUtility* iDrmMediaUtility;
+    CDesCArrayFlat*      iMusicLibraryMenuTitles;      // titles for each of the menu items
+    CDesCArrayFlat*      iMusicLibraryTitles;          // titles for each of the category views
+    RArray<TInt>         iMusicLibraryMenuIds;         // music library item menu IDs
+    HBufC*               iAllSongsForArtistTitle;
+    HBufC*               iMusicMenuTitle;
+    HBufC*               iShuffleAllText;
+    TBool                iDisablePodcasting;
+    TBool                iMtpInUse;
+    TBool                iRefreshing;
+    CMPXDbActiveTask*    iActiveTask;
+    RArray<TMPXItemId>   iSelections;   //selected items in the path
+    TBool iFirstDeleteStep;
+    TBool iAllSongsValid;    //to indicate if there's enough space to get all songs information from collection DB.
+    };
+
+#endif   // MPXDBPLUGIN_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbpluginqueries.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,403 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  SQLite queries for MPX collection db
+*
+*/
+
+
+#ifndef MPXDBPLUGINQUERIES_H
+#define MPXDBPLUGINQUERIES_H
+
+// SQLite queries
+
+// == Music table queries =====================================================
+//
+_LIT(KMusicCreateTable, "CREATE TABLE Music("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"DbFlag INTEGER,"
+    L"VolumeId INTEGER,"
+    L"Title TEXT COLLATE NOCASE,"
+    L"Artist INTEGER,"
+    L"Art TEXT,"
+    L"Deleted INTEGER DEFAULT 0,"
+    L"Location TEXT,"
+    L"AlbumTrack INTEGER,"
+    L"PlayCount INTEGER DEFAULT 0,"
+    L"TimeAdded TEXT,"
+    L"TimePlayed TEXT DEFAULT '',"
+    L"Duration INTEGER,"
+    L"Sync INTEGER DEFAULT 0,"
+    L"Modified INTEGER DEFAULT 0,"
+    L"Album INTEGER,"
+    L"Genre INTEGER,"
+    L"Composer INTEGER,"
+    L"ReleaseDate TEXT DEFAULT '',"
+    L"Rating INTEGER,"
+    L"Comment TEXT,"
+    L"Copyright TEXT,"
+    L"Url TEXT,"
+    L"DRM INTEGER,"
+    L"LastPlayPosition INTEGER DEFAULT 0,"
+    L"SampleRate INTEGER,"
+    L"BitRate INTEGER,"
+    L"NumChannels INTEGER,"
+    L"Codec INTEGER,"
+    L"MimeType TEXT,"
+    L"MTPDrmStatus INTEGER)");
+
+_LIT(KMusicDropTable,"DROP TABLE Music");
+_LIT(KMusicCheckTable,"SELECT UniqueId,Title,Location,Artist,Album,AlbumTrack,Genre,Composer,Duration,ReleaseDate,TimeAdded,PlayCount,TimePlayed,Rating,Comment,Copyright,Art,DbFlag,Sync,Modified,Deleted,Url,DRM,LastPlayPosition,SampleRate,BitRate,VolumeId,NumChannels,Codec,MimeType,MTPDrmStatus FROM Music");
+
+// indexes
+_LIT(KMusicDeletedIdIndex,"CREATE INDEX IndexMusicDeletedId ON Music(Deleted,UniqueId)");
+_LIT(KMusicDeletedTitleIndex,"CREATE INDEX IndexMusicDeletedTitle ON Music(Deleted,Title)");
+_LIT(KMusicDeletedArtistTitleIndex,"CREATE INDEX IndexMusicArtistDeletedTitle ON Music(Artist,Deleted,Title)");
+_LIT(KMusicDeletedAlbumTitleIndex,"CREATE INDEX IndexMusicAlbumDeletedTitle ON Music(Album,Deleted,Title)");
+_LIT(KMusicDeletedAlbumTrackTitleIndex,"CREATE INDEX IndexMusicAlbumDeletedTrackTitle ON Music(Album,Deleted,AlbumTrack,Title)");
+_LIT(KMusicDeletedGenreTitleIndex,"CREATE INDEX IndexMusicGenreDeletedTitle ON Music(Genre,Deleted,Title)");
+_LIT(KMusicDeletedComposerTitleIndex,"CREATE INDEX IndexMusicComposerDeletedTitle ON Music(Composer,Deleted,Title)");
+
+_LIT(KQueryMusicInsert, "INSERT INTO :dbname.Music(%S) VALUES(%S)");
+_LIT(KQueryMusicUpdate, "UPDATE :dbname.Music SET %S WHERE UniqueId=%u");
+_LIT(KQueryMusicDelete, "DELETE FROM :dbname.Music WHERE UniqueId=%u");
+_LIT(KQueryMusicDeleteUpdate, "UPDATE :dbname.Music SET Deleted=1 WHERE UniqueId=%u");
+_LIT(KQueryMusicDeleteForCategory, "UPDATE :dbname.Music SET Deleted=0 WHERE %S=%u");
+_LIT(KQueryMusicCleanup, "DELETE FROM :dbname.Music WHERE Deleted=1");
+
+// Note: The no categories queries below only retrieve a limited number of fields from the Music table
+//       as opposed to *. This is an optimization that matches the DBMS version of the plugin and assumes
+//       that the client only requests those fields. From the C++ code perspective there is no difference
+//       in processing as the five fields in question reside at the beginning of the table. If the client
+//       is modified to request more attributes then the queries below will have to be changed to return *.
+//
+//       As far as performance goes, the queries that only return six fields are a little faster than
+//       the ones that return *, for example, for a * query that takes 2.1 seconds the equivalent
+//       optimized query is faster by more than 100ms.
+
+_LIT(KQueryMusicGetSong, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.UniqueId=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId");
+
+// LTAN-79N8ND: temporary fix.  Symbian 9.4 SQLite cannot resolve column number correctly,
+// Use column number instead of column name for ORDER BY, needed when FROM uses more than 1 table
+// calculate column number from SELECT fields, first field is column 1 (not 0)
+/*
+_LIT(KQueryMusicGetAllSongs, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.Title");
+_LIT(KQueryMusicGetSongsForArtist, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Artist=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.Title");
+_LIT(KQueryMusicGetSongsForAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.AlbumTrack, Music.Title");
+_LIT(KQueryMusicGetSongsForUnknownAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.Title");
+_LIT(KQueryMusicGetSongsForArtistAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Artist=%u AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.AlbumTrack, Music.Title");
+_LIT(KQueryMusicGetSongsForGenre, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Genre=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.Title");
+_LIT(KQueryMusicGetSongsForComposer, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Composer=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.Title");
+_LIT(KQueryMusicGetRecentlyPlayed, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.TimePlayed<>'' AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetMostPlayed, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.PlayCount<>0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY PlayCount DESC, TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetRecentlyAdded, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND (julianday(Music.TimeAdded)>julianday('now','-7 days')) AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.TimeAdded DESC");
+*/
+_LIT(KQueryMusicGetAllSongs, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
+_LIT(KQueryMusicGetSongsForArtist, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Artist=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
+_LIT(KQueryMusicGetSongsForAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 9, 4");
+_LIT(KQueryMusicGetSongsForUnknownAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
+_LIT(KQueryMusicGetSongsForArtistAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Artist=%u AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 9, 4");
+_LIT(KQueryMusicGetSongsForGenre, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Genre=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
+_LIT(KQueryMusicGetSongsForComposer, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Composer=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
+_LIT(KQueryMusicGetRecentlyPlayed, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.TimePlayed<>'' AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 12 DESC LIMIT %u");
+_LIT(KQueryMusicGetMostPlayed, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.PlayCount<>0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY PlayCount DESC, TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetRecentlyAdded, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND (julianday(Music.TimeAdded)>julianday('now','-7 days')) AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 11 DESC");
+
+_LIT(KQueryMusicSong, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE %S");
+_LIT(KQueryMusicFindAll, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE %S AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId %S");
+
+// LTAN-79N8ND: temporary fix.  Symbian 9.4 SQLite cannot resolve column number correctly,
+// Use column number instead of column name for ORDER BY, needed when FROM uses more than 1 table
+// calculate column number from SELECT fields, first field is column 1 (not 0)
+/*
+_LIT(KQueryMusicFindAllSortOrderTrack, "ORDER BY Music.AlbumTrack,Music.Title");
+_LIT(KQueryMusicFindAllSortOrderTitle, "ORDER BY Music.Title");
+*/
+_LIT(KQueryMusicFindAllSortOrderTrack, "ORDER BY 9, 4");
+_LIT(KQueryMusicFindAllSortOrderTitle, "ORDER BY 4");
+
+// no categories queries
+_LIT(KQueryMusicGetSongNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryMusicGetAllSongsNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 ORDER BY Title");
+_LIT(KQueryMusicGetSongsForArtistNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 AND Artist=%u ORDER BY Title");
+_LIT(KQueryMusicGetSongsForAlbumNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location,AlbumTrack FROM :dbname.Music WHERE Deleted=0 AND Album=%u ORDER BY AlbumTrack,Title");
+_LIT(KQueryMusicGetSongsForUnknownAlbumNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 AND Album=%u ORDER BY Title");
+_LIT(KQueryMusicGetSongsForArtistAlbumNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location,AlbumTrack FROM :dbname.Music WHERE Deleted=0 AND Artist=%u AND Album=%u ORDER BY AlbumTrack,Title");
+_LIT(KQueryMusicGetSongsForGenreNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 AND Genre=%u ORDER BY Title");
+_LIT(KQueryMusicGetSongsForComposerNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 AND Composer=%u ORDER BY Title");
+_LIT(KQueryMusicGetRecentlyPlayedNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND TimePlayed<>'' ORDER BY TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetMostPlayedNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location,PlayCount,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND PlayCount<>0 ORDER BY PlayCount DESC, TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetRecentlyAddedNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location,TimeAdded FROM :dbname.Music WHERE Deleted=0 AND (julianday(TimeAdded)>julianday('now','-7 days')) ORDER BY TimeAdded DESC");
+
+_LIT(KQueryMusicGetSongsInBlockAsc, "SELECT Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,Music.Artist,Music.Art,0,'',0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId AND Title > :title ORDER BY 4 ASC LIMIT :limit");
+_LIT(KQueryMusicGetSongsInBlockDsc, "SELECT Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,Music.Artist,Music.Art,0,'',0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId AND Title < :title ORDER BY 4 DESC LIMIT :limit");
+_LIT(KQueryMusicGetSongsAtOffset, "SELECT Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,Music.Artist,Music.Art,0,'',0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId ORDER BY 4 LIMIT :limit OFFSET :offset");
+_LIT(KQueryMusicGetSongsLimited, "Select Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,Music.Artist,Music.Art,0,'',0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId ORDER BY 4 LIMIT %u");
+
+_LIT(KQueryMusicGetUri, "SELECT Location,VolumeId FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryMusicGetTitle, "SELECT Title FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryMusicGetMusicUris, "SELECT UniqueId,Location FROM :dbname.Music WHERE Deleted=0 ORDER BY UniqueId ASC LIMIT %u");
+_LIT(KQueryMusicGetMusicUrisFrom, "SELECT UniqueId,Location FROM :dbname.Music WHERE Deleted=0 AND UniqueId > %u ORDER BY UniqueId ASC LIMIT %u");
+
+_LIT(KQueryMusicCount, "SELECT count(*) FROM :dbname.Music WHERE Deleted=0");
+_LIT(KQueryMusicAlbum, "SELECT DISTINCT Album FROM :dbname.Music WHERE Deleted=0 AND Artist=%u ORDER BY Album");
+_LIT(KQueryMusicVolume, "SELECT VolumeId FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryMusicVolumeAll, "SELECT VolumeId FROM :dbname.Music WHERE UniqueId=%u");
+_LIT(KQueryMusicInfo, "SELECT * FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryOtherSongsInArtistAlbum, "SELECT count(*) FROM :dbname.Music WHERE Deleted=0 AND UniqueId<>%u AND Artist=%u AND Album=%u");
+
+_LIT(KQueryMusicDurationAll, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0");
+_LIT(KQueryMusicDurationArtist, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND Artist=%u");
+_LIT(KQueryMusicDurationAlbum, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND Album=%u");
+_LIT(KQueryMusicDurationArtistAlbum, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND Artist=%u AND Album=%u");
+_LIT(KQueryMusicDurationGenre, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND Genre=%u");
+_LIT(KQueryMusicDurationComposer, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND Composer=%u");
+_LIT(KQueryMusicDurationRecentlyPlayed, "SELECT sum(Duration) FROM (SELECT Duration,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND TimePlayed<>'' ORDER BY TimePlayed DESC LIMIT %u)");
+_LIT(KQueryMusicDurationMostPlayed, "SELECT sum(Duration) FROM (SELECT Duration,PlayCount,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND PlayCount<>0 ORDER BY PlayCount DESC,TimePlayed DESC LIMIT %u)");
+_LIT(KQueryMusicDurationRecentlyAdded, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND (julianday(TimeAdded) > julianday('now','-7 days'))");
+
+_LIT(KQueryMusicGetDurationRecentlyPlayed, "SELECT Duration,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND TimePlayed<>'' ORDER BY TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetDurationMostPlayed, "SELECT Duration,PlayCount,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND PlayCount<>0 ORDER BY PlayCount DESC,TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetDurationRecentlyAdded, "SELECT Duration FROM :dbname.Music WHERE Deleted=0 AND (julianday(TimeAdded) > julianday('now','-7 days'))");
+
+// Select songs information from music, playlistsongs and playlistsonginfo via playlistid order by playlistsongs's ordinal
+_LIT(KQueryMusicGetAllSongsbyPl,"select mu.UniqueId,mu.DbFlag,mu.VolumeId,mu.Title,mu.Artist,mu.Art,0,mu.Location,pl.UniqueId as PlUId, pl.ordinal from :dbname.music as mu,:pldbname.playlistsongs as pl where mu.Deleted=0 AND mu.uniqueid = pl.songid and pl.playlistid =%u ORDER BY 10");
+_LIT(KQueryMusicGetAllSongsInfobyPl,"SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name,pl.UniqueId as PlUId,pl.ordinal FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer,:pldbname.playlistsongs as pl WHERE Music.Deleted=0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId AND Music.UniqueId=pl .songid and pl .PlaylistId=%u ORDER BY 37");
+
+_LIT(KQuerySongsInArtistAlbum, "SELECT count(*) FROM :dbname.Music WHERE Deleted=0 AND Artist=%u AND Album=%u");
+_LIT(KQueryMusicGetArtistForAlbum, "SELECT Artist FROM :dbname.Music,:dbname.Artist WHERE Music.Deleted=0 AND Music.Artist=Artist.UniqueId AND Music.Album=%u");
+
+// == Category table queries ==================================================
+//
+_LIT(KCategoryTablePlaceholder, "##table##");
+
+_LIT(KCategoryCreateTable,"CREATE TABLE ##table##("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"Name TEXT COLLATE NOCASE,"
+    L"SongCount INTEGER)");
+
+_LIT(KCategoryDropTable,"DROP TABLE ##table##");
+_LIT(KCategoryCheckTable,"SELECT UniqueId,Name,SongCount FROM ##table##");
+_LIT(KCategoryNameIndex,"CREATE INDEX Index##table##Name ON ##table##(Name)");
+
+_LIT(KQueryCategoryInsert, "INSERT INTO :dbname.##table##(UniqueId,Name,SongCount) VALUES(%u,'%S',%u)");
+_LIT(KQueryCategoryDelete, "DELETE FROM :dbname.##table## WHERE UniqueId=%u");
+
+_LIT(KQueryCategoryCount, "SELECT count(*) FROM :dbname.##table##");
+_LIT(KQueryCategoryItem, "SELECT * FROM :dbname.##table## WHERE UniqueId=%u");
+_LIT(KQueryCategoryItemBySongId, "SELECT ##table##.* FROM :dbname.##table##,:dbname.Music WHERE Music.Deleted=0 AND Music.UniqueId=%u AND ##table##.UniqueId=Music.%S");
+_LIT(KQueryCategoryAll, "SELECT * FROM :dbname.##table## ORDER BY Name");
+_LIT(KQueryCategoryItems, "SELECT * FROM :dbname.##table## WHERE %S ORDER BY Name ASC");
+_LIT(KQueryCategorySongCount, "SELECT SongCount FROM :dbname.##table## WHERE UniqueId=%u");
+_LIT(KQueryCategorySubcategoryItems, "SELECT Album.* FROM :dbname.Album,:dbname.Music WHERE Music.Deleted=0 AND Music.Artist=%u AND Album.UniqueId=Music.Album ORDER BY Name");
+
+_LIT(KQueryCategoryIncrementSongCount, "UPDATE :dbname.##table## SET SongCount=SongCount+1 WHERE UniqueId=%u");
+_LIT(KQueryCategoryDecrementSongCount, "UPDATE :dbname.##table## SET SongCount=SongCount-1 WHERE UniqueId=%u");
+_LIT(KQueryCategoryGetSongCount, "SELECT SongCount FROM :dbname.##table## WHERE UniqueId=%u");
+
+// == Auxiliary table queries =================================================
+//
+_LIT(KAuxiliaryCreateTable, "CREATE TABLE Auxiliary("
+    L"Id INTEGER,"
+    L"Version TEXT,"
+    L"TimeRefreshed TEXT,"
+    L"TimeSynced TEXT,"
+    L"Corrupt INTEGER DEFAULT 0,"
+    L"SaveDeletedRecordCount INTEGER DEFAULT 0)");
+_LIT(KAuxiliaryDropTable,"DROP TABLE Auxiliary");
+_LIT(KAuxiliaryCheckTable, "SELECT Id,Version,TimeRefreshed,TimeSynced,Corrupt,SaveDeletedRecordCount FROM AUXILIARY");
+_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.4.0',%u)");
+
+_LIT(KQueryAuxiliarySetTime, "UPDATE :dbname.Auxiliary SET TimeRefreshed='%S', Corrupt=0");
+_LIT(KQueryAuxiliaryGetTime, "SELECT TimeRefreshed FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliarySetCorrupt, "UPDATE :dbname.Auxiliary SET Corrupt=%u");
+_LIT(KQueryAuxiliaryGetCorrupt, "SELECT Corrupt FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliaryGetCount, "SELECT SaveDeletedRecordCount FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliarySetCount, "UPDATE :dbname.Auxiliary SET SaveDeletedRecordCount=%u");
+_LIT(KQueryAuxiliaryGetId, "SELECT Id FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliarySetId, "UPDATE :dbname.Auxiliary SET Id=%u");
+
+// == Playlist table queries ==================================================
+//
+_LIT(KPlaylistCreateTable, "CREATE TABLE Playlist("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"VolumeId INTEGER,"
+    L"DbFlag INTEGER,"
+    L"Sync INTEGER,"
+    L"Name TEXT COLLATE NOCASE,"
+    L"Uri TEXT,"
+    L"Time TEXT)");
+_LIT(KPlaylistDropTable,"DROP TABLE Playlist");
+_LIT(KPlaylistCheckTable, "SELECT UniqueId,Name,Uri,VolumeId,Sync,DbFlag,Time FROM Playlist");
+_LIT(KPlaylistNameIndex,"CREATE INDEX IndexPlaylistName ON Playlist(Name)");
+
+_LIT(KQueryPlaylistInsert, "INSERT INTO :dbname.Playlist(UniqueId,Name,Uri,VolumeId,Sync,DbFlag,Time) VALUES(%u,'%S','%S',%u,0,%u,'%S')");
+_LIT(KQueryPlaylistUpdate, "UPDATE :dbname.Playlist SET %S WHERE UniqueId=%u");
+_LIT(KQueryPlaylistUpdateTime, "UPDATE :dbname.Playlist SET Time='%S' WHERE UniqueId=%u");
+_LIT(KQueryPlaylistUpdateTimeForSong, "UPDATE :dbname.Playlist SET Time='%S' WHERE UniqueId IN (SELECT DISTINCT PlaylistId FROM :dbname.PlaylistSongs WHERE SongId=%u)");
+_LIT(KQueryPlaylistDeleteAll, "DELETE FROM :dbname.Playlist");
+_LIT(KQueryPlaylistDelete, "DELETE FROM :dbname.Playlist WHERE UniqueId=%u");
+
+_LIT(KQueryPlaylistCount, "SELECT count(*) FROM :dbname.Playlist");
+_LIT(KQueryPlaylistGetAll, "SELECT * FROM :dbname.Playlist ORDER BY Name ASC");
+_LIT(KQueryPlaylistGet, "SELECT * FROM :dbname.Playlist WHERE UniqueId=%u");
+_LIT(KQueryPlaylistDuration, "SELECT sum(Music.Duration) FROM :dbname.Music,:dbname.Playlist,:dbname.PlaylistSongs WHERE Music.UniqueId=PlaylistSongs.SongId AND PlaylistSongs.PlaylistId=%u");
+_LIT(KQueryPlaylistId, "SELECT UniqueId FROM :dbname.Playlist WHERE Uri='%S'");
+_LIT(KQueryLikePlaylistId, "SELECT UniqueId FROM :dbname.Playlist WHERE Uri LIKE '%%%%%S%%%%' ESCAPE '\\'");
+_LIT(KQueryPlaylistDriveId, "SELECT VolumeId FROM :dbname.Playlist WHERE UniqueId=%u");
+_LIT(KQueryPlaylistItems, "SELECT * FROM :dbname.Playlist WHERE %S ORDER BY Name ASC");
+_LIT(KQueryPlaylistGetForSong, "SELECT DISTINCT PlaylistId FROM :dbname.PlaylistSongs WHERE SongId=%u");
+_LIT(KQueryPlaylistFileCount, "SELECT count(*) FROM :dbname.Playlist WHERE Uri LIKE '%%.m3u'");
+//see "Efficient Use of Symbinan SQL How-To Document" for details about following queries:
+_LIT(KQueryPlaylistGetFileUris, "SELECT UniqueId,Uri FROM :dbname.Playlist WHERE Uri LIKE '%%%%.m3u' ORDER BY UniqueId ASC LIMIT %u");
+_LIT(KQueryPlaylistGetFileUrisFrom, "SELECT UniqueId,Uri FROM :dbname.Playlist WHERE Uri LIKE '%%%%.m3u' AND UniqueId > %u ORDER BY UniqueId ASC LIMIT %u");
+
+// == PlaylistSongs table queries =============================================
+//
+_LIT(KPlaylistSongsCreateTable, "CREATE TABLE PlaylistSongs("
+    L"UniqueId INTEGER PRIMARY KEY AUTOINCREMENT,"
+    L"SongId INTEGER,"
+    L"PlaylistId INTEGER,"
+    L"Ordinal INTEGER)");
+_LIT(KPlaylistSongsDropTable,"DROP TABLE PlaylistSongs");
+_LIT(KPlaylistSongsCheckTable, "SELECT UniqueId,SongId,PlaylistId,Ordinal FROM PlaylistSongs");
+
+_LIT(KQueryPlaylistSongsInsert, "INSERT INTO :dbname.PlaylistSongs(PlaylistId,SongId,Ordinal) VALUES(%u,%u,%u)");
+_LIT(KQueryPlaylistSongsUpdate, "UPDATE :dbname.PlaylistSongs SET SongId=%u WHERE SongId=%u");
+_LIT(KQueryPlaylistSongsUpdatePlaylistId, "UPDATE :dbname.PlaylistSongs SET PlaylistId=%u WHERE PlaylistId=%u");
+_LIT(KQueryPlaylistSongsDelete, "DELETE FROM :dbname.PlaylistSongs WHERE SongId=%u");
+_LIT(KQueryPlaylistSongsDeleteAll, "DELETE FROM :dbname.PlaylistSongs");
+_LIT(KQueryPlaylistSongsDeletePlaylist, "DELETE FROM :dbname.PlaylistSongs WHERE PlaylistId=%u");
+_LIT(KQueryPlaylistSongsDeleteSong, "DELETE FROM :dbname.PlaylistSongs WHERE PlaylistId=%u AND SongId=%u");
+_LIT(KQueryPlaylistSongsDeleteSongOrdinal, "DELETE FROM :dbname.PlaylistSongs WHERE PlaylistId=%u AND SongId=%u AND Ordinal=%u");
+_LIT(KQueryPlaylistSongsDeleteForCategory, "DELETE FROM :dbname.PlaylistSongs WHERE PlaylistSongs.SongId=Music.UniqueId AND Music.%S=%u");
+_LIT(KQueryPlaylistSongsDeleteForArtistAlbum, "DELETE FROM :dbname.PlaylistSongs WHERE PlaylistSongs.SongId=Music.UniqueId AND Music.Artist=%u AND Music.Album=%u");
+
+_LIT(KQueryPlaylistSongsCount, "SELECT count(*) FROM :dbname.PlaylistSongs WHERE PlaylistId=%u");
+_LIT(KQueryPlaylistSongsPlaylistSongCount, "SELECT count(*) FROM :dbname.PlaylistSongs WHERE PlaylistId=%u AND SongId=%u");
+_LIT(KQueryPlaylistSongsSongCount, "SELECT count(*) FROM :dbname.PlaylistSongs WHERE SongId=%u");
+_LIT(KQueryPlaylistSongsGetSongs, "SELECT UniqueId,SongId,Ordinal FROM :dbname.PlaylistSongs WHERE PlaylistId=%u ORDER BY Ordinal");
+
+// LTAN-79N8ND: temporary fix.  Symbian 9.4 SQLite cannot resolve column number correctly,
+// Use column number instead of column name for ORDER BY, needed when FROM uses more than 1 table
+// calculate column number from SELECT fields, first field is column 1 (not 0)
+//_LIT(KQueryPlaylistSongsGetSong, "SELECT PlaylistSongs.UniqueId,PlaylistSongs.SongId,PlaylistSongs.PlaylistId,PlaylistSongs.Ordinal,PlaylistSongInfo.VolumeId,PlaylistSongInfo.DbFlag,PlaylistSongInfo.Uri,PlaylistSongInfo.Title FROM :dbname.PlaylistSongs,:dbname.PlaylistSongInfo WHERE PlaylistSongs.PlaylistId=%u AND PlaylistSongs.SongId=%u AND PlaylistSongs.SongId=PlaylistSongInfo.SongId ORDER BY PlaylistSongs.Ordinal");
+_LIT(KQueryPlaylistSongsGetSong, "SELECT PlaylistSongs.UniqueId,PlaylistSongs.SongId,PlaylistSongs.PlaylistId,PlaylistSongs.Ordinal,PlaylistSongInfo.VolumeId,PlaylistSongInfo.DbFlag,PlaylistSongInfo.Uri,PlaylistSongInfo.Title FROM :dbname.PlaylistSongs,:dbname.PlaylistSongInfo WHERE PlaylistSongs.PlaylistId=%u AND PlaylistSongs.SongId=%u AND PlaylistSongs.SongId=PlaylistSongInfo.SongId ORDER BY 4");
+_LIT(KQueryPlaylistSongsGetSongsInfo, " SELECT PlaylistSongs.*,PlaylistSongInfo.VolumeId,PlaylistSongInfo.DbFlag,PlaylistSongInfo.Uri,PlaylistSongInfo.Title FROM :dbname.PlaylistSongs,:dbname.PlaylistSongInfo WHERE PlaylistSongs.SongId=PlaylistSongInfo.SongId AND PlaylistSongs.PlaylistId=%u ORDER BY 4");
+
+_LIT(KQueryPlaylistSongsGetSongInfo, "SELECT PlaylistSongs.UniqueId,PlaylistSongs.SongId,PlaylistSongs.PlaylistId,PlaylistSongs.Ordinal,PlaylistSongInfo.VolumeId,PlaylistSongInfo.DbFlag,PlaylistSongInfo.Uri,PlaylistSongInfo.Title FROM :dbname.PlaylistSongs,:dbname.PlaylistSongInfo WHERE PlaylistSongs.UniqueId=%u AND PlaylistSongs.SongId=%u AND PlaylistSongs.SongId=PlaylistSongInfo.SongId");
+
+_LIT(KQueryPlaylistSongsUpdateSongOrdinalAfterDelete, "UPDATE :dbname.PlaylistSongs SET Ordinal=Ordinal-1 WHERE PlaylistId=%u AND Ordinal>%u");
+_LIT(KQueryPlaylistSongsUpdateSongOrdinal, "UPDATE :dbname.PlaylistSongs SET Ordinal=%u WHERE UniqueId=%u");
+_LIT(KQueryPlaylistSongsMoveSongUp, "UPDATE :dbname.PlaylistSongs SET Ordinal=Ordinal+1 WHERE PlaylistId=%u AND Ordinal>=%u AND Ordinal<%u");
+_LIT(KQueryPlaylistSongsMoveSongDown, "UPDATE :dbname.PlaylistSongs SET Ordinal=Ordinal-1 WHERE PlaylistId=%u AND Ordinal<=%u AND Ordinal>%u");
+
+// == PlaylistSongInfo table queries ==========================================
+//
+_LIT(KPlaylistSongInfoCreateTable, "CREATE TABLE PlaylistSongInfo("
+    L"SongId INTEGER PRIMARY KEY,"
+    L"VolumeId INTEGER,"
+    L"DbFlag INTEGER,"
+    L"Uri TEXT,"
+    L"Title TEXT COLLATE NOCASE)");
+_LIT(KPlaylistSongInfoDropTable,"DROP TABLE PlaylistSongInfo");
+_LIT(KPlaylistSongInfoCheckTable, "SELECT SongId,VolumeId,DbFlag,Uri,Title FROM PlaylistSongInfo");
+
+_LIT(KQueryPlaylistSongInfoInsert, "INSERT INTO :dbname.PlaylistSongInfo(SongId,Uri,Title,VolumeId,DbFlag) VALUES(%u,'%S','%S',%u,%u)");
+_LIT(KQueryPlaylistSongInfoDelete, "DELETE FROM :dbname.PlaylistSongInfo WHERE SongId=%u");
+_LIT(KQueryPlaylistSongInfoDeleteAll, "DELETE FROM :dbname.PlaylistSongInfo");
+_LIT(KQueryPlaylistSongInfoCleanup, "DELETE FROM :dbname.PlaylistSongInfo WHERE SongId NOT IN (SELECT DISTINCT SongId FROM :dbname.PlaylistSongs)");
+_LIT(KQueryPlaylistSongInfoUpdateTitle, "UPDATE :dbname.PlaylistSongInfo SET Title='%S' WHERE SongId=%u");
+_LIT(KQueryPlaylistSongInfoUpdate, "UPDATE :dbname.PlaylistSongInfo SET SongId=%u,Uri='%S',VolumeId=%u WHERE SongId=%u");
+_LIT(KQueryPlaylistSongInfoUpdateFlags, "UPDATE :dbname.PlaylistSongInfo SET DbFlag=%u WHERE SongId=%u");
+
+_LIT(KQueryPlaylistSongInfoExists, "SELECT SongId FROM :dbname.PlaylistSongInfo WHERE SongId=%u");
+_LIT(KQueryPlaylistSongInfoGet, "SELECT * FROM :dbname.PlaylistSongInfo WHERE SongId=%u");
+
+// == Criteria strings ========================================================
+//
+// Music criteria
+_LIT(KCriterionMusicUniqueId, "Music.UniqueId=%u");
+_LIT(KCriterionMusicNotDeleted, "Music.Deleted=0");
+_LIT(KCriterionMusicArtist, "Music.artist=%u");
+_LIT(KCriterionMusicAlbum, "Music.album=%u");
+_LIT(KCriterionMusicGenre, "Music.genre=%u");
+_LIT(KCriterionMusicComposer, "Music.composer=%u");
+// SQLite requires LIKE statement to include an ESCAPE clause if an escaped percentage
+// or underscore is to be used as regular search text instead of pattern matching
+// characters. See http://www.sqlite.org/lang_expr.html for an explanation. To supprt
+// partial title matching, our goal is to have the following statement as an example:
+//      SELECT * FROM Music WHERE title LIKE '%xyz%' ESCAPE '\'
+// To achieve this, we specify the format to be %%%%%S%%%%. The 1st percentage is the
+// escape character for string formatter to output the 2nd percentage sign. Similiarly
+// for the 3rd, 4th, 6th, 7th, 8th, and 9th. The 5th percentage instructs string formatter
+// to substitute a string, i.e. %S. After subsititution, we will have, for example, %%xyz%%.
+// Because this substituted string will be substituted again into a WHERE clause, we need
+// to escape the percentage signs in order to get %xyz% as the end result.
+_LIT(KCriterionMusicTitle, "Music.title LIKE '%%%%%S%%%%' ESCAPE '\\'");
+_LIT(KCriterionMusicVolume, "Music.VolumeId=%u");
+_LIT(KCriterionMusicLocation, "Music.Location='%S'");
+_LIT(KCriterionMusicSync, "Music.Sync=%u");
+_LIT(KCriterionMusicDeleted, "Music.Deleted=%u");
+_LIT(KCriterionMusicModified, "Music.Modified=%u");
+
+// Category criteria
+_LIT(KCriterionCategoryUniqueId, "##table##.UniqueId=%u");
+_LIT(KCriterionCategoryName, "##table##.Name LIKE '%%%%%S%%%%' ESCAPE '\\'");
+
+// Playlist criteria
+_LIT(KCriterionPlaylistUniqueId, "UniqueId=%u");
+_LIT(KCriterionPlaylistVolumeId, "VolumeId=%u");
+_LIT(KCriterionPlaylistTitle, "Name='%S'");
+_LIT(KCriterionPlaylistLikeTitle, "Name LIKE '%%%%%S%%%%' ESCAPE '\\'");
+_LIT(KCriterionPlaylistUri, "Uri='%S'");
+_LIT(KCriterionPlaylistSync, "Sync=%u");
+_LIT(KCriterionPlaylistTime, "Time='%S'");
+
+// PlaylistSongs criteria
+_LIT(KCriterionPlaylistSongId, "PlaylistSongs.SongId=%u");
+
+// == Album table queries ==========================================
+//
+_LIT(KAlbumCreateTable,"CREATE TABLE Album("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"Name TEXT COLLATE NOCASE,"
+    L"SongCount INTEGER,"
+    L"Artist INTEGER,"
+	L"Art TEXT)");
+
+_LIT(KAlbumCheckTable,"SELECT UniqueId,Name,SongCount,Artist,Art FROM Album");
+
+_LIT(KQueryAlbumInsert, "INSERT INTO :dbname.Album(UniqueId,Name,SongCount,Artist,Art) VALUES(%u,'%S',%u,%u,'%S')");
+_LIT(KQueryAlbumUpdate, "UPDATE :dbname.Album SET %S WHERE UniqueId=%u");
+
+_LIT(KQueryAlbumItem, "SELECT Album.*,Artist.Name FROM :dbname.Album,:dbname.Artist WHERE Album.Artist=Artist.UniqueId AND UniqueId=%u");
+_LIT(KQueryAlbumAll, "SELECT Album.*,Artist.Name FROM :dbname.Album,:dbname.Artist WHERE Album.Artist=Artist.UniqueId ORDER BY 6, 2");
+
+// == Artist table queries ==========================================
+//
+_LIT(KArtistCreateTable,"CREATE TABLE Artist("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"Name TEXT COLLATE NOCASE,"
+    L"SongCount INTEGER,"
+    L"Art TEXT)");
+
+_LIT(KArtistCheckTable,"SELECT UniqueId,Name,SongCount,Art FROM Artist");
+
+_LIT(KQueryArtistInsert, "INSERT INTO :dbname.Artist(UniqueId,Name,SongCount,Art) VALUES(%u,'%S',%u,'%S')");
+_LIT(KQueryArtistUpdate, "UPDATE :dbname.Artist SET %S WHERE UniqueId=%u");
+
+_LIT(KQueryArtistAll, "SELECT Artist.* FROM :dbname.Artist ORDER BY 2");
+_LIT(KQueryArtistName, "SELECT Artist.Name FROM :dbname.Artist WHERE UniqueId=%u");
+
+#endif // MPXDBPLUGINQUERIES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/inc/mpxdbutil.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The class MPXDbUtil which contains utilities functions
+*
+*/
+
+
+#ifndef MPXDBUTIL_H
+#define MPXDBUTIL_H
+
+// INCLUDES
+#include <mpxmediageneraldefs.h>
+#include "mpxcollectiondbstd.h"
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXMediaArray;
+
+// CLASS DECLARATION
+
+/**
+* This static class contains utilities functions used by Music Collection
+*
+* @lib MPXDbPlugin.lib
+*/
+class MPXDbUtil
+    {
+    public:
+        /**
+        * Filter out duplicated Ids in the array
+        * @param aIds array containing Ids to be filtered
+        * @param aFilteredIds filtered Ids without duplicates, generated from
+        *        the input array
+        */
+        static void FilterDuplicatedIdsL(const TArray<TUint32>& aIds,
+            RArray<TUint32>& aFilteredIds);
+
+        /**
+        * Returns the table name for a specified category
+        * @param aCategory identifies the category
+        * @return corresponding table name
+        */
+        static TPtrC TableNameForCategoryL(TMPXGeneralCategory aCategory);
+
+        /**
+        * Returns the music field name for a specified category
+        * @param aCategory identifies the category
+        * @return corresponding field name
+        */
+        static TPtrC MusicFieldNameForCategoryL(TMPXGeneralCategory aCategory);
+    };
+
+#endif // MPXDBUTIL_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/loc/mpxcollectiondbhg.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,187 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxsqlitedbhgplugin
+*
+*/
+
+
+
+// LOCALISATION STRINGS
+
+// d:Text for first item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_all_tracks "All songs"
+
+
+// d:Text for second item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_playlists "Playlists"
+
+// d:Text for third item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_artists "Artists"
+
+
+// d:Text for fourth item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_albums "Albums"
+
+
+// d:Text for podcast (if enabled) item in music library menu.
+// l:list_double_large_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_podcasts "Podcasts"
+
+
+// d:Text for genres item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_genres "Genres"
+
+
+// d:Text for composers item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_composers "Composers"
+
+// d:Text in main pane.
+// d:First item in the artist's album view. All
+// d:songs for the artist will be shown when
+// d:selected
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_nmp_all_by "All"
+
+// d:Title for first item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_all_tracks "All songs"
+
+// d:Title for second item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_pls "Playlists"
+
+// d:Title for third item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+#define qtn_mus_title_artists "Artists"
+
+// d:Title for fourth item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_albums "Albums"
+
+// d:Title for Album_soung view
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_album "Album"
+
+// d:Title for fifth item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_genres "Genres"
+
+// d:Title for sixth item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_composers "Composers"
+
+// d:Title for Most Played item in the playlists menu
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_most_played "Most played"
+
+// d:Text for the Most Played item in the playlists menu
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_pl_most_played "Most played"
+
+// d:Title for Recently Played item in the playlists menu
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_recently_played "Recently played"
+
+// d:Text for the Recently Played item in the playlists menu
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_pl_recently_played "Recently played"
+
+// d:Title for Recently Added item in the playlists menu
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_recently_downloaded "Recently added"
+
+// d:Text for the Recently Added item in the playlists menu
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_pl_recently_downloaded "Recently added"
+
+// d:List box text to show the number of items in the collection
+// d:For the case there're 0 or more than 1 song in the collection
+// l:list_double_large_graphic_pane_t2
+// r:5.0
+//
+#define qtn_mus_music_num_songs "%N songs"
+
+// d:List box text to show the number of items in the collection
+// d:For the case there's only 1 song in the collection
+// l:list_double_large_graphic_pane_t2
+// r:5.0
+//
+#define qtn_mus_music_one_song  "1 song"
+
+// d:List box text to show the name of the music collection
+// l:list_double_large_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_music "Music"
+
+// d:Text for music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_music_menu "Music Menu"
+
+// d:Text for music library menu.
+// l:list_logical_template_1_title
+// r:10.0
+//
+#define qtn_mp_title_my_music_menu_nseries "My Music"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxcollectiondbmanager.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for managing all of music collection
+*                databases.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include "mpxcollectiondbdef.h"
+#include "mpxcollectiondbmanager.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionDbManager* CMPXCollectionDbManager::NewL(
+    RFs& aFs)
+    {
+    MPX_FUNC("CMPXCollectionDbManager::NewL");
+
+    CMPXCollectionDbManager* self = CMPXCollectionDbManager::NewLC(aFs);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionDbManager* CMPXCollectionDbManager::NewLC(
+    RFs& aFs)
+    {
+    MPX_FUNC("CMPXCollectionDbManager::NewLC");
+
+    CMPXCollectionDbManager* self = new (ELeave) CMPXCollectionDbManager(aFs);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionDbManager::~CMPXCollectionDbManager()
+    {
+    MPX_FUNC("CMPXCollectionDbManager::~CMPXCollectionDbManager");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionDbManager::CMPXCollectionDbManager(
+    RFs& aFs) :
+    CMPXDbManager(aFs)
+    {
+    MPX_FUNC("CMPXCollectionDbManager::CMPXCollectionDbManager");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXCollectionDbManager::ConstructL()
+    {
+    MPX_FUNC("CMPXCollectionDbManager::ConstructL");
+    CMPXDbManager::ConstructL(TFileName(KMCDbFile));
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbalbum.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,546 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the category tables:
+*                Artist, Album, Genre and Composer
+*
+*/
+
+
+// INCLUDE FILES
+#include <sqldb.h>
+
+#include <mpxlog.h>
+
+#include "mpxdbcommonutil.h"
+#include "mpxdbcommondef.h"
+#include "mpxdbmanager.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxmediamusicdefs.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbutil.h"
+#include "mpxdbalbum.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAlbum* CMPXDbAlbum::NewL(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbAlbumObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbAlbum::NewL");
+
+    CMPXDbAlbum* self = CMPXDbAlbum::NewLC(aDbManager, aCategory, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAlbum* CMPXDbAlbum::NewLC(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbAlbumObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbAlbum::NewLC");
+
+    CMPXDbAlbum* self = new (ELeave) CMPXDbAlbum(aDbManager, aCategory, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAlbum::~CMPXDbAlbum()
+    {
+    MPX_FUNC("CMPXDbAlbum::~CMPXDbAlbum");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAlbum::CMPXDbAlbum(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbAlbumObserver& aObserver) :
+    CMPXDbCategory(aDbManager, aCategory),
+    iObserver(aObserver)
+    {
+    MPX_FUNC("CMPXDbAlbum::CMPXDbAlbum");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::ConstructL()
+    {
+    MPX_FUNC("CMPXDbAlbum::ConstructL");
+
+    BaseConstructL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::AddItemL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAlbum::AddItemL(
+    const TDesC& aName,
+    TUint32 aArtist,
+    const TDesC& aArt,
+    TInt aDriveId,
+    TBool& aNewRecord,
+    TBool aCaseSensitive)
+    {
+    MPX_FUNC("CMPXDbAlbum::AddItemL");
+
+    // try to find the item first
+    TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
+        aName, aCaseSensitive));
+    aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
+
+    if (aNewRecord)
+        {
+        // insert new
+        HBufC* query = PreProcessStringLC(KQueryAlbumInsert);
+        HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
+		HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(aArt);
+
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId, name, 1, aArtist, art);
+
+		CleanupStack::PopAndDestroy(art);
+        CleanupStack::PopAndDestroy(name);
+        CleanupStack::PopAndDestroy(query);
+        }
+    else
+        {
+        // retrieve the existing record
+        HBufC* query = NULL;
+        query = PreProcessStringLC(KQueryCategoryItem);
+        RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, rowId));
+        CleanupStack::PopAndDestroy(query);
+
+        CleanupClosePushL(recordset);
+
+        if (recordset.Next() != KSqlAtRow)
+            {
+            User::Leave(KErrNotFound);
+	    }
+
+        // Artist
+        TUint32 artistId = recordset.ColumnInt64(EAlbumArtist);
+
+        // the current one is Unknown and the new one is Not Unknown.
+        if ( IsUnknownArtistL( artistId ) && !IsUnknownArtistL( aArtist ) )
+            {
+            _LIT( KFormatArtistId, "Artist=%d" );
+            HBufC* setStr = HBufC::NewLC(KFormatArtistId().Length() + KMCIntegerLen);
+            setStr->Des().Format( KFormatArtistId, aArtist );
+
+            iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, rowId);
+            CleanupStack::PopAndDestroy(setStr);
+            }
+
+        // Album Art
+        TPtrC art(KNullDesC);
+        art.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EAlbumArt));
+
+        // the current one is Unknown and the new one is Not Unknown
+        if ( art == KNullDesC && aArt != KNullDesC )
+            {
+            HBufC* artReplaceSingleQuote = 
+                            MPXDbCommonUtil::ProcessSingleQuotesLC( aArt );
+            _LIT( KFormatArt, "Art=\'%S\'" );
+            HBufC* setStr = HBufC::NewLC(256);
+            setStr->Des().Format( KFormatArt, artReplaceSingleQuote );
+
+            iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, rowId);
+            CleanupStack::PopAndDestroy(setStr);
+            CleanupStack::PopAndDestroy(artReplaceSingleQuote);
+            }
+
+        CleanupStack::PopAndDestroy(&recordset);
+
+        // increment the number of songs for the category
+        query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
+        CleanupStack::PopAndDestroy(query);
+        }
+
+    return rowId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::DecrementSongsForCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::DecrementSongsForCategoryL(
+    const TUint32 aId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TBool& aItemExist,
+    const TUint32 aArtist)
+    {
+    MPX_FUNC("CMPXDbAlbum::DecrementSongsForCategoryL");
+
+    // if just one song uses this category. Use <= just in case
+    if (GetSongsCountL(aDriveId, aId) <= 1)
+        {
+        aItemExist = EFalse;
+        // delete the category
+        DeleteCategoryL(aId, aDriveId);
+
+        if (aItemChangedMessages)
+            {
+            // add the item changed message
+            MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
+                iCategory, KDBPluginUid);
+            }
+        }
+    else
+        {
+        aItemExist = ETrue;
+
+        // retrieve the existing record
+        HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+        RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, aId));
+        CleanupStack::PopAndDestroy(query);
+
+        CleanupClosePushL(recordset);
+
+        if (recordset.Next() != KSqlAtRow)
+            {
+            User::Leave(KErrNotFound);
+        }
+
+        TUint32 artistId = recordset.ColumnInt64(EAlbumArtist);
+
+        CleanupStack::PopAndDestroy(&recordset);
+
+        // the current artist is equal to deleted song's artist
+        if ( artistId == aArtist )
+            {
+            TUint32 newArtistId = ArtistForAlbumL(aId);
+
+            _LIT( KFormatArtistId, "Artist=%d" );
+            HBufC* setStr = HBufC::NewLC(KFormatArtistId().Length() + KMCIntegerLen);
+            setStr->Des().Format(KFormatArtistId, newArtistId);
+
+            iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, aId);
+            CleanupStack::PopAndDestroy(setStr);
+
+            if (aItemChangedMessages)
+                {
+                // add the item changed message
+                MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
+                    iCategory, KDBPluginUid);
+                }
+            }
+
+        // decrement the number of songs for the category
+        query = PreProcessStringLC(KQueryCategoryDecrementSongCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, aId);
+        CleanupStack::PopAndDestroy(query);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::GetAllCategoryItemsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::GetAllCategoryItemsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbAlbum::GetAllCategoryItemsL");
+
+    HBufC* query = PreProcessStringLC(KQueryAlbumAll);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::UpdateItemL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::UpdateItemL(
+    TUint32 aId,
+    const CMPXMedia& aMedia,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages)
+	{
+	MPX_FUNC("CMPXDbAlbum::UpdateItemL");
+
+	CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EAlbumFieldCount);
+	CleanupStack::PushL(fields);
+	CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EAlbumFieldCount);
+	CleanupStack::PushL(values);
+
+	// process the media parameter and construct the fields and values array
+	GenerateAlbumFieldsValuesL(aMedia, *fields, *values);
+
+	// construct the SET string
+	HBufC* setStr = MPXDbCommonUtil::StringFromArraysLC(*fields, *values, KMCEqualSign, KMCCommaSign);
+
+    if (setStr->Length())
+        {
+        // execute the query
+        iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, aId);
+	    TInt oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+	    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
+            EMPXAlbum, KDBPluginUid, oldSongId );
+        }
+
+	CleanupStack::PopAndDestroy(setStr);
+	CleanupStack::PopAndDestroy(values);
+	CleanupStack::PopAndDestroy(fields);
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::GetAlbumsCountForArtistL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbAlbum::GetAlbumsCountForArtistL(TUint32 aArtistId)
+	{
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryCategorySubcategoryItems, aArtistId));
+
+    TInt prevId(0);
+    TInt count(0);
+	TInt err(KErrNone);
+
+    while ((err = recordset.Next()) == KSqlAtRow)
+		{
+		TUint32 rowId(recordset.ColumnInt64(EAlbumUniqueId));
+        if (prevId == rowId)
+            {
+            continue;
+            }
+
+		count++;
+		prevId = rowId;
+		}
+
+    if (err != KSqlAtEnd)
+        {
+        User::Leave(err);
+        }
+
+	return count;
+
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL(TUint32 aArtistId, TUint32 aAlbumId)
+	{
+	MPX_FUNC("CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL");
+
+	return ExecuteSumQueryL(KQuerySongsInArtistAlbum, aArtistId, aAlbumId);
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::UpdateMediaL(
+    RSqlStatement& aRecord,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbAlbum::UpdateMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            if (attributeId & EMPXMediaGeneralId)
+                {
+                MPX_DEBUG1("    EMPXMediaGeneralId");
+
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+                    aRecord.ColumnInt64(EAlbumUniqueId));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                MPX_DEBUG1("    EMPXMediaGeneralTitle");
+
+                TPtrC album( MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) );
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle,
+                    MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName));
+                MPX_DEBUG2("	Album[%S]", &album );
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+                MPX_DEBUG1("    EMPXMediaGeneralCount");
+
+				TInt songCount = GetSongsCountL(KDbManagerAllDrives,
+					aRecord.ColumnInt64(EAlbumUniqueId));
+                aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount );
+				MPX_DEBUG2("	SongCount[%d]", songCount );
+                }
+            } // end if contentId == KMPXMediaIdGeneral
+		else if ( contentId == KMPXMediaIdMusic )
+			{
+			if (attributeId & EMPXMediaMusicArtist)
+				{
+				MPX_DEBUG1("	EMPXMediaMusicArtist");
+
+				TPtrC artistName(KNullDesC);
+
+				// if album is unknown, ignore arist name
+				if (MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) != KNullDesC)
+					{
+					artistName.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArtistName));
+					}
+
+				aMedia.SetTextValueL(KMPXMediaMusicArtist, artistName);
+				MPX_DEBUG2("	Artist[%S]", &artistName);
+				}
+
+			if (attributeId & EMPXMediaMusicAlbum)
+				{
+				MPX_DEBUG1("	EMPXMediaMusicAlbum");
+
+				TPtrC albumName(KNullDesC);
+                TPtrC album( MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) );
+
+
+				// if album is unknown
+				if ( album != KNullDesC)
+					{
+					albumName.Set(album);
+					}
+
+				aMedia.SetTextValueL(KMPXMediaMusicAlbum, albumName);
+				MPX_DEBUG2("	Album[%S]", &albumName);
+				}
+			if (attributeId & EMPXMediaMusicAlbumArtFileName)
+				{
+				MPX_DEBUG1("	EMPXMediaMusicAlbumArtFileName");
+
+				TPtrC art(KNullDesC);
+
+				// if album is unknown, ignore album art name
+				if (MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) != KNullDesC)
+					{
+					art.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArt));
+					}
+
+				aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art);
+				MPX_DEBUG2("	Art[%S]", &art);
+				}
+			}
+		} // end for
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, iCategory);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::GenerateAlbumFieldsValuesL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::GenerateAlbumFieldsValuesL(const CMPXMedia& aMedia, CDesCArray& aFields, CDesCArray& aValues)
+	{
+	if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+		{
+		const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen);
+		MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
+		}
+
+	if (aMedia.IsSupported(KMPXMediaMusicArtist))
+	    {
+	    const TDesC& artistName = aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen);
+	    TUint32 artistId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXArtist,
+	            artistName, ETrue);
+	    MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArtist, artistId);
+	    }
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::IsUnknownArtistL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAlbum::IsUnknownArtistL(TUint32 aId)
+	{
+	return iObserver.HandleIsUnknownArtistL(aId);
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::ArtistForAlbumL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAlbum::ArtistForAlbumL(const TUint32 aId)
+    {
+    return iObserver.HandleArtistForAlbumL(aId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbCategory::CreateTableL");
+
+    // create the table
+    HBufC* query = PreProcessStringLC(KAlbumCreateTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    // do not create an index on the Name field
+    // as it only slows down the insert/update queries overall
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAlbum::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbCategory::CheckTableL");
+
+    HBufC* query = PreProcessStringLC(KAlbumCheckTable);
+    TBool check(DoCheckTable(aDatabase, *query));
+    CleanupStack::PopAndDestroy(query);
+
+    return check;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbartist.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,380 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the Artist table
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include <sqldb.h>
+
+#include <mpxlog.h>
+
+#include "mpxdbcommonutil.h"
+#include "mpxdbcommondef.h"
+#include "mpxmediamusicdefs.h"
+#include "mpxdbmanager.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbutil.h"
+#include "mpxdbartist.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbArtist* CMPXDbArtist::NewL(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbArtistObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbArtist::NewL");
+
+    CMPXDbArtist* self = CMPXDbArtist::NewLC(aDbManager, aCategory, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbArtist* CMPXDbArtist::NewLC(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbArtistObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbArtist::NewLC");
+
+    CMPXDbArtist* self = new (ELeave) CMPXDbArtist(aDbManager, aCategory, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbArtist::~CMPXDbArtist()
+    {
+    MPX_FUNC("CMPXDbArtist::~CMPXDbArtist");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbArtist::CMPXDbArtist(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbArtistObserver& aObserver) :
+    CMPXDbCategory(aDbManager, aCategory),
+    iObserver(aObserver)
+    {
+    MPX_FUNC("CMPXDbArtist::CMPXDbArtist");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbArtist::ConstructL()
+    {
+    MPX_FUNC("CMPXDbArtist::ConstructL");
+
+    BaseConstructL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::AddItemL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbArtist::AddItemL(
+    const TDesC& aName,
+    const TDesC& aArt,
+    TInt aDriveId,
+    TBool& aNewRecord,
+    TBool aCaseSensitive)
+    {
+    MPX_FUNC("CMPXDbArtist::AddItemL");
+
+    // try to find the item first
+    TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
+        aName, aCaseSensitive));
+    aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
+
+    if (aNewRecord)
+        {
+        // insert new
+        HBufC* query = PreProcessStringLC(KQueryArtistInsert);
+        HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
+        HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(aArt);
+
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId, name, 1, art);
+
+        CleanupStack::PopAndDestroy(art);
+        CleanupStack::PopAndDestroy(name);
+        CleanupStack::PopAndDestroy(query);
+        }
+    else
+        {
+        // retrieve the existing record
+        HBufC* query = NULL;
+        query = PreProcessStringLC(KQueryCategoryItem);
+        RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, rowId));
+        CleanupStack::PopAndDestroy(query);
+
+        CleanupClosePushL(recordset);
+
+        if (recordset.Next() != KSqlAtRow)
+            {
+            User::Leave(KErrNotFound);
+        }
+
+        // Album Art
+        TPtrC art(KNullDesC);
+        art.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EArtistArt));
+
+        // the current one is Unknown and the new one is Not Unknown
+        if ( art == KNullDesC && aArt != KNullDesC )
+            {
+            HBufC* artReplaceSingleQuote = 
+                MPXDbCommonUtil::ProcessSingleQuotesLC( aArt );
+            _LIT( KFormatArt, "Art=\'%S\'" );
+            HBufC* setStr = HBufC::NewLC(256);
+            setStr->Des().Format( KFormatArt, artReplaceSingleQuote );
+
+            iDbManager.ExecuteQueryL(aDriveId, KQueryArtistUpdate, setStr, rowId);
+            CleanupStack::PopAndDestroy(setStr);
+            CleanupStack::PopAndDestroy(artReplaceSingleQuote);
+            }
+
+        CleanupStack::PopAndDestroy(&recordset);
+
+        // increment the number of songs for the category
+        query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
+        CleanupStack::PopAndDestroy(query);
+        }
+
+    return rowId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::IsUnknownArtistL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbArtist::IsUnknownArtistL(TUint32 aId)
+    {
+	MPX_FUNC("CMPXDbArtist::IsUnknownArtistL");
+
+    HBufC* name = GetNameL(aId);
+
+	TInt ret = EFalse;
+	if (*name == KNullDesC)
+		{
+		ret = ETrue;
+		}
+	delete name;
+
+	return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbArtist::UpdateMediaL(
+    RSqlStatement& aRecord,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbArtist::UpdateMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            if (attributeId & EMPXMediaGeneralId)
+                {
+                MPX_DEBUG1("	EMPXMediaGeneralId");
+
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+                    aRecord.ColumnInt64(EArtistUniqueId));
+				MPX_DEBUG2("	Id[%d]", aRecord.ColumnInt64(EArtistUniqueId));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                MPX_DEBUG1("	EMPXMediaGeneralTitle");
+
+                TPtrC artist( MPXDbCommonUtil::GetColumnTextL(aRecord, EArtistName) );
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle,
+                    MPXDbCommonUtil::GetColumnTextL(aRecord, EArtistName));
+
+				MPX_DEBUG2("	Artist[%S]", &artist);
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+//				TInt albumCount = GetAlbumsCountL(aRecord.ColumnInt64(EArtistUniqueId));
+//              aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount,albumCount);
+//              MPX_DEBUG1("	EMPXMediaGeneralCount");
+//				MPX_DEBUG2("	AlbumCount[%d]", albumCount);
+				TInt songCount = aRecord.ColumnInt64(EArtistSongCount);
+				aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount); // mod by anjokela
+
+                MPX_DEBUG1("	EMPXMediaGeneralCount");
+				MPX_DEBUG2("	SongCount[%d]", songCount);
+                }
+            } // end if contentId == KMPXMediaIdGeneral
+        else if ( contentId == KMPXMediaIdMusic )
+            {
+            if (attributeId & EMPXMediaMusicAlbumArtFileName)
+                {
+                MPX_DEBUG1("    EMPXMediaMusicAlbumArtFileName");
+                TPtrC art(KNullDesC);
+                art.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EArtistArt));
+                aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art);
+                MPX_DEBUG2("    Art[%S]", &art);
+                }
+            }
+		} // end for
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, iCategory);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::GenerateArtistFieldsValuesL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbArtist::GenerateArtistFieldsValuesL(const CMPXMedia& aMedia, CDesCArray& aFields, CDesCArray& aValues)
+    {
+    if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+        {
+        const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen);
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::GetAlbumsCountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbArtist::GetAlbumsCountL(TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbArtist::GetAlbumsCountL");
+
+	return iObserver.HandleGetAlbumsCountForArtistL(aId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::GetAllCategoryItemsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbArtist::GetAllCategoryItemsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbArtist::GetAllCategoryItemsL");
+    HBufC* query = PreProcessStringLC(KQueryArtistAll);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::UpdateItemL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbArtist::UpdateItemL(
+    TUint32 aId,
+    const CMPXMedia& aMedia,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbAlbum::UpdateItemL");
+
+    CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EArtistFieldCount);
+    CleanupStack::PushL(fields);
+    CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EArtistFieldCount);
+    CleanupStack::PushL(values);
+
+    // process the media parameter and construct the fields and values array
+    GenerateArtistFieldsValuesL(aMedia, *fields, *values);
+
+    // construct the SET string
+    HBufC* setStr = MPXDbCommonUtil::StringFromArraysLC(*fields, *values, KMCEqualSign, KMCCommaSign);
+
+    if (setStr->Length())
+        {
+        // execute the query
+        iDbManager.ExecuteQueryL(aDriveId, KQueryArtistUpdate, setStr, aId);
+        TInt oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
+            EMPXArtist, KDBPluginUid, oldSongId );
+        }
+
+    CleanupStack::PopAndDestroy(setStr);
+    CleanupStack::PopAndDestroy(values);
+    CleanupStack::PopAndDestroy(fields);
+    }
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbArtist::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbCategory::CreateTableL");
+
+    // create the table
+    HBufC* query = PreProcessStringLC(KArtistCreateTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    // do not create an index on the Name field
+    // as it only slows down the insert/update queries overall
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbArtist::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbCategory::CheckTableL");
+
+    HBufC* query = PreProcessStringLC(KArtistCheckTable);
+    TBool check(DoCheckTable(aDatabase, *query));
+    CleanupStack::PopAndDestroy(query);
+
+    return check;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbautoplaylist.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,406 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for the auto playlist functionality.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include <mpxcollectiondbhgres.rsg>
+#include <sqldb.h>
+
+#include "mpxresource.h"
+#include "mpxdbcommonutil.h"
+#include "mpxdbmanager.h"
+#include "mpxdbutil.h"
+#include "mpxcollectiondbdef.h"
+#include "mpxdbautoplaylist.h"
+#include "mpxdbpluginqueries.h"
+
+const TInt KMPXTableDefaultIndex = 0;
+const TInt32 KMPXRecentlyPlayedPlaylistId = 0x20000000;
+const TInt32 KMPXMostPlayedPlaylistId = 0x20000001;
+const TInt32 KMPXRecentlyAddedPlaylistId = 0x20000002;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAutoPlaylist* CMPXDbAutoPlaylist::NewL(
+    CMPXDbManager& aDbManager,
+    RFs& aFs,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::NewL");
+
+    CMPXDbAutoPlaylist* self = CMPXDbAutoPlaylist::NewLC(aDbManager, aFs, aResource);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAutoPlaylist* CMPXDbAutoPlaylist::NewLC(
+    CMPXDbManager& aDbManager,
+    RFs& aFs,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::NewLC");
+
+    CMPXDbAutoPlaylist* self = new (ELeave) CMPXDbAutoPlaylist(aDbManager);
+    CleanupStack::PushL(self);
+    self->ConstructL(aFs, aResource);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAutoPlaylist::~CMPXDbAutoPlaylist()
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::~CMPXDbAutoPlaylist");
+
+    delete iRecentlyPlayedPlaylist;
+    delete iMostPlayedPlaylist;
+    delete iRecentlyAddedPlaylist;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAutoPlaylist::CMPXDbAutoPlaylist(CMPXDbManager& aDbManager)
+    : iDbManager(aDbManager)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::CMPXDbAutoPlaylist");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAutoPlaylist::ConstructL(
+    RFs& /*aFs*/,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::ConstructL");
+
+    iRecentlyPlayedPlaylist = aResource.ReadHBufCL(R_MC_RECENTLY_PLAYED_PLAYLIST);
+    iMostPlayedPlaylist = aResource.ReadHBufCL(R_MC_MOST_PLAYED_PLAYLIST);
+    iRecentlyAddedPlaylist = aResource.ReadHBufCL(R_MC_RECENTLY_ADDED_PLAYLIST);
+
+    iRecentlyPlayedPlaylistId = KMPXRecentlyPlayedPlaylistId;
+    iMostPlayedPlaylistId = KMPXMostPlayedPlaylistId;
+    iRecentlyAddedPlaylistId = KMPXRecentlyAddedPlaylistId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::AutoPlaylistIdL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAutoPlaylist::AutoPlaylistIdL(
+    TMPXAutoPlaylistType aPlaylistType)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::AutoPlaylistIdL");
+
+    TUint32 id(0);
+    switch (aPlaylistType)
+        {
+        case EMPXRecentlyPlayedPlaylist:
+            {
+            id = iRecentlyPlayedPlaylistId;
+            }
+            break;
+
+        case EMPXMostPlayedPlaylist:
+            {
+            id = iMostPlayedPlaylistId;
+            }
+            break;
+
+        case EMPXRecentlyAddedPlaylist:
+            {
+            id = iRecentlyAddedPlaylistId;
+            }
+            break;
+
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return id;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::AutoPlaylistNameL
+// ----------------------------------------------------------------------------
+//
+TPtrC CMPXDbAutoPlaylist::AutoPlaylistNameL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::AutoPlaylistNameL");
+
+    TPtrC ptr;
+    if (aPlaylistId == iRecentlyPlayedPlaylistId)
+        {
+        ptr.Set(*iRecentlyPlayedPlaylist);
+        }
+    else if (aPlaylistId == iMostPlayedPlaylistId)
+        {
+        ptr.Set(*iMostPlayedPlaylist);
+        }
+    else if (aPlaylistId == iRecentlyAddedPlaylistId)
+        {
+        ptr.Set(*iRecentlyAddedPlaylist);
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    return ptr;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::AutoPlaylistTypeL
+// ----------------------------------------------------------------------------
+//
+TMPXAutoPlaylistType CMPXDbAutoPlaylist::AutoPlaylistTypeL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::AutoPlaylistTypeL");
+
+    TMPXAutoPlaylistType type(EMPXNoAutoPlaylist);
+    if (aPlaylistId == iRecentlyPlayedPlaylistId)
+        {
+        type = EMPXRecentlyPlayedPlaylist;
+        }
+    else if (aPlaylistId == iMostPlayedPlaylistId)
+        {
+        type = EMPXMostPlayedPlaylist;
+        }
+    else if (aPlaylistId == iRecentlyAddedPlaylistId)
+        {
+        type = EMPXRecentlyAddedPlaylist;
+        }
+    else
+        {
+        // do nothing
+        }
+
+    return type;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::GetPlaylistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAutoPlaylist::GetPlaylistL(
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::GetPlaylistL");
+
+    if (EMPXNoAutoPlaylist == AutoPlaylistTypeL(aPlaylistId))
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    UpdateMediaL(aPlaylistId, aAttrs, aMedia);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::GetAllPlaylistsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAutoPlaylist::GetAllPlaylistsL(
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::GetAllPlaylistsL");
+
+    MPX_ASSERT(aMediaArray.Count());
+    MPX_ASSERT(aMediaArray[0]->IsSupported(KMPXMediaGeneralValue));
+    TInt pPath = aMediaArray[0]->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+    MPX_ASSERT(pPath);
+    MPXDbCommonUtil::AppendMediaL(aMediaArray, *iMostPlayedPlaylist, EMPXItem,
+        EMPXPlaylist, iMostPlayedPlaylistId, EMPXWrite);
+    TInt count = aMediaArray.Count();
+    TMPXItemId id = aMediaArray[count-1]->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+    if (count==2)
+        { // the first playlist
+        if (((CMPXCollectionPath*)pPath)->Id()==KMPXInvalidItemId)
+            { // Remove top level with invalid id
+            ((CMPXCollectionPath*)pPath)->Back();
+            }
+        ((CMPXCollectionPath*)pPath)->AppendL(id);
+        }
+    else
+        { // append the end
+        ((CMPXCollectionPath*)pPath)->InsertL(id,
+                                              ((CMPXCollectionPath*)pPath)->Count());
+        }
+    TInt songCount = 0;
+    TInt duration = 0;
+    GetPlaylistDetailsL(EMPXMostPlayedPlaylist, songCount, duration);
+    aMediaArray[count-1]->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount);
+    aMediaArray[count-1]->SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+
+    MPXDbCommonUtil::AppendMediaL(aMediaArray, *iRecentlyPlayedPlaylist, EMPXItem,
+        EMPXPlaylist, iRecentlyPlayedPlaylistId, EMPXWrite);
+    id = aMediaArray[count]->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+    ((CMPXCollectionPath*)pPath)->InsertL(id, ((CMPXCollectionPath*)pPath)->Count());
+    songCount = 0;
+    duration = 0;
+    GetPlaylistDetailsL(EMPXRecentlyPlayedPlaylist, songCount, duration);
+	aMediaArray[count]->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount);
+   	aMediaArray[count]->SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+
+    MPXDbCommonUtil::AppendMediaL(aMediaArray, *iRecentlyAddedPlaylist, EMPXItem,
+        EMPXPlaylist, iRecentlyAddedPlaylistId, EMPXWrite);
+    id = aMediaArray[count+1]->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+    ((CMPXCollectionPath*)pPath)->InsertL(id, ((CMPXCollectionPath*)pPath)->Count());
+    songCount = 0;
+	duration = 0;
+	GetPlaylistDetailsL(EMPXRecentlyAddedPlaylist, songCount, duration);
+	aMediaArray[count+1]->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount);
+	aMediaArray[count+1]->SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::GetPlaylistDetails
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAutoPlaylist::GetPlaylistDetailsL(TMPXAutoPlaylistType aType, TInt& aCount, TInt& aDuration)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::GetPlaylistDetails");
+
+    HBufC* query = NULL;
+
+    switch ( aType )
+    	{
+		case EMPXMostPlayedPlaylist:
+		    query = HBufC::NewLC(KQueryMusicGetDurationMostPlayed().Length() + KMCIntegerLen);
+		    query->Des().Format(KQueryMusicGetDurationMostPlayed(), KMPXMaxMostPlayedSongs);
+		    break;
+		case EMPXRecentlyPlayedPlaylist:
+		    query = HBufC::NewLC(KQueryMusicGetDurationRecentlyPlayed().Length() + KMCIntegerLen);
+		    query->Des().Format(KQueryMusicGetDurationRecentlyPlayed(), KMPXMaxRecentlyPlayedSongs);
+			break;
+		case EMPXRecentlyAddedPlaylist:
+		    query = HBufC::NewLC(KQueryMusicGetDurationRecentlyAdded().Length());
+		    query->Des().Append(KQueryMusicGetDurationRecentlyAdded());
+			break;
+		default:
+			User::Leave(KErrArgument);
+			break;
+		}
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+    CleanupClosePushL(recordset);
+
+    TInt sum(0);
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        aCount++;
+        sum += recordset.ColumnInt64(KMPXTableDefaultIndex);
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(query);
+
+    if (err != KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    aDuration = sum;
+    MPX_DEBUG3("    Count[%d], Duration[%d]", aCount, aDuration);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAutoPlaylist::UpdateMediaL(
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::UpdateMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            TUint attributeId(aAttrs[i].AttributeId());
+
+            if (attributeId & EMPXMediaGeneralId)
+                {
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aPlaylistId);
+                }
+            if (attributeId & EMPXMediaGeneralCollectionId )
+                {
+                aMedia.SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId,
+                    TUid::Uid(KDBPluginUid));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                if (aPlaylistId == iRecentlyPlayedPlaylistId)
+                    {
+                    aMedia.SetTextValueL(KMPXMediaGeneralTitle, *iRecentlyPlayedPlaylist);
+                    }
+                 else if (aPlaylistId == iMostPlayedPlaylistId)
+                    {
+                    aMedia.SetTextValueL(KMPXMediaGeneralTitle,*iMostPlayedPlaylist);
+                    }
+                 else if (aPlaylistId == iRecentlyAddedPlaylistId)
+                    {
+                    aMedia.SetTextValueL(KMPXMediaGeneralTitle, *iRecentlyAddedPlaylist);
+                    }
+                 else
+                    {
+                    User::Leave(KErrArgument);
+                    }
+                }
+            if (attributeId & EMPXMediaGeneralSynchronized)
+                {
+                aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralSynchronized, EFalse);
+                }
+            if (attributeId & EMPXMediaGeneralNonPermissibleActions)
+                {
+                aMedia.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+                    KMPXMediaGeneralNonPermissibleActions, EMPXWrite);
+                }
+            // EMPXMediaGeneralCount, EMPXMediaGeneralDate, EMPXMediaGeneralDuration,
+            // EMPXMediaGeneralUri, EMPXMediaGeneralDrive, and EMPXMediaGeneralFlags
+            // attributes are not applicable for auto-playlists
+            } // end if contentId == KMPXMediaIdGeneral
+        } // end for
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXPlaylist);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbauxiliary.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interaction with the Auxiliary table.
+*
+*/
+
+
+// INCLUDE FILES
+#include <sqldb.h>
+#include <mpxlog.h>
+
+#include "mpxdbcommonutil.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbmanager.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbauxiliary.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary* CMPXDbAuxiliary::NewL(
+    CMPXDbManager& aDbManager)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::NewL");
+
+    CMPXDbAuxiliary* self = CMPXDbAuxiliary::NewLC(aDbManager);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary* CMPXDbAuxiliary::NewLC(
+    CMPXDbManager& aDbManager)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::NewLC");
+
+    CMPXDbAuxiliary* self = new (ELeave) CMPXDbAuxiliary(aDbManager);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary::~CMPXDbAuxiliary()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::~CMPXDbAuxiliary");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary::CMPXDbAuxiliary(
+    CMPXDbManager& aDbManager) :
+    CMPXDbTable(aDbManager)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::CMPXDbAuxiliary");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::ConstructL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::ConstructL");
+    BaseConstructL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetLastRefreshedTimeL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetLastRefreshedTimeL(
+    TTime aTime)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SetLastRefreshedTimeL");
+
+    // update all databases
+    HBufC* time = MPXDbCommonUtil::TTimeToDesLC(aTime);
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryAuxiliarySetTime, time);
+    CleanupStack::PopAndDestroy(time);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::LastRefreshedTimeL
+// ----------------------------------------------------------------------------
+//
+TTime CMPXDbAuxiliary::LastRefreshedTimeL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::LastRefreshedTimeL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    // read the time string and convert it to TTime
+    TTime time(MPXDbCommonUtil::DesToTTimeL(
+    	MPXDbCommonUtil::GetColumnTextL(recordset, KMPXTableDefaultIndex)));
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return time;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetDBCorruptedL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetDBCorruptedL(
+    TBool aCorrupt)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SetDBCorruptedL");
+
+    // update all databases
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryAuxiliarySetCorrupt,
+        aCorrupt);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::DBCorruptedL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAuxiliary::DBCorruptedL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::DBCorruptedL");
+    return (ExecuteSumQueryL(KQueryAuxiliaryGetCorrupt) > 0);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetSaveDeletedRecordCountL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetSaveDeletedRecordCountL(TInt aDrive,
+    TUint32 aValue)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SetSaveDeletedRecordCountL");
+
+    // update all databases
+    iDbManager.ExecuteQueryL(aDrive, KQueryAuxiliarySetCount, aValue);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SaveDeletedRecordCountL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAuxiliary::SaveDeletedRecordCountL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SaveDeletedRecordCountL");
+    return ExecuteSumQueryL(KQueryAuxiliaryGetCount);
+    }
+
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SaveDeletedRecordCountL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAuxiliary::SaveDeletedRecordCountL(TInt aDriveID)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SaveDeletedRecordCountL ");
+    return ExecuteIntQueryL(aDriveID, KQueryAuxiliaryGetCount);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::IsRefreshedL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAuxiliary::IsRefreshedL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::IsRefreshedL");
+
+    TBool refreshed(ETrue);
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
+    CleanupClosePushL(recordset);
+
+    TInt count(0);
+    while (recordset.Next() == KSqlAtRow)
+        {
+        count++;
+
+        // read the time string and convert it to TTime
+        if (Time::NullTTime() == MPXDbCommonUtil::DesToTTimeL(
+        	MPXDbCommonUtil::GetColumnTextL(recordset, KMPXTableDefaultIndex)))
+            {
+            refreshed = EFalse;
+            break;
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    return refreshed && (count > 0);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::IdL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbAuxiliary::IdL( TInt aDrive )
+    {
+    MPX_DEBUG1("CMPXDbAuxiliary::IdL <--");
+    TInt id(0);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive, KQueryAuxiliaryGetId));
+    CleanupClosePushL( recordset );
+
+    while(recordset.Next() == KSqlAtRow )
+        {
+        id = recordset.ColumnInt(KMPXTableDefaultIndex);
+        }
+
+    CleanupStack::PopAndDestroy( &recordset );
+    MPX_DEBUG1("CMPXDbAuxiliary::IdL -->");
+    return id;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetIdL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetIdL( TInt aDrive, TInt aId )
+    {
+    MPX_DEBUG1("CMPXDbAuxiliary::SetIdL <--");
+    iDbManager.ExecuteQueryL(aDrive,KQueryAuxiliarySetId, aId);
+    MPX_DEBUG1("CMPXDbAuxiliary::SetIdL -->");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool aCorruptTable)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::CreateTableL");
+
+    // create the table
+    User::LeaveIfError(aDatabase.Exec(KAuxiliaryCreateTable));
+
+    // insert the default record
+    // use the same length as '%u' is longer than '0' or '1'
+    HBufC* query = KQueryAuxiliaryInsert().AllocLC();
+    query->Des().Format(KQueryAuxiliaryInsert, aCorruptTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::DropTableL");
+    User::LeaveIfError(aDatabase.Exec(KAuxiliaryDropTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAuxiliary::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::CheckTableL");
+    return DoCheckTable(aDatabase, KAuxiliaryCheckTable);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbcategory.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,690 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the category tables:
+*                Artist, Album, Genre and Composer
+*
+*/
+
+
+// INCLUDE FILES
+#include <sqldb.h>
+
+#include <mpxlog.h>
+
+#include "mpxdbcommonutil.h"
+#include "mpxdbcommondef.h"
+#include "mpxdbmanager.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbutil.h"
+#include "mpxdbcategory.h"
+
+// CONSTANTS
+
+// maximum number of table name entries per query
+const TInt KMaxTableNameCount = 2;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbCategory::~CMPXDbCategory()
+    {
+    MPX_FUNC("CMPXDbCategory::~CMPXDbCategory");
+    delete iTableName;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbCategory::CMPXDbCategory(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory) :
+    CMPXDbTable(aDbManager),
+    iCategory(aCategory)
+    {
+    MPX_FUNC("CMPXDbCategory::CMPXDbCategory");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::BaseConstructL()
+    {
+    MPX_FUNC("CMPXDbCategory::BaseConstructL");
+
+    CMPXDbTable::BaseConstructL();
+    iTableName = MPXDbUtil::TableNameForCategoryL(iCategory).AllocL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::AddItemL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbCategory::AddItemL(
+    const TDesC& aName,
+    TInt aDriveId,
+    TBool& aNewRecord,
+    TBool aCaseSensitive)
+    {
+    MPX_FUNC("CMPXDbCategory::AddItemL");
+
+    // try to find the item first
+    TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
+        aName, aCaseSensitive));
+    aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
+
+    if (aNewRecord)
+        {
+        // insert new
+        HBufC* query = PreProcessStringLC(KQueryCategoryInsert);
+        HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
+
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId, name, 1);
+
+        CleanupStack::PopAndDestroy(name);
+        CleanupStack::PopAndDestroy(query);
+        }
+    else
+        {
+        // increment the number of songs for the category
+        HBufC* query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
+        CleanupStack::PopAndDestroy(query);
+        }
+
+    return rowId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetNameL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbCategory::GetNameL(
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::GetNameL");
+
+    RSqlStatement recordset(GetCategoryRecordL(aId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::LeaveIfError(KErrNotFound);
+        }
+
+    HBufC* name = MPXDbCommonUtil::GetColumnTextL(recordset, ECategoryName).AllocL();
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return name;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::CountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbCategory::CountL()
+    {
+    MPX_FUNC("CMPXDbCategory::CountL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryCount);
+    TInt count(ExecuteSumQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::FindAllL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::FindAllL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCategory::FindAllL");
+
+    TMPXGeneralType type = aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+
+    const TArray<TMPXAttribute> criteria = aCriteria.Attributes();
+    TInt criteriaCount(criteria.Count());
+
+    // process the criteria and construct the criteria string
+    CDesCArrayFlat* criteriaArray = new (ELeave) CDesCArrayFlat(criteriaCount + 1);
+    CleanupStack::PushL(criteriaArray);
+
+    for (TInt i = 0; i < criteriaCount; ++i)
+        {
+        const TMPXAttribute& criterion = criteria[i];
+        if ((type == EMPXItem) && (criterion == KMPXMediaGeneralId))
+            {
+            TUint32 itemId = (aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+            if (MPX_ITEM_CATEGORY(itemId) != iCategory)
+                {
+                User::Leave(KErrNotSupported);
+                }
+
+            HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, itemId);
+            CleanupStack::PopAndDestroy(critStr);
+            }
+        else if (criterion == KMPXMediaGeneralTitle)
+            {
+#ifdef RD_MPX_COLLECTION_CACHE
+
+            if (aCriteria.ValueText(KMPXMediaGeneralTitle).Length() <= 0)
+                {
+                TUint32 itemId = MPXDbCommonUtil::GenerateUniqueIdL(
+                                    iDbManager.Fs(), iCategory, KNullDesC, EFalse);
+                HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
+                MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, itemId);
+                CleanupStack::PopAndDestroy(critStr);
+                }
+            else
+                {
+
+#endif //RD_MPX_COLLECTION_CACHE
+                HBufC* critStr = PreProcessStringLC(KCriterionCategoryName);
+                HBufC* title = MPXDbCommonUtil::ProcessPatternCharsLC(
+                    aCriteria.ValueText(KMPXMediaGeneralTitle));
+                MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, *title);
+                CleanupStack::PopAndDestroy(2, critStr); // title & critStr
+#ifdef RD_MPX_COLLECTION_CACHE
+                }
+#endif //RD_MPX_COLLECTION_CACHE
+            }
+        else
+            {
+            // ignore attribute
+            }
+        }
+
+    // construct criteria string
+    HBufC* criteriaStr = MPXDbCommonUtil::StringFromArrayLC(*criteriaArray, KMCAndKeyword);
+
+    // either get all items or items filtered based on criteria
+    HBufC* query = PreProcessStringLC(criteriaStr->Length() ?
+        KQueryCategoryItems() : KQueryCategoryAll());
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, criteriaStr));
+    CleanupStack::PopAndDestroy(3, criteriaArray); // query, criteriaStr, criteriaArray
+    CleanupClosePushL(recordset);
+
+    // process the results
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::DecrementSongsForCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::DecrementSongsForCategoryL(
+    const TUint32 aId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TBool& aItemExist)
+    {
+    MPX_FUNC("CMPXDbCategory::DecrementSongsForCategoryL");
+
+    // if just one song uses this category. Use <= just in case
+    if (GetSongsCountL(aDriveId, aId) <= 1)
+        {
+        aItemExist = EFalse;
+        // delete the category
+        DeleteCategoryL(aId, aDriveId);
+
+        if (aItemChangedMessages)
+            {
+            // add the item changed message
+            MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
+                iCategory, KDBPluginUid);
+            }
+        }
+    else
+        {
+        aItemExist = ETrue;
+        // decrement the number of songs for the category
+        HBufC* query = PreProcessStringLC(KQueryCategoryDecrementSongCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, aId);
+        CleanupStack::PopAndDestroy(query);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::DeleteCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::DeleteCategoryL(
+    TUint32 aId,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbCategory::DeleteCategoryL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryDelete);
+    iDbManager.ExecuteQueryL(aDriveId, *query, aId);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetCategoryItemsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::GetCategoryItemsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCategory::GetCategoryItemsL");
+
+    // have to run one query to get all items as opposed to individual queries
+    // because of the sorting
+
+    // construct the unique ID criteria string
+    // (UniqueId = %u OR UniqueId = %u ...)
+    TInt count(aMediaArray.Count());
+    HBufC* criteria = HBufC::NewLC((2 * KCriterionCategoryUniqueId().Length() +
+        KMCIntegerLen + KMCOrKeyword().Length() + 2) * count);
+    TPtr ptr(criteria->Des());
+    ptr.Append(KMCOpenBracket);
+    for (TInt index = 0; index < count; ++index)
+        {
+        CMPXMedia* media = aMediaArray[index];
+
+        HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
+        HBufC* criterion = MPXDbCommonUtil::SqlCriterionLC(*critStr,
+            (media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId1);
+        ptr.Append(*criterion);
+        CleanupStack::PopAndDestroy(criterion);
+        CleanupStack::PopAndDestroy(critStr);
+
+        if (index < (count - 1))
+            {
+            ptr.Append(KMCOrKeyword);
+            }
+        }
+    ptr.Append(KMCCloseBracket);
+
+    // the array has to be reset as the items have to be returned in a different sort order
+    aMediaArray.Reset();
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryItems);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, criteria));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(criteria);
+
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetAllCategoryItemsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::GetAllCategoryItemsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCategory::GetAllCategoryItemsL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryAll);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetCategoryItemL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::GetCategoryItemL(
+    TUint32 aId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbCategory::GetCategoryItemL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+    ExecuteMediaQueryL(aAttrs, aMedia, *query, aId);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetSubCategoryItemsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::GetSubCategoryItemsL(
+    TMPXGeneralCategory aParentCategory,
+    TUint32 aParentId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCategory::GetSubCategoryItemsL");
+
+    // this is only valid for albums belonging to an artist
+    ASSERT((iCategory == EMPXAlbum) && (aParentCategory == EMPXArtist));
+
+    // to handle the UREL warning
+    (void)aParentCategory;
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryCategorySubcategoryItems, aParentId));
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::CategoryItemExistsL
+// The category records must be in the same database as the corresponding
+// Music record, otherwise when adding a duplicate of a song on a
+// different drive this method will return true and the category record won't
+// be created.
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbCategory::CategoryItemExistsL(
+    TInt aDriveId,
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::CategoryItemExistsL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+    RSqlStatement recordset(
+        iDbManager.ExecuteSelectQueryL(aDriveId, *query, aId));
+
+    TBool exists(recordset.Next() == KSqlAtRow);
+
+    recordset.Close();
+    CleanupStack::PopAndDestroy(query);
+
+    return exists;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetSongsCountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbCategory::GetSongsCountL(
+    TInt aDriveId,
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::GetSongsCountL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryGetSongCount);
+    RSqlStatement recordset(
+        iDbManager.ExecuteSelectQueryL(aDriveId, *query, aId));
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    TInt ret(0);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        ret += recordset.ColumnInt(KMPXTableDefaultIndex);
+        }
+
+    if (err != KSqlAtEnd)
+        {
+        User::Leave(err);
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(query);
+
+    return ret;
+    }
+
+void CMPXDbCategory::UpdateItemL(
+    TUint32 /*aId*/,
+    const CMPXMedia& /*aMedia*/,
+    TInt /*aDriveId*/,
+    CMPXMessageArray* /*aItemChangedMessages*/)
+	{
+	// nothing
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::UpdateMediaL(
+    RSqlStatement& aRecord,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbCategory::UpdateMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            if (attributeId & EMPXMediaGeneralId)
+                {
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+                    aRecord.ColumnInt64(ECategoryUniqueId));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle,
+                    MPXDbCommonUtil::GetColumnTextL(aRecord, ECategoryName));
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+                aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount,
+                    GetSongsCountL(KDbManagerAllDrives,
+                    aRecord.ColumnInt64(ECategoryUniqueId)));
+                }
+            } // end if contentId == KMPXMediaIdGeneral
+        } // end for
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, iCategory);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetCategoryRecordL
+// ----------------------------------------------------------------------------
+//
+RSqlStatement CMPXDbCategory::GetCategoryRecordL(
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::GetCategoryRecordL");
+    HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+    RSqlStatement statement(iDbManager.ExecuteSelectQueryL(*query, aId));
+    CleanupStack::PopAndDestroy(query);
+
+    return statement;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::PreProcessStringLC
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbCategory::PreProcessStringLC(
+    const TDesC& aQuery)
+    {
+    MPX_FUNC("CMPXDbCategory::PreProcessStringLC");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + KMaxTableNameCount * (iTableName->Length() +
+        KCategoryTablePlaceholder().Length()));
+    TPtr queryPtr(query->Des());
+
+    // copy the query string
+    queryPtr = aQuery;
+
+    // replace all instances of the placeholder with the actual table name
+    TInt index(0);
+    while ((index = queryPtr.Find(KCategoryTablePlaceholder)) != KErrNotFound)
+        {
+        queryPtr.Replace(index, KCategoryTablePlaceholder().Length(), *iTableName);
+        }
+
+    return query;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::ProcessRecordsetL
+// Unknown item is stored in the database as NULL (name field). This ensures the
+// unknown item to be the 1st found record if it exists. This will save time in
+// searching for the unknown record among the results and avoid performing
+// descriptor comparison. If the 1st record is the unknown item, it won't be
+// appended to the array until all other records have been put in the array.
+//
+// NOTE: putting unknown item to the end of the array only takes place when title
+//       field is requested. normal sorting algorithm occurs if title isn't
+//       requested.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::ProcessRecordsetL(
+    const TArray<TMPXAttribute>& aAttrs,
+    RSqlStatement& aRecordset,
+    CMPXMediaArray& aMediaArray)
+    {
+    // populate the array
+    TBool firstRecord(ETrue);
+    CMPXMedia* unknownMedia(NULL);
+    TInt prevId(0);
+    TInt err(KErrNone);
+
+    TInt pPath(0);
+    if (aMediaArray.Count())
+        {
+        CMPXMedia* pMedia = aMediaArray[0];
+        if (pMedia->IsSupported(KMPXMediaGeneralValue))
+            { // Query excuted by OpenL
+            pPath = pMedia->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+            MPX_ASSERT(pPath);
+            }
+        }
+    RArray<TMPXItemId> ids;
+    CleanupClosePushL(ids);
+
+    while ((err = aRecordset.Next()) == KSqlAtRow)
+        {
+        TUint32 rowId(aRecordset.ColumnInt64(ECategoryUniqueId));
+        if (prevId == rowId)
+            {
+            continue;
+            }
+
+        prevId = rowId;
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        UpdateMediaL(aRecordset, aAttrs, *media);
+
+        if (firstRecord &&
+            (MPXDbCommonUtil::GetColumnTextL(aRecordset, ECategoryName).Length() == 0))
+            {
+            unknownMedia = media;
+            }
+
+        if (!firstRecord || !unknownMedia)
+            {
+            if (media->IsSupported(KMPXMediaGeneralId) && pPath)
+                {
+                ids.AppendL(media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+                }
+            aMediaArray.AppendL(*media);
+            CleanupStack::PopAndDestroy(media);
+            }
+
+        firstRecord = EFalse;
+        } // end while
+
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(err);
+        }
+
+    if (unknownMedia)
+        {
+        if (unknownMedia->IsSupported(KMPXMediaGeneralId) && pPath)
+            {
+            ids.AppendL(unknownMedia->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+            }
+        aMediaArray.AppendL(*unknownMedia);
+        CleanupStack::PopAndDestroy(unknownMedia);
+        }
+
+    // Append ids to the returned path
+    if (pPath)
+        {
+        ((CMPXCollectionPath*)pPath)->AppendL(ids.Array());
+        }
+    CleanupStack::PopAndDestroy(&ids);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbCategory::CreateTableL");
+
+    // create the table
+    HBufC* query = PreProcessStringLC(KCategoryCreateTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    // do not create an index on the Name field
+    // as it only slows down the insert/update queries overall
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbCategory::DropTableL");
+
+    HBufC* query = PreProcessStringLC(KCategoryDropTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbCategory::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbCategory::CheckTableL");
+
+    HBufC* query = PreProcessStringLC(KCategoryCheckTable);
+    TBool check(DoCheckTable(aDatabase, *query));
+    CleanupStack::PopAndDestroy(query);
+
+    return check;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbcomposer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the category tables:
+*                Artist, Album, Genre and Composer
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include "mpxdbcomposer.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbComposer* CMPXDbComposer::NewL(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbComposer::NewL");
+
+    CMPXDbComposer* self = CMPXDbComposer::NewLC(aDbManager, aCategory);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbComposer* CMPXDbComposer::NewLC(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbComposer::NewLC");
+
+    CMPXDbComposer* self = new (ELeave) CMPXDbComposer(aDbManager, aCategory);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbComposer::~CMPXDbComposer()
+    {
+    MPX_FUNC("CMPXDbComposer::~CMPXDbComposer");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbComposer::CMPXDbComposer(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory) :
+    CMPXDbCategory(aDbManager, aCategory)
+    {
+    MPX_FUNC("CMPXDbComposer::CMPXDbComposer");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbComposer::ConstructL()
+    {
+    MPX_FUNC("CMPXDbComposer::ConstructL");
+
+    BaseConstructL();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbgenre.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the category tables:
+*                Artist, Album, Genre and Composer
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include "mpxdbgenre.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbGenre* CMPXDbGenre::NewL(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbGenre::NewL");
+
+    CMPXDbGenre* self = CMPXDbGenre::NewLC(aDbManager, aCategory);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbGenre* CMPXDbGenre::NewLC(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbGenre::NewLC");
+
+    CMPXDbGenre* self = new (ELeave) CMPXDbGenre(aDbManager, aCategory);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbGenre::~CMPXDbGenre()
+    {
+    MPX_FUNC("CMPXDbGenre::~CMPXDbGenre");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbGenre::CMPXDbGenre(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory) :
+    CMPXDbCategory(aDbManager, aCategory)
+    {
+    MPX_FUNC("CMPXDbGenre::CMPXDbGenre");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbGenre::ConstructL()
+    {
+    MPX_FUNC("CMPXDbGenre::ConstructL");
+
+    BaseConstructL();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbhandler.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2939 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is used by db plugin for all database related
+*                functionality. The main responsibilities are:
+*
+*/
+
+
+// INCLUDE FILES
+#include <bautils.h>
+#ifdef RD_MULTIPLE_DRIVE
+#include <driveinfo.h>
+#include <pathinfo.h>
+#endif //RD_MULTIPLE_DRIVE
+
+#include <mpxcollectiondbhgres.rsg>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxcollectionpath.h>
+#include <mpxlog.h>
+
+#include "mpxresource.h"
+#include "mpxdbcommonutil.h"
+
+#include "mpxdbutil.h"
+#include "mpxcollectiondbdef.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxcollectiondbmanager.h"
+#include "mpxdbplaylist.h"
+#include "mpxdbplaylistsongs.h"
+#include "mpxdbcategory.h"
+#include "mpxdbauxiliary.h"
+#include "mpxdbautoplaylist.h"
+#include "mpxdbhandler.h"
+#include "mpxdbartist.h"
+#include "mpxdbalbum.h"
+#include "mpxdbgenre.h"
+#include "mpxdbcomposer.h"
+
+// CONSTANTS
+_LIT(KMPXVirtualPlaylistExt, ".vir");
+static const TInt KMaxOpInTransaction = 100;
+
+const TInt KSqlDbCorrupted = -321;
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+
+#include <centralrepository.h>
+
+// MTP CenRep Key UID
+const TUid KMPXMtpSettings = {0x101FFC53};
+// MTP CenRep Key for Delete contents
+const TUint32 KMPXMtpSaveDeletedRecordFlag = 0x00000001;
+
+#endif
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbHandler* CMPXDbHandler::NewL(
+    RFs& aFs,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbHandler::NewL");
+    CMPXDbHandler* self = CMPXDbHandler::NewLC(aFs, aResource);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbHandler* CMPXDbHandler::NewLC(
+    RFs& aFs,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbHandler::NewLC");
+    CMPXDbHandler* self = new (ELeave) CMPXDbHandler(aFs, aResource);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbHandler::~CMPXDbHandler()
+    {
+    MPX_FUNC("CMPXDbHandler::~CMPXDbHandler");
+
+    delete iAutoPlaylist;
+
+    delete iDbMusic;
+    delete iDbPlaylist;
+    delete iDbArtist;
+    delete iDbAlbum;
+    delete iDbGenre;
+    delete iDbComposer;
+    delete iDbAuxiliary;
+    delete iDbManager;
+
+    delete iMimeTypes;
+    delete iExtensions;
+    delete iExtensionsMime;
+    delete iExtensionsDrm;
+
+    iDbDrives.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that might leave
+// ----------------------------------------------------------------------------
+//
+CMPXDbHandler::CMPXDbHandler(
+    RFs& aFs,
+    CMPXResource& aResource) :
+    iFs(aFs),
+    iResource(aResource)
+    {
+    MPX_FUNC("CMPXDbHandler::CMPXDbHandler");
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::ConstructL()
+    {
+    MPX_FUNC("CMPXDbHandler::ConstructL");
+
+    iMimeTypes = iResource.ReadDesCArrayL(R_MC_MIME_TYPES);
+    iExtensions = iResource.ReadDesCArrayL(R_MC_MUSIC_FILE_EXTENSIONS);
+    iExtensionsMime = iResource.ReadDesCArrayL(R_MC_FILE_EXTENSIONS_MIME);
+    iExtensionsDrm = iResource.ReadDesCArrayL(R_MC_FILE_EXTENSIONS_DRM);
+
+    // make sure all databases are created and valid
+    iDbManager = CMPXCollectionDbManager::NewL(iFs);
+
+    CDesCArrayFlat* musicFolders =
+#ifdef RD_MULTIPLE_DRIVE
+        GetMusicFoldersL();
+#else
+        iResource.ReadDesCArrayL(R_MC_DEFAULT_MUSIC_FOLDERS);
+#endif
+
+    // create the music folders and initialize iDbDrives
+    CleanupStack::PushL(musicFolders);
+    ProcessMusicFoldersL(*musicFolders);
+    CleanupStack::PopAndDestroy(musicFolders);
+
+    // Create the db infrastructure,
+    //
+    iDbMusic = CMPXDbMusic::NewL(*iDbManager, iResource, *this);
+    iDbPlaylist = CMPXDbPlaylist::NewL(*iDbManager, *this);
+    iDbArtist = CMPXDbArtist::NewL(*iDbManager, EMPXArtist, *this);
+	iDbAlbum = CMPXDbAlbum::NewL(*iDbManager, EMPXAlbum, *this);
+    iDbGenre = CMPXDbGenre::NewL(*iDbManager, EMPXGenre);
+    iDbComposer = CMPXDbComposer::NewL(*iDbManager, EMPXComposer);
+    iAutoPlaylist = CMPXDbAutoPlaylist::NewL(*iDbManager, iFs, iResource);
+    iDbAuxiliary = CMPXDbAuxiliary::NewL(*iDbManager);
+
+    MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives));
+    iCollectionOpen = ETrue;
+
+    // If KErrCorrupt is returned, a database file was found to be corrupted
+    // and was replaced with a new one.  The db plugin can ignore this error and continue
+    // because a new db file was successfully created in a subsequent retry.
+    if ((err != KErrNone) && (err != KErrCorrupt) && (err != KErrDiskFull))
+        {
+        // leave to signal the caller that there was an error why creating and opening
+        // one or more of the databases
+        User::Leave(err);
+        }
+    else if (err == KErrDiskFull)
+        {
+        iOutOfDisk = ETrue;
+        }
+    else
+        {
+        // do nothing
+        }
+
+    // Verify the volume ids of each drive matches the database
+    MPX_TRAP(err,VerifyVolumeIdL());
+    if ((err != KErrNone) && (err != KErrDiskFull))
+        {
+        // leave to signal the caller that there was an error why creating and opening
+        // one or more of the databases
+        User::Leave(err);
+        }
+    else if (err == KErrDiskFull)
+        {
+        iOutOfDisk = ETrue;
+        }
+
+//#ifdef _DEBUG
+//    iDbManager->PrintDatabaseL();    // PREQ2536 the files sqlrowsetutil.h and sqlrowsetutil.cpp has been removed
+//#endif
+
+    MPX_DEBUG2("CMPXDbHandler::ConstructL DbCount[%d]", iDbManager->DatabaseCount());
+    }
+
+// ----------------------------------------------------------------------------
+// Add song to collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::AddSongL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aMessageArray)
+    {
+    MPX_FUNC("CMPXDbHandler::AddSongL");
+
+    BeginTransactionL();
+    TUint32 songId(0);
+    MPX_TRAPD(err, songId = DoAddSongL(aMedia,aMessageArray));
+
+    if (iOutOfDisk && (err == KErrNotFound))
+        {
+        err = KErrDiskFull;
+        }
+    EndTransactionL(err);
+
+    return songId;
+    }
+
+// ----------------------------------------------------------------------------
+// Add song to collection with no database transaction
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::AddSongWithNoTransactionL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aMessageArray)
+    {
+    MPX_FUNC("CMPXDbHandler::AddSongWithNoTransactionL");
+
+    TUint32 songId(0);
+    MPX_TRAPD(err, songId = DoAddSongL(aMedia,aMessageArray));
+
+    if (iOutOfDisk && (err == KErrNotFound))
+        {
+        err = KErrDiskFull;
+        }
+    User::LeaveIfError(err);
+
+    return songId;
+    }
+
+// ----------------------------------------------------------------------------
+// Add playlist to collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::AddPlaylistL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::AddPlaylistL");
+
+    BeginTransactionL();
+    TUint32 playlistId(0);
+    MPX_TRAPD(err, playlistId = DoAddPlaylistL(aMedia));
+    EndTransactionL(err);
+
+    return playlistId;
+    }
+
+// ----------------------------------------------------------------------------
+// Add song to playlist
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::AddSongToPlaylistL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::AddSongToPlaylistL");
+
+    BeginTransactionL();
+    TUint32 playlistId(0);
+    MPX_TRAPD(err, playlistId = DoAddSongToPlaylistL(aMedia));
+    EndTransactionL(err);
+
+    return playlistId;
+    }
+
+// ----------------------------------------------------------------------------
+// Update a song in the collection
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbHandler::UpdateSongL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::UpdateSongL");
+
+    BeginTransactionL();
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+    MPX_TRAPD(err, visibleChange = DoUpdateSongL(aMedia, aItemChangedMessages));
+    EndTransactionL(err);
+    return visibleChange;
+    }
+
+// ----------------------------------------------------------------------------
+// Update a playlist in the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::UpdatePlaylistL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aMessageArray)
+    {
+    MPX_FUNC("CMPXDbHandler::UpdatePlaylistL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoUpdatePlaylistL(aMedia, aMessageArray));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Updates the playlist songs
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::UpdatePlaylistSongsL(
+    const CMPXMedia& aMedia,
+    CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbHandler::UpdatePlaylistSongsL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoUpdatePlaylistSongsL(aMedia, aMessage));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Reorder a song in a playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::ReorderPlaylistL(
+    const TMPXItemId& aPlaylistId,
+    const TMPXItemId& aSongId,
+    TUint aOriginalOrdinal,
+    TUint aNewOrdinal,
+    CMPXMessage& aMessage)
+    {
+    MPX_DEBUG5("-->CMPXDbHandler::ReorderPlaylistL(0x%x, 0x%x, %d, %d)",
+               aPlaylistId.iId2, aSongId.iId2, aOriginalOrdinal, aNewOrdinal);
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoReorderPlaylistL(aPlaylistId, aSongId, aOriginalOrdinal, aNewOrdinal, aMessage));
+    EndTransactionL(err);
+    MPX_DEBUG2("<--CMPXDbHandler::ReorderPlaylistL() error=%d", err);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove the entire music collection database
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveEntireCollectionL()
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveEntireCollectionL");
+    BeginTransactionL();
+    MPX_TRAPD(err, iDbManager->RecreateAllDatabasesL());
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Delete a song from collection
+// The function notifies collection model to perform deletion
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveSongL(
+    TUint32 aSongId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages,
+    TBool aDeleteRecord)
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveSongL");
+
+    MPX_TRAPD(err, DoRemoveSongL(aSongId, aUriArray, aItemChangedMessages, aDeleteRecord));
+
+    MPX_TRAP(err, DoRemoveSongFromPlaylistL(aSongId,aItemChangedMessages));
+
+    }
+
+// ----------------------------------------------------------------------------
+// Removes a category of songs from the music collection,
+// and its corresponding category in the lookup table
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveSongsMatchingCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveSongsMatchingCategoryL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoRemoveSongsMatchingCategoryL(aCategory, aCategoryId, aUriArray, aItemChangedMessages));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Delete songs for the specified artist and album from collection
+// The function notifies collection model to perform deletion
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveSongsMatchingArtistAndAlbumL(
+    TUint32 aArtistId,
+    TUint32 aAlbumId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveSongsMatchingArtistAndAlbumL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoRemoveSongsMatchingArtistAndAlbumL(aArtistId, aAlbumId, aUriArray,
+        aItemChangedMessages));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all playlists from collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveAllPlaylistsL()
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveAllPlaylistsL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoRemoveAllPlaylistsL());
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove specified playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemovePlaylistL(
+    TUint32 aPlaylistId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::RemovePlaylistL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoRemovePlaylistL(aPlaylistId, aUriArray, aItemChangedMessages));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove song from playlist songs table
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveSongFromPlaylistL(
+    TUint32 aPlaylistId,
+    const TMPXItemId& aSongId,
+    TInt aOrdinal,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveSongFromPlaylistL");
+    MPX_DEBUG5("CMPXDbHandler::RemoveSongFromPlaylistL(playlist 0x%x, songId [0x%x,0x%x], ordinal %d)",
+        aPlaylistId, aSongId.iId1, aSongId.iId2, aOrdinal);
+
+    MPX_TRAPD(err, DoRemoveSongFromPlaylistL(aPlaylistId, aSongId, aOrdinal, aItemChangedMessages));
+    if ( err && InTransaction() )
+        {
+        // only end transaction if there's an error
+        EndTransactionL( err );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Cleanup records marked as deleted. This is designated for MTP to clean up records marked as deleted
+// at the end of its session.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::CleanupDeletedRecordsL()
+    {
+    MPX_FUNC("CMPXDbHandler::CleanupDeletedRecordsL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoCleanupDeletedRecordsL());
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+//  Read all songs and cache them into an array ordered by song name
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllSongsL(
+    CMPXMediaArray* aMediaArray,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllSongsL");
+    iDbMusic->GetAllSongsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+//  Read a limited # of songs and cache them into an array ordered by song name
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs,
+                                        CMPXMediaArray& aMediaArray, TInt aLimit)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllSongsLimitedL");
+    iDbMusic->GetAllSongsLimitedL( aAttrs, aMediaArray, aLimit );
+    }
+
+// ----------------------------------------------------------------------------
+//  Read all songs and cache them into an array ordered by song name
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsInBlockL(
+    CMPXMediaArray* aMediaArray,
+    const TArray<TMPXAttribute>& aAttrs,
+    TPtrC aTitle,
+    TUint aNumOfSongs,
+    TBool aAsc)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsInBlockL");
+    iDbMusic->GetSongsInBlockL(aAttrs, *aMediaArray, aTitle, aNumOfSongs, aAsc);
+    }
+
+// ----------------------------------------------------------------------------
+//  Read songs at a particular offset
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsAtOffsetL( CMPXMediaArray* aMediaArray,
+                                       const TArray<TMPXAttribute>& aAttrs,
+                                       TInt aOffset,
+                                       TInt aCount )
+    {
+    MPX_DEBUG1("CMPXDbHandler::GetSongsAtOffsetL <--");
+    iDbMusic->GetSongsAtOffsetL( *aMediaArray, aAttrs, aOffset, aCount );
+    }
+
+// ----------------------------------------------------------------------------
+// Get all songs matching the given artist ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingArtistL(
+    TUint aArtistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingArtistL");
+    iDbMusic->GetSongsForArtistL(aArtistId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all songs matching the given album ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingAlbumL(
+    TUint aAlbumId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingAlbumL");
+    iDbMusic->GetSongsForAlbumL(aAlbumId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Get all songs matching the given artist and album ID
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingArtistAndAlbumL(
+    TUint aArtistId,
+    TUint aAlbumId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingArtistAndAlbumL");
+    iDbMusic->GetSongsForArtistAndAlbumL(aArtistId, aAlbumId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all songs matching the given genre ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingGenreL(
+    TUint aGenreId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingGenreL");
+    iDbMusic->GetSongsForGenreL(aGenreId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all songs matching the given composer ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingComposerL(
+    TUint aComposerId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingComposerL");
+    iDbMusic->GetSongsForComposerL(aComposerId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all songs that belong to the given playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingPlaylistL(
+    TUint aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingPlaylistL");
+    GetPlaylistSongsL(aPlaylistId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get song matching the given song ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongL(
+    TUint32 aSongId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongL");
+    iDbMusic->GetSongL(aSongId, aAttrs, aMedia);
+    }
+
+// ----------------------------------------------------------------------------
+// GetSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongL(
+    TUint32 aSongId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongL");
+
+    CMPXMedia* media = CMPXMedia::NewL();
+    CleanupStack::PushL(media);
+
+    GetSongL(aSongId, aAttrs, *media);
+    aMediaArray.AppendL(*media);
+
+    CleanupStack::PopAndDestroy(media);
+    }
+
+// ----------------------------------------------------------------------------
+// Get song matching the given song ID and playlist ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetPlaylistSongL(
+    TUint32 aSongId,
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_DEBUG3("-->CMPXDbHandler::GetPlaylistSongL songId[0x%x] playlistId[0x%x]", aSongId, aPlaylistId);
+
+    // complete the song information from the Music table
+    MPX_TRAPD(err, iDbMusic->GetSongL(aSongId, aAttrs, aMedia));
+
+    //
+    // song not found in Music table
+    //
+    if (err == KErrNotFound)
+        {
+        //
+        // Leave with KErrNotFound if one of the following is true:
+        // 1) the requested song is in an auto playlist. Since auto-playlist isn't
+        //    stored in playlist tables, we won't be able to retrieve info elsewhere
+        // 2) the requested song is in a user playlist but we cannot find the song
+        //    info from playlist tables either
+        //
+        if (EMPXNoAutoPlaylist != iAutoPlaylist->AutoPlaylistTypeL(aPlaylistId) ||
+            !iDbPlaylist->Songs().GetSongL(aPlaylistId, aSongId, aAttrs, aMedia))
+            {
+            User::Leave(KErrNotFound);
+            }
+        }
+
+    //
+    // Unable to read information from Music table
+    //
+    else
+        {
+        // ignore the error if KErrNotFound
+        User::LeaveIfError(err);
+        }
+    MPX_DEBUG1("<--CMPXDbHandler::GetPlaylistSongL");
+    }
+
+// ----------------------------------------------------------------------------
+// GetPlaylistSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetPlaylistSongL(
+    TUint32 aSongId,
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistSongL");
+
+    CMPXMedia* media = CMPXMedia::NewL();
+    CleanupStack::PushL(media);
+
+    GetPlaylistSongL(aSongId, aPlaylistId, aAttrs, *media);
+    aMediaArray.AppendL(*media);
+
+    CleanupStack::PopAndDestroy(media);
+    }
+
+// ----------------------------------------------------------------------------
+// Get song matching the given URI
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::GetSongIdMatchingUriL(
+    const TDesC& aUri)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongIdMatchingUriL");
+    return MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXCollection, aUri, EFalse);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all artists
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllArtistsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllArtistsL");
+    iDbArtist->GetAllCategoryItemsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all albums
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllAlbumsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllAlbumsL");
+    iDbAlbum->GetAllCategoryItemsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all albums for the given artist ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAlbumsMatchingArtistL(
+    TUint aArtistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAlbumsMatchingArtistL");
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL( attributes );
+
+    TBool tryGetSongCount = EFalse;
+    TInt attrCount(aAttrs.Count());
+    TInt i = 0;
+    for (i = 0; i < attrCount; i++)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral && attributeId & EMPXMediaGeneralCount)
+            {
+            MPX_DEBUG1("    EMPXMediaGeneralCount");
+
+            attributes.Append(TMPXAttribute(KMPXMediaIdGeneral, attributeId & !EMPXMediaGeneralCount));
+
+            tryGetSongCount = ETrue;
+            break;
+            }
+
+        attributes.Append(aAttrs[i]);
+        }
+
+    for (TInt j = i+1; j < attrCount; j++)
+        {
+        attributes.Append(aAttrs[j]);
+        }
+    iDbAlbum->GetSubCategoryItemsL(EMPXArtist, aArtistId, attributes.Array(), aMediaArray);
+    CleanupStack::PopAndDestroy(&attributes);
+
+    TInt pPath(0);
+    if (aMediaArray.Count())
+        {
+        CMPXMedia* pMedia = aMediaArray[0];
+        if (pMedia->IsSupported(KMPXMediaGeneralValue))
+            {
+            pPath = pMedia->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+            MPX_ASSERT(pPath);
+            }
+        }
+
+    TInt albumCount(aMediaArray.Count());
+    if (albumCount)
+        {
+        if ( tryGetSongCount )
+            {
+            TInt startIndex = pPath ? 1 : 0;
+
+            for (TInt i = startIndex; i < albumCount; i++)
+                {
+                CMPXMedia* media = aMediaArray[i];
+                TUint32 albumId((media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)));
+
+				TInt songCount = iDbAlbum->GetSongsCountInAlbumMatchingArtistL(aArtistId, albumId);
+
+                media->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount );
+				MPX_DEBUG2("	SongCount[%d]", songCount );
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Get all genres
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllGenresL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllGenresL");
+    iDbGenre->GetAllCategoryItemsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all composers
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllComposersL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllComposersL");
+    iDbComposer->GetAllCategoryItemsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the playlist ID of the playlist that matches the given URI
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::GetPlaylistIdMatchingUriL(
+    const TDesC& aUri)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistIdMatchingUriL");
+    return iDbPlaylist->GetIdL(aUri);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::IsAutoPlaylistL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::IsAutoPlaylistL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbHandler::IsAutoPlaylistL");
+    return (iAutoPlaylist->AutoPlaylistTypeL(aPlaylistId) != EMPXNoAutoPlaylist);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all user playlist names
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllPlaylistsL(
+    CMPXMediaArray* aMediaArray,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllPlaylistsL");
+    iDbPlaylist->GetAllPlaylistsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all system playlist names
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllSystemPlaylistNamesL(
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllSystemPlaylistNamesL()");
+    iAutoPlaylist->GetAllPlaylistsL(*aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the name of the row matching the given ID
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbHandler::GetNameMatchingIdL(
+    const TUint32 aId) const
+    {
+    MPX_FUNC("CMPXDbHandler::GetNameMatchingIdL()");
+
+    HBufC* name(NULL);
+    TMPXGeneralCategory category(MPX_ITEM_CATEGORY(aId));
+    switch (category)
+        {
+        case EMPXCollection:
+            {
+            // song name
+            name = iDbMusic->GetNameL(aId);
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            // playlist name
+            if (iAutoPlaylist->AutoPlaylistTypeL(aId) != EMPXNoAutoPlaylist)
+                {
+                name = iAutoPlaylist->AutoPlaylistNameL(aId).AllocL();
+                }
+            else
+                {
+                name = iDbPlaylist->GetNameL(aId);
+                }
+            break;
+            }
+        default:
+            {
+            // category name
+            name = DbCategoryL(category)->GetNameL(aId);
+            break;
+            }
+        }
+
+    return name;
+    }
+
+// ----------------------------------------------------------------------------
+// Get the URI of the row matching the given ID
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbHandler::GetUriMatchingIdL(
+    const TUint32 aId) const
+    {
+    MPX_FUNC("CMPXDbHandler::GetUriMatchingIdL");
+
+    HBufC* uri(NULL);
+    switch (MPX_ITEM_CATEGORY(aId))
+        {
+        case EMPXCollection:
+            {
+            // song URI
+            uri = iDbMusic->GetUriL(aId);
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            // playlist URI
+            uri = iDbPlaylist->GetUriL(aId);
+            break;
+            }
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return uri;
+    }
+
+// ----------------------------------------------------------------------------
+// Get category
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetCategoryL(
+    const TUint32 aCategoryId,
+    TMPXGeneralCategory aCategory,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia* aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::GetCategoryL");
+
+    switch (aCategory)
+        {
+        case EMPXPlaylist:
+            {
+            if (iAutoPlaylist->AutoPlaylistTypeL(aCategoryId) != EMPXNoAutoPlaylist)
+                {
+                iAutoPlaylist->GetPlaylistL(aCategoryId, aAttrs, *aMedia);
+                }
+            else
+                {
+                iDbPlaylist->GetPlaylistL(aCategoryId, aAttrs, *aMedia);
+                }
+            break;
+            }
+        default:
+            {
+            DbCategoryL(aCategory)->GetCategoryItemL(aCategoryId, aAttrs, *aMedia);
+            break;
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for all songs
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetAllSongsDurationL()
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllSongsDurationL");
+    return iDbMusic->AllSongsDurationL();
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for an artist
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetArtistDurationL(
+    TInt aArtistId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetArtistDurationL");
+    return iDbMusic->ArtistDurationL(aArtistId);
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for an album
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetAlbumDurationL(
+    TInt aAlbumId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAlbumDurationL");
+    return iDbMusic->AlbumDurationL(aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for an artist/album combination
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetArtistAlbumDurationL(
+    TInt aArtistId,
+    TInt aAlbumId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetArtistAlbumDurationL");
+    return iDbMusic->ArtistAlbumDurationL(aArtistId, aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for a composer
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetComposerDurationL(
+    TInt aComposerId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetComposerDurationL");
+    return iDbMusic->ComposerDurationL(aComposerId);
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for a genre
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetGenreDurationL(
+    TInt aGenreId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetGenreDurationL");
+    return iDbMusic->GenreDurationL(aGenreId);
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for a user playlist
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetUserPlaylistDurationL(
+    TInt aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetUserPlaylistDurationL");
+
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL(attributes);
+    attributes.AppendL(KMPXMediaGeneralId);
+    attributes.AppendL(TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralDuration));
+
+    CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
+    CleanupStack::PushL(mediaArray);
+
+    GetPlaylistSongsL(aPlaylistId, attributes.Array(), *mediaArray);
+
+    TInt duration(0);
+    TInt count(mediaArray->Count());
+    for (TInt index = 0; index < count; ++index)
+        {
+        CMPXMedia* media((*mediaArray)[index]);
+        if (media->IsSupported(KMPXMediaGeneralDuration))
+            {
+            duration += media->ValueTObjectL<TInt>(KMPXMediaGeneralDuration);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(mediaArray);
+    CleanupStack::PopAndDestroy(&attributes);
+
+    return duration;
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for a playlist
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetPlaylistDurationL(
+    TInt aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistDurationL");
+
+    TInt duration(0);
+
+    if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXRecentlyPlayedPlaylist))
+        {
+        duration = iDbMusic->RecentlyPlayedDurationL();
+        }
+    else if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXMostPlayedPlaylist))
+        {
+        duration = iDbMusic->MostPlayedDurationL();
+        }
+    else if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXRecentlyAddedPlaylist))
+        {
+        duration = iDbMusic->RecentlyAddedDurationL();
+        }
+    else
+        {
+        duration = GetUserPlaylistDurationL(aPlaylistId);
+        }
+
+    return duration;
+    }
+
+// ----------------------------------------------------------------------------
+// Find the number of items of a specified type
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::NumberOfItemsL(
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbHandler::NumberOfItemsL");
+
+    TInt count(0);
+    switch(aCategory)
+        {
+        case EMPXSong:
+            {
+            count = iDbMusic->CountL();
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            // return the total number of playlists, including the system ones
+            count = iDbPlaylist->CountL() + EMPXAutoPlaylistCount;
+            break;
+            }
+        default:
+            {
+            count = DbCategoryL(aCategory)->CountL();
+            break;
+            }
+        }
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::FindAllLC
+// ----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXDbHandler::FindAllLC(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbHandler::FindAllLC");
+
+    // leave if the given media doesn't contain the following attributes
+    if (!aCriteria.IsSupported(KMPXMediaGeneralType) ||
+        !aCriteria.IsSupported(KMPXMediaGeneralCategory))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    supportedIds.AppendL(KMPXMediaIdContainer);
+    MPXDbCommonUtil::FillInSupportedUIDsL(aAttrs, supportedIds);
+
+    CMPXMedia* entries = CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entries);
+
+    CMPXMediaArray* array = CMPXMediaArray::NewL();
+    CleanupStack::PushL(array);
+
+    FindAllL(aCriteria, aAttrs, array);
+
+    entries->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup);
+    entries->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory,
+        aCriteria.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory));
+    entries->SetCObjectValueL(KMPXMediaArrayContents, array);
+    entries->SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+
+    CleanupStack::PopAndDestroy(array);
+    return entries;
+    }
+
+// ----------------------------------------------------------------------------
+// Set the last refreshed time into the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::SetLastRefreshedTimeL(
+    TTime aTime)
+    {
+    MPX_FUNC("CMPXDbHandler::SetLastRefreshedTimeL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, iDbAuxiliary->SetLastRefreshedTimeL(aTime));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the last refreshed time from the collection
+// ----------------------------------------------------------------------------
+//
+TTime CMPXDbHandler::GetLastRefreshedTimeL()
+    {
+    MPX_FUNC("CMPXDbHandler::GetLastRefreshedTimeL");
+    return iDbAuxiliary->LastRefreshedTimeL();
+    }
+
+// ----------------------------------------------------------------------------
+// Set the db corrupted state for all drives
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::SetDBCorruptedL(
+    TBool aCorrupted)
+    {
+    MPX_FUNC("CMPXDbHandler::SetDBCorruptedL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, iDbAuxiliary->SetDBCorruptedL(aCorrupted));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Gets the db corrupted state for all drives
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::IsDBCorruptedL()
+    {
+    MPX_FUNC("CMPXDbHandler::IsDBCorruptedL");
+    return iDbAuxiliary->DBCorruptedL();
+    }
+
+// ----------------------------------------------------------------------------
+// Have the databases been created?
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::DatabaseCreated()
+    {
+    MPX_FUNC("CMPXDbHandler::DatabaseCreatedL");
+
+    TBool AuxilaryDbIsRefreshed(EFalse);
+    TRAP_IGNORE(AuxilaryDbIsRefreshed = iDbAuxiliary->IsRefreshedL());
+    // If none of the databases were available, ie out of disk we return EFalse
+    return iDbManager->IsInitialized() && AuxilaryDbIsRefreshed;
+    }
+
+// ----------------------------------------------------------------------------
+// Open a database
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::OpenDatabaseL(
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbHandler::OpenDatabaseL");
+    MPX_DEBUG2( "CMPXDbHandler::OpenDatabaseL: %i", aDrive);
+    iDbManager->OpenDatabaseL(aDrive);
+
+    // Verify the volume ID after a remount event
+    VerifyVolumeIdL();
+    }
+
+// ----------------------------------------------------------------------------
+// Close a database
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::CloseDatabaseL(
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbHandler::CloseDatabaseL");
+    MPX_DEBUG2( "CMPXDbHandler::CloseDatabaseL drive: %i", aDrive );
+    iDbManager->CloseDatabaseL(aDrive);
+    }
+
+// ----------------------------------------------------------------------------
+// Re-create all databases
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::ReCreateDatabasesL()
+    {
+    MPX_FUNC("CMPXDbHandler::ReCreateDatabasesL");
+    iDbManager->RecreateAllDatabasesL();
+    }
+
+// ----------------------------------------------------------------------------
+// Set handler refresh status
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RefreshStartL()
+    {
+    MPX_FUNC("CMPXDbHandler::RefreshStartL");
+
+    iOutOfDisk = EFalse;
+    // Re-open databases
+    // This is needed for the case where we were OOD before, but user
+    // has cleared some space but now try to refresh
+    MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives));
+    iCollectionOpen = ETrue;
+    // Update (synchronize) music basic table if it's not
+    // in sync with music table
+    if(iSynchronizeBasicTable)
+        {
+        iDbMusic->RefreshEndL();
+        }
+    iSynchronizeBasicTable = ETrue;
+
+    if(err == KErrDiskFull)
+        {
+            iOutOfDisk = ETrue;
+        }
+
+    if(!iOutOfDisk)
+    {
+        MPX_TRAP(err,CheckDiskSpaceOnDrivesL());
+
+        if(err == KErrDiskFull)
+            {
+            iOutOfDisk = ETrue;
+            }
+    }
+    
+    iDbMusic->RefreshStartL();
+
+    BeginTransactionL();
+    iRefresh = ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// Re-set handler refresh status
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RefreshEndL()
+    {
+    MPX_FUNC("CMPXDbHandler::RefreshEndL");
+    iRefresh = EFalse;
+    EndTransactionL(KErrNone);
+    if (!iOutOfDisk)
+        {
+        // Write last refreshed time as current time
+        // This also sets corrupt = 0
+        TTime curTime;
+        curTime.HomeTime();
+        SetLastRefreshedTimeL(curTime);
+        }
+    iDbMusic->RefreshEndL();
+    //Update of music basic table fails when the collection is not open
+    //Next time the collection is opened the music basic table must be updated
+    if (iCollectionOpen )
+        {
+        iSynchronizeBasicTable = EFalse;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Notification of Mtp status change
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::MtpStartL()
+    {
+    iMtpInUse = ETrue;
+    iOpOnDbCount = 0;
+    iDbManager->BeginL();
+    }
+
+// ----------------------------------------------------------------------------
+// Notification of Mtp status change
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::MtpEndL()
+    {
+    iMtpInUse = EFalse;
+    iOpOnDbCount = 0;
+    iDbManager->CommitL();
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for music
+// ----------------------------------------------------------------------------
+//
+TUint CMPXDbHandler::GetMusicCountL(TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbHandler::GetMusicCountL");
+    TUint total(0);
+
+    //music
+    total += iDbMusic->GetDriveTrackCountL(aDrive);
+
+    return total;
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for playlists
+// ----------------------------------------------------------------------------
+//
+TUint CMPXDbHandler::GetPlaylistCountL(TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistCountL");
+    TUint total(0);
+
+    //playlist
+    total += iDbPlaylist->GetDrivePlaylistCountL(aDrive);
+
+    return total;
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for music and playlists
+// ----------------------------------------------------------------------------
+//
+TUint CMPXDbHandler::GetTotalCountL(TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbHandler::GetTotalCountL");
+    TUint total(0);
+
+    //music
+    total += iDbMusic->GetDriveTrackCountL(aDrive);
+    //playlist
+    total += iDbPlaylist->GetDrivePlaylistCountL(aDrive);
+
+    return total;
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for music and playlists
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                      CDesCArray& aUriArr, TInt& aLastID)
+    {
+    MPX_FUNC("CMPXDbHandler::GetMusicUriArrayL");
+
+    iDbMusic->GetMusicUriArrayL(aDrive,aFromID,aRecords,aUriArr,aLastID);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for music and playlists
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetPlaylistUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                         CDesCArray& aUriArr, TInt& aLastID)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistUriArrayL");
+
+    iDbPlaylist->GetPlaylistUriArrayL(aDrive,aFromID,aRecords,aUriArr,aLastID);
+    }
+
+// ----------------------------------------------------------------------------
+// Starts a transaction on all databases
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::BeginTransactionL()
+    {
+    MPX_FUNC("CMPXDbHandler::BeginTransactionL");
+
+    if(!iMtpInUse)
+        {
+        iDbManager->BeginL();
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Ends a transaction on all databases
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::EndTransactionL(
+    TInt aError)
+    {
+    MPX_FUNC("CMPXDbHandler::EndTransactionL");
+
+    if(iMtpInUse)
+        {
+        if (aError)
+            {
+            iOpOnDbCount = 0;
+            iDbManager->RollbackL();
+            User::Leave(aError);
+            }
+
+        if(iOpOnDbCount >= KMaxOpInTransaction)
+            {
+            MPX_DEBUG2("CMPXDbHandler::EndTransactionL - %d>KMaxOpInTransaction Commiting",iOpOnDbCount);
+            iOpOnDbCount = 0;
+            iDbManager->CommitL();
+            iDbManager->BeginL();
+            }
+        }
+    else
+        {
+        if (aError)
+            {
+            MPX_DEBUG2("CMPXDbHandler::EndTransactionL - Rollback [%d]", aError);
+
+            iDbManager->RollbackL();
+
+            // KSqlDbCorrupted indicates DB corrupted, need to recreate.
+            if ( aError != KSqlDbCorrupted )
+                {
+                User::Leave(aError);
+                }
+            }
+        else
+            {
+            iDbManager->CommitL();
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Checks if the database is currently in a transaction
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::InTransaction()
+    {
+    MPX_FUNC("CMPXDbHandler::InTransaction");
+    return iDbManager->InTransaction();
+    }
+
+// ----------------------------------------------------------------------------
+// Notifies the handler that the collection will be closed.
+// It is called before closing the collection.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::PreCloseCollectionL()
+    {
+    MPX_FUNC("CMPXDbHandler::PreCloseCollectionL");
+    // Complete pending transaction and set the latest refresh time
+    // before closing the databases if collection close event occurs
+    // before the end of the refresh operation
+    if(iRefresh)
+        {
+        EndTransactionL(KErrNone);
+        if (!iOutOfDisk)
+            {
+            // Write last refreshed time as current time
+            // This also sets corrupt = 0
+            TTime curTime;
+            curTime.HomeTime();
+            SetLastRefreshedTimeL(curTime);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Notifies the handler that the collection was closed.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::CollectionClosed()
+    {
+    MPX_FUNC("CMPXDbHandler::CollectionClosed");
+
+    iCollectionOpen = EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+//Notifies the handler that the collection was opened.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::CollectionOpenedL()
+    {
+    MPX_FUNC("CMPXDbHandler::CollectionOpened");
+
+    iCollectionOpen = ETrue;
+    // Update (synchronize) music basic table if it's not
+    // in sync with music table
+    if(iSynchronizeBasicTable)
+        {
+        iDbMusic->RefreshEndL();
+        iSynchronizeBasicTable = EFalse;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Add song to collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::DoAddSongL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aMessageArray)
+    {
+    MPX_FUNC("CMPXDbHandler::DoAddSongL");
+
+    if (!aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    // add the song to the Music table
+    TDriveUnit drive(aMedia.ValueText(KMPXMediaGeneralUri));
+    TUint32 songId(iDbMusic->AddSongL(aMedia, drive,
+                                      iRefresh?NULL:aMessageArray));
+
+    // update the playlist tables
+    // make sure the song db flags are reset and not just updated
+    iDbPlaylist->UpdateSongL(aMedia, ETrue);
+
+    if(iMtpInUse)
+        {
+        ++iOpOnDbCount;
+        }
+
+    return songId;
+    }
+
+// ----------------------------------------------------------------------------
+// Add playlist to collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::DoAddPlaylistL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::DoAddPlaylistL");
+
+    CMPXMedia* media = CMPXMedia::NewL(aMedia);
+    CleanupStack::PushL(media);
+
+    const TDesC& playlistUri = media->ValueText(KMPXMediaGeneralUri);
+
+    //
+    // client has asked to create a virtual playlist if file name is not specified
+    // in the URI. In this case, generate URI for virtual playlist specified as
+    // follows:
+    //          <dir path>\timestamp.vir
+    //
+    TParsePtrC parser(playlistUri);
+
+    if (!parser.NameOrExtPresent() ||
+        parser.IsNameWild() ||
+        parser.IsExtWild())
+        {
+        HBufC* newUri = HBufC::NewLC(parser.DriveAndPath().Length() + KMCMaxTextLen +
+            KMPXVirtualPlaylistExt().Length());
+
+        TPtr ptr = newUri->Des();
+        ptr.Append(parser.DriveAndPath());
+        TTime time;
+        time.HomeTime();
+        ptr.AppendNum(time.Int64());
+        ptr.Append(KMPXVirtualPlaylistExt);
+
+        // overwrite the old uri with the new one with full path and playlist
+        // playlist filename
+        media->SetTextValueL(KMPXMediaGeneralUri, *newUri);
+
+        CleanupStack::PopAndDestroy(newUri);
+
+        // set DbFlags to indicate that this is a virtual playlist
+        media->SetTObjectValueL<TUint>(KMPXMediaGeneralFlags,
+            KMPXMediaGeneralFlagsSetOrUnsetBit | KMPXMediaGeneralFlagsIsVirtual);
+        }
+
+    // complete the song attributes from the music table
+    UpdatePlaylistSongInfoL(*media);
+
+    // add playlist to the database
+    TUint32 playlistId = iDbPlaylist->AddPlaylistL(*media);
+
+    CleanupStack::PopAndDestroy(media);
+    return playlistId;
+    }
+
+// ----------------------------------------------------------------------------
+// Add song to playlist
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::DoAddSongToPlaylistL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::DoAddSongToPlaylistL");
+
+    CMPXMedia* media = CMPXMedia::NewL(aMedia);
+    CleanupStack::PushL(media);
+
+    // complete the song attributes from the music table
+    UpdatePlaylistSongInfoL(*media);
+
+    // add the songs to the playlist
+    TUint32 playlistId((media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2);
+
+    CMPXMediaArray* ary( aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents) );
+    User::LeaveIfNull( ary );
+    iDbPlaylist->AddSongsL(playlistId,*ary);
+
+    CleanupStack::PopAndDestroy(media);
+    return playlistId;
+    }
+
+// ----------------------------------------------------------------------------
+// Update a song in the collection
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbHandler::DoUpdateSongL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::DoUpdateSongL");
+
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+
+    TUint32 songId(0);
+
+    if (aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        songId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        }
+    if (aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        const TDesC& uri = aMedia.ValueText(KMPXMediaGeneralUri);
+        songId = MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXCollection, uri, EFalse);
+        }
+    if (!songId)
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    // Update the Music table
+    TRAPD(err, visibleChange = iDbMusic->UpdateSongL(songId, aMedia, aItemChangedMessages));
+
+    // do not leave if song is not found in Music table
+    // leave for other errors such as disk full
+    if(err != KErrNone && err != KErrNotFound)
+        {
+        User::Leave(err);
+        }
+
+    // Update the Playlist table
+    TBool visible = EFalse;
+
+    TRAP( err, visible = iDbPlaylist->UpdateSongL(aMedia, EFalse, &aItemChangedMessages));
+
+    // do not leave if song is not found in Playlist table
+    // leave for other errors such as disk full
+    if(err != KErrNone && err != KErrNotFound)
+        {
+        User::Leave(err);
+        }
+
+    // make it visible if either table is updated
+    if (visible)
+        {
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        }
+
+    return visibleChange;
+    }
+
+// ----------------------------------------------------------------------------
+// Update a playlist in the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoUpdatePlaylistL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aMessageArray)
+    {
+    MPX_FUNC("CMPXDbHandler::DoUpdatePlaylistL");
+
+    TUint32 playlistId(0);
+    TInt drive(0);
+
+    CMPXMedia* media = CMPXMedia::NewL(aMedia);
+    CleanupStack::PushL(media);
+
+
+    ProcessPlaylistMediaL(*media, playlistId, drive);
+
+    CMPXMessage* m1 = CMPXMessage::NewL();
+    CleanupStack::PushL(m1);
+    CMPXMessage* m2 = CMPXMessage::NewL();
+    CleanupStack::PushL(m2);
+
+    // send 2 messages to notify the playlist change & to refresh the display (update playlist name)
+    MPXDbCommonUtil::FillItemChangedMessageL(*m1, playlistId, EMPXItemModified,
+            EMPXPlaylist, KDBPluginUid);
+
+    MPXDbCommonUtil::FillItemChangedMessageL(*m2, EBrowsePlaylist, EMPXItemModified,
+                EMPXPlaylist, KDBPluginUid);
+
+    iDbPlaylist->UpdatePlaylistL(*media, *m1, drive);
+
+    aMessageArray.AppendL(*m1);
+    aMessageArray.AppendL(*m2);
+
+
+    CleanupStack::PopAndDestroy(m2);
+    CleanupStack::PopAndDestroy(m1);
+    CleanupStack::PopAndDestroy(media);
+    }
+
+// ----------------------------------------------------------------------------
+// Update a playlist in the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoUpdatePlaylistSongsL(
+    const CMPXMedia& aMedia,
+    CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbHandler::DoUpdatePlaylistSongsL");
+
+    CMPXMedia* media = CMPXMedia::NewL(aMedia);
+    CleanupStack::PushL(media);
+
+    TUint32 playlistId(0);
+    TInt drive(0);
+
+    // get the playlist ID and drive ID
+    ProcessPlaylistMediaL(*media, playlistId, drive);
+    MPXDbCommonUtil::FillItemChangedMessageL(aMessage, playlistId, EMPXItemModified,
+        EMPXPlaylist, KDBPluginUid);
+
+    // complete the song attributes from the Music table
+    UpdatePlaylistSongInfoL(*media);
+
+    // delete existing songs for the playlist first
+    iDbPlaylist->Songs().DeleteSongsL(playlistId, drive);
+
+    // add new songs to the playlist
+    CMPXMediaArray* ary( media->Value<CMPXMediaArray>(KMPXMediaArrayContents ) );
+    User::LeaveIfNull( ary );
+    iDbPlaylist->AddSongsL(playlistId, *ary);
+
+    CleanupStack::PopAndDestroy(media);
+    }
+
+// ----------------------------------------------------------------------------
+// Reorder a song in a playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoReorderPlaylistL(
+    const TMPXItemId& aPlaylistId,
+    const TMPXItemId& aSongId,
+    TUint aOriginalOrdinal,
+    TUint aNewOrdinal,
+    CMPXMessage& aMessage)
+    {
+    MPX_DEBUG1("-->CMPXDbHandler::DoReorderPlaylistL()");
+
+    if (aOriginalOrdinal != aNewOrdinal)
+        {
+        iDbPlaylist->Songs().ReorderSongL(aPlaylistId, aSongId, aOriginalOrdinal, aNewOrdinal);
+
+        MPXDbCommonUtil::FillItemChangedMessageL(aMessage, aPlaylistId.iId2, EMPXItemModified,
+            EMPXPlaylist, KDBPluginUid);
+        }
+
+    MPX_DEBUG1("<--CMPXDbHandler::DoReorderPlaylistL()");
+    }
+
+// ----------------------------------------------------------------------------
+// Delete a song from collection
+// The function notifies collection model to perform deletion
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveSongL(
+    TUint32 aSongId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages,
+    TBool aDeleteRecord)
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemoveSongL");
+
+    // Get the song drive
+    TUint32 artistID(0);
+    TUint32 albumID(0);
+    TUint32 genreID(0);
+    TUint32 composerID(0);
+    TInt drive(0);
+
+    // Get information from the Music table first
+    HBufC* uri = iDbMusic->GetSongInfoL(aSongId, artistID, albumID, genreID, composerID, drive);
+
+    // add the URI to the return array
+    CleanupStack::PushL(uri);
+    aUriArray.AppendL(*uri);
+    CleanupStack::PopAndDestroy(uri);
+
+    // Update the category records
+    TBool categoryExist( EFalse );
+    iDbArtist->DecrementSongsForCategoryL(artistID, drive, &aItemChangedMessages, categoryExist);
+    iDbAlbum->DecrementSongsForCategoryL(albumID, drive, &aItemChangedMessages, categoryExist, artistID);
+    iDbGenre->DecrementSongsForCategoryL(genreID, drive, &aItemChangedMessages, categoryExist);
+    iDbComposer->DecrementSongsForCategoryL(composerID, drive, &aItemChangedMessages, categoryExist);
+
+    // Update the music table
+    TBool deleteRecord(ETrue);
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+    // Mark the song record as deleted if the following is true; otherwise, delete the
+    // song record.
+    //
+    // A client other than MTP has initiated this song deletion (aDeleteRecord is EFalse)
+    // and MTP has turned on its cenrep key to save deleted records and current number of
+    // saved deleted records has not exceeded its maximum, KMCMaxSavedDeletedRecords.
+    //
+    // Songs are marked as deleted in order to support auto-sync. MTP will delete these
+    // marked records at the end of each session via CleanupDeletedRecordsL.
+    //
+    // For performance consideration, if the number of saved records exceeds its maximum,
+    // song record will be deleted.
+    if (!aDeleteRecord && SaveDeletedSongs())
+        {
+        TUint32 savedDeletedRecordCount(iDbAuxiliary->SaveDeletedRecordCountL());
+        MPX_DEBUG2("Current number of saved deleted record count is %d", savedDeletedRecordCount);
+
+        if (savedDeletedRecordCount < KMCMaxSavedDeletedRecords)
+            {
+            deleteRecord = EFalse;
+            TUint32 savedDeletedDriveRecordCount(iDbAuxiliary->SaveDeletedRecordCountL(drive));
+            iDbAuxiliary->SetSaveDeletedRecordCountL(drive,++savedDeletedDriveRecordCount);
+            }
+        }
+#endif
+
+    // delete the song from the Music table
+    iDbMusic->DeleteSongL(aSongId, drive, deleteRecord);
+
+    // add the item changed message
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aSongId, EMPXItemDeleted,
+        EMPXSong, KDBPluginUid);
+
+
+    if(iMtpInUse)
+        {
+        ++iOpOnDbCount;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Delete a song from playlist tables
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveSongFromPlaylistL(TUint32 aSongId,CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemoveSongFromPlaylistL");
+    // delete song from the playlist tables on all drives
+    iDbPlaylist->DeleteSongL(aSongId, aItemChangedMessages);
+    }
+
+// ----------------------------------------------------------------------------
+// Removes a category of songs from the music collection,
+// and its corresponding category in the lookup table
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveSongsMatchingCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemoveSongsMatchingCategoryL");
+
+    // get the songs for the specified category
+    CMPXMediaArray* songs = CMPXMediaArray::NewL();
+    CleanupStack::PushL(songs);
+
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL(attributes);
+    attributes.AppendL(KMPXMediaGeneralId);
+
+    switch (aCategory)
+        {
+        case EMPXArtist:
+            {
+            iDbMusic->GetSongsForArtistL(aCategoryId, attributes.Array(), *songs);
+            break;
+            }
+        case EMPXAlbum:
+            {
+            iDbMusic->GetSongsForAlbumL(aCategoryId, attributes.Array(), *songs);
+            break;
+            }
+        case EMPXGenre:
+            {
+            iDbMusic->GetSongsForGenreL(aCategoryId, attributes.Array(), *songs);
+            break;
+            }
+        case EMPXComposer:
+            {
+            iDbMusic->GetSongsForComposerL(aCategoryId, attributes.Array(), *songs);
+            break;
+            }
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    CleanupStack::PopAndDestroy(&attributes);
+
+    // iterate the songs and remove them one by one
+    // so records in the category tables can also be updated
+    TInt count(songs->Count());
+    for (TInt index = 0; index < count; ++index)
+        {
+        CMPXMedia* song = (*songs)[index];
+        if (song->IsSupported(KMPXMediaGeneralId))
+            {
+            DoRemoveSongL((song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2,
+                aUriArray, aItemChangedMessages, EFalse);
+            DoRemoveSongFromPlaylistL((song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2,aItemChangedMessages);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(songs);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Delete songs for the specified artist and album from collection
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveSongsMatchingArtistAndAlbumL(
+    TUint32 aArtistId,
+    TUint32 aAlbumId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveSongsMatchingArtistAndAlbumL");
+
+    // get the songs for the specified artist and album
+    CMPXMediaArray* songs = CMPXMediaArray::NewL();
+    CleanupStack::PushL(songs);
+
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL (attributes);
+    attributes.AppendL(KMPXMediaGeneralId);
+
+    iDbMusic->GetSongsForArtistAndAlbumL(aArtistId, aAlbumId, attributes.Array(), *songs);
+    CleanupStack::PopAndDestroy(&attributes);
+
+    // iterate the songs and remove them one by one
+    // so records in the category tables can also be updated
+    TInt count(songs->Count());
+    for (TInt index = 0; index < count; ++index)
+        {
+        CMPXMedia* song = (*songs)[index];
+        if (song->IsSupported(KMPXMediaGeneralId))
+            {
+            DoRemoveSongL( song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId),
+                aUriArray, aItemChangedMessages, EFalse);
+            DoRemoveSongFromPlaylistL(song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId),aItemChangedMessages);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(songs);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all playlists from collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveAllPlaylistsL()
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemoveAllPlaylistsL");
+    iDbPlaylist->DeleteAllPlaylistsL();
+    }
+
+// ----------------------------------------------------------------------------
+// Remove specified playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemovePlaylistL(
+    TUint32 aPlaylistId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemovePlaylistL");
+
+    HBufC* uri(iDbPlaylist->DeletePlaylistL(aPlaylistId));
+    if (uri)
+        {
+        CleanupStack::PushL(uri);
+        aUriArray.AppendL(*uri);
+        CleanupStack::PopAndDestroy(uri);
+        }
+
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aPlaylistId, EMPXItemDeleted,
+        EMPXPlaylist, KDBPluginUid);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove song from playlist songs table
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveSongFromPlaylistL(
+    TUint32 aPlaylistId,
+    const TMPXItemId& aSongId,
+    TInt aOrdinal,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemoveSongFromPlaylistL");
+    MPX_DEBUG5("CMPXDbHandler::DoRemoveSongFromPlaylistL(playlist 0x%x, songId [0x%x,0x%x], ordinal %d)",
+        aPlaylistId, aSongId.iId1, aSongId.iId2, aOrdinal);
+
+    // delete the song
+    iDbPlaylist->DeleteSongL(aPlaylistId, aSongId.iId2, aOrdinal);
+
+    // Send a playlist modified message
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aPlaylistId, EMPXItemModified,
+        EMPXPlaylist, KDBPluginUid);
+
+    // Send a message on the song in the playlist that is deleted
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aSongId, EMPXItemDeleted,
+        EMPXSong, KDBPluginUid);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::DoCleanupDeletedRecordsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoCleanupDeletedRecordsL()
+    {
+    MPX_FUNC("CMPXDbHandler::DoCleanupDeletedRecordsL");
+
+    // delete all marked records from the Music table
+    iDbMusic->CleanupL();
+
+    // reset the count in the Auxiliary table
+    iDbAuxiliary->SetSaveDeletedRecordCountL(KDbManagerAllDrives,0);
+    }
+
+// ----------------------------------------------------------------------------
+// FindAllL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::FindAllL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::FindAllL");
+
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL(attributes);
+    MPXUser::MergeAttributeL(aAttrs, attributes);
+
+    TMPXGeneralCategory category = aCriteria.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory);
+    switch (category)
+        {
+        case EMPXPlaylist:
+            {
+            TUint32 playlistId(0);
+            if (aCriteria.IsSupported(KMPXMediaGeneralId))
+                {
+                playlistId = (aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+                }
+
+            if (iAutoPlaylist->AutoPlaylistTypeL(playlistId) != EMPXNoAutoPlaylist)
+                {
+                CMPXMedia* media = CMPXMedia::NewL();
+                CleanupStack::PushL(media);
+
+                iAutoPlaylist->GetPlaylistL(playlistId, aAttrs, *media);
+
+                aMediaArray->AppendL(*media);
+                CleanupStack::PopAndDestroy(media);
+                }
+            else
+                {
+                iDbPlaylist->FindAllL(aCriteria, attributes.Array(), *aMediaArray);
+                }
+
+            break;
+            }
+        case EMPXSong:
+            {
+            FindSongL(aCriteria, attributes.Array(), *aMediaArray);
+            break;
+            }
+        default:
+            {
+            DbCategoryL(category)->FindAllL(aCriteria, attributes.Array(), *aMediaArray);
+            break;
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&attributes);
+    }
+
+// ----------------------------------------------------------------------------
+// Get song(s) from the music table that match the given criteria
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::FindSongL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCollection::FindSongL");
+
+    TMPXGeneralType type = aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+
+    TUint32 id(0);
+    if (aCriteria.IsSupported(KMPXMediaGeneralId))
+        {
+        id = (aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        }
+
+    TUint32 containerId(0);
+    if (aCriteria.IsSupported(KMPXMediaGeneralContainerId))
+        {
+        containerId = aCriteria.ValueTObjectL<TUint32>(KMPXMediaGeneralContainerId);
+        }
+
+    //////////////////////////////////////////////////////////////////////
+    // Find songs in the specified playlist
+    //////////////////////////////////////////////////////////////////////
+    TMPXGeneralCategory cat(MPX_ITEM_CATEGORY(id));
+
+    if (type == EMPXGroup &&
+        (cat == EMPXPlaylist ||
+        MPX_ITEM_CATEGORY(containerId) == EMPXPlaylist))
+        {
+        TUint32 playlistId = (cat == EMPXPlaylist) ?
+            id : (containerId & KMCCategoryMask);
+
+        GetPlaylistSongsL(playlistId, aAttrs, aMediaArray);
+        }
+
+    //////////////////////////////////////////////////////////////////////
+    // Find a particular song in the specified playlist. This fills the
+    // song with info from Playlist table first then overwrites it with
+    // info from Songs table if Songs table where this song is located
+    // is present in order to support the display of song titles in a
+    // playlist when memory card is removed if the playlist refers to
+    // songs on the memory card. Caller of this scenario is OpenL/MediaL.
+    // When user attempts to play a track in an auto-playlist, we will
+    // find the song from Songs table directly since auto-playlists are
+    // not stored in the Playlist table. Auto-playlists are query-based,
+    // therefore, when memory card is removed, songs on the memory card
+    // will not be shown in the auto-playlist; hence they do not exhibit
+    // the same challenge as user created playlists.
+    //////////////////////////////////////////////////////////////////////
+    else if (type == EMPXItem &&
+        cat == EMPXCollection &&
+        MPX_ITEM_CATEGORY(containerId) == EMPXPlaylist)
+        {
+        if (iAutoPlaylist->AutoPlaylistTypeL(containerId) != EMPXNoAutoPlaylist)
+            {
+            // auto playlist song, get the song details from the music table
+            iDbMusic->FindSongsL(id, 0, type, aCriteria, aAttrs, aMediaArray);
+            }
+        else
+            {
+            GetPlaylistSongL(id, containerId, aAttrs, aMediaArray);
+            }
+        }
+
+    //////////////////////////////////////////////////////////////////////
+    // Find all songs, all songs in a particular album and/or artist, or
+    // a particular song
+    //////////////////////////////////////////////////////////////////////
+    else
+        {
+        iDbMusic->FindSongsL(id, containerId, type, aCriteria, aAttrs, aMediaArray);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Get song(s) in the specified playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetPlaylistSongsL(
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistSongsL");
+    MPX_DEBUG2("CMPXDbHandler::GetPlaylistSongsL(0x%x)", aPlaylistId);
+
+    // check the auto playlists first
+    if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXRecentlyPlayedPlaylist))
+        {
+        iDbMusic->GetRecentlyPlayedSongsL(aAttrs, aMediaArray);
+        }
+    else if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXMostPlayedPlaylist))
+        {
+        iDbMusic->GetMostPlayedSongsL(aAttrs, aMediaArray);
+        }
+    else if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXRecentlyAddedPlaylist))
+        {
+        iDbMusic->GetRecentlyAddedSongsL(aAttrs, aMediaArray);
+        }
+    else
+        {
+        TInt attrCount(aAttrs.Count());
+        if ( attrCount > 1 || (attrCount == 1 && !(aAttrs[0] == KMPXMediaGeneralId)) )
+            {
+	        TInt plDrive(iDbPlaylist->GetDriveIdL(aPlaylistId));
+	        MPX_TRAPD(err, iDbMusic->GetAllSongsL(plDrive, aPlaylistId, aAttrs, aMediaArray));
+
+	        // song not found in Music table
+	        if (err == KErrNotFound)
+	            {
+	            //
+	            // Leave with KErrNotFound if one of the following is true:
+	            // 1) the requested song is in an auto playlist. Since auto-playlist isn't
+	            //    stored in playlist tables, we won't be able to retrieve info elsewhere
+	            // 2) the requested song is in a user playlist but we cannot find the song
+	            //    info from playlist tables either
+	            //
+	           if (EMPXNoAutoPlaylist != iAutoPlaylist->AutoPlaylistTypeL(aPlaylistId) ||
+	                !iDbPlaylist->Songs().GetSongsL(aPlaylistId, aAttrs, aMediaArray))
+	               {
+	               User::Leave(KErrNotFound);
+	               }
+	            }
+	        else
+	            {
+	            // ignore the error if KErrNotFound
+	            User::LeaveIfError(err);
+	            }
+            }
+        else
+            {
+            // get ids of the songs in the playlist
+            iDbPlaylist->Songs().GetSongsL(aPlaylistId, aMediaArray);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Find all albums or the albums for a specified artist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::FindAlbumL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::FindAlbumL");
+
+    TMPXGeneralType type = aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+
+    TUint32 id(0);
+    if (aCriteria.IsSupported(KMPXMediaGeneralId))
+        {
+        id = aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+        }
+
+    if ((type == EMPXGroup) && (MPX_ITEM_CATEGORY(id) == EMPXArtist))
+        {
+        // get all the albums for the artist
+        GetAlbumsMatchingArtistL(id, aAttrs, aMediaArray);
+        }
+    else
+        {
+        // look up all albums from album table
+        iDbAlbum->FindAllL(aCriteria, aAttrs, aMediaArray);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Extracts the playlist ID and drive ID from a playlist media instance
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::ProcessPlaylistMediaL(
+    CMPXMedia& aMedia,
+    TUint32& aPlaylistId,
+    TInt& aPlaylistDriveId)
+    {
+    MPX_FUNC("CMPXDbHandler::ProcessPlaylistMediaL");
+
+    if (aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        aPlaylistId = aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            // find drive id of the playlist
+            aPlaylistDriveId = TDriveUnit(aMedia.ValueText(KMPXMediaGeneralUri));
+            }
+        else
+            {
+            // Find drive Id(s) of corresponding Playlist Id
+            aPlaylistDriveId = iDbPlaylist->GetDriveIdL(aPlaylistId);
+            }
+        }
+    else if (aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        const TDesC& playlistUri = aMedia.ValueText(KMPXMediaGeneralUri);
+        // find drive id of the playlist
+        aPlaylistDriveId = TDriveUnit(playlistUri);
+
+        // aMedia does not have an ID, make sure the add it
+        aPlaylistId = GetPlaylistIdMatchingUriL(playlistUri);
+        aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aPlaylistId);
+        }
+    else
+        {
+        User::Leave(KErrArgument);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Makes sure that all songs in the specified playlist have the ID, title and URI attributes
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::UpdatePlaylistSongInfoL(
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::UpdatePlaylistSongInfoL");
+
+    CMPXMediaArray* mediaArray = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+    User::LeaveIfNull(mediaArray);
+
+    // make sure each song has Id, Uri, and Title before they can be added to playlist
+    TInt count(mediaArray->Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        CMPXMedia* element = mediaArray->AtL(i);
+
+        // copy each song to deal w/ global heap issues
+        CMPXMedia* entry = CMPXMedia::NewL(*element);
+        CleanupStack::PushL(entry);
+
+        // song has everything, go to next song
+        if (entry->IsSupported(KMPXMediaGeneralUri) &&
+            entry->IsSupported(KMPXMediaGeneralId) &&
+            entry->IsSupported(KMPXMediaGeneralTitle))
+            {
+            // pop entry to maintain CleanupStack
+            CleanupStack::PopAndDestroy(entry);
+            continue;
+            }
+
+        // songs must contain (at minimum) an Uri or an Id
+        if (!entry->IsSupported(KMPXMediaGeneralUri) &&
+            !entry->IsSupported(KMPXMediaGeneralId))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        // get Id
+        if (!entry->IsSupported(KMPXMediaGeneralId))
+            {
+            // fill in the ID if not present
+            TParsePtrC parser(entry->ValueText(KMPXMediaGeneralUri));
+            entry->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+                MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXCollection, parser.FullName(), EFalse));
+            }
+
+        CMPXMedia* song(NULL);
+
+        // update songs info
+        TInt error(iDbMusic->GetSongL(*entry, song));
+        TBool result (ETrue);
+
+        // error can only be KErrNone or KErrNotFound
+        // from CMPXDbMusic::GetSongL
+        // if not found in Music, get info from PlaylistSongs (PlaylistSongs & PlaylistSongInfo) DB
+        if (error == KErrNotFound)
+            {
+            RArray<TMPXAttribute> attributes;
+            CleanupClosePushL(attributes);
+            attributes.AppendL(TMPXAttribute(KMPXMediaIdGeneral,
+                EMPXMediaGeneralId | EMPXMediaGeneralTitle | EMPXMediaGeneralUri | EMPXMediaGeneralFlags));
+
+            // this song doesn't exist in Music table. This song is either a broken link or
+            // is of an unsupported song type that exists in the file system. Broken links
+            // have already been marked as such during playlist import.
+            result = iDbPlaylist->Songs().GetSongL(entry->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId), attributes.Array(), song);
+            if (!result)
+                {
+                // song is a broken link
+                //TUint flags = KMPXMediaGeneralFlagsSetOrUnsetBit;
+                //flags |= KMPXMediaGeneralFlagsIsInvalid; // set flag
+                //t->SetTObjectValueL<TUint>( KMPXMediaGeneralFlags, flags );
+
+                if (entry->IsSupported(KMPXMediaGeneralUri))
+                    {
+                    // no valid Id but has Uri, just verify Title is present
+                    // this is the case if the song is a broken link or podcast
+                    if (!entry->IsSupported(KMPXMediaGeneralTitle))
+                        {
+                        // does not have Title, make up the Title from file name
+                        TParsePtrC parser(entry->ValueText(KMPXMediaGeneralUri));
+                        entry->SetTextValueL(KMPXMediaGeneralTitle, parser.Name());
+                        }
+                    }
+                else
+                    {
+                    // no valid Id & no Uri, bad argument
+                    User::Leave(KErrArgument);
+                    }
+                }
+            CleanupStack::PopAndDestroy(&attributes);
+            }
+
+        // update attributes
+        CleanupStack::PushL(song);
+
+        // song not found in Music or Playlist DB, update entry
+        if(error == KErrNotFound && !result)
+            {
+            mediaArray->InsertL(*entry,i);
+            }
+        else  // found in DB, replace entry
+            {
+            mediaArray->InsertL(*song,i);
+            }
+
+        // replace element in the array
+        CleanupStack::PopAndDestroy(song);
+        CleanupStack::PopAndDestroy(entry);
+        mediaArray->Remove(i+1);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::ProcessMusicFoldersL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::ProcessMusicFoldersL(
+    const CDesCArray& aFolders)
+    {
+    MPX_FUNC("CMPXDbHandler::ProcessMusicFoldersL");
+
+    TInt count(aFolders.MdcaCount());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TPtrC16 folder = aFolders.MdcaPoint(i);
+
+        // check if disk is inserted and act accordingly
+        TDriveUnit driveUnit(folder);
+        if (!iFs.IsValidDrive(driveUnit))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        // append the drive to the drive list
+        iDbDrives.AppendL(driveUnit);
+
+        // make sure the folder is created
+        TVolumeInfo info;
+        if (iFs.Volume(info, driveUnit) == KErrNone)
+           {
+            if (!BaflUtils::PathExists(iFs, folder))
+                {
+                // create music folder if necessary
+                TInt err(iFs.MkDirAll(folder));
+                MPX_DEBUG3("Try to create music folder %S return code %d", &folder, err);
+                if (err != KErrAlreadyExists)
+                    {
+                    User::LeaveIfError(err);
+                    }
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::DbCategoryL
+// ----------------------------------------------------------------------------
+//
+CMPXDbCategory* CMPXDbHandler::DbCategoryL(
+    TMPXGeneralCategory aCategory) const
+    {
+    MPX_FUNC("CMPXDbHandler::DbCategoryL");
+
+    CMPXDbCategory* dbCategory(NULL);
+    switch (aCategory)
+        {
+        case EMPXArtist:
+            {
+            dbCategory = (CMPXDbCategory*)iDbArtist;
+            break;
+            }
+        case EMPXAlbum:
+            {
+            dbCategory = (CMPXDbCategory*)iDbAlbum;
+            break;
+            }
+        case EMPXGenre:
+            {
+            dbCategory = (CMPXDbCategory*)iDbGenre;
+            break;
+            }
+        case EMPXComposer:
+            {
+            dbCategory = (CMPXDbCategory*)iDbComposer;
+            break;
+            }
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return dbCategory;
+    }
+
+// ----------------------------------------------------------------------------
+// Verifies that the volume ID of the database matches the drive
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::VerifyVolumeIdL()
+    {
+    MPX_DEBUG1("CMPXDbHandler::VerifyVolumeIdL <--");
+
+    TInt count( iDbDrives.Count() );
+    for( TInt i=0; i<count; ++i )
+        {
+        if( iDbManager->IsOpen( iDbDrives[i] ) )
+            {
+            TVolumeInfo volInfo;
+            iFs.Volume(volInfo, iDbDrives[i] );
+            TUint curId(volInfo.iUniqueID);
+
+            TInt volId = iDbAuxiliary->IdL( iDbDrives[i] );
+
+            // New database, no volume id set, mask out top bit because this is an uint
+            //
+            MPX_DEBUG3("CMPXDBHandler::VerifyVolumeIdL drive:%i db:%i", curId, volId);
+            if( volId == 0 )
+                {
+                MPX_DEBUG1("CMPXDbHandler::VerifyVolumeIdL -- New ID");
+                BeginTransactionL();
+                TRAPD( err, iDbAuxiliary->SetIdL( iDbDrives[i], curId&0x7FFFFFFF ) );
+                EndTransactionL( err );
+
+                // KSqlDbCorrupted indicates DB corrupted, need to recreate.
+                if ( err == KSqlDbCorrupted )
+                    {
+                    MPX_DEBUG1("CMPXPodcastDbHandler::VerifyVolumeIdL -- Corrupted DB");
+                    iDbManager->RecreateDatabaseL(iDbDrives[i]);
+                    BeginTransactionL();
+                    TRAPD(err, iDbAuxiliary->SetDBCorruptedL( ETrue ) );
+                    EndTransactionL( err );
+                    }
+                }
+            // Unmatched volume id, mark db as corrupt and break
+            //
+            else if ( (curId&0x7FFFFFFF) != (volId&0x7FFFFFFFF) )
+                {
+                MPX_DEBUG1("CMPXDbHandler::VerifyVolumeIdL -- ID match FAILED");
+                iDbManager->RecreateDatabaseL(iDbDrives[i]);
+                BeginTransactionL();
+                TRAPD(err, iDbAuxiliary->SetDBCorruptedL( ETrue ) );
+                EndTransactionL( err );
+                }
+            }
+        }
+    MPX_DEBUG1("CMPXDbHandler::VerifyVolumeIdL -->");
+    }
+
+
+// ----------------------------------------------------------------------------
+// Checks if there is a drive that has a low disk space
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::CheckDiskSpaceOnDrivesL()
+    {
+    MPX_DEBUG1("CMPXDbHandler::CheckDiskSpaceOnDrivesL <--");
+
+    TInt count( iDbDrives.Count() );
+    for( TInt index=0; index<count; ++index )
+        {
+        iDbManager->CheckDiskSpaceL(iDbDrives[index]);
+        }
+    MPX_DEBUG1("CMPXDbHandler::CheckDiskSpaceOnDrivesL -->");
+    }
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::SaveDeletedSongs
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::SaveDeletedSongs()
+    {
+    MPX_FUNC("CMPXDbHandler::SaveDeletedSongs");
+
+    TBool saveDeletedSongs(ETrue);
+    CRepository* cenrep(NULL);
+    MPX_TRAPD(error, cenrep = CRepository::NewL(KMPXMtpSettings));
+    if (!error)
+        {
+        cenrep->Get(KMPXMtpSaveDeletedRecordFlag, saveDeletedSongs);
+        delete cenrep;
+        MPX_DEBUG2("MTP indicated to save deleted songs? %d", saveDeletedSongs);
+        }
+
+    return saveDeletedSongs;
+    }
+
+#endif
+
+#ifdef RD_MULTIPLE_DRIVE
+
+// ----------------------------------------------------------------------------------------------------------
+// Retrieve all visible music folder locations
+// ----------------------------------------------------------------------------------------------------------
+//
+CDesCArrayFlat* CMPXDbHandler::GetMusicFoldersL()
+    {
+    MPX_FUNC("CMPXDbHandler::GetMusicFoldersL()");
+    TDriveList driveList;
+    TInt driveCount(0);
+    User::LeaveIfError(DriveInfo::GetUserVisibleDrives(iFs, driveList, driveCount));
+    MPX_DEBUG2 ("CMPXDbHandler::GetMusicFoldersL() - driveCount = %d", driveCount);
+
+    CDesCArrayFlat* folders = new (ELeave) CDesCArrayFlat(1); // granularity
+    CleanupStack::PushL(folders);
+
+    for (TInt i = EDriveA; i <= EDriveZ; i++)
+        {
+        if ((driveList[i]) && (!IsRemoteDrive(static_cast<TDriveNumber>(i))))
+            {
+            if (i == EDriveC)
+                {
+                // Append the default phone memory path to the list
+                // of music folders
+                TPtrC rootPath(PathInfo::PhoneMemoryRootPath());
+                folders->AppendL(rootPath);
+                MPX_DEBUG2("CMPXDbHandler::GetMusicFoldersL() - adding...%S", &rootPath);
+                }
+            else
+                {
+                // Get drive letter
+                TChar driveChar;
+                User::LeaveIfError(iFs.DriveToChar(i, driveChar));
+
+                // Append visible drive to list of music folders
+                TBuf<2> drive;
+                drive.Append(driveChar);
+                drive.Append(_L(":"));
+                folders->AppendL(drive);
+                MPX_DEBUG2 ("CMPXDbHandler::GetMusicFoldersL() - adding...%S", &drive);
+                }
+            }
+        }
+
+    CleanupStack::Pop(folders);
+    return folders;
+    }
+
+#endif // RD_MULTIPLE_DRIVE
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::AddCategoryItemL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::AddCategoryItemL(
+    TMPXGeneralCategory aCategory,
+    const TDesC& aName,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TBool& aItemExist)
+    {
+    MPX_FUNC("CMPXDbHandler::AddCategoryItemL()");
+
+    MPX_PERF_START(CMPXDbHandler_AddCategoryItemL);
+
+    TBool newRecord(EFalse);
+    TUint32 id(DbCategoryL(aCategory)->AddItemL(aName, aDriveId, newRecord, (aCategory != EMPXGenre)));
+    if (newRecord && aItemChangedMessages)
+        {
+        MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemInserted,
+            aCategory, KDBPluginUid);
+        }
+    aItemExist = !newRecord;
+    MPX_PERF_END(CMPXDbHandler_AddCategoryItemL);
+
+    return id;
+    }
+
+TUint32 CMPXDbHandler::AddCategoryItemL(
+        TMPXGeneralCategory aCategory,
+        const TDesC& aName,
+        TUint32 aArtist,
+        const TDesC& aArt,
+        TInt aDriveId,
+        CMPXMessageArray* aItemChangedMessages,
+        TBool& aItemExist)
+	{
+    MPX_FUNC("CMPXDbHandler::AddCategoryItemL()");
+
+    MPX_PERF_START(CMPXDbHandler_AddCategoryItemL);
+
+    TBool newRecord(EFalse);
+
+    TUint32 id = 0;
+    if ( aArtist )
+        {
+        id = iDbAlbum->AddItemL(aName, aArtist, aArt, aDriveId, newRecord, (aCategory != EMPXGenre));
+        }
+    else
+        {
+        id = iDbArtist->AddItemL(aName, aArt, aDriveId, newRecord, (aCategory != EMPXGenre));
+        }
+
+    if (newRecord && aItemChangedMessages)
+        {
+        MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemInserted,
+            aCategory, KDBPluginUid);
+        }
+    aItemExist = !newRecord;
+    MPX_PERF_END(CMPXDbHandler_AddCategoryItemL);
+
+    return id;
+	}
+
+void CMPXDbHandler::UpdateCategoryItemL(
+		TMPXGeneralCategory aCategory,
+		TUint32 aCategoryId,
+		const CMPXMedia& aMedia,
+		TInt aDrive,
+		CMPXMessageArray* aItemChangedMessages)
+	{
+	switch(aCategory)
+	    {
+	    case EMPXAlbum:
+            iDbAlbum->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
+	        break;
+
+	    case EMPXArtist:
+	        iDbArtist->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
+	        break;
+
+	    default:
+            DbCategoryL(aCategory)->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
+	        break;
+	    }
+	}
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::DeleteSongForCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DeleteSongForCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TBool& aItemExist)
+    {
+    MPX_FUNC("CMPXDbHandler::DeleteSongForCategoryL");
+    DbCategoryL(aCategory)->DecrementSongsForCategoryL(aCategoryId, aDriveId,
+        aItemChangedMessages, aItemExist);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::HandlePlayCountModifiedL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::HandlePlayCountModifiedL(
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::HandlePlayCountModifiedL");
+
+    TUint32 plId(iAutoPlaylist->AutoPlaylistIdL(EMPXMostPlayedPlaylist));
+
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, plId, EMPXItemModified,
+        EMPXSong, KDBPluginUid, plId);
+
+    // Force the deprecated ID attribute
+    aItemChangedMessages[aItemChangedMessages.Count() - 1]->
+        SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, plId);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// CMPXDbHandler::HandlePlaybackTimeModifiedL
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbHandler::HandlePlaybackTimeModifiedL(
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::HandlePlaybackTimeModifiedL");
+
+    TUint32 plId(iAutoPlaylist->AutoPlaylistIdL(EMPXRecentlyPlayedPlaylist));
+
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, plId, EMPXItemModified,
+        EMPXSong, KDBPluginUid, plId);
+
+    // Force the deprecated ID attribute
+    aItemChangedMessages[aItemChangedMessages.Count() - 1]->
+        SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, plId);
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMPXDbHandler::IsRemoteDrive
+// ---------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::IsRemoteDrive(TDriveNumber aDrive)
+    {
+    return iDbManager->IsRemoteDrive(aDrive);
+    }
+
+TInt CMPXDbHandler::HandlePlaylistDurationL(TUint32 aPlaylistId)
+	{
+	return GetPlaylistDurationL(aPlaylistId);
+	}
+
+TInt CMPXDbHandler::HandleGetAlbumsCountForArtistL(TUint32 aArtistId)
+	{
+	return iDbAlbum->GetAlbumsCountForArtistL(aArtistId);
+	}
+
+TBool CMPXDbHandler::HandleIsUnknownArtistL(TUint32 aArtistId)
+    {
+    return iDbArtist->IsUnknownArtistL(aArtistId);
+    }
+
+TUint32 CMPXDbHandler::HandleArtistForAlbumL(const TUint32 aAlbumId)
+    {
+    return iDbMusic->ArtistForAlbumL(aAlbumId);
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbmusic.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2562 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the music table.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxcollectionpath.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediamtpdefs.h>
+#include <mpxcollectiondbhgres.rsg>
+
+#include "mpxdbcommondef.h"
+#include "mpxdbcommonstd.h"
+#include "mpxdbcommonutil.h"
+#include "mpxresource.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxcollectiondbstd.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbutil.h"
+#include "mpxdbmanager.h"
+#include "mpxdbmusic.h"
+
+// CONSTANTS
+
+// This is what KNullDesC album computes to for the hash
+// to-do: generate this Id through
+//        MPXDbUtil::GenerateUniqueIdL(EMPXAlbum, KNullDesC, EFalse)
+//        instead of hard-coding the number so if GenerateUniqueIdL
+//        is modified, this constant doesn't need to be redefined
+const TInt KUnknownAlbumID = 1770790356;
+// UniqueID column in Uris requests
+const TInt KColUniqueID = 0;
+// URI column in Uris requests
+const TInt KColUri = 1;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbMusic* CMPXDbMusic::NewL(
+    CMPXDbManager& aDbManager,
+    CMPXResource& aResource,
+    MMPXDbMusicObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbMusic::NewL");
+    CMPXDbMusic* self = CMPXDbMusic::NewLC(aDbManager, aResource, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbMusic* CMPXDbMusic::NewLC(
+    CMPXDbManager& aDbManager,
+    CMPXResource& aResource,
+    MMPXDbMusicObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbMusic::NewLC");
+
+    CMPXDbMusic* self = new (ELeave) CMPXDbMusic(aDbManager, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL(aResource);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbMusic::~CMPXDbMusic()
+    {
+    MPX_FUNC("CMPXDbMusic::~CMPXDbMusic");
+    delete iExtensionsDrm;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbMusic::CMPXDbMusic(
+    CMPXDbManager& aDbManager,
+    MMPXDbMusicObserver& aObserver) :
+    CMPXDbTable(aDbManager),
+    iObserver(aObserver)
+    {
+    MPX_FUNC("CMPXDbMusic::CMPXDbMusic");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::ConstructL(
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbMusic::ConstructL");
+
+    BaseConstructL();
+    iExtensionsDrm = aResource.ReadDesCArrayL(R_MC_FILE_EXTENSIONS_DRM);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::AddSongL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbMusic::AddSongL(
+    const CMPXMedia& aMedia,
+    TInt aDrive,
+    CMPXMessageArray* aMessageArray)
+    {
+    MPX_FUNC("CMPXDbMusic::AddSongL");
+
+    TUint32 songId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection,
+        aMedia.ValueText(KMPXMediaGeneralUri), EFalse));
+
+    if (SongExistsL(songId))
+        {
+        // Delete the existing record first and start from scratch
+        DeleteSongL(songId, aDrive, ETrue);
+        }
+    // add the song
+    DoAddSongL(songId, aMedia, aDrive, aMessageArray);
+
+    return songId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DoAddSongL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::DoAddSongL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    TInt aDrive,
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbMusic::DoAddSongL");
+
+    CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EMusicFieldCount);
+    CleanupStack::PushL(fields);
+    CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EMusicFieldCount);
+    CleanupStack::PushL(values);
+
+    // add known fields
+    MPXDbCommonUtil::AppendValueL(*fields, *values, KMCMusicUniqueId, aSongId);
+    MPXDbCommonUtil::AppendValueL(*fields, *values, KMCMusicDel, 0);
+
+    TTime time;
+    time.HomeTime();
+    HBufC* timeAdded = MPXDbCommonUtil::TTimeToDesLC(time);
+    MPXDbCommonUtil::AppendValueL(*fields, *values, KMCMusicTimeAdded, *timeAdded);
+    CleanupStack::PopAndDestroy(timeAdded);
+
+    // process the media parameter and construct the fields and values array
+    TBool visible(GenerateMusicFieldsValuesL(aSongId, aMedia, aItemChangedMessages,
+        NULL, *fields, *values, aDrive));
+
+    // create the fields and values strings
+    HBufC* fieldStr = MPXDbCommonUtil::StringFromArrayLC(*fields, KMCCommaSign);
+    HBufC* valueStr = MPXDbCommonUtil::StringFromArrayLC(*values, KMCCommaSign);
+
+    // execute the query
+    iDbManager.ExecuteQueryL(aDrive, KQueryMusicInsert, fieldStr, valueStr);
+
+    CleanupStack::PopAndDestroy(valueStr);
+    CleanupStack::PopAndDestroy(fieldStr);
+    CleanupStack::PopAndDestroy(values);
+    CleanupStack::PopAndDestroy(fields);
+
+    return visible;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateSongL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::UpdateSongL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbMusic::UpdateSongL");
+    return DoUpdateSongL(aSongId, aMedia, &aItemChangedMessages);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DoUpdateSongL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::DoUpdateSongL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbMusic::DoUpdateSongL");
+
+    CMPXDbActiveTask::TChangeVisibility visible(CMPXDbActiveTask::ENotVisibile);
+    if (IsSupported(aMedia))
+        {
+        // retrieve the existing record
+        TInt oldSongId(0);
+        oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        if ( oldSongId <= 0 )
+            {
+            oldSongId = aSongId;
+            }
+        RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetSong, oldSongId));
+        CleanupClosePushL(recordset);
+
+        if (recordset.Next() != KSqlAtRow)
+            {
+            User::Leave(KErrNotFound);
+            }
+
+        TDriveUnit driveUnit(MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+          recordset.ColumnInt64(EMusicVolumeId)));
+        visible = DoUpdateSongL(aSongId, aMedia, driveUnit, aItemChangedMessages,
+          recordset);
+
+        // Update Album table
+		if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName) || aMedia.IsSupported(KMPXMediaMusicArtist))
+			{
+			TUint32 albumId = recordset.ColumnInt64(EMusicAlbum);
+			iObserver.UpdateCategoryItemL(EMPXAlbum, albumId, aMedia, driveUnit, aItemChangedMessages);
+			}
+
+        // Update Artist table
+        if ( aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName) )
+            {
+            TUint32 artistId = recordset.ColumnInt64(EMusicArtist);
+            iObserver.UpdateCategoryItemL(EMPXArtist, artistId, aMedia, driveUnit, aItemChangedMessages);
+            }
+
+        CleanupStack::PopAndDestroy(&recordset);
+        }
+
+    return visible;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DoUpdateSongL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::DoUpdateSongL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    TInt aDrive,
+    CMPXMessageArray* aItemChangedMessages,
+    RSqlStatement& aRecordset)
+    {
+    MPX_FUNC("CMPXDbMusic::DoUpdateSongL");
+
+    CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EMusicFieldCount);
+    CleanupStack::PushL(fields);
+    CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EMusicFieldCount);
+    CleanupStack::PushL(values);
+
+    TInt oldSongId(0);
+    oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+    if ( oldSongId <= 0 )
+        {
+        oldSongId = aSongId;
+        }
+    // process the media parameter and construct the fields and values array
+    CMPXDbActiveTask::TChangeVisibility visible(GenerateMusicFieldsValuesL(oldSongId, aMedia, aItemChangedMessages,
+        &aRecordset, *fields, *values, aDrive));
+
+    // construct the SET string
+    HBufC* setStr = MPXDbCommonUtil::StringFromArraysLC(*fields, *values, KMCEqualSign, KMCCommaSign);
+    if (setStr->Length())
+        {
+        // execute the query
+        iDbManager.ExecuteQueryL(aDrive, KQueryMusicUpdate, setStr, oldSongId);
+        }
+
+    CleanupStack::PopAndDestroy(setStr);
+    CleanupStack::PopAndDestroy(values);
+    CleanupStack::PopAndDestroy(fields);
+
+    return visible;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DeleteSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::DeleteSongL(
+    TUint32 aSongId,
+    TInt aDrive,
+    TBool aDeleteRecord /* = EFalse */)
+    {
+    MPX_FUNC("CMPXDbMusic::DeleteSongL");
+
+    TPtrC query(aDeleteRecord ? KQueryMusicDelete() : KQueryMusicDeleteUpdate());
+    iDbManager.ExecuteQueryL(aDrive, query, aSongId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DeleteCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::DeleteCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    CDesCArray& /* aUriArray */,
+    CMPXMessageArray& /* aItemChangedMessages */,
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbMusic::DeleteCategoryL");
+    TPtrC ptr(MPXDbUtil::MusicFieldNameForCategoryL(aCategory));
+    iDbManager.ExecuteQueryL(aDrive, KQueryMusicDeleteForCategory, &ptr, aCategoryId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::CleanupL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::CleanupL()
+    {
+    MPX_FUNC("CMPXDbMusic::CleanupL");
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryMusicCleanup);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetNameL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbMusic::GetNameL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbMusic::GetNameL");
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetTitle, aSongId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::LeaveIfError(KErrNotFound);
+        }
+
+    HBufC* title = MPXDbCommonUtil::GetColumnTextL(recordset, KMPXTableDefaultIndex).AllocL();
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return title;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetUriL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbMusic::GetUriL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbMusic::GetUriL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetUri, aSongId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::LeaveIfError(KErrNotFound);
+        }
+
+    // query fields
+    enum
+        {
+        EMusicUriLocation = 0,
+        EMusicUriVolId
+        };
+
+    TUint volId(recordset.ColumnInt64(EMusicUriVolId));
+    HBufC* fullUri = MPXDbCommonUtil::CreateFullPathL(
+        MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId),
+        MPXDbCommonUtil::GetColumnTextL(recordset, EMusicUriLocation));
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return fullUri;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetDriveL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::GetDriveL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbMusic::GetDriveL");
+    return MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+        ExecuteIntQueryL(KQueryMusicVolume, aSongId));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongInfoL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbMusic::GetSongInfoL(
+    TUint32 aSongId,
+    TUint32& aArtistId,
+    TUint32& aAlbumId,
+    TUint32& aGenreId,
+    TUint32& aComposerId,
+    TInt& aDriveId)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongInfoL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicInfo, aSongId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    aDriveId = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+        recordset.ColumnInt64(EMusicVolumeId));
+    aArtistId = recordset.ColumnInt64(EMusicArtist);
+    aAlbumId = recordset.ColumnInt64(EMusicAlbum);
+    aGenreId = recordset.ColumnInt64(EMusicGenre);
+    aComposerId = recordset.ColumnInt64(EMusicComposer);
+    HBufC* uri = ConstructUriL(recordset);
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return uri;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::GetSongL(
+    const CMPXMedia& aCriteria,
+    CMPXMedia*& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongL");
+
+    TUint32 songId(0);
+
+    // find song Id, title, URI, and general flags from its Id and/or URI. Do not use "aCriteria"
+    // because it may contain attributes other than Id and URI. We don't want to search the
+    // song by fields other than the ID and URI because other attributes for the song may have
+    // been changed in the collection since the song was added
+    CMPXMedia* criteria = CMPXMedia::NewL();
+    CleanupStack::PushL(criteria);
+    if (aCriteria.IsSupported(KMPXMediaGeneralId))
+        {
+        songId = (aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        criteria->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, songId);
+        }
+    else if (aCriteria.IsSupported(KMPXMediaGeneralUri))
+        {
+        criteria->SetTextValueL(KMPXMediaGeneralUri,
+            aCriteria.ValueText(KMPXMediaGeneralUri));
+        }
+
+    // get the criteria string
+    HBufC* criteriaStr = GenerateMusicMatchingCriteriaLC(songId, 0, EMPXItem, *criteria);
+
+    // execute the query
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicSong, criteriaStr));
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    if ((err = recordset.Next()) == KSqlAtRow)
+        {
+        RArray<TMPXAttribute> attributes;
+        CleanupClosePushL(attributes);
+        attributes.AppendL(TMPXAttribute(KMPXMediaIdGeneral,
+            EMPXMediaGeneralId | EMPXMediaGeneralTitle | EMPXMediaGeneralUri | EMPXMediaGeneralFlags));
+
+        aMedia = CMPXMedia::NewL();
+        CleanupStack::PushL(aMedia);
+
+        UpdateMediaL(recordset, attributes.Array(), *aMedia);
+
+        CleanupStack::Pop(aMedia);
+        CleanupStack::PopAndDestroy(&attributes);
+
+        err = KErrNone;
+        }
+    else
+        {
+        err = KErrNotFound;
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(criteriaStr);
+    CleanupStack::PopAndDestroy(criteria);
+
+    return err;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetRecentlyPlayedSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetRecentlyPlayedSongsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetRecentlyPlayedSongsL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetRecentlyPlayed,
+        KMPXMaxRecentlyPlayedSongs);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetMostPlayedSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetMostPlayedSongsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetMostPlayedSongsL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetMostPlayed() : KQueryMusicGetMostPlayedNoCategories(),
+        KMPXMaxMostPlayedSongs);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetRecentlyAddedSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetRecentlyAddedSongsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetRecentlyAddedSongsL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetRecentlyAdded() : KQueryMusicGetRecentlyAddedNoCategories());
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::CountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::CountL()
+    {
+    MPX_FUNC("CMPXDbMusic::CountL");
+    return ExecuteSumQueryL(KQueryMusicCount);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetAlbumsForArtistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetAlbumsForArtistL(
+    TUint32 aArtistId,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetAlbumsForArtistL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicAlbum, aArtistId));
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        TUint32 albumId(recordset.ColumnInt64(KMPXTableDefaultIndex));
+
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, albumId);
+        media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+        media->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXAlbum);
+
+        aMediaArray.AppendL(*media);
+        CleanupStack::PopAndDestroy(media);
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(KErrCorrupt);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongL(
+    TInt aSongId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongL");
+    ExecuteMediaQueryL(aAttrs, aMedia, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetSong() : KQueryMusicGetSongNoCategories(), aSongId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetAllSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetAllSongsL(
+    TInt aDrive,
+    TInt aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetAllSongsL");
+    ExecuteMediaQueryL(aDrive, aAttrs, aMediaArray, KQueryMusicGetAllSongsInfobyPl(), aPlaylistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetAllSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetAllSongsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetAllSongsL");
+
+    // do not execute the joins if no category name is required
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetAllSongs() : KQueryMusicGetAllSongsNoCategories());
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetAllSongsLimitedL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs,
+                                      CMPXMediaArray& aMediaArray, TInt aLimit)
+    {
+    MPX_FUNC("CMPXDbMusic::GetAllSongsLimitedL");
+
+    // Gets a subset of the data from all songs ordered by title
+    HBufC* query = HBufC::NewLC( KQueryMusicGetSongsLimited().Length() + KMCIntegerLen );
+    query->Des().Format( KQueryMusicGetSongsLimited, aLimit );
+    ExecuteMediaQueryL(aAttrs, aMediaArray, *query);
+    CleanupStack::PopAndDestroy( query );    
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsInBlockL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsInBlockL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    TPtrC aTitle,
+    TUint aNumOfSongs,
+    TBool aAsc)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsInBlockL");
+
+    if (aAsc)
+        { 
+        ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetSongsInBlockAsc,
+                              aTitle, aNumOfSongs, ETrue, EAscQuery );    
+        }
+    else
+        {
+        ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetSongsInBlockDsc,
+                           aTitle, aNumOfSongs, EFalse, EDscQuery );        
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsAtOffsetL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsAtOffsetL( CMPXMediaArray& aMediaArray,
+                                     const TArray<TMPXAttribute>& aAttrs,
+                                     TInt aOffset,
+                                     TInt aCount )
+    {
+    MPX_DEBUG1("CMPXDbMusic::GetSongsAtOffsetL <--");   
+
+    ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetSongsAtOffset, 
+                       aCount, aOffset, EOffSetQuery );
+    
+    MPX_DEBUG1("CMPXDbMusic::GetSongsAtOffsetL() -->"); 
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsForArtistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsForArtistL(
+    TUint aArtistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsForArtistL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetSongsForArtist() : KQueryMusicGetSongsForArtistNoCategories(),
+        aArtistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsForAlbumL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsForAlbumL(
+    TUint aAlbumId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsForAlbumL");
+
+    TPtrC query;
+    if (aAlbumId == KUnknownAlbumID)
+        {
+        query.Set(ExtraFieldsRequired(aAttrs) ? KQueryMusicGetSongsForUnknownAlbum() :
+            KQueryMusicGetSongsForUnknownAlbumNoCategories());
+        }
+    else
+        {
+        query.Set(ExtraFieldsRequired(aAttrs) ? KQueryMusicGetSongsForAlbum() :
+            KQueryMusicGetSongsForAlbumNoCategories());
+        }
+
+    ExecuteMediaQueryL(aAttrs, aMediaArray, query, aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsForArtistAndAlbumL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsForArtistAndAlbumL(
+    TUint aArtistId,
+    TUint aAlbumId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsForArtistAndAlbumL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetSongsForArtistAlbum() : KQueryMusicGetSongsForArtistAlbumNoCategories(),
+        aArtistId, aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsForGenreL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsForGenreL(
+    TUint aGenreId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsForGenreL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetSongsForGenre() : KQueryMusicGetSongsForGenreNoCategories(),
+        aGenreId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsForComposerL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsForComposerL(
+    TUint aComposerId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsForComposerL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetSongsForComposer() : KQueryMusicGetSongsForComposerNoCategories(),
+        aComposerId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::AllSongsDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::AllSongsDurationL()
+    {
+    MPX_FUNC("CMPXDbMusic::AllSongsDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationAll);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ArtistDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::ArtistDurationL(
+    TUint aArtistId)
+    {
+    MPX_FUNC("CMPXDbMusic::ArtistDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationArtist, aArtistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::AlbumDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::AlbumDurationL(
+    TUint aAlbumId)
+    {
+    MPX_FUNC("CMPXDbMusic::AlbumDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationAlbum, aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ArtistAlbumDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::ArtistAlbumDurationL(
+    TUint aArtistId,
+    TUint aAlbumId)
+    {
+    MPX_FUNC("CMPXDbMusic::ArtistAlbumDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationArtistAlbum, aArtistId, aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GenreDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::GenreDurationL(
+    TUint aGenreId)
+    {
+    MPX_FUNC("CMPXDbMusic::GenreDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationGenre, aGenreId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ComposerDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::ComposerDurationL(
+    TUint aComposerId)
+    {
+    MPX_FUNC("CMPXDbMusic::ComposerDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationComposer, aComposerId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::RecentlyPlayedDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::RecentlyPlayedDurationL()
+    {
+    MPX_FUNC("CMPXDbMusic::RecentlyPlayedDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationRecentlyPlayed, KMPXMaxRecentlyPlayedSongs);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::MostPlayedDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::MostPlayedDurationL()
+    {
+    MPX_FUNC("CMPXDbMusic::MostPlayedDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationMostPlayed, KMPXMaxMostPlayedSongs);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::RecentlyAddedDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::RecentlyAddedDurationL()
+    {
+    MPX_FUNC("CMPXDbMusic::RecentlyAddedDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationRecentlyAdded);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::FindSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::FindSongsL(
+    TUint32 aGeneralId,
+    TUint32 aContainerId,
+    TMPXGeneralType aType,
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::FindSongsL");
+
+    // get the selection criteria string
+    HBufC* criteriaStr = GenerateMusicMatchingCriteriaLC(aGeneralId, aContainerId, aType,
+        aCriteria);
+
+    // construct the sort order depending on category. Albums are always sorted by track,
+    // then name, except for unknown album. Songs are sorted by name for unknown album.
+    // NULL track number is stored as KMaxTInt so that they will be sorted to the end
+    TPtrC sortOrder;
+    if ((aType == EMPXGroup) && (MPX_ITEM_CATEGORY(aGeneralId) == EMPXAlbum) &&
+        (aGeneralId != MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXAlbum, KNullDesC, EFalse)))
+        {
+        sortOrder.Set(KQueryMusicFindAllSortOrderTrack);
+        }
+    else
+        {
+        sortOrder.Set(KQueryMusicFindAllSortOrderTitle);
+        }
+
+    // construct the query
+    HBufC* query = HBufC::NewLC(KQueryMusicFindAll().Length() + criteriaStr->Length() +
+        sortOrder.Length());
+    query->Des().Format(KQueryMusicFindAll, criteriaStr, &sortOrder);
+
+    // iterate the results and append media objects to the destination array
+    ExecuteMediaQueryL(aAttrs, aMediaArray, *query);
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(criteriaStr);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetDriveTrackCount
+// ----------------------------------------------------------------------------
+//
+TUint CMPXDbMusic::GetDriveTrackCountL(TInt aDrive)
+    {
+    TUint count(0);
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,KQueryMusicCount));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    count = TUint(recordset.ColumnInt64(KMPXTableDefaultIndex));
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetMusicUriArrayL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                    CDesCArray& aUriArr, TInt& aLastID)
+    {
+    MPX_FUNC("CMPXDbMusic::GetMusicUriArrayL");
+
+    HBufC* query = NULL;
+    if(aFromID == 0)
+        {
+        query = HBufC::NewLC(KQueryMusicGetMusicUris().Length() + KMCIntegerLen);
+        query->Des().Format(KQueryMusicGetMusicUris, aRecords);
+        }
+    else
+        {
+        query = HBufC::NewLC(KQueryMusicGetMusicUrisFrom().Length() + 2*KMCIntegerLen);
+        query->Des().Format(KQueryMusicGetMusicUrisFrom, aFromID, aRecords);
+        }
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,*query));
+
+    CleanupStack::PopAndDestroy(query);
+
+    CleanupClosePushL(recordset);
+
+    TInt lastID = 0;
+    TInt err(KErrNone);
+    while((err = recordset.Next()) == KSqlAtRow)
+        {
+        HBufC* fullPath = MPXDbCommonUtil::CreateFullPathL(aDrive,
+                MPXDbCommonUtil::GetColumnTextL(recordset, KColUri));
+        CleanupStack::PushL(fullPath);
+        aUriArr.AppendL(*fullPath);
+        CleanupStack::PopAndDestroy(fullPath);
+
+        lastID = recordset.ColumnInt(KColUniqueID);
+        }
+    CleanupStack::PopAndDestroy(&recordset);
+
+    aLastID = lastID;
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ArtistForAlbumL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbMusic::ArtistForAlbumL(const TUint32 aId)
+    {
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetArtistForAlbum, aId));
+
+    CleanupClosePushL(recordset);
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    TUint32 artistId = recordset.ColumnInt64(KMPXTableDefaultIndex);
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return artistId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::RefreshStartL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::RefreshStartL()
+    {
+    iRefresh = ETrue;
+    MPX_FUNC("CMPXDbMusic::RefreshStartL");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::RefreshEndL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::RefreshEndL()
+    {
+    MPX_FUNC("CMPXDbMusic::RefreshEndL");
+    iRefresh = EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::SongExistsL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::SongExistsL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbMusic::SongExistsL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicVolumeAll, aSongId));
+    TBool found = (recordset.Next() == KSqlAtRow);
+    recordset.Close();
+
+    return found;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::UpdateMediaL(
+    RSqlStatement& aMusicTable,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::UpdateMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        switch (aAttrs[i].ContentId())
+            {
+            case KMPXMediaIdGeneral:
+                {
+                UpdateMediaGeneralL(aMusicTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            case KMPXMediaIdMusic:
+                {
+                UpdateMediaMusicL(aMusicTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            case KMPXMediaIdDrm:
+                {
+                // DRM is set by drm helper
+                break;
+                }
+            case KMPXMediaIdMTP:
+                {
+                // Only attribute stored in db is MTP drm status
+                UpdateMediaMTPL(aMusicTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            case KMPXMediaIdAudio:
+                {
+                UpdateMediaAudioL(aMusicTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            default:
+                // Do not leave. If this plugin doesn't support
+                // the content id they want, just return what we have
+                break;
+            } // end switch
+        } // end for
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateMediaGeneralL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::UpdateMediaGeneralL(
+    RSqlStatement& aMusicTable,
+    const TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_DEBUG1("-->CMPXDbMusic::UpdateMediaGeneralL");
+    MPX_DEBUG2("    aAttrId=%b", aAttrId);
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem );
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXSong );
+
+    // FIX ME, temporary always fetch item ID
+    //if (aAttrId & EMPXMediaGeneralId)
+    if (!aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        MPX_DEBUG1("    !aMedia.IsSupported(KMPXMediaGeneralId)");
+        TUint32 songId(aMusicTable.ColumnInt64(EMusicUniqueId));
+        TInt columnCount(aMusicTable.ColumnCount());
+        if(columnCount == 37 && aMusicTable.ColumnIndex(_L("PlUId"))==35)
+            {
+            TUint32 pListUId(aMusicTable.ColumnInt64(35));
+            aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, TMPXItemId(pListUId, songId));
+        	}
+        else
+        	{
+        	aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, songId);
+        	}
+        MPX_DEBUG2("    SongId[%d]", songId);
+        }
+    // FIX ME temporary always fetch URI
+    if (aAttrId & EMPXMediaGeneralUri)
+        {
+        MPX_DEBUG1("    !aMedia.IsSupported(KMPXMediaGeneralUri)");
+        HBufC* uri = ConstructUriL(aMusicTable);
+        CleanupStack::PushL(uri);
+        aMedia.SetTextValueL(KMPXMediaGeneralUri, *uri);
+        MPX_DEBUG2("    FullPath[%S]", uri);
+        CleanupStack::PopAndDestroy(uri);
+        }
+    if (aAttrId & EMPXMediaGeneralDrive)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralDrive");
+        TDriveUnit driveUnit;
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            MPX_DEBUG1("        aMedia.IsSupported(KMPXMediaGeneralUri)");
+            driveUnit = aMedia.ValueText(KMPXMediaGeneralUri);
+            MPX_DEBUG2("        driveUnit=%d", (TInt)driveUnit);
+            }
+        else
+            {
+            MPX_DEBUG1("        !aMedia.IsSupported(KMPXMediaGeneralUri)");
+            driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+                aMusicTable.ColumnInt64(EMusicVolumeId));
+            MPX_DEBUG2("        driveUnit=%d", (TInt)driveUnit);
+            }
+
+        TPtrC driveName(driveUnit.Name());
+        aMedia.SetTextValueL(KMPXMediaGeneralDrive, driveName);
+        MPX_DEBUG2("    Drive[%S]", &driveName);
+        }
+    if (aAttrId & EMPXMediaGeneralSize)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralSize");
+        // to-do: store this in the DB
+        }
+    if (aAttrId & EMPXMediaGeneralDuration)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralDuration");
+        TInt32 duration(aMusicTable.ColumnInt(EMusicDuration));
+        aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+        MPX_DEBUG2("    Duration[%d]", duration);
+        }
+    if ((aAttrId & EMPXMediaGeneralTitle) && !aMedia.IsSupported(KMPXMediaGeneralTitle))
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralTitle");
+        TPtrC title(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicTitle));
+        aMedia.SetTextValueL(KMPXMediaGeneralTitle, title);
+        MPX_DEBUG2("    Title[%S]", &title);
+        }
+    if ( aAttrId & EMPXMediaGeneralDate)
+		{
+		MPX_DEBUG1("    EMPXMediaGeneralDate");
+		const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL (aMusicTable,
+				EMusicTimeAdded));
+		if ( dateStr.Compare (KNullDesC)!= 0)
+			{
+			TTime dateTime(MPXDbCommonUtil::DesToTTimeL (dateStr));
+			aMedia.SetTObjectValueL<TInt64> (KMPXMediaGeneralDate,
+					dateTime.Int64 ());
+			}
+		MPX_DEBUG2("    Date[%S]", &dateStr);
+		}
+    if (aAttrId & EMPXMediaGeneralComment)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralComment");
+        TPtrC comment(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicComment));
+        aMedia.SetTextValueL(KMPXMediaGeneralComment, comment);
+        MPX_DEBUG2("    Comment[%S]", &comment);
+        }
+    if (aAttrId & EMPXMediaGeneralMimeType)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralMimeType");
+        TPtrC mimeType(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicMimeType));
+        aMedia.SetTextValueL(KMPXMediaGeneralMimeType, mimeType);
+        MPX_DEBUG2("    MimeType[%S]", &mimeType);
+        }
+    if (aAttrId & EMPXMediaGeneralSynchronized)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralSynchronized");
+        TInt sync(aMusicTable.ColumnInt(EMusicSync));
+        aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralSynchronized, sync);
+        MPX_DEBUG2("    Synchronized[%d]", sync);
+        }
+    if (aAttrId & EMPXMediaGeneralDeleted)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralDeleted");
+        TInt del(aMusicTable.ColumnInt(EMusicDeleted));
+        aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralDeleted, del);
+        MPX_DEBUG2("    Deleted[%d]", del);
+        }
+    if (aAttrId & EMPXMediaGeneralModified)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralModified");
+        TInt mod(aMusicTable.ColumnInt(EMusicModified));
+        aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralModified, mod);
+        MPX_DEBUG2("    Modified[%d]", mod);
+        }
+    if (aAttrId & EMPXMediaGeneralCount)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralCount");
+        aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, 1);
+        }
+    if (aAttrId & EMPXMediaGeneralCollectionId)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralCollectionId");
+        aMedia.SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId,
+            TUid::Uid(KDBPluginUid));
+        }
+    if(aAttrId & EMPXMediaGeneralCopyright)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralCopyright");
+        TPtrC copyright(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicCopyright));
+        aMedia.SetTextValueL(KMPXMediaGeneralCopyright, copyright);
+        MPX_DEBUG2("    Copyright[%S]", &copyright);
+        }
+    if (aAttrId & EMPXMediaGeneralFlags)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralFlags");
+        TUint32 dbFlags(aMusicTable.ColumnInt64(EMusicDbFlag));
+        MPX_DEBUG2("        dbFlags=%b", dbFlags);
+        TDriveUnit driveUnit;
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            MPX_DEBUG1("        aMedia.IsSupported(KMPXMediaGeneralUri)");
+            TParsePtrC parse( aMedia.ValueText(KMPXMediaGeneralUri) );
+            if( parse.DrivePresent() )
+                {
+                driveUnit = parse.Drive();
+                }
+            else
+                {
+                driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+                     aMusicTable.ColumnInt64(EMusicVolumeId));
+                }
+            MPX_DEBUG2("        driveUnit=%d", (TInt)driveUnit);
+            }
+        else
+            {
+            MPX_DEBUG1("        !aMedia.IsSupported(KMPXMediaGeneralUri)");
+            driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+                aMusicTable.ColumnInt64(EMusicVolumeId));
+            MPX_DEBUG2("        driveUnit=%d", (TInt)driveUnit);
+            }
+
+        TInt driveId = driveUnit & KMPXMediaGeneralFlagsDriveInfo;  // 5 bits
+        aMedia.SetTObjectValueL<TUint>(KMPXMediaGeneralFlags, dbFlags | driveId);
+
+        MPX_DEBUG2("    GeneralFlags[%b]", dbFlags | driveId);
+        MPX_DEBUG2("    DriveId[%u]", driveId);
+        }
+    if (aAttrId & EMPXMediaGeneralPlayCount)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralPlayCount");
+        TUint32 playcount(aMusicTable.ColumnInt(EMusicPlayCount));
+        aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralPlayCount, playcount);
+        MPX_DEBUG2("    PlayCount[%d]", playcount);
+        }
+
+    MPX_DEBUG1("<--CMPXDbMusic::UpdateMediaGeneralL");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateMediaMusicL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::UpdateMediaMusicL(
+    RSqlStatement& aMusicTable,
+    const TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::UpdateMediaMusicL");
+
+    if (aAttrId & EMPXMediaMusicAlbumArtFileName)
+        {
+        TPtrC art(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicArt));
+            aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art);
+            MPX_DEBUG2("    Album Art File Name[%S]", &art);
+        }
+    if (aAttrId & EMPXMediaMusicArtist)
+        {
+        TPtrC artist(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicArtistName));
+        aMedia.SetTextValueL(KMPXMediaMusicArtist, artist);
+        MPX_DEBUG2("    Artist[%S]", &artist);
+        }
+    if (aAttrId & EMPXMediaMusicAlbum)
+        {
+        TPtrC album(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicAlbumName));
+        aMedia.SetTextValueL(KMPXMediaMusicAlbum, album);
+        MPX_DEBUG2("    Album[%S]", &album);
+        }
+    if ( aAttrId & EMPXMediaMusicYear)
+		{
+		const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL (aMusicTable,
+				EMusicReleaseDate));
+		if ( dateStr.Compare (KNullDesC)!= 0)
+			{
+			TTime dateTime(MPXDbCommonUtil::DesToTTimeL (dateStr));
+			aMedia.SetTObjectValueL<TInt64> (KMPXMediaMusicYear,
+					dateTime.Int64 ());
+			MPX_DEBUG2("    Year[%d]", dateTime.Int64());
+			}
+		MPX_DEBUG2("    ReleaseDate[%S]", &dateStr);
+		}
+    if (aAttrId & EMPXMediaMusicAlbumTrack)
+        {
+        TInt32 track(aMusicTable.ColumnInt(EMusicAlbumTrack));
+        HBufC* hbuf = HBufC::NewLC(KMCIntegerLen);
+        if (track != KMaxTInt)
+            {
+            hbuf->Des().AppendFormat(_L("%d"), track);
+            }
+        aMedia.SetTextValueL(KMPXMediaMusicAlbumTrack, *hbuf);
+        MPX_DEBUG3("    Album Track[%S][%d]", hbuf, track);
+        CleanupStack::PopAndDestroy(hbuf);
+        }
+    if (aAttrId & EMPXMediaMusicGenre)
+        {
+        TPtrC genre(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicGenreName));
+        aMedia.SetTextValueL(KMPXMediaMusicGenre, genre);
+        MPX_DEBUG2("    Music Genre[%S]", &genre);
+        }
+    if (aAttrId & EMPXMediaMusicComposer)
+        {
+        TPtrC composer(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicComposerName));
+        aMedia.SetTextValueL(KMPXMediaMusicComposer, composer);
+        MPX_DEBUG2("    Music Composer[%S]", &composer);
+        }
+    if (aAttrId & EMPXMediaMusicRating)
+        {
+        TUint32 rating(aMusicTable.ColumnInt(EMusicRating));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaMusicRating, rating);
+        MPX_DEBUG2("    Music Rating[%d]", rating);
+        }
+    if (aAttrId & EMPXMediaMusicURL)
+        {
+        TPtrC url(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicUrl));
+        aMedia.SetTextValueL(KMPXMediaMusicURL, url);
+        MPX_DEBUG2("    Music URL[%S]", &url);
+        }
+    if (aAttrId & EMPXMediaMusicOriginalAlbumArtFileName)
+        {
+        // Always set original album art to be file path
+        // Maybe add a new column to db for future if services like rhapsody pushes jpgs to us
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            const TDesC& uri(aMedia.ValueText(KMPXMediaGeneralUri));
+            aMedia.SetTextValueL(KMPXMediaMusicOriginalAlbumArtFileName, uri);
+            MPX_DEBUG2("    Music Original Album Art FullPath[%S]", &uri);
+            }
+        else
+            {
+            HBufC* fullPath = ConstructUriL(aMusicTable);
+            CleanupStack::PushL(fullPath);
+            aMedia.SetTextValueL(KMPXMediaMusicOriginalAlbumArtFileName, *fullPath);
+            MPX_DEBUG2("    Music Original Album Art FullPath[%S]", fullPath);
+            CleanupStack::PopAndDestroy(fullPath);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateMediaAudioL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::UpdateMediaAudioL(
+    RSqlStatement& aMusicTable,
+    const TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::UpdateMediaAudioL");
+
+    if (aAttrId & EMPXMediaAudioBitrate)
+        {
+        TUint32 bitrate(aMusicTable.ColumnInt(EMusicBitRate));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioBitrate, bitrate);
+        MPX_DEBUG2("    Bitrate[%d]", bitrate);
+        }
+    if (aAttrId & EMPXMediaAudioSamplerate)
+        {
+        TUint32 samplerate(aMusicTable.ColumnInt(EMusicSampleRate));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioSamplerate, samplerate);
+        MPX_DEBUG2("    SampleRate[%d]", samplerate);
+        }
+    if (aAttrId & EMPXMediaAudioNumberOfChannels)
+        {
+        TUint32 numchannels(aMusicTable.ColumnInt(EMusicNumChannels));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioNumberOfChannels, numchannels);
+        MPX_DEBUG2("    Num of Channels[%d]", numchannels);
+        }
+    if (aAttrId & EMPXMediaAudioCodec)
+        {
+        TUint32 codec(aMusicTable.ColumnInt(EMusicCodec));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioAudioCodec, codec);
+        MPX_DEBUG2("    Audio Codec[%d]", codec);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateMediaMTPL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::UpdateMediaMTPL(
+    RSqlStatement& aMusicTable,
+    const TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::UpdateMediaMTPL");
+
+    if (aAttrId & KMPXMediaMTPDrmStatus.iAttributeId)
+        {
+        TUint32 val(aMusicTable.ColumnInt(EMusicMTPDrmStatus));
+        aMedia.SetTObjectValueL<TUint16>(KMPXMediaMTPDrmStatus, val);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GenerateMusicFieldsValuesL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::GenerateMusicFieldsValuesL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aItemChangedMessages,
+    RSqlStatement* aMusicTable,
+    CDesCArray& aFields,
+    CDesCArray& aValues,
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbMusic::GenerateMusicFieldsValuesL");
+
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+    TBool metaDataModified(EFalse);
+    const TArray<TMPXAttribute> attributes = aMedia.Attributes();
+
+    TBool addSongChangedMessage(ETrue);
+    CMPXMessage* songChangedMessage(NULL);
+    if (aItemChangedMessages)
+        {
+        songChangedMessage = CMPXMedia::NewL();
+        CleanupStack::PushL(songChangedMessage);
+        MPXDbCommonUtil::FillItemChangedMessageL(*songChangedMessage, aSongId,
+            aMusicTable ? EMPXItemModified : EMPXItemInserted, EMPXSong, KDBPluginUid);
+        }
+
+    // NOTE: Attributes being processed here should be listed in IsSupported()
+    TInt attrCount(attributes.Count());
+    for (TInt i = 0; i < attrCount; ++i)
+        {
+        TUint attributeId(attributes[i].AttributeId());
+
+        switch (attributes[i].ContentId())
+            {
+            case KMPXMediaIdGeneral:
+                {
+                if (attributeId & EMPXMediaGeneralDeleted)
+                    {
+                    TBool deleted(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralDeleted));
+                    if (!aMusicTable || (deleted != aMusicTable->ColumnInt(EMusicDeleted)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDel, deleted);
+                        }
+                    MPX_DEBUG2("    Deleted[%d]", deleted);
+                    }
+
+                if (attributeId & EMPXMediaGeneralFlags)
+                    {
+                    TUint flag(aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags));
+                    TUint32 curFlag(0);
+                    if (aMusicTable)
+                        {
+                        curFlag = aMusicTable->ColumnInt64(EMusicDbFlag);
+                        }
+                    TUint32 oldFlag(curFlag);
+
+                    if (flag & KMPXMediaGeneralFlagsSetOrUnsetBit)
+                        {
+                        // Set bits
+                        curFlag |= flag;
+                        }
+                    else
+                        {
+                        // Clear bits
+                        curFlag &= (~flag);
+                        }
+
+                    // The field is written ONLY if the flag value is changing
+                    if (((curFlag ^ oldFlag) & 0x7FFFFFFF) != 0)
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDbFlag, curFlag);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        }
+                    MPX_DEBUG2("    GeneralFlags[%b]", curFlag);
+                    }
+
+                if (attributeId & EMPXMediaGeneralTitle)
+                    {
+                    TBool titleChanged(NULL == aMusicTable);
+
+                    const TDesC& title = aMedia.ValueText(KMPXMediaGeneralTitle);
+                    TPtrC truncatedTitle(title.Left(KMCMaxTextLen));
+                    if (aMusicTable)
+                        {
+                        // Title of the song has been changed
+                        if (truncatedTitle.Compare(MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicTitle)) != 0)
+                            {
+                            titleChanged = ETrue;
+                            }
+                        }
+
+                    if (titleChanged)
+                        {
+                        if ( title.Length() == 0 )
+                            {
+                            const TDesC& path = aMedia.ValueText( KMPXMediaGeneralUri );
+                            TParsePtrC parse( path );
+                            TPtrC truncatedParse( parse.Name().Left( KMCMaxTextLen ) );
+
+                            MPXDbCommonUtil::AppendValueL( aFields, aValues, KMCMusicName, truncatedParse );
+                            }
+                        else
+                            {
+                            MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicName, truncatedTitle);
+                            }
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        metaDataModified = ETrue;
+
+                        MPX_DEBUG2("    Title[%S]", &truncatedTitle);
+                        }
+                    }
+
+                if (attributeId & EMPXMediaGeneralUri)
+                    {
+                    const TDesC& uri = aMedia.ValueText(KMPXMediaGeneralUri);
+                    const TDesC& uriTrunc(uri.Mid(KMCPathStartPos));
+
+                    TDriveUnit driveUnit(uri);
+                    TUint volId(MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit));
+
+                    if (!aMusicTable || ((uriTrunc != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicLocation)) ||
+                        (volId != aMusicTable->ColumnInt64(EMusicVolumeId))))
+                        {
+                        // only do the update something changed
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicVolumeId, volId);
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicLocation,
+                            uri.Mid(KMCPathStartPos));
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDRM, DRMTypeL(uri));
+
+                        const TDesC& mimeTypeText(MPXDbCommonUtil::GetMimeTypeForUriL(uri).Des());
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMimeType, mimeTypeText);
+
+                        MPX_DEBUG3("    VolumeId[%u] Location[%S]", volId, &uri);
+                        MPX_DEBUG2("    MimeType[%S]", &mimeTypeText);
+
+                        if (!aMusicTable && !aMedia.IsSupported(KMPXMediaGeneralTitle))
+                            {
+                            TParsePtrC parser(uri);
+                            TPtrC title = parser.Name();
+                            // use file name as song name
+                            MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicName, title);
+
+                            visibleChange = CMPXDbActiveTask::EAllVisible;
+                            MPX_DEBUG2("    Title[%S]", &title);
+                            }
+
+                        // URI of the song has been changed. This changes the Id of the song
+                        if (aMusicTable)
+                            {
+                            TUint32 newSongId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection, uri, EFalse);
+                            if (aSongId != newSongId)
+                                {
+                                MPX_DEBUG3("    CurrentSongId[0x%x] changed to [0x%x]", aSongId, newSongId);
+                                if (songChangedMessage)
+                                    {
+                                    songChangedMessage->SetTObjectValueL<TMPXItemId>(KMPXMessageMediaGeneralId, newSongId);
+                                    songChangedMessage->SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, aSongId);
+                                    }
+
+                                MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicUniqueId, newSongId);
+                                }
+                            }
+                        }
+                    }
+
+                if (attributeId & EMPXMediaGeneralPlayCount)
+                    {
+                    TInt increment(aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralPlayCount));
+                    TUint32 curCount(increment);
+                    if (aMusicTable)
+                        {
+                        curCount += aMusicTable->ColumnInt(EMusicPlayCount);
+                        }
+
+                    if (!aMusicTable || (curCount != aMusicTable->ColumnInt(EMusicPlayCount)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicPlayCount, curCount);
+
+                        // this needs to be visible in order for Recently Played and Most Played
+                        // playlists will be updated
+                        visibleChange = CMPXDbActiveTask::ESingleVisible;
+
+                        if (aItemChangedMessages)
+                            {
+                            iObserver.HandlePlayCountModifiedL(*aItemChangedMessages);
+                            }
+                        addSongChangedMessage = EFalse;
+                        }
+
+                    MPX_DEBUG2("    PlayCount[%d]", curCount);
+                    }
+
+                if (attributeId & EMPXMediaGeneralLastPlaybackTime)
+                    {
+                    HBufC* time = MPXDbCommonUtil::TTimeToDesLC(
+                        TTime(aMedia.ValueTObjectL<TInt64>(KMPXMediaGeneralLastPlaybackTime)));
+                    if (!aMusicTable || (*time != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicTimePlayed)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicTimePlayed, *time);
+                        // this needs to be visible in order for Recently Played playlist to be updated
+                        visibleChange = CMPXDbActiveTask::ESingleVisible;
+
+                        if (aItemChangedMessages)
+                            {
+                            iObserver.HandlePlaybackTimeModifiedL(*aItemChangedMessages);
+                            }
+                        addSongChangedMessage = EFalse;
+                        }
+                    MPX_DEBUG2("    PlaybackTime[%S]", time);
+                    CleanupStack::PopAndDestroy(time);
+                    }
+
+                if (attributeId & EMPXMediaGeneralDuration)
+                    {
+                    TInt duration(aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralDuration));
+                    if (!aMusicTable || (duration != aMusicTable->ColumnInt(EMusicDuration)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDuration, duration);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Duration[%d]", duration);
+                    }
+
+                if (attributeId & EMPXMediaGeneralSynchronized)
+                    {
+                    TBool synced(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized));
+                    if (!aMusicTable || (synced != aMusicTable->ColumnInt(EMusicSync)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicSync, synced);
+                        }
+                    MPX_DEBUG2("    Synchronized[%d]", synced);
+                    }
+
+                if (attributeId & EMPXMediaGeneralModified)
+                    {
+                    TBool modified(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralModified));
+                    if (!aMusicTable || (modified != aMusicTable->ColumnInt(EMusicModified)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMod, modified);
+                        }
+                    MPX_DEBUG2("    Modified[%d]", modified);
+                    }
+
+                if (attributeId & EMPXMediaGeneralComment)
+                    {
+                    TPtrC comment = aMedia.ValueText(KMPXMediaGeneralComment).Left(KMCMaxTextLen);
+                    if (!aMusicTable || (comment != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicComment)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicComment, comment);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Comment[%S]", &comment);
+                    }
+
+                if (attributeId & EMPXMediaGeneralCopyright)
+                    {
+                    const TDesC& copyright = aMedia.ValueText(KMPXMediaGeneralCopyright).
+                        Left(KMCMaxTextLen);
+                    if (!aMusicTable || (copyright != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicCopyright)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicCopyright, copyright);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Copyright[%S]", &copyright);
+                    }
+                }
+                break;
+
+            case KMPXMediaIdMusic:
+                {
+                if (attributeId & EMPXMediaMusicAlbumTrack)
+                    {
+                    const TDesC& trackNumber = aMedia.ValueText(KMPXMediaMusicAlbumTrack);
+
+                    // KMaxTInt is used to represent null album track
+                    TInt track(KMaxTInt);
+                    if (trackNumber.Length())
+                        {
+                        TLex stringParser(trackNumber);
+
+                        if ((stringParser.Val(track) != KErrNone) ||
+                            (track == 0) || (track > 999))  // Limit track number to 3 characters
+                            {
+                            track = KMaxTInt;
+                            }
+                        }
+
+                    if (!aMusicTable || (track != aMusicTable->ColumnInt(EMusicAlbumTrack)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicTrackNumber, track);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG3("    Album Track[%S][%d]", &trackNumber, track);
+                    }
+
+                if (attributeId & EMPXMediaMusicYear)
+                    {
+                    TInt64 int64(aMedia.ValueTObjectL<TInt64>(KMPXMediaMusicYear));
+
+                    TTime maxTime(0);
+                    maxTime += TTimeIntervalYears(9999);    // Limit years to 4 characters
+                    TTime time(int64);
+
+                    if (time > maxTime)
+                        {
+                        time = Time::NullTTime();
+                        }
+
+                    HBufC* timeStr = MPXDbCommonUtil::TTimeToDesLC(time);
+                    if (!aMusicTable || (*timeStr != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicReleaseDate)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicReleaseDate, *timeStr);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Music Year[%S]", timeStr);
+                    CleanupStack::PopAndDestroy(timeStr);
+                    }
+
+                if (attributeId & EMPXMediaMusicRating)
+                    {
+                    TInt rating(aMedia.ValueTObjectL<TInt>(KMPXMediaMusicRating));
+                    if (!aMusicTable || (rating != aMusicTable->ColumnInt(EMusicRating)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicRating, rating);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Rating[%d]", rating);
+                    }
+
+                if (attributeId & EMPXMediaMusicAlbumArtFileName)
+                    {
+                    const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen);
+                    if (!aMusicTable || (albumArtFilename != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicArt)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        metaDataModified = ETrue;
+                        }
+
+                    MPX_DEBUG2("    Album Art Filename[%S]", &albumArtFilename);
+                    }
+
+                if (attributeId & EMPXMediaMusicURL)
+                    {
+                    const TDesC& url = aMedia.ValueText(KMPXMediaMusicURL).Left(KMCMaxTextLen);
+                    if (!aMusicTable || (url != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicUrl)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicUrl, url);
+                        metaDataModified = ETrue;
+                        }
+
+                    MPX_DEBUG2("    Music URL[%S]", &url);
+                    }
+                }
+                break;
+
+            case KMPXMediaIdAudio:
+                {
+                if (attributeId & EMPXMediaAudioSamplerate)
+                    {
+                    TInt samplerate(aMedia.ValueTObjectL<TInt>(KMPXMediaAudioSamplerate));
+                    if (!aMusicTable || (samplerate != aMusicTable->ColumnInt(EMusicSampleRate)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicSampleRate, samplerate);
+                        metaDataModified = ETrue;
+                        }
+
+                    MPX_DEBUG2("    Sample Rate[%d]", samplerate);
+                    }
+
+                if (attributeId & EMPXMediaAudioBitrate)
+                    {
+                    TInt bitrate(aMedia.ValueTObjectL<TInt>(KMPXMediaAudioBitrate));
+                    if (!aMusicTable || (bitrate != aMusicTable->ColumnInt(EMusicBitRate)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicBitRate, bitrate);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Bitrate[%d]", bitrate);
+                    }
+
+                if (attributeId & EMPXMediaAudioNumberOfChannels)
+                    {
+                    TUint32 val = aMedia.ValueTObjectL<TUint32>(KMPXMediaAudioNumberOfChannels);
+                    if (!aMusicTable || (val != aMusicTable->ColumnInt(EMusicNumChannels)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicNumChannels, val);
+                        }
+                    MPX_DEBUG2("    Num of Channels[%d]", val);
+                    }
+                }
+                break;
+
+            case KMPXMediaIdDrm:
+                {
+                if (attributeId & EMPXMediaDrmType)
+                    {
+                    TInt drmType(aMedia.ValueTObjectL<TInt>(KMPXMediaDrmType));
+                    if (!aMusicTable || (drmType != aMusicTable->ColumnInt(EMusicDRM)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDRM, drmType);
+                        }
+                    MPX_DEBUG2("    DRM type[%d]", drmType);
+                    }
+
+                if (attributeId & KMPXMediaDrmRightsStatus.iAttributeId)
+                    {
+                    if (aMusicTable)
+                        {
+                        TMPXMediaDrmRightsStatus status =
+                                 aMedia.ValueTObjectL<TMPXMediaDrmRightsStatus>(KMPXMediaDrmRightsStatus);
+
+                        //.Set the db flag
+                        TUint32 curFlag(aMusicTable->ColumnInt64(EMusicDbFlag));
+                        TUint32 oldFlag(curFlag);
+
+                        if ((status != EMPXDrmRightsFull) && (status != EMPXDrmRightsRestricted))
+                            {
+                            // No rights
+                            curFlag |= KMPXMediaGeneralFlagsIsDrmLicenceInvalid;
+                            }
+                        else
+                            {
+                            // Rights valid
+                            curFlag &= (KMPXMediaGeneralFlagsIsDrmLicenceInvalid ^ 0xFFFFFFFF);
+                            }
+
+                        // The field is written ONLY if the flag value is changing
+                        if (((curFlag ^ oldFlag) & 0x7FFFFFFF) != 0)
+                        {
+                            MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDbFlag, curFlag);
+                            visibleChange = CMPXDbActiveTask::EAllVisible;
+                        }
+
+                        MPX_DEBUG2("    Rights Status[%d]", curFlag);
+                        }
+                    }
+
+                break;
+                }
+
+            case KMPXMediaIdMTP:
+                {
+                if (attributeId & KMPXMediaMTPDrmStatus.iAttributeId)
+                    {
+                    TUint16 drmStatus(aMedia.ValueTObjectL<TUint16>(KMPXMediaMTPDrmStatus));
+                    if (!aMusicTable || (drmStatus != aMusicTable->ColumnInt(EMusicMTPDrmStatus)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMTPDrmStatus, drmStatus);
+                        }
+                    MPX_DEBUG2("    MTP Drm Status[%d]", drmStatus);
+                    }
+                }
+                break;
+
+            default:
+                break;
+            } // end switch
+        } // end for
+
+    // get the current artist/album/genre/composer
+    // this is required because the recordset may be reused by the code below
+    TUint32 artistId(0);
+    TUint32 albumId(0);
+    TUint32 genreId(0);
+    TUint32 composerId(0);
+    if (aMusicTable)
+        {
+        artistId = aMusicTable->ColumnInt64(EMusicArtist);
+        albumId = aMusicTable->ColumnInt64(EMusicAlbum);
+        genreId = aMusicTable->ColumnInt64(EMusicGenre);
+        composerId = aMusicTable->ColumnInt64(EMusicComposer);
+        }
+
+    // update the artist field
+    TUint32 id(0);
+    TUint32 artistIdForAlbum(artistId);
+    if (UpdateCategoryFieldL(EMPXArtist, aMedia, KMPXMediaMusicArtist, artistId,
+        aDrive, aItemChangedMessages, id, 0))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArtist, id);
+        metaDataModified = (aMusicTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        artistIdForAlbum = id;
+        }
+
+    // update the album field
+	if (UpdateCategoryFieldL(EMPXAlbum, aMedia, KMPXMediaMusicAlbum, albumId,
+		aDrive, aItemChangedMessages, id, artistIdForAlbum))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicAlbum, id);
+        metaDataModified = (aMusicTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+
+        //
+        // added to handle error EALU-73WDJN. If the album name of the last song
+        // in the album for the artist is changed to an existing album name from
+        // artist view, a change message needs to be sent in order for UI to
+        // correctly refresh.
+        //
+        // Fix for EDXU-7BBALS, remove check for HasOtherSongsInArtistAlbumL
+        // Always send a Album Inserted message when Album change to get Artist updated
+        if (aItemChangedMessages)
+            {
+            // send album added m essage instead of album deleted or modified
+            // to avoid collection paths of other clients being modified
+            MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, albumId,
+                    EMPXItemInserted, EMPXAlbum, KDBPluginUid);
+            }
+        }
+
+    // update the genre field
+    if (UpdateCategoryFieldL(EMPXGenre, aMedia, KMPXMediaMusicGenre, genreId,
+        aDrive, aItemChangedMessages, id))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicGenre, id);
+        metaDataModified = (aMusicTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        }
+
+    // update the composer field
+    if (UpdateCategoryFieldL(EMPXComposer, aMedia, KMPXMediaMusicComposer, composerId,
+        aDrive, aItemChangedMessages, id))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicComposer, id);
+        metaDataModified = (aMusicTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        }
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+    // Set Mod bit to ETrue if metadata has been updated and caller hasn't explicitly
+    // set/reset it
+    if (aMusicTable &&
+        !aMedia.IsSupported(KMPXMediaGeneralModified) &&
+        metaDataModified)
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMod, 1);
+        MPX_DEBUG1("    Modified[1]");
+        }
+#endif
+
+    if (aItemChangedMessages)
+        {
+      if (aFields.Count() && addSongChangedMessage)
+          {
+          aItemChangedMessages->AppendL(*songChangedMessage);
+          }
+        CleanupStack::PopAndDestroy(songChangedMessage);
+        }
+
+    return visibleChange;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DRMTypeL
+// ----------------------------------------------------------------------------
+//
+TMCDrmType CMPXDbMusic::DRMTypeL(
+    const TDesC& aFile)
+    {
+    MPX_FUNC("CMPXDbMusic::DRMTypeL");
+
+    TMCDrmType drm(EMCDrmNone);
+    TInt pos(0);
+    TParsePtrC fullEntry(aFile);
+    TPtrC theExt = fullEntry.Ext();
+
+    if (iExtensionsDrm->Find(theExt, pos) == 0)
+        {
+        drm = MPXDbCommonUtil::GetDRMTypeL(aFile);
+        }
+
+    return drm;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GenerateMusicMatchingCriteriaLC
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbMusic::GenerateMusicMatchingCriteriaLC(
+    TUint32 aGeneralId,
+    TUint32 aContainerId,
+    TMPXGeneralType aType,
+    const CMPXMedia& aCriteria)
+    {
+    MPX_FUNC("CMPXDbMusic::GenerateMusicMatchingCriteriaLC");
+
+    const TArray<TMPXAttribute> criteria = aCriteria.Attributes();
+    TInt criteriaCount(criteria.Count());
+
+    // construct an array of criteria strings
+    CDesCArrayFlat* sqlCriteria = new (ELeave) CDesCArrayFlat(criteriaCount);
+    CleanupStack::PushL(sqlCriteria);
+
+    // If EMPXMediaGeneralDeleted is not defined, always unset the deleted bit for matching
+    if (!aCriteria.IsSupported(KMPXMediaGeneralDeleted))
+        {
+        sqlCriteria->AppendL(KCriterionMusicNotDeleted);
+        }
+
+    TBool volumeAdded(EFalse);
+    for (TInt i = 0; i < criteriaCount; ++i)
+        {
+        const TMPXAttribute& criterion = criteria[i];
+
+        if (criterion == KMPXMediaGeneralId)
+            {
+            // Set the type if no type is specified
+            TInt category(MPX_ITEM_CATEGORY(aGeneralId));
+
+            if( aType == EMPXNoType )
+                {
+                aType = (category == EMPXCollection) ? EMPXItem : EMPXGroup;
+                }
+
+            TPtrC ptr;
+            if (aType == EMPXItem && (category == EMPXCollection))
+                {
+                ptr.Set(KCriterionMusicUniqueId);
+                }
+            else if (aType == EMPXGroup && (category == EMPXArtist))
+                {
+                ptr.Set(KCriterionMusicArtist);
+                }
+            else if (aType == EMPXGroup && (category == EMPXAlbum))
+                {
+                ptr.Set(KCriterionMusicAlbum);
+                }
+            else if (aType == EMPXGroup && (category == EMPXGenre))
+                {
+                ptr.Set(KCriterionMusicGenre);
+                }
+            else if (aType == EMPXGroup && (category == EMPXComposer))
+                {
+                ptr.Set(KCriterionMusicComposer);
+                }
+            else
+                {
+                User::Leave(KErrNotSupported);
+                }
+
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, ptr, aGeneralId);
+            }
+        else if (criterion == KMPXMediaGeneralContainerId)
+            {
+            TInt containerCategory(MPX_ITEM_CATEGORY(aContainerId));
+
+            if (aType == EMPXGroup && (containerCategory == EMPXArtist))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionMusicArtist, aContainerId);
+                }
+            else if (aType == EMPXGroup && (containerCategory == EMPXAlbum))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionMusicAlbum, aContainerId);
+                }
+            else
+                {
+                //User::Leave(KErrNotSupported);
+                }
+            }
+        else if (criterion == KMPXMediaGeneralTitle)
+            {
+            HBufC* title = MPXDbCommonUtil::ProcessPatternCharsLC(
+                aCriteria.ValueText(KMPXMediaGeneralTitle));
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicTitle, *title);
+            CleanupStack::PopAndDestroy(title);
+            }
+        else if (criterion == KMPXMediaGeneralUri)
+            {
+            // full URI from criteria
+            const TDesC& uri = aCriteria.ValueText(KMPXMediaGeneralUri);
+            TUint32 itemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection,
+                                                                uri, EFalse);
+
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicUniqueId, itemId);
+            }
+        else if (criterion == KMPXMediaGeneralDrive)
+            {
+            if (!volumeAdded)
+                {
+                // validate the drive letter, TDriveUnit panics if given drive isn't between
+                // 'A' to 'Z'
+                TDriveUnit driveUnit(aCriteria.ValueText(KMPXMediaGeneralDrive));
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicVolume,
+                    MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit));
+                volumeAdded = ETrue;
+                }
+            }
+        else if (criterion == KMPXMediaGeneralSynchronized)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicSync,
+                aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized));
+            }
+        else if (criterion == KMPXMediaGeneralDeleted)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicDeleted,
+                aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralDeleted));
+            }
+        else if (criterion == KMPXMediaGeneralModified)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicModified,
+                aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralModified));
+            }
+         else
+            {
+            // to-do: provide searching ability on the rest of the fields
+            }
+        }
+
+    // construct the final criteria string
+    HBufC* criteriaStr = MPXDbCommonUtil::StringFromArrayLC(*sqlCriteria, KMCAndKeyword);
+
+    CleanupStack::Pop(criteriaStr);
+    CleanupStack::PopAndDestroy(sqlCriteria);
+    CleanupStack::PushL(criteriaStr);
+
+    return criteriaStr;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ConstructUriL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbMusic::ConstructUriL(
+    RSqlStatement& aMusicTable)
+    {
+    MPX_FUNC("CMPXDbMusic::ConstructUriL");
+
+    TUint volId(aMusicTable.ColumnInt64(EMusicVolumeId));
+    TPtrC location(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicLocation));
+    return MPXDbCommonUtil::CreateFullPathL(
+        MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId), location);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbMusic::CreateTableL");
+
+    // Create the table
+    User::LeaveIfError(aDatabase.Exec(KMusicCreateTable));
+
+    // Do not create any other indexes than the one on UniqueId
+    // as they only slow down the database overall
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbMusic::DropTableL");
+    User::LeaveIfError(aDatabase.Exec(KMusicDropTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbMusic::CheckTableL");
+    return DoCheckTable(aDatabase, KMusicCheckTable);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateCategoryFieldL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::UpdateCategoryFieldL(
+    TMPXGeneralCategory aCategory,
+    const CMPXMedia& aMedia,
+    const TMPXAttribute& aAttribute,
+    TUint32 aOldId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TUint32& aItemId)
+    {
+    TBool updated(EFalse);
+    TBool itemNotRemoved( EFalse );
+    TBool itemAdded( EFalse );
+
+    // update category table and add category Id to the music table
+    if (!aOldId || aMedia.IsSupported(aAttribute))
+        {
+        TInt changeMsgCount( 0 );
+        if( aItemChangedMessages )
+            {
+            changeMsgCount = aItemChangedMessages->Count();
+            }
+
+        if (aMedia.IsSupported(aAttribute))
+            {
+            TPtrC name(aMedia.ValueText(aAttribute).Left(KMCMaxTextLen));
+
+            // construct the new ID for the category record
+            // only genre is not case sensitive
+            aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory,
+                name, (aCategory != EMPXGenre));
+            if (!aOldId || (aOldId != aItemId))
+                {
+                // only add if the ID changed,
+                // otherwise the song was updated but the artist name was not
+
+                // ignore the return value
+                iObserver.AddCategoryItemL(aCategory, name, aDriveId,
+                    aItemChangedMessages, itemAdded);
+                updated = ETrue;
+                }
+            }
+        else
+            {
+            // only genre is not case sensitive
+            aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, KNullDesC,
+                (aCategory != EMPXGenre));
+            if (!aOldId || (aOldId != aItemId))
+                {
+                // ignore the return value
+                iObserver.AddCategoryItemL(aCategory, KNullDesC, aDriveId,
+                    aItemChangedMessages, itemAdded);
+                updated = ETrue;
+                }
+            }
+
+        if (aOldId && (aOldId != aItemId))
+            {
+            iObserver.DeleteSongForCategoryL(aCategory, aOldId, aDriveId,
+                aItemChangedMessages, itemNotRemoved);
+            updated = ETrue;
+            }
+
+        // Special case where the item(s) has been renamed.
+        // In this case, a new category is created +1 change msg
+        //               a old category is removed +1 change msg
+        // We merge these 2 change messages into one using the deprecated ID
+        //
+        if( aItemChangedMessages )
+            {
+            TInt newChangeMsgCount( aItemChangedMessages->Count() );
+            if(  newChangeMsgCount - changeMsgCount > 0 )
+                {
+                TInt oldId = KErrNotFound;
+                TInt newId = KErrNotFound;
+                for( TInt i=0; i<newChangeMsgCount; ++i )
+                    {
+                    CMPXMessage& msg = *(*aItemChangedMessages)[i];
+
+                    TMPXItemId id = msg.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId);
+                    TMPXChangeEventType changeType = msg.ValueTObjectL<TMPXChangeEventType>(KMPXMessageChangeEventType);
+
+                    // Look for the added and deleted category IDs
+                    //
+                    if( id == aOldId && changeType == EMPXItemDeleted )
+                        {
+                        oldId = i;
+                        }
+                    else if( id == aItemId && changeType == EMPXItemInserted )
+                        {
+                        newId = i;
+                        }
+                    }
+
+                if( oldId != KErrNotFound &&
+                    newId != KErrNotFound )
+                    {
+                    aItemChangedMessages->Remove(oldId);  // category removed
+                    aItemChangedMessages->Remove(newId);  // category added
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aOldId );
+                    }
+                else if ( oldId !=KErrNotFound && itemAdded ) // old item removed, new item already exist
+                    {
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aOldId );
+                    }
+                else if ( newId !=KErrNotFound && itemNotRemoved ) // new item added, old item still exist
+                    {
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aOldId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aItemId );
+                    }
+                }
+            }
+        }
+
+    return updated;
+    }
+
+TBool CMPXDbMusic::UpdateCategoryFieldL(
+    TMPXGeneralCategory aCategory,
+    const CMPXMedia& aMedia,
+    const TMPXAttribute& aAttribute,
+    TUint32 aOldId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TUint32& aItemId,
+    TUint32 aArtistId)
+    {
+    TBool updated(EFalse);
+    TBool itemNotRemoved( EFalse );
+    TBool itemAdded( EFalse );
+
+    // update category table and add category Id to the music table
+    if (!aOldId || aMedia.IsSupported(aAttribute))
+        {
+        TInt changeMsgCount( 0 );
+        if( aItemChangedMessages )
+            {
+            changeMsgCount = aItemChangedMessages->Count();
+            }
+
+        if (aMedia.IsSupported(aAttribute))
+            {
+            TPtrC name(aMedia.ValueText(aAttribute).Left(KMCMaxTextLen));
+
+            // construct the new ID for the category record
+            // only genre is not case sensitive
+            aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory,
+                name, (aCategory != EMPXGenre));
+            if (!aOldId || (aOldId != aItemId))
+                {
+                // only add if the ID changed,
+                // otherwise the song was updated but the artist name was not
+				TPtrC art(KNullDesC);
+				if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+					{
+					art.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
+					}
+
+				iObserver.AddCategoryItemL(aCategory, name, aArtistId, art, aDriveId, aItemChangedMessages, itemAdded);
+                updated = ETrue;
+                }
+            }
+        else
+            {
+            // only genre is not case sensitive
+            aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, KNullDesC,
+                (aCategory != EMPXGenre));
+            if (!aOldId || (aOldId != aItemId))
+                {
+				TPtrC art(KNullDesC);
+				if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+					{
+					art.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
+					}
+
+				iObserver.AddCategoryItemL(aCategory, KNullDesC, aArtistId, art, aDriveId,
+                    aItemChangedMessages, itemAdded);
+                updated = ETrue;
+                }
+            }
+
+        if (aOldId && (aOldId != aItemId))
+            {
+            iObserver.DeleteSongForCategoryL(aCategory, aOldId, aDriveId,
+                aItemChangedMessages, itemNotRemoved);
+            updated = ETrue;
+            }
+
+        // Special case where the item(s) has been renamed.
+        // In this case, a new category is created +1 change msg
+        //               a old category is removed +1 change msg
+        // We merge these 2 change messages into one using the deprecated ID
+        //
+        if( aItemChangedMessages )
+            {
+            TInt newChangeMsgCount( aItemChangedMessages->Count() );
+            if(  newChangeMsgCount - changeMsgCount > 0 )
+                {
+                TInt oldId = KErrNotFound;
+                TInt newId = KErrNotFound;
+                for( TInt i=0; i<newChangeMsgCount; ++i )
+                    {
+                    CMPXMessage& msg = *(*aItemChangedMessages)[i];
+
+                    TMPXItemId id = msg.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId);
+                    TMPXChangeEventType changeType = msg.ValueTObjectL<TMPXChangeEventType>(KMPXMessageChangeEventType);
+
+                    // Look for the added and deleted category IDs
+                    //
+                    if( id == aOldId && changeType == EMPXItemDeleted )
+                        {
+                        oldId = i;
+                        }
+                    else if( id == aItemId && changeType == EMPXItemInserted )
+                        {
+                        newId = i;
+                        }
+                    }
+
+                if( oldId != KErrNotFound &&
+                    newId != KErrNotFound )
+                    {
+                    aItemChangedMessages->Remove(oldId);  // category removed
+                    aItemChangedMessages->Remove(newId);  // category added
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aOldId );
+                    }
+                else if ( oldId !=KErrNotFound && itemAdded ) // old item removed, new item already exist
+                    {
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aOldId );
+                    }
+                else if ( newId !=KErrNotFound && itemNotRemoved ) // new item added, old item still exist
+                    {
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aOldId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aItemId );
+                    }
+                }
+            }
+        }
+
+    return updated;
+    }
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ExtraFieldsRequired
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::ExtraFieldsRequired(
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_DEBUG1("-->CMPXDbMusic::ExtraFieldsRequired");
+
+    // check if any extra fields are required
+    TUint defaultFields(EMPXMediaGeneralId |
+                        EMPXMediaGeneralType |
+                        EMPXMediaGeneralCategory |
+                        EMPXMediaGeneralTitle |
+                        EMPXMediaGeneralUri |
+                        EMPXMediaGeneralFlags);
+
+    TBool extraRequired(EFalse);
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TUint attributeId(aAttrs[i].AttributeId()|defaultFields);
+        MPX_DEBUG2("    attribute content id 0x%x", aAttrs[i].ContentId());
+        MPX_DEBUG3("    attribute id %b, original attribute id %b", attributeId, aAttrs[i].AttributeId());
+
+        if (KMPXMediaIdGeneral != aAttrs[i].ContentId() ||
+            attributeId != defaultFields)
+            {
+            MPX_DEBUG1("    extraRequired YES");
+            extraRequired = ETrue;
+            break;
+            }
+        }
+
+    MPX_DEBUG2("<--CMPXDbMusic::ExtraFieldsRequired returns %d", extraRequired);
+    return extraRequired;
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Test if the given media contains supported attributes
+// ----------------------------------------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::IsSupported(
+  const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::IsSupported");
+
+    // this checklist should match the attributes processed in DoFillInDatabaseInfoL
+    return aMedia.IsSupported(KMPXMediaGeneralTitle) ||
+        aMedia.IsSupported(KMPXMediaGeneralUri) ||
+        aMedia.IsSupported(KMPXMediaGeneralComment) ||
+        aMedia.IsSupported(KMPXMediaGeneralSynchronized) ||
+        aMedia.IsSupported(KMPXMediaGeneralDeleted) ||
+        aMedia.IsSupported(KMPXMediaGeneralModified) ||
+        aMedia.IsSupported(KMPXMediaGeneralCopyright) ||
+        aMedia.IsSupported(KMPXMediaGeneralDuration) ||
+        aMedia.IsSupported(KMPXMediaGeneralFlags) ||
+        aMedia.IsSupported(KMPXMediaGeneralPlayCount) ||
+        aMedia.IsSupported(KMPXMediaGeneralLastPlaybackTime) ||
+        aMedia.IsSupported(KMPXMediaMusicAlbumTrack) ||
+        aMedia.IsSupported(KMPXMediaMusicYear) ||
+        aMedia.IsSupported(KMPXMediaMusicRating) ||
+        aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName) ||
+        aMedia.IsSupported(KMPXMediaMusicURL) ||
+        aMedia.IsSupported(KMPXMediaMusicArtist) ||
+        aMedia.IsSupported(KMPXMediaMusicAlbum) ||
+        aMedia.IsSupported(KMPXMediaMusicGenre) ||
+        aMedia.IsSupported(KMPXMediaMusicComposer) ||
+        aMedia.IsSupported(KMPXMediaAudioSamplerate) ||
+        aMedia.IsSupported(KMPXMediaAudioBitrate) ||
+        aMedia.IsSupported(KMPXMediaAudioNumberOfChannels) ||
+        aMedia.IsSupported(KMPXMediaDrmType) ||
+        aMedia.IsSupported(KMPXMediaDrmRightsStatus) ||
+        aMedia.IsSupported(KMPXMediaMTPDrmStatus);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplaylist.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1087 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interaction with the playlist tables.
+*
+*/
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <mpxlog.h>
+#include <mpxmediacontainerdefs.h>
+
+#include "mpxdbcommonutil.h"
+#include "mpxdbcommondef.h"
+#include "mpxdbcommonstd.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbmanager.h"
+#include "mpxdbutil.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbplaylistsongs.h"
+#include "mpxdbplaylist.h"
+
+// CONSTANTS
+// UniqueID column in Uris requests
+const TInt KColUniqueID = 0;
+// URI column in Uris requests
+const TInt KColUri = 1;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylist* CMPXDbPlaylist::NewL(
+    CMPXDbManager& aDbManager,
+	MMPXDbPlaylistObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbPlaylist::NewL");
+
+    CMPXDbPlaylist* self = CMPXDbPlaylist::NewLC(aDbManager, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylist* CMPXDbPlaylist::NewLC(
+    CMPXDbManager& aDbManager,
+	MMPXDbPlaylistObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbPlaylist::NewLC");
+
+	CMPXDbPlaylist* self = new (ELeave) CMPXDbPlaylist(aDbManager, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylist::~CMPXDbPlaylist()
+    {
+    MPX_FUNC("CMPXDbPlaylist::~CMPXDbPlaylist");
+    delete iPlaylistSongs;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylist::CMPXDbPlaylist(
+    CMPXDbManager& aDbManager,
+    MMPXDbPlaylistObserver& aObserver) :
+    CMPXDbTable(aDbManager),
+	iObserver(aObserver)
+    {
+    MPX_FUNC("CMPXDbPlaylist::CMPXDbPlaylist");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::ConstructL()
+    {
+    MPX_FUNC("CMPXDbPlaylist::ConstructL");
+
+    BaseConstructL();
+    iPlaylistSongs = CMPXDbPlaylistSongs::NewL(iDbManager);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::AddPlaylistL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlaylist::AddPlaylistL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::AddPlaylistL");
+
+    // make sure the playlist and the corresponding songs are deleted
+    TUint32 playlistId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXPlaylist,
+        aMedia.ValueText(KMPXMediaGeneralUri), EFalse));
+    DeletePlaylistNoUriL(playlistId);
+
+    // add the playlist
+    return DoAddPlaylistL(aMedia, TDriveUnit(aMedia.ValueText(KMPXMediaGeneralUri)));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::AddSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::AddSongsL(
+    TUint32 aPlaylistId,
+    const CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlaylist::AddSongsL");
+
+    // get the drive ID of corresponding playlist
+    TInt drive(GetDriveIdL(aPlaylistId));
+
+    // add the songs
+    iPlaylistSongs->AddSongsL(aPlaylistId, aMediaArray, drive);
+
+    // update the time for the playlist
+    UpdatePlaylistTimeL(aPlaylistId, drive);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::UpdatePlaylistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::UpdatePlaylistL(
+    const CMPXMedia& aMedia,
+    CMPXMessage& aMessage,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdatePlaylistL");
+
+    TUint32 playlistId((aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2);
+    DoUpdatePlaylistL(playlistId, aMedia, aDriveId, aMessage);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::UpdateSongL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylist::UpdateSongL(
+    const CMPXMedia& aMedia,
+    TBool aResetFlags,
+    CMPXMessageArray* aItemChangedMessages /* = NULL */)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdateSongL");
+
+    // find the song ID
+    TInt oldSongId(0);
+    TInt newSongId(0);
+    if (aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        }
+    if (aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        newSongId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection,
+            aMedia.ValueText(KMPXMediaGeneralUri), EFalse);
+        }
+    if ( !aMedia.IsSupported( KMPXMediaGeneralId ) && !aMedia.IsSupported( KMPXMediaGeneralUri ))
+        {
+        User::Leave( KErrArgument );
+        }
+
+    if ( newSongId <= 0 )
+        {
+        newSongId = oldSongId;
+        }
+
+    if ( oldSongId <= 0 )
+        {
+        oldSongId = newSongId;
+        }
+
+    // update the PlaylistSongs and PlaylistSongInfo tables first
+    TBool updated(EFalse);
+    TBool visible(iPlaylistSongs->UpdateSongL( oldSongId, aMedia, aResetFlags, updated ));
+    TBool bSongInPlaylists( EFalse );
+    if (updated)
+        {
+        UpdatePlaylistsForSongL( newSongId, aItemChangedMessages,bSongInPlaylists );
+        }
+
+    return visible;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DeleteSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DeleteSongL(
+    TUint32 aSongId,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongL");
+    TBool bSongInPlaylists(EFalse);
+    // add item changed messages for all playlists that contain the song
+    UpdatePlaylistsForSongL (aSongId, &aItemChangedMessages, bSongInPlaylists);
+    if (bSongInPlaylists)
+        {
+        // delete the song from the PlaylistSongs and PlaylistSongInfo tables
+        iPlaylistSongs->DeleteSongL (aSongId);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DeleteSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DeleteSongL(
+    TUint32 aPlaylistId,
+    TUint32 aSongId,
+    TInt aOrdinal)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongL");
+
+    // get playlist drive
+    TInt drive(GetDriveIdL(aPlaylistId));
+
+    // delete the song from the PlaylistSongs / PlaylistSongInfo tables
+    iPlaylistSongs->DeleteSongL(aPlaylistId, aSongId, aOrdinal, drive);
+
+    // update the time for the playlist
+    UpdatePlaylistTimeL(aPlaylistId, drive);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DeletePlaylistL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbPlaylist::DeletePlaylistL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeletePlaylistL");
+
+    // get the uri
+    HBufC* uri = GetUriL(aPlaylistId);
+    if (uri)
+        {
+        CleanupStack::PushL(uri);
+        TDriveUnit drive(*uri);
+
+        // delete the songs from the PlaylistSongs table
+        iPlaylistSongs->DeleteSongsL(aPlaylistId, drive);
+
+        // delete the playlist record from the Playlist table
+        iDbManager.ExecuteQueryL(drive, KQueryPlaylistDelete, aPlaylistId);
+
+        CleanupStack::Pop(uri);
+        }
+
+    return uri;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DeletePlaylistNoUriL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DeletePlaylistNoUriL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeletePlaylistNoUriL");
+
+    TInt drive(0);
+    MPX_TRAPD(err, drive = GetDriveIdL(aPlaylistId));
+    if (err != KErrNotFound)
+        {
+        User::LeaveIfError(err);
+
+        // delete the songs from the PlaylistSongs table
+        iPlaylistSongs->DeleteSongsL(aPlaylistId, drive);
+
+        // delete the playlist record from the Playlist table
+        iDbManager.ExecuteQueryL(drive, KQueryPlaylistDelete, aPlaylistId);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DeleteAllPlaylistsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DeleteAllPlaylistsL()
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteAllPlaylistsL");
+
+    // delete the songs from the PlaylistSongs table
+    iPlaylistSongs->DeleteAllSongsL();
+
+    // delete all playlists
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistDeleteAll);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::CountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylist::CountL()
+    {
+    MPX_FUNC("CMPXDbPlaylist::CountL");
+    return ExecuteSumQueryL(KQueryPlaylistCount);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetPlaylistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::GetPlaylistL(
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetPlaylistL");
+    ExecuteMediaQueryL(aAttrs, aMedia, KQueryPlaylistGet, aPlaylistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetAllPlaylistsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::GetAllPlaylistsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetAllPlaylistsL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryPlaylistGetAll);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetNameL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbPlaylist::GetNameL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetNameL");
+
+    RSqlStatement recordset(GetPlaylistRecordL(aPlaylistId));
+    CleanupClosePushL(recordset);
+
+    HBufC* name(NULL);
+    TInt err(KErrNone);
+    if ((err = recordset.Next()) == KSqlAtRow)
+        {
+        name = MPXDbCommonUtil::GetColumnTextL(recordset, EPlaylistName).AllocL();
+        }
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(err);
+        }
+
+    if (name == NULL)
+        {
+        User::LeaveIfError(KErrNotFound);
+        }
+    return name;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetUriL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbPlaylist::GetUriL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetUriL");
+
+    RSqlStatement recordset(GetPlaylistRecordL(aPlaylistId));
+    CleanupClosePushL(recordset);
+
+    HBufC* uri(NULL);
+    TInt err(KErrNone);
+    if ((err = recordset.Next()) == KSqlAtRow)
+        {
+        uri = MPXDbCommonUtil::CreateFullPathL(
+            MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+            recordset.ColumnInt64(EPlaylistVolumeId)),
+            MPXDbCommonUtil::GetColumnTextL(recordset, EPlaylistUri));
+
+        }
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(err);
+        }
+
+    if (uri == NULL)
+        {
+        User::LeaveIfError(KErrNotFound);
+        }
+
+    return uri;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetIdL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlaylist::GetIdL(
+    const TDesC& aUri)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetIdL");
+    HBufC* uri = MPXDbCommonUtil::ProcessPatternCharsLC( aUri );
+    TUint32 ret = ExecuteIntQueryL(
+        KQueryLikePlaylistId, uri->Mid( KMCPathStartPos ) );
+
+   	CleanupStack::PopAndDestroy( uri );
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::FindAllL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::FindAllL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlaylist::FindAllL");
+
+    // process the requested attributes
+    // the UniqueId is always requested
+    TBool titleRequested(EFalse);
+    TBool counterRequested(EFalse);
+
+    TInt viewingColumnCount(aAttrs.Count());
+    for (TInt i = 0; (i < viewingColumnCount) && !(titleRequested && counterRequested); ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdGeneral)
+            {
+            TUint attributeId(aAttrs[i].AttributeId());
+
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                titleRequested = ETrue;
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+                counterRequested = ETrue;
+                }
+            }
+        }
+
+    TMPXGeneralType type = aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+
+    const TArray<TMPXAttribute> criteria = aCriteria.Attributes();
+    TInt criteriaCount(criteria.Count());
+
+    // process the criteria and construct the criteria string
+    CDesCArrayFlat* criteriaArray = new (ELeave) CDesCArrayFlat(criteriaCount);
+    CleanupStack::PushL(criteriaArray);
+
+    TBool criteriaCounterSet(EFalse);
+    TInt criteriaCounter(0);
+
+    for (TInt i = 0; i < criteriaCount; ++i)
+        {
+        const TMPXAttribute& criterion = criteria[i];
+        if (type == EMPXItem && criterion == KMPXMediaGeneralId)
+            {
+            TUint32 itemId((aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2);
+            if (MPX_ITEM_CATEGORY(itemId) != EMPXPlaylist)
+                {
+                User::Leave(KErrNotSupported);
+                }
+
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistUniqueId, itemId);
+            }
+        else if (criterion == KMPXMediaGeneralTitle)
+            {
+            HBufC* title = MPXDbCommonUtil::ProcessPatternCharsLC(
+                aCriteria.ValueText(KMPXMediaGeneralTitle));
+            if( type == EMPXOtherType )
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistTitle, *title);
+                }
+            else
+                {
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistLikeTitle, *title);
+                }
+            CleanupStack::PopAndDestroy(title);
+            }
+        else if (criterion == KMPXMediaGeneralUri)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistUniqueId,
+                MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXPlaylist,
+                aCriteria.ValueText(KMPXMediaGeneralUri), EFalse));
+            }
+        else if (criterion == KMPXMediaGeneralDrive)
+            {
+            const TDesC& drive(aCriteria.ValueText(KMPXMediaGeneralDrive));
+            TDriveUnit driveUnit(drive);
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistVolumeId,
+                MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit));
+            }
+        else if (criterion == KMPXMediaGeneralSynchronized)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistSync,
+                aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized));
+            }
+        else if (criterion == KMPXMediaGeneralCount)
+            {
+            criteriaCounterSet = ETrue;
+            criteriaCounter = aCriteria.ValueTObjectL<TInt>(KMPXMediaGeneralCount);
+            }
+        }
+
+    // construct criteria string
+    HBufC* criteriaStr = MPXDbCommonUtil::StringFromArrayLC(*criteriaArray, KMCAndKeyword);
+
+    HBufC* query(NULL);
+    if (criteriaStr->Length() > 0)
+        {
+        // construct and execute the query
+        query = HBufC::NewLC(KQueryPlaylistItems().Length() + criteriaStr->Length());
+        query->Des().Format(KQueryPlaylistItems, criteriaStr);
+        }
+    else
+        {
+        query = HBufC::NewLC(KQueryPlaylistGetAll().Length());
+        query->Des().Format(KQueryPlaylistGetAll);
+        }
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(criteriaStr);
+    CleanupStack::PopAndDestroy(criteriaArray);
+
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        // Setup basic info - with first record of a group
+        TUint32 playlistId(recordset.ColumnInt64(EPlaylistUniqueId));
+
+        TBool valid(ETrue);
+        TInt songCount(-1);
+        if (criteriaCounterSet)
+            {
+            songCount = iPlaylistSongs->CountL(playlistId);
+            valid = (criteriaCounter == songCount);
+            }
+
+        if (valid)
+            {
+            // start a new media object
+            CMPXMedia* media = CMPXMedia::NewL();
+            CleanupStack::PushL(media);
+
+            UpdateMediaL(recordset, aAttrs, *media);
+
+            aMediaArray.AppendL(*media);
+            CleanupStack::PopAndDestroy(media);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(err);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetDriveIdL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylist::GetDriveIdL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetDriveIdL");
+    return MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+        ExecuteIntQueryL(KQueryPlaylistDriveId, aPlaylistId));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::Songs
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylistSongs& CMPXDbPlaylist::Songs()
+    {
+    return *iPlaylistSongs;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetDrivePlaylistCount
+// ----------------------------------------------------------------------------
+//
+TUint CMPXDbPlaylist::GetDrivePlaylistCountL(TInt aDrive)
+    {
+    TUint count(0);
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,KQueryPlaylistFileCount));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    count = TUint(recordset.ColumnInt64(KMPXTableDefaultIndex));
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetPlaylistUriArrayL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::GetPlaylistUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                          CDesCArray& aUriArr, TInt& aLastID)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetPlaylistUriArrayL");
+
+    HBufC* query = NULL;
+    if(aFromID == 0)
+        {
+        query = HBufC::NewLC(KQueryPlaylistGetFileUris().Length()
+                            + KMCIntegerLen);
+        query->Des().Format(KQueryPlaylistGetFileUris, aRecords);
+        }
+    else
+        {
+        query = HBufC::NewLC(KQueryPlaylistGetFileUrisFrom().Length()
+                            + 2*KMCIntegerLen);
+        query->Des().Format(KQueryPlaylistGetFileUrisFrom, aFromID, aRecords);
+        }
+
+    RSqlStatement playlist_rs(iDbManager.ExecuteSelectQueryL(aDrive,*query));
+
+    CleanupStack::PopAndDestroy(query);
+
+    CleanupClosePushL(playlist_rs);
+
+    TInt lastID = 0;
+    TInt err(KErrNone);
+    while((err = playlist_rs.Next()) == KSqlAtRow)
+        {
+        HBufC* fullPath = MPXDbCommonUtil::CreateFullPathL(aDrive,
+                MPXDbCommonUtil::GetColumnTextL(playlist_rs, KColUri));
+        CleanupStack::PushL(fullPath);
+        aUriArr.AppendL(*fullPath);
+        CleanupStack::PopAndDestroy(fullPath);
+
+        lastID = playlist_rs.ColumnInt(KColUniqueID);
+        }
+    CleanupStack::PopAndDestroy(&playlist_rs);
+
+    aLastID = lastID;
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::UpdateMediaL(
+    RSqlStatement& aRecord,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdateMediaL");
+
+    TBool countRequested(EFalse);
+	TBool durationRequested(EFalse);
+    TUint32 playlistId(aRecord.ColumnInt64(EPlaylistUniqueId));
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            if (attributeId & EMPXMediaGeneralId)
+                {
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, playlistId);
+                MPX_DEBUG2("    Playlist ID[%u]", playlistId);
+                }
+            if (attributeId & EMPXMediaGeneralCollectionId)
+                {
+                aMedia.SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId,
+                    TUid::Uid(KDBPluginUid));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                TPtrC title(MPXDbCommonUtil::GetColumnTextL(aRecord, EPlaylistName));
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle, title);
+                MPX_DEBUG2("    Title[%S]", &title);
+                }
+            if ((attributeId & EMPXMediaGeneralUri) ||
+                (attributeId & EMPXMediaGeneralDrive) ||
+                (attributeId & EMPXMediaGeneralFlags))
+                {
+                TUint32 volId(aRecord.ColumnInt64(EPlaylistVolumeId));
+                TInt driveId = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId);
+
+                // LTAN-7GH6BZ, crash if eject memory card when adding song to existing playlist
+                // due to special timing issue, it is possible drive number is -1 and create a
+                // panic when use for TDriveUnit
+                MPX_DEBUG3("volId = %d, driveId = %d", volId, driveId);
+
+                // handle possibly delay from framework notification
+                if (driveId < 0)
+                    {
+                    MPX_DEBUG1("invalid driveId, leave with KErrNotReady");
+                    User::Leave(KErrNotReady);
+                    }
+
+                TDriveUnit driveUnit(driveId);
+
+                if (attributeId & EMPXMediaGeneralUri)
+                    {
+                    HBufC* fullPath = MPXDbCommonUtil::CreateFullPathL(driveUnit,
+                        MPXDbCommonUtil::GetColumnTextL(aRecord, EPlaylistUri));
+                    CleanupStack::PushL(fullPath);
+                    aMedia.SetTextValueL(KMPXMediaGeneralUri, *fullPath);
+                    MPX_DEBUG2("    URI[%S]", fullPath);
+                    CleanupStack::PopAndDestroy(fullPath);
+                    }
+                if (attributeId & EMPXMediaGeneralDrive)
+                    {
+                    aMedia.SetTextValueL(KMPXMediaGeneralDrive, driveUnit.Name());
+                    }
+                if (attributeId & EMPXMediaGeneralFlags)
+                    {
+                    TUint32 dbFlags(aRecord.ColumnInt64(EPlaylistDbFlag));
+                    TInt driveId = driveUnit & KMPXMediaGeneralFlagsDriveInfo;  // 5 bits
+                    aMedia.SetTObjectValueL<TUint>(KMPXMediaGeneralFlags, dbFlags | driveId);
+                    }
+                }
+            if (attributeId & EMPXMediaGeneralSynchronized)
+                {
+                aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralSynchronized,
+                    aRecord.ColumnInt(EPlaylistSync));
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+                // make sure the PlaylistSongs query is executed after all fields
+                // from the current record have been processed, otherwise the recordset
+                // may point to something else
+                countRequested = ETrue;
+                }
+            if (attributeId & EMPXMediaGeneralDate)
+                {
+                // convert the time from the internal DB string format
+                // to the int64 format used by TTime
+                aMedia.SetTObjectValueL<TInt64>(KMPXMediaGeneralDate,
+                    MPXDbCommonUtil::DesToTTimeL(
+                    MPXDbCommonUtil::GetColumnTextL(aRecord, EPlaylistTime)).Int64());
+                }
+			if ( attributeId & EMPXMediaGeneralDuration )
+				{
+				// make sure the PlaylistSongs query is executed after all fields
+				// from the current record have been processed, otherwise the recordset
+				// may point to something else
+
+				durationRequested = ETrue;
+				}
+            } // end if contentId == KMPXMediaIdGeneral
+        } // end for
+
+    if (countRequested)
+        {
+		TInt count = iPlaylistSongs->CountL(playlistId);
+        aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount,
+            count );
+
+        MPX_DEBUG1("    EMPXMediaGeneralCount");
+		MPX_DEBUG2("	Count[%d]", count);
+        }
+	if (durationRequested)
+		{
+		TInt duration = iObserver.HandlePlaylistDurationL(playlistId);
+		aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+
+		MPX_DEBUG1("    EMPXMediaGeneralDuration");
+		MPX_DEBUG2("	Duration[%d]", duration);
+		}
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXPlaylist);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetPlaylistRecordL
+// ----------------------------------------------------------------------------
+//
+RSqlStatement CMPXDbPlaylist::GetPlaylistRecordL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetPlaylistRecordL");
+    return iDbManager.ExecuteSelectQueryL(KQueryPlaylistGet, aPlaylistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DoAddPlaylistL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlaylist::DoAddPlaylistL(
+    const CMPXMedia& aMedia,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DoAddPlaylistL");
+
+    const TDesC& playlistName(aMedia.ValueText(KMPXMediaGeneralTitle));
+    const TDesC& playlistUri(aMedia.ValueText(KMPXMediaGeneralUri));
+
+    TUint32 playlistId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXPlaylist, playlistUri, EFalse));
+    const CMPXMediaArray* mediaArray = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+    if( !mediaArray )
+        {
+        User::Leave( KErrNoMemory );
+        }
+    // add the songs to the PlaylistSongs table
+    TInt count(mediaArray->Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        iPlaylistSongs->AddSongL(playlistId, i, *mediaArray->AtL(i), aDriveId);
+        }
+
+    // determine the value of DbFlag
+    TUint dbflags(0);
+    if (aMedia.IsSupported(KMPXMediaGeneralFlags))
+        {
+        TUint flag(aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags));
+        if (flag & KMPXMediaGeneralFlagsSetOrUnsetBit )
+            {
+            // Set flag
+            dbflags |= flag;
+            MPX_DEBUG2("    GeneralFlags[%b]", dbflags);
+            }
+        }
+
+    // add playlist record
+    HBufC* time = MPXDbCommonUtil::CurrentTimeDesLC();
+    HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(playlistName);
+    HBufC* uri = MPXDbCommonUtil::ProcessSingleQuotesLC(playlistUri);
+    TPtrC uriPtr(uri->Mid(KMCPathStartPos));
+    TPtrC namePtr(name->Left(KMCMaxTextLen));
+
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistInsert, playlistId, &namePtr,
+        &uriPtr, MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), aDriveId),
+        dbflags, time);
+
+    CleanupStack::PopAndDestroy(uri);
+    CleanupStack::PopAndDestroy(name);
+    CleanupStack::PopAndDestroy(time);
+
+    return playlistId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DoUpdatePlaylistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DoUpdatePlaylistL(
+    TUint32 aPlaylistId,
+    const CMPXMedia& aMedia,
+    TInt aDriveId,
+    CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DoUpdatePlaylistL");
+
+    // construct the criteria array
+    const TArray<TMPXAttribute> attributes = aMedia.Attributes();
+
+    CDesCArrayFlat* criteriaArray = new (ELeave) CDesCArrayFlat(attributes.Count());
+    CleanupStack::PushL(criteriaArray);
+
+    TInt attrCount(attributes.Count());
+    for (TInt index = 0; index < attrCount; ++index)
+        {
+        TInt contentId(attributes[index].ContentId());
+        TUint attributeId(attributes[index].AttributeId());
+
+        switch(contentId)
+            {
+            case KMPXMediaIdGeneral:
+                {
+                if (attributeId & EMPXMediaGeneralTitle)
+                    {
+                    MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistTitle,
+                        aMedia.ValueText(KMPXMediaGeneralTitle));
+                    }
+                if (attributeId & EMPXMediaGeneralUri)
+                    {
+                    const TDesC& uri(aMedia.ValueText (KMPXMediaGeneralUri));
+
+                    // determine if we are changing URI of an existing playlist.
+                    // if so, update playlist URI + its Id
+                    TUint32 newId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXPlaylist, uri, EFalse));
+
+                    if (aPlaylistId != newId)
+                        {
+                        aMessage.SetTObjectValueL<TMPXItemId>(KMPXMessageMediaGeneralId, newId);
+                        aMessage.SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, aPlaylistId);
+
+                        // Change event handling for renaming a playlist should be like a song
+                        // The item focus should goto the new name of the playlist
+                        // to-do: this should be abstracted from the plugin. framework should
+                        //        have enough info to deal with this scenario, if not, add more
+                        //        info in the message passing back to framework
+                        aMessage.SetTObjectValueL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory,
+                            EMPXSong);
+
+                        // update the PlaylistSongs to reflect playlist id change
+                        iPlaylistSongs->UpdateSongsL(aPlaylistId, newId);
+
+                        // this takes care of processing the single quotes in the URI
+                        MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistUri,
+                            uri.Mid(KMCPathStartPos));
+                        MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistVolumeId,
+                            MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), TDriveUnit(uri)));
+                        MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistUniqueId,
+                            newId);
+                        }
+                    }
+                if (attributeId & EMPXMediaGeneralSynchronized)
+                    {
+                    MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistSync,
+                        aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized));
+                    }
+                }
+                break;
+
+            default:
+                break;
+
+            } // end switch
+        } // end for
+
+    // update the time field to the current time
+    HBufC* time = MPXDbCommonUtil::CurrentTimeDesLC();
+    MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistTime, *time);
+    CleanupStack::PopAndDestroy(time);
+
+    // construct a string from all criteria
+    HBufC* criteria = MPXDbCommonUtil::StringFromArrayLC(*criteriaArray, KMCCommaSign);
+
+    // execute the query
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistUpdate, criteria, aPlaylistId);
+
+    CleanupStack::PopAndDestroy(criteria);
+    CleanupStack::PopAndDestroy(criteriaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::UpdatePlaylistsForSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::UpdatePlaylistsForSongL(
+    TUint32 aSongId,
+    CMPXMessageArray* aItemChangedMessages, TBool& aSongInPlaylists)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdatePlaylistsForSongL");
+
+    aSongInPlaylists = EFalse;
+    if (aItemChangedMessages)
+        {
+        // get all playlists for the song
+        RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPlaylistGetForSong, aSongId));
+        CleanupClosePushL(recordset);
+
+        // ignore the errors
+        while (recordset.Next() == KSqlAtRow)
+            {
+            aSongInPlaylists = ETrue;
+            // add item changed messages for all of them
+            MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages,
+                recordset.ColumnInt64(KMPXTableDefaultIndex), EMPXItemModified,
+                EMPXPlaylist, KDBPluginUid);
+            }
+
+        CleanupStack::PopAndDestroy(&recordset);
+        }
+    if (aSongInPlaylists)
+        {
+        // update the time for all playlists that contain this song
+        HBufC* time = MPXDbCommonUtil::CurrentTimeDesLC();
+        iDbManager.ExecuteQueryL (KDbManagerAllDrives,
+                KQueryPlaylistUpdateTimeForSong, time, aSongId);
+        CleanupStack::PopAndDestroy (time);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::UpdatePlaylistTimeL(
+    TUint32 aPlaylistId,
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdatePlaylistTimeL");
+
+    HBufC* time = MPXDbCommonUtil::CurrentTimeDesLC();
+    iDbManager.ExecuteQueryL(aDrive, KQueryPlaylistUpdateTime, time, aPlaylistId);
+    CleanupStack::PopAndDestroy(time);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetDrivePlaylistDuration
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylist::GetDrivePlaylistDuration(TUint32 /*aPlaylistId*/)
+    {
+    return 0;
+    }
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbPlaylist::CreateTableL");
+
+    // create the table
+    User::LeaveIfError(aDatabase.Exec(KPlaylistCreateTable));
+
+    // create the index on the Name field
+    User::LeaveIfError(aDatabase.Exec(KPlaylistNameIndex));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DropTableL");
+    User::LeaveIfError(aDatabase.Exec(KPlaylistDropTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylist::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbPlaylist::CheckTableL");
+    return DoCheckTable(aDatabase, KPlaylistCheckTable);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplaylistsongs.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,832 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interaction with the PlaylistSongs and
+*                PlaylistSongInfo tables.
+*
+*/
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <mpxlog.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include "mpxdbcommonutil.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbutil.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbmanager.h"
+#include "mpxdbplaylistsongs.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylistSongs* CMPXDbPlaylistSongs::NewL(
+    CMPXDbManager& aDbManager)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::NewL");
+
+    CMPXDbPlaylistSongs* self = CMPXDbPlaylistSongs::NewLC(aDbManager);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylistSongs* CMPXDbPlaylistSongs::NewLC(
+    CMPXDbManager& aDbManager)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::NewLC");
+
+    CMPXDbPlaylistSongs* self = new (ELeave) CMPXDbPlaylistSongs(aDbManager);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylistSongs::~CMPXDbPlaylistSongs()
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::~CMPXDbPlaylistSongs");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylistSongs::CMPXDbPlaylistSongs(
+    CMPXDbManager& aDbManager) :
+    CMPXDbTable(aDbManager)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::CMPXDbPlaylistSongs");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::ConstructL()
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::ConstructL");
+    BaseConstructL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::AddSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::AddSongsL(
+    TUint32 aPlaylistId,
+    const CMPXMediaArray& aMediaArray,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::AddSongsL");
+
+    TInt count(aMediaArray.Count());
+    for (TInt index = 0; index < count; ++index)
+        {
+        AddSongL(aPlaylistId, *(aMediaArray[index]), aDriveId);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::AddSongL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlaylistSongs::AddSongL(
+    TUint32 aPlaylistId,
+    const CMPXMedia& aMedia,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::AddSongL");
+    return AddSongL(aPlaylistId, CountL(aPlaylistId), aMedia, aDriveId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::AddSongL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlaylistSongs::AddSongL(
+    TUint32 aPlaylistId,
+    TInt aOrdinal,
+    const CMPXMedia& aMedia,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::AddSongL");
+
+    // the UniqueId field is AUTOINCREMENT and its value is going to be generated
+    // automatically by the database - no need to supply it here
+    TUint32 songId((aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2);
+
+    // insert PlaylistSongs record
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsInsert, aPlaylistId, songId, aOrdinal);
+
+    // if the song is not already in the PlaylistSongInfo table - add it
+    if (!SongInfoExistsL(aDriveId, songId))
+        {
+        // add a new song info record
+        HBufC* uri = MPXDbCommonUtil::ProcessSingleQuotesLC(aMedia.ValueText(KMPXMediaGeneralUri));
+        HBufC* title = MPXDbCommonUtil::ProcessSingleQuotesLC(aMedia.ValueText(KMPXMediaGeneralTitle));
+
+        TUint32 dbFlag(0);
+        if (aMedia.IsSupported(KMPXMediaGeneralFlags))
+            {
+            dbFlag = (aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags));
+            dbFlag = dbFlag & (~KMPXMediaGeneralFlagsDriveInfo); // clear drive info
+            }
+
+        // add the URI without the drive letter
+        TPtrC uriPtr(uri->Mid(KMCPathStartPos));
+        iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongInfoInsert, songId, &uriPtr, title,
+            MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), TDriveUnit(*uri)), dbFlag);
+
+        CleanupStack::PopAndDestroy(title);
+        CleanupStack::PopAndDestroy(uri);
+        }
+
+    return songId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::UpdateSongL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::UpdateSongL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    TBool aResetFlags,
+    TBool& aUpdated)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::UpdateSongL");
+
+    aUpdated = EFalse;
+    TBool visibleChange(EFalse);
+
+    // get the current record
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPlaylistSongInfoGet, aSongId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() == KSqlAtRow)
+        {
+        const TArray<TMPXAttribute> attributes = aMedia.Attributes();
+
+        // stores the current song ID, which may change during execution
+        TUint32 songId(aSongId);
+
+        TInt attrCount(attributes.Count());
+        for (TInt i = 0; i < attrCount; ++i)
+            {
+            TInt contentId(attributes[i].ContentId());
+            TUint attributeId(attributes[i].AttributeId());
+
+            switch(contentId)
+                {
+                case KMPXMediaIdGeneral:
+                    {
+                    if (attributeId & EMPXMediaGeneralTitle)
+                        {
+                        // existing title
+                        TPtrC title(aMedia.ValueText(KMPXMediaGeneralTitle).Left(KMCMaxTextLen));
+
+                        // compare with the old title
+                        if (title.Compare(MPXDbCommonUtil::GetColumnTextL(recordset, EPlaylistSongInfoTitle)) != 0)
+                            {
+                            HBufC* titleProc = MPXDbCommonUtil::ProcessSingleQuotesLC(title);
+
+                            // title has changed - update on all drives
+                            iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongInfoUpdateTitle,
+                                titleProc, songId);
+
+                            CleanupStack::PopAndDestroy(titleProc);
+
+                            visibleChange = ETrue;
+                            aUpdated = ETrue;
+                            MPX_DEBUG2("    Title[%S]", &title);
+                            }
+                        }
+
+                    if (attributeId & EMPXMediaGeneralUri)
+                        {
+                        const TDesC& uriOrig(aMedia.ValueText(KMPXMediaGeneralUri));
+                        songId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection, uriOrig, EFalse);
+
+                        if (aSongId != songId)
+                            {
+                            // URI of the song has been changed. This changes the Id of the song and both the
+                            // PlaylistSongs and PlaylistSongInfo tables should be updated accordingly.
+
+                            HBufC* uri = MPXDbCommonUtil::ProcessSingleQuotesLC(uriOrig);
+
+                            // use the URI without the drive letter
+                            TPtrC uriPtr(uri->Mid(KMCPathStartPos));
+
+                            // update the PlaylistSongInfo table on all drives
+                            iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongInfoUpdate, songId,
+                                &uriPtr, MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), TDriveUnit(*uri)), aSongId);
+
+                            // update the PlaylistSongs table on all drives
+                            iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsUpdate, songId,
+                                aSongId);
+
+                            aUpdated = ETrue;
+                            MPX_DEBUG3("    CurrentSongId[0x%x] changed to [0x%x]", aSongId, songId);
+
+                            CleanupStack::PopAndDestroy(uri);
+                            }
+                        }
+
+                    if (attributeId & EMPXMediaGeneralFlags)
+                        {
+                        TUint flag(aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags));
+                        TUint32 curFlag(recordset.ColumnInt64(EPlaylistSongInfoDbFlag));
+
+                        if (flag & KMPXMediaGeneralFlagsSetOrUnsetBit)
+                            {
+                            if (aResetFlags)
+                                {
+                                visibleChange = ETrue;
+                                curFlag = flag;
+                                }
+                            else
+                                {
+                                // Set flag, visible change is true only if the flag status is changing
+                                visibleChange = visibleChange || ((curFlag^flag) & 0x7FFFFFFF);
+                                curFlag |= flag;
+                                }
+                            }
+                        else
+                            {
+                            // Clear flag, visible change is true only if the flag status is changing
+                            visibleChange = visibleChange || (((curFlag^0xFFFFFFFF)^flag) & 0x7FFFFFFF);
+                            curFlag &= (~flag);
+                            }
+
+                        if (visibleChange)
+                            {
+                            // update the flags on all drives
+                            iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongInfoUpdateFlags,
+                                curFlag, songId);
+                            aUpdated = ETrue;
+                            }
+
+                        MPX_DEBUG2("    GeneralFlags[%b]", curFlag);
+                        }
+                    } // end case
+                } // end switch
+            } // end for
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    return visibleChange;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::UpdateSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::UpdateSongsL(
+    TUint32 aPlaylistId,
+    TUint32 aNewPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::UpdateSongsL");
+
+    // update the PlaylistSongs table on all drives
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsUpdatePlaylistId,
+        aNewPlaylistId, aPlaylistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::ReorderSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::ReorderSongL(
+    const TMPXItemId& aPlaylistId,
+    const TMPXItemId& aSongId,
+    TUint aOriginalOrdinal,
+    TUint aNewOrdinal)
+    {
+    MPX_DEBUG1("-->CMPXDbPlaylistSongs::ReorderSongL");
+    MPX_DEBUG5("    playlist[0x%x, 0x%x], song[0x%x, 0x%x]",
+               aPlaylistId.iId1, aPlaylistId.iId2, aSongId.iId1, aSongId.iId2);
+
+    //
+    // Move the song up. The rest of the songs in between the old ordinal and new ordinal
+    // need to be moved down, i.e. their ordinals need to be incremented
+    //
+    if (aOriginalOrdinal > aNewOrdinal)
+        {
+        iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsMoveSongUp,
+            aPlaylistId.iId2, aNewOrdinal, aOriginalOrdinal);
+        }
+
+    //
+    // Move the song down. The rest of the songs in between the old ordinal and new ordinal
+    // need to be moved up, i.e. their ordinals need to be decremented
+    //
+    else if (aOriginalOrdinal < aNewOrdinal)
+        {
+        iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsMoveSongDown,
+            aPlaylistId.iId2, aNewOrdinal, aOriginalOrdinal);
+        }
+
+    //
+    // Change the ordinal of the song itself. If the ordinal is unchanged, no update is
+    // required
+    //
+    if (aOriginalOrdinal != aNewOrdinal)
+        {
+        iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsUpdateSongOrdinal,
+            aNewOrdinal, aSongId.iId1);
+        }
+
+    MPX_DEBUG1("<--CMPXDbPlaylistSongs::ReorderSongL");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteSongL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::DeleteSongL");
+
+    // delete from the PlaylistSongs table on all drives
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsDelete, aSongId);
+
+    // delete from the PlaylistSongInfo table on all drives
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongInfoDelete, aSongId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteSongL(
+    TUint32 aPlaylistId,
+    TUint32 aSongId,
+    TInt aOrdinal,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongL");
+
+    // get the number of instances for the song in the playlist
+    TInt count(SongInstanceCountL(aPlaylistId, aSongId));
+
+    if (1 == count)
+        {
+        // just one instance with this ID in the playlist
+        // delete it regardless of the ordinal
+        iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsDeleteSong, aPlaylistId, aSongId);
+
+        // check how many instances of this song are left for all playlists
+        if (!SongCountL(aSongId))
+            {
+            // delete the PlaylistSongInfo record
+            iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongInfoDelete, aSongId);
+            }
+        }
+    else if (count > 1)
+        {
+        // multiple songs with this id in the playlist
+        // try to delete the one with the specified ordinal
+        iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsDeleteSongOrdinal, aPlaylistId,
+            aSongId, aOrdinal);
+        }
+    else
+        {
+        // no such song in the playlist
+        User::Leave(KErrCorrupt);
+        }
+    // adjust song ordinals for the songs after the deleted song
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsUpdateSongOrdinalAfterDelete,
+        aPlaylistId, aOrdinal);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteSongsL(
+    TUint32 aPlaylistId,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongsL");
+
+    // delete the records from the PlaylistSongs table
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsDeletePlaylist, aPlaylistId);
+
+    // delete the unused records from the PlaylistSongInfo table
+    CleanupSongInfoL(aDriveId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteSongsForCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteSongsForCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongsForCategoryL");
+
+    // get the category field name in the Music table
+    TPtrC category = MPXDbUtil::MusicFieldNameForCategoryL(aCategory);
+
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsDeleteForCategory,
+        &category, aCategoryId);
+
+    // delete the unused records from the PlaylistSongInfo table
+    CleanupSongInfoL(aDriveId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteSongsForArtistAndAlbumL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteSongsForArtistAndAlbumL(
+    TUint32 aArtistId,
+    TUint32 aAlbumId,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongsForArtistAndAlbumL");
+
+    // delete the songs in the PlaylisSongs table
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsDeleteForArtistAlbum,
+        aArtistId, aAlbumId);
+
+    // delete the unused records from the PlaylistSongInfo table
+    CleanupSongInfoL(aDriveId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteAllSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteAllSongsL()
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteAllSongsL");
+
+    // delete all records from the PlaylistSongs table, all drives
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsDeleteAll);
+
+    // delete all records from the PlaylistSongInfo table, all drives
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongInfoDeleteAll);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::GetSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::GetSongsL(
+    TUint32 aPlaylistId,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_DEBUG2("-->CMPXDbPlaylistSongs::GetSongsL(playlist 0x%x)", aPlaylistId);
+
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL( attributes );
+
+    attributes.AppendL(KMPXMediaGeneralType);
+    attributes.AppendL(KMPXMediaGeneralCategory);
+    attributes.AppendL(KMPXMediaGeneralId);
+
+    // cannot execute a joined query to the music table
+    // because the song records in the music table may be on a different drive
+    ExecuteMediaQueryL(attributes.Array(), aMediaArray, KQueryPlaylistSongsGetSongs, aPlaylistId);
+
+    CleanupStack::PopAndDestroy(&attributes);
+
+    MPX_DEBUG1("<--CMPXDbPlaylistSongs::GetSongsL");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::GetSongsL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::GetSongsL(
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_DEBUG2("-->CMPXDbPlaylistSongs::GetSongsL(playlist 0x%x)", aPlaylistId);
+    TBool valid(EFalse);
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPlaylistSongsGetSongsInfo,
+    		aPlaylistId));
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        UpdateMediaL(recordset, aAttrs, *media);
+
+        aMediaArray.AppendL(*media);
+        CleanupStack::PopAndDestroy(media);
+        }
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    else
+    	{
+    	valid = ETrue;
+    	}
+
+    MPX_DEBUG1("<--CMPXDbPlaylistSongs::GetSongsL");
+    return valid;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::GetSongL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::GetSongL(
+    TUint32 aPlaylistId,
+    TUint32 aSongId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetSongL");
+
+    // get the song
+    TBool valid(EFalse);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPlaylistSongsGetSong,
+        aPlaylistId, aSongId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() == KSqlAtRow)
+        {
+        // convert to media
+        UpdateMediaL(recordset, aAttrs, aMedia);
+        valid = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return valid;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::GetSongL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::GetSongL(
+    const TMPXItemId& aSongId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia*& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetSongL");
+
+    // get the song
+    TBool valid(EFalse);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPlaylistSongsGetSongInfo,
+        aSongId.iId1, aSongId.iId2));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() == KSqlAtRow)
+        {
+        // convert to media
+        aMedia = CMPXMedia::NewL();
+        CleanupStack::PushL(aMedia);
+        UpdateMediaL(recordset, aAttrs, *aMedia);
+        CleanupStack::Pop(aMedia);
+        valid = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return valid;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::CountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylistSongs::CountL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::CountL");
+    return ExecuteSumQueryL(KQueryPlaylistSongsCount, aPlaylistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::UpdateMediaL(
+    RSqlStatement& aRecord,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdateMediaL");
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXSong);
+    aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, TMPXItemId(
+        aRecord.ColumnInt64(EPlaylistSongsUniqueId),
+        aRecord.ColumnInt64(EPlaylistSongsSongId)));
+
+/*
+    aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+        aRecord.ColumnInt64(EPlaylistSongsSongId));
+*/
+    TInt count(aAttrs.Count());
+    for (TInt index = 0; index < count; ++index)
+        {
+        TInt contentId(aAttrs[index].ContentId());
+        TUint attributeId(aAttrs[index].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            if (attributeId & EMPXMediaGeneralCollectionId)
+                {
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralCollectionId,
+                    aRecord.ColumnInt64(EPlaylistSongsPlaylistId));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                TPtrC title(MPXDbCommonUtil::GetColumnTextL(aRecord, EPlaylistSongsTitle));
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle, title);
+                MPX_DEBUG2("    Title[%S]", &title);
+                }
+            if (attributeId & EMPXMediaGeneralUri)
+                {
+                TUint volId(aRecord.ColumnInt64(EPlaylistSongsVolumeId));
+                HBufC* uri = MPXDbCommonUtil::CreateFullPathL(
+                    MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId),
+                    MPXDbCommonUtil::GetColumnTextL(aRecord, EPlaylistSongsUri));
+                CleanupStack::PushL(uri);
+
+                aMedia.SetTextValueL(KMPXMediaGeneralUri, *uri);
+
+                MPX_DEBUG2("    URI[%S]", uri);
+                CleanupStack::PopAndDestroy(uri);
+                }
+            if (attributeId & EMPXMediaGeneralFlags)
+                {
+                // assuming song details shouldn't be available for this song
+                TUint32 dbFlags(aRecord.ColumnInt64(EPlaylistSongsDbFlag) |
+                                KMPXMediaGeneralFlagsIsMissingDetails);
+                TUint32 volId(aRecord.ColumnInt64(EPlaylistSongsVolumeId));
+                TDriveUnit driveUnit(EDriveC);
+                if (aMedia.IsSupported(KMPXMediaGeneralUri))
+                    {
+                    // ignore the return value
+                    MPXDbCommonUtil::GetDriveL(aMedia.ValueText(KMPXMediaGeneralUri), driveUnit);
+                    }
+                else
+                    {
+                    driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId);
+                    }
+
+                // the volume the playlist song is located on may be removed
+                if (~dbFlags & KMPXMediaGeneralFlagsIsInvalid)
+                    {
+                    if (((volId != 0) && (MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId) == KErrNotFound)) ||
+                        ((volId == 0) && (MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit) == 0)))
+                        {
+                        dbFlags |= KMPXMediaGeneralFlagsIsInvalid;
+                        }
+                    }
+
+                TInt driveId(driveUnit & KMPXMediaGeneralFlagsDriveInfo);  // 5 bits
+                aMedia.SetTObjectValueL<TUint>(KMPXMediaGeneralFlags, dbFlags | driveId);
+                MPX_DEBUG2("    GeneralFlags[%b]", dbFlags | driveId);
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::SongInstanceCountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylistSongs::SongInstanceCountL(
+    TUint32 aPlaylistId,
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::SongInstanceCountL");
+    return ExecuteSumQueryL(KQueryPlaylistSongsPlaylistSongCount, aPlaylistId, aSongId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::SongCountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylistSongs::SongCountL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::SongCountL");
+    return ExecuteSumQueryL(KQueryPlaylistSongsSongCount, aSongId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::SongInfoExistsL
+// The song info record must be in the same database as the corresponding
+// PlaylistSongs record(s), otherwise when adding a duplicate of a song on a
+// different drive this method will return true and the song info record won't
+// be created.
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::SongInfoExistsL(
+    TInt aDriveId,
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::SongInfoExistsL");
+
+    RSqlStatement recordset(
+        iDbManager.ExecuteSelectQueryL(aDriveId, KQueryPlaylistSongInfoExists, aSongId));
+    TBool exists(recordset.Next() == KSqlAtRow);
+    recordset.Close();
+    return exists;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::CleanupSongInfoL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::CleanupSongInfoL(
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::CleanupSongInfoL");
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongInfoCleanup);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::CreateTableL");
+
+    // create the PlaylistSongs table
+    User::LeaveIfError(aDatabase.Exec(KPlaylistSongsCreateTable));
+
+    // create the PlaylistSongInfo table
+    User::LeaveIfError(aDatabase.Exec(KPlaylistSongInfoCreateTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::DropTableL");
+
+    // drop the PlaylistSongs table
+    User::LeaveIfError(aDatabase.Exec(KPlaylistSongsDropTable));
+
+    // drop the PlaylistSongInfo table
+    User::LeaveIfError(aDatabase.Exec(KPlaylistSongInfoDropTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::CheckTableL");
+
+    // check the PlaylistSongs table
+    TBool check = DoCheckTable(aDatabase, KPlaylistSongsCheckTable);
+
+    // check the PlaylistSongInfo table
+    return check && DoCheckTable(aDatabase, KPlaylistSongInfoCheckTable);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4457 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of collection DB Plugin interface
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32cmn.h>
+#include <StringLoader.h>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+
+#include <mpxcmn.h>
+#include <mpxuser.h>
+#include <mpxcollectionpluginobserver.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxmessagecontainerdefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxincrementalopendefs.h>
+#include <mpxcollectionopenlresultdef.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxdrmmediautility.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxlog.h>
+#include <mpxcollectiondbhgres.rsg>
+#include <mpxdbhgplugin.mbg>
+#include <centralrepository.h>
+
+#ifdef RD_MULTIPLE_DRIVE
+#include <driveinfo.h>
+#endif //RD_MULTIPLE_DRIVE
+
+#include "mpxresource.h"
+#include "mpxdbcommondef.h"
+#include "mpxdbcommonutil.h"
+
+#include "mpxdbhandler.h"
+#include "mpxdbutil.h"
+#include "mpxcollectiondbdef.h"
+#include "mpxdbplugin.h"
+
+// CONSTANTS
+_LIT(KMPlayerDbPluginMbmFile, "mpxdbhgplugin.mif");
+const TInt KFirstFetchCount = 400;
+
+const TUid KCRUIDMusicPlayerFeatures = { 0x101FFCD0 };
+const TInt KMusicPlayerFeatures = 1;
+const TInt KDisablePodcasting = 0x80;
+
+const TInt KIncrementalDeleteCount = 400;
+
+const TInt KSQLErrGeneral = -311; // SQL General error. Don't want to include sql header here
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlugin* CMPXDbPlugin::NewL(
+    TAny* /*aInitParams*/)
+    {
+    MPX_FUNC("CMPXDbPlugin::NewL");
+
+    CMPXDbPlugin* self = new (ELeave) CMPXDbPlugin();
+    CleanupStack::PushL (self);
+    self->ConstructL ();
+    CleanupStack::Pop (self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlugin::~CMPXDbPlugin()
+    {
+    MPX_FUNC("CMPXDbPlugin::~CMPXDbPlugin");
+
+    iSelections.Reset();
+    iSelections.Close();
+    iFs.Close();
+    delete iDbHandler;
+    delete iDrmMediaUtility;
+    if (iResource)
+        {
+        iResource->Release();
+        }
+    iMusicLibraryMenuIds.Close();
+    delete iMusicLibraryMenuTitles;
+    delete iMusicLibraryTitles;
+    delete iAllSongsForArtistTitle;
+    delete iMusicMenuTitle;
+    delete iShuffleAllText;
+
+    if (iActiveTask)
+        {
+        iActiveTask->Cancel();
+        delete iActiveTask;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlugin::CMPXDbPlugin()
+    {
+    MPX_FUNC("CMPXDbPlugin::CMPXDbPlugin");
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::ConstructL()
+    {
+    MPX_FUNC("CMPXDbPlugin::ConstructL");
+    iFirstDeleteStep = ETrue;
+    User::LeaveIfError(iFs.Connect());
+    iDrmMediaUtility = CMPXDrmMediaUtility::NewL();
+
+    TParse parse;
+    parse.Set( KMPXCollectionDbResourceFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resFile(parse.FullName());
+    User::LeaveIfError(MPXUser::CompleteWithDllPath(resFile));
+    BaflUtils::NearestLanguageFile(iFs, resFile);
+    iResource = CMPXResource::NewL(resFile);
+
+    iDbHandler = CMPXDbHandler::NewL(iFs, *iResource);
+    iMusicLibraryMenuTitles = iResource->ReadMenuArrayL(R_MC_MENU_ITEMS_ARRAY, iMusicLibraryMenuIds);
+    iMusicLibraryTitles = iResource->ReadMenuArrayL(R_MC_TITLE_ITEMS_ARRAY, iMusicLibraryMenuIds );
+    iAllSongsForArtistTitle = iResource->ReadHBufCL(R_MC_ALL_SONGS_FOR_ARTIST);
+
+#ifdef __ENABLE_MUSIC_TEXT_ALIGNMENT
+    iMusicMenuTitle = iResource->ReadHBufCL(R_MPX_QTN_MP_TITLE_MY_MUSIC_MENU_NSERIES);
+#else
+    iMusicMenuTitle = iResource->ReadHBufCL(R_MPX_QTN_MUS_TITLE_MUSIC_MENU);
+#endif // __ENABLE_MUSIC_TEXT_ALIGNMENT
+
+    iShuffleAllText = iResource->ReadHBufCL(R_MC_SHUFFLE_ALL);
+
+    iActiveTask = CMPXDbActiveTask::NewL(*this);
+
+    CRepository* cenrep(NULL);
+    TRAPD( err, cenrep = CRepository::NewL( KCRUIDMusicPlayerFeatures ) );
+    if( err == KErrNone )
+        {
+        TInt val(0);
+        cenrep->Get( KMusicPlayerFeatures, val );
+        iDisablePodcasting = val&KDisablePodcasting ? ETrue:EFalse;
+        delete cenrep;
+        }
+    else
+        {
+        iDisablePodcasting = EFalse;
+        }
+    iAllSongsValid = ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// Navigates to the given path
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::OpenL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& /*aAttrs*/,
+    CMPXFilter* aFilter)
+    {
+    MPX_FUNC("CMPXDbPlugin::OpenL");
+    MPX_DEBUG_PATH(aPath);
+    //Create a path object to be returned.
+    CMPXCollectionPath* path = CMPXCollectionPath::NewL(aPath);
+    CleanupStack::PushL(path);
+    RArray<TMPXAttribute> openAttrs;
+    CleanupClosePushL(openAttrs);
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+
+    // Replace the attributes requested by the client with the ones below.
+    // This will eventually have to be fixed
+    SetAttributesL(aPath, openAttrs, supportedIds);
+
+    CMPXMedia* entries = CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entries);
+    //Add returned path into media
+    entries->SetTObjectValueL<TInt>(KMPXMediaGeneralValue, (TInt)path);
+
+    TInt error(KErrNone);
+    TBool isASong(EFalse);
+    CMPXCollectionPath* newPath(NULL);
+
+    // Make sure we handle open the correct open mode
+    //
+    TMPXOpenMode openmode = aPath.OpenNextMode();
+    switch (openmode)
+        {
+        case EMPXOpenGroupOrPlaylist:
+            {
+            // Open By Path
+            MPX_TRAP(error, isASong = DoOpenL(aPath, openAttrs.Array(), *entries, aFilter));
+            break;
+            }
+
+        case EMPXOpenPlaylistOnly:
+            {
+            if (aPath.Count() > 0)
+                {
+                // Try to open
+                MPX_TRAP(error, newPath = DoOpenPlaylistL(aPath, openAttrs.Array()));
+                CleanupStack::PushL(newPath);
+                isASong = ETrue;
+                }
+            else // no items
+                {
+                MPX_TRAP(error, isASong = DoOpenL(aPath, openAttrs.Array(), *entries, aFilter));
+                }
+
+            break;
+            }
+
+        default:
+            // do nothing
+            break;
+        }
+
+    // generate the callback
+    if (isASong )
+        {
+        if (openmode == EMPXOpenGroupOrPlaylist)
+            {
+            iObs->HandleOpen(const_cast<CMPXCollectionPath*>(&aPath), error);
+            }
+        else  // openmode == EMPXOpenPlaylistOnly
+            {
+            iObs->HandleOpen(newPath, error);
+            }
+        }
+    else
+        {
+        entries->SetCObjectValueL(KMPXMediaGeneralContainerPath,
+            const_cast<CMPXCollectionPath*>(&aPath));
+        entries->Delete(KMPXMediaGeneralValue);
+        iObs->HandleOpen(entries, path, error);
+        }
+
+    if (newPath)
+        {
+        CleanupStack::PopAndDestroy(newPath);
+        }
+
+    CleanupStack::PopAndDestroy(entries);
+    CleanupStack::PopAndDestroy(&openAttrs);
+    CleanupStack::PopAndDestroy(path);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the extended properties of the current file (async)
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::MediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    const TArray<TCapability>& /*aCaps*/,
+    CMPXAttributeSpecs* /*aSpecs*/)
+    {
+    MPX_FUNC("CMPXDbPlugin::MediaL");
+    MPX_DEBUG_PATH(aPath);
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    if (aPath.Selection().Count())
+        {
+        // it's a container if there are multiple selection, else it's not a container
+        supportedIds.AppendL(KMPXMediaIdContainer);
+        }
+    MPXDbCommonUtil::FillInSupportedUIDsL(aAttrs, supportedIds);
+
+    CMPXMedia* entries = CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entries);
+
+    DoMediaL(aPath, aAttrs, *entries);
+
+    // Also fetch collection details and set the path if required
+    DoHandleOtherMediaAttributesL(aAttrs, aPath, *entries);
+
+    iObs->HandleMedia(entries, KErrNone);
+    CleanupStack::PopAndDestroy(entries);
+    }
+
+// ----------------------------------------------------------------------------
+// Cancel outstanding request
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::CancelRequest()
+    {
+    MPX_FUNC("CMPXDbPlugin::CancelRequest");
+    iActiveTask->Cancel();
+    }
+
+// ----------------------------------------------------------------------------
+// Executes the given command on the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::CommandL(
+    TMPXCollectionCommand aCmd,
+    TInt aArg /* = 0 */)
+    {
+    MPX_FUNC("CMPXDbPlugin::CommandL");
+    MPX_DEBUG2("CMPXDbPlugin::CommandL %d", aCmd);
+    iAllSongsValid = ETrue;
+    switch (aCmd)
+        {
+        case EMcCmdRemoveAll:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcCmdRemoveAll");
+            // Remove EVERYthing from the collection
+            iDbHandler->RemoveEntireCollectionL();
+            break;
+            }
+        case EMcCmdClose:
+        case EMcCloseCollection:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcCloseCollection");
+            // Close the specified database
+            TRAP_IGNORE(iDbHandler->PreCloseCollectionL());
+ #ifdef RD_MULTIPLE_DRIVE
+            MPX_DEBUG1("Multiple drives closing databases");
+            if ( aArg <0)
+                {
+                DriveInfo::TDriveArray driveArray;
+                User::LeaveIfError ( DriveInfo::GetUserVisibleDrives( iFs, driveArray));
+                TInt count( driveArray.Count ());
+                for (TInt i=0; i<count; ++i)
+                    {
+                    MPX_DEBUG2("At drive %i", driveArray[i]);
+                    if (( driveArray[i] != EDriveC) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i]))))
+                        {
+                        MPX_DEBUG2("Closing database %i", driveArray[i]);
+                        TRAP_IGNORE( iDbHandler->CloseDatabaseL( driveArray[i] ) );
+                        }
+                    }
+                }
+            else
+                {
+                iDbHandler->CloseDatabaseL(aArg);
+                }
+ #else
+            iDbHandler->CloseDatabaseL(aArg);
+ #endif // RD_MULTIPLE_DRIVE
+            iDbHandler->CollectionClosed();
+            break;
+            }
+        case EMcReOpenCollection:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcReOpenCollection");
+            // Open the specified database
+#ifdef RD_MULTIPLE_DRIVE
+            MPX_DEBUG1("Multiple drives opening databases");
+            DriveInfo::TDriveArray driveArray;
+            User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFs, driveArray ) );
+            TInt count( driveArray.Count() );
+            for( TInt i=0; i<count; ++i )
+                {
+                MPX_DEBUG2("At drive %i", driveArray[i]);
+                if( (driveArray[i] != EDriveC)  && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i]))))
+                    {
+                    TUint driveStatus(0);
+                    User::LeaveIfError( DriveInfo::GetDriveStatus(
+                        iFs, driveArray[i], driveStatus ) );
+                    if( driveStatus & DriveInfo::EDrivePresent )
+                        {
+                        MPX_DEBUG2("Opening database %i", driveArray[i]);
+                        TRAP_IGNORE( iDbHandler->OpenDatabaseL( driveArray[i] ) );
+                        }
+                    }
+                }
+#else
+            iDbHandler->OpenDatabaseL(aArg);
+#endif // RD_MULTIPLE_DRIVE
+            TRAP_IGNORE(iDbHandler->CollectionOpenedL());
+            break;
+            }
+        case EMcRefreshStarted:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcRefreshStarted");
+            iDbHandler->CheckDiskSpaceOnDrivesL();
+            // ask the handler to start a transaction
+            iDbHandler->RefreshStartL();
+            iRefreshing=ETrue;
+            break;
+            }
+        case EMcRefreshEnded:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcRefreshEnded");
+            iDbHandler->CheckDiskSpaceOnDrivesL();
+            // ask the handler to finalize the transaction
+            iDbHandler->RefreshEndL();
+            iRefreshing=EFalse;
+            break;
+            }
+         case EMcCmdReCreateDB:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcCmdReCreateDB");
+            // Recreate all databases
+            iDbHandler->ReCreateDatabasesL();
+            break;
+            }
+         case EMcCmdDbCorrupted:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcCmdDbCorrupted");
+            iDbHandler->SetDBCorruptedL(ETrue);
+            break;
+            }
+        case EMcCmdRefresh:
+        case EMcCmdCollectionInit:
+        case EMcCmdCollectionResyn:
+            {
+            // deprecated
+            break;
+            }
+        case EMcCmdMtpStart:
+            iDbHandler->CheckDiskSpaceOnDrivesL();
+            iMtpInUse = ETrue;
+            iDbHandler->MtpStartL();
+            break;
+        case EMcCmdMtpEnd:
+            iDbHandler->CheckDiskSpaceOnDrivesL();
+            iMtpInUse = EFalse;
+            iDbHandler->MtpEndL();
+            break;
+         default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Executes the given command on the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::CommandL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::CommandL");
+
+    if (!aCmd.IsSupported(KMPXCommandGeneralId))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TMPXCommandId commandId = aCmd.ValueTObjectL<TMPXCommandId>(KMPXCommandGeneralId);
+
+    TBool syncOp(EFalse);
+    if (aCmd.IsSupported(KMPXCommandGeneralDoSync))
+        {
+        syncOp = aCmd.ValueTObjectL<TBool>(KMPXCommandGeneralDoSync);
+        }
+
+    // Handle this operation synchronously or asynchronously
+    //
+    if (!syncOp)
+        {
+        iActiveTask->StartL(commandId, aCmd);
+        }
+    else  // Sync operation
+        {
+        switch (commandId)
+            {
+            case KMPXCommandIdCollectionRetrieveUriForDeletion:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionRetrieveUriForDeletion");
+                DoRetrieveUriForDeletionL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionRemove:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionRemove");
+                if ( !iDbHandler->InTransaction() )
+                    {
+                    iDbHandler->BeginTransactionL();
+                    }
+
+                if (iFirstDeleteStep )
+                    {
+                    iFirstDeleteStep = EFalse;
+                    }
+                DoRemovePathL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionRemoveMedia:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionRemoveMedia");
+                DoRemoveMediaL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionCleanupDeletedMedias:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionCleanupDeletedMedias");
+                CleanupDeletedRecordsL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionAdd:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectioAdd");
+                CMPXMedia* media = aCmd.Value<CMPXMedia>(KMPXCommandColAddMedia);
+                User::LeaveIfNull( media );
+                TUint32 id(DoAddL(*media));
+                aCmd.SetTObjectValueL<TMPXItemId>(KMPXCommandColAddRtnId, id);
+                break;
+                }
+            case KMPXCommandIdCollectionSet:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionSet");
+                CMPXMedia* media = aCmd.Value<CMPXMedia>(KMPXCommandColSetMedia);
+                User::LeaveIfNull( media );
+                DoSetL(*media);
+                break;
+                }
+            case KMPXCommandIdCollectionCompleteDelete:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionCompleteDelete");
+                DoHandleDeleteCompleteL(aCmd);
+                break;
+                }
+            case KMPXCommandIdReorderPlaylist:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdReorderPlaylist");
+                DoReorderPlaylistL(aCmd);
+                break;
+                }
+            case KMPXCommandIdUpdateRefreshTime:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdUpdateRefreshTime");
+                TTime curTime;
+                curTime.HomeTime();
+                iDbHandler->SetLastRefreshedTimeL(curTime);
+                break;
+                }
+            case KMPXCommandCollectionGetCount:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandCollectionGetCount");
+                DoGetCollectionCountL(aCmd);
+                break;
+                }
+            case KMPXCommandCollectionGetURIs:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandCollectionGetURIs");
+                DoGetCollectionUriL(aCmd);
+                break;
+                }
+            default:
+                {
+                User::Leave(KErrNotSupported);
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Adds an item (song or playlist) to the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::AddL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlugin::AddL");
+    DoAddL(aMedia);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given path
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::RemoveL(
+    const CMPXCollectionPath& aPath)
+    {
+    MPX_FUNC("CMPXDbPlugin::RemoveL(by path)");
+    MPX_DEBUG_PATH(aPath);
+
+    CMPXMessageArray* msgAry = CMPXMessageArray::NewL();
+    CleanupStack::PushL(msgAry);
+
+    // Return file path for deleted item(s)
+    CDesCArray* fp = DoRemoveL(aPath, *msgAry);
+
+    iObs->HandleRemove(*fp, KErrNone);
+    delete fp;
+
+    // Send Change Messages
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+    DoHandleChangeL(msgAry);
+    CleanupStack::PopAndDestroy(msgAry);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given media properties
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::RemoveL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlugin::RemoveL(by media)");
+    DoRemoveL(aMedia, EFalse);
+    }
+
+// ----------------------------------------------------------------------------
+// Sets/updates the media for an item in the collection
+// DEPRECATED for week 18
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::SetL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlugin::SetL");
+    DoSetL(aMedia);
+    }
+
+// ----------------------------------------------------------------------------
+// Find the items matching the media specifications
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::FindAllL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbPlugin::FindAllL");
+
+    CMPXMedia* entries = FindAllSyncL(aCriteria, aAttrs);
+
+    // notify client. if FindAllL leaves, framework will notify client of the error
+    iObs->HandleFindAll(entries, KErrNone);
+    delete entries;
+    }
+
+// ----------------------------------------------------------------------------
+// Find the items matching the media specifications
+// ----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXDbPlugin::FindAllSyncL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbPlugin::FindAllSyncL");
+
+    CMPXMedia* entries = iDbHandler->FindAllLC(aCriteria, aAttrs);
+
+    if (entries)
+        {
+        CMPXMediaArray* ary = entries->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull( ary );
+        DoSetDrmForArrayL( *ary, aAttrs );
+        }
+
+    CleanupStack::Pop(entries);
+    return entries;
+    }
+
+// ----------------------------------------------------------------------------
+// Get the list of supported capabilities
+// ----------------------------------------------------------------------------
+//
+TCollectionCapability CMPXDbPlugin::GetCapabilities()
+    {
+    // This one supports simple search
+    return EMcSearch;
+    }
+
+// ----------------------------------------------------------------------------
+// Get the list of supported capabilities
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::HandleStepL()
+    {
+    MPX_FUNC("CMPXDbPlugin::HandleStepL");
+
+    TBool done(ETrue);
+
+    switch (iActiveTask->GetTask())
+        {
+        case KMPXCommandIdCollectionSet:
+            {
+            done = DoSetAsyncL();
+            break;
+            }
+        case KMPXCommandIdCollectionAdd:
+            {
+            done = DoAddAsyncL();
+            break;
+            }
+        case KMPXCommandIdCollectionRemove:
+            {
+            DoRemovePathL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionRemoveMedia:
+            {
+            DoRemoveMediaL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionRetrieveUriForDeletion:
+            {
+            DoRetrieveUriForDeletionL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionCleanupDeletedMedias:
+            {
+            CleanupDeletedRecordsL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionCompleteDelete:
+            {
+            DoHandleDeleteCompleteL( iActiveTask->GetCommand() );
+            break;
+            }
+        case KMPXCommandIdUpdateRefreshTime:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdUpdateRefreshTime");
+            TTime curTime;
+            curTime.HomeTime();
+            iDbHandler->SetLastRefreshedTimeL(curTime);
+            break;
+            }
+        case KMPXCommandIdIncrementalOpenL:
+            {
+            DoIncrementalOpenL( iActiveTask->GetCommand() );
+            done = ETrue;
+            break;
+            }
+        default:
+            {
+            // Should never happen!
+            ASSERT(0);
+            break;
+            }
+        }
+    return done;
+    }
+
+// ----------------------------------------------------------------------------
+// Handler for async operations completed
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::HandleOperationCompleted(
+    TInt aErr)
+    {
+    MPX_FUNC("CMPXDbPlugin::HandleOperationCompleted");
+    TRAP_IGNORE(DoHandleOperationCompletedL(aErr));
+    }
+
+// ----------------------------------------------------------------------------
+// Process the OpenL command
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXFilter* aFilter )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenL");
+
+    TInt err( KErrNone );
+    CMPXMediaArray* array = CMPXMediaArray::NewL();
+    CleanupStack::PushL(array);
+
+    TInt count(0);
+    TInt levels(aPath.Levels());
+    TBool isASong(EFalse);
+
+    aEntries.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aPath.Id(levels - 1));
+
+    if (1 == levels)
+        {
+        // return the "main menu"
+        count = iMusicLibraryMenuTitles->Count();
+        RArray<TMPXItemId> ids;
+        CleanupClosePushL(ids);
+
+        // due to ui changes, the order of main menu is changed
+        // since multiple clients hardcode indexes to each entry,
+        // the enum cannot be changed, instead we will have to
+        // manually change the display order to minimize the impact to
+        // external clients
+
+        // change from:
+        // all songs, playlist, artist, album, (podcast), genre, composer
+        // to:
+        // artist, album, playlist, all songs, (podcast), genre, composer
+        for (TInt i = EBrowseArtist; i <= EBrowseAlbum; ++i)
+            {
+            MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(i), EMPXGroup,
+                CategoryForBrowseType(static_cast<TMCBrowseType>(i)), iMusicLibraryMenuIds[i]);
+            ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[i]));
+            }
+        MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(1), EMPXGroup,
+            CategoryForBrowseType(static_cast<TMCBrowseType>(1)), iMusicLibraryMenuIds[1]);
+        ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[1]));
+        MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(0), EMPXGroup,
+            CategoryForBrowseType(static_cast<TMCBrowseType>(0)), iMusicLibraryMenuIds[0]);
+        ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[0]));
+
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        if( !iDisablePodcasting )
+            {
+            MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(EBrowsePodcasts), EMPXGroup,
+                CategoryForBrowseType(static_cast<TMCBrowseType>(EBrowsePodcasts)), iMusicLibraryMenuIds[EBrowsePodcasts]);
+            ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[EBrowsePodcasts]));
+            }
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+
+        // Genre and composer
+        for (TInt i = ( EBrowseGenre ); i < count; ++i)
+            {
+            MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(i), EMPXGroup,
+                CategoryForBrowseType(static_cast<TMCBrowseType>(i)), iMusicLibraryMenuIds[i]);
+            ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[i]));
+            }
+
+        TInt pPath = aEntries.ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+        MPX_ASSERT(pPath);
+        ((CMPXCollectionPath*)pPath)->AppendL(ids.Array());
+        CleanupStack::PopAndDestroy(&ids);
+        SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXCollection, *iMusicMenuTitle);
+        aEntries.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+            KMPXMediaGeneralNonPermissibleActions, EMPXWrite);
+        }
+    else if (levels >= 2)
+        {
+        // Create a media which hold the pointer to the returned path
+        if (aEntries.IsSupported(KMPXMediaGeneralValue))
+            {
+            CMPXMedia* pMedia = CMPXMedia::NewL();
+            CleanupStack::PushL(pMedia);
+            pMedia->SetTObjectValueL<TInt>(KMPXMediaGeneralValue,
+                                          aEntries.ValueTObjectL<TInt>(KMPXMediaGeneralValue));
+            array->AppendL(*pMedia);
+            CleanupStack::PopAndDestroy(pMedia);
+            MPX_ASSERT(array->Count()==1);
+            }
+
+        // check the browse type
+        switch (aPath.Id(1).iId2)
+            {
+            case EBrowseAll:
+                {
+                TBool doIncremental(ETrue);
+                if( aFilter && aFilter->IsSupported( KMPXCollectionOpenLSupportsIncremental ) )
+                    {
+                    doIncremental =
+                         aFilter->ValueTObjectL<TBool>(KMPXCollectionOpenLSupportsIncremental);
+                    }
+
+                if( doIncremental )
+                    {
+                    TRAP( err, isASong = DoOpenIncrementalL( aPath, aAttrs, aEntries, array ) );
+                    }
+                else
+                    {
+                    TRAP( err, isASong = DoOpenBrowseAllL(aPath, aAttrs, aEntries, array) );
+                    }
+                break;
+                }
+
+            case EBrowseArtist:
+                {
+                if( iAllSongsValid )
+                    {
+                    isASong = DoOpenBrowseArtistL( aPath, aAttrs, aEntries, array );
+                    }
+                break;
+                }
+
+            case EBrowseAlbum:
+                {
+                if( iAllSongsValid )
+                    {
+                    isASong = DoOpenBrowseAlbumL( aPath, aAttrs, aEntries, array );
+                    }
+                break;
+                }
+
+            case EBrowsePlaylist:
+                {
+                if( iAllSongsValid )
+                    {
+                    isASong = DoOpenBrowsePlaylistL(aPath, aAttrs, aEntries, array);
+                    }
+
+                break;
+                }
+
+            case EBrowseGenre:
+                {
+                if( iAllSongsValid )
+                    {
+                    isASong = DoOpenBrowseGenreL( aPath, aAttrs, aEntries, array );
+                    }
+                break;
+                }
+
+            case EBrowseComposer:
+                {
+                if( iAllSongsValid )
+                    {
+                    isASong = DoOpenBrowseComposerL( aPath, aAttrs, aEntries, array );
+                    }
+                break;
+                }
+
+            default:
+                {
+                User::Leave(KErrArgument);
+                }
+            }
+        //Remove the first media
+        if ( array->Count() &&
+            (*array)[0]->IsSupported(KMPXMediaGeneralValue))
+            {
+            array->Remove(0);
+            }
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+    aEntries.SetCObjectValueL(KMPXMediaArrayContents, array);
+    aEntries.SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+
+    CleanupStack::PopAndDestroy(array);
+
+    if( err == KSQLErrGeneral )
+        {
+        iAllSongsValid = EFalse;
+        User::Leave( KErrDiskFull );
+        }
+    else if( err != KErrNone )
+        {
+        User::Leave( err );
+        }
+    return isASong;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlugin::DoOpenIncrementalL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenIncrementalL( const CMPXCollectionPath& aPath,  const TArray<TMPXAttribute>& aAttrs,
+                                       CMPXMedia& aEntries, CMPXMediaArray* aArray)
+    {
+    TBool isASong(EFalse);
+
+    TInt levels(aPath.Levels());
+
+    if( levels == 2 )
+        {
+        // Remove the pPath dummy from the array
+        TInt pPath = aEntries.ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+        aArray->Remove(0);
+        CMPXCollectionPath* p = (CMPXCollectionPath*) pPath;
+
+        RArray<TMPXItemId> ids;
+        CleanupClosePushL( ids );
+
+        iDbHandler->GetAllSongsLimitedL( aAttrs, *aArray, KFirstFetchCount );
+        if ( aArray->Count() > 1 )
+            {
+            // Add "Shuffle" item
+            MPXDbCommonUtil::PrependMediaL(*aArray, *iShuffleAllText,
+                    EMPXItem, EMPXCommand, 0, 0, 0, 0);            
+            //MPXDbCommonUtil::AppendMediaL(*aArray, *iShuffleAllText, EMPXItem, EMPXCommand,
+            //    0, 0, 0);
+            aArray->AtL(0)->SetTObjectValueL(KMPXMediaColDetailNumberOfItems,
+                iDbHandler->NumberOfItemsL(EMPXSong));           
+            }
+        TInt c( aArray->Count() );
+        for( TInt i=0; i<c; ++i )
+            {
+            TMPXItemId id = aArray->AtL(i)->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+            ids.Append( id );
+            }
+
+        // Rest are all blank items
+        CMPXMedia* entry = CMPXMedia::NewL();
+        CleanupStack::PushL(entry);
+        entry->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+        entry->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXSong);
+        entry->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, KMPXInvalidItemId );
+
+        TInt count = iDbHandler->NumberOfItemsL(EMPXSong);
+        count-=c;
+        for( TInt i=0; i<count; ++i )
+            {
+            aArray->AppendL( *entry );
+            ids.Append( KMPXInvalidItemId );
+            }
+        CleanupStack::PopAndDestroy( entry );
+
+        // Set the "Supportes incremental Command" flag
+        //
+        aEntries.SetTObjectValueL( KMPXCollectionOpenLSupportsIncremental, ETrue );
+
+        TMPXOpenDataBlock block;
+        block.iOffset=KErrNotFound;
+        block.iSize=count;
+        aEntries.SetTObjectValueL<TMPXOpenDataBlock>( KMPXCollectionOpenLResultRange, block );
+
+        SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXSong,
+                iMusicLibraryTitles->MdcaPoint(EBrowseAll));
+
+        p->AppendL(ids.Array());
+        CleanupStack::PopAndDestroy( &ids );
+        }
+    else if( levels == 3 )
+        {
+        iDbHandler->GetSongL(aPath.Id(levels - 1).iId2, aAttrs, *aArray);
+        isASong = ETrue;
+        }
+
+
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseAll
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowseAllL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowseAllL");
+
+    TInt levels(aPath.Levels());
+    switch (levels)
+       {
+       // All songs
+       case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseAllL_All);
+
+            iDbHandler->GetAllSongsL(aArray, aAttrs);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXSong,
+                iMusicLibraryTitles->MdcaPoint(EBrowseAll));
+
+            // Add "Shuffle" item
+            if (aArray->Count() > 2)
+                {
+                MPXDbCommonUtil::PrependMediaL(*aArray, *iShuffleAllText,
+                        EMPXItem, EMPXCommand, 0, 0, 0, 1);
+                aArray->AtL(1)->SetTObjectValueL(KMPXMediaColDetailNumberOfItems,
+                    iDbHandler->NumberOfItemsL(EMPXSong));
+
+                }
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAllL_All);
+            break;
+            }
+
+         // A Song in all songs
+         case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseAllL_Song);
+
+            iDbHandler->GetSongL(aPath.Id(levels - 1).iId2, aAttrs, *aArray);
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAllL_Song);
+            break;
+            }
+
+         default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseAllL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        } // end switch(levels)
+
+    return (levels == 3);
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseArtist
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowseArtistL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowseArtistL");
+
+    TBool isASong(EFalse);
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (levels)
+        {
+        // All artists
+        case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseArtistL_All);
+
+            iDbHandler->GetAllArtistsL(aAttrs, aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXArtist,
+                iMusicLibraryTitles->MdcaPoint(EBrowseArtist));
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseArtistL_All);
+            break;
+            }
+
+        // All albums of an artist
+        case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseArtistL_AllAlbums);
+            // get the albums
+            TInt id(aPath.Id(idIndex).iId2);
+            MPX_ASSERT(aArray->Count());
+            MPX_ASSERT((*aArray)[0]->IsSupported(KMPXMediaGeneralValue));
+            TInt pPath = (*aArray)[0]->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+            MPX_ASSERT(pPath);
+            iDbHandler->GetAlbumsMatchingArtistL(id, aAttrs, *aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXArtist, id);
+
+            TInt count = aArray->Count();
+            if ( count > 2 )
+                {
+                // Only show "all" item if there is more than 1 album
+                // count for "all" item
+                TInt total = 0;
+                for ( TInt i = 1; i < count; i++ )
+                {
+                TInt temp = (*aArray)[i]->ValueTObjectL<TInt>(KMPXMediaGeneralCount);
+                total += temp;
+                }
+            // Add "all" item under an artist
+            MPXDbCommonUtil::PrependMediaL(*aArray, *iAllSongsForArtistTitle, EMPXItem, EMPXAlbum,
+                aPath.Id(idIndex), 0, 0, 1);
+
+                (*aArray)[1]->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, total);
+
+            TMPXItemId allId = ((*aArray)[1]->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+            if (aArray->Count() > 2)
+                { // path media, all id  and at least one media
+                ((CMPXCollectionPath*)pPath)->InsertL(allId, 0);
+                }
+            else
+                { // only has all item
+                ((CMPXCollectionPath*)pPath)->AppendL(allId);
+                    }
+                }
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseArtistL_AllAlbums);
+            break;
+            }
+
+        // All songs of an album for an artist or all songs for an artist
+        case 4:
+            {
+            // all songs for an artist
+            if (aPath.Id(3) == aPath.Id(2))
+                {
+                MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseArtistL_AllSongs);
+
+                TInt id(aPath.Id(idIndex - 1).iId2);
+                iDbHandler->GetSongsMatchingArtistL(id, aAttrs, aArray);
+                SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXSong, id);
+
+                MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseArtistL_AllSongs);
+                }
+            // all songs of an album for an artist
+            else
+                {
+                MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseArtistL_AllSongsForAlbum);
+                TUint32 artistId(aPath.Id(idIndex - 1).iId2);
+
+                if (selections.Count())
+                    {
+                    // Multiple albums
+                    const TInt count(aPath.Selection().Count());
+                    for (TInt i = 0; i < count; ++i)
+                        {
+                        iDbHandler->GetSongsMatchingArtistAndAlbumL(artistId, selections[i].iId2,
+                            aAttrs, aArray);
+                        }
+                    }
+                else
+                    {
+                    // One album
+                    iDbHandler->GetSongsMatchingArtistAndAlbumL(artistId, aPath.Id(idIndex).iId2,
+                        aAttrs, aArray);
+                    }
+
+                SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXAlbum, aPath.Id(idIndex).iId2);
+                MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseArtistL_AllSongsForAlbum);
+                }
+
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseArtistL: retrieved %d items", aArray->Count());
+
+            break;
+            }
+
+        // A Song in an album
+        case 5:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseArtistL_Song);
+
+            iDbHandler->GetSongL(aPath.Id(idIndex).iId2, aAttrs, *aArray);
+            isASong = ETrue;
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseArtistL_Song);
+            break;
+            }
+
+        default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseArtistL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        } // end switch(level)
+
+    CleanupStack::PopAndDestroy(&selections);
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseAlbum
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowseAlbumL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowseAlbumL");
+
+    TBool isASong(EFalse);
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (levels)
+        {
+        // All Albums
+        case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseAlbumL_All);
+
+            iDbHandler->GetAllAlbumsL(aAttrs, aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXAlbum,
+                iMusicLibraryTitles->MdcaPoint(EBrowseAlbum));
+
+             // Add "Shuffle" item
+            if (aArray->Count() > 2)
+                {
+                MPXDbCommonUtil::PrependMediaL(*aArray, *iShuffleAllText,
+                        EMPXItem, EMPXCommand, 0, 0, 0, 1);
+                aArray->AtL(1)->SetTObjectValueL(KMPXMediaColDetailNumberOfItems,
+                    iDbHandler->NumberOfItemsL(EMPXSong));
+
+				TInt pPath(0);
+                CMPXMedia* pMedia = aArray->AtL(0);
+				if (pMedia->IsSupported(KMPXMediaGeneralValue))
+					{
+					pPath = pMedia->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+					MPX_ASSERT(pPath);
+					}
+				//Update path to include the additional id.
+				((CMPXCollectionPath*)pPath)->InsertL(0,0);
+                }
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAlbumL_All);
+            break;
+            }
+
+        // All songs in one or multiple albums
+        case 3:
+            {
+            iDbHandler->GetAllAlbumsL(aAttrs, aArray);
+			CMPXMedia* album = aArray->AtL(aPath.Index());
+			TMPXItemId albumId = aPath.Id(); // id of selected album
+
+			CMPXMediaArray* songs = CMPXMediaArray::NewL();
+			CleanupStack::PushL(songs);
+			// get all the songs for the selected album
+			iDbHandler->GetSongsMatchingAlbumL(albumId, aAttrs, songs);
+			album->SetCObjectValueL(KMPXMediaArrayContents, songs);
+			album->SetTObjectValueL<TInt>(KMPXMediaArrayCount, songs->Count());
+			CleanupStack::PopAndDestroy(songs);
+
+            //iDbHandler->GetAllAlbumsL(aAttrs, aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXAlbum,
+                    iMusicLibraryTitles->MdcaPoint(EBrowseAlbumSong));
+            break;
+            }
+
+        // A song in an album
+        case 4:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseAlbumL_Song);
+
+            iDbHandler->GetSongL(aPath.Id(idIndex).iId2, aAttrs, *aArray);
+            isASong = ETrue;
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAlbumL_Song);
+            break;
+            }
+
+        default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseAlbumL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&selections);
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowsePlaylist
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowsePlaylistL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowsePlaylistL");
+
+    TBool isASong(EFalse);
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (levels)
+         {
+         case 2:
+            {
+            // All playlists
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowsePlaylistL_All);
+
+            iDbHandler->GetAllPlaylistsL(aArray, aAttrs);
+            iDbHandler->GetAllSystemPlaylistNamesL(aArray);
+
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXPlaylist,
+                iMusicLibraryTitles->MdcaPoint(EBrowsePlaylist));
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowsePlaylistL_All);
+            break;
+            }
+
+         // All songs in a playlist
+         case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowsePlaylistL_AllSongs);
+
+            if (selections.Count())
+                {
+                const TInt count(aPath.Selection().Count());
+                for (TInt i = 0; i < count; ++i)
+                    {
+                    iDbHandler->GetSongsMatchingPlaylistL(selections[i].iId2, aAttrs, aArray);
+                    }
+                }
+            else
+                {
+                iDbHandler->GetSongsMatchingPlaylistL(aPath.Id (idIndex).iId2, aAttrs, aArray);
+                }
+
+            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXPlaylist, aPath.Id(idIndex).iId2);
+
+            // populate EMPXMediaGeneralNonPermissibleActions
+            if (iDbHandler->IsAutoPlaylistL(aPath.Id(idIndex).iId2))
+                {
+                // set non-permissible actions to not writable and cacheable
+                aEntries.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+                    KMPXMediaGeneralNonPermissibleActions, (TMPXGeneralNonPermissibleActions)(EMPXWrite | EMPXCache));
+                }
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowsePlaylistL_AllSongs);
+            break;
+            }
+
+         // Specific song in a playlist
+         case 4:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowsePlaylistL_Song);
+
+            iDbHandler->GetPlaylistSongL(aPath.Id(idIndex).iId2, aPath.Id(idIndex - 1).iId2,
+                aAttrs, *aArray);
+            isASong = ETrue;
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowsePlaylistL_Song);
+            break;
+            }
+
+         default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowsePlaylistL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+       }
+
+    CleanupStack::PopAndDestroy(&selections);
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseGenre
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowseGenreL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowseGenreL");
+
+    TBool isASong(EFalse);
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (levels)
+        {
+        // All genres
+         case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseGenreL_All);
+
+            iDbHandler->GetAllGenresL(aAttrs, aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXGenre,
+                iMusicLibraryTitles->MdcaPoint(EBrowseGenre));
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseGenreL_All);
+            break;
+            }
+
+        // All songs of a genre
+        case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseGenreL_AllSongs);
+
+            if (selections.Count())
+                {
+                const TInt count(aPath.Selection().Count());
+                for (TInt i = 0; i < count; ++i)
+                    {
+                    iDbHandler->GetSongsMatchingGenreL(selections[i].iId2, aAttrs, aArray);
+                    }
+                }
+            else
+                {
+                iDbHandler->GetSongsMatchingGenreL(aPath.Id(idIndex).iId2, aAttrs, aArray);
+                }
+            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXGenre, aPath.Id(idIndex).iId2);
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseGenreL_AllSongs);
+            break;
+            }
+
+        // Specific song in a genre
+        case 4:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseGenreL_Song);
+
+            iDbHandler->GetSongL(aPath.Id(idIndex).iId2, aAttrs, *aArray);
+            isASong = ETrue;
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseGenreL_Song);
+            break;
+            }
+
+        default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseGenreL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&selections);
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseComposer
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowseComposerL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowseComposerL");
+
+    TBool isASong(EFalse);
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (levels)
+        {
+        // All composers
+        case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseComposerL_All);
+
+            iDbHandler->GetAllComposersL(aAttrs, aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXComposer,
+                iMusicLibraryTitles->MdcaPoint(EBrowseComposer));
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseComposerL_All);
+            break;
+            }
+
+        // All songs of a composer
+        case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseComposerL_AllSongs);
+            if (selections.Count())
+                {
+                const TInt count(aPath.Selection().Count());
+                for (TInt i = 0; i < count; ++i)
+                    {
+                    iDbHandler->GetSongsMatchingComposerL(selections[i].iId2, aAttrs, aArray);
+                    }
+                }
+            else
+                {
+                iDbHandler->GetSongsMatchingComposerL(aPath.Id(idIndex).iId2, aAttrs, aArray);
+                }
+            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXComposer, aPath.Id(idIndex).iId2);
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseComposerL_AllSongs);
+            break;
+            }
+
+        // Specific song of a composer
+        case 4:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseComposerL_Song);
+
+            iDbHandler->GetSongL(aPath.Id(idIndex).iId2, aAttrs, *aArray);
+            isASong = ETrue;
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseComposerL_Song);
+            break;
+            }
+
+        default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseComposerL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&selections);
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Process the OpenL method with open mode EMPXOpenPlaylistOnly
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionPath* CMPXDbPlugin::DoOpenPlaylistL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenPlaylistL");
+
+    RArray<TMPXItemId> ids;
+    CleanupClosePushL(ids);
+
+    CMPXMedia* entries = CMPXMedia::NewL();
+    CleanupStack::PushL(entries);
+
+    CMPXCollectionPath* path = CMPXCollectionPath::NewL(aPath);
+    CleanupStack::PushL(path);
+
+    // Go through the browse path
+    TInt levels(aPath.Levels());
+    if (levels == 2)
+        {
+        // Create a new collection path
+        CleanupStack::PopAndDestroy( path );
+        path = CMPXCollectionPath::NewL();
+        CleanupStack::PushL( path );
+
+        // Always return all songs here
+        ids.Reset();
+        ids.AppendL( KDBPluginUid );
+        path->AppendL(ids.Array());
+        path->SelectL((TMPXItemId) KDBPluginUid);
+
+        ids.Reset();
+        ids.AppendL(EBrowseAll);
+        path->AppendL(ids.Array());
+        path->SelectL((TMPXItemId) EBrowseAll);
+        path->Set(EMPXOpenPlaylistOnly);
+
+        // Get all item IDs
+        CMPXMediaArray* array = CMPXMediaArray::NewL();
+        CleanupStack::PushL(array);
+
+        DoOpenBrowseAllL(*path, aAttrs, *entries, array);
+
+        entries->SetCObjectValueL(KMPXMediaArrayContents, array);
+        entries->SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+
+        CleanupStack::PopAndDestroy(array);
+
+        DoAppendLevelL(*path, *entries);
+        }
+    else if (levels > 2)
+        {
+        switch (aPath.Id(1).iId2)
+            {
+            case EBrowseAll:
+                {
+                path->Set(EMPXOpenPlaylistOnly);
+                // Returns the same path that we copied
+                break;
+                }
+            case EBrowseArtist:
+                {
+                if (levels == 3)
+                    {
+                    // return all songs of a particular artist (currently highlighted)
+                    path->Set(EMPXOpenGroupOrPlaylist);
+                    ids.Reset();
+                    ids.Append(aPath.Id(2));
+                    path->AppendL(ids.Array());
+                    path->SelectL(aPath.Id(2));
+                    path->Set(EMPXOpenPlaylistOnly);
+
+                    // Opens all songs of an artist and create the corresponding
+                    // Collection playlist by appending all songs of an artist to
+                    // the collection path
+                    //
+                    DoOpenL(*path, aAttrs, *entries, NULL);
+                    DoAppendLevelL(*path, *entries);
+                    }
+                else if (levels == 4)
+                    {
+                    // Open the album of an artist and create the corresponding
+                    // Collection playlist by appending all songs of an artist to
+                    // the collection path
+                    //
+                    path->Set(EMPXOpenPlaylistOnly);
+                    DoOpenL(*path, aAttrs, *entries, NULL);
+                    DoAppendLevelL(*path, *entries);
+                    }
+                else
+                    {
+                    // case is a song no need to open again!
+                    }
+
+                break;
+                }
+            // Playlist, album, genre and composer easier, only 2 levels deep
+            // plugin | category | category contents | songs of category
+            //
+            case EBrowsePlaylist:
+            case EBrowseAlbum:
+            case EBrowseGenre:
+            case EBrowseComposer:
+                {
+                if (!DoOpenL(aPath, aAttrs, *entries, NULL))
+                    {
+                    // If it is not at a song level
+                    // Append all entries to create collection path
+                    //
+                    path->Set(EMPXOpenPlaylistOnly);
+                    DoAppendLevelL( *path, *entries );
+                    }
+                break;
+                }
+            default:
+                {
+                User::Leave(KErrNotSupported);
+                }
+            }
+        }
+    else  // levels < 2
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    // Cleanup
+    CleanupStack::Pop(path);
+    CleanupStack::PopAndDestroy(entries);
+    CleanupStack::PopAndDestroy(&ids);
+
+    return path;
+    }
+
+// ----------------------------------------------------------------------------
+// Process the MediaL command
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoMediaL");
+
+    // Fetch Media for root level
+    //
+    if (aPath.Levels() == 1) //root
+        {
+        DoRootMediaL( aAttrs, aEntries );
+        }
+    // Ensure the database has been merged before attempting MediaL()
+    //
+    else
+        {
+        CMPXMediaArray* array = CMPXMediaArray::NewL();
+        CleanupStack::PushL(array);
+
+        switch (aPath.Id(1).iId2)
+            {
+            case EBrowseAll:
+                {
+                DoAllSongsMediaL(aPath, aAttrs, aEntries, *array);
+                break;
+                } // end case EBrowseAll
+
+            case EBrowseArtist:
+                {
+                DoArtistMediaL(aPath, aAttrs, aEntries, *array);
+                break;
+                } // end case EBrowseArtist
+
+            case EBrowseAlbum:
+                {
+                DoCategoryMediaL(aPath, aAttrs, EMPXAlbum, aEntries, *array);
+                break;
+                } // end case EBrowseAlbum
+
+            case EBrowsePlaylist:
+                {
+                DoCategoryMediaL(aPath, aAttrs, EMPXPlaylist, aEntries, *array);
+                break;
+                } // end case EBrowsePlaylist
+
+            case EBrowseGenre:
+                {
+                DoCategoryMediaL(aPath, aAttrs, EMPXGenre, aEntries, *array);
+                break;
+                } // end case EBrowseGenre
+
+            case EBrowseComposer:
+                {
+                DoCategoryMediaL(aPath, aAttrs, EMPXComposer, aEntries, *array);
+                break;
+                } // end case EBrowseComposer
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+            case EBrowsePodcasts:
+                {
+                break;
+                }
+#endif
+            default:
+                {
+                User::Leave(KErrArgument);
+                }
+            } // end switch(aPath.id(1)
+
+        if (array->Count() > 0)
+            {
+            aEntries.SetCObjectValueL(KMPXMediaArrayContents, array);
+            aEntries.SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+            }
+        CleanupStack::PopAndDestroy(array);
+        }
+    // Else case cannot leave, because this will happen when we have no disk space to
+    // perform the merging. It should NOT leave.
+    //
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for root level
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRootMediaL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRootMediaL");
+
+    TInt count(aAttrs.Count());
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU
+    aMedia.SetTObjectValueL<TMPXGeneralNonPermissibleActions> (
+            KMPXMediaGeneralNonPermissibleActions, (TMPXGeneralNonPermissibleActions)(EMPXWrite | EMPXCache) );
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdGeneral)
+            {
+            TUint att(aAttrs[i].AttributeId());
+            if (att & EMPXMediaGeneralTitle)
+                {
+                HBufC* title(iResource->ReadHBufCL(R_MPX_QTN_MUS_MUSIC));
+                CleanupStack::PushL(title);
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle, *title);
+                CleanupStack::PopAndDestroy(title);
+                }
+            if (att & EMPXMediaGeneralSubTitle)
+                {
+                TInt numSongs(iDbHandler->NumberOfItemsL(EMPXSong));
+                aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, numSongs);
+
+                HBufC* text(iResource->ReadHBufCL((1 == numSongs) ?
+                    R_MPX_QTN_MUS_MUSIC_ONE_SONG : R_MPX_QTN_MUS_MUSIC_NUM_SONGS));
+
+                CleanupStack::PushL(text);
+                aMedia.SetTextValueL(KMPXMediaGeneralSubTitle, *text);
+                CleanupStack::PopAndDestroy(text);
+                }
+            if (att & EMPXMediaGeneralIcon)
+                {
+                TIconInfo icon;
+                icon.bmpfile = KMPlayerDbPluginMbmFile;
+                icon.bitmapId = EMbmMpxdbhgpluginQgn_graf_mup_dlst_music;
+                icon.maskId = EMbmMpxdbhgpluginQgn_graf_mup_dlst_music_mask;
+                aMedia.SetTObjectValueL<TIconInfo>(KMPXMediaGeneralIcon, icon);
+                }
+            } // if
+        } // for
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for all songs category
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoAllSongsMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAllSongsMediaL");
+
+    TInt levels(aPath.Levels());
+
+    switch (levels)
+       {
+       // All songs
+       case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoAllSongsMediaL_All);
+            DoRootCategoryMediaL(aAttrs, EBrowseAll, EMPXSong, aEntries);
+            MPX_PERF_END(CMPXDbPlugin_DoAllSongsMediaL_All);
+            break;
+            }
+
+         // A Song in all songs
+         case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoAllSongsMediaL_Song);
+            GetSongInfoL(aPath, aAttrs, aEntries, aMediaArray);
+            MPX_PERF_END(CMPXDbPlugin_DoAllSongsMediaL_Song);
+            break;
+            }
+
+         default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoAllSongsMediaL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        } // end switch(levels)
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for artists category
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoArtistMediaL (
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoArtistMediaL");
+
+    TInt levels(aPath.Levels());
+    TInt count(aPath.Selection().Count());
+
+     // All artists
+    if (levels == 2)
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoArtistMediaL_All);
+        DoRootCategoryMediaL(aAttrs, EBrowseArtist, EMPXArtist, aEntries);
+        MPX_PERF_END(CMPXDbPlugin_DoArtistMediaL_All);
+        }
+    else if ((levels == 3) && count) // multiple artists selected
+        {
+        RArray<TMPXItemId> selections;
+        CleanupClosePushL(selections);
+        aPath.SelectionL(selections);
+
+        for (TInt i = 0; i < count; ++i)
+            {
+            CMPXMedia* artist = CMPXMedia::NewL();
+            CleanupStack::PushL(artist);
+            iDbHandler->GetCategoryL(selections[i].iId2, EMPXArtist, aAttrs, artist);
+            aMediaArray.AppendL(*artist);
+            CleanupStack::PopAndDestroy(artist);
+            }
+
+        CleanupStack::PopAndDestroy(&selections);
+        }
+    else if (levels == 3) // single artist selected
+        {
+        iDbHandler->GetCategoryL(aPath.Id(2).iId2, EMPXArtist, aAttrs, &aEntries);
+        }
+    else if (levels == 4 && (aPath.Id(3) == aPath.Id(2))) // all songs for an artist
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoArtistMediaL_AllSongs);
+        // Calculate duration directly with SQL
+        if (MPXDbCommonUtil::AttributeExists(aAttrs, KMPXMediaGeneralDuration))
+            {
+            DoDurationL(aEntries, EMPXArtist, aPath.Id(2));
+            }
+
+        MPX_PERF_END(CMPXDbPlugin_DoArtistMediaL_AllSongs);
+        }
+    else if ((levels == 4) && count) // multiple albums of an artist
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoArtistMediaL_AllAlbums);
+
+        RArray<TMPXItemId> selections;
+        CleanupClosePushL(selections);
+        aPath.SelectionL(selections);
+
+        for (TInt i = 0; i < count; ++i)
+            {
+            CMPXMedia* media = CMPXMedia::NewL();
+            CleanupStack::PushL(media);
+            iDbHandler->GetCategoryL(selections[i].iId2, EMPXAlbum, aAttrs, media);
+            aMediaArray.AppendL(*media);
+            CleanupStack::PopAndDestroy(media);
+            }
+
+        CleanupStack::PopAndDestroy(&selections);
+
+        MPX_PERF_END(CMPXDbPlugin_DoArtistMediaL_AllAlbums);
+        }
+    else if (levels == 4) // one album of an artist
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoArtistMediaL_OneAlbum);
+        iDbHandler->GetCategoryL(aPath.Id(3).iId2, EMPXAlbum, aAttrs, &aEntries);
+
+        // Calculate duration
+        if (MPXDbCommonUtil::AttributeExists(aAttrs, KMPXMediaGeneralDuration))
+            {
+            DoDurationL(aEntries, EMPXArtist, aPath.Id(2), EMPXAlbum, aPath.Id(3));
+            }
+
+        MPX_PERF_END(CMPXDbPlugin_DoArtistMediaL_OneAlbum);
+        }
+     else if (levels == 5) // a song/songs in an album
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoArtistMediaL_Song);
+        GetSongInfoL(aPath, aAttrs, aEntries, aMediaArray);
+        MPX_PERF_END(CMPXDbPlugin_DoArtistMediaL_Song);
+        }
+    else
+        {
+        MPX_DEBUG2("CMPXDbPlugin_DoArtistMediaL: Invalid levels[%d]", levels);
+        User::Leave(KErrNotSupported);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for all songs category
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRootCategoryMediaL (
+    const TArray<TMPXAttribute>& aAttrs,
+    TMPXItemId aRootCategoryId,
+    TMPXGeneralCategory aCategory,
+    CMPXMedia& aEntries)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRootCategoryMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdGeneral)
+            {
+            TUint att(aAttrs[i].AttributeId());
+            switch (att)
+                {
+                case EMPXMediaGeneralId:
+                    {
+                    aEntries.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aRootCategoryId);
+                    break;
+                    }
+                case EMPXMediaGeneralTitle:
+                    {
+                    aEntries.SetTextValueL(KMPXMediaGeneralTitle,
+                        iMusicLibraryMenuTitles->MdcaPoint(BrowseTypeForCategory(aCategory)));
+                    break;
+                    }
+                case EMPXMediaGeneralCount:
+                    {
+                    // count number of category
+                    aEntries.SetTObjectValueL<TInt>(KMPXMediaGeneralCount,
+                        iDbHandler->NumberOfItemsL(aCategory));
+                    break;
+                    }
+                case EMPXMediaGeneralDuration:
+                    {
+                    if (aCategory == EMPXSong)
+                        {
+                        DoDurationL(aEntries, EMPXSong);
+                        }
+                    break;
+                    }
+                default:
+                    // not supported
+                    break;
+                } // end switch
+            } // end if
+        } // end for
+
+    aEntries.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup);
+    aEntries.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, aCategory);
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for albums/playlists/genres/composers category
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoCategoryMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    TMPXGeneralCategory aCategory,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoCategoryMediaL");
+
+    TInt levels(aPath.Levels());
+    TInt count(aPath.Selection().Count());
+
+    if (levels == 2) // all albums/playlists/genres/composers
+        {
+        MPX_PERF_START (CMPXDbPlugin_DoCategoryMediaL_All);
+        DoRootCategoryMediaL(aAttrs, aPath.Id(1).iId2, aCategory, aEntries);
+        MPX_PERF_END (CMPXDbPlugin_DoCategoryMediaL_All);
+        }
+    else if (levels == 3 && count) // multiple albums/playlists/genres/composers selected
+        {
+        RArray<TMPXItemId> selections;
+        CleanupClosePushL(selections);
+        aPath.SelectionL(selections);
+
+        for (TInt i = 0; i < count; ++i)
+            {
+            CMPXMedia* media = CMPXMedia::NewL();
+            CleanupStack::PushL(media);
+            iDbHandler->GetCategoryL(selections[i].iId2, aCategory, aAttrs, media);
+            aMediaArray.AppendL(*media);
+            CleanupStack::PopAndDestroy(media);
+            }
+
+        CleanupStack::PopAndDestroy(&selections);
+        }
+    else if (levels == 3) // all songs in an album/playlist/genre/composer
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoCategoryMediaL_Category);
+        TMPXItemId id = aPath.Id(2);
+        iDbHandler->GetCategoryL(id.iId2, aCategory, aAttrs, &aEntries);
+
+        // Calculate duration directly with SQL
+        if (MPXDbCommonUtil::AttributeExists(aAttrs, KMPXMediaGeneralDuration))
+            {
+            DoDurationL(aEntries, aCategory, id);
+            }
+
+        TInt nonPermisAction( aEntries.ValueTObjectL<TInt>(KMPXMediaGeneralNonPermissibleActions));
+        nonPermisAction |= EMPXCache;
+
+        aEntries.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+                    KMPXMediaGeneralNonPermissibleActions, (TMPXGeneralNonPermissibleActions) nonPermisAction );
+
+        MPX_PERF_END(CMPXDbPlugin_DoCategoryMediaL_Category);
+        }
+    else if (levels == 4) // a song/songs in an album/playlist/genre/composer
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoCategoryMediaL_Song);
+        GetSongInfoL(aPath, aAttrs, aEntries, aMediaArray);
+        MPX_PERF_END(CMPXDbPlugin_DoCategoryMediaL_Song);
+        }
+    else
+        {
+        MPX_DEBUG2("CMPXDbPlugin__DoMediaL__EBrowseAlbum: Invalid levels[%d]", levels);
+        User::Leave(KErrNotSupported);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Set all the attributes in CMPXMedia corresponding to KMPXMediaIdDrm
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoSetMediaDrmL(
+    CMPXMedia& aMedia,
+    TUint aDrmAttributes,
+    const TDesC& aLocation)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoSetMediaDrmL");
+
+    iDrmMediaUtility->InitL(aLocation);
+    CleanupClosePushL(*iDrmMediaUtility);
+    const CMPXMedia* drmMedia(iDrmMediaUtility->GetMediaL(aDrmAttributes));
+
+    // Only get attributes if it's a DRM file
+    if (drmMedia)
+        {
+        if ((aDrmAttributes & EMPXMediaDrmType) &&
+            drmMedia->IsSupported(KMPXMediaDrmType))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmType,
+                drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmType));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmRightsStatus) &&
+            drmMedia->IsSupported(KMPXMediaDrmRightsStatus))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmRightsStatus,
+                drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmRightsStatus));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmRightsType) &&
+            drmMedia->IsSupported(KMPXMediaDrmRightsType))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmRightsType,
+                drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmRightsType));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmCount) &&
+            drmMedia->IsSupported(KMPXMediaDrmCount))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmCount,
+                drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmCount));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmProtected) &&
+            drmMedia->IsSupported(KMPXMediaDrmProtected))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmProtected,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmProtected));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmSendingAllowed) &&
+            drmMedia->IsSupported(KMPXMediaDrmSendingAllowed))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmSendingAllowed,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmSendingAllowed));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmCanSetAutomated) &&
+            drmMedia->IsSupported(KMPXMediaDrmCanSetAutomated))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmCanSetAutomated,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmCanSetAutomated));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmHasInfoUrl) &&
+            drmMedia->IsSupported(KMPXMediaDrmHasInfoUrl))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmHasInfoUrl,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmHasInfoUrl));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmHasPreviewUrl) &&
+            drmMedia->IsSupported(KMPXMediaDrmHasPreviewUrl))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmHasPreviewUrl,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmHasPreviewUrl));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmAboutToExpire) &&
+            drmMedia->IsSupported(KMPXMediaDrmAboutToExpire))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmAboutToExpire,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmAboutToExpire));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmStartTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmStartTime))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmStartTime,
+                drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmStartTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmEndTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmEndTime))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmEndTime,
+                drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmEndTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmIntervalStartTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmIntervalStartTime))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmIntervalStartTime,
+                drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmIntervalStartTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmAccumulatedTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmAccumulatedTime))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmAccumulatedTime,
+                drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmAccumulatedTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmInterval) &&
+            drmMedia->IsSupported(KMPXMediaDrmInterval))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmInterval,
+                drmMedia->ValueTObjectL<TTimeIntervalSeconds>(KMPXMediaDrmInterval));
+            }
+        }
+
+    CleanupStack::PopAndDestroy(iDrmMediaUtility);
+    }
+
+// ----------------------------------------------------------------------------
+// Add media objects to the array with attributes from song details
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::GetSongInfoL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntry,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::GetSongInfoL");
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    MPXDbCommonUtil::FillInSupportedUIDsL(aAttrs, supportedIds);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    //
+    // If we are trying to locate a song from a playlist, we should read available song
+    // info from Playlist table first in case the song is located on a removable
+    // drive and the drive is not currently present. This is achieved by supplying
+    // playlist Id to GetSongMatchingSongIdL. When playlistId is 0, we are reading song
+    // info directly from Songs table. If playlistId is specified, GetSongMatchingSongIdL
+    // will populate song media from Playlist table and if Songs table for the drive
+    // exists, song media will be overwritten with info from Songs table.
+    //
+    TMPXItemId playlistId(0);
+    if (aPath.Id(1) == EBrowsePlaylist)
+        {
+        if (aPath.Levels() < 2)
+            {
+            User::Leave(KErrArgument);
+            }
+
+        playlistId = aPath.Id(aPath.Levels() - 2);
+        }
+
+    TInt countSelection(aPath.Selection().Count());
+    if (countSelection)
+        {
+        // We have a selection, iterate it
+        for (TInt selectionIndex = 0; selectionIndex < countSelection; ++selectionIndex)
+            {
+            CMPXMedia* newEntry = CMPXMedia::NewL(supportedIds.Array());
+            CleanupStack::PushL(newEntry);
+
+            DoGetSongInfoL(aAttrs, selections[selectionIndex].iId2, playlistId.iId2, *newEntry);
+
+            aMediaArray.AppendL(*newEntry);
+            CleanupStack::PopAndDestroy(newEntry);
+            }
+        }
+    else
+        {
+        // No selection, get the attributes for the one song
+        DoGetSongInfoL(aAttrs, aPath.Id(aPath.Levels() - 1).iId2, playlistId.iId2, aEntry);
+        }
+
+    CleanupStack::PopAndDestroy(&selections);
+    CleanupStack::PopAndDestroy(&supportedIds);
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieves the attributes for a media object.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoGetSongInfoL(
+    const TArray<TMPXAttribute>& aAttrs,
+    TInt aEntryId,
+    TInt aPlaylistId,
+    CMPXMedia& aEntry)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoGetSongInfoL");
+
+    if (aPlaylistId)
+        {
+        iDbHandler->GetPlaylistSongL(aEntryId, aPlaylistId, aAttrs, aEntry);
+        }
+    else
+        {
+        iDbHandler->GetSongL(aEntryId, aAttrs, aEntry);
+        }
+
+    const TDesC& location(aEntry.ValueText(KMPXMediaGeneralUri));
+
+    // Check DRM Only if we have a location
+    if (location != KNullDesC)
+        {
+        TUint drmAttributes(0);
+
+        // Compact the attribute set
+        TInt count(aAttrs.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            if (aAttrs[i].ContentId() == KMPXMediaIdDrm)
+                {
+                drmAttributes |= aAttrs[i].AttributeId();
+                }
+            }
+
+        // Set the correct attributes to media, only if requested
+        if (drmAttributes)
+            {
+            DoSetMediaDrmL(aEntry, drmAttributes, location);
+            }
+        }
+
+    // Disable caching for any MediaL() returning song info.
+    TInt nonPermisAction( aEntry.ValueTObjectL<TInt>(KMPXMediaGeneralNonPermissibleActions));
+    nonPermisAction |= EMPXCache;
+
+    aEntry.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+                KMPXMediaGeneralNonPermissibleActions, (TMPXGeneralNonPermissibleActions) nonPermisAction );
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection details
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoHandleOtherMediaAttributesL(
+    const TArray<TMPXAttribute>& aAttrs,
+    const CMPXCollectionPath& aPath,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoHandleOtherMediaAttributesL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdCollectionDetails)
+            {
+            TUint att(aAttrs[i].AttributeId());
+
+            if (att & EMPXMediaColDetailNumberOfItems)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailNumberOfItems,
+                    iDbHandler->NumberOfItemsL(EMPXSong));
+                }
+            if (att & EMPXMediaColDetailDuration)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailDuration,
+                    DoDurationL(aMedia, EMPXSong));
+                }
+            if (att & EMPXMediaColTotalSize)
+                {
+                // todo
+                TInt totalSize(0);
+                aMedia.SetTObjectValueL(KMPXMediaColDetailTotalSize, totalSize);
+                }
+            if (att & EMPXMediaLastRefreshed)
+                {
+                TTime lastRefreshed(iDbHandler->GetLastRefreshedTimeL());
+                aMedia.SetTObjectValueL(KMPXMediaColDetailLastRefreshed,
+                    lastRefreshed.Int64());
+                }
+            if (att & EMPXMediaColDetailDBCreated)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailDBCreated,
+                    iDbHandler->DatabaseCreated());
+                }
+            if (att & EMPXMediaColDetailDBCorrupted)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailDBCorrupted,
+                    iDbHandler->IsDBCorruptedL());
+                }
+            }
+        else if (aAttrs[i] == KMPXMediaGeneralPath)
+            {
+            aMedia.SetCObjectValueL(KMPXMediaGeneralPath,
+                const_cast<CMPXCollectionPath*>(&aPath));
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given path
+// ----------------------------------------------------------------------------
+//
+CDesCArray* CMPXDbPlugin::DoRemoveL(
+    const CMPXCollectionPath& aPath,
+    CMPXMessageArray& aChangeMsgArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveL");
+
+    if (aPath.Levels() <= 1)
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    // Return file path for deleted item(s)
+    //
+    CDesCArray* fp = new(ELeave) CDesCArrayFlat(1);
+    CleanupStack::PushL(fp);
+
+    // Ids of the selected items
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (aPath.Id(1).iId2)
+        {
+        case EBrowseAll:
+            {
+            DoRemoveFromAllSongsL(aPath, selections.Array(), *fp, aChangeMsgArray);
+            }
+            break;
+
+        case EBrowseArtist:
+            {
+            DoRemoveFromArtistsL(aPath, selections.Array(), *fp, aChangeMsgArray);
+            }
+            break;
+
+        case EBrowseAlbum: // deliberate fall through
+        case EBrowseGenre: // deliberate fall through
+        case EBrowseComposer: // deliberate fall through
+            {
+            DoRemoveFromCategoriesL(aPath, selections.Array(),
+                CategoryForBrowseType(static_cast<TMCBrowseType>(aPath.Id(1).iId2)), *fp, aChangeMsgArray);
+            }
+            break;
+
+        case EBrowsePlaylist:
+            {
+            DoRemoveFromPlaylistsL(aPath, selections.Array(), *fp, aChangeMsgArray);
+            }
+            break;
+
+        default:
+            {
+            User::Leave(KErrArgument);
+            }
+        } // end switch (aPath.Id(1))
+
+    MPX_DEBUG2("CMPXDbPlugin::RemoveL itemId[%d]", aPath.Id(aPath.Levels() - 1).iId2);
+
+    CleanupStack::PopAndDestroy( &selections );
+    CleanupStack::Pop(fp);
+
+    return fp;
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given media properties
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveL(
+    const CMPXMedia& aMedia,
+    TBool aDeleteRecord)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveL(by media)");
+
+    // Return deleted file paths to caller
+    CDesCArray* fp = new(ELeave) CDesCArrayFlat(1);
+    CleanupStack::PushL(fp);
+
+    // a list of change event messages a result of the item being removed
+    CMPXMessageArray* itemChangedMessages = CMPXMediaArray::NewL();
+    CleanupStack::PushL(itemChangedMessages);
+
+    TUint32 mediaId(0);
+
+    // Removing a container of items
+    //
+    if (aMedia.IsSupported(KMPXMediaArrayContents))
+        {
+        MPX_DEBUG1("CMPXDbPlugin::RemoveL -- Removing a container of items");
+        const CMPXMediaArray* media = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        if( !media )
+            {
+            User::Leave(KErrNoMemory);
+            }
+        const TInt mediaCount(media->Count());
+        for (TInt i = 0; i < mediaCount; ++i)
+            {
+            CMPXMedia* entry = media->AtL(i);
+            if (entry->IsSupported(KMPXMediaGeneralId))
+                {
+                mediaId = entry->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+                }
+            else if (entry->IsSupported(KMPXMediaGeneralUri))
+                {
+                const TDesC& uri = entry->ValueText(KMPXMediaGeneralUri);
+                mediaId = iDbHandler->GetSongIdMatchingUriL(uri);
+                }
+            else
+                {
+                // Unable to process this item
+                continue;
+                }
+
+            iDbHandler->RemoveSongL(mediaId, *fp, *itemChangedMessages, aDeleteRecord);
+            }
+        }
+    // Removing an item with known item id
+    //
+    else if (aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        MPX_DEBUG1("CMPXDbPlugin::RemoveL -- Removing an item by item id");
+        mediaId =  aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+
+        if (MPX_ITEM_CATEGORY(mediaId) != EMPXPlaylist)
+            {
+            iDbHandler->RemoveSongL(mediaId, *fp, *itemChangedMessages, aDeleteRecord);
+            }
+        else
+            {
+            iDbHandler->RemovePlaylistL(mediaId, *fp, *itemChangedMessages);
+            }
+        }
+    // Removing an item with known uri
+    //
+    else if (aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        MPX_DEBUG1("CMPXDbPlugin::RemoveL -- Removing an item by uri");
+        TPtrC uri = aMedia.ValueText( KMPXMediaGeneralUri );
+
+        TMPXGeneralCategory category =
+            aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory);
+
+        if (category == EMPXSong)
+            {
+            mediaId = iDbHandler->GetSongIdMatchingUriL(uri);
+            iDbHandler->RemoveSongL(mediaId, *fp, *itemChangedMessages, aDeleteRecord);
+            }
+        else if (category == EMPXPlaylist)
+            {
+            mediaId = iDbHandler->GetPlaylistIdMatchingUriL(uri);
+            iDbHandler->RemovePlaylistL(mediaId, *fp, *itemChangedMessages);
+            }
+        else
+            {
+            // otherwise unable to process this item
+            }
+        }
+    else
+        {
+        MPX_DEBUG1("CMPXDbPlugin::RemoveL -- Unknown item for removal");
+        User::Leave(KErrNotSupported);
+        }
+
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+
+    // Removing an item always invalidates all songs.
+    //
+    MPXDbCommonUtil::AddItemChangedMessageL(*itemChangedMessages, EBrowseAll,
+                                            EMPXItemModified, EMPXCollection, KDBPluginUid);
+
+    DoHandleChangeL(itemChangedMessages);
+
+    CleanupStack::PopAndDestroy(itemChangedMessages);
+    CleanupStack::PopAndDestroy(fp);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove media by path through a command
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemovePathL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemovePathL(by command)");
+
+    TInt removeError(KErrNone);
+    TBool removeCompleted(ETrue);
+
+    if (!aCmd.IsSupported(KMPXCommandCollectionRemovePath) ||
+        !aCmd.IsSupported(KMPXCommandCollectionRemoveMediaCount))
+        {
+        removeError = KErrArgument;
+        }
+    else
+        {
+        CMPXCollectionPath* path =
+            aCmd.ValueCObjectL<CMPXCollectionPath>(KMPXCommandCollectionRemovePath);
+        CleanupStack::PushL(path);
+
+        // in order to support cancel delete for a category, we need to adjust path. If
+        // the path ends in a category, retrieve all songs under the selected category
+        // and append a new level with all songs under the selected category
+        DoAppendLevelL(*path);
+
+        CMPXCollectionPath* iterationPath = CMPXCollectionPath::NewL(*path);
+        CleanupStack::PushL(iterationPath);
+        iterationPath->ClearSelection();
+
+        // indices of the selected items
+        TArray<TInt> selectionIndices = path->Selection();
+        TInt count(selectionIndices.Count());
+
+        // number of media items to remove in this iteration
+        TInt removeCount = (aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionRemoveMediaCount));
+
+        // remove all in one shot if removeCount is 0 or negative
+        if (removeCount <= 0)
+            {
+            removeCount = count;
+            }
+
+        // If the given path contains multiple selections, remove the first n selected media
+        // and update the path so that client can use this path to call remove iteratively
+        // until all selections are processed
+        //
+        if (count)
+            {
+            for (TInt i = 0; i < removeCount; ++i)
+                {
+                TInt index(selectionIndices[i]);
+
+                MPX_DEBUG4(" path: selected item [index %d] [selectioncount %d] [remove count %d]", index, count, removeCount);
+
+                iterationPath->SelectL(index);
+                path->Remove(index);
+                }
+
+            aCmd.SetCObjectValueL(KMPXCommandCollectionRemovePath, path);
+
+            // indicate to the client that subsequent remove command is required
+            if ((count - removeCount) > 0)
+                {
+                removeCompleted = EFalse;
+                }
+            }
+
+        // Remove the media specified by the path
+        CDesCArray* fp(NULL);
+        TBool supressMsgs(EFalse);
+        CMPXMessageArray* msgAry(NULL);
+
+        if (aCmd.IsSupported(KMPXCommandCollectionRemoveSuppressMsgs) &&
+            aCmd.ValueTObjectL<TBool>(KMPXCommandCollectionRemoveSuppressMsgs))
+            {
+            // Msgs are stored in the command
+            supressMsgs = ETrue;
+
+            CMPXMessageArray* msgs( aCmd.Value<CMPXMessageArray>(KMPXCommandCollectionChangeMsgs) );
+            User::LeaveIfNull( msgs );
+            fp = DoRemoveL(*iterationPath, *msgs);
+            }
+        else
+            {
+            // Msgs will be sent after delete
+            msgAry = CMPXMessageArray::NewL();
+            CleanupStack::PushL(msgAry);
+            fp = DoRemoveL(*iterationPath, *msgAry);
+            }
+
+        CleanupStack::PushL(fp);
+        if (fp->MdcaCount() > removeCount)
+            {
+            removeError = KErrCorrupt;
+            }
+        CleanupStack::PopAndDestroy(fp);
+
+        if (!supressMsgs)
+            {
+            // Send Change Messages
+            iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+            DoHandleChangeL(msgAry);
+            CleanupStack::PopAndDestroy(msgAry);
+            }
+
+        // Cleanup
+        CleanupStack::PopAndDestroy(iterationPath);
+        CleanupStack::PopAndDestroy(path);
+        }
+
+    // mandatory return parameters
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRemoveError, removeError);
+    aCmd.SetTObjectValueL<TBool>(KMPXCommandCollectionRemoveCompleted, removeCompleted);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove media by CMPXMedia through a command
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveMediaL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveMediaL(by command)");
+
+    TInt error(KErrArgument);
+
+    if (aCmd.IsSupported(KMPXCommandCollectionRemoveMedia))
+        {
+        CMPXMedia* media = aCmd.ValueCObjectL<CMPXMedia>(KMPXCommandCollectionRemoveMedia);
+        CleanupStack::PushL(media);
+
+        MPX_TRAP(error, DoRemoveL(*media,
+            aCmd.ValueTObjectL<TBool>(KMPXCommandCollectionRemoveMediaDeleteRecord)));
+
+        CleanupStack::PopAndDestroy(media);
+        }
+
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRemoveMediaError, error);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media/media items from All Songs view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveFromAllSongsL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXItemId>& aSelections,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveFromAllSongsL");
+
+    switch (aPath.Levels())
+        {
+        case 2:
+            {
+            // when the collection is removed, it's intended not to delete the files
+            iDbHandler->RemoveEntireCollectionL();
+            }
+            break;
+
+        case 3:
+            {
+            TInt count(aSelections.Count());
+            if (count)
+                {
+                for (TInt i = 0; i < count; ++i)
+                    {
+                    iDbHandler->RemoveSongL(aSelections[i].iId2, aUriArray, aItemChangedMessages);
+                    } // end for
+                }
+            else
+                {
+                iDbHandler->RemoveSongL(aPath.Id(aPath.Levels() - 1).iId2, aUriArray,
+                     aItemChangedMessages);
+                }
+            }
+            break;
+
+        default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoRemoveFromAllSongsL: Invalid levels[%d]", aPath.Levels());
+            User::Leave(KErrNotSupported);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media/media items from Artists view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveFromArtistsL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXItemId>& aSelections,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveFromArtistsL");
+
+    TInt levels(aPath.Levels());
+    if (levels == 2)
+        {
+        // when the collection is removed, it's intended not to delete the files
+        iDbHandler->RemoveEntireCollectionL();
+        }
+    else
+        {
+        TInt count(aSelections.Count());
+        if (count)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                RemoveFromArtistsL(aPath, aSelections[i].iId2, aUriArray, aItemChangedMessages);
+                }
+            }
+        else
+            {
+            RemoveFromArtistsL(aPath, aPath.Id(levels - 1).iId2, aUriArray, aItemChangedMessages);
+            }
+        }
+
+    MPX_DEBUG2("CMPXDbPlugin__RemoveL__EBrowseArtist: levels[%d]", levels);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media item from Artists view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::RemoveFromArtistsL(
+    const CMPXCollectionPath& aPath,
+    TUint32 aItemId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::RemoveFromArtistsL");
+
+    switch (aPath.Levels())
+        {
+        case 3:
+            {
+            iDbHandler->RemoveSongsMatchingCategoryL(EMPXArtist, aItemId, aUriArray, aItemChangedMessages);
+            break;
+            }
+        case 4:
+            {
+            // remove the songs for the artist and album
+            iDbHandler->RemoveSongsMatchingArtistAndAlbumL(aPath.Id(aPath.Levels() - 2), aItemId,
+                aUriArray, aItemChangedMessages);
+            break;
+            }
+        case 5:
+            {
+            iDbHandler->RemoveSongL(aItemId, aUriArray, aItemChangedMessages);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrArgument);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media/media items from Albums/Genres/Composers view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveFromCategoriesL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXItemId>& aSelections,
+    TMPXGeneralCategory aCategory,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveFromCategoriesL");
+
+    TInt levels(aPath.Levels());
+    if (levels == 2)
+        {
+        // when the collection is removed, it's intended not to delete the files
+        iDbHandler->RemoveEntireCollectionL();
+        }
+    else
+        {
+        TInt count(aSelections.Count());
+        if (count)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                RemoveFromCategoriesL(aPath, aSelections[i].iId2, aCategory,
+                    aUriArray, aItemChangedMessages);
+                }
+            }
+        else
+            {
+            RemoveFromCategoriesL(aPath, aPath.Id(levels - 1).iId2, aCategory,
+                aUriArray, aItemChangedMessages);
+            }
+        }
+
+    MPX_DEBUG2("CMPXDbPlugin__RemoveL__EBrowseAlbum: levels[%d]", levels);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media item from Albums/Genres/Composers view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::RemoveFromCategoriesL(
+    const CMPXCollectionPath& aPath,
+    TUint32 aItemId,
+    TMPXGeneralCategory aCategory,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::RemoveFromCategoriesL");
+
+    switch (aPath.Levels())
+        {
+        case 3:
+            {
+            iDbHandler->RemoveSongsMatchingCategoryL(aCategory, aItemId, aUriArray,
+                aItemChangedMessages);
+            break;
+            }
+        case 4:
+            {
+            iDbHandler->RemoveSongL(aItemId, aUriArray, aItemChangedMessages);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrArgument);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove one or multiple media items from Playlists view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveFromPlaylistsL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXItemId>& aSelections,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveFromPlaylistsL");
+
+    TInt levels(aPath.Levels());
+
+    // all playlists
+    if (levels == 2)
+        {
+        // when the collection is removed, it's intended not to delete the files
+        iDbHandler->RemoveAllPlaylistsL();
+        }
+    else
+        {
+        TArray<TInt> selectionIndices = aPath.Selection();
+        TInt count(selectionIndices.Count());
+
+        // multiple selections
+        if (count)
+            {
+            for (TInt i = (count - 1); i >= 0; --i)
+                {
+                RemoveFromPlaylistsL(aPath, aSelections[i], selectionIndices[i],
+                    aUriArray, aItemChangedMessages);
+                }
+            }
+        // else no selection
+        else
+            {
+            RemoveFromPlaylistsL(aPath, aPath.IdOfIndex(aPath.Index()), aPath.Index(),
+                aUriArray, aItemChangedMessages);
+            }
+        }
+
+    MPX_DEBUG2("CMPXDbPlugin__RemoveL__EBrowsePlaylist: levels[%d]", levels);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media item from Playlists view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::RemoveFromPlaylistsL(
+    const CMPXCollectionPath& aPath,
+    const TMPXItemId& aItemId,
+    TInt aIndex,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::RemoveFromPlaylistsL");
+
+    switch (aPath.Levels())
+        {
+        case 3:
+            {
+            iDbHandler->RemovePlaylistL(aItemId.iId2, aUriArray, aItemChangedMessages);
+            break;
+            }
+        case 4:
+            {
+            if ( !iDbHandler->InTransaction() )
+                {
+                iDbHandler->BeginTransactionL();
+                }
+            iDbHandler->RemoveSongFromPlaylistL(aPath.Id(aPath.Levels() - 2).iId2, aItemId,
+                aIndex, aItemChangedMessages);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrArgument);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve URIs associated with this file path for file deletion
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRetrieveUriForDeletionL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRetrieveUriForDeletionL");
+
+    // initialize mandatory return parameters
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRetrieveUriError, KErrNone);
+
+    if (!aCmd.IsSupported(KMPXCommandCollectionRetrievePath))
+        {
+        aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRetrieveUriError, KErrArgument);
+        }
+    else
+        {
+        CMPXCollectionPath* path = aCmd.ValueCObjectL<CMPXCollectionPath>(KMPXCommandCollectionRetrievePath);
+        CleanupStack::PushL(path);
+        if (iFirstDeleteStep )
+            {
+            iSelections.Reset( );
+        // in order to support cancel delete for a category, we need to adjust path. If
+        // the path ends in a category, retrieve all songs under the selected category
+        // and append a new level with all songs under the selected category
+        DoAppendLevelL(*path);
+
+        // Ids of the selected items
+            path->SelectionL(iSelections );
+
+        // single selection
+            if (iSelections.Count()== 0 )
+                {
+                iSelections.AppendL(path->Id (path->Levels()- 1 ) );
+                }
+            }
+
+        CDesCArray* fp = new(ELeave) CDesCArrayFlat(4);
+        CleanupStack::PushL(fp);
+
+        TInt count(iSelections.Count());
+        TInt itemCount = count > KIncrementalDeleteCount ? KIncrementalDeleteCount : count;
+        for (TInt i = 0; i < itemCount; ++i )
+            {
+            // do not report song URIs if collection path is for songs within a playlist, i.e.
+            // EBrowsePlaylist and level 4, because client should not be deleting those song
+            // files
+            if (path->Id(1) != EBrowsePlaylist || path->Levels() !=4)
+                {
+                HBufC * uri = iDbHandler->GetUriMatchingIdL (iSelections[0].iId2 );
+                CleanupStack::PushL(uri);
+                fp->AppendL(*uri);
+                CleanupStack::PopAndDestroy(uri);
+                }
+            iSelections.Remove(0);
+            }
+
+        aCmd.SetNoNewLCObjectL(KMPXCommandCollectionRetrieveMediaUriArray, fp);
+        if (iFirstDeleteStep)
+            {
+        aCmd.SetCObjectValueL(KMPXCommandCollectionRetrievePath, path);
+            }
+
+        CleanupStack::PopAndDestroy(fp);
+        CleanupStack::PopAndDestroy(path);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Cleanup deleted records
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::CleanupDeletedRecordsL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::CleanupDeletedRecordsL");
+
+    MPX_TRAPD(error, iDbHandler->CleanupDeletedRecordsL());
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionCleanupError, error);
+    }
+
+// ----------------------------------------------------------------------------
+// Find the duration
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlugin::DoDurationL(
+    CMPXMedia& aMedia,
+    TMPXGeneralCategory aFirstCat,
+    TMPXItemId aId,
+    TMPXGeneralCategory aSecondCat,
+    TMPXItemId aSubId)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoDurationL");
+
+    TInt duration(0);
+
+    switch (aFirstCat)
+        {
+        case EMPXSong:
+            {
+            duration = iDbHandler->GetAllSongsDurationL();
+            break;
+            }
+        case EMPXAlbum:
+            {
+            duration = iDbHandler->GetAlbumDurationL(aId.iId2);
+            break;
+            }
+        case EMPXComposer:
+            {
+            duration = iDbHandler->GetComposerDurationL(aId.iId2);
+            break;
+            }
+        case EMPXGenre:
+            {
+            duration = iDbHandler->GetGenreDurationL(aId.iId2);
+            break;
+            }
+        case EMPXArtist:
+            {
+            if (aSecondCat == EMPXAlbum)
+                {
+                duration = iDbHandler->GetArtistAlbumDurationL(aId.iId2, aSubId.iId2);
+                }
+            else
+                {
+                duration = iDbHandler->GetArtistDurationL(aId.iId2);
+                }
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            duration = iDbHandler->GetPlaylistDurationL(aId.iId2);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+    return duration;
+    }
+
+// ----------------------------------------------------------------------------
+// Append a level to a collection path and set selection to the first item
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlugin::DoAppendLevelL(
+    CMPXCollectionPath& aPath,
+    CMPXMedia& aMedia )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAppendLevelL");
+
+    RArray<TMPXItemId> ids;
+    CleanupClosePushL(ids);
+
+    // Extract media array, and get all item ids
+    //
+    const CMPXMediaArray* mediaArray = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+    if( !mediaArray )
+        {
+        User::Leave( KErrNoMemory );
+        }
+
+    TInt count(mediaArray->Count());
+    if (count >= 0)
+        {
+        for (TInt i = 0; i < count; ++i)
+            {
+            TMPXItemId id = mediaArray->AtL(i)->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+            ids.AppendL(id);
+            }
+
+        // Put item id array into the path and select the first one
+        aPath.AppendL(ids.Array());
+        if (count > 0)
+            {
+            aPath.Set(0);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&ids);
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Append a level to a collection path and set selection to all songs under the
+// selected category/categories
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoAppendLevelL(
+    CMPXCollectionPath& aPath)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAppendLevelL");
+
+    TMPXItemId contextId(aPath.Id(1));
+    TInt levels(aPath.Levels());
+
+    if ((contextId == EBrowseAll) ||
+        (contextId == EBrowsePlaylist))
+        {
+        return;
+        }
+    else if (levels == 3 || (levels == 4 && contextId == EBrowseArtist))
+        {
+        // retrieve songs in the selected category
+        //
+        CMPXMediaArray* songs = CMPXMediaArray::NewL();
+        CleanupStack::PushL(songs);
+
+        RArray<TMPXAttribute> attributes;
+        CleanupClosePushL(attributes);
+        attributes.AppendL(KMPXMediaGeneralId);
+
+        // Ids of the selected items
+        RArray<TMPXItemId> selections;
+        CleanupClosePushL(selections);
+        aPath.SelectionL(selections);
+
+        // single selection
+        if (selections.Count() == 0)
+            {
+            selections.AppendL(aPath.Id(aPath.Levels() - 1));
+            }
+
+        TInt count(selections.Count());
+
+        // all songs for the selected artist
+        if (contextId == EBrowseArtist && levels == 3)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                iDbHandler->GetSongsMatchingArtistL(selections[i].iId2, attributes.Array(), songs);
+                }
+            if (songs->Count())
+                {
+                aPath.AppendL(selections.Array());
+                }
+            }
+
+        // all songs for the selected artist in the specified album
+        else if ((contextId == EBrowseArtist) && (levels == 4))
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                if (aPath.Id(2) == aPath.Id(3))
+                    {
+                    iDbHandler->GetSongsMatchingArtistL(aPath.Id(3).iId2,
+                        attributes.Array(), songs);
+                    }
+                else
+                    {
+                    iDbHandler->GetSongsMatchingArtistAndAlbumL(aPath.Id(aPath.Levels() - 2),
+                        selections[i].iId2, attributes.Array(), songs);
+                    }
+                }
+            }
+
+         // all songs for the selected album
+        else if (contextId == EBrowseAlbum && levels == 3)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                iDbHandler->GetSongsMatchingAlbumL(selections[i], attributes.Array(), songs);
+                }
+            }
+
+        // all songs for the selected genre
+        else if (contextId == EBrowseGenre && levels == 3)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                iDbHandler->GetSongsMatchingGenreL(selections[i], attributes.Array(), songs);
+                }
+            }
+
+        // all songs for the selected composer
+        else if (contextId == EBrowseComposer && levels == 3)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                iDbHandler->GetSongsMatchingComposerL(selections[i], attributes.Array(), songs);
+                }
+            }
+        else
+            {
+            // else do nothing
+            }
+
+        CleanupStack::PopAndDestroy(&selections);
+        CleanupStack::PopAndDestroy(&attributes);
+
+        // transform from CMPXMediaArray to RArray
+        RArray<TMPXItemId> songIds;
+        CleanupClosePushL(songIds);
+
+        TInt songCount(songs->Count());
+        for (TInt i = 0; i < songCount; ++i)
+            {
+            CMPXMedia* song = (*songs)[i];
+
+            if (song->IsSupported(KMPXMediaGeneralId))
+                {
+                songIds.AppendL(song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+                }
+            }
+
+        // modify the collection path. append another level with all songs under the selected
+        // category/categories selected
+        songCount = songIds.Count();
+
+        if (songCount)
+            {
+            aPath.ClearSelection();
+            aPath.AppendL(songIds.Array());
+
+            // select all
+            for (TInt i = 0; i < songCount; ++i)
+                {
+                aPath.SelectL(songIds[i]);
+                }
+            }
+
+        CleanupStack::PopAndDestroy(&songIds);
+        CleanupStack::PopAndDestroy(songs);
+        }
+    else
+        {
+        // do nothing
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Execute an Add task step
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoAddAsyncL()
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAddAsyncL");
+
+    TBool done(EFalse);
+    const CMPXMedia* task = (iActiveTask->GetCommand().Value<CMPXMedia>(KMPXCommandColAddMedia));
+    if( !task )
+        {
+        User::Leave(KErrNoMemory);
+        }
+
+    CMPXMessageArray& msgArray = iActiveTask->GetChangeMessages();
+
+    if (!task->IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    // Group of items or a single item
+    //
+    if (task->ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+        {
+        if (!task->IsSupported(KMPXMediaArrayContents))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        CMPXMediaArray* ary = task->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull(ary);
+        TInt step( iActiveTask->GetStep() );
+        DoAddItemL( *ary->AtL(step), msgArray );
+
+        if (++step == ary->Count())
+            {
+            done = ETrue;
+            }
+        }
+    else // type == EMPXItem
+        {
+        TUint32 item = DoAddItemL( *task, msgArray );
+        iActiveTask->GetCommand().SetTObjectValueL<TMPXItemId>( KMPXCommandColAddRtnId, item);
+        done = ETrue;
+        }
+
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+    return done;
+    }
+
+// ----------------------------------------------------------------------------
+// Add an item to the collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlugin::DoAddL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAddL");
+
+    if (!aMedia.IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TUint32 itemId(0);
+    CMPXMessageArray* changeMsgAry = CMPXMessageArray::NewL();
+    CleanupStack::PushL(changeMsgAry);
+
+	// start a transaction here
+	if (!iDbHandler->InTransaction())
+		{
+		iDbHandler->BeginTransactionL();
+		}
+
+    // Group of items
+    if (aMedia.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+        {
+        CMPXMediaArray* array = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull( array );
+
+        TInt count(array->Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            // ETrue indicates we are batch committing the songs.
+            // This parameter is only used for the use case of adding
+            // thousands of songs at a time.
+            DoAddItemL(*array->AtL(i), *changeMsgAry, ETrue);
+            }
+        }
+    else // single item
+        {
+        itemId = DoAddItemL(aMedia, *changeMsgAry);
+        }
+
+	// end transaction here.
+	iDbHandler->EndTransactionL(KErrNone);
+
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+    DoHandleChangeL(changeMsgAry);
+    CleanupStack::PopAndDestroy(changeMsgAry);
+
+    return itemId;
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Add an item to the collection
+// ----------------------------------------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlugin::DoAddItemL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aMessageArray,
+    TBool aBatchCommit)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAddItemL");
+
+    TUint32 itemId(0);
+    if (!aMedia.IsSupported(KMPXMediaGeneralCategory))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    switch (aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory))
+        {
+        case EMPXPlaylist:
+            {
+            if (!aMedia.IsSupported(KMPXMediaArrayContents))
+                {
+                User::Leave(KErrArgument);
+                }
+
+            if (aMedia.IsSupported(KMPXMediaGeneralId))
+                {
+                itemId = iDbHandler->AddSongToPlaylistL(aMedia);
+                MPXDbCommonUtil::AddItemChangedMessageL(aMessageArray, itemId, EMPXItemModified,
+                    EMPXPlaylist, KDBPluginUid);
+                }
+            else if (aMedia.IsSupported(KMPXMediaGeneralUri))
+                {
+                itemId = iDbHandler->AddPlaylistL(aMedia);
+                MPXDbCommonUtil::AddItemChangedMessageL(aMessageArray, EBrowsePlaylist, EMPXItemInserted,
+                    EMPXPlaylist, KDBPluginUid);
+                }
+            else
+                {
+                User::Leave(KErrArgument);
+                }
+            }
+            break;
+
+        case EMPXSong:
+            {
+            // For the use case of adding thousands of songs at once,
+            // we do not create a new database transaction for each song;
+            // Instead DoAddL() will batch 100 songs under a single transaction.
+            // This enhancement improves performance with MMC-based databases.
+            if (aBatchCommit)
+                {
+                itemId = iDbHandler->AddSongWithNoTransactionL(aMedia, &aMessageArray);
+                }
+            else
+                {
+                itemId = iDbHandler->AddSongL(aMedia, &aMessageArray);
+                }
+
+            MPXDbCommonUtil::AddItemChangedMessageL(aMessageArray, itemId, EMPXItemInserted,
+                EMPXSong, KDBPluginUid);
+            }
+            break;
+
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    return itemId;
+    }
+
+// ----------------------------------------------------------------------------
+// Update the collection from a media
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoSetL(
+    const CMPXMedia& aMedia )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoSetL");
+
+    if (!aMedia.IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+
+    CMPXMessageArray* changeMsgArray = CMPXMessageArray::NewL();
+    CleanupStack::PushL(changeMsgArray);
+
+    if (aMedia.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+        {
+        if (!aMedia.IsSupported(KMPXMediaArrayContents))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        CMPXMediaArray* array = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull( array );
+        TInt count( array->Count() );
+        for (TInt i = 0; i < count; ++i)
+            {
+            visibleChange = (CMPXDbActiveTask::TChangeVisibility)(visibleChange | DoSetItemL(*array->AtL(i), *changeMsgArray));
+            }
+        }
+    else
+        {
+        visibleChange = DoSetItemL(aMedia, *changeMsgArray);
+        }
+
+    // Handle Change Events
+    if (visibleChange)
+        {
+        iActiveTask->SetVisibleChange(visibleChange);
+        DoHandleChangeL(changeMsgArray);
+        }
+    CleanupStack::PopAndDestroy(changeMsgArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Execute a task step for async set
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoSetAsyncL()
+    {
+    MPX_FUNC("CMPXDbPlugin::DoSetAsyncL");
+
+    TBool done(EFalse);
+    CMPXMedia* task = iActiveTask->GetCommand().Value<CMPXMedia>(KMPXCommandColSetMedia);
+    User::LeaveIfNull( task );
+
+    CMPXMessageArray& msgArray = iActiveTask->GetChangeMessages();
+    CMPXDbActiveTask::TChangeVisibility visibleChange(iActiveTask->GetVisibleChange());
+
+    // Multiple steps can be in a transaction for faster response
+    if( !iDbHandler->InTransaction() )
+        {
+        iDbHandler->BeginTransactionL();
+        }
+
+    if (!task->IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    if (task->ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+        {
+        if (!task->IsSupported(KMPXMediaArrayContents))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        // Multiple items
+        CMPXMediaArray* array = task->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull( array );
+        TInt step = iActiveTask->GetStep();
+        visibleChange = (CMPXDbActiveTask::TChangeVisibility)(visibleChange | DoSetItemL(*array->AtL(step), msgArray));
+
+        if (++step == array->Count())
+            {
+            done = ETrue;
+            }
+        }
+    else // Single item
+        {
+        visibleChange = DoSetItemL(*task, msgArray);
+        done = ETrue;
+        }
+    iActiveTask->SetVisibleChange(visibleChange);
+    return done;
+    }
+
+// ----------------------------------------------------------------------------
+// Update the collection from a media
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbPlugin::DoSetItemL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aMessageArray )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoSetItemL");
+
+    TMPXGeneralCategory category = aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory);
+
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+    switch (category)
+        {
+        case EMPXPlaylist:
+            {
+            if (aMedia.IsSupported(KMPXMediaArrayContents))
+                {
+                CMPXMessage* message = CMPXMedia::NewL();
+                CleanupStack::PushL(message);
+
+                iDbHandler->UpdatePlaylistSongsL(aMedia, *message);
+
+                aMessageArray.AppendL(message); // ownership xfer
+                CleanupStack::Pop(message);
+                }
+            else
+                {
+                iDbHandler->UpdatePlaylistL(aMedia, aMessageArray);
+                }
+
+            visibleChange = CMPXDbActiveTask::ESingleVisible;
+            }
+            break;
+
+        case EMPXSong:
+            {
+            // a list of changed messages as a result of the song being updated
+            visibleChange = iDbHandler->UpdateSongL(aMedia, aMessageArray);
+            }
+            break;
+
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+            break;
+        }
+    return visibleChange; // ownership xfer
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the drm properties for a list of medias
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoSetDrmForArrayL(
+    const CMPXMediaArray& mediaArray,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoSetDrmForArrayL");
+
+    TUint drmAttributes(0);
+
+    // Compact the attribute set
+    //
+    TInt attrCount(aAttrs.Count());
+    for (TInt i = 0; i < attrCount; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdDrm)
+            {
+            drmAttributes |= aAttrs[i].AttributeId();
+            }
+        }
+
+    // Fetch drm attributes for every item
+    //
+    if (drmAttributes)
+        {
+        TInt count(mediaArray.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            if (mediaArray[i]->IsSupported(KMPXMediaGeneralUri))
+                {
+                DoSetMediaDrmL(*mediaArray[i], drmAttributes,
+                    mediaArray[i]->ValueText(KMPXMediaGeneralUri));
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Handle change events
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::HandleChangeL(
+    const CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbPlugin::HandleChange");
+
+    // check if message is filled
+    if (aMessage.IsSupported(KMPXMessageGeneralId))
+        {
+#if _DEBUG
+        PrintMessagesL(aMessage);
+#endif // _DEBUG
+        if(iRefreshing)
+            {
+            if (aMessage.IsSupported(KMPXMessageArrayContents))
+                {
+                const CMPXMessageArray* messageArray = aMessage.Value<CMPXMessageArray>(KMPXMessageArrayContents);
+                if(messageArray)
+                    {
+                    CMPXMessage& message = *((*messageArray)[0]);
+                    TMPXChangeEventType changeType( message.ValueTObjectL<TMPXChangeEventType>( KMPXMessageChangeEventType ) );
+                    TMPXGeneralCategory cat(message.ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory));
+                    if(changeType == EMPXItemInserted && (cat == EMPXSong || cat == EMPXPlaylist || cat == EMPXPodcast))
+                        {
+                        iObs->HandleMessage(aMessage);
+                        }
+                    }
+                }
+            else
+                {
+                TMPXChangeEventType changeType( aMessage.ValueTObjectL<TMPXChangeEventType>( KMPXMessageChangeEventType ) );
+                TMPXGeneralCategory cat(aMessage.ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory));
+                if(changeType == EMPXItemInserted && (cat == EMPXSong || cat == EMPXPlaylist || cat == EMPXPodcast))
+                    {
+                    iObs->HandleMessage(aMessage);
+                    }
+                }
+            }
+        else
+            {
+            if(!iMtpInUse)
+                {
+                iObs->HandleMessage(aMessage);
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Construct a CMPXMedia and call HandleChange
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoHandleChangeL(
+    CMPXMessageArray* aItemChangedMessages,
+    TMPXCommandId aCommandId )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoHandleChangeL");
+
+    if( (iActiveTask->GetVisibleChange() & CMPXDbActiveTask::EAllVisible)
+        && (aCommandId == KMPXCommandIdCollectionSet ||
+            aCommandId == KMPXCommandIdCollectionAdd ||
+            aCommandId == KMPXCommandIdCollectionRemove ||
+            aCommandId == KMPXCommandIdCollectionCompleteDelete ))
+        {
+        MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, EBrowseAll,
+                                                 EMPXItemModified, EMPXCollection, KDBPluginUid);
+        }
+    // group change messages and send to collection client context
+    //
+    CMPXMessage* message = CMPXMessage::NewL();
+    CleanupStack::PushL(message);
+
+    message->SetTObjectValueL<TMPXMessageId>(KMPXMessageGeneralId, KMPXMessageIdItemChanged);
+    message->SetCObjectValueL(KMPXMessageArrayContents, aItemChangedMessages);
+    message->SetTObjectValueL<TInt>(KMPXMessageArrayCount, aItemChangedMessages->Count());
+
+    HandleChangeL(*message);
+
+    CleanupStack::PopAndDestroy(message);
+    }
+
+// ----------------------------------------------------------------------------
+// Handle completion of operation
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoHandleOperationCompletedL(
+    TInt aErr)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoHandleOperationCompletedL");
+
+    // Broadcase change messages
+    //
+    if (iActiveTask->GetVisibleChange())
+        {
+        DoHandleChangeL(&iActiveTask->GetChangeMessages(), iActiveTask->GetTask() );
+        }
+
+    // Callback to engine to signal completion
+    // NOTE: Collection server immediately completes the async message when
+    // Cancel is called, no need to callback to observer
+    if (aErr != KErrCancel)
+        {
+        iObs->HandleCommandComplete(NULL, aErr);
+        }
+
+    if( iDbHandler->InTransaction() )
+        {
+        // Commit if cancelled
+        TInt err(aErr);
+        if( err == KErrCancel )
+            {
+            err = KErrNone;
+            }
+        iDbHandler->EndTransactionL( err );
+        }
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Complete a delete operation
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoHandleDeleteCompleteL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoHandleDeleteCompleteL");
+    iFirstDeleteStep = ETrue;
+    iSelections.Reset();
+    if ( iDbHandler->InTransaction() )
+        {
+        // if it can reach this point in a transaction, there's no error
+        iDbHandler->EndTransactionL( KErrNone );
+        }
+
+    // Change messages
+    if (aCmd.IsSupported(KMPXCommandCollectionDeleteMsgArray))
+        {
+        CMPXMessageArray* msgs = aCmd.Value<CMPXMessageArray>(KMPXCommandCollectionDeleteMsgArray);
+        User::LeaveIfNull( msgs );
+        iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+        DoHandleChangeL(msgs, KMPXCommandIdCollectionCompleteDelete);
+        }
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Reorder a song in a playlist
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoReorderPlaylistL(
+    const CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoReorderPlaylistL");
+
+    if (!aCmd.IsSupported(KMPXCommandReorderPlaylistId) ||
+        !aCmd.IsSupported(KMPXCommandReorderSongId) ||
+        !aCmd.IsSupported(KMPXCommandReorderOriginalOrdinal) ||
+        !aCmd.IsSupported(KMPXCommandReorderNewOrdinal))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    CMPXMessage* message = CMPXMedia::NewL();
+    CleanupStack::PushL(message);
+
+    iDbHandler->ReorderPlaylistL(
+        aCmd.ValueTObjectL<TMPXItemId>(KMPXCommandReorderPlaylistId),
+        aCmd.ValueTObjectL<TMPXItemId>(KMPXCommandReorderSongId),
+        aCmd.ValueTObjectL<TUint>(KMPXCommandReorderOriginalOrdinal),
+        aCmd.ValueTObjectL<TUint>(KMPXCommandReorderNewOrdinal),
+        *message);
+
+    HandleChangeL(*message);
+
+    CleanupStack::PopAndDestroy(message);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Get total songs and playlists count for a database
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoGetCollectionCountL( const CMPXCommand& aCmd )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoGetCollectionCountL");
+    if (!aCmd.IsSupported(KMPXCommandCollectionCountDrive) ||
+        !aCmd.IsSupported(KMPXCommandCollectionCountTable) )
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TInt count = 0;
+    TInt drive = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionCountDrive);
+    TInt table = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionCountTable);
+    switch(table)
+        {
+        case EMPXCollectionCountTrack:
+            count = (TInt)iDbHandler->GetMusicCountL(drive);
+            break;
+        case EMPXCollectionCountPlaylist:
+            count = (TInt)iDbHandler->GetPlaylistCountL(drive);
+            break;
+        case EMPXCollectionCountTotal:
+            count = (TInt)iDbHandler->GetTotalCountL(drive);
+            break;
+        default:
+            User::Leave(KErrArgument);
+        }
+    ((CMPXMedia&)aCmd).SetTObjectValueL<TInt>(KMPXCommandCollectionCountValue, count);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Get URIs for all songs and file playlists in a database
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoGetCollectionUriL( const CMPXCommand& aCmd )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoGetCollectionCountL");
+    if (!aCmd.IsSupported(KMPXCommandCollectionURIDrive) ||
+        !aCmd.IsSupported(KMPXCommandCollectionURITable) ||
+        !aCmd.IsSupported(KMPXCommandCollectionURIFromID) ||
+        !aCmd.IsSupported(KMPXCommandCollectionURIRecords) )
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TInt drive = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionURIDrive);
+    TInt table = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionURITable);
+    TInt fromID = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionURIFromID);
+    TInt recnum = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionURIRecords);
+
+    CDesCArray* uris = new(ELeave) CDesCArrayFlat(4);
+    CleanupStack::PushL(uris);
+    TInt lastID = 0;
+
+    switch(table)
+        {
+        case EMPXCollectionURITrack:
+            iDbHandler->GetMusicUriArrayL(drive, fromID, recnum, *uris, lastID);
+            break;
+        case EMPXCollectionURIPlaylist:
+            iDbHandler->GetPlaylistUriArrayL(drive, fromID, recnum, *uris, lastID);
+            break;
+        default:
+            User::Leave(KErrArgument);
+        }
+
+    ((CMPXMedia&)aCmd).SetNoNewLCObjectL(KMPXCommandCollectionURIList, uris);
+    ((CMPXMedia&)aCmd).SetTObjectValueL(KMPXCommandCollectionURILastID, lastID);
+    CleanupStack::PopAndDestroy(uris);
+    }
+
+
+// ----------------------------------------------------------------------------------------------------------
+// Perform one step of the incremental operation
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoIncrementalOpenL( const CMPXCommand& aCmd )
+    {
+    MPX_DEBUG1("CMPXDbPlugin::DoIncrementalOpenL <--");
+
+    TInt offset = aCmd.ValueTObjectL<TInt>( KMPXCollectionCommandIdIncOpenLOffset );
+    TInt numItems = aCmd.ValueTObjectL<TInt>( KMPXCollectionCommandIdIncOpenLNumItems );
+
+    TReadDirection direction(EReadUnknown);
+    if( aCmd.IsSupported(KMPXCollectionCommandIdIncOpenLAscDsc) &&
+        aCmd.IsSupported(KMPXCollectionCommandIdIncOpenLKeyItem) )
+        {
+        direction = aCmd.ValueTObjectL<TReadDirection>(KMPXCollectionCommandIdIncOpenLAscDsc);
+        }
+
+    CMPXCollectionPath* path =  aCmd.ValueCObjectL<CMPXCollectionPath>(KMPXCollectionCommandIdIncOpenLPath);
+    CleanupStack::PushL( path );
+    MPX_DEBUG_PATH( *path );
+
+    // Switch on level and item selected
+    //
+    TInt levels( path->Levels() );
+    switch( levels )
+        {
+        case 3:  // levels of 3 top level is not stripped
+            {
+            switch( path->Id(1).iId2 )
+                {
+                case EBrowseAll:
+                    {
+                    CMPXMedia* results = CMPXMedia::NewL();
+                    CleanupStack::PushL( results );
+
+                    TMPXOpenDataBlock block;
+                    block.iOffset = offset;
+                    block.iSize = numItems;
+
+                    // Todo: this should come from the UI
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL( attrs );
+                    attrs.AppendL(TMPXAttribute(KMPXMediaIdGeneral,
+                                   EMPXMediaGeneralId | EMPXMediaGeneralType | EMPXMediaGeneralCategory |
+                                   EMPXMediaGeneralTitle | EMPXMediaGeneralFlags));
+                    attrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+                                        EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName ) );
+
+                    // Array to read data from
+                    CMPXMediaArray* array = CMPXMediaArray::NewL();
+                    CleanupStack::PushL( array );
+
+                    // Do we have to use offset or can we use asc/dsc
+                    //
+                    if( direction == EReadUnknown )
+                        {
+                        iDbHandler->GetSongsAtOffsetL( array, attrs.Array(), offset, numItems );
+                        }
+                    else
+                        {
+                        iDbHandler->GetSongsInBlockL( array, attrs.Array(),
+                                                      aCmd.ValueText( KMPXCollectionCommandIdIncOpenLKeyItem ),
+                                                      numItems,
+                                                      direction );
+                        }
+
+                    // Add "Shuffle" item
+                    if (offset == 0 && array->Count() > 1)
+                        {
+                        //MPXDbCommonUtil::AppendMediaL(*array, *iShuffleAllText, EMPXItem, EMPXCommand,
+                        //0, 0, 0);
+                        MPXDbCommonUtil::PrependMediaL(*array, *iShuffleAllText,
+                                EMPXItem, EMPXCommand, 0, 0, 0, 0);                             
+                        array->AtL(0)->SetTObjectValueL(KMPXMediaColDetailNumberOfItems,
+                            iDbHandler->NumberOfItemsL(EMPXSong));
+                        }
+                    
+                    TInt max( path->Count() );
+                    TInt count(0);
+                    TInt aryCount( array->Count() );
+                    // Update the collection path
+                    while( count<numItems && offset<max &&
+                           count<aryCount )
+                        {
+                        TMPXItemId id = array->AtL(count)->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+                        path->Update( offset, id );
+
+                        // Next items
+                        offset++;
+                        count++;
+                        }
+
+                    // Setup the results
+                    //
+                    results->SetCObjectValueL(KMPXMediaArrayContents, array);
+                    results->SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+                    CleanupStack::PopAndDestroy( array );
+                    CleanupStack::PopAndDestroy( &attrs );
+
+                    // Callback with results
+                    //
+                    results->SetTObjectValueL<TMPXOpenDataBlock>( KMPXCollectionOpenLResultRange, block );
+                    iObs->HandleOpen( results, path, KErrNone );
+                    CleanupStack::PopAndDestroy( results );
+                    break;
+                    }
+                default:
+                    User::Leave(KErrNotSupported);
+                    break;
+                }
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            break;
+            }
+
+        }
+    CleanupStack::PopAndDestroy( path );
+
+    MPX_DEBUG1("CMPXDbPlugin::DoIncrementalOpenL -->");
+    }
+
+// ----------------------------------------------------------------------------
+// Maps a given browse type to a category ID.
+// ----------------------------------------------------------------------------
+//
+TMPXGeneralCategory CMPXDbPlugin::CategoryForBrowseType(
+    TMCBrowseType aBrowseType)
+    {
+    MPX_FUNC("CMPXDbPlugin::CategoryForBrowseType");
+
+    TMPXGeneralCategory cat(EMPXNoCategory);
+
+    switch (aBrowseType)
+        {
+        case EBrowseAll:
+            {
+            cat = EMPXSong;
+            break;
+            }
+        case EBrowseArtist:
+            {
+            cat = EMPXArtist;
+            break;
+            }
+        case EBrowseAlbum:
+            {
+            cat = EMPXAlbum;
+            break;
+            }
+        case EBrowsePlaylist:
+            {
+            cat = EMPXPlaylist;
+            break;
+            }
+        case EBrowseGenre:
+            {
+            cat = EMPXGenre;
+            break;
+            }
+        case EBrowseComposer:
+            {
+            cat = EMPXComposer;
+            break;
+            }
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        case EBrowsePodcasts:
+            {
+            cat = EMPXPodcast;
+            break;
+            }
+#endif
+        default:
+            {
+            // do nothing
+            break;
+            }
+        }
+
+    return cat;
+    }
+
+// ----------------------------------------------------------------------------
+// Maps a given category ID to a browse type.
+// ----------------------------------------------------------------------------
+//
+TMCBrowseType CMPXDbPlugin::BrowseTypeForCategory(
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbPlugin::BrowseTypeForCategory");
+
+    TMCBrowseType browseType(EBrowseComposer);
+
+    switch (aCategory)
+        {
+        case EMPXSong:
+            {
+            browseType = EBrowseAll;
+            break;
+            }
+        case EMPXArtist:
+            {
+            browseType = EBrowseArtist;
+            break;
+            }
+        case EMPXAlbum:
+            {
+            browseType = EBrowseAlbum;
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            browseType = EBrowsePlaylist;
+            break;
+            }
+        case EMPXGenre:
+            {
+            browseType = EBrowseGenre;
+            break;
+            }
+        default:
+            {
+            // do nothing
+            break;
+            }
+        }
+
+    return browseType;
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the type, category and title attributes in the specified media instance
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::SetMediaGeneralAttributesL(
+    CMPXMedia& aMedia,
+    TMPXGeneralType aType,
+    TMPXGeneralCategory aCategory,
+    const TDesC& aTitle)
+    {
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, aType);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, aCategory);
+    aMedia.SetTextValueL(KMPXMediaGeneralTitle, aTitle);
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the type, category and title attributes in the specified media instance
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::SetMediaGeneralAttributesL(
+    CMPXMedia& aMedia,
+    TMPXGeneralType aType,
+    TMPXGeneralCategory aCategory,
+    TInt aId)
+    {
+    MPX_FUNC("CMPXDbPlugin::SetMediaGeneralAttributesL");
+
+    HBufC* title = iDbHandler->GetNameMatchingIdL(aId);
+    CleanupStack::PushL(title);
+    SetMediaGeneralAttributesL(aMedia, aType, aCategory, *title);
+    CleanupStack::PopAndDestroy(title);
+    }
+
+// ----------------------------------------------------------------------------
+// Set the attribute list according to current path
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::SetAttributesL(
+    const CMPXCollectionPath& aPath,
+    RArray<TMPXAttribute>& aAttrs,
+    RArray<TInt>& aSupportedIds )
+    {
+    aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral,
+        EMPXMediaGeneralId | EMPXMediaGeneralType | EMPXMediaGeneralCategory |
+        EMPXMediaGeneralTitle | EMPXMediaGeneralFlags) );
+
+    aSupportedIds.AppendL(KMPXMediaIdContainer);
+    aSupportedIds.AppendL(KMPXMediaIdGeneral);
+
+    TInt levels(aPath.Levels());
+    if ( 2 == levels )
+        {
+        // check the browse type
+        switch ( aPath.Id(1).iId2 )
+            {
+            case EBrowseAll:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+                    EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName ) );
+                aSupportedIds.AppendL( KMPXMediaIdMusic );
+                break;
+                }
+            case EBrowseArtist:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralCount) );
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+                                    EMPXMediaMusicAlbumArtFileName ) );
+                break;
+                }
+            case EBrowseAlbum:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+                    EMPXMediaMusicArtist | EMPXMediaMusicAlbum | EMPXMediaMusicAlbumArtFileName ) );
+                aSupportedIds.AppendL( KMPXMediaIdMusic );
+                break;
+                }
+            case EBrowsePlaylist:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral,
+                    EMPXMediaGeneralCount | EMPXMediaGeneralDuration ) );
+                break;
+                }
+            case EBrowseGenre:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralCount) );
+                break;
+                }
+            case EBrowseComposer:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralCount) );
+                break;
+                }
+            default:
+                {
+                User::Leave(KErrArgument);
+                }
+            }
+        }
+    else if ( 3 == levels )
+        {
+        // check the browse type
+        switch ( aPath.Id(1).iId2 )
+            {
+            case EBrowseArtist:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralCount) );
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic, EMPXMediaMusicAlbumArtFileName ) );
+                aSupportedIds.AppendL( KMPXMediaIdMusic );
+                break;
+                }
+            case EBrowseAlbum:
+            	{
+
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+                    EMPXMediaMusicArtist | EMPXMediaMusicAlbum | EMPXMediaMusicAlbumArtFileName ) );
+                aSupportedIds.AppendL( KMPXMediaIdMusic );
+                break;
+				}
+            case EBrowsePlaylist:
+            case EBrowseGenre:
+            case EBrowseComposer:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+//                    EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName ) );
+                //added ganes
+                    EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName | EMPXMediaMusicAlbum) );
+                aSupportedIds.AppendL( KMPXMediaIdMusic );
+                break;
+                }
+            }
+        }
+    else if ( (4 == levels) && (aPath.Id(1).iId2 == EBrowseArtist) )
+        {
+        aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+            EMPXMediaMusicArtist | EMPXMediaMusicAlbum | EMPXMediaMusicAlbumArtFileName ) );
+        aSupportedIds.AppendL( KMPXMediaIdMusic );
+        }
+    }
+
+#ifdef _DEBUG
+// ----------------------------------------------------------------------------
+// Print change events
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::PrintMessagesL(
+    const CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbPlugin::PrintMessages");
+
+    if (aMessage.IsSupported(KMPXMessageArrayContents))
+        {
+        const CMPXMessageArray* messageArray =
+            aMessage.Value<CMPXMessageArray>(KMPXMessageArrayContents);
+        if( !messageArray )
+            {
+            User::Leave( KErrNoMemory );
+            }
+
+        TInt count(messageArray->Count());
+        MPX_DEBUG2("%d messages:", count);
+
+        for (TInt i = 0; i < count; ++i)
+            {
+            PrintMessage(*((*messageArray)[i]));
+            }
+        }
+    else
+        {
+        PrintMessage(aMessage);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Print one change event
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::PrintMessage(
+    const CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbPlugin::PrintMessage");
+
+    if (aMessage.IsSupported(KMPXMessageGeneralId))
+        {
+        TMPXItemId id = aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageGeneralId);
+        MPX_DEBUG3("    message id[0x%x, 0x%x]", id.iId1, id.iId2);
+        }
+
+    if (aMessage.IsSupported(KMPXMessageCollectionId))
+        {
+        TUid uid = aMessage.ValueTObjectL<TUid>(KMPXMessageCollectionId);
+        MPX_DEBUG2("    uid [0x%x]", uid.iUid);
+        }
+
+    if (aMessage.IsSupported(KMPXMessageChangeEventType))
+        {
+        MPX_DEBUG2("    change event type [%d]",
+            aMessage.ValueTObjectL<TMPXChangeEventType>(KMPXMessageChangeEventType));
+        }
+
+    if (aMessage.IsSupported(KMPXMessageMediaGeneralCategory))
+        {
+        MPX_DEBUG2("    category [%d]",
+            aMessage.ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory));
+        }
+
+    if (aMessage.IsSupported(KMPXMessageMediaGeneralId))
+        {
+        TMPXItemId id = aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId);
+        MPX_DEBUG3("    media id[0x%x, 0x%x]", id.iId1, id.iId2);
+        }
+
+    if (aMessage.IsSupported(KMPXMessageMediaDeprecatedId))
+        {
+        TMPXItemId id = aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageMediaDeprecatedId);
+        MPX_DEBUG3("    deprecated id [0x%x, 0x%x]", id.iId1, id.iId2);
+        }
+    }
+
+#endif// _DEBUG
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+#include <implementationproxy.h>
+#include "mpxdbplugin.h"
+
+#if (!defined IMPLEMENTATION_PROXY_ENTRY)
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) {{aUid},(TProxyNewLPtr)(aFuncPtr)}
+#endif
+
+// ----------------------------------------------------------------------------
+// The list of implementations
+// ----------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    { IMPLEMENTATION_PROXY_ENTRY(0x101FFC3A, CMPXDbPlugin::NewL) };
+
+// ----------------------------------------------------------------------------
+// The proxy of implementations
+// ----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbhgplugin/src/mpxdbutil.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contains utility functions for the DB plugin
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbutil.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Filter out duplicated Ids
+// ----------------------------------------------------------------------------
+//
+void MPXDbUtil::FilterDuplicatedIdsL(
+    const TArray<TUint32>& aIds,
+    RArray<TUint32>& aFilteredIds)
+    {
+    MPX_FUNC("MPXDbUtil::FilterDuplicatedIdsL");
+
+    TInt count(aIds.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        MPX_TRAPD(error, aFilteredIds.InsertInUnsignedKeyOrderL(aIds[i]));
+        if ((error != KErrNone) && (error != KErrAlreadyExists))
+            {
+            User::Leave(error);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbUtil::TableNameForCategoryL
+// ----------------------------------------------------------------------------
+//
+TPtrC MPXDbUtil::TableNameForCategoryL(
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("MPXDbUtil::TableNameForCategoryL");
+
+    TPtrC ptr;
+    switch (aCategory)
+        {
+        case EMPXPlaylist:
+            ptr.Set(KMCPlaylistTable);
+            break;
+        case EMPXArtist:
+            ptr.Set(KMCArtistTable);
+            break;
+        case EMPXAlbum:
+            ptr.Set(KMCAlbumTable);
+            break;
+        case EMPXGenre:
+            ptr.Set(KMCGenreTable);
+            break;
+        case EMPXComposer:
+            ptr.Set(KMCComposerTable);
+            break;
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return ptr;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbUtil::MusicFieldNameForCategoryL
+// ----------------------------------------------------------------------------
+//
+TPtrC MPXDbUtil::MusicFieldNameForCategoryL(
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("MPXDbUtil::MusicFieldNameForCategoryL");
+
+    TPtrC ptr;
+    switch (aCategory)
+        {
+        case EMPXArtist:
+            ptr.Set(KMCMusicArtist);
+            break;
+        case EMPXAlbum:
+            ptr.Set(KMCMusicAlbum);
+            break;
+        case EMPXGenre:
+            ptr.Set(KMCMusicGenre);
+            break;
+        case EMPXComposer:
+            ptr.Set(KMCMusicComposer);
+            break;
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return ptr;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/data/101FFC3E.RSS	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+#include <mpxcollectionplugin.hrh>
+#include "mpxpluginresource.hrh"
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: Supported plugin types.
+ *  E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. for music plugin will be: 0x101FFCDA
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags
+ *         Collection specific flags include:
+ *                EMPXCollectionPluginFlagCacheable - Are media results cachable in the collection cache
+ *         General flags include: 
+ *                EMPXPluginFlagPreLoad - Should the plugin be pre loaded when the collection starts
+ *                
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXCollectionPluginPriorities. This value determines
+ *  the returning order when several plugins can support the same set of Uids. 
+ *  Default value of this field is EMPXCollectionPluginPriorityNormal.
+ *
+ * <c>non-cacheable attributes</c> optional
+ *  List of content IDs that cannot be cached in the collection cache.
+ *  The list is a list of hexidecimal numbers, semicolon seperated
+ *  For example, <c>0x101FFC45</c> not cache media objects w/ drm attributes
+ *
+ */
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC3E;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXCollectionPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x101FFC3A;
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "audio/mp3;audio/x-mp3;audio/mp4;audio/3gpp;audio/3gpp2;audio/wav;audio/x-wav;audio/x-au;audio/au;audio/3gp;audio/mpeg;audio/aac;audio/x-ms-wma;x-caf-audio/x-ms-wma;audio/x-pn-realaudio;audio/x-realaudio;audio/vnd.rn-realaudio";
+                    opaque_data = "<s>*<e>.mp3;.aac;.3gp;.3gpp;.3g2;.3gpp2;.m4a;.wav;.mp4;.wma;.dcf;.odf;.asf;.m3u;.rm;.ra;.o4a;.dm;.3ga"
+                                  "<t>"EMPXCollectionPluginMusic"</t>"
+                                  "<i>"EMPXPluginPriorityNormal"</i>"
+                                  "<c>"EDRMContentId"</c>" // DRM
+                                  "<f>"EPreloadAndCache"</f>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/data/mpxcollectiondbres.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,292 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file contains all the resources for the Music Collection
+*
+*/
+
+
+//  INCLUDES
+#include <bldvariant.hrh>
+#include <badef.rh>
+#include <pathconfiguration.hrh>
+#include "mpxcollectiondb.hrh"
+#include <mpxcollectiondb.loc>
+
+STRUCT MENU_ITEM
+    {
+    LONG   id;
+    STRUCT name;
+    }
+
+STRUCT MENU_ITEM_ARRAY
+    {
+    STRUCT array_of_menu_items[];
+    }
+
+//  RESOURCE IDENTIFIER
+NAME    OAMC // 4 letter ID
+
+//  RESOURCE DEFINITIONS
+
+RESOURCE BA_RSS_SIGNATURE { }
+
+//----------------------------------------------------
+//
+//    r_mc_music_library_menu_items
+//    Menu items to be displayed in the music library view
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_ITEM_ARRAY r_mc_menu_items_array
+    {
+    array_of_menu_items =
+        {
+        MENU_ITEM {id = EBrowseAll;      name = LBUF {txt = qtn_mus_all_tracks;};},
+        MENU_ITEM {id = EBrowsePlaylist; name = LBUF {txt = qtn_mus_playlists;};},
+        MENU_ITEM {id = EBrowseArtist;   name = LBUF {txt = qtn_mus_artists;};},
+        MENU_ITEM {id = EBrowseAlbum;    name = LBUF {txt = qtn_mus_albums;};},
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU        
+        MENU_ITEM {id = EBrowsePodcasts; name = LBUF {txt = qtn_mus_podcasts;};},
+#endif
+        MENU_ITEM {id = EBrowseGenre;    name = LBUF {txt = qtn_mus_genres;};},
+        MENU_ITEM {id = EBrowseComposer; name = LBUF {txt = qtn_mus_composers;};}        
+        };
+    }
+
+RESOURCE TBUF { buf="MPXCOLLECTIONDBRES"; }
+
+//----------------------------------------------------
+//
+//    r_mc_music_library_title_items
+//    titles to be displayed in the music player
+//
+//    added album for ganes
+//----------------------------------------------------
+//
+RESOURCE MENU_ITEM_ARRAY r_mc_title_items_array
+    {
+    array_of_menu_items =
+        {
+        MENU_ITEM {id = EBrowseAll;      name = LBUF {txt = qtn_mus_title_all_tracks;};},
+        MENU_ITEM {id = EBrowsePlaylist; name = LBUF {txt = qtn_mus_title_pls;};},
+        MENU_ITEM {id = EBrowseArtist;   name = LBUF {txt = qtn_mus_title_artists;};},
+        MENU_ITEM {id = EBrowseAlbum;    name = LBUF {txt = qtn_mus_title_albums;};},
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU                
+        MENU_ITEM {id = EBrowsePodcasts; name = LBUF {txt = qtn_mus_podcasts;};},
+#endif        
+        MENU_ITEM {id = EBrowseGenre;    name = LBUF {txt = qtn_mus_title_genres;};},
+        MENU_ITEM {id = EBrowseComposer; name = LBUF {txt = qtn_mus_title_composers;};},     
+        MENU_ITEM {id = EBrowseAlbumSong;    name = LBUF {txt = qtn_mus_title_album;};}
+        };
+    }
+
+
+// ** DEFAULT MUSIC FOLDER STRINGS
+
+//----------------------------------------------------
+//
+//    r_mc_default_music_folders
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_default_music_folders
+    {
+    items =
+        {
+        LBUF {txt = text_memory_card_root_path;},
+        LBUF {txt = text_phone_memory_root_path;}
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_mc_music_file_extensions
+//    file extensions which be scanned by music collection
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_music_file_extensions
+    {
+    items =
+        {
+#if (defined __WMA || defined __WINDOWS_MEDIA)
+        LBUF {txt = ".wma";},
+#endif
+        LBUF {txt = ".mp3";},
+        LBUF {txt = ".m4a";},
+        LBUF {txt = ".aac";}
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_mc_file_extensions_mime
+//    file extensions which can be scanned by music
+//    collection, however, these files types must be
+//    checked whether their MIME types match as well
+//    because they can be DRM or video files
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_file_extensions_mime
+    {
+    items =
+        {
+        LBUF {txt = "";},
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+        LBUF {txt = ".ra";},
+        LBUF {txt = ".rm";},
+#endif
+        LBUF {txt = ".mp4";},
+        LBUF {txt = ".3gpp";},
+        LBUF {txt = ".3gp";},
+        LBUF {txt = ".3gpp2";},
+        LBUF {txt = ".3g2";},
+        LBUF {txt = ".3ga";},
+        LBUF {txt = ".dcf";},
+        LBUF {txt = ".dm";},
+        LBUF {txt = ".odf";}
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_mc_file_extensions_drm
+//    file extensions which can be scanned by music
+//    collection, however, these files types must be
+//    checked which type of DRM is used
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_file_extensions_drm
+    {
+    items =
+        {
+        LBUF {txt = "";},
+        LBUF {txt = ".dcf";},
+        LBUF {txt = ".dm";},
+        LBUF {txt = ".odf";},
+        LBUF {txt = ".o4a";}
+        };
+    }
+
+//----------------------------------------------------
+//
+//    r_mc_mime_types
+//    Mime types which be scanned by music collection
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_mime_types
+    {
+    items =
+        {
+#ifdef __WMA
+        LBUF {txt = "audio/x-ms-wma";},
+#endif
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+        LBUF {txt = "audio/x-pn-realaudio";},
+        LBUF {txt = "audio/x-realaudio";},
+        LBUF {txt = "audio/vnd.rn-realaudio";},
+//        LBUF {txt = "application/vnd.rn-realmedia";}
+#endif
+        LBUF {txt = "audio/mpeg";},
+        LBUF {txt = "audio/aac";},
+        LBUF {txt = "audio/mp3";},
+        LBUF {txt = "audio/x-mp3";},
+        LBUF {txt = "audio/mp4";},
+        LBUF {txt = "audio/3gpp";},
+        LBUF {txt = "audio/m4a";},
+        LBUF {txt = "audio/3gpp2";},
+        LBUF {txt = "audio/mpeg4";}
+        };
+    }
+
+// ** All songs for an artist
+RESOURCE LBUF r_mc_all_songs_for_artist
+    {
+    txt = qtn_nmp_all_by;
+    }
+
+// ** Recently played
+RESOURCE LBUF r_mc_recently_played_playlist
+    {
+    txt = qtn_mus_pl_recently_played;
+    }
+
+// ** Most played
+RESOURCE LBUF r_mc_most_played_playlist
+    {
+    txt = qtn_mus_pl_most_played;
+    }
+
+// ** Recently added
+RESOURCE LBUF r_mc_recently_added_playlist
+    {
+    txt = qtn_mus_pl_recently_downloaded;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_music_num_songs
+// Number of songs text
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_music_num_songs
+    {
+    txt = qtn_mus_music_num_songs;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_music_one_song
+// One song text
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_music_one_song
+    {
+    txt = qtn_mus_music_one_song;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_music
+// Collection Plugin Name
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_music
+    {
+    txt = qtn_mus_music;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_title_music_menu
+// Music Menu Title
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_title_music_menu
+    {
+    txt = qtn_mus_title_music_menu;
+    }
+
+#ifdef __ENABLE_MUSIC_TEXT_ALIGNMENT
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mp_title_my_music_menu_nseries
+// My Music Menu Title
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mp_title_my_music_menu_nseries
+    {
+    txt = qtn_mp_title_my_music_menu_nseries;
+    }
+#endif //__ENABLE_MUSIC_TEXT_ALIGNMENT
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project Collection DBMS plugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxcollectiondb.loc	APP_LAYER_LOC_EXPORT_PATH(mpxcollectiondb.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxdbplugin.mif
+OPTION HEADERFILE mpxdbplugin.mbg
+OPTION SOURCES -c8,8 qgn_graf_mup_dlst_music
+END
+
+
+PRJ_MMPFILES
+
+mpxsqlitedbplugin.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1 @@
+/c8,8 qgn_graf_mup_dlst_music
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/group/mpxdbpluginicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  Icons makefile for project mpxdbplugin
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxdbplugin.mif
+HEADERFILENAME=$(HEADERDIR)/mpxdbplugin.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/group/mpxsqlitedbplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Collection file db plugin project specification
+*
+*/
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxsqlitedbplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC3E
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN
+
+VERSION 15.0
+
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+#define __ENABLE_PODCAST_IN_MUSIC_MENU
+//MACRO RD_MPX_COLLECTION_CACHE
+
+SOURCEPATH      ../src
+SOURCE          mpxdbplugin.cpp
+SOURCE          mpxdbpluginproxy.cpp
+SOURCE          mpxdbutil.cpp
+
+SOURCE          mpxcollectiondbmanager.cpp
+
+SOURCE          mpxdbcategory.cpp
+SOURCE          mpxdbmusic.cpp
+SOURCE          mpxdbplaylist.cpp
+SOURCE          mpxdbplaylistsongs.cpp
+SOURCE          mpxdbauxiliary.cpp
+SOURCE          mpxdbautoplaylist.cpp
+SOURCE          mpxdbhandler.cpp
+SOURCE          mpxdbartist.cpp
+SOURCE          mpxdbalbum.cpp
+SOURCE          mpxdbgenre.cpp
+SOURCE          mpxdbcomposer.cpp
+
+SOURCEPATH       ../data
+START RESOURCE  mpxcollectiondbres.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END
+
+SOURCEPATH      ../data
+START RESOURCE  101FFC3E.RSS
+TARGET          mpxsqlitedbplugin.rsc
+END
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+LIBRARY         sqldb.lib
+LIBRARY         bafl.lib
+LIBRARY         apmime.lib
+LIBRARY         sysutil.lib
+#ifdef __MTP_PROTOCOL_SUPPORT
+LIBRARY         centralrepository.lib
+#endif
+#ifdef RD_MULTIPLE_DRIVE
+LIBRARY         PlatformEnv.lib
+#endif //RD_MULTIPLE_DRIVE
+
+LIBRARY         mpxsqlitedbcommon.lib
+LIBRARY         mpxcommon.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxcollectiondb.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file contains declarations for constants of Music
+*                Collection. The file can be included in C++ or resource file.
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONDB_HRH
+#define MPXCOLLECTIONDB_HRH
+
+enum TMCBrowseType
+    {
+    EBrowseAll = 0,
+    EBrowsePlaylist,
+    EBrowseArtist,
+    EBrowseAlbum,
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU            
+    EBrowsePodcasts,
+#endif    
+    EBrowseGenre,
+    EBrowseComposer,        
+    EBrowseAlbumSong //added for ganes
+    };
+
+#endif      // MPXCOLLECTIONDB_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxcollectiondbdef.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This header file contains macro definitions used by the
+*                database subsystem.
+*
+*/
+
+#ifndef MPXCOLLECTIONDBDEF_H
+#define MPXCOLLECTIONDBDEF_H
+
+// INCLUDES
+#include <mmfmeta.h>
+
+// CONSTANTS
+
+// ================================== DATABASE ================================
+
+// Db filename
+_LIT(KMCDbFile, "mpxv2_5.db");
+
+// Collection Db resource file
+_LIT(KMPXCollectionDbResourceFile,  "mpxcollectiondbres.rsc");
+
+// == TABLE NAMES =============================================================
+// The Auxiliary table stores general database metadata
+_LIT(KMCAuxiliaryTable,             "Auxiliary");
+// The Music table stores songs information
+_LIT(KMCMusicTable,                 "Music");
+// The Playlist table stores playlists information
+_LIT(KMCPlaylistTable,              "Playlist");
+// The PlaylistSongs table stores the song instances for each playlist
+_LIT(KMCPlaylistSongsTable,         "PlaylistSongs");
+// The PlaylistSongInfo table stores the songs that are included in playlists
+_LIT(KMCPlaylistSongInfoTable,      "PlaylistSongInfo");
+// The Artist table stores artist information
+_LIT(KMCArtistTable,                "Artist");
+// The Album table stores albums information
+_LIT(KMCAlbumTable,                 "Album");
+// The Genre table stores genres information
+_LIT(KMCGenreTable,                 "Genre");
+// The Composer table stores composers information
+_LIT(KMCComposerTable,              "Composer");
+
+// == Music TABLE FIELDS ======================================================
+_LIT(KMCMusicUniqueId,          "UniqueId");
+
+// From MMF (MmfMeta.h)
+#define KMCMusicName                KMMFMetaEntrySongTitle           // "title"
+#define KMCMusicArtist              KMMFMetaEntryArtist              // "artist"
+#define KMCMusicAlbum               KMMFMetaEntryAlbum               // "album"
+#define KMCMusicTrackNumber         KMMFMetaEntryAlbumTrack          // "albumtrack"
+#define KMCMusicGenre               KMMFMetaEntryGenre               // "genre"
+#define KMCMusicComposer            KMMFMetaEntryComposer            // "composer"
+#define KMCMusicComment             KMMFMetaEntryComment             // "comment"
+#define KMCMusicCopyright           KMMFMetaEntryCopyright           // "copyright"
+#define KMCMusicOrigArtist          KMMFMetaEntryOriginalArtist      // "originalartist"
+//end of MMF support data
+
+// NOTE: Location will store the path without drive letter
+_LIT(KMCMusicLocation,              "Location");
+_LIT(KMCMusicDuration,              "Duration");
+_LIT(KMCMusicReleaseDate,           "ReleaseDate");
+_LIT(KMCMusicTimeAdded,             "TimeAdded");
+_LIT(KMCMusicPlayCount,             "PlayCount");
+_LIT(KMCMusicTimePlayed,            "TimePlayed");
+_LIT(KMCMusicRating,                "Rating");
+_LIT(KMCMusicArt,                   "Art");
+_LIT(KMCMusicDbFlag,                "DbFlag");
+_LIT(KMCMusicSync,                  "Sync");
+_LIT(KMCMusicMod,                   "Modified");
+_LIT(KMCMusicDel,                   "Deleted");
+_LIT(KMCMusicUrl,                   "Url");
+_LIT(KMCMusicDRM,                   "DRM");
+_LIT(KMCMusicLastPlayPosition,      "LastPlayPosition");
+_LIT(KMCMusicSampleRate,            "SampleRate");
+_LIT(KMCMusicBitRate,               "BitRate");
+_LIT(KMCMusicVolumeId,              "VolumeId");
+
+// Number of channels: required by MTP to support Play4sure
+_LIT(KMCMusicNumChannels,           "NumChannels");
+
+// Audio Codec: required by MTP to support Play4sure
+_LIT(KMCMusicCodec,                 "Codec");
+_LIT(KMCMusicMimeType,              "MimeType");
+_LIT(KMCMusicMTPDrmStatus,          "MTPDrmStatus");
+
+// == Category TABLE FIELDS ===================================================
+_LIT(KMCCategoryUniqueId,           "UniqueId");
+_LIT(KMCCategoryName,               "Name");
+_LIT(KMCCategorySongCount,          "SongCount");
+
+// == Playlist TABLE FIELDS ===================================================
+_LIT(KMCPlaylistUniqueId,           "UniqueId");
+_LIT(KMCPlaylistName,               "Name");
+_LIT(KMCPlaylistUri,                "Uri");
+_LIT(KMCPlaylistVolumeId,           "VolumeId");
+_LIT(KMCPlaylistSync,               "Sync");
+_LIT(KMCPlaylistDbFlag,             "DbFlag");
+_LIT(KMCPlaylistTime,               "Time");
+
+// == PlaylistSongs TABLE FIELDS ==============================================
+_LIT(KMCPlaylistSongsUniqueId,      "UniqueId");
+_LIT(KMCPlaylistSongsSongId,        "SongId");
+_LIT(KMCPlaylistSongsPlaylistId,        "PlaylistId");
+_LIT(KMCPlaylistSongsOrdinal,   "Ordinal");
+
+// == PlaylistSongInfo TABLE FIELDS ===========================================
+_LIT(KMCPlaylistSongInfoSongId,     "SongId");
+_LIT(KMCPlaylistSongInfoUri,        "Uri");
+_LIT(KMCPlaylistSongInfoTitle,      "Title");
+_LIT(KMCPlaylistSongInfoVolumeId,   "VolumeId");
+_LIT(KMCPlaylistSongInfoDbFlag,     "DbFlag");
+
+// == Auxiliary TABLE FIELDS ==================================================
+// Version of database
+// The version integer looks like:
+// 31     23      15           0 bit
+// -----------------------------
+// |Major |Minor  |Build       |
+// -----------------------------
+_LIT(KMCAuxVersion,                 "Version");
+
+// Last time db was refreshed
+_LIT(KMCAuxTimeRefresh,             "TimeRefreshed");
+
+// Last time db was synced
+_LIT(KMCAuxTimeSync,                "TimeSynced");
+
+// Database Corrupted bit
+_LIT(KMCMusicCorruptDB,             "Corrupt");
+
+// Number of records that have been marked as deleted
+_LIT(KMCSavedDeletedRecordCount,    "SaveDeletedRecordCount");
+
+#endif // MPXCOLLECTIONDBDEF_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxcollectiondbmanager.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for managing all of music collection
+*                databases.
+*
+*/
+
+
+#ifndef MPXCOLLECTIONDBMANAGER_H
+#define MPXCOLLECTIONDBMANAGER_H
+
+// INCLUDES
+
+#include "mpxdbmanager.h"
+
+// CLASS DECLARATION
+
+/**
+* Database manager specialization for the collection plugin.
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXCollectionDbManager :
+    public CMPXDbManager
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return The constructed object of CMPXDbManager
+        */
+        static CMPXCollectionDbManager* NewL(RFs& aFs);
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return The constructed object of CMPXDbManager
+        */
+        static CMPXCollectionDbManager* NewLC(RFs& aFs);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXCollectionDbManager();
+
+    private:
+
+        /**
+        * C++ default constructor
+        * @param aFs file server session
+        */
+        CMPXCollectionDbManager(RFs& aFs);
+
+        /**
+        * The second phase constructor ConstructL to safely construct things
+        * that can leave
+        */
+        void ConstructL();
+    };
+
+#endif  // MPXCOLLECTIONDBMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxcollectiondbstd.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2006,2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This header file contains constants definitions and type
+*                definition
+*
+*/
+
+
+#ifndef MPXCOLLECTIONDBSTD_H
+#define MPXCOLLECTIONDBSTD_H
+
+// CONSTANTS
+enum TMPXAutoPlaylistType
+    {
+    EMPXNoAutoPlaylist = -1,
+    EMPXRecentlyPlayedPlaylist,
+    EMPXMostPlayedPlaylist,
+    EMPXRecentlyAddedPlaylist,
+    EMPXAutoPlaylistCount
+    };
+
+const TInt KDBPluginUid = 0x101FFC3A;
+
+const TInt KMPXMaxRecentlyPlayedSongs = 20;
+const TInt KMPXMaxMostPlayedSongs = 20;
+const TInt KMPXRecentlyAddedInterval = 7;
+
+const TInt KMCMaxTextLen          = 255; // Maximum field size for categories is 255
+
+#endif // MPXCOLLECTIONDBSTD_H
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbalbum.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for all category tables (Artist,
+*                Album, Genre, Composer).
+*
+*
+*/
+
+
+#ifndef MPXDBALBUM_H
+#define MPXDBALBUM_H
+
+// INCLUDES
+#include "mpxdbcategory.h"
+
+// CLASS DECLARATION
+
+class MMPXDbAlbumObserver
+    {
+    public:
+        virtual TInt HandleIsUnknownArtistL(TUint32 aId) = 0;    
+        virtual TUint32 HandleArtistForAlbumL( const TUint32 aId ) = 0;
+    };
+/**
+* Responsible for managing all music databases
+*
+* @lib MPXDbPlugin.lib
+*/
+
+class CMPXDbAlbum :
+    public CMPXDbCategory
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance.
+        */
+        static CMPXDbAlbum* NewL(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory, MMPXDbAlbumObserver& aObserver);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance on the cleanup stack.
+        */
+        static CMPXDbAlbum* NewLC(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory, MMPXDbAlbumObserver& aObserver);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbAlbum();
+
+    public:
+
+        /**
+        * Add a category item. If the record already exists, its counter will
+        * be incremented.
+        * @param aName: This is the name to be entered into the row
+        * @param aDriveId: The Drive Id the name (category) belongs
+        * @param aNewRecord: indicates to the caller if a new record is created.
+        *        ETrue if a new row is created in the table; otherwise EFalse.
+        * @param aCaseSensitive indicates whether case sensitivity should be taken
+        *        into consideration when generating the unique row id
+        * @return The unique id of the row added.
+        */
+        TUint32 AddItemL(const TDesC& aName, TUint32 aArtist, const TDesC& aArt, TInt aDriveId, TBool& aNewRecord,
+            TBool aCaseSensitive = ETrue);
+
+        /**
+        * Decrement the number of songs for the item. If the count gets to 0, remove
+        * the item.
+        * @param aId: The ID of the category to delete.
+        * @param aDriveId: The drive Id the name (category) belongs to. Songs on different
+        *                  drives may belong to the same album or artist; consequently, one
+        *                  row for each artist/album id and drive ID pair will exist in the
+        *                  lookup table with a count existing for each row that tracks the
+        *                  number number of songs on that drive with that album/artist.
+        * @param aItemChangedMessages if valid on return contains a deleted message if the
+        *                  category was deleted
+        * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete,
+        *        EFalse otherwise
+		* @param aArtist: The ID of the artist
+        */
+        void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
+            CMPXMessageArray* aItemChangedMessages, TBool& aItemExist, const TUint32 aArtist);
+        
+		/**
+	* Gets the details for all category items.
+	* @param aAttrs attributes to be returned
+	* @param aMediaArray returns the requested attributes for all items
+	*/
+		void GetAllCategoryItemsL(const TArray<TMPXAttribute>& aAttrs,
+			CMPXMediaArray& aMediaArray);
+
+		/**
+	* Update a category item. 
+	* @param aId: The ID of the category to update
+	* @param aMedia: The media data
+	* @param aDriveId: The Drive Id the name (category) belongs
+	* @param aItemChangedMessages: if valid on return contains a updated message if the
+    *        category was updated
+	*/
+		void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
+
+	public:
+		/**
+	* Get albums count for a specified artist
+	* @param aId: The ID of the artist
+	*/		
+	    TInt GetAlbumsCountForArtistL(TUint32 aArtistId);
+
+		/**
+	* Get songs count for a specified album and a specified artist
+	* @param aArtistId: The ID of the artist
+	* @param aAlbumId: The ID of the album
+	*/		
+		TInt GetSongsCountInAlbumMatchingArtistL(TUint32 aArtistId, TUint32 aAlbumId);
+		
+    private:	
+        /**
+        * Updates the media with information from the table
+        * @param aRecord record containing the source fields
+        * @param aAttrs attributes to be returned
+        * @param aMedia returns the requested attributes
+        */
+        void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+         /**
+        * Generate searching criteria for album table from the given criteria
+        * @param aMedia media data
+        * @param aFields fields of Album table
+        * @param aValues values of each field of Album table
+        * @return a string containing the selection criteria. The ownership is passed to the caller.
+        */
+		void GenerateAlbumFieldsValuesL(const CMPXMedia& aMedia, 
+			CDesCArray& aFields, CDesCArray& aValues);
+
+
+		TBool IsUnknownArtistL(TUint32 aId);
+		
+		TUint32 ArtistForAlbumL(const TUint32 aId);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        */
+        CMPXDbAlbum(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory, MMPXDbAlbumObserver& aObserver);
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL();
+
+    public:
+
+        /**
+        * Column indexes in the category tables
+        */
+        enum TAlbumColumns
+            {
+            EAlbumUniqueId = KMPXTableDefaultIndex,
+            EAlbumName,
+            EAlbumSongCount,
+            EAlbumArtist,
+            EAlbumArt,
+            EAlbumArtistName,
+            EAlbumFieldCount
+            };
+
+    private:    // Data
+        MMPXDbAlbumObserver& iObserver;
+    };
+#endif // MPXDBALBUM_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbartist.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for Artist table.
+*
+*
+*/
+
+
+#ifndef MPXDBARTIST_H
+#define MPXDBARTIST_H
+
+// INCLUDES
+#include "mpxdbcategory.h"
+
+// CLASS DECLARATION
+class MMPXDbArtistObserver
+    {
+    public:
+		virtual TInt HandleGetAlbumsCountForArtistL(TUint32 aId) = 0;
+	};
+
+/**
+* Responsible for managing all music databases
+*
+* @lib MPXDbPlugin.lib
+*/
+
+class CMPXDbArtist :
+    public CMPXDbCategory
+    {
+    public:
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbArtist instance.
+        */
+        static CMPXDbArtist* NewL(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory, MMPXDbArtistObserver& aObserver);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbArtist instance on the cleanup stack.
+        */
+        static CMPXDbArtist* NewLC(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory, MMPXDbArtistObserver& aObserver);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbArtist();
+       
+    public:
+        /**
+        * Add a category item. If the record already exists, its counter will
+        * be incremented.
+        * @param aName: This is the name to be entered into the row
+        * @param aDriveId: The Drive Id the name (category) belongs
+        * @param aNewRecord: indicates to the caller if a new record is created.
+        *        ETrue if a new row is created in the table; otherwise EFalse.
+        * @param aCaseSensitive indicates whether case sensitivity should be taken
+        *        into consideration when generating the unique row id
+        * @return The unique id of the row added.
+        */
+        TUint32 AddItemL(const TDesC& aName, const TDesC& aArt, TInt aDriveId, TBool& aNewRecord,
+            TBool aCaseSensitive = ETrue);
+        
+        /**
+        * Gets the details for all category items.
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray returns the requested attributes for all items
+        */
+        void GetAllCategoryItemsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+        
+        /**
+        * Update a category item. 
+        * @param aId: The ID of the category to update
+        * @param aMedia: The media data
+        * @param aDriveId: The Drive Id the name (category) belongs
+        * @param aItemChangedMessages: if valid on return contains a updated message if the
+        *        category was updated
+        */
+        void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
+        
+        /*
+        * Checks if the specified artist item is unknown
+        * @param aId identifies the artist item
+        * @return ETrue if it is unknown, EFalse otherwise
+        */        
+        TBool IsUnknownArtistL(TUint32 aId);
+        
+    private:
+
+        /**
+        * Updates the media with information from the table
+        * @param aRecord record containing the source fields
+        * @param aAttrs attributes to be returned
+        * @param aMedia returns the requested attributes
+        */
+        void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Generate searching criteria for artist table from the given criteria
+        * @param aMedia media data
+        * @param aFields fields of Artist table
+        * @param aValues values of each field of Artist table
+        * @return a string containing the selection criteria. The ownership is passed to the caller.
+        */
+        void GenerateArtistFieldsValuesL(const CMPXMedia& aMedia, 
+            CDesCArray& aFields, CDesCArray& aValues);
+       
+        /**
+        * Gets the Album counts for a Artist item
+        * @param aId identifies the Artist item
+        * @return value of the Album counts
+        */
+        TInt GetAlbumsCountL(TUint32 aId);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+        
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        */
+        CMPXDbArtist(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory, MMPXDbArtistObserver& aObserver);
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the category tables
+        */
+        enum TArtistColumns
+            {
+            EArtistUniqueId = KMPXTableDefaultIndex,
+            EArtistName,
+            EArtistSongCount,
+            EArtistArt,
+            EArtistFieldCount
+            };
+
+    private:    // Data
+        MMPXDbArtistObserver& iObserver;
+    };
+#endif // MPXDBARTIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbautoplaylist.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for the auto playlist functionality.
+*
+*/
+
+
+#ifndef MPXDBAUTOPLAYLIST_H
+#define MPXDBAUTOPLAYLIST_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxattribute.h>
+
+// CLASS FORWARDS
+class CMPXMedia;
+class CMPXMediaArray;
+class CMPXDbManager;
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing the music table
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbAutoPlaylist :
+    public CBase
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @return new CMPXDbAutoPlaylist instance.
+        */
+        static CMPXDbAutoPlaylist* NewL(CMPXDbManager& aDbManager, RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Two-phased constructor.
+        * @return new CMPXDbAutoPlaylist instance on the cleanup stack.
+        */
+        static CMPXDbAutoPlaylist* NewLC(CMPXDbManager& aDbManager, RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbAutoPlaylist();
+
+    public:
+
+        /**
+        * Get the playlist ID of an auto-playlist by type
+        * @param aPlaylistType type of the auto-playlist
+        * @return auto playlist ID
+        * @leave KErrNotSupported if invalid playlist type
+        */
+        TUint32 AutoPlaylistIdL(TMPXAutoPlaylistType aPlaylistType);
+
+        /**
+        * Get the name of an auto playlist
+        * @param aPlaylistId identifies the playlist
+        * @return the name of the playlist
+        * @leave KErrNotSupported if invalid playlist ID
+        */
+        TPtrC AutoPlaylistNameL(TUint32 aPlaylistId);
+
+        /**
+        * Checks whether the playlist ID corresponds to an auto playlist or not.
+        * @param aPlaylistId identifies the playlist
+        * @return Auto playlist type or EMPXNoAutoPlaylist if not found
+        */
+        TMPXAutoPlaylistType AutoPlaylistTypeL(TUint32 aPlaylistId);
+
+        /**
+        * Get information on a specified playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aAttrs the attributes to include for the playlists found.
+        * @param aMedia returns the playlist information
+        * @leave KErrNotSupported if invalid playlist ID
+        */
+        void GetPlaylistL(TUint32 aPlaylistId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Get information on all auto playlists
+        * @param aMediaArray returns information on all auto playlists
+        */
+        void GetAllPlaylistsL(CMPXMediaArray& aMediaArray);
+
+    private:
+        
+        /**
+        * Get count and duration information of the auto-playlist
+        * @param aType the type of the auto-playlist
+        * @param aCount reference to count to be returned
+        * @param aDuration reference to duration to be returned
+        */
+        void GetPlaylistDetailsL(TMPXAutoPlaylistType aType, TInt& aCount, TInt& aDuration);
+
+        /**
+        * Update the media with information about the auto-playlist
+        * @param aPlaylistId Id of the auto-playlist
+        * @param aAttrs the attributes to include for the playlist matching the
+        *        selection criteria
+        * @param aMedia the playlist details object
+        */
+        void UpdateMediaL(TUint32 aPlaylistId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+    private:
+
+        /**
+        * C++ constructor
+        */
+        CMPXDbAutoPlaylist(CMPXDbManager& aDbManager);
+
+        /**
+        * Second phase constructor
+        */
+        void ConstructL(RFs& aFs, CMPXResource& aResource);
+
+    private:    // Data
+        TUint32             iRecentlyPlayedPlaylistId; // recently played playlist ID
+        TUint32             iMostPlayedPlaylistId;     // most played playlist ID
+        TUint32             iRecentlyAddedPlaylistId;  // recently added playlist ID
+
+        // owned
+        HBufC*              iRecentlyPlayedPlaylist;   // recently played playlist name
+        HBufC*              iMostPlayedPlaylist;       // most played playlist name
+        HBufC*              iRecentlyAddedPlaylist;    // recently added playlist name
+        CMPXDbManager&      iDbManager;
+    };
+
+#endif // MPXDBAUTOPLAYLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbauxiliary.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for interacting with the Auxiliary
+*                table.
+*
+*/
+
+
+#ifndef MPXDBAUXILIARY_H
+#define MPXDBAUXILIARY_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing the playlist tables
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbAuxiliary :
+    public CMPXDbTable
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbManager instance.
+        */
+        static CMPXDbAuxiliary* NewL(CMPXDbManager& aDbManager);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbManager instance on the cleanup stack.
+        */
+        static CMPXDbAuxiliary* NewLC(CMPXDbManager& aDbManager);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbAuxiliary();
+
+    public:
+
+        /**
+        * Sets the last refreshed time in the auxiliary table.
+        * @param aTime the last refreshed time value
+        */
+        void SetLastRefreshedTimeL(TTime aTime);
+
+        /**
+        * Gets the last refreshed time from the auxiliary table.
+        * @return last refreshed time value
+        */
+        TTime LastRefreshedTimeL();
+
+        /**
+        * Sets the db corrupted flag in the auxiliary table.
+        * @param aCorrupted db corrupted flag value
+        */
+        void SetDBCorruptedL(TBool aCorrupted);
+
+        /**
+        * Gets the db corrupted flag value from the auxiliary table.
+        * @return db corrupted flag value
+        */
+        TBool DBCorruptedL();
+
+        /**
+        * Sets the save deleted record count value.
+        * @param aDrive drive identifier
+        * @param aValue new field value
+        *
+        */
+        void SetSaveDeletedRecordCountL(TInt aDrive,TUint32 aValue);
+
+        /**
+        * Gets the save deleted record count field value.
+        * @return field value
+        */
+        TUint32 SaveDeletedRecordCountL();
+
+        /**
+         * Gets the save deleted record count field value.
+         * @param aDrive drive identifier
+         * @return field value
+         */
+         TUint32 SaveDeletedRecordCountL(TInt aDrive);
+
+        /**
+        * Checks if all databases have been refreshed.
+        * @return EFalse if at least one database has not been refreshed.
+        */
+        TBool IsRefreshedL();
+
+        /**
+        * Get the auxilary id for a drive
+        * @param aDrive drive to get the volume id
+        * @return TInt id for the aux database
+        */
+        TInt IdL( TInt aDrive );
+
+        /**
+        * Set the auxilary id for a drive
+        * @param aDrive,
+        * @param aId
+        */
+        void SetIdL( TInt aDrive, TInt aId );
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor
+        * @param aDbManager database manager to use for database interactions
+        */
+        CMPXDbAuxiliary(CMPXDbManager& aDbManager);
+
+        /**
+        * Safely construct things that can leave
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the auxiliary table
+        */
+        enum TAuxiliaryColumns
+            {
+            EAuxiliaryId = KMPXTableDefaultIndex,
+            EAuxiliaryVersion,
+            EAuxiliaryTimeRefreshed,
+            EAuxiliaryTimeSynced,
+            EAuxiliaryCorrupt,
+            EAuxiliarySavedDeletedRecordCount
+            };
+
+    };
+
+#endif // MPXDBAUXILIARY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbcategory.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,268 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for all category tables (Artist,
+*                Album, Genre, Composer).
+*
+*
+*/
+
+
+#ifndef MPXDBCATEGORY_H
+#define MPXDBCATEGORY_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+#include "mpxmediageneraldefs.h"
+#include "mpxmessage2.h"
+
+// CLASS FORWARDS
+class CMPXMedia;
+class CMPXMediaArray;
+class RSqlStatement;
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing all music databases
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbCategory :
+    public CMPXDbTable
+    {
+    protected:
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbCategory();
+
+
+    public:
+
+        /**
+        * Add a category item. If the record already exists, its counter will
+        * be incremented.
+        * @param aName: This is the name to be entered into the row
+        * @param aDriveId: The Drive Id the name (category) belongs
+        * @param aNewRecord: indicates to the caller if a new record is created.
+        *        ETrue if a new row is created in the table; otherwise EFalse.
+        * @param aCaseSensitive indicates whether case sensitivity should be taken
+        *        into consideration when generating the unique row id
+        * @return The unique id of the row added.
+        */
+        TUint32 AddItemL(const TDesC& aName, TInt aDriveId, TBool& aNewRecord,
+            TBool aCaseSensitive = ETrue);
+
+        /**
+        * Get the name field for a given ID.
+        * @param aId identifies the category item
+        * @return name that matches aId. Ownership is abandoned.
+        */
+        HBufC* GetNameL(TUint32 aId);
+
+        /**
+        * Gets the total number of items in the category table.
+        * @return number of items
+        */
+        TInt CountL();
+
+        /**
+        * Find record(s) matching the criteria
+        * @param aCriteria, selection criteria
+        * @param aAttrs, attributes for the matching record(s)
+        * @param aMediaArray returns the matching record(s)
+        */
+        void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Decrement the number of songs for the item. If the count gets to 0, remove
+        * the item.
+        * @param aId: The ID of the category to delete.
+        * @param aDriveId: The drive Id the name (category) belongs to. Songs on different
+        *                  drives may belong to the same album or artist; consequently, one
+        *                  row for each artist/album id and drive ID pair will exist in the
+        *                  lookup table with a count existing for each row that tracks the
+        *                  number number of songs on that drive with that album/artist.
+        * @param aItemChangedMessages if valid on return contains a deleted message if the
+        *                  category was deleted
+        * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete,
+        *        EFalse otherwise
+        */
+        void DecrementSongsForCategoryL(TUint32 aId, TInt aDriveId,
+            CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
+
+        /**
+        * Deletes a category.
+        * @param aId identifies the category
+        * @param aDriveId category drive
+        */
+        void DeleteCategoryL(TUint32 aId, TInt aDriveId);
+
+        /**
+        * Gets the details for multiple category items.
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray inout parameter, on input contains the IDs of the
+        *       category items to be returned, on exit contains the requested
+        *       attributes for these items
+        */
+        void GetCategoryItemsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Gets the details for all category items.
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray returns the requested attributes for all items
+        */
+        void GetAllCategoryItemsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Gets details for one category item.
+        * @param aId identifies the category item
+        * @param aAttrs attributes to be returned
+        * @param aMedia returns the requested attributes for te item
+        * @leave KErrCorrupt if there are multiple items with the same ID
+        *        KErrNotFound if there is no item with the specified ID
+        */
+        void GetCategoryItemL(TUint32 aId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Gets details for the category items under a parent category item.
+        * This applies to albums for a given artist. The method panics if the
+        * category or parent category are invalid.
+        * @param aParentCategory identifies the parent category
+        * @param aParentId identifies the parent item
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray returns the requested attributes for all items
+        */
+        void GetSubCategoryItemsL(TMPXGeneralCategory aParentCategory, TUint32 aParentId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Checks if the specified category item exists.
+        * @param aDriveId drive to check or KDbManagerAllDrives
+        * @param aId identifies the category item
+        * @return ETrue if it exists, EFalse otherwise
+        */
+        TBool CategoryItemExistsL(TInt aDriveId, TUint32 aId);
+
+        /**
+        * Gets the CountSongs field for a category item
+        * @param aDriveId drive to check or KDbManagerAllDrives
+        * @param aId identifies the category item
+        * @return value of the CountSongs field.
+        */
+        TInt GetSongsCountL(TInt aDriveId, TUint32 aId);
+
+		/**
+	    * Update a category item. 
+	    * @param aId: The ID of the category to update
+	    * @param aMedia: The media data
+	    * @param aDriveId: The Drive Id the name (category) belongs
+	    * @param aItemChangedMessages: if valid on return contains a updated message if the
+        * category was updated
+        */
+		void UpdateItemL(TUint32 aId, const CMPXMedia& aMedia, TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
+		
+    protected:
+
+        /**
+        * Updates the media with information from the table
+        * @param aRecord record containing the source fields
+        * @param aAttrs attributes to be returned
+        * @param aMedia returns the requested attributes
+        */
+        void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Returns the category record for a given ID
+        * @param aId identifies the category item
+        * @return rowset
+        */
+        RSqlStatement GetCategoryRecordL(TUint32 aId);
+
+        /**
+        * Replaces the table placeholder in the string parameter with the
+        * category table name.
+        * @param aQuery raw query string
+        * @return processed query string, ownership is transferred.
+        */
+        HBufC* PreProcessStringLC(const TDesC& aQuery);
+
+        /**
+        * Processes a recordset by constructing media instances and adding them
+        * to the specified array.
+        * @param aAttrs attributes to be returned
+        * @param aRecordset recordset to be processed
+        * @param aMediaArray returns the media instances
+        */
+        void ProcessRecordsetL(const TArray<TMPXAttribute>& aAttrs,
+            RSqlStatement& aRecordset, CMPXMediaArray& aMediaArray);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    protected:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        */
+        CMPXDbCategory(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory);
+
+        /**
+        * Second phase constructor.
+        */
+        void BaseConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the category tables
+        */
+        enum TCategoryColumns
+            {
+            ECategoryUniqueId = KMPXTableDefaultIndex,
+            ECategoryName,
+            ECategorySongCount
+            };
+
+    protected:
+
+        HBufC* iTableName;              // owned
+        TMPXGeneralCategory iCategory;
+
+    };
+
+#endif // MPXDBCATEGORY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbcomposer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for all category tables (Artist,
+*                Album, Genre, Composer).
+*
+*
+*/
+
+
+#ifndef MPXDBCOMPOSER_H
+#define MPXDBCOMPOSER_H
+
+// INCLUDES
+#include "mpxdbcategory.h"
+
+// CLASS FORWARDS
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing all music databases
+*
+* @lib MPXDbPlugin.lib
+*/
+
+class CMPXDbComposer :
+    public CMPXDbCategory
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance.
+        */
+        static CMPXDbComposer* NewL(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance on the cleanup stack.
+        */
+        static CMPXDbComposer* NewLC(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbComposer();
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        */
+        CMPXDbComposer(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory);
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the category tables
+        */
+        enum TComposerColumns
+            {
+            EComposerUniqueId = KMPXTableDefaultIndex,
+            EComposerName,
+            EComposerSongCount,
+            EAlbumFieldCount
+            };
+
+    private:    // Data
+
+    };
+#endif // MPXDBCOMPOSER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbgenre.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for all category tables (Artist,
+*                Album, Genre, Composer).
+*
+*
+*/
+
+
+#ifndef MPXDBGENRE_H
+#define MPXDBGENRE_H
+
+// INCLUDES
+#include "mpxdbcategory.h"
+
+// CLASS FORWARDS
+class CMPXMedia;
+class CMPXMediaArray;
+class RSqlStatement;
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing all music databases
+*
+* @lib MPXDbPlugin.lib
+*/
+
+class CMPXDbGenre :
+    public CMPXDbCategory
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance.
+        */
+        static CMPXDbGenre* NewL(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        * @return New CMPXDbCategory instance on the cleanup stack.
+        */
+        static CMPXDbGenre* NewLC(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbGenre();
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aCategory identifies the category
+        */
+        CMPXDbGenre(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory);
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the category tables
+        */
+        enum TGenreColumns
+            {
+            EGenreUniqueId = KMPXTableDefaultIndex,
+            EGenreName,
+            EGenreSongCount,
+            EGenreFieldCount
+            };
+
+    private:    // Data
+
+    };
+#endif // MPXDBGENRE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbhandler.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1059 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class provides the functions to manipulate the music collection
+*                database.
+*
+*/
+
+
+#ifndef MPXDBHANDLER_H
+#define MPXDBHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <f32file.h>
+
+#include <mpxattribute.h>
+#include <mpxmessage2.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionmessagedefs.h>
+
+#include "mpxcollectiondbstd.h"
+#include "mpxcollectiondb.hrh"
+#include "mpxdbactivetask.h"
+#include "mpxdbmusic.h"     // for MMPXDbMusicObserver
+#include "mpxdbartist.h"    // for MMPXDbArtistObserver
+#include "mpxdbalbum.h"     // for MMPXDbAlbumObserver
+#include "mpxdbplaylist.h"	// for MMPXDbPlaylistObserver
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXMediaArray;
+class CMPXCollectionDbManager;
+class CMPXDbPlaylist;
+class CMPXDbCategory;
+class CMPXDbAuxiliary;
+class CMPXDbAutoPlaylist;
+class CMPXDbArtist;
+class CMPXDbAlbum;
+class CMPXDbGenre;
+class CMPXDbComposer;
+
+// CLASS DECLARATION
+
+/**
+*  Music collection database handler
+*
+*  @lib MPXDbPlugin.lib
+*/
+class CMPXDbHandler :
+    public CBase,
+    public MMPXDbMusicObserver,
+    public MMPXDbArtistObserver,
+    public MMPXDbAlbumObserver,
+	public MMPXDbPlaylistObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return a new CMPXDbHandler instance
+        */
+        static CMPXDbHandler* NewL(RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return a new CMPXDbHandler instance
+        */
+        static CMPXDbHandler* NewLC(RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPXDbHandler();
+
+    public:
+
+        /**
+        * Add a song to the music collection database
+        * @param aMedia media object which contains file path,
+        *           artist, composer, name(title), track, etc...
+        * @param aMessageArray change event message to notify client of the changes
+        * @return TUint32 id of the item added
+        */
+        TUint32 AddSongL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL);
+
+        /**
+        * Add a song to the music collection without a database transaction; it
+        * is assumed the transaction is created at a higher leve
+        * @param aMedia media object which contains file path,
+        *           artist, composer, name(title), track, etc...
+        * @param aMessageArray change event message to notify client of the changes
+        * @return TUint32 id of the item added
+        */
+        TUint32 AddSongWithNoTransactionL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray=NULL);
+        
+        /**
+        * Add a playlist to the collection
+        * @param aMedia playlist media object with title and URI of the playlist.
+        * @return playlist Id of the playlist created
+        */
+        TUint32 AddPlaylistL(const CMPXMedia& aMedia);
+
+        /**
+        * Add songs to the specified playlist
+        * @param aMedia playlist media object with playlist Id.
+        * @return playlist Id of the playlist
+        */
+        TUint32 AddSongToPlaylistL(const CMPXMedia& aMedia);
+
+        /**
+        * Update song info for a song in the music collection database
+        * @param aMedia songDetails object  which contains file path,
+        *           artist, composer, name(title), track, etc...
+        * @param aItemChangedMessages a list of change events as a result of the
+        *           song update
+        * @return ETrue if UI visible change else EFalse
+        */
+        CMPXDbActiveTask::TChangeVisibility UpdateSongL(const CMPXMedia& aMedia,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Update playlist info in the music collection database
+        * @param aMedia playlist details object which contains file path,
+        *           timestamps etc.
+        * @param aMessageArray change event messages for the playlist update
+        */
+        void UpdatePlaylistL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray);
+
+        /**
+        * Update the songs for a playlist in the music collection database
+        * @param aMedia playlist details object which contains the playlist songs.
+        * @param aMessage change event message for the playlist update
+        */
+        void UpdatePlaylistSongsL(const CMPXMedia& aMedia, CMPXMessage& aMessage);
+
+        /**
+        * Reorder the specified song in the specified playlist
+        * @param aPlaylistId id of the playlist which contains the song to be reordered
+        * @param aSongId id of the song to be reordered
+        * @param aOriginalOrdinal the original ordinal of the song within the playlist.
+        *        Ordinal starts from 0.
+        * @param aNewOrdinal the new ordinal of the song within the playlist. Ordinal
+        *        starts from 0.
+        * @param aMessage change event message for the playlist update
+        */
+        void ReorderPlaylistL(const TMPXItemId& aPlaylistId, const TMPXItemId& aSongId,
+            TUint aOriginalOrdinal, TUint aNewOrdinal, CMPXMessage& aMessage);
+
+        /**
+        * Remove all songs within music collection database
+        */
+        void RemoveEntireCollectionL();
+
+        /**
+        * Remove a song from the music collection database
+        * @param aSongId ID of the song to be removed
+        * @param aUriArray a descriptor array to contain the URI of the deleted file
+        * @param aItemChangedMessages a list of change events as a result of the song removal
+        * @param aDeleteRecord indicates whether the client has explictly requested
+        *                to delete the records from the database. If ETrue, records
+        *                associated with the media will be deleted from the database;
+        *                if EFalse, whether to mark the records as deleted or to delete
+        *                the records will be based on other deciding factors.
+        */
+        void RemoveSongL(TUint32 aSongId, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord = EFalse);
+
+        /**
+        * Removes a category of songs from the music collection, and its
+        * corresponding category in the lookup table
+        * @param aCategory the category to remove
+        * @param aCategoryId ID of the category to remove
+        * @param aUriArray a descriptor array to contain the URI of the deleted songs
+        * @param aItemChangedMessages a list of change events as a result of the song removal
+        */
+        void RemoveSongsMatchingCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+            CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Removes songs from the music collection belonging to the
+        * specified artist and album as well as the actual category
+        * in the lookup table
+        * @param aArtistId id of the artist
+        * @param aAlbumId id of the album
+        * @param aUriArray a descriptor array to contain the URI of the deleted file(s)
+        * @param aItemChangedMessages a list of change events as a result of the song removal
+        */
+        void RemoveSongsMatchingArtistAndAlbumL(TUint32 aArtistId, TUint32 aAlbumId,
+            CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove all playlists from the collection
+        */
+        void RemoveAllPlaylistsL();
+
+        /**
+        * Remove a playlist This will remove all the songs from the playlist
+        * @param aPlaylistId ID of the playlist to remove
+        * @param aUriArray a descriptor array to contain the URI of the deleted file
+        * @param aItemChangedMessages a list of change events as a result of the
+        *        playlist removal
+        */
+        void RemovePlaylistL(TUint32 aPlaylistId, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove a song from the specified playlist.
+        * @param aPlaylistId ID of the playlist to remove the song from
+        * @param aSongId Id of the song in the playlist to be removed
+        * @param aOrdinal the ordinal of the song in the playlist. This uniquely
+        *        identifies which song in the playlist to be removed; whereas song
+        *        Id doesn't because duplicate tracks in the playlist are allowed.
+        *        The position is relative to zero, i.e. zero implies that the song
+        *        at the beginning of the playlist is to be removed.
+        * @param aItemChangedMessages a list of change events as a result of the
+        *        song removal
+        */
+        void RemoveSongFromPlaylistL(TUint32 aPlaylist, const TMPXItemId& aSongId,
+            TInt aOrdinal, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Delete records in all databases which have been marked as deleted
+        */
+        void CleanupDeletedRecordsL();
+
+        /**
+        * Get all songs from the music collection databasee
+        * @param aMediaArray Array to place all the songs' required info
+        * @param aAttrs required attributes
+        */
+        void GetAllSongsL(CMPXMediaArray* aMediaArray,
+            const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Get a limited number of songs from the music collection databasee
+        * @param aMediaArray Array to place all the songs' required info
+        * @param aAttrs required attributes
+        * @param aLimit maximum number of songs to retrieve
+        */
+        void GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs,
+                                 CMPXMediaArray& aMediaArray, TInt aLimit);
+
+        /**
+        * Get songs from the music collection database incrementally
+        * @param aMediaArray Array to place all the songs' required info
+        * @param aAttrs required attributes
+        * @param aTitle title to use as a key
+        * @param aNumOfSongs number of songs to read
+        * @param aAsc ascending or descending data read
+        */
+        void GetSongsInBlockL(CMPXMediaArray* aMediaArray,
+            const TArray<TMPXAttribute>& aAttrs,
+            TPtrC aTitle,
+            TUint aNumOfSongs,
+            TBool aAsc);
+
+
+        /**
+        * Get songs from the music collection starting at a particular offset
+        * ONLY use this as the first query to locate particular item. Should use
+        * GetSongsInBlockL() to fetch in blocks with a particular index
+        * @param aMediaArray Array to store the results
+        * @param aAttrs attributes to fetch
+        * @param aOffset offset to start reading
+        * @param aCount number of items to get
+        */
+        void GetSongsAtOffsetL( CMPXMediaArray* aMediaArray,
+                                const TArray<TMPXAttribute>& aAttrs,
+                                TInt aOffset,
+                                TInt aCount );
+
+        /**
+        * Get all the songs that match the given artist ID
+        * @param aArtistId ID of the artist to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching songs' required
+        *        attributes
+        */
+        void GetSongsMatchingArtistL(TUint aArtistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the songs that match the given album ID
+        * @param aAlbumId ID of the album to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching songs' required info
+        */
+        void GetSongsMatchingAlbumL(TUint aAlbumId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the songs that match the given artist and album ID
+        * @param aArtistId ID of the artist to match
+        * @param aAlbumId ID of the album to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching songs' required info
+        */
+        void GetSongsMatchingArtistAndAlbumL(TUint aArtistId, TUint aAlbumId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the songs that match the given genre ID
+        * @param aGenreId ID of the genre to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching songs' required info
+        */
+        void GetSongsMatchingGenreL(TUint aGenreId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the songs that match the given composer ID
+        * @param aComposerId ID of the composer to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching songs' required info
+        */
+        void GetSongsMatchingComposerL(TUint aComposerId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the songs that match the given playlist ID
+        * @param aPlaylistId ID of the playlist to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the required song info
+        */
+        void GetSongsMatchingPlaylistL(TUint aPlaylistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get the song info that matches the given song ID from Songs table.
+        * @param aSongId ID of the song
+        * @param aAttrs required attributes
+        * @param aMedia returns the song info
+        */
+        void GetSongL(TUint32 aSongId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Appends the media object with the song information to the specified array.
+        * @param aSongId ID of the song
+        * @param aAttrs required attributes
+        * @param aMediaArray on return the song info is appended to this array
+        */
+        void GetSongL(TUint32 aSongId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the song info that matches the given song ID from Songs table.
+        * The song info will first be populated from Playlist table and
+        * if the Songs table exists in the drive where the song is located,
+        * song info will be overwritten from Songs table. This enables the
+        * support for displaying song title in a playlist when the drive
+        * where the song is located is not present.
+        * @aSongId ID of the song
+        * @aPlaylistId ID of the playlist the song belongs to.
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the required song info
+        * @leave KErrNotFound if the song could not be found in the
+        *       PlaylistSongs table
+        */
+        void GetPlaylistSongL(TUint32 aSongId, TUint32 aPlaylistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia);
+
+        /**
+        * Appends the a media object with the song information to the specified array.
+        * @param aSongId ID of the song
+        * @param aPlaylistId ID of the playlist
+        * @param aAttrs required attributes
+        * @param aMediaArray on return the song info is appended to this array
+        */
+        void GetPlaylistSongL(TUint32 aSongId, TUint32 aPlaylistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the song ID of the song that matches the given URI
+        * @param aUri URI to match
+        * @return song ID
+        */
+        TUint32 GetSongIdMatchingUriL(const TDesC& aUri);
+
+        /**
+        * Get all the artist names from the music collection database sorted by name.
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the artists' required info
+        */
+        void GetAllArtistsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the album names from the music collection database sorted by name.
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the albums' required info
+        */
+        void GetAllAlbumsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the albums that match the given artist ID sorted by name.
+        * @param aArtistId ID of the artist to match
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the matching albums' required info
+        */
+        void GetAlbumsMatchingArtistL(TUint aArtistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get all the genre names from the collection
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the genres' required info
+        */
+        void GetAllGenresL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get all the composer names from the collection
+        * @param aAttrs required attributes
+        * @param aMediaArray Array to place all the composers' required info
+        */
+        void GetAllComposersL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get the playlist ID of the playlist that matches the given URI
+        * @param aUri URI to match
+        * @return playlist ID to return
+        */
+        TUint32 GetPlaylistIdMatchingUriL(const TDesC& aUri);
+
+        /**
+        * Checks if the specified ID corresponds to an auto playlist.
+        * @param aPlaylistId ID to be checked
+        * @return ETrue if it corresponds to an auto playlist, EFalse otherwise
+        */
+        TBool IsAutoPlaylistL(TUint32 aPlaylistId);
+
+        /**
+        * Get all the playlist names from the collection
+        * @param aMediaArray Array to place all the playlists' required info
+        * @param aAttrs required attributes
+        */
+        void GetAllPlaylistsL(CMPXMediaArray* aMediaArray,
+            const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Get all the system playlist names from the collection
+        * @param aMediaArray Array to place all the system playlists' required info
+        */
+        void GetAllSystemPlaylistNamesL(CMPXMediaArray* aMediaArray);
+
+        /**
+        * Get title from the Id
+        * @param Id to search for
+        * @return name matching the ID
+        */
+        HBufC* GetNameMatchingIdL(const TUint32 aId) const;
+
+        /**
+        * Get URI from the Id
+        * @param Id to search for
+        * @return URI matching the ID
+        * @leave KErrNotSupported if the ID refers to an invalid category
+        */
+        HBufC* GetUriMatchingIdL(const TUint32 aId) const;
+
+        /**
+        * Retrieve category record with information as specified in the given
+        * attributes
+        * @param aCategoryId Id of the record to be retrieved
+        * @param aCategory category type
+        * @param aAttrs information to return about the specified category
+        * @param aMedia returns the category information
+        */
+        void GetCategoryL(const TUint32 aCategoryId, TMPXGeneralCategory aCategory,
+                const TArray<TMPXAttribute>& aAttrs, CMPXMedia* aMedia);
+
+        /**
+        * Get the duration for all songs
+        * @return duration
+        */
+        TInt GetAllSongsDurationL();
+
+        /**
+        * Get the duration for all songs for a specified artist
+        * @param aArtistId identifies the artist
+        * @return duration
+        */
+        TInt GetArtistDurationL(TInt aArtistId);
+
+        /**
+        * Get the duration for all songs in a specified album
+        * @param aAlbumId identifies the album
+        * @return duration
+        */
+        TInt GetAlbumDurationL(TInt aAlbumId);
+
+        /**
+        * Get the duration for all songs for a specified artist and album
+        * @param aArtistId identifies the artist
+        * @param aAlbumId identifies the album
+        * @return duration
+        */
+        TInt GetArtistAlbumDurationL(TInt aArtistId, TInt aAlbumId);
+
+        /**
+        * Get the duration for all songs for a specified composer
+        * @param aComposerId identifies the composer
+        * @return duration
+        */
+        TInt GetComposerDurationL(TInt aComposerId);
+
+        /**
+        * Get the duration for all songs for a specified genre
+        * @param aGenreId identifies the genre
+        * @return duration
+        */
+        TInt GetGenreDurationL(TInt aGenreId);
+
+        /**
+        * Get the duration for all songs in a user playlist
+        * @param aPlaylistId identifies the playlist
+        * @return duration
+        */
+        TInt GetUserPlaylistDurationL(TInt aPlaylistId);
+
+        /**
+        * Get the duration for all songs for a specified playlist
+        * @param aPlaylistId identifies the playlist
+        * @return duration
+        */
+        TInt GetPlaylistDurationL(TInt aPlaylistId);
+
+        /**
+        * Fetch the total number of items in the specified category
+        * @param aCategory category to be queried
+        * @return number of items.
+        */
+        TInt NumberOfItemsL(TMPXGeneralCategory aCategory);
+
+        /**
+        * Find media(s) from the collection
+        * @param aCriteria selection criteria
+        * @param aAttrs attributes for the matching media
+        * @return matching media. Ownership is transferred.
+        * @leave KErrArgument if the criteria do not include a type
+        *           or category
+        */
+        CMPXMedia* FindAllLC(const CMPXMedia& aCriteria,
+            const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Set the last refreshed time
+        * @param aTime the updated last refresh time
+        */
+        void SetLastRefreshedTimeL(TTime aTime);
+
+        /**
+        * Get the last refreshed time
+        * @return last refreshed time
+        */
+        TTime GetLastRefreshedTimeL();
+
+        /**
+        * Set the db corrupted bit in the aux table for all drives
+        * @param aCorrupted flag indicating whether or not the db is corrupted
+        */
+        void SetDBCorruptedL(TBool aCorrupted);
+
+        /**
+        * Get the db corrupted bit in the aux table ( or of all drives )
+        * @return ETrue if database is corrupted, else EFalse
+        */
+        TBool IsDBCorruptedL();
+
+        /**
+        * Checks if the database has been created
+        * @return ETrue if file has been created
+        */
+        TBool DatabaseCreated();
+
+        /**
+        * Close and re-open the music collection database stored on the
+        * specified drive
+        * @param aDrive drive containing the music collection database to re-open
+        */
+        void OpenDatabaseL(TInt aDrive);
+
+        /**
+        * Close a database for a particular drive
+        * @param aDrive drive to close
+        */
+        void CloseDatabaseL(TInt aDrive);
+
+        /**
+        * Recreate all databases.
+        */
+        void ReCreateDatabasesL();
+
+        /**
+        * Starts a refresh operation.
+        */
+        void RefreshStartL();
+
+        /**
+        * Ends a refresh operation.
+        */
+        void RefreshEndL();
+        
+        /**
+        * Notification of mtp start
+        */
+        void MtpStartL();
+
+        /**
+        * Notification of mtp end
+        */
+        void MtpEndL();
+        /**
+        * Get total record count for music in db
+        * @param aDrive, specifies drive number for db selection
+        * @return count
+        */
+        TUint GetMusicCountL(TInt aDrive);
+
+        /**
+        * Get total record count for playlists in db
+        * @param aDrive, specifies drive number for db selection
+        * @return count
+        */
+        TUint GetPlaylistCountL(TInt aDrive);
+
+        /**
+        * Get total record count for music and playlists in db
+        * @param aDrive, specifies drive number for db selection
+        * @return count
+        */
+        TUint GetTotalCountL(TInt aDrive);
+
+        /**
+        * Get URIs for a given amount of songs
+        * @param aDrive, specifies drive number for db selection
+        * @param aFromID, specifies unique ID of last record retrieved
+        * @param aRecords, specifies the number of records to get
+        * @param aUriArr, will contain all URIs on return
+        * @param aLastID, will contain unique ID of a last record in the array
+        */
+        void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                               CDesCArray& aUriArr, TInt& aLastID);
+
+        /**
+        * Get URIs for a given amount of playlists
+        * @param aDrive, specifies drive number for db selection
+        * @param aFromID, specifies unique ID of last record retrieved
+        * @param aRecords, specifies the number of records to get
+        * @param aUriArr, will contain all URIs on return
+        * @param aLastID, will contain unique ID of a last record in the array
+        */
+        void GetPlaylistUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                  CDesCArray& aUriArr, TInt& aLastID);
+
+        /**
+        * Starts a transaction on all open databases.
+        */
+        void BeginTransactionL();
+
+        /**
+        * Commits or rolls back a transaction.
+        * @param aError if error then rolls back the transaction and leaves
+        *               if KErrNone it commits the transaction
+        */
+        void EndTransactionL(TInt aError);
+
+        /**
+        * Checks if the database is currently in a transaction.
+        *
+        * @return ETrue if database is currently in a transaction, EFalse otherwise
+        */
+        TBool InTransaction();
+
+        /**
+         * Notifies the handler that the collection will be closed.
+         * It is called before closing the collection.
+         */
+        void PreCloseCollectionL();
+
+        /**
+         * Notifies the handler that the collection was closed.
+         */
+         void CollectionClosed();
+
+         /**
+         * Notifies the handler that the collection was opened.
+         */
+         void CollectionOpenedL();
+         
+         /**
+          * Checks if the spefified drive is a remove drive
+          */      
+         TBool IsRemoteDrive(TDriveNumber aDrive);
+         
+         /**
+          * Checks if there is a drive that has a low disk space
+          * @leave KErrDiskFull if the space on one of the drives is below the
+          *         critical level
+          */
+         void CheckDiskSpaceOnDrivesL();
+
+    private:
+
+        /**
+        * Add a song to the music collection database
+        * @param aMedia: media object which contains file path,
+        *           artist, composer, name(title), track, etc...
+        * @param aMessage change event message to notify client of the changes
+        * @return Id of the song added
+        * @leave KErrArgument if the media doe snot include the song URI
+        */
+        TUint32 DoAddSongL(const CMPXMedia& aMedia, CMPXMessageArray* aMessageArray);
+
+        /**
+        * Add a playlist to the collection
+        * @param aMedia playlist media object with title and URI of the playlist.
+        * @return ID of the playlist created
+        */
+        TUint32 DoAddPlaylistL(const CMPXMedia& aMedia);
+
+        /**
+        * Add songs to the specified playlist
+        * @param aMedia playlist media object with playlist Id.
+        * @return playlist Id of the playlist
+        */
+        TUint32 DoAddSongToPlaylistL(const CMPXMedia& aMedia);
+
+        /**
+        * Update song info for a song in the music collection database
+        * @param aMedia songDetails object  which contains file path,
+        *           artist, composer, name(title), track, etc...
+        * @param aItemChangedMessages a list of items changed
+        * @return ETrue if UI visible change
+        * @leave KErrNotSupported if the song ID could not be constructed
+        */
+        CMPXDbActiveTask::TChangeVisibility DoUpdateSongL(const CMPXMedia& aMedia,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Update playlist info in the music collection database
+        * @param aMedia playlist details object which contains file path,
+        *           timestamps etc...
+        * @param aMessage change event message for the playlist update
+        */
+        void DoUpdatePlaylistL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray);
+
+        /**
+        * Replace all songs for a playlist. This method is called when harvester
+        * scans an updated playlist. This will also be called if MTP wants to
+        * replace the contents of an existing playlist. The implementation deleted the
+        * existing songs first and then inserts the new ones.
+        * @param aMedia playlist and songs details object which contains file path,
+        *           timestamps etc...
+        * @param aMessage change event message for the playlist update
+        */
+        void DoUpdatePlaylistSongsL(const CMPXMedia& aMedia, CMPXMessage& aMessage);
+
+        /**
+        * Reorder the specified song in the specified playlist
+        * @param aPlaylistId id of the playlist which contains the song to be reordered
+        * @param aSongId id of the song to be reordered
+        * @param aOriginalOrdinal the original ordinal of the song within the playlist.
+        *        Ordinal starts from 0.
+        * @param aNewOrdinal the new ordinal of the song within the playlist. Ordinal
+        *        starts from 0.
+        * @param aMessage change event message for the playlist update
+        */
+        void DoReorderPlaylistL(const TMPXItemId& aPlaylistId, const TMPXItemId& aSongId,
+            TUint aOriginalOrdinal, TUint aNewOrdinal, CMPXMessage& aMessage);
+
+        /**
+        * Deletes a song. In addition to deleting the song record from the music
+        * table takes care of updating the category and playlist tables.
+        * @param aSongId song to be deleted
+        * @param aUriArray on return contains the URIs of the song deleted.
+        * @param aItemChangedMessages on return contains changed messages for all
+        *        affected items
+        * @param aDeleteRecord ETrue if the record is to be deleted, EFalse if it is
+        *        to be marked as deleted.
+        */
+        void DoRemoveSongL(TUint32 aSongId, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord);
+
+        /**
+         * Deletes the song  from the playlist tables
+         * @param aSongId song to be deleted
+         * @param aItemChangedMessages on return contains changed messages for all
+         *        affected items
+         */
+        void DoRemoveSongFromPlaylistL(TUint32 aSongId,CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Deletes all the songs for a given category. The implementation uses
+        * DoRemoveSongL for the business logic.
+        * @param aCategory category type (artist/album/genre/composer)
+        * @param aCategoryId identifies the category item
+        * @param aUriArray on return contains the URIs of the songs deleted.
+        * @param aItemChangedMessages on return contains changed messages for all
+        *        affected items
+        * @leave KErrNotSupported if invalid category
+        */
+        void DoRemoveSongsMatchingCategoryL(TMPXGeneralCategory aCategory,
+            TUint32 aCategoryId, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Deletes all the songs for a given artist and album.
+        * The implementation uses DoRemoveSongL for the business logic.
+        * @param aArtistId identifies the artist
+        * @param aAlbumId identifies the album
+        * @param aUriArray on return contains the URIs of the songs deleted.
+        * @param aItemChangedMessages on return contains changed messages for all affected items
+        */
+        void DoRemoveSongsMatchingArtistAndAlbumL(TUint32 aArtistId, TUint32 aAlbumId,
+            CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Deletes all the playlists in all databases. Note that the songs are not affected.
+        */
+        void DoRemoveAllPlaylistsL();
+
+        /**
+        * Deletes a specified playlist.
+        * @param aPlaylistId the playlist to be deleted.
+        * @param aUriArray on return contains the URIs of the items deleted.
+        * @param aItemChangedMessages on return contains changed messages for all
+        *        affected items
+        */
+        void DoRemovePlaylistL(TUint32 aPlaylistId, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Deletes a song from a playlist.
+        * @param aPlaylistId identifies the playlist.
+        * @param aSongId song to be deleted.
+        * @param aOrdinal song ordinal in case there are multiple instances of the same
+        *        song in the playlist.
+        * @param aItemChangedMessages on return contains changed messages for all
+        *        affected items
+        */
+        void DoRemoveSongFromPlaylistL(TUint32 aPlaylistId, const TMPXItemId& aSongId,
+            TInt aOrdinal, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Deletes all song records marked as deleted.
+        */
+        void DoCleanupDeletedRecordsL();
+
+        /**
+        * Find items in the collection
+        * @param aCriteria selection criteria
+        * @param aAttrs attributes for the matching media
+        * @param aMediaArray returns the matching entries
+        */
+        void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray* aMediaArray);
+
+        /**
+        * Find a song.
+        * @param aCriteria selection criteria
+        * @param aAttrs attributes for the matching media
+        * @param aMediaArray returns the matching entries
+        */
+        void FindSongL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Gets the songs for a specified playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray returns the matching entries
+        */
+        void GetPlaylistSongsL(TUint32 aPlaylistId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Find an album
+        * @param aCriteria selection criteria
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray returns the matching entries
+        */
+        void FindAlbumL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Extracts the playlist ID and drive ID from the media object.
+        * @param aMedia playlist information
+        * @param aPlaylistId returns the playlist ID
+        * @param aPlaylistDriveId returns the drive ID
+        * @leave KErrArgument if the media does not include the ID and URI
+        */
+        void ProcessPlaylistMediaL(CMPXMedia& aMedia, TUint32& aPlaylistId,
+            TInt& aPlaylistDriveId);
+
+        /**
+        * Updates all the song entries in the playlist media with extra
+        * information from the music table.
+        * @param aMedia inout, contains the playlist/songs information
+        * @leave KErrArgument if the song does not exist in the music table and
+        *        the media does not include a URI
+        */
+        void UpdatePlaylistSongInfoL(CMPXMedia& aMedia);
+
+        /**
+        * Makes sure all the folders specified in the array parameter are created,
+        * otherwise it tries to create them. Updates the iDbDrives member variable
+        * with the drives corresponding to the folders.
+        * @param aFolders contains all the folders to be processed
+        */
+        void ProcessMusicFoldersL(const CDesCArray& aFolders);
+
+        /**
+        * Returns the CMPXDbCategory instance associated with the specified
+        * category type
+        * @param aCategory category type
+        * @return corresponding CMPXDbCategory instance
+        * @leave KErrNotSupported if invalid category
+        */
+        CMPXDbCategory* DbCategoryL(TMPXGeneralCategory aCategory) const;
+
+        /**
+        * Verify the volume id for the databases
+        */
+        void VerifyVolumeIdL();
+
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+        /**
+        * Reads the "save deleted records" MTP flag from CenRep and returns
+        * the value.
+        * @return value of the "save deleted records" MTP flag
+        */
+        TBool SaveDeletedSongs();
+#endif
+
+#ifdef RD_MULTIPLE_DRIVE
+        /**
+        * Retrieve all visible music folder locations.
+        */
+        CDesCArrayFlat* GetMusicFoldersL();
+#endif // RD_MULTIPLE_DRIVE
+
+    private:    // From MMPXDbMusicObserver
+
+        /**
+        * @see MMPXDbMusicObserver
+        */
+        virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory,
+            const TDesC& aName, TInt aDriveId,
+            CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
+
+		virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+			TUint32 aArtist, const TDesC& aArt,
+			TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist);
+
+		virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId, 
+			const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages);
+			
+        /**
+        * @see MMPXDbMusicObserver
+        */
+        virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory,
+            TUint32 aCategoryId, TInt aDriveId, CMPXMessageArray* aItemChangedMessages,
+            TBool& aItemExist);
+
+        /**
+        * @see MMPXDbMusicObserver
+        */
+        virtual void HandlePlayCountModifiedL(CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * @see MMPXDbMusicObserver
+        */
+        virtual void HandlePlaybackTimeModifiedL(CMPXMessageArray& aItemChangedMessages);
+    private:    // From MMPXDbArtistObserver
+    /**
+    * @see MMPXDbArtistObser
+    */
+        virtual TInt HandleGetAlbumsCountForArtistL(TUint32 aArtistId);
+
+    private:    // From MMPXDbAlbumObserver
+    /**
+    * @see MMPXDbAlbumObserver
+    */
+        virtual TBool HandleIsUnknownArtistL(TUint32 aArtistId);
+        virtual TUint32 HandleArtistForAlbumL(const TUint32 aAlbumId);
+        
+    private:	// From MMPXDbPlaylistObserver
+	/**
+	* @see MMPXDbPlaylistObserver
+	*/
+		virtual TInt HandlePlaylistDurationL(TUint32 aPlaylistId);
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param file session
+        */
+        CMPXDbHandler(RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Symbian 2nd phase constructor..
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // owned member variables
+        CMPXCollectionDbManager* iDbManager;
+        CMPXDbMusic* iDbMusic;
+        CMPXDbPlaylist* iDbPlaylist;
+        CMPXDbArtist* iDbArtist;
+        CMPXDbAlbum* iDbAlbum;
+        CMPXDbGenre* iDbGenre;
+        CMPXDbComposer* iDbComposer;
+        CMPXDbAuxiliary* iDbAuxiliary;
+
+        CMPXDbAutoPlaylist* iAutoPlaylist;
+
+        CDesCArrayFlat* iMimeTypes;         // MIME types supported
+        CDesCArrayFlat* iExtensions;        // file extensions supported
+        CDesCArrayFlat* iExtensionsMime;    // file extensions to check MIME
+        CDesCArrayFlat* iExtensionsDrm;     // file extensions to check DRM type
+        RArray<TInt> iDbDrives;
+
+        // not owned member variables
+        RFs& iFs;
+        CMPXResource& iResource;
+        TBool iOutOfDisk;                   // Are we in out of disk mode?
+        TBool iSynchronizeBasicTable;       // Basic music table was not updated during last refresh
+        TBool iCollectionOpen;              // Databases opened
+        TBool iRefresh;                     // Refresh operation currently performed
+        TBool iMtpInUse;                    // Flag for MTP operation
+        TInt  iOpOnDbCount;                 // Count to provide a min op amount in one transaction
+    };
+
+#endif      // MPXDBHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbmusic.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,752 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for all music table functionality.
+*                The Music table contains one record for each song on the database
+*                drive.
+*
+*
+*/
+
+
+#ifndef MPXDBMUSIC_H
+#define MPXDBMUSIC_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+#include "mpxdbcommonstd.h"
+#include "mpxdbactivetask.h"
+
+// CLASS FORWARDS
+class CMPXMedia;
+class CMPXMediaArray;
+
+// CLASS DECLARATION
+
+/**
+* Observer interface for handling the category ID functionality.
+* This is needed because the incoming CMPXMedia parameters in Add and Update methods
+* contain the names for the category items and the music table has to use IDs linking
+* to the category tables. Using this interface removes the dependency to the category
+* class.
+*
+* Note that this interface is only used when information is written to the Music table,
+* when information is retrieved the query takes care of also retrieving the names from
+* the corresponding category tables so the outgoing CMPXMedia will contain the correct
+* information.
+*/
+class MMPXDbMusicObserver
+    {
+    public:
+        /**
+        * Called when a new category item has to be added to a category table.
+        * @param aCategory category type
+        * @param aName name string
+        * @param aDrive drive to add the category to
+        * @param aItemChangedMessages changed mesages array to be updated or NULL
+        * @param aItemExist Out parameter, ETrue if the item already exist before the add,
+        *        EFalse otherwise
+        * @return the ID of the category item (new or existing)
+        */
+        virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+            TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
+
+		// for Album and Artist table
+		virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+			TUint32 aArtistId, const TDesC& aArt,
+			TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
+        /**
+        * Called when the ID of a category item changed for a Music record, for example when
+        * the artist name changed for a song. The implementation is supposed to update the
+        * category record and add corresponding item changed messages to the array parameter.
+        * @param aCategory category type
+        * @param aCategoryId old category item ID
+        * @param aDrive drive the category item is on
+        * @param aItemChangedMessages changed mesages array to be updated or NULL
+        * @param aItemExist Out parameter, ETrue if the category is not deleted after the delete,
+        *        EFalse otherwise
+        */
+        virtual void DeleteSongForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+            TInt aDrive, CMPXMessageArray* aItemChangedMessages, TBool& aItemExist) = 0;
+
+        /**
+        * Called when the play count attribute of a song is changed. Should add an item changed
+        * message to the array.
+        * @param aItemChangedMessages array of item changed messages to add to
+        */
+        virtual void HandlePlayCountModifiedL(CMPXMessageArray& aItemChangedMessages) = 0;
+
+        /**
+        * Called when the playback time attribute of a song is changed. Should add an item changed
+        * message to the array.
+        * @param aItemChangedMessages array of item changed messages to add to
+        */
+        virtual void HandlePlaybackTimeModifiedL(CMPXMessageArray& aItemChangedMessages) = 0;
+        
+        /**
+         * Called when category item is changed. Should add an item changed 
+         * message to the array.
+         * @param aCategory category type
+         * @param aCategoryId old category item ID
+         * @param aDrive drive the category item is on
+         * @param aMedia media data
+         * @param aItemChangedMessages changed mesages array to be updated or NULL
+         */
+		virtual void UpdateCategoryItemL(TMPXGeneralCategory aCategory, TUint32 aCategoryId, 
+			const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aItemChangedMessages) = 0;
+    };
+
+/**
+* Responsible for managing the Music table
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbMusic :
+    public CMPXDbTable
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aObserver observer reference
+        * @return New CMPXDbMusic instance.
+        */
+        static CMPXDbMusic* NewL(CMPXDbManager& aDbManager, CMPXResource& aResource,
+            MMPXDbMusicObserver& aObserver);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aObserver observer reference
+        * @return New CMPXDbMusic instance on the cleanup stack.
+        */
+        static CMPXDbMusic* NewLC(CMPXDbManager& aDbManager, CMPXResource& aResource,
+            MMPXDbMusicObserver& aObserver);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbMusic();
+
+    public:
+
+        /**
+        * Add a song to the music table
+        * @param aMedia contains the song details
+        * @param aDrive drive to add the song to
+        * @param aMessageArray change event message to notify client of the changes
+        * @return The unique ID of the song added.
+        */
+        TUint32 AddSongL(const CMPXMedia& aMedia, TInt aDrive, CMPXMessageArray* aMessageArray=NULL);
+
+        /**
+        * Remove a song from the music table
+        * @param aSongId the ID of the song to be removed
+        * @param aDrive song drive
+        * @param aDeleteRecord indicates whether the client has explictly requested
+        *                to delete the records from the database. If ETrue, records
+        *                associated with the media will be deleted from the database;
+        *                if EFalse, whether to mark the records as deleted or to delete
+        *                the records will be based on other deciding factors.
+        */
+        void DeleteSongL(TUint32 aSongId, TInt aDrive, TBool aDeleteRecord = EFalse);
+
+        /**
+        * Remove songs matching a category from the music table
+        * @param aCategory the category to remove
+        * @param aCategoryId ID of the category to remove
+        * @param aUriArray on return will be filled with all the paths that were removed
+        * @param aItemChangedMessages a list of change events as a result of the song removal
+        * @param aDrive drive the category record is on
+        */
+        void DeleteCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+            CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages, TInt aDrive);
+
+        /**
+        * Deletes all songs marked as deleted
+        */
+        void CleanupL();
+
+        /**
+        * Update song info for a song in the music table
+        * @param aSongId song ID
+        * @param aMedia media object which contains file path,
+        *                artist, composer, name(title), track, etc...
+        * @param aItemChangedMessages a list of change events as a result of the song removal
+        * @return ETrue if the change is visible in the UI
+        */
+        CMPXDbActiveTask::TChangeVisibility UpdateSongL(TUint32 aSongId, const CMPXMedia& aMedia,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Get the name of the song that matches the given song ID
+        * @param aSongId ID of the song
+        * @return Song name, ownership is transferred to the caller.
+        */
+        HBufC* GetNameL(TUint32 aSongId);
+
+        /**
+        * Get URI of the song
+        * @param aSongId ID of the song
+        * @return Song URI, ownership is transferred to the caller.
+        */
+        HBufC* GetUriL(TUint32 aSongId);
+
+        /**
+        * Get the drive of the song
+        * @param aSongId ID of the song
+        * @return Song drive
+        */
+        TInt GetDriveL(TUint32 aSongId);
+
+        /**
+        * Get the drive and category IDs for a specified song
+        * @param aSongId song to be retrieved
+        * @param aArtistId returns the artist ID
+        * @param aAlbumId returns the artist ID
+        * @param aGenreId returns the artist ID
+        * @param aComposerId returns the artist ID
+        * @param aDriveId returns the song drive
+        * @return song URI. The ownership is transferred.
+        */
+        HBufC* GetSongInfoL(TUint32 aSongId, TUint32& aArtistId, TUint32& aAlbumId,
+            TUint32& aGenreId, TUint32& aComposerId, TInt& aDriveId);
+
+        /**
+        * Get the song Id, title, URI, and general flags from the given song Id and/or URI
+        * @param aCriteria search the media by song Id and/or URI
+        * @param aMedia returns the song details
+        * @return error code KErrNotFound if unable to find the specified song in the
+        *          collection; otherwise KErrNone
+        */
+        TInt GetSongL(const CMPXMedia& aCriteria, CMPXMedia*& aMedia);
+
+        /**
+        * Get the most recently played songs. Returns a maximum of KMPXMaxRecentlyPlayedSongs
+        * songs.
+        * @param aAttrs attributes to include
+        * @param aMediaArray returns the songs' info
+        */
+        void GetRecentlyPlayedSongsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the most played songs from the music table. Returns a maximum of
+        * KMPXMaxMostPlayedSongs songs.
+        * @param aAttrs attributes to include
+        * @param aMediaArray returns the songs' info
+        */
+        void GetMostPlayedSongsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the recently added songs from the music table (7 days)
+        * @param aAttrs attributes to include
+        * @param aMediaArray returns the songs' info
+        */
+        void GetRecentlyAddedSongsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+       /**
+        * Get the total number of songs
+        * @return total number of songs
+        */
+        TInt CountL();
+
+        /**
+        * Get all the albums for a specified artist
+        * @param aArtistId artist ID
+        * @param aMediaArray returns the album(s) matching the artist
+        */
+        void GetAlbumsForArtistL(TUint32 aArtistId, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns details about the specified song.
+        * @param aSongId identifies the song
+        * @param aAttrs attributes to be retrieved
+        * @param aMedia returns the song information
+        */
+        void GetSongL(TInt aSongId, const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia);
+        
+        /**
+        * Returns all songs in the playlist.
+        * @param aDrive identifies in db
+        * @param aPlaylistId identifies the playlist
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetAllSongsL(TInt aDrive,TInt aPlaylistId,const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns all songs in the database.
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetAllSongsL(const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get from all songs with a limit (first N items)
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        * @param aLimit maximum number of songs to retrieve
+        */
+        void GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray, TInt aLimit);
+
+        /**
+        * Returns a block of songs as specified
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        * @param aTitle title of the song that marks the beginning of the block
+        * @param aNumOfSongs the number of songs in the block
+        * @param aAsc
+        */
+        void GetSongsInBlockL( const TArray<TMPXAttribute>& aAttrs,
+                               CMPXMediaArray& aMediaArray,
+                               TPtrC aTitle,
+                               TUint aNumOfSongs,
+                               TBool aAsc);
+
+
+        /**
+        * Get songs from the music collection starting at a particular offset
+        * ONLY use this as the first query to locate particular item. Should use
+        * GetSongsInBlockL() to fetch in blocks with a particular index
+        * @param aMediaArray Array to store the results
+        * @param aAttrs attributes to fetch
+        * @param aOffset offset to start reading
+        * @param aCount number of items to get
+        */
+        void GetSongsAtOffsetL( CMPXMediaArray& aMediaArray,
+                                const TArray<TMPXAttribute>& aAttrs,
+                                TInt aOffset,
+                                TInt aCount );
+
+        /**
+        * Returns all songs for a given artist.
+        * @param aArtistId artist to get the songs for
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetSongsForArtistL(TUint aArtistId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns all songs for a given album.
+        * @param aAlbumId album to get the songs for
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetSongsForAlbumL(TUint aAlbumId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns all songs for a given artist and album.
+        * @param aArtistId artist to get the songs for
+        * @param aAlbumId album to get the songs for
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetSongsForArtistAndAlbumL(TUint aArtistId, TUint aAlbumId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns all songs for a given genre.
+        * @param aGenreId genre to get the songs for
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetSongsForGenreL(TUint aGenreId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns all songs for a given composer.
+        * @param aComposerId composer to get the songs for
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the song attributes.
+        */
+        void GetSongsForComposerL(TUint aComposerId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns the duration of all songs.
+        * @return the duration value
+        */
+        TInt AllSongsDurationL();
+
+        /**
+        * Returns the duration for a specified artist.
+        * @param aArtistId artist to get the duration for
+        * @return the duration value
+        */
+        TInt ArtistDurationL(TUint aArtistId);
+
+        /**
+        * Returns the duration for a specified album.
+        * @param aAlbumId album to get the duration for
+        * @return the duration value
+        */
+        TInt AlbumDurationL(TUint aAlbumId);
+
+        /**
+        * Returns the duration for a specified artist and album.
+        * @param aArtistId artist to get the duration for
+        * @param aAlbumId album to get the duration for
+        * @return the duration value
+        */
+        TInt ArtistAlbumDurationL(TUint aArtistId, TUint aAlbumId);
+
+        /**
+        * Returns the duration for a specified genre.
+        * @param aGenreId genre to get the duration for
+        * @return the duration value
+        */
+        TInt GenreDurationL(TUint aGenreId);
+
+        /**
+        * Returns the duration for a specified composer.
+        * @param aComposerId composer to get the duration for
+        * @return the duration value
+        */
+        TInt ComposerDurationL(TUint aComposerId);
+
+        /**
+        * Returns the duration for the recently played songs.
+        * @return the duration value
+        */
+        TInt RecentlyPlayedDurationL();
+
+        /**
+        * Returns the duration for the most played songs.
+        * @return the duration value
+        */
+        TInt MostPlayedDurationL();
+
+        /**
+        * Returns the duration for the recently added songs.
+        * @return the duration value
+        */
+        TInt RecentlyAddedDurationL();
+
+        /**
+        * Find the songs for the selection criteria
+        * @param aGeneralId selection criteria (could be song/album/artist/genre/composer ID)
+        * @param aContainerId selection criteria (could be artist/album id)
+        * @param aType criteria type (EMPXItem or EMPXGroup)
+        * @param aCriteria selection criteria
+        * @param aAttrs the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray returns the songs
+        */
+        void FindSongsL(TUint32 aGeneralId, TUint32 aContainerId, TMPXGeneralType aType,
+            const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns the track count for a given drive
+        * @param aDrive drive
+        * @return the count
+        */
+        TUint GetDriveTrackCountL(TInt aDrive);
+
+        /**
+        * Get URIs for a given number of tracks
+        * @param aDrive, specifies drive number for db selection
+        * @param aFromID, specifies unique ID of last record retrieved
+        * @param aRecords, specifies the number of records to get
+        * @param aUriArr, will contain all URIs on return
+        * @param aLastID, will contain unique ID of a last record in the array
+        */
+        void GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                               CDesCArray& aUriArr, TInt& aLastID);
+
+        /**
+         * Get the ID of Artist which belongs to the specified Album
+		 * @param aId, the ID of Album
+         */
+        TUint32 CMPXDbMusic::ArtistForAlbumL(const TUint32 aId);
+        
+        /**
+        * Signals the start of a refresh operation
+        */
+        void RefreshStartL();
+
+        /**
+        * Signals the end of a refresh operation
+        */
+        void RefreshEndL();
+
+    private:
+
+        /**
+        * Checks if the specified song exists.
+        * @param aId identifies the song
+        * @return ETrue if it exists, EFalse otherwise
+        */
+        TBool SongExistsL(TUint32 aSongId);
+
+        /**
+        * Update the media with information found in the Music table
+        * @param aMusicTable music table record
+        * @param aAttrs the attributes to include
+        * @param aMedia returns the song details
+        */
+        void UpdateMediaL(RSqlStatement& aMusicTable, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Update the media general attributes from the Music table
+        * @param aMusicTable music table view
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaGeneralL(RSqlStatement& aMusicTable, const TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Update the media music attributes from the Music table
+        * @param aMusicTable music table view
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaMusicL(RSqlStatement& aMusicTable, const TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Update the media audio attributes from the Music table
+        * @param aMusicTable music table view
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaAudioL(RSqlStatement& aMusicTable, const TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Update the media MTP attributes from the Music table
+        * @param aMusicTable music table view
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaMTPL(RSqlStatement& aMusicTable, const TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Adds a song to the Music table
+        * @param aSongId identifies the song
+        * @param aMedia contains the song attributes
+        * @param aDrive drive to add the song to
+        * @param aItemChangedMessages item changed messages to update
+        */
+        TBool DoAddSongL(TUint32 aSongId, const CMPXMedia& aMedia, TInt aDrive,
+            CMPXMessageArray* aItemChangedMessages);
+
+        /**
+        * Updates a song in the Music table
+        * @param aSongId identifies the song
+        * @param aMedia contains the song attributes
+        * @param aItemChangedMessages item changed messages to update or NULL
+        */
+        CMPXDbActiveTask::TChangeVisibility DoUpdateSongL(TUint32 aSongId, const CMPXMedia& aMedia,
+            CMPXMessageArray* aItemChangedMessages);
+
+        /**
+        * Updates a song in the Music table
+        * @param aSongId identifies the song
+        * @param aMedia contains the song attributes
+        * @param aDrive drive to add the song to
+        * @param aItemChangedMessages item changed messages to update
+        * @param aRecordset current song record in the Music table.
+        *       Required to detect any field changes.
+        */
+        CMPXDbActiveTask::TChangeVisibility DoUpdateSongL(TUint32 aSongId, const CMPXMedia& aMedia, TInt aDrive,
+            CMPXMessageArray* aItemChangedMessages, RSqlStatement& aRecordset);
+
+        /**
+        * Get the DRM type of the given file
+        * @param aFile file
+        * @return DRM type.
+        */
+        TMCDrmType DRMTypeL(const TDesC& aFile);
+
+        /**
+        * Generate searching criteria for music table from the given criteria
+        * @param aGeneralId selection criteria (could be song/album/artist/genre/composer Id)
+        * @param aContainerId selection criteria (could be artist/album id)
+        * @param aType criteria type (EMPXItem or EMPXGroup)
+        * @param aCriteria input criteria
+        * @return a string containing the selection criteria. The ownership is passed to the caller.
+        */
+        HBufC* GenerateMusicMatchingCriteriaLC(TUint32 aGeneralId, TUint32 aContainerId,
+            TMPXGeneralType aType, const CMPXMedia& aCriteria);
+
+        /**
+        * Constructs the fields and corresponding values to be written into the music
+        * table for update and insert statements.
+        * @param aSongId identifies the song
+        * @param aMedia contains the new song attributes
+        * @param aItemChangedMessages item changed mesages to add to
+        * @param aMusicTable points to the existing record in the Music table for updates or NULL
+        *       for inserts
+        * @param aFields returns the field names to be updated
+        * @param aValues returns the field values to be updated
+        * @param aDrive drive the song is on
+        * @return ETrue if the change is visible in the UI
+        */
+        CMPXDbActiveTask::TChangeVisibility GenerateMusicFieldsValuesL(TUint32 aSongId, const CMPXMedia& aMedia,
+            CMPXMessageArray* aItemChangedMessages, RSqlStatement* aMusicTable,
+            CDesCArray& aFields, CDesCArray& aValues, TInt aDrive);
+
+        /**
+        * Generates the full URI from a music record.
+        * @param aMusicTable music table record
+        * @return Full URI string. The ownership is passed to the caller.
+        */
+        HBufC* ConstructUriL(RSqlStatement& aMusicTable);
+
+        /**
+        * Checks if the specified category field (artist/album/genre/composer)
+        * will change and notifies the observer if so.
+        * @param aCategory identifies the category
+        * @param aMedia contains the new record attributes
+        * @param aAttribute corresponding attribute in the media parameter
+        * @param aColumnIndex column index in the recordset
+        * @param aMusicTable current record in the music table or NULL if this is an insert
+        * @param aDriveId drive ID the update is for
+        * @param aItemChangedMessages item changed messages to append to
+        * @param aItemId returns the category item ID
+        * @return ETrue if the field was modified
+        */
+        TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
+            const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
+            CMPXMessageArray* aItemChangedMessages, TUint32& aItemId);
+
+		TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
+			const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
+			CMPXMessageArray* aItemChangedMessages, TUint32& aItemId, TUint32 aArtistId);
+        /**
+        * Checks if extra attributes are required. The "standard attribute set includes:
+        * EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory,
+        * EMPXMediaGeneralTitle, EMPXMediaGeneralUri, and EMPXMediaGeneralFlags
+        * @param aAttrs attributes to be checked
+        * @return ETrue if extra attributes are required
+        */
+        TBool ExtraFieldsRequired(const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Test whether the given media contains any supported attribute
+        * @param aMedia media to be tested
+        * @return ETrue if the media contains one or more supported attribute;
+        *  otherwise EFalse.
+        */
+		TBool IsSupported(const CMPXMedia& aMedia);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor
+        * @param aDbManager database manager to use for database interactions
+        */
+        CMPXDbMusic(CMPXDbManager& aDbManager, MMPXDbMusicObserver& aObserver);
+
+        /**
+        * Second phase constructor.
+        */
+        void ConstructL(CMPXResource& aResource);
+
+    private:
+
+        /**
+        * Column indexes in the music table
+        */
+		enum TMusicColumns
+			{
+			EMusicUniqueId = KMPXTableDefaultIndex,
+			EMusicDbFlag,
+			EMusicVolumeId,
+			EMusicTitle,
+			EMusicArtist,
+			EMusicArt,
+			EMusicDeleted,
+			EMusicLocation,
+			EMusicAlbumTrack,
+			EMusicPlayCount,
+			EMusicTimeAdded,
+			EMusicTimePlayed,
+			EMusicDuration,
+			EMusicSync,
+			EMusicModified,
+			EMusicAlbum,
+			EMusicGenre,
+			EMusicComposer,
+			EMusicReleaseDate,
+			EMusicRating,
+			EMusicComment,
+			EMusicCopyright,
+			EMusicUrl,
+			EMusicDRM,
+			EMusicLastPlayPosition,
+			EMusicSampleRate,
+			EMusicBitRate,
+			EMusicNumChannels,
+			EMusicCodec,
+			EMusicMimeType,
+			EMusicMTPDrmStatus,
+			EMusicArtistName,
+			EMusicAlbumName,
+			EMusicGenreName,
+			EMusicComposerName,
+			EMusicFieldCount
+			};
+
+         /*
+         * Unique ID for Queries with a lifetime
+         */
+         enum TMusicStatements
+             {
+             EOffsetQueryBasic = 0xabcd0001,
+             EAscQueryBasic = 0xabcd0002,
+             EDscQueryBasic = 0xabcd0003,
+             EOffSetQuery = 0xabcd0004,
+             EAscQuery = 0xabcd0005,
+             EDscQuery = 0xabcd0006
+             };
+
+    private:    // Data
+
+        // file extensions to check DRM type, owned
+        CDesCArrayFlat* iExtensionsDrm;
+        MMPXDbMusicObserver& iObserver;
+        TBool iRefresh;
+    };
+
+#endif // MPXDBMUSIC_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbplaylist.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,335 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class manages the Playlist table and owns a
+*                CMPXPlaylistSongs instance for managing the PlaylistSongs and
+*                PlaylistSongInfo tables.
+*
+*                The Playlist table stores one record for each playlist.
+*
+*
+*/
+
+
+#ifndef MPXDBPLAYLIST_H
+#define MPXDBPLAYLIST_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+
+// CLASS FORWARDS
+class RSqlStatement;
+class CMPXDbPlaylistSongs;
+class CMPXMedia;
+class CMPXMediaArray;
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing the playlist tables
+*
+* @lib MPXDbPlugin.lib
+*/
+class MMPXDbPlaylistObserver
+	{
+	public:
+		virtual TInt HandlePlaylistDurationL(TUint32 aPlaylistId) = 0;
+	};
+class CMPXDbPlaylist : public CMPXDbTable
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbPlaylist instance.
+        */
+        static CMPXDbPlaylist* NewL(CMPXDbManager& aDbManager, MMPXDbPlaylistObserver& aObserver);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbManager instance on the cleanup stack.
+        */
+        static CMPXDbPlaylist* NewLC(CMPXDbManager& aDbManager, MMPXDbPlaylistObserver& aObserver);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbPlaylist();
+
+    public:
+
+        /**
+        * Add a playlist to the playlist table.  If playlist already exists,
+        * it is updated.
+        * @param aMedia playlist media to be added to the collection
+        * @return The unique id of the playlist
+        */
+        TUint32 AddPlaylistL(const CMPXMedia& aMedia);
+
+        /**
+        * Add one or multiple songs to the playlist.
+        * @param aPlaylistId identifies the playlist
+        * @param aMediaArray contains the song information to be added
+        */
+        void AddSongsL(TUint32 aPlaylistId, const CMPXMediaArray& aMediaArray);
+
+        /**
+        * Update playlist info
+        * @param aMedia playlist object which contains playlist Id, file path,
+        *               timestamp, etc... to be updated in the playlist table
+        * @param aMessage change event message for the playlist updated
+        */
+        void UpdatePlaylistL(const CMPXMedia& aMedia, CMPXMessage& aMessage, TInt aDriveId);
+
+        /**
+        * Update a playlist song
+        * @param aMedia song info
+        * @param aResetFlags indicates whether the song db flags should be reset or just updated
+        * @param aItemChangedMessages returns the change messages for the playlists updated
+        * @return ETrue if the change is visible in the UI
+        */
+        TBool UpdateSongL(const CMPXMedia& aMedia, TBool aResetFlags,
+            CMPXMessageArray* aItemChangedMessages = NULL);
+
+        /**
+        * Remove a playlist and return its URI
+        * @param aPlaylistId identifies the playlist
+        * @return HBufC containing the URI. Ownership is transferred.
+        */
+        HBufC* DeletePlaylistL(TUint32 aPlaylistId);
+
+        /**
+        * Remove a playlist
+        * @param aPlaylistId identifies the playlist
+        */
+        void DeletePlaylistNoUriL(TUint32 aPlaylistId);
+
+        /**
+        * Delete a song from the playlist tables.
+        * @param aSongId identifies the song
+        * @param aItemChangedMessages returns the item changed messages
+        */
+        void DeleteSongL(TUint32 aSongId, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Delete a song from the playlist tables.
+        * @param aPlaylistId identifies the playlist
+        * @param aSongId identifies the song
+        * @param aOrdinal song ordinal
+        */
+        void DeleteSongL(TUint32 aPlaylistId, TUint32 aSongId, TInt aOrdinal);
+
+        /**
+        * Remove all playlists.
+        */
+        void DeleteAllPlaylistsL();
+
+        /**
+        * Gets the total number of playlists.
+        * @return number of playlists
+        */
+        TInt CountL();
+
+        /**
+        * Get information on a specified playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aAttrs the attributes to include for the playlists found.
+        * @param aMedia returns the playlist information
+        */
+        void GetPlaylistL(TUint32 aPlaylistId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Get all playlists
+        * @param aAttrs the attributes to include for the playlists found.
+        * @param aMediaArray returns the playlist information
+        */
+        void GetAllPlaylistsL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the name of a playlist.
+        * @param aPlaylistId identifies the playlist
+        * @return name matching the specified playlist ID. Ownership is transferred.
+        */
+        HBufC* GetNameL(TUint32 aPlaylistId);
+
+        /**
+        * Get a playlist' uri
+        * @param aPlaylistId identifies the playlist
+        * @return URI matching the specified playlist ID. Ownership is transferred.
+        */
+        HBufC* GetUriL(TUint32 aPlaylistId);
+
+        /**
+        * Return the playlist ID for a specified URI.
+        * @param aUri URI of the playlistId
+        * @return playlist ID
+        */
+        TUint32 GetIdL(const TDesC& aUri);
+
+        /**
+        * Find playlist(s) which match(es) the selection criteria
+        * @param aCriteria selection criteria
+        * @param aAttrs the attributes to include for the playlist(s) matching the
+        *        selection criteria
+        * @param aMediaArray playlist(s) matching the selection criteria
+        */
+        void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Find the drive Id for a playlist
+        * @param aPlaylistId identifies the playlist
+        * @return corresponding drive id
+        */
+        TInt GetDriveIdL(TUint32 aPlaylistId);
+
+        /**
+        * Provides access to the songs for the current playlist.
+        * @return CMPXDbPlaylistSongs reference to be used to access the songs
+        */
+        CMPXDbPlaylistSongs& Songs();
+
+        /**
+        * Returns the playlist count for a given drive
+        * @param aDrive drive
+        * @return the count
+        */
+        TUint GetDrivePlaylistCountL(TInt aDrive);
+
+        /**
+        * Get URIs for a given number of playlists
+        * @param aDrive, specifies drive number for db selection
+        * @param aFromID, specifies unique ID of last record retrieved
+        * @param aRecords, specifies the number of records to get
+        * @param aUriArr, will contain all URIs on return
+        * @param aLastID, will contain unique ID of a last record in the array
+        */
+        void GetPlaylistUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                  CDesCArray& aUriArr, TInt& aLastID);
+
+    private:
+
+        /**
+        * Update the media with information found in the Playlist table
+        * @param aRecord playlist table
+        * @param aAttrs the attributes to include for the playlist matching the
+        *        selection criteria
+        * @param aMedia returns playlist details
+        */
+        void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Create playlist table view and have the current row point to aPlaylistId
+        * @param aPlaylistId ID of the playlist to match
+        * @return RSqlStatement with row pointing to selected aPlaylistId
+        * Function leaves with KErrNotFound if RSqlStatement is unable to initialize
+        * or row cannot be found
+        */
+        RSqlStatement GetPlaylistRecordL(TUint32 aPlaylistId);
+
+        /**
+        * Add a new playlist
+        * @param aMedia contains the playlist info
+        * @param aDriveId drive to add the playlist to
+        * @return ID of the new playlist
+        */
+        TUint32 DoAddPlaylistL(const CMPXMedia& aMedia, TInt aDriveId);
+
+        /**
+        * Update a playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aMedia contains the playlist info
+        * @param aDriveId drive to add the playlist to
+        * @param aMessage change event message for the playlist updated
+        */
+        void DoUpdatePlaylistL(TUint32 aPlaylistId, const CMPXMedia& aMedia, TInt aDriveId,
+            CMPXMessage& aMessage);
+
+        /**
+        * Sets the Time field for all playlists that contain the specified song to the
+        * current time
+        * @param aSongId identifies the song
+        * @param aItemChangedMessages if not NULL item changed messages are added for all
+        *           updated playlists
+        * @param aSongInPlaylists out parameter that flags if the song is part of a playlist or not
+        */
+        void UpdatePlaylistsForSongL(TUint32 aSongId, CMPXMessageArray* aItemChangedMessages,TBool &aSongInPlaylists);
+
+        /**
+        * Sets the Time field for a playlist to the current time.
+        * @param aPlaylistId identifies the playlist
+        * @param aDrive playlist drive
+        */
+        void UpdatePlaylistTimeL(TUint32 aPlaylistId, TInt aDrive);
+
+        TInt GetDrivePlaylistDuration(TUint32 aPlaylistId);
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+     private:
+
+        /**
+        * C++ constructor
+        * @param aDbManager database manager to use for database interactions
+        */
+        CMPXDbPlaylist(CMPXDbManager& aDbManager, MMPXDbPlaylistObserver& aObserver);
+
+        /**
+        * Second phase constructor
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the playlist table
+        */
+        enum TPlaylistColumns
+            {
+            EPlaylistUniqueId = KMPXTableDefaultIndex,
+            EPlaylistVolumeId,
+            EPlaylistDbFlag,
+            EPlaylistSync,
+            EPlaylistName,
+            EPlaylistUri,
+            EPlaylistTime
+            };
+
+    private:    // Data
+
+        CMPXDbPlaylistSongs* iPlaylistSongs;
+		MMPXDbPlaylistObserver& iObserver;
+    };
+
+#endif // MPXDBPLAYLIST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbplaylistsongs.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,327 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for the functionality related to
+*                playlist songs. The class operates on two tables: PlaylistSongs
+*                and PlaylistSongInfo.
+*
+*                The PlaylistSongs table contains records for all song instances in
+*                playlists. For example if a playlist contains 7 songs, there will be 7
+*                corresponding records in the PlaylistSongs table, even if one song has
+*                multiple instances in the playlist.
+*
+*                The PlaylistSongInfo table contains one record for each song included
+*                in at least one playlist. Redundant song information is stored in this
+*                table to help with songs on different drives than the playlist.
+*
+*
+*/
+
+
+#ifndef MPXDBPLAYLISTSONGS_H
+#define MPXDBPLAYLISTSONGS_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+
+// CLASS FORWARDS
+class CMPXMedia;
+class CMPXMediaArray;
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing the music table
+*
+* @lib MPXDbPlugin.lib
+*/
+class CMPXDbPlaylistSongs :
+    public CMPXDbTable
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbPlaylistSongs instance.
+        */
+        static CMPXDbPlaylistSongs* NewL(CMPXDbManager& aDbManager);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbPlaylistSongs instance on the cleanup stack.
+        */
+        static CMPXDbPlaylistSongs* NewLC(CMPXDbManager& aDbManager);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbPlaylistSongs();
+
+    public:
+
+        /**
+        * Add a song/songs to the given playlist
+        * @param aPlaylistId playlist id
+        * @param aMediaArray media array which contains the tracks to be added to the playlist
+        * @param aDriveId Drive Id of corresponding playlist
+        */
+        void AddSongsL(TUint32 aPlaylistId, const CMPXMediaArray& aMediaArray, TInt aDriveId);
+
+        /**
+        * Add a song to playlist songs table for the given playlist
+        * @param aPlaylistId id of the playlist to add the song to
+        * @param aDriveId drive the song is on
+        * @param aMedia song media to be added to the playlist songs table for the playlist
+        * @return song ID
+        */
+        TUint32 AddSongL(TUint32 aPlaylistId, const CMPXMedia& aMedia, TInt aDriveId);
+
+        /**
+        * Add a song to playlist songs table for the given playlist
+        * @param aPlaylistId id of the playlist to add the song to
+        * @param aOrdinal ordinal of the song to be added
+        * @param aDriveId drive the song is on
+        * @param aMedia song media to be added to the playlist songs table for the playlist
+        * @return song ID
+        */
+        TUint32 AddSongL(TUint32 aPlaylistId, TInt aOrdinal, const CMPXMedia& aMedia,
+            TInt aDriveId);
+
+        /**
+        * Update song info for a song in the playlist songs table
+        * @param aSongId identifies the song
+        * @param aMedia song information
+        * @param aResetFlags indicates whether the song db flags should be reset or just updated
+        * @param aUpdated returns ETrue if the song information has changed
+        */
+        TBool UpdateSongL(TUint32 aSongId, const CMPXMedia& aMedia, TBool aResetFlags,
+            TBool& aUpdated);
+
+        /**
+        * Update songs in a playlist to reflect playlist id change
+        * @param aPlaylistId identifies the songs in the playlist
+        * @param aNewPlaylistId specifies the new playlist id the songs should be associated with
+        */
+        void UpdateSongsL(TUint32 aPlaylistId, TUint32 aNewPlaylistId);
+
+        /**
+        * Reorder the song in the playlist
+        * @param aPlaylistId id of the playlist which contains the song to be reordered
+        * @param aSongId id of the song to be reordered
+        * @param aOriginalOrdinal the original ordinal of the song within the playlist.
+        *        Ordinal starts from 0.
+        * @param aNewOrdinal the new ordinal of the song within the playlist. Ordinal
+        *        starts from 0.
+        */
+        void ReorderSongL(const TMPXItemId& aPlaylistId, const TMPXItemId& aSongId,
+            TUint aOriginalOrdinal, TUint aNewOrdinal);
+
+        /**
+        * Remove the given song from all playlists
+        * @param aSongId ID of the song to remove
+        * @param aDriveId identifies the database to be updated
+        */
+        void DeleteSongL(TUint32 aSongId);
+
+        /**
+        * Remove a song from the playlist.
+        * @param aPlaylistId ID of the playlist to remove the song from
+        * @param aSongId Id of the song in the playlist to be removed
+        * @param aOrdinal the ordinal of the song in the playlist. This uniquely
+        *        identifies which song in the playlist to be removed; whereas song
+        *        ID doesn't because duplicate tracks in the playlist are allowed.
+        *        The position is relative to zero, i.e. zero implies that the song
+        *        at the beginning of the playlist is to be removed.
+        * @param aDriveId identifies the database to be updated
+        */
+        void DeleteSongL(TUint32 aPlaylistId, TUint32 aSongId, TInt aOrdinal, TInt aDriveId);
+
+        /**
+        * Remove all songs from the specified playlist
+        * @param aPlaylistId ID of the playlist.
+        * @param aDriveId identifies the database.
+        */
+        void DeleteSongsL(TUint32 aPlaylistId, TInt aDriveId);
+
+        /**
+        * Remove the songs for a given category from all playlists.
+        * @param aCategory identifies the category
+        * @param aCategoryId identifies the category item
+        * @param aDriveId identifies the database to be updated
+        */
+        void DeleteSongsForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+            TInt aDriveId);
+
+        /**
+        * Remove the songs for a given category from all playlists.
+        * @param aCategory identifies the category
+        * @param aCategoryId identifies the category item
+        * @param aDriveId identifies the database to be updated
+        */
+        void DeleteSongsForArtistAndAlbumL(TUint32 aArtistId, TUint32 aAlbumId, TInt aDriveId);
+
+        /**
+        * Remove all songs from the playlist songs table
+        */
+        void DeleteAllSongsL();
+
+        /**
+        * Get ids of all songs in a playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aMediaArray returns songs' id
+        */
+        void GetSongsL(TUint32 aPlaylistId, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get ids of all songs in a playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aAttrs attributes to return
+        * @param aMediaArray returns songs' id
+        */
+        TBool GetSongsL( TUint32 aPlaylistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get information on a song in a playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aSongId identifies the song
+        * @param aAttrs attributes to return
+        * @param aMedia returns song info
+        */
+        TBool GetSongL(TUint32 aPlaylistId, TUint32 aSongId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia);
+
+        /**
+        * Get information on a song
+        * @param aSongId identifies the song
+        * @param aAttrs attributes to return
+        * @param aMedia returns song info
+        */
+        TBool GetSongL(const TMPXItemId& aSongId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia*& aMedia);
+
+
+        /**
+        * Get the number of songs for a playlist
+        * @param aPlaylistId identifies the playlist
+        * @return number of songs
+        */
+        TInt CountL(TUint32 aPlaylistId);
+
+    private:
+
+        /**
+        * Update the media from the table
+        * @param aRecord playlist table view
+        * @param aAttrs the attributes to return
+        * @param aMedia updated with the playlist song info
+        */
+        void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Get the number of instances of a song in a playlist
+        * @param aPlaylistId identifies the playlist
+        * @param aSongId identifies the song
+        * @return number of instances
+        */
+        TInt SongInstanceCountL(TUint32 aPlaylistId, TUint32 aSongId);
+
+        /**
+        * Get the number of instances of a song in the PlaylistSongs table.
+        * @param aSongId identifies the song
+        * @return number of instances
+        */
+        TInt SongCountL(TUint32 aSongId);
+
+        /**
+        * Checks if the specified song exists in the PlaylisySongInfo table.
+        * @param aDriveId drive to check or KDbManagerAllDrives
+        * @param aSongId identifies the song
+        * @return ETrue if it exists, EFalse otherwise
+        */
+        TBool SongInfoExistsL(TInt aDriveId, TUint32 aSongId);
+
+        /**
+        * Deletes all orphaned records in the PlaylistSongInfo table
+        * (songs not included in any playlist).
+        * @param aDriveId database to cleanup
+        */
+        void CleanupSongInfoL(TInt aDriveId);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor
+        * @param aDbManager database manager to use for database interactions
+        */
+        CMPXDbPlaylistSongs(CMPXDbManager& aDbManager);
+
+        /**
+        * Safely construct things that can leave
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the playlist songs query
+        */
+        enum TPlaylistSongsColumns
+            {
+            EPlaylistSongsUniqueId = KMPXTableDefaultIndex,
+            EPlaylistSongsSongId,
+            EPlaylistSongsPlaylistId,
+            EPlaylistSongsOrdinal,
+            EPlaylistSongsVolumeId,
+            EPlaylistSongsDbFlag,
+            EPlaylistSongsUri,
+            EPlaylistSongsTitle
+            };
+
+        /**
+        * Column indexes in the playlist song info table
+        */
+        enum TPlaylistSongInfoColumns
+            {
+            EPlaylistSongInfoSongId = KMPXTableDefaultIndex,
+            EPlaylistSongInfoVolumeId,
+            EPlaylistSongInfoDbFlag,
+            EPlaylistSongInfoUri,
+            EPlaylistSongInfoTitle
+            };
+
+    };
+
+#endif // MPXDBPLAYLISTSONGS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,794 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of collection Database Plugin interface
+*
+*/
+
+
+#ifndef MPXDBPLUGIN_H
+#define MPXDBPLUGIN_H
+
+// INCLUDES
+#include <badesca.h>
+#include <mpxcommonframeworkdefs.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxcollectionplugin.h>
+#include <mpxcollectionpath.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmessage2.h>
+
+#include "mpxdbactivetask.h"
+#include "mpxcollectiondb.hrh"
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXDbHandler;
+class CMPXDrmMediaUtility;
+class CMPXMediaArray;
+class CMPXResource;
+struct TMPXOpenDataBlock;
+
+// CLASS DECLARATION
+
+/**
+* CMPXDbPlugin class
+* Implements the plugin interface.
+*
+* @lib MPXDbPlugin.lib
+*/
+NONSHARABLE_CLASS(CMPXDbPlugin) :
+    public CMPXCollectionPlugin,
+    public MMPXDbActiveTaskObserver
+    {
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor
+    * @param aInitParams: initialization parameters
+    * @return object constructed
+    */
+    static CMPXDbPlugin* NewL (TAny* aInitParams);
+
+    /**
+    * Destructor
+    */
+    virtual ~CMPXDbPlugin();
+
+public: // from base classes
+
+    /**
+    * From CMPXCollectionPlugin
+    * Navigates to the given path. This method is serviced
+    * asynchronously and HandleOpenL is called upon completion
+    * @param aPath a path
+    * @param aAttrs attributes requested
+    * @param aFilter filter to apply or NULL if none
+    */
+    void OpenL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXFilter* aFilter);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Get the extended properties of the item referred to by the
+    * specified collection path.  This method is serviced asynchronously and
+    * HandleMediaL is called upon completion
+    * @param aPath a collection path referring to the item to retrieve the
+    *               extended properties for
+    * @param aAttrs array of attributes requested
+    * @param aCaps platsec capabilities of client requesting media; plug-in
+    *        should also verify its process capabilities (not yet supported)
+    * @aParam aSpecs specifications for attributes (not yet supported)
+    */
+    void MediaL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        const TArray<TCapability>& aCaps, CMPXAttributeSpecs* aSpecs);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Cancel outstanding request. Note*** CancelRequest is not currently
+    * implemented because all requests are processed synchronously
+    */
+    void CancelRequest();
+
+    /**
+    * From CMPXCollectionPlugin
+    * Executes the given TMPXCollectionCommand command on the collection
+    * @param aCmd a command
+    * @param aArg an argument
+    */
+    void CommandL (TMPXCollectionCommand aCmd, TInt aArg = 0);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Executes the given CMPXCommand command on the collection
+    * @param aCmd a command
+    */
+    void CommandL(CMPXCommand& aCmd);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Adds an item (song or playlist) to the collection
+    * @param aMedia Properties of the item
+    */
+    void AddL(const CMPXMedia& aMedia);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Remove an item from the collection database using the given path
+    * Note that the selection indices are hidden within the path
+    * @param aPath path to the item to be removed
+    *
+    */
+    void RemoveL(const CMPXCollectionPath& aPath);
+
+    /**
+    *  Remove item(s) from the collection database using the given media properties
+    *  @param aMedia Properties of the item(s) to be removed. May cantain a URI
+    *           or metadata. All item(s) matching the specified properties
+    *           will be removed.
+    */
+    void RemoveL(const CMPXMedia& aMedia);
+
+    /**
+    *  Sets/updates the specified media for an item in the collection.  Media
+    *  is identified by specifying an ID or URI.
+    *  @param aMedia new property values for the item
+    */
+    void SetL(const CMPXMedia& aMedia);
+
+    /**
+    * From CMPXCollectionPlugin
+    *  Find the items matching the media specifications.  This method is serviced
+    *  asynchronously and HandleFindAllL is called upon completion
+    *  @param aCriteria Properties of the item that is to be found
+    *  @param aAttrs Requested attributes to return
+    */
+    void FindAllL (const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs);
+
+    /**
+    *  From CMPXCollectionPlugin
+    *  Find the items matching the media specifications
+    *  @param aCriteria Properties of the item that is to be found
+    *  @param aAttrs Requested attributes to return
+    *  @return results of the search. Method abandons ownership of results.
+    */
+    CMPXMedia* FindAllSyncL(const CMPXMedia& aCriteria,
+        const TArray<TMPXAttribute>& aAttrs);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Get the list of supported capabilities
+    * @return TCollectionCapability, bitmask of supported capabilities
+    */
+    TCollectionCapability GetCapabilities ();
+
+    /**
+    * From MMPXDbActiveTaskObserver
+    */
+    TBool HandleStepL();
+
+    /**
+    * From MMPXDbActiveTaskObserver
+    */
+    void HandleOperationCompleted(TInt aErr);
+
+private:
+    /**
+    * Constructor
+    */
+    CMPXDbPlugin();
+
+    /**
+    * Symbian 2nd phase constructor.
+    */
+    void ConstructL();
+
+    /**
+    * Process the OpenL command
+    * @param aPath a path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aFilter CMPXFilter Object
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXFilter* aFilter );
+
+    /**
+    * Process the OpenL(EBrowseAll) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowseAllL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process the OpenL(EBrowseArtist) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowseArtistL(const CMPXCollectionPath& aPath,
+        const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process the OpenL(EBrowseAlbum) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowseAlbumL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process the OpenL(EBrowsePlaylist) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowsePlaylistL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process the OpenL(EBrowseGenre) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowseGenreL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+       CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process the OpenL(EBrowseComposer) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for a song, EFalse otherwise
+    */
+    TBool DoOpenBrowseComposerL(const CMPXCollectionPath& aPath,  const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Process an OpenL command with a EMPXOpenPlaylistOnly open mode
+    * @param aPath path that we want to open
+    * @param aAttrs default attributes to fetch
+    * @return CMPXCollectionPath* which is the new valid browse path
+    */
+    CMPXCollectionPath* DoOpenPlaylistL( const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs );
+
+    /**
+    * Process the MediaL command
+    * @param aPath a path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries collection items containing media properties of all items, returned if opening a group of items
+    */
+    void DoMediaL (const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aEntries);
+
+    /**
+    * Get the plugin title, subtitle, icons for this plugin
+    * @param aAttrs attributes to find
+    * @param aMedia media object
+    */
+    void DoRootMediaL(const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia);
+
+    /**
+    * Get the media under ALL SONGS category
+    * @param aPath path that leads to a media under ALL SONGS
+    * @param aAttrs attributes of media to find
+    * @param aEntries the media referred by the path
+    * @param aMediaArray media entries contained in the media referred by the path
+    */
+    void DoAllSongsMediaL(const CMPXCollectionPath& aPath,
+                            const TArray<TMPXAttribute>& aAttrs,
+                            CMPXMedia& aEntries,
+                            CMPXMediaArray& aMediaArray);
+
+    /**
+    * Get the media under ARTISTS category
+    * @param aPath path that leads to a media under ARTISTS
+    * @param aAttrs attributes of media to find
+    * @param aEntries the media referred by the path
+    * @param aMediaArray media entries contained in the media referred by the path
+    */
+    void DoArtistMediaL(const CMPXCollectionPath& aPath,
+                          const TArray<TMPXAttribute>& aAttrs,
+                          CMPXMedia& aEntries,
+                          CMPXMediaArray& aMediaArray);
+
+    /**
+    * Get the root media under ALBUMS/PLAYLISTS/GENRES/COMPOSERS
+    * @param aAttrs attributes of media to find
+    * @param aRootCategoryId Id of the root media in the category, i.e. all albums,
+    *        ...etc.
+    * @param aCategory specifies the category. Will be either EMPXAlbum, EMPXPlaylist,
+    *        EMPXGenre, or EMPXComposer
+    * @param aEntries the media referred by the path
+    */
+    void DoRootCategoryMediaL(const TArray<TMPXAttribute>& aAttrs,
+                               TMPXItemId aRootCategoryId,
+                               TMPXGeneralCategory aCategory,
+                               CMPXMedia& aEntries);
+
+    /**
+    * Get the media under album/playlist/genre/composer category
+    * @param aPath path that leads to a media under ALBUMS/PLAYLISTS/GENRES/COMPOSERS
+    * @param aAttrs attributes of media to find
+    * @param aCategory specifies the category. Will be either EMPXAlbum, EMPXPlaylist,
+    *        EMPXGenre, or EMPXComposer
+    * @param aEntries the media referred by the path
+    * @param aMediaArray medias contained in the media referred by the path
+    */
+    void DoCategoryMediaL(const CMPXCollectionPath& aPath,
+                           const TArray<TMPXAttribute>& aAttrs,
+                           TMPXGeneralCategory aCategory,
+                           CMPXMedia& aEntries,
+                           CMPXMediaArray& aMediaArray);
+
+    /**
+    * Set all the attributes in CMPXMedia corresponding to KMPXMediaIdDrm
+    * @param aMedia, media to update
+    * @param aDrmAttributes, bitwise or of the flags we want
+    * @param aLocation, full file path including filename
+    */
+    void DoSetMediaDrmL(CMPXMedia& aMedia, TUint aDrmAttributes, const TDesC& aLocation);
+
+    /**
+    * Add media objects to the array with attributes from song details
+    * @param aPath a path
+    * @param aAttrs requested attributes
+    * @param aEntry media to contain information about the container if it contains
+    *        than one entry
+    * @param aMediaArray array to contain all the media objects added
+    */
+    void GetSongInfoL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntry, CMPXMediaArray& aMediaArray);
+
+    /**
+    * Add media objects to the array with attributes from song details
+    * @param aAttrs requested attributes
+    * @param aEntryId song ID
+    * @param aPlaylistId corresponding playlist ID, if 0 the attributes will be read from
+    *        the songs table, otherwise they will be read from the playlist table.
+    * @param aEntry media to contain information about the container if it contains
+    *        than one entry
+    */
+    void DoGetSongInfoL(const TArray<TMPXAttribute>& aAttrs, TInt aEntryId, TInt aPlaylistId,
+        CMPXMedia& aEntry);
+
+    /**
+    * Get the collection details from the db
+    * @param aAttrs, attributes to find
+    * @param aMedia, media object
+    */
+    void DoHandleOtherMediaAttributesL(const TArray<TMPXAttribute>& aAttrs,
+        const CMPXCollectionPath& aPath, CMPXMedia& aMedia);
+
+    /**
+    * Remove an item from the collection database using the given path
+    * Note that the selection indices are hidden within the path
+    * @param aPath path to the item to be removed
+    * @param aChangeMsgArray array to store change messages
+    * @return an array of files associated with the removed media entries
+    */
+    CDesCArray* DoRemoveL(const CMPXCollectionPath& aPath,
+        CMPXMessageArray& aChangeMsgArray);
+
+    /**
+    * Remove an item/items from the collection database using the given media properties
+    * @param aMedia: Properties of the item that is to be removed. It may cantain URI only
+    *                or meta data, all of items matched properties will be removed.
+    * @param aDeleteRecord: indicates whether the client has explictly requested
+    *                to delete the records from the database. If ETrue, records
+    *                associated with the media will be deleted from the database;
+    *                if EFalse, whether to mark the records as deleted or to delete
+    *                the records will be based on other deciding factors.
+    */
+    void DoRemoveL(const CMPXMedia& aMedia, TBool aDeleteRecord);
+
+    /**
+    * Remove an item from the collection database using a command
+    * @param aCmd: remove command which contains collection path to the media(s) to be
+    *        removed. This method should be called until all the selected items are
+    *        removed. When that happens, EMPXCommandCompleted flag is set to ETrue.
+    *        see KMPXCommandIdCollectionRemove in mpxcollectioncommanddefs.h
+    */
+    void DoRemovePathL(CMPXCommand& aCmd);
+
+    /**
+    * Remove a media/medias from the collection database using a command
+    * @param aCmd: remove command which contains the media(s) to be removed. This
+    *        will delete the records from the database rather than marking them
+    *        as deleted. Designated caller is MTP.
+    */
+    void DoRemoveMediaL(CMPXCommand& aCmd);
+
+    /**
+    * Remove a media/medias from all songs view
+    * @param aPath, collection path that points to the media items to be removed
+    * @param aSelections, multiple media items selected. This array contains the id
+    *        of the selected media.
+    * @param aUriArray: a descriptor array containing the URI(s) of the deleted file(s)
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void DoRemoveFromAllSongsL(const CMPXCollectionPath& aPath,
+                               const TArray<TMPXItemId>& aSelections,
+                               CDesCArray& aUriArray,
+                               CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media/medias from artists view
+    * @param aPath, collection path that points to the media(s) to be removed
+    * @param aSelections, multiple media items selected. This array contains the id
+    *        of the selected media.
+    * @param aUriArray: a descriptor array to contain the URI of the deleted file
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void DoRemoveFromArtistsL(const CMPXCollectionPath& aPath,
+                              const TArray<TMPXItemId>& aSelections,
+                              CDesCArray& aUriArray,
+                              CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media/medias from artists view
+    * @param aPath, collection path that points to the media(s) to be removed
+    * @param aItemId media item to be removed.
+    * @param aUriArray: a descriptor array to contain the URI of the deleted file
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void RemoveFromArtistsL(const CMPXCollectionPath& aPath,
+                                TUint32 aItemId,
+                                CDesCArray& aUriArray,
+                                CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media entry/entries from albums/genres/composers view
+    * @param aPath, collection path that points to the media entry/entries to be removed
+    * @param aSelections, multiple media entries selected. This array contains the id
+    *        of the selected media.
+    * @param aCategory, indicates one of the 3 categories, EMPXAlbum, EMPXGenre, or
+    *        EMPXComposer
+    * @param aUriArray: a descriptor array to contain the URI(s) of the deleted file(s)
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void DoRemoveFromCategoriesL(const CMPXCollectionPath& aPath,
+                                 const TArray<TMPXItemId>& aSelections,
+                                 TMPXGeneralCategory aCategory,
+                                 CDesCArray& aUriArray,
+                                 CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media entry from albums/genres/composers view
+    * @param aPath, collection path that points to the media entry/entries to be removed
+    * @param aItemId item ID to be removed.
+    * @param aCategory, indicates one of the 3 categories, EMPXAlbum, EMPXGenre, or
+    *        EMPXComposer
+    * @param aUriArray: a descriptor array to contain the URI(s) of the deleted file(s)
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void RemoveFromCategoriesL(const CMPXCollectionPath& aPath,
+                                TUint32 aItemId,
+                                TMPXGeneralCategory aCategory,
+                                CDesCArray& aUriArray,
+                                CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media entry/entries from playlists view
+    * @param aPath, collection path that points to the media(s) to be removed
+    * @param aSelections, multiple medias selected. This array contains the id
+    *        of the selected media.
+    * @param aUriArray: a descriptor array to contain the URI of the deleted file
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void DoRemoveFromPlaylistsL(const CMPXCollectionPath& aPath,
+                                const TArray<TMPXItemId>& aSelections,
+                                CDesCArray& aUriArray,
+                                CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media entry/entries from playlists view
+    * @param aPath, collection path that points to the media(s) to be removed
+    * @param aItemId item to be removed
+    * @param aIndex item index to be removed
+    * @param aUriArray: a descriptor array to contain the URI of the deleted file
+    * @param aItemChangedMessages: a list of change events as a result of the
+    *        song removals
+    */
+    void RemoveFromPlaylistsL(const CMPXCollectionPath& aPath,
+                                const TMPXItemId& aItemId,
+                                TInt aIndex,
+                                CDesCArray& aUriArray,
+                                CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Retrieves URIs associated with the path for file deletion
+    * @param aCmd, command to retrieve associated URIs for the given path. If
+    *        path ends with a particular artist/album/genre/composer, the path
+    *        will be updated to include all songs in that category. If path
+    *        ends with one or more medias in a particular playlist, an array
+    *        of 0 elements will be returned to avoid client deleting them from
+    *        the file system. see KMPXCommandIdCollectionRetrieveUriForDeletion
+    *        defined in mpxcollectioncommanddefs.h
+    */
+    void DoRetrieveUriForDeletionL(CMPXCommand& aCmd);
+
+    /**
+    * Deletes records which have been marked as deleted from the collection
+    * @param aCmd command to cleanup deleted medias.
+    *        see KMPXCommandIdCollectionCleanupDeletedRecords defined in
+    *        mpxcollectioncommanddefs.h
+    */
+    void CleanupDeletedRecordsL(CMPXCommand& aCmd);
+
+    /**
+    * Fetch the duration for a specific category
+    * @param aMedia a media object of which EMPXMediaGeneralDuration is to be
+    *        populated with the duration calculated in this method
+    * @param aFirstCat category of the 1st Id
+    * @param aId id for identifying which category to calculate the duration for
+    * @param aSecondCat category of the 2nd Id
+    * @param aSubId 2nd id for identifying which category to calculate the
+    *        duration for. For example, to calculate the duration of an album of
+    *        a particular artist, 1st Id provided will be the artist Id and the
+    *        2nd Id provided will be the album Id.
+    */
+    TInt DoDurationL(CMPXMedia& aMedia, TMPXGeneralCategory aFirstCat, TMPXItemId aId = 0,
+                      TMPXGeneralCategory aSecondCat = EMPXNoCategory, TMPXItemId aSubId = 0);
+
+    /**
+    * Append a collection level to the collection path
+    * @param aPath, path to append the level to
+    * @param aMedia, media to extract media ids from
+    * @note: Selection will be put on the first song in the collection path
+    */
+    TInt DoAppendLevelL(CMPXCollectionPath& aPath, CMPXMedia& aMedia);
+
+    /**
+    * Append a collection level to the collection path with all songs under the
+    * selected category/categories (e.g. artist/artist-album/album/genre/composer).
+    * Once the level is appended, all songs under the selected category/categories
+    * are selected.
+    * @param aPath, path to append the level to. Path remains unchanged if it's not
+    *        one of the following:
+    *        1) path ends at an artist or selected artists
+    *        2) path ends at an album of an artist or selected albums of an artist
+    *        3) path ends at an album or selected albums
+    *        4) path ends at a genre or selected genres
+    *        5) path ends at a composer or selected composers
+    */
+    void DoAppendLevelL(CMPXCollectionPath& aPath);
+
+    /**
+    * Execute a task step for an asynchronous add
+    */
+    TBool DoAddAsyncL();
+
+    /**
+    * Add a media object to the collection
+    * @param aMedia media to add
+    * @return TUint32 item id of the item added
+    */
+    TUint32 DoAddL(const CMPXMedia& aMedia);
+
+    /**
+    * Add an item into the collection
+    * @param aMedia media to add
+    * @param aMessageArray change message array
+    */
+    TUint32 DoAddItemL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray,
+                        TBool aBatchCommit = EFalse);
+
+    /**
+    * Set a media object to update the collection
+    * @param aMedia media can be an item or a list. The item is treated as a list
+    *               if it contains a media array
+    */
+    void DoSetL(const CMPXMedia& aMedia);
+
+    /**
+    * Execute a task step for an asynchronous set
+    */
+    TBool DoSetAsyncL();
+
+    /**
+    * Set an item media to update the collection
+    * @param aMedia media to update
+    * @param aMessageArray array to append change messages
+    * @return ETrue if the update is UI visible, EFalse otherwise
+    */
+    CMPXDbActiveTask::TChangeVisibility DoSetItemL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray);
+
+    /**
+    * Set the drm properties for an array of medias
+    * @param mediaArray CMPXMediaArray list of medias
+    * @param aAtts attribute list
+    */
+    void DoSetDrmForArrayL(const CMPXMediaArray& mediaArray,
+                            const TArray<TMPXAttribute>& aAttrs);
+
+    /**
+    * Send a change message
+    *
+    * @param aMessage: a change message to be sent
+    */
+    void HandleChangeL(const CMPXMessage& aMessage);
+
+    /**
+    * Construct a CMPXMedia from the array parameter and call HandleChange
+    *
+    * @param aItemChangedMessages: array in the change message to be sent
+    * @param aCommandid command that was executed
+    */
+    void DoHandleChangeL(CMPXMessageArray* aItemChangedMessages,
+                         TMPXCommandId aCommandId = 0 );
+
+    /**
+    * Returns the category for a given browse type.
+    *
+    * @param aBrowseType browse type
+    * @return Category ID
+    */
+    TMPXGeneralCategory CategoryForBrowseType(TMCBrowseType aBrowseType);
+
+    /**
+    * Returns the browse type for a given category ID.
+    *
+    * @param aCategory category ID
+    * @return Browse type
+    */
+    TMCBrowseType BrowseTypeForCategory(TMPXGeneralCategory aCategory);
+
+    /**
+    * Sets the type, category and title attributes in the specified media.
+    *
+    * @param aMedia media instance to be updated
+    * @param aType type attribute value
+    * @param aCategory category attribute value
+    * @param aTitle title attribute value
+    */
+    void SetMediaGeneralAttributesL(CMPXMedia& aMedia, TMPXGeneralType aType,
+        TMPXGeneralCategory aCategory, const TDesC& aTitle);
+
+    /**
+    * Sets the type, category and title attributes in the specified media.
+    *
+    * @param aMedia media instance to be updated
+    * @param aType type attribute value
+    * @param aCategory category attribute value
+    * @param aId ID of the item to the title from
+    */
+    void SetMediaGeneralAttributesL(CMPXMedia& aMedia, TMPXGeneralType aType,
+        TMPXGeneralCategory aCategory, TInt aId);
+
+    /**
+    * Leaving function to handle async op completion
+    * @param aErr error code
+    */
+    void DoHandleOperationCompletedL(TInt aErr);
+
+    /**
+    * Complete a delete operation
+    * Sends out change messages and compacts the database
+    */
+    void DoHandleDeleteCompleteL( CMPXCommand& aCmd );
+
+    /**
+    * Reorder a song in a playlist
+    * @param aCmd command to reoder a song in a playlist
+    *        see KMPXCommandIdReorderPlaylist defined in
+    *        mpxcollectioncommanddefs.h
+    */
+    void DoReorderPlaylistL( const CMPXCommand& aCmd );
+
+    /**
+    * Get total song and playlist count
+    * @param aCmd command to return count
+    *        see KMPXCommandCollectionGetCount defined in
+    *        mpxcollectioncommanddefs.h
+    */
+    void DoGetCollectionCountL( const CMPXCommand& aCmd );
+
+    /**
+    * Get an array of URIs for all songs and playlists in a given db
+    * @param aCmd command to return CDesCArray
+    *        see KMPXCommandCollectionGetURIs defined in
+    *        mpxcollectioncommanddefs.h
+    */
+    void DoGetCollectionUriL( const CMPXCommand& aCmd );
+
+    /**
+    * Perform 1 step of the incremental read operation
+    * @param aCmd Command to process
+    */
+    void DoIncrementalOpenL( const CMPXCommand& aCmd );
+
+    /**
+    * Open the all songs view incrementally
+    * @param aPath path that leads to a media under ALL SONGS
+    * @param aAttrs attributes of media to find
+    * @param aEntries the media referred by the path
+    * @param aMediaArray media entries contained in the media referred by the path
+    */
+    TBool DoOpenIncrementalL( const CMPXCollectionPath& aPath,  const TArray<TMPXAttribute>& aAttrs,
+                              CMPXMedia& aEntries, CMPXMediaArray* aArray);
+
+    /**
+    * Set the attribute list according to current path
+    * @param aPath a path
+    * @param aAttrs attributes array to be filled
+    * @param aSupportedIds array of supported content IDs to be filled
+    */
+    void SetAttributesL( const CMPXCollectionPath& aPath, RArray<TMPXAttribute>& aAttrs,
+                         RArray<TInt>& aSupportedIds );
+
+#ifdef _DEBUG
+    /**
+    * Prints messages for debugging
+    * @param aMessage: message(s) to be printed
+    */
+    void PrintMessagesL(const CMPXMessage& aMessage);
+
+    /**
+    * Prints a single message for debugging
+    * @param aMessage: a message to be printed
+    */
+    void PrintMessage(const CMPXMessage& aMessage);
+#endif // _DEBUG
+
+private:
+    // owned member variables
+    RFs                  iFs;
+    CMPXResource*        iResource;
+    CMPXDbHandler*       iDbHandler;
+    CMPXDrmMediaUtility* iDrmMediaUtility;
+    CDesCArrayFlat*      iMusicLibraryMenuTitles;      // titles for each of the menu items
+    CDesCArrayFlat*      iMusicLibraryTitles;          // titles for each of the category views
+    RArray<TInt>         iMusicLibraryMenuIds;         // music library item menu IDs
+    HBufC*               iAllSongsForArtistTitle;
+    HBufC*               iMusicMenuTitle;
+    TBool                iDisablePodcasting;
+    TBool                iMtpInUse;
+    TBool                iRefreshing;
+    CMPXDbActiveTask*    iActiveTask;
+    RArray<TMPXItemId>   iSelections;   //selected items in the path
+    TBool iFirstDeleteStep;
+    TBool iAllSongsValid;    //to indicate if there's enough space to get all songs information from collection DB.
+    };
+
+#endif   // MPXDBPLUGIN_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbpluginqueries.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,402 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  SQLite queries for MPX collection db
+*
+*/
+
+
+#ifndef MPXDBPLUGINQUERIES_H
+#define MPXDBPLUGINQUERIES_H
+
+// SQLite queries
+
+// == Music table queries =====================================================
+//
+_LIT(KMusicCreateTable, "CREATE TABLE Music("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"DbFlag INTEGER,"
+    L"VolumeId INTEGER,"
+    L"Title TEXT COLLATE NOCASE,"
+    L"Artist INTEGER,"
+    L"Art TEXT,"
+    L"Deleted INTEGER DEFAULT 0,"
+    L"Location TEXT,"
+    L"AlbumTrack INTEGER,"
+    L"PlayCount INTEGER DEFAULT 0,"
+    L"TimeAdded TEXT,"
+    L"TimePlayed TEXT DEFAULT '',"
+    L"Duration INTEGER,"
+    L"Sync INTEGER DEFAULT 0,"
+    L"Modified INTEGER DEFAULT 0,"
+    L"Album INTEGER,"
+    L"Genre INTEGER,"
+    L"Composer INTEGER,"
+    L"ReleaseDate TEXT DEFAULT '',"
+    L"Rating INTEGER,"
+    L"Comment TEXT,"
+    L"Copyright TEXT,"
+    L"Url TEXT,"
+    L"DRM INTEGER,"
+    L"LastPlayPosition INTEGER DEFAULT 0,"
+    L"SampleRate INTEGER,"
+    L"BitRate INTEGER,"
+    L"NumChannels INTEGER,"
+    L"Codec INTEGER,"
+    L"MimeType TEXT,"
+    L"MTPDrmStatus INTEGER)");
+
+_LIT(KMusicDropTable,"DROP TABLE Music");
+_LIT(KMusicCheckTable,"SELECT UniqueId,Title,Location,Artist,Album,AlbumTrack,Genre,Composer,Duration,ReleaseDate,TimeAdded,PlayCount,TimePlayed,Rating,Comment,Copyright,Art,DbFlag,Sync,Modified,Deleted,Url,DRM,LastPlayPosition,SampleRate,BitRate,VolumeId,NumChannels,Codec,MimeType,MTPDrmStatus FROM Music");
+
+// indexes
+_LIT(KMusicDeletedIdIndex,"CREATE INDEX IndexMusicDeletedId ON Music(Deleted,UniqueId)");
+_LIT(KMusicDeletedTitleIndex,"CREATE INDEX IndexMusicDeletedTitle ON Music(Deleted,Title)");
+_LIT(KMusicDeletedArtistTitleIndex,"CREATE INDEX IndexMusicArtistDeletedTitle ON Music(Artist,Deleted,Title)");
+_LIT(KMusicDeletedAlbumTitleIndex,"CREATE INDEX IndexMusicAlbumDeletedTitle ON Music(Album,Deleted,Title)");
+_LIT(KMusicDeletedAlbumTrackTitleIndex,"CREATE INDEX IndexMusicAlbumDeletedTrackTitle ON Music(Album,Deleted,AlbumTrack,Title)");
+_LIT(KMusicDeletedGenreTitleIndex,"CREATE INDEX IndexMusicGenreDeletedTitle ON Music(Genre,Deleted,Title)");
+_LIT(KMusicDeletedComposerTitleIndex,"CREATE INDEX IndexMusicComposerDeletedTitle ON Music(Composer,Deleted,Title)");
+
+_LIT(KQueryMusicInsert, "INSERT INTO :dbname.Music(%S) VALUES(%S)");
+_LIT(KQueryMusicUpdate, "UPDATE :dbname.Music SET %S WHERE UniqueId=%u");
+_LIT(KQueryMusicDelete, "DELETE FROM :dbname.Music WHERE UniqueId=%u");
+_LIT(KQueryMusicDeleteUpdate, "UPDATE :dbname.Music SET Deleted=1 WHERE UniqueId=%u");
+_LIT(KQueryMusicDeleteForCategory, "UPDATE :dbname.Music SET Deleted=0 WHERE %S=%u");
+_LIT(KQueryMusicCleanup, "DELETE FROM :dbname.Music WHERE Deleted=1");
+
+// Note: The no categories queries below only retrieve a limited number of fields from the Music table
+//       as opposed to *. This is an optimization that matches the DBMS version of the plugin and assumes
+//       that the client only requests those fields. From the C++ code perspective there is no difference
+//       in processing as the five fields in question reside at the beginning of the table. If the client
+//       is modified to request more attributes then the queries below will have to be changed to return *.
+//
+//       As far as performance goes, the queries that only return six fields are a little faster than
+//       the ones that return *, for example, for a * query that takes 2.1 seconds the equivalent
+//       optimized query is faster by more than 100ms.
+
+_LIT(KQueryMusicGetSong, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.UniqueId=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId");
+
+// LTAN-79N8ND: temporary fix.  Symbian 9.4 SQLite cannot resolve column number correctly,
+// Use column number instead of column name for ORDER BY, needed when FROM uses more than 1 table
+// calculate column number from SELECT fields, first field is column 1 (not 0)
+/*
+_LIT(KQueryMusicGetAllSongs, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.Title");
+_LIT(KQueryMusicGetSongsForArtist, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Artist=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.Title");
+_LIT(KQueryMusicGetSongsForAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.AlbumTrack, Music.Title");
+_LIT(KQueryMusicGetSongsForUnknownAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.Title");
+_LIT(KQueryMusicGetSongsForArtistAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Artist=%u AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.AlbumTrack, Music.Title");
+_LIT(KQueryMusicGetSongsForGenre, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Genre=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.Title");
+_LIT(KQueryMusicGetSongsForComposer, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Composer=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.Title");
+_LIT(KQueryMusicGetRecentlyPlayed, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.TimePlayed<>'' AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetMostPlayed, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.PlayCount<>0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY PlayCount DESC, TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetRecentlyAdded, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND (julianday(Music.TimeAdded)>julianday('now','-7 days')) AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY Music.TimeAdded DESC");
+*/
+_LIT(KQueryMusicGetAllSongs, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
+_LIT(KQueryMusicGetSongsForArtist, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Artist=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
+_LIT(KQueryMusicGetSongsForAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 9, 4");
+_LIT(KQueryMusicGetSongsForUnknownAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
+_LIT(KQueryMusicGetSongsForArtistAlbum, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Artist=%u AND Music.Album=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 9, 4");
+_LIT(KQueryMusicGetSongsForGenre, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Genre=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
+_LIT(KQueryMusicGetSongsForComposer, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.Composer=%u AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 4");
+_LIT(KQueryMusicGetRecentlyPlayed, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.TimePlayed<>'' AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 12 DESC LIMIT %u");
+_LIT(KQueryMusicGetMostPlayed, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND Music.PlayCount<>0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY PlayCount DESC, TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetRecentlyAdded, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Music.Deleted=0 AND (julianday(Music.TimeAdded)>julianday('now','-7 days')) AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId ORDER BY 11 DESC");
+
+_LIT(KQueryMusicSong, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE %S");
+_LIT(KQueryMusicFindAll, "SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE %S AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId %S");
+
+// LTAN-79N8ND: temporary fix.  Symbian 9.4 SQLite cannot resolve column number correctly,
+// Use column number instead of column name for ORDER BY, needed when FROM uses more than 1 table
+// calculate column number from SELECT fields, first field is column 1 (not 0)
+/*
+_LIT(KQueryMusicFindAllSortOrderTrack, "ORDER BY Music.AlbumTrack,Music.Title");
+_LIT(KQueryMusicFindAllSortOrderTitle, "ORDER BY Music.Title");
+*/
+_LIT(KQueryMusicFindAllSortOrderTrack, "ORDER BY 9, 4");
+_LIT(KQueryMusicFindAllSortOrderTitle, "ORDER BY 4");
+
+// no categories queries
+_LIT(KQueryMusicGetSongNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryMusicGetAllSongsNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 ORDER BY Title");
+_LIT(KQueryMusicGetSongsForArtistNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 AND Artist=%u ORDER BY Title");
+_LIT(KQueryMusicGetSongsForAlbumNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location,AlbumTrack FROM :dbname.Music WHERE Deleted=0 AND Album=%u ORDER BY AlbumTrack,Title");
+_LIT(KQueryMusicGetSongsForUnknownAlbumNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 AND Album=%u ORDER BY Title");
+_LIT(KQueryMusicGetSongsForArtistAlbumNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location,AlbumTrack FROM :dbname.Music WHERE Deleted=0 AND Artist=%u AND Album=%u ORDER BY AlbumTrack,Title");
+_LIT(KQueryMusicGetSongsForGenreNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 AND Genre=%u ORDER BY Title");
+_LIT(KQueryMusicGetSongsForComposerNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location FROM :dbname.Music WHERE Deleted=0 AND Composer=%u ORDER BY Title");
+_LIT(KQueryMusicGetRecentlyPlayedNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND TimePlayed<>'' ORDER BY TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetMostPlayedNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location,PlayCount,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND PlayCount<>0 ORDER BY PlayCount DESC, TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetRecentlyAddedNoCategories, "SELECT UniqueId,DbFlag,VolumeId,Title,0,'',0,Location,TimeAdded FROM :dbname.Music WHERE Deleted=0 AND (julianday(TimeAdded)>julianday('now','-7 days')) ORDER BY TimeAdded DESC");
+
+_LIT(KQueryMusicGetSongsInBlockAsc, "SELECT Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,Music.Artist,Music.Art,0,'',0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId AND Title > :title ORDER BY 4 ASC LIMIT :limit");
+_LIT(KQueryMusicGetSongsInBlockDsc, "SELECT Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,Music.Artist,Music.Art,0,'',0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId AND Title < :title ORDER BY 4 DESC LIMIT :limit");
+_LIT(KQueryMusicGetSongsAtOffset, "SELECT Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,Music.Artist,Music.Art,0,'',0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId ORDER BY 4 LIMIT :limit OFFSET :offset");
+_LIT(KQueryMusicGetSongsLimited, "Select Music.UniqueId,Music.DbFlag,Music.VolumeId,Music.Title,Music.Artist,Music.Art,0,'',0,0,'','',0,0,0,0,0,0,0,0,'','','',0,0,0,0,0,0,'',0,Artist.Name FROM :dbname.Music,:dbname.Artist WHERE Deleted=0 AND Music.Artist=Artist.UniqueId ORDER BY 4 LIMIT %u");
+
+_LIT(KQueryMusicGetUri, "SELECT Location,VolumeId FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryMusicGetTitle, "SELECT Title FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryMusicGetMusicUris, "SELECT UniqueId,Location FROM :dbname.Music WHERE Deleted=0 ORDER BY UniqueId ASC LIMIT %u");
+_LIT(KQueryMusicGetMusicUrisFrom, "SELECT UniqueId,Location FROM :dbname.Music WHERE Deleted=0 AND UniqueId > %u ORDER BY UniqueId ASC LIMIT %u");
+
+_LIT(KQueryMusicCount, "SELECT count(*) FROM :dbname.Music WHERE Deleted=0");
+_LIT(KQueryMusicAlbum, "SELECT DISTINCT Album FROM :dbname.Music WHERE Deleted=0 AND Artist=%u ORDER BY Album");
+_LIT(KQueryMusicVolume, "SELECT VolumeId FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryMusicVolumeAll, "SELECT VolumeId FROM :dbname.Music WHERE UniqueId=%u");
+_LIT(KQueryMusicInfo, "SELECT * FROM :dbname.Music WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryOtherSongsInArtistAlbum, "SELECT count(*) FROM :dbname.Music WHERE Deleted=0 AND UniqueId<>%u AND Artist=%u AND Album=%u");
+
+_LIT(KQueryMusicDurationAll, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0");
+_LIT(KQueryMusicDurationArtist, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND Artist=%u");
+_LIT(KQueryMusicDurationAlbum, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND Album=%u");
+_LIT(KQueryMusicDurationArtistAlbum, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND Artist=%u AND Album=%u");
+_LIT(KQueryMusicDurationGenre, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND Genre=%u");
+_LIT(KQueryMusicDurationComposer, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND Composer=%u");
+_LIT(KQueryMusicDurationRecentlyPlayed, "SELECT sum(Duration) FROM (SELECT Duration,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND TimePlayed<>'' ORDER BY TimePlayed DESC LIMIT %u)");
+_LIT(KQueryMusicDurationMostPlayed, "SELECT sum(Duration) FROM (SELECT Duration,PlayCount,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND PlayCount<>0 ORDER BY PlayCount DESC,TimePlayed DESC LIMIT %u)");
+_LIT(KQueryMusicDurationRecentlyAdded, "SELECT sum(Duration) FROM :dbname.Music WHERE Deleted=0 AND (julianday(TimeAdded) > julianday('now','-7 days'))");
+
+_LIT(KQueryMusicGetDurationRecentlyPlayed, "SELECT Duration,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND TimePlayed<>'' ORDER BY TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetDurationMostPlayed, "SELECT Duration,PlayCount,TimePlayed FROM :dbname.Music WHERE Deleted=0 AND PlayCount<>0 ORDER BY PlayCount DESC,TimePlayed DESC LIMIT %u");
+_LIT(KQueryMusicGetDurationRecentlyAdded, "SELECT Duration FROM :dbname.Music WHERE Deleted=0 AND (julianday(TimeAdded) > julianday('now','-7 days'))");
+
+// Select songs information from music, playlistsongs and playlistsonginfo via playlistid order by playlistsongs's ordinal
+_LIT(KQueryMusicGetAllSongsbyPl,"select mu.UniqueId,mu.DbFlag,mu.VolumeId,mu.Title,mu.Artist,mu.Art,0,mu.Location,pl.UniqueId as PlUId, pl.ordinal from :dbname.music as mu,:pldbname.playlistsongs as pl where mu.Deleted=0 AND mu.uniqueid = pl.songid and pl.playlistid =%u ORDER BY 10");
+_LIT(KQueryMusicGetAllSongsInfobyPl,"SELECT Music.*,Artist.Name,Album.Name,Genre.Name,Composer.Name,pl.UniqueId as PlUId,pl.ordinal FROM :dbname.Music,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer,:pldbname.playlistsongs as pl WHERE Music.Deleted=0 AND Music.Album=Album.UniqueId AND Music.Artist=Artist.UniqueId AND Music.Genre=Genre.UniqueId AND Music.Composer=Composer.UniqueId AND Music.UniqueId=pl .songid and pl .PlaylistId=%u ORDER BY 37");
+
+_LIT(KQuerySongsInArtistAlbum, "SELECT count(*) FROM :dbname.Music WHERE Deleted=0 AND Artist=%u AND Album=%u");
+_LIT(KQueryMusicGetArtistForAlbum, "SELECT Artist FROM :dbname.Music,:dbname.Artist WHERE Music.Deleted=0 AND Music.Artist=Artist.UniqueId AND Music.Album=%u");
+
+// == Category table queries ==================================================
+//
+_LIT(KCategoryTablePlaceholder, "##table##");
+
+_LIT(KCategoryCreateTable,"CREATE TABLE ##table##("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"Name TEXT COLLATE NOCASE,"
+    L"SongCount INTEGER)");
+
+_LIT(KCategoryDropTable,"DROP TABLE ##table##");
+_LIT(KCategoryCheckTable,"SELECT UniqueId,Name,SongCount FROM ##table##");
+_LIT(KCategoryNameIndex,"CREATE INDEX Index##table##Name ON ##table##(Name)");
+
+_LIT(KQueryCategoryInsert, "INSERT INTO :dbname.##table##(UniqueId,Name,SongCount) VALUES(%u,'%S',%u)");
+_LIT(KQueryCategoryDelete, "DELETE FROM :dbname.##table## WHERE UniqueId=%u");
+
+_LIT(KQueryCategoryCount, "SELECT count(*) FROM :dbname.##table##");
+_LIT(KQueryCategoryItem, "SELECT * FROM :dbname.##table## WHERE UniqueId=%u");
+_LIT(KQueryCategoryItemBySongId, "SELECT ##table##.* FROM :dbname.##table##,:dbname.Music WHERE Music.Deleted=0 AND Music.UniqueId=%u AND ##table##.UniqueId=Music.%S");
+_LIT(KQueryCategoryAll, "SELECT * FROM :dbname.##table## ORDER BY Name");
+_LIT(KQueryCategoryItems, "SELECT * FROM :dbname.##table## WHERE %S ORDER BY Name ASC");
+_LIT(KQueryCategorySongCount, "SELECT SongCount FROM :dbname.##table## WHERE UniqueId=%u");
+_LIT(KQueryCategorySubcategoryItems, "SELECT Album.* FROM :dbname.Album,:dbname.Music WHERE Music.Deleted=0 AND Music.Artist=%u AND Album.UniqueId=Music.Album ORDER BY Name");
+
+_LIT(KQueryCategoryIncrementSongCount, "UPDATE :dbname.##table## SET SongCount=SongCount+1 WHERE UniqueId=%u");
+_LIT(KQueryCategoryDecrementSongCount, "UPDATE :dbname.##table## SET SongCount=SongCount-1 WHERE UniqueId=%u");
+_LIT(KQueryCategoryGetSongCount, "SELECT SongCount FROM :dbname.##table## WHERE UniqueId=%u");
+
+// == Auxiliary table queries =================================================
+//
+_LIT(KAuxiliaryCreateTable, "CREATE TABLE Auxiliary("
+    L"Id INTEGER,"
+    L"Version TEXT,"
+    L"TimeRefreshed TEXT,"
+    L"TimeSynced TEXT,"
+    L"Corrupt INTEGER DEFAULT 0,"
+    L"SaveDeletedRecordCount INTEGER DEFAULT 0)");
+_LIT(KAuxiliaryDropTable,"DROP TABLE Auxiliary");
+_LIT(KAuxiliaryCheckTable, "SELECT Id,Version,TimeRefreshed,TimeSynced,Corrupt,SaveDeletedRecordCount FROM AUXILIARY");
+_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.4.0',%u)");
+
+_LIT(KQueryAuxiliarySetTime, "UPDATE :dbname.Auxiliary SET TimeRefreshed='%S', Corrupt=0");
+_LIT(KQueryAuxiliaryGetTime, "SELECT TimeRefreshed FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliarySetCorrupt, "UPDATE :dbname.Auxiliary SET Corrupt=%u");
+_LIT(KQueryAuxiliaryGetCorrupt, "SELECT Corrupt FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliaryGetCount, "SELECT SaveDeletedRecordCount FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliarySetCount, "UPDATE :dbname.Auxiliary SET SaveDeletedRecordCount=%u");
+_LIT(KQueryAuxiliaryGetId, "SELECT Id FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliarySetId, "UPDATE :dbname.Auxiliary SET Id=%u");
+
+// == Playlist table queries ==================================================
+//
+_LIT(KPlaylistCreateTable, "CREATE TABLE Playlist("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"VolumeId INTEGER,"
+    L"DbFlag INTEGER,"
+    L"Sync INTEGER,"
+    L"Name TEXT COLLATE NOCASE,"
+    L"Uri TEXT,"
+    L"Time TEXT)");
+_LIT(KPlaylistDropTable,"DROP TABLE Playlist");
+_LIT(KPlaylistCheckTable, "SELECT UniqueId,Name,Uri,VolumeId,Sync,DbFlag,Time FROM Playlist");
+_LIT(KPlaylistNameIndex,"CREATE INDEX IndexPlaylistName ON Playlist(Name)");
+
+_LIT(KQueryPlaylistInsert, "INSERT INTO :dbname.Playlist(UniqueId,Name,Uri,VolumeId,Sync,DbFlag,Time) VALUES(%u,'%S','%S',%u,0,%u,'%S')");
+_LIT(KQueryPlaylistUpdate, "UPDATE :dbname.Playlist SET %S WHERE UniqueId=%u");
+_LIT(KQueryPlaylistUpdateTime, "UPDATE :dbname.Playlist SET Time='%S' WHERE UniqueId=%u");
+_LIT(KQueryPlaylistUpdateTimeForSong, "UPDATE :dbname.Playlist SET Time='%S' WHERE UniqueId IN (SELECT DISTINCT PlaylistId FROM :dbname.PlaylistSongs WHERE SongId=%u)");
+_LIT(KQueryPlaylistDeleteAll, "DELETE FROM :dbname.Playlist");
+_LIT(KQueryPlaylistDelete, "DELETE FROM :dbname.Playlist WHERE UniqueId=%u");
+
+_LIT(KQueryPlaylistCount, "SELECT count(*) FROM :dbname.Playlist");
+_LIT(KQueryPlaylistGetAll, "SELECT * FROM :dbname.Playlist ORDER BY Name ASC");
+_LIT(KQueryPlaylistGet, "SELECT * FROM :dbname.Playlist WHERE UniqueId=%u");
+_LIT(KQueryPlaylistDuration, "SELECT sum(Music.Duration) FROM :dbname.Music,:dbname.Playlist,:dbname.PlaylistSongs WHERE Music.UniqueId=PlaylistSongs.SongId AND PlaylistSongs.PlaylistId=%u");
+_LIT(KQueryPlaylistId, "SELECT UniqueId FROM :dbname.Playlist WHERE Uri='%S'");
+_LIT(KQueryLikePlaylistId, "SELECT UniqueId FROM :dbname.Playlist WHERE Uri LIKE '%%%%%S%%%%' ESCAPE '\\'");
+_LIT(KQueryPlaylistDriveId, "SELECT VolumeId FROM :dbname.Playlist WHERE UniqueId=%u");
+_LIT(KQueryPlaylistItems, "SELECT * FROM :dbname.Playlist WHERE %S ORDER BY Name ASC");
+_LIT(KQueryPlaylistGetForSong, "SELECT DISTINCT PlaylistId FROM :dbname.PlaylistSongs WHERE SongId=%u");
+_LIT(KQueryPlaylistFileCount, "SELECT count(*) FROM :dbname.Playlist WHERE Uri LIKE '%%.m3u'");
+//see "Efficient Use of Symbinan SQL How-To Document" for details about following queries:
+_LIT(KQueryPlaylistGetFileUris, "SELECT UniqueId,Uri FROM :dbname.Playlist WHERE Uri LIKE '%%%%.m3u' ORDER BY UniqueId ASC LIMIT %u");
+_LIT(KQueryPlaylistGetFileUrisFrom, "SELECT UniqueId,Uri FROM :dbname.Playlist WHERE Uri LIKE '%%%%.m3u' AND UniqueId > %u ORDER BY UniqueId ASC LIMIT %u");
+
+// == PlaylistSongs table queries =============================================
+//
+_LIT(KPlaylistSongsCreateTable, "CREATE TABLE PlaylistSongs("
+    L"UniqueId INTEGER PRIMARY KEY AUTOINCREMENT,"
+    L"SongId INTEGER,"
+    L"PlaylistId INTEGER,"
+    L"Ordinal INTEGER)");
+_LIT(KPlaylistSongsDropTable,"DROP TABLE PlaylistSongs");
+_LIT(KPlaylistSongsCheckTable, "SELECT UniqueId,SongId,PlaylistId,Ordinal FROM PlaylistSongs");
+
+_LIT(KQueryPlaylistSongsInsert, "INSERT INTO :dbname.PlaylistSongs(PlaylistId,SongId,Ordinal) VALUES(%u,%u,%u)");
+_LIT(KQueryPlaylistSongsUpdate, "UPDATE :dbname.PlaylistSongs SET SongId=%u WHERE SongId=%u");
+_LIT(KQueryPlaylistSongsUpdatePlaylistId, "UPDATE :dbname.PlaylistSongs SET PlaylistId=%u WHERE PlaylistId=%u");
+_LIT(KQueryPlaylistSongsDelete, "DELETE FROM :dbname.PlaylistSongs WHERE SongId=%u");
+_LIT(KQueryPlaylistSongsDeleteAll, "DELETE FROM :dbname.PlaylistSongs");
+_LIT(KQueryPlaylistSongsDeletePlaylist, "DELETE FROM :dbname.PlaylistSongs WHERE PlaylistId=%u");
+_LIT(KQueryPlaylistSongsDeleteSong, "DELETE FROM :dbname.PlaylistSongs WHERE PlaylistId=%u AND SongId=%u");
+_LIT(KQueryPlaylistSongsDeleteSongOrdinal, "DELETE FROM :dbname.PlaylistSongs WHERE PlaylistId=%u AND SongId=%u AND Ordinal=%u");
+_LIT(KQueryPlaylistSongsDeleteForCategory, "DELETE FROM :dbname.PlaylistSongs WHERE PlaylistSongs.SongId=Music.UniqueId AND Music.%S=%u");
+_LIT(KQueryPlaylistSongsDeleteForArtistAlbum, "DELETE FROM :dbname.PlaylistSongs WHERE PlaylistSongs.SongId=Music.UniqueId AND Music.Artist=%u AND Music.Album=%u");
+
+_LIT(KQueryPlaylistSongsCount, "SELECT count(*) FROM :dbname.PlaylistSongs WHERE PlaylistId=%u");
+_LIT(KQueryPlaylistSongsPlaylistSongCount, "SELECT count(*) FROM :dbname.PlaylistSongs WHERE PlaylistId=%u AND SongId=%u");
+_LIT(KQueryPlaylistSongsSongCount, "SELECT count(*) FROM :dbname.PlaylistSongs WHERE SongId=%u");
+_LIT(KQueryPlaylistSongsGetSongs, "SELECT UniqueId,SongId,Ordinal FROM :dbname.PlaylistSongs WHERE PlaylistId=%u ORDER BY Ordinal");
+
+// LTAN-79N8ND: temporary fix.  Symbian 9.4 SQLite cannot resolve column number correctly,
+// Use column number instead of column name for ORDER BY, needed when FROM uses more than 1 table
+// calculate column number from SELECT fields, first field is column 1 (not 0)
+//_LIT(KQueryPlaylistSongsGetSong, "SELECT PlaylistSongs.UniqueId,PlaylistSongs.SongId,PlaylistSongs.PlaylistId,PlaylistSongs.Ordinal,PlaylistSongInfo.VolumeId,PlaylistSongInfo.DbFlag,PlaylistSongInfo.Uri,PlaylistSongInfo.Title FROM :dbname.PlaylistSongs,:dbname.PlaylistSongInfo WHERE PlaylistSongs.PlaylistId=%u AND PlaylistSongs.SongId=%u AND PlaylistSongs.SongId=PlaylistSongInfo.SongId ORDER BY PlaylistSongs.Ordinal");
+_LIT(KQueryPlaylistSongsGetSong, "SELECT PlaylistSongs.UniqueId,PlaylistSongs.SongId,PlaylistSongs.PlaylistId,PlaylistSongs.Ordinal,PlaylistSongInfo.VolumeId,PlaylistSongInfo.DbFlag,PlaylistSongInfo.Uri,PlaylistSongInfo.Title FROM :dbname.PlaylistSongs,:dbname.PlaylistSongInfo WHERE PlaylistSongs.PlaylistId=%u AND PlaylistSongs.SongId=%u AND PlaylistSongs.SongId=PlaylistSongInfo.SongId ORDER BY 4");
+_LIT(KQueryPlaylistSongsGetSongsInfo, " SELECT PlaylistSongs.*,PlaylistSongInfo.VolumeId,PlaylistSongInfo.DbFlag,PlaylistSongInfo.Uri,PlaylistSongInfo.Title FROM :dbname.PlaylistSongs,:dbname.PlaylistSongInfo WHERE PlaylistSongs.SongId=PlaylistSongInfo.SongId AND PlaylistSongs.PlaylistId=%u ORDER BY 4");
+
+_LIT(KQueryPlaylistSongsGetSongInfo, "SELECT PlaylistSongs.UniqueId,PlaylistSongs.SongId,PlaylistSongs.PlaylistId,PlaylistSongs.Ordinal,PlaylistSongInfo.VolumeId,PlaylistSongInfo.DbFlag,PlaylistSongInfo.Uri,PlaylistSongInfo.Title FROM :dbname.PlaylistSongs,:dbname.PlaylistSongInfo WHERE PlaylistSongs.UniqueId=%u AND PlaylistSongs.SongId=%u AND PlaylistSongs.SongId=PlaylistSongInfo.SongId");
+
+_LIT(KQueryPlaylistSongsUpdateSongOrdinalAfterDelete, "UPDATE :dbname.PlaylistSongs SET Ordinal=Ordinal-1 WHERE PlaylistId=%u AND Ordinal>%u");
+_LIT(KQueryPlaylistSongsUpdateSongOrdinal, "UPDATE :dbname.PlaylistSongs SET Ordinal=%u WHERE UniqueId=%u");
+_LIT(KQueryPlaylistSongsMoveSongUp, "UPDATE :dbname.PlaylistSongs SET Ordinal=Ordinal+1 WHERE PlaylistId=%u AND Ordinal>=%u AND Ordinal<%u");
+_LIT(KQueryPlaylistSongsMoveSongDown, "UPDATE :dbname.PlaylistSongs SET Ordinal=Ordinal-1 WHERE PlaylistId=%u AND Ordinal<=%u AND Ordinal>%u");
+
+// == PlaylistSongInfo table queries ==========================================
+//
+_LIT(KPlaylistSongInfoCreateTable, "CREATE TABLE PlaylistSongInfo("
+    L"SongId INTEGER PRIMARY KEY,"
+    L"VolumeId INTEGER,"
+    L"DbFlag INTEGER,"
+    L"Uri TEXT,"
+    L"Title TEXT COLLATE NOCASE)");
+_LIT(KPlaylistSongInfoDropTable,"DROP TABLE PlaylistSongInfo");
+_LIT(KPlaylistSongInfoCheckTable, "SELECT SongId,VolumeId,DbFlag,Uri,Title FROM PlaylistSongInfo");
+
+_LIT(KQueryPlaylistSongInfoInsert, "INSERT INTO :dbname.PlaylistSongInfo(SongId,Uri,Title,VolumeId,DbFlag) VALUES(%u,'%S','%S',%u,%u)");
+_LIT(KQueryPlaylistSongInfoDelete, "DELETE FROM :dbname.PlaylistSongInfo WHERE SongId=%u");
+_LIT(KQueryPlaylistSongInfoDeleteAll, "DELETE FROM :dbname.PlaylistSongInfo");
+_LIT(KQueryPlaylistSongInfoCleanup, "DELETE FROM :dbname.PlaylistSongInfo WHERE SongId NOT IN (SELECT DISTINCT SongId FROM :dbname.PlaylistSongs)");
+_LIT(KQueryPlaylistSongInfoUpdateTitle, "UPDATE :dbname.PlaylistSongInfo SET Title='%S' WHERE SongId=%u");
+_LIT(KQueryPlaylistSongInfoUpdate, "UPDATE :dbname.PlaylistSongInfo SET SongId=%u,Uri='%S',VolumeId=%u WHERE SongId=%u");
+_LIT(KQueryPlaylistSongInfoUpdateFlags, "UPDATE :dbname.PlaylistSongInfo SET DbFlag=%u WHERE SongId=%u");
+
+_LIT(KQueryPlaylistSongInfoExists, "SELECT SongId FROM :dbname.PlaylistSongInfo WHERE SongId=%u");
+_LIT(KQueryPlaylistSongInfoGet, "SELECT * FROM :dbname.PlaylistSongInfo WHERE SongId=%u");
+
+// == Criteria strings ========================================================
+//
+// Music criteria
+_LIT(KCriterionMusicUniqueId, "Music.UniqueId=%u");
+_LIT(KCriterionMusicNotDeleted, "Music.Deleted=0");
+_LIT(KCriterionMusicArtist, "Music.artist=%u");
+_LIT(KCriterionMusicAlbum, "Music.album=%u");
+_LIT(KCriterionMusicGenre, "Music.genre=%u");
+_LIT(KCriterionMusicComposer, "Music.composer=%u");
+// SQLite requires LIKE statement to include an ESCAPE clause if an escaped percentage
+// or underscore is to be used as regular search text instead of pattern matching
+// characters. See http://www.sqlite.org/lang_expr.html for an explanation. To supprt
+// partial title matching, our goal is to have the following statement as an example:
+//      SELECT * FROM Music WHERE title LIKE '%xyz%' ESCAPE '\'
+// To achieve this, we specify the format to be %%%%%S%%%%. The 1st percentage is the
+// escape character for string formatter to output the 2nd percentage sign. Similiarly
+// for the 3rd, 4th, 6th, 7th, 8th, and 9th. The 5th percentage instructs string formatter
+// to substitute a string, i.e. %S. After subsititution, we will have, for example, %%xyz%%.
+// Because this substituted string will be substituted again into a WHERE clause, we need
+// to escape the percentage signs in order to get %xyz% as the end result.
+_LIT(KCriterionMusicTitle, "Music.title LIKE '%%%%%S%%%%' ESCAPE '\\'");
+_LIT(KCriterionMusicVolume, "Music.VolumeId=%u");
+_LIT(KCriterionMusicLocation, "Music.Location='%S'");
+_LIT(KCriterionMusicSync, "Music.Sync=%u");
+_LIT(KCriterionMusicDeleted, "Music.Deleted=%u");
+_LIT(KCriterionMusicModified, "Music.Modified=%u");
+
+// Category criteria
+_LIT(KCriterionCategoryUniqueId, "##table##.UniqueId=%u");
+_LIT(KCriterionCategoryName, "##table##.Name LIKE '%%%%%S%%%%' ESCAPE '\\'");
+
+// Playlist criteria
+_LIT(KCriterionPlaylistUniqueId, "UniqueId=%u");
+_LIT(KCriterionPlaylistVolumeId, "VolumeId=%u");
+_LIT(KCriterionPlaylistTitle, "Name='%S'");
+_LIT(KCriterionPlaylistLikeTitle, "Name LIKE '%%%%%S%%%%' ESCAPE '\\'");
+_LIT(KCriterionPlaylistUri, "Uri='%S'");
+_LIT(KCriterionPlaylistSync, "Sync=%u");
+_LIT(KCriterionPlaylistTime, "Time='%S'");
+
+// PlaylistSongs criteria
+_LIT(KCriterionPlaylistSongId, "PlaylistSongs.SongId=%u");
+
+// == Album table queries ==========================================
+//
+_LIT(KAlbumCreateTable,"CREATE TABLE Album("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"Name TEXT COLLATE NOCASE,"
+    L"SongCount INTEGER,"
+    L"Artist INTEGER,"
+	L"Art TEXT)");
+
+_LIT(KAlbumCheckTable,"SELECT UniqueId,Name,SongCount,Artist,Art FROM Album");
+
+_LIT(KQueryAlbumInsert, "INSERT INTO :dbname.Album(UniqueId,Name,SongCount,Artist,Art) VALUES(%u,'%S',%u,%u,'%S')");
+_LIT(KQueryAlbumUpdate, "UPDATE :dbname.Album SET %S WHERE UniqueId=%u");
+
+_LIT(KQueryAlbumItem, "SELECT Album.*,Artist.Name FROM :dbname.Album,:dbname.Artist WHERE Album.Artist=Artist.UniqueId AND UniqueId=%u");
+_LIT(KQueryAlbumAll, "SELECT Album.*,Artist.Name FROM :dbname.Album,:dbname.Artist WHERE Album.Artist=Artist.UniqueId ORDER BY 2");
+
+// == Artist table queries ==========================================
+//
+_LIT(KArtistCreateTable,"CREATE TABLE Artist("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"Name TEXT COLLATE NOCASE,"
+    L"SongCount INTEGER,"
+    L"Art TEXT)");
+
+_LIT(KArtistCheckTable,"SELECT UniqueId,Name,SongCount,Art FROM Artist");
+
+_LIT(KQueryArtistInsert, "INSERT INTO :dbname.Artist(UniqueId,Name,SongCount,Art) VALUES(%u,'%S',%u,'%S')");
+_LIT(KQueryArtistUpdate, "UPDATE :dbname.Artist SET %S WHERE UniqueId=%u");
+
+_LIT(KQueryArtistAll, "SELECT Artist.* FROM :dbname.Artist ORDER BY 2");
+
+#endif // MPXDBPLUGINQUERIES_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/inc/mpxdbutil.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The class MPXDbUtil which contains utilities functions
+*
+*/
+
+
+#ifndef MPXDBUTIL_H
+#define MPXDBUTIL_H
+
+// INCLUDES
+#include <mpxmediageneraldefs.h>
+#include "mpxcollectiondbstd.h"
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXMediaArray;
+
+// CLASS DECLARATION
+
+/**
+* This static class contains utilities functions used by Music Collection
+*
+* @lib MPXDbPlugin.lib
+*/
+class MPXDbUtil
+    {
+    public:
+        /**
+        * Filter out duplicated Ids in the array
+        * @param aIds array containing Ids to be filtered
+        * @param aFilteredIds filtered Ids without duplicates, generated from
+        *        the input array
+        */
+        static void FilterDuplicatedIdsL(const TArray<TUint32>& aIds,
+            RArray<TUint32>& aFilteredIds);
+
+        /**
+        * Returns the table name for a specified category
+        * @param aCategory identifies the category
+        * @return corresponding table name
+        */
+        static TPtrC TableNameForCategoryL(TMPXGeneralCategory aCategory);
+
+        /**
+        * Returns the music field name for a specified category
+        * @param aCategory identifies the category
+        * @return corresponding field name
+        */
+        static TPtrC MusicFieldNameForCategoryL(TMPXGeneralCategory aCategory);
+    };
+
+#endif // MPXDBUTIL_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/loc/mpxcollectiondb.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,170 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: This is a localisation file for MusicPlayer
+*     A .loc file is the one and only place where the logical strings
+*     to be localised are defined.
+*
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Text for first item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_all_tracks "All songs"
+
+
+// d:Text for second item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_playlists "Playlists"
+
+// d:Text for third item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_artists "Artists"
+
+
+// d:Text for fourth item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_albums "Albums"
+
+
+// d:Text for podcast (if enabled) item in music library menu.
+// l:list_double_large_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_podcasts "Podcasts"
+
+
+// d:Text for genres item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_genres "Genres"
+
+
+// d:Text for composers item in music library menu.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_composers "Composers"
+
+// d:Text in main pane.
+// d:First item in the artist's album view. All
+// d:songs for the artist will be shown when
+// d:selected
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_nmp_all_by "All"
+
+// d:Title for first item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_all_tracks "All songs"
+
+// d:Title for second item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_pls "Playlists"
+
+// d:Title for third item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+#define qtn_mus_title_artists "Artists"
+
+// d:Title for fourth item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_albums "Albums"
+
+// d:Title for Album_soung view
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_album "Album"
+
+// d:Title for fifth item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_genres "Genres"
+
+// d:Title for sixth item in music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_composers "Composers"
+
+// d:Text for the Most Played item in the playlists menu
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_pl_most_played "Most played"
+
+// d:Text for the Recently Played item in the playlists menu
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_pl_recently_played "Recently played"
+
+// d:Text for the Recently Added item in the playlists menu
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_pl_recently_downloaded "Recently added"
+
+// d:List box text to show the number of items in the collection
+// d:For the case there're 0 or more than 1 song in the collection
+// l:list_double_large_graphic_pane_t2
+// r:5.0
+//
+#define qtn_mus_music_num_songs "%N songs"
+
+// d:List box text to show the number of items in the collection
+// d:For the case there's only 1 song in the collection
+// l:list_double_large_graphic_pane_t2
+// r:5.0
+//
+#define qtn_mus_music_one_song  "1 song"
+
+// d:List box text to show the name of the music collection
+// l:list_double_large_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_music "Music"
+
+// d:Text for music library menu.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_music_menu "Music Menu"
+
+// d:Text for music library menu.
+// l:list_logical_template_1_title
+// r:10.0
+//
+#define qtn_mp_title_my_music_menu_nseries "My Music"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxcollectiondbmanager.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for managing all of music collection
+*                databases.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include "mpxcollectiondbdef.h"
+#include "mpxcollectiondbmanager.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionDbManager* CMPXCollectionDbManager::NewL(
+    RFs& aFs)
+    {
+    MPX_FUNC("CMPXCollectionDbManager::NewL");
+
+    CMPXCollectionDbManager* self = CMPXCollectionDbManager::NewLC(aFs);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionDbManager* CMPXCollectionDbManager::NewLC(
+    RFs& aFs)
+    {
+    MPX_FUNC("CMPXCollectionDbManager::NewLC");
+
+    CMPXCollectionDbManager* self = new (ELeave) CMPXCollectionDbManager(aFs);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionDbManager::~CMPXCollectionDbManager()
+    {
+    MPX_FUNC("CMPXCollectionDbManager::~CMPXCollectionDbManager");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionDbManager::CMPXCollectionDbManager(
+    RFs& aFs) :
+    CMPXDbManager(aFs)
+    {
+    MPX_FUNC("CMPXCollectionDbManager::CMPXCollectionDbManager");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXCollectionDbManager::ConstructL()
+    {
+    MPX_FUNC("CMPXCollectionDbManager::ConstructL");
+    CMPXDbManager::ConstructL(TFileName(KMCDbFile));
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbalbum.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,531 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the category tables:
+*                Artist, Album, Genre and Composer
+*
+*/
+
+
+// INCLUDE FILES
+#include <sqldb.h>
+
+#include <mpxlog.h>
+
+#include "mpxdbcommonutil.h"
+#include "mpxdbcommondef.h"
+#include "mpxdbmanager.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxmediamusicdefs.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbutil.h"
+#include "mpxdbalbum.h"
+
+// CONSTANTS
+
+// maximum number of table name entries per query
+const TInt KMaxTableNameCount = 2;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAlbum* CMPXDbAlbum::NewL(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbAlbumObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbAlbum::NewL");
+
+    CMPXDbAlbum* self = CMPXDbAlbum::NewLC(aDbManager, aCategory, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAlbum* CMPXDbAlbum::NewLC(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbAlbumObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbAlbum::NewLC");
+
+    CMPXDbAlbum* self = new (ELeave) CMPXDbAlbum(aDbManager, aCategory, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAlbum::~CMPXDbAlbum()
+    {
+    MPX_FUNC("CMPXDbAlbum::~CMPXDbAlbum");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAlbum::CMPXDbAlbum(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbAlbumObserver& aObserver) :
+    CMPXDbCategory(aDbManager, aCategory),
+    iObserver(aObserver)
+    {
+    MPX_FUNC("CMPXDbAlbum::CMPXDbAlbum");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::ConstructL()
+    {
+    MPX_FUNC("CMPXDbAlbum::ConstructL");
+
+    BaseConstructL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::AddItemL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAlbum::AddItemL(
+    const TDesC& aName,
+    TUint32 aArtist,
+    const TDesC& aArt,
+    TInt aDriveId,
+    TBool& aNewRecord,
+    TBool aCaseSensitive)
+    {
+    MPX_FUNC("CMPXDbAlbum::AddItemL");
+    
+    // try to find the item first
+    TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
+        aName, aCaseSensitive));
+    aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
+
+    if (aNewRecord)
+        {      
+        // insert new
+        HBufC* query = PreProcessStringLC(KQueryAlbumInsert);
+        HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
+		HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(aArt);
+
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId, name, 1, aArtist, art);
+
+		CleanupStack::PopAndDestroy(art);
+        CleanupStack::PopAndDestroy(name);
+        CleanupStack::PopAndDestroy(query);
+        }
+    else
+        {
+        // retrieve the existing record
+        HBufC* query = NULL;
+        query = PreProcessStringLC(KQueryCategoryItem);
+        RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, rowId));
+        CleanupStack::PopAndDestroy(query);
+		
+        CleanupClosePushL(recordset);
+		
+        if (recordset.Next() != KSqlAtRow)
+            {
+            User::Leave(KErrNotFound);
+	    }
+
+        // Artist
+        TUint32 artistId = recordset.ColumnInt64(EAlbumArtist);
+	    
+        // the current one is Unknown and the new one is Not Unknown.
+        if ( IsUnknownArtistL( artistId ) && !IsUnknownArtistL( aArtist ) )
+            {
+            _LIT( KFormatArtistId, "Artist=%d" );
+            HBufC* setStr = HBufC::NewLC(KFormatArtistId().Length() + KMCIntegerLen);
+            setStr->Des().Format( KFormatArtistId, aArtist );
+        
+            iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, rowId);
+            CleanupStack::PopAndDestroy(setStr);            
+            }
+	        
+        // Album Art
+        TPtrC art(KNullDesC);
+        art.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EAlbumArt));
+	
+        // the current one is Unknown and the new one is Not Unknown
+        if ( art == KNullDesC && aArt != KNullDesC )
+            {
+            HBufC* artReplaceSingleQuote = 
+                MPXDbCommonUtil::ProcessSingleQuotesLC( aArt );
+            _LIT( KFormatArt, "Art=\'%S\'" );
+            HBufC* setStr = HBufC::NewLC(256);
+            setStr->Des().Format( KFormatArt, artReplaceSingleQuote );
+            
+            iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, rowId);
+            CleanupStack::PopAndDestroy(setStr);		    
+            CleanupStack::PopAndDestroy(artReplaceSingleQuote);
+            }
+		
+        CleanupStack::PopAndDestroy(&recordset);
+		
+        // increment the number of songs for the category
+        query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
+        CleanupStack::PopAndDestroy(query);
+        }
+
+    return rowId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::DecrementSongsForCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::DecrementSongsForCategoryL(
+    const TUint32 aId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TBool& aItemExist,
+    const TUint32 aArtist)
+    {
+    MPX_FUNC("CMPXDbAlbum::DecrementSongsForCategoryL");
+
+    // if just one song uses this category. Use <= just in case
+    if (GetSongsCountL(aDriveId, aId) <= 1)
+        {
+        aItemExist = EFalse;
+        // delete the category
+        DeleteCategoryL(aId, aDriveId);
+
+        if (aItemChangedMessages)
+            {
+            // add the item changed message
+            MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
+                iCategory, KDBPluginUid);
+            }
+        }
+    else
+        {
+        aItemExist = ETrue;
+        
+        // retrieve the existing record
+        HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+        RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, aId));
+        CleanupStack::PopAndDestroy(query);
+        
+        CleanupClosePushL(recordset);
+        
+        if (recordset.Next() != KSqlAtRow)
+            {
+            User::Leave(KErrNotFound);
+        }
+
+        TUint32 artistId = recordset.ColumnInt64(EAlbumArtist);
+        
+        CleanupStack::PopAndDestroy(&recordset);
+        
+        // the current artist is equal to deleted song's artist
+        if ( artistId == aArtist )
+            {
+            TUint32 newArtistId = ArtistForAlbumL(aId);
+            
+            _LIT( KFormatArtistId, "Artist=%d" );
+            HBufC* setStr = HBufC::NewLC(KFormatArtistId().Length() + KMCIntegerLen);
+            setStr->Des().Format(KFormatArtistId, newArtistId);
+        
+            iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, aId);
+            CleanupStack::PopAndDestroy(setStr);
+            
+            if (aItemChangedMessages)
+                {
+                // add the item changed message
+                MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
+                    iCategory, KDBPluginUid);
+                }
+            }
+
+        // decrement the number of songs for the category
+        query = PreProcessStringLC(KQueryCategoryDecrementSongCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, aId);
+        CleanupStack::PopAndDestroy(query);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::GetAllCategoryItemsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::GetAllCategoryItemsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbAlbum::GetAllCategoryItemsL");
+
+    HBufC* query = PreProcessStringLC(KQueryAlbumAll);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::UpdateItemL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::UpdateItemL(
+    TUint32 aId, 
+    const CMPXMedia& aMedia, 
+    TInt aDriveId, 
+    CMPXMessageArray* aItemChangedMessages)
+	{
+	MPX_FUNC("CMPXDbAlbum::UpdateItemL");
+
+	CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EAlbumFieldCount);
+	CleanupStack::PushL(fields);
+	CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EAlbumFieldCount);
+	CleanupStack::PushL(values);
+
+	// process the media parameter and construct the fields and values array
+	GenerateAlbumFieldsValuesL(aMedia, *fields, *values);
+
+	// construct the SET string
+	HBufC* setStr = MPXDbCommonUtil::StringFromArraysLC(*fields, *values, KMCEqualSign, KMCCommaSign);
+
+    if (setStr->Length())
+        {
+        // execute the query
+        iDbManager.ExecuteQueryL(aDriveId, KQueryAlbumUpdate, setStr, aId);
+	    TInt oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;	
+	    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
+            EMPXAlbum, KDBPluginUid, oldSongId );
+        }
+
+	CleanupStack::PopAndDestroy(setStr);
+	CleanupStack::PopAndDestroy(values);
+	CleanupStack::PopAndDestroy(fields);
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::GetAlbumsCountForArtistL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbAlbum::GetAlbumsCountForArtistL(TUint32 aArtistId)
+	{
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryCategorySubcategoryItems, aArtistId));
+
+    TInt prevId(0);
+    TInt count(0);
+	TInt err(KErrNone);
+	
+    while ((err = recordset.Next()) == KSqlAtRow)
+		{
+		TUint32 rowId(recordset.ColumnInt64(EAlbumUniqueId));
+        if (prevId == rowId)
+            {
+            continue;
+            }
+		
+		count++;
+		prevId = rowId;
+		}
+
+    if (err != KSqlAtEnd)
+        {
+        User::Leave(err);
+        }
+
+	return count;
+
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL(TUint32 aArtistId, TUint32 aAlbumId)
+	{
+	MPX_FUNC("CMPXDbAlbum::GetSongsCountInAlbumMatchingArtistL");
+	
+	return ExecuteSumQueryL(KQuerySongsInArtistAlbum, aArtistId, aAlbumId);
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::UpdateMediaL(
+    RSqlStatement& aRecord,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbAlbum::UpdateMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            if (attributeId & EMPXMediaGeneralId)
+                {
+                MPX_DEBUG1("    EMPXMediaGeneralId");
+                
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+                    aRecord.ColumnInt64(EAlbumUniqueId));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                MPX_DEBUG1("    EMPXMediaGeneralTitle");
+                
+                TPtrC album( MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) );
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle,
+                    MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName));
+                MPX_DEBUG2("	Album[%S]", &album );
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+                MPX_DEBUG1("    EMPXMediaGeneralCount");
+
+				TInt songCount = GetSongsCountL(KDbManagerAllDrives,
+					aRecord.ColumnInt64(EAlbumUniqueId));
+                aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount );
+				MPX_DEBUG2("	SongCount[%d]", songCount );
+                }
+            } // end if contentId == KMPXMediaIdGeneral
+		else if ( contentId == KMPXMediaIdMusic )
+			{
+			if (attributeId & EMPXMediaMusicArtist)
+				{				
+				MPX_DEBUG1("	EMPXMediaMusicArtist");
+
+				TPtrC artistName(KNullDesC);
+				
+				// if album is unknown, ignore arist name
+				if (MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) != KNullDesC)
+					{
+					artistName.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArtistName));
+					}
+				
+				aMedia.SetTextValueL(KMPXMediaMusicArtist, artistName);
+				MPX_DEBUG2("	Artist[%S]", &artistName);
+				}
+			if (attributeId & EMPXMediaMusicAlbumArtFileName)
+				{
+				MPX_DEBUG1("	EMPXMediaMusicAlbumArtFileName");
+
+				TPtrC art(KNullDesC);
+				
+				// if album is unknown, ignore album art name
+				if (MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumName) != KNullDesC)
+					{
+					art.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EAlbumArt));
+					}
+				
+				aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art);
+				MPX_DEBUG2("	Art[%S]", &art);
+				}
+			}
+		} // end for
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, iCategory);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::GenerateAlbumFieldsValuesL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::GenerateAlbumFieldsValuesL(const CMPXMedia& aMedia, CDesCArray& aFields, CDesCArray& aValues)
+	{
+	if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+		{
+		const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen);
+		MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
+		}
+		
+	if (aMedia.IsSupported(KMPXMediaMusicArtist))
+	    {
+	    const TDesC& artistName = aMedia.ValueText(KMPXMediaMusicArtist).Left(KMCMaxTextLen);
+	    TUint32 artistId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXArtist,
+	            artistName, ETrue);
+	    MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArtist, artistId);	    
+	    }
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::IsUnknownArtistL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAlbum::IsUnknownArtistL(TUint32 aId)
+	{
+	return iObserver.HandleIsUnknownArtistL(aId);
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::ArtistForAlbumL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAlbum::ArtistForAlbumL(const TUint32 aId)
+    {
+    return iObserver.HandleArtistForAlbumL(aId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAlbum::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbCategory::CreateTableL");
+
+    // create the table
+    HBufC* query = PreProcessStringLC(KAlbumCreateTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    // do not create an index on the Name field
+    // as it only slows down the insert/update queries overall
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAlbum::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbCategory::CheckTableL");
+
+    HBufC* query = PreProcessStringLC(KAlbumCheckTable);
+    TBool check(DoCheckTable(aDatabase, *query));
+    CleanupStack::PopAndDestroy(query);
+
+    return check;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbartist.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,383 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the Artist table
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include <sqldb.h>
+
+#include <mpxlog.h>
+
+#include "mpxdbcommonutil.h"
+#include "mpxdbcommondef.h"
+#include "mpxmediamusicdefs.h"
+#include "mpxdbmanager.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbutil.h"
+#include "mpxdbartist.h"
+
+// CONSTANTS
+
+// maximum number of table name entries per query
+const TInt KMaxTableNameCount = 2;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbArtist* CMPXDbArtist::NewL(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbArtistObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbArtist::NewL");
+
+    CMPXDbArtist* self = CMPXDbArtist::NewLC(aDbManager, aCategory, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbArtist* CMPXDbArtist::NewLC(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbArtistObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbArtist::NewLC");
+
+    CMPXDbArtist* self = new (ELeave) CMPXDbArtist(aDbManager, aCategory, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbArtist::~CMPXDbArtist()
+    {
+    MPX_FUNC("CMPXDbArtist::~CMPXDbArtist");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbArtist::CMPXDbArtist(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory,
+    MMPXDbArtistObserver& aObserver) :
+    CMPXDbCategory(aDbManager, aCategory), 
+    iObserver(aObserver)
+    {
+    MPX_FUNC("CMPXDbArtist::CMPXDbArtist");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbArtist::ConstructL()
+    {
+    MPX_FUNC("CMPXDbArtist::ConstructL");
+
+    BaseConstructL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::AddItemL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbArtist::AddItemL(
+    const TDesC& aName,
+    const TDesC& aArt,
+    TInt aDriveId,
+    TBool& aNewRecord,
+    TBool aCaseSensitive)
+    {
+    MPX_FUNC("CMPXDbArtist::AddItemL");
+    
+    // try to find the item first
+    TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
+        aName, aCaseSensitive));
+    aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
+
+    if (aNewRecord)
+        {      
+        // insert new
+        HBufC* query = PreProcessStringLC(KQueryArtistInsert);
+        HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
+        HBufC* art = MPXDbCommonUtil::ProcessSingleQuotesLC(aArt);
+
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId, name, 1, art);
+
+        CleanupStack::PopAndDestroy(art);
+        CleanupStack::PopAndDestroy(name);
+        CleanupStack::PopAndDestroy(query);
+        }
+    else
+        {
+        // retrieve the existing record
+        HBufC* query = NULL;
+        query = PreProcessStringLC(KQueryCategoryItem);
+        RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, rowId));
+        CleanupStack::PopAndDestroy(query);
+        
+        CleanupClosePushL(recordset);
+        
+        if (recordset.Next() != KSqlAtRow)
+            {
+            User::Leave(KErrNotFound);
+        }
+            
+        // Album Art
+        TPtrC art(KNullDesC);
+        art.Set(MPXDbCommonUtil::GetColumnTextL(recordset, EArtistArt));
+    
+        // the current one is Unknown and the new one is Not Unknown
+        if ( art == KNullDesC && aArt != KNullDesC )
+            {
+            HBufC* artReplaceSingleQuote = 
+                               MPXDbCommonUtil::ProcessSingleQuotesLC( aArt );
+            _LIT( KFormatArt, "Art=\'%S\'" );
+            HBufC* setStr = HBufC::NewLC(256);
+            setStr->Des().Format( KFormatArt, artReplaceSingleQuote );
+            
+            iDbManager.ExecuteQueryL(aDriveId, KQueryArtistUpdate, setStr, rowId);
+            CleanupStack::PopAndDestroy(setStr);            
+            CleanupStack::PopAndDestroy(artReplaceSingleQuote);
+            }
+        
+        CleanupStack::PopAndDestroy(&recordset);
+        
+        // increment the number of songs for the category
+        query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
+        CleanupStack::PopAndDestroy(query);
+        }
+
+    return rowId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::IsUnknownArtistL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbArtist::IsUnknownArtistL(TUint32 aId)
+    {
+	MPX_FUNC("CMPXDbArtist::IsUnknownArtistL");
+	
+    HBufC* name = GetNameL(aId);
+	
+	TInt ret = EFalse;
+	if (*name == KNullDesC)
+		{
+		ret = ETrue;
+		}
+	delete name;
+	
+	return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbArtist::UpdateMediaL(
+    RSqlStatement& aRecord,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbArtist::UpdateMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            if (attributeId & EMPXMediaGeneralId)
+                {
+                MPX_DEBUG1("	EMPXMediaGeneralId");
+				
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+                    aRecord.ColumnInt64(EArtistUniqueId));
+				MPX_DEBUG2("	Id[%d]", aRecord.ColumnInt64(EArtistUniqueId));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                MPX_DEBUG1("	EMPXMediaGeneralTitle");
+				
+                TPtrC artist( MPXDbCommonUtil::GetColumnTextL(aRecord, EArtistName) );
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle,
+                    MPXDbCommonUtil::GetColumnTextL(aRecord, EArtistName));
+
+				MPX_DEBUG2("	Artist[%S]", &artist);
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+//				TInt albumCount = GetAlbumsCountL(aRecord.ColumnInt64(EArtistUniqueId));
+//              aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount,albumCount);
+//              MPX_DEBUG1("	EMPXMediaGeneralCount");
+//				MPX_DEBUG2("	AlbumCount[%d]", albumCount);
+				TInt songCount = aRecord.ColumnInt64(EArtistSongCount);
+				aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount); // mod by anjokela
+				
+                MPX_DEBUG1("	EMPXMediaGeneralCount");
+				MPX_DEBUG2("	SongCount[%d]", songCount);
+                }
+            } // end if contentId == KMPXMediaIdGeneral
+        else if ( contentId == KMPXMediaIdMusic )
+            {
+            if (attributeId & EMPXMediaMusicAlbumArtFileName)
+                {
+                MPX_DEBUG1("    EMPXMediaMusicAlbumArtFileName");
+                TPtrC art(KNullDesC);                
+                art.Set(MPXDbCommonUtil::GetColumnTextL(aRecord, EArtistArt));
+                aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art);
+                MPX_DEBUG2("    Art[%S]", &art);
+                }
+            }
+		} // end for
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, iCategory);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::GenerateArtistFieldsValuesL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbArtist::GenerateArtistFieldsValuesL(const CMPXMedia& aMedia, CDesCArray& aFields, CDesCArray& aValues)
+    {
+    if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+        {
+        const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen);
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
+        }
+    }
+	
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::GetAlbumsCountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbArtist::GetAlbumsCountL(TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbArtist::GetAlbumsCountL");
+	
+	return iObserver.HandleGetAlbumsCountForArtistL(aId);
+    }
+	
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::GetAllCategoryItemsL
+// ----------------------------------------------------------------------------
+//	
+void CMPXDbArtist::GetAllCategoryItemsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbArtist::GetAllCategoryItemsL");
+    HBufC* query = PreProcessStringLC(KQueryArtistAll);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbArtist::UpdateItemL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbArtist::UpdateItemL(
+    TUint32 aId, 
+    const CMPXMedia& aMedia, 
+    TInt aDriveId, 
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbAlbum::UpdateItemL");
+
+    CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EArtistFieldCount);
+    CleanupStack::PushL(fields);
+    CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EArtistFieldCount);
+    CleanupStack::PushL(values);
+
+    // process the media parameter and construct the fields and values array
+    GenerateArtistFieldsValuesL(aMedia, *fields, *values);
+
+    // construct the SET string
+    HBufC* setStr = MPXDbCommonUtil::StringFromArraysLC(*fields, *values, KMCEqualSign, KMCCommaSign);
+
+    if (setStr->Length())
+        {
+        // execute the query
+        iDbManager.ExecuteQueryL(aDriveId, KQueryArtistUpdate, setStr, aId);
+        TInt oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;   
+        MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemModified,
+            EMPXArtist, KDBPluginUid, oldSongId );
+        }
+
+    CleanupStack::PopAndDestroy(setStr);
+    CleanupStack::PopAndDestroy(values);
+    CleanupStack::PopAndDestroy(fields);
+    }
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbArtist::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbCategory::CreateTableL");
+
+    // create the table
+    HBufC* query = PreProcessStringLC(KArtistCreateTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    // do not create an index on the Name field
+    // as it only slows down the insert/update queries overall
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAlbum::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbArtist::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbCategory::CheckTableL");
+
+    HBufC* query = PreProcessStringLC(KArtistCheckTable);
+    TBool check(DoCheckTable(aDatabase, *query));
+    CleanupStack::PopAndDestroy(query);
+
+    return check;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbautoplaylist.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,406 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for the auto playlist functionality.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include <mpxcollectiondbres.rsg>
+#include <sqldb.h>
+
+#include "mpxresource.h"
+#include "mpxdbcommonutil.h"
+#include "mpxdbmanager.h"
+#include "mpxdbutil.h"
+#include "mpxcollectiondbdef.h"
+#include "mpxdbautoplaylist.h"
+#include "mpxdbpluginqueries.h"
+
+const TInt KMPXTableDefaultIndex = 0;
+const TInt32 KMPXRecentlyPlayedPlaylistId = 0x20000000;
+const TInt32 KMPXMostPlayedPlaylistId = 0x20000001;
+const TInt32 KMPXRecentlyAddedPlaylistId = 0x20000002;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAutoPlaylist* CMPXDbAutoPlaylist::NewL(
+    CMPXDbManager& aDbManager,
+    RFs& aFs,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::NewL");
+
+    CMPXDbAutoPlaylist* self = CMPXDbAutoPlaylist::NewLC(aDbManager, aFs, aResource);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAutoPlaylist* CMPXDbAutoPlaylist::NewLC(
+    CMPXDbManager& aDbManager,
+    RFs& aFs,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::NewLC");
+
+    CMPXDbAutoPlaylist* self = new (ELeave) CMPXDbAutoPlaylist(aDbManager);
+    CleanupStack::PushL(self);
+    self->ConstructL(aFs, aResource);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAutoPlaylist::~CMPXDbAutoPlaylist()
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::~CMPXDbAutoPlaylist");
+
+    delete iRecentlyPlayedPlaylist;
+    delete iMostPlayedPlaylist;
+    delete iRecentlyAddedPlaylist;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAutoPlaylist::CMPXDbAutoPlaylist(CMPXDbManager& aDbManager)
+    : iDbManager(aDbManager)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::CMPXDbAutoPlaylist");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAutoPlaylist::ConstructL(
+    RFs& /*aFs*/,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::ConstructL");
+
+    iRecentlyPlayedPlaylist = aResource.ReadHBufCL(R_MC_RECENTLY_PLAYED_PLAYLIST);
+    iMostPlayedPlaylist = aResource.ReadHBufCL(R_MC_MOST_PLAYED_PLAYLIST);
+    iRecentlyAddedPlaylist = aResource.ReadHBufCL(R_MC_RECENTLY_ADDED_PLAYLIST);
+
+    iRecentlyPlayedPlaylistId = KMPXRecentlyPlayedPlaylistId;
+    iMostPlayedPlaylistId = KMPXMostPlayedPlaylistId;
+    iRecentlyAddedPlaylistId = KMPXRecentlyAddedPlaylistId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::AutoPlaylistIdL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAutoPlaylist::AutoPlaylistIdL(
+    TMPXAutoPlaylistType aPlaylistType)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::AutoPlaylistIdL");
+
+    TUint32 id(0);
+    switch (aPlaylistType)
+        {
+        case EMPXRecentlyPlayedPlaylist:
+            {
+            id = iRecentlyPlayedPlaylistId;
+            }
+            break;
+
+        case EMPXMostPlayedPlaylist:
+            {
+            id = iMostPlayedPlaylistId;
+            }
+            break;
+
+        case EMPXRecentlyAddedPlaylist:
+            {
+            id = iRecentlyAddedPlaylistId;
+            }
+            break;
+
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return id;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::AutoPlaylistNameL
+// ----------------------------------------------------------------------------
+//
+TPtrC CMPXDbAutoPlaylist::AutoPlaylistNameL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::AutoPlaylistNameL");
+
+    TPtrC ptr;
+    if (aPlaylistId == iRecentlyPlayedPlaylistId)
+        {
+        ptr.Set(*iRecentlyPlayedPlaylist);
+        }
+    else if (aPlaylistId == iMostPlayedPlaylistId)
+        {
+        ptr.Set(*iMostPlayedPlaylist);
+        }
+    else if (aPlaylistId == iRecentlyAddedPlaylistId)
+        {
+        ptr.Set(*iRecentlyAddedPlaylist);
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    return ptr;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::AutoPlaylistTypeL
+// ----------------------------------------------------------------------------
+//
+TMPXAutoPlaylistType CMPXDbAutoPlaylist::AutoPlaylistTypeL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::AutoPlaylistTypeL");
+
+    TMPXAutoPlaylistType type(EMPXNoAutoPlaylist);
+    if (aPlaylistId == iRecentlyPlayedPlaylistId)
+        {
+        type = EMPXRecentlyPlayedPlaylist;
+        }
+    else if (aPlaylistId == iMostPlayedPlaylistId)
+        {
+        type = EMPXMostPlayedPlaylist;
+        }
+    else if (aPlaylistId == iRecentlyAddedPlaylistId)
+        {
+        type = EMPXRecentlyAddedPlaylist;
+        }
+    else
+        {
+        // do nothing
+        }
+
+    return type;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::GetPlaylistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAutoPlaylist::GetPlaylistL(
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::GetPlaylistL");
+
+    if (EMPXNoAutoPlaylist == AutoPlaylistTypeL(aPlaylistId))
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    UpdateMediaL(aPlaylistId, aAttrs, aMedia);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::GetAllPlaylistsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAutoPlaylist::GetAllPlaylistsL(
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::GetAllPlaylistsL");
+
+    MPX_ASSERT(aMediaArray.Count());
+    MPX_ASSERT(aMediaArray[0]->IsSupported(KMPXMediaGeneralValue));
+    TInt pPath = aMediaArray[0]->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+    MPX_ASSERT(pPath);
+    MPXDbCommonUtil::AppendMediaL(aMediaArray, *iMostPlayedPlaylist, EMPXItem,
+        EMPXPlaylist, iMostPlayedPlaylistId, EMPXWrite);
+    TInt count = aMediaArray.Count();
+    TMPXItemId id = aMediaArray[count-1]->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+    if (count==2)
+        { // the first playlist
+        if (((CMPXCollectionPath*)pPath)->Id()==KMPXInvalidItemId)
+            { // Remove top level with invalid id
+            ((CMPXCollectionPath*)pPath)->Back();
+            }
+        ((CMPXCollectionPath*)pPath)->AppendL(id);
+        }
+    else
+        { // append the end
+        ((CMPXCollectionPath*)pPath)->InsertL(id,
+                                              ((CMPXCollectionPath*)pPath)->Count());
+        }
+    TInt songCount = 0;
+    TInt duration = 0;
+    GetPlaylistDetailsL(EMPXMostPlayedPlaylist, songCount, duration);
+    aMediaArray[count-1]->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount);
+    aMediaArray[count-1]->SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+
+    MPXDbCommonUtil::AppendMediaL(aMediaArray, *iRecentlyPlayedPlaylist, EMPXItem,
+        EMPXPlaylist, iRecentlyPlayedPlaylistId, EMPXWrite);
+    id = aMediaArray[count]->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+    ((CMPXCollectionPath*)pPath)->InsertL(id, ((CMPXCollectionPath*)pPath)->Count());
+    songCount = 0;
+    duration = 0;
+    GetPlaylistDetailsL(EMPXRecentlyPlayedPlaylist, songCount, duration);
+	aMediaArray[count]->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount);
+   	aMediaArray[count]->SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+
+    MPXDbCommonUtil::AppendMediaL(aMediaArray, *iRecentlyAddedPlaylist, EMPXItem,
+        EMPXPlaylist, iRecentlyAddedPlaylistId, EMPXWrite);
+    id = aMediaArray[count+1]->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+    ((CMPXCollectionPath*)pPath)->InsertL(id, ((CMPXCollectionPath*)pPath)->Count());
+    songCount = 0;
+	duration = 0;
+	GetPlaylistDetailsL(EMPXRecentlyAddedPlaylist, songCount, duration);
+	aMediaArray[count+1]->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount);
+	aMediaArray[count+1]->SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::GetPlaylistDetails
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAutoPlaylist::GetPlaylistDetailsL(TMPXAutoPlaylistType aType, TInt& aCount, TInt& aDuration)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::GetPlaylistDetails");
+
+    HBufC* query = NULL;
+  
+    switch ( aType )
+    	{
+		case EMPXMostPlayedPlaylist:
+		    query = HBufC::NewLC(KQueryMusicGetDurationMostPlayed().Length() + KMCIntegerLen);
+		    query->Des().Format(KQueryMusicGetDurationMostPlayed(), KMPXMaxMostPlayedSongs);
+		    break;
+		case EMPXRecentlyPlayedPlaylist:
+		    query = HBufC::NewLC(KQueryMusicGetDurationRecentlyPlayed().Length() + KMCIntegerLen);
+		    query->Des().Format(KQueryMusicGetDurationRecentlyPlayed(), KMPXMaxRecentlyPlayedSongs);
+			break;
+		case EMPXRecentlyAddedPlaylist:
+		    query = HBufC::NewLC(KQueryMusicGetDurationRecentlyAdded().Length());
+		    query->Des().Append(KQueryMusicGetDurationRecentlyAdded());
+			break;
+		default:
+			User::Leave(KErrArgument);
+			break;
+		}
+    
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+    CleanupClosePushL(recordset);
+
+    TInt sum(0);
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        aCount++;
+        sum += recordset.ColumnInt64(KMPXTableDefaultIndex);
+        }
+    
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(query);
+    
+    if (err != KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    aDuration = sum;
+    MPX_DEBUG3("    Count[%d], Duration[%d]", aCount, aDuration);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAutoPlaylist::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAutoPlaylist::UpdateMediaL(
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbAutoPlaylist::UpdateMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            TUint attributeId(aAttrs[i].AttributeId());
+
+            if (attributeId & EMPXMediaGeneralId)
+                {
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aPlaylistId);
+                }
+            if (attributeId & EMPXMediaGeneralCollectionId )
+                {
+                aMedia.SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId,
+                    TUid::Uid(KDBPluginUid));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                if (aPlaylistId == iRecentlyPlayedPlaylistId)
+                    {
+                    aMedia.SetTextValueL(KMPXMediaGeneralTitle, *iRecentlyPlayedPlaylist);
+                    }
+                 else if (aPlaylistId == iMostPlayedPlaylistId)
+                    {
+                    aMedia.SetTextValueL(KMPXMediaGeneralTitle,*iMostPlayedPlaylist);
+                    }
+                 else if (aPlaylistId == iRecentlyAddedPlaylistId)
+                    {
+                    aMedia.SetTextValueL(KMPXMediaGeneralTitle, *iRecentlyAddedPlaylist);
+                    }
+                 else
+                    {
+                    User::Leave(KErrArgument);
+                    }
+                }
+            if (attributeId & EMPXMediaGeneralSynchronized)
+                {
+                aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralSynchronized, EFalse);
+                }
+            if (attributeId & EMPXMediaGeneralNonPermissibleActions)
+                {
+                aMedia.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+                    KMPXMediaGeneralNonPermissibleActions, EMPXWrite);
+                }
+            // EMPXMediaGeneralCount, EMPXMediaGeneralDate, EMPXMediaGeneralDuration,
+            // EMPXMediaGeneralUri, EMPXMediaGeneralDrive, and EMPXMediaGeneralFlags
+            // attributes are not applicable for auto-playlists
+            } // end if contentId == KMPXMediaIdGeneral
+        } // end for
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXPlaylist);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbauxiliary.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interaction with the Auxiliary table.
+*
+*/
+
+
+// INCLUDE FILES
+#include <sqldb.h>
+#include <mpxlog.h>
+
+#include "mpxdbcommonutil.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbmanager.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbauxiliary.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary* CMPXDbAuxiliary::NewL(
+    CMPXDbManager& aDbManager)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::NewL");
+
+    CMPXDbAuxiliary* self = CMPXDbAuxiliary::NewLC(aDbManager);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary* CMPXDbAuxiliary::NewLC(
+    CMPXDbManager& aDbManager)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::NewLC");
+
+    CMPXDbAuxiliary* self = new (ELeave) CMPXDbAuxiliary(aDbManager);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary::~CMPXDbAuxiliary()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::~CMPXDbAuxiliary");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary::CMPXDbAuxiliary(
+    CMPXDbManager& aDbManager) :
+    CMPXDbTable(aDbManager)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::CMPXDbAuxiliary");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::ConstructL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::ConstructL");
+    BaseConstructL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetLastRefreshedTimeL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetLastRefreshedTimeL(
+    TTime aTime)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SetLastRefreshedTimeL");
+
+    // update all databases
+    HBufC* time = MPXDbCommonUtil::TTimeToDesLC(aTime);
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryAuxiliarySetTime, time);
+    CleanupStack::PopAndDestroy(time);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::LastRefreshedTimeL
+// ----------------------------------------------------------------------------
+//
+TTime CMPXDbAuxiliary::LastRefreshedTimeL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::LastRefreshedTimeL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    // read the time string and convert it to TTime
+    TTime time(MPXDbCommonUtil::DesToTTimeL(
+    	MPXDbCommonUtil::GetColumnTextL(recordset, KMPXTableDefaultIndex)));
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return time;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetDBCorruptedL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetDBCorruptedL(
+    TBool aCorrupt)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SetDBCorruptedL");
+
+    // update all databases
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryAuxiliarySetCorrupt,
+        aCorrupt);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::DBCorruptedL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAuxiliary::DBCorruptedL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::DBCorruptedL");
+    return (ExecuteSumQueryL(KQueryAuxiliaryGetCorrupt) > 0);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetSaveDeletedRecordCountL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetSaveDeletedRecordCountL(TInt aDrive,
+    TUint32 aValue)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SetSaveDeletedRecordCountL");
+
+    // update all databases
+    iDbManager.ExecuteQueryL(aDrive, KQueryAuxiliarySetCount, aValue);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SaveDeletedRecordCountL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAuxiliary::SaveDeletedRecordCountL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SaveDeletedRecordCountL");
+    return ExecuteSumQueryL(KQueryAuxiliaryGetCount);
+    }
+
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SaveDeletedRecordCountL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAuxiliary::SaveDeletedRecordCountL(TInt aDriveID)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SaveDeletedRecordCountL ");
+    return ExecuteIntQueryL(aDriveID, KQueryAuxiliaryGetCount);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::IsRefreshedL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAuxiliary::IsRefreshedL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::IsRefreshedL");
+
+    TBool refreshed(ETrue);
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
+    CleanupClosePushL(recordset);
+
+    TInt count(0);
+    while (recordset.Next() == KSqlAtRow)
+        {
+        count++;
+
+        // read the time string and convert it to TTime
+        if (Time::NullTTime() == MPXDbCommonUtil::DesToTTimeL(
+        	MPXDbCommonUtil::GetColumnTextL(recordset, KMPXTableDefaultIndex)))
+            {
+            refreshed = EFalse;
+            break;
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    return refreshed && (count > 0);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::IdL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbAuxiliary::IdL( TInt aDrive )
+    {
+    MPX_DEBUG1("CMPXDbAuxiliary::IdL <--");
+    TInt id(0);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive, KQueryAuxiliaryGetId));
+    CleanupClosePushL( recordset );
+
+    while(recordset.Next() == KSqlAtRow )
+        {
+        id = recordset.ColumnInt(KMPXTableDefaultIndex);
+        }
+
+    CleanupStack::PopAndDestroy( &recordset );
+    MPX_DEBUG1("CMPXDbAuxiliary::IdL -->");
+    return id;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetIdL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetIdL( TInt aDrive, TInt aId )
+    {
+    MPX_DEBUG1("CMPXDbAuxiliary::SetIdL <--");
+    iDbManager.ExecuteQueryL(aDrive,KQueryAuxiliarySetId, aId);
+    MPX_DEBUG1("CMPXDbAuxiliary::SetIdL -->");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool aCorruptTable)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::CreateTableL");
+
+    // create the table
+    User::LeaveIfError(aDatabase.Exec(KAuxiliaryCreateTable));
+
+    // insert the default record
+    // use the same length as '%u' is longer than '0' or '1'
+    HBufC* query = KQueryAuxiliaryInsert().AllocLC();
+    query->Des().Format(KQueryAuxiliaryInsert, aCorruptTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::DropTableL");
+    User::LeaveIfError(aDatabase.Exec(KAuxiliaryDropTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAuxiliary::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::CheckTableL");
+    return DoCheckTable(aDatabase, KAuxiliaryCheckTable);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbcategory.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,690 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the category tables:
+*                Artist, Album, Genre and Composer
+*
+*/
+
+
+// INCLUDE FILES
+#include <sqldb.h>
+
+#include <mpxlog.h>
+
+#include "mpxdbcommonutil.h"
+#include "mpxdbcommondef.h"
+#include "mpxdbmanager.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbutil.h"
+#include "mpxdbcategory.h"
+
+// CONSTANTS
+
+// maximum number of table name entries per query
+const TInt KMaxTableNameCount = 2;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbCategory::~CMPXDbCategory()
+    {
+    MPX_FUNC("CMPXDbCategory::~CMPXDbCategory");
+    delete iTableName;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbCategory::CMPXDbCategory(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory) :
+    CMPXDbTable(aDbManager),
+    iCategory(aCategory)
+    {
+    MPX_FUNC("CMPXDbCategory::CMPXDbCategory");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::BaseConstructL()
+    {
+    MPX_FUNC("CMPXDbCategory::BaseConstructL");
+
+    CMPXDbTable::BaseConstructL();
+    iTableName = MPXDbUtil::TableNameForCategoryL(iCategory).AllocL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::AddItemL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbCategory::AddItemL(
+    const TDesC& aName,
+    TInt aDriveId,
+    TBool& aNewRecord,
+    TBool aCaseSensitive)
+    {
+    MPX_FUNC("CMPXDbCategory::AddItemL");
+
+    // try to find the item first
+    TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory,
+        aName, aCaseSensitive));
+    aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
+
+    if (aNewRecord)
+        {
+        // insert new
+        HBufC* query = PreProcessStringLC(KQueryCategoryInsert);
+        HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
+
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId, name, 1);
+
+        CleanupStack::PopAndDestroy(name);
+        CleanupStack::PopAndDestroy(query);
+        }
+    else
+        {
+        // increment the number of songs for the category
+        HBufC* query = PreProcessStringLC(KQueryCategoryIncrementSongCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
+        CleanupStack::PopAndDestroy(query);
+        }
+
+    return rowId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetNameL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbCategory::GetNameL(
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::GetNameL");
+
+    RSqlStatement recordset(GetCategoryRecordL(aId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::LeaveIfError(KErrNotFound);
+        }
+
+    HBufC* name = MPXDbCommonUtil::GetColumnTextL(recordset, ECategoryName).AllocL();
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return name;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::CountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbCategory::CountL()
+    {
+    MPX_FUNC("CMPXDbCategory::CountL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryCount);
+    TInt count(ExecuteSumQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::FindAllL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::FindAllL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCategory::FindAllL");
+
+    TMPXGeneralType type = aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+
+    const TArray<TMPXAttribute> criteria = aCriteria.Attributes();
+    TInt criteriaCount(criteria.Count());
+
+    // process the criteria and construct the criteria string
+    CDesCArrayFlat* criteriaArray = new (ELeave) CDesCArrayFlat(criteriaCount + 1);
+    CleanupStack::PushL(criteriaArray);
+
+    for (TInt i = 0; i < criteriaCount; ++i)
+        {
+        const TMPXAttribute& criterion = criteria[i];
+        if ((type == EMPXItem) && (criterion == KMPXMediaGeneralId))
+            {
+            TUint32 itemId = (aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+            if (MPX_ITEM_CATEGORY(itemId) != iCategory)
+                {
+                User::Leave(KErrNotSupported);
+                }
+
+            HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, itemId);
+            CleanupStack::PopAndDestroy(critStr);
+            }
+        else if (criterion == KMPXMediaGeneralTitle)
+            {
+#ifdef RD_MPX_COLLECTION_CACHE
+           
+            if (aCriteria.ValueText(KMPXMediaGeneralTitle).Length() <= 0)
+                {
+                TUint32 itemId = MPXDbCommonUtil::GenerateUniqueIdL(
+                                    iDbManager.Fs(), iCategory, KNullDesC, EFalse);
+                HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
+                MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, itemId);
+                CleanupStack::PopAndDestroy(critStr);
+                }
+            else
+                {
+
+#endif //RD_MPX_COLLECTION_CACHE
+                HBufC* critStr = PreProcessStringLC(KCriterionCategoryName);
+                HBufC* title = MPXDbCommonUtil::ProcessPatternCharsLC(
+                    aCriteria.ValueText(KMPXMediaGeneralTitle));
+                MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, *title);
+                CleanupStack::PopAndDestroy(2, critStr); // title & critStr
+#ifdef RD_MPX_COLLECTION_CACHE
+                }
+#endif //RD_MPX_COLLECTION_CACHE
+            }
+        else
+            {
+            // ignore attribute
+            }
+        }
+
+    // construct criteria string
+    HBufC* criteriaStr = MPXDbCommonUtil::StringFromArrayLC(*criteriaArray, KMCAndKeyword);
+
+    // either get all items or items filtered based on criteria
+    HBufC* query = PreProcessStringLC(criteriaStr->Length() ?
+        KQueryCategoryItems() : KQueryCategoryAll());
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, criteriaStr));
+    CleanupStack::PopAndDestroy(3, criteriaArray); // query, criteriaStr, criteriaArray
+    CleanupClosePushL(recordset);
+
+    // process the results
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::DecrementSongsForCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::DecrementSongsForCategoryL(
+    const TUint32 aId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TBool& aItemExist)
+    {
+    MPX_FUNC("CMPXDbCategory::DecrementSongsForCategoryL");
+
+    // if just one song uses this category. Use <= just in case
+    if (GetSongsCountL(aDriveId, aId) <= 1)
+        {
+        aItemExist = EFalse;
+        // delete the category
+        DeleteCategoryL(aId, aDriveId);
+
+        if (aItemChangedMessages)
+            {
+            // add the item changed message
+            MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
+                iCategory, KDBPluginUid);
+            }
+        }
+    else
+        {
+        aItemExist = ETrue;
+        // decrement the number of songs for the category
+        HBufC* query = PreProcessStringLC(KQueryCategoryDecrementSongCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, aId);
+        CleanupStack::PopAndDestroy(query);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::DeleteCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::DeleteCategoryL(
+    TUint32 aId,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbCategory::DeleteCategoryL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryDelete);
+    iDbManager.ExecuteQueryL(aDriveId, *query, aId);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetCategoryItemsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::GetCategoryItemsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCategory::GetCategoryItemsL");
+
+    // have to run one query to get all items as opposed to individual queries
+    // because of the sorting
+
+    // construct the unique ID criteria string
+    // (UniqueId = %u OR UniqueId = %u ...)
+    TInt count(aMediaArray.Count());
+    HBufC* criteria = HBufC::NewLC((2 * KCriterionCategoryUniqueId().Length() +
+        KMCIntegerLen + KMCOrKeyword().Length() + 2) * count);
+    TPtr ptr(criteria->Des());
+    ptr.Append(KMCOpenBracket);
+    for (TInt index = 0; index < count; ++index)
+        {
+        CMPXMedia* media = aMediaArray[index];
+
+        HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
+        HBufC* criterion = MPXDbCommonUtil::SqlCriterionLC(*critStr,
+            (media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId1);
+        ptr.Append(*criterion);
+        CleanupStack::PopAndDestroy(criterion);
+        CleanupStack::PopAndDestroy(critStr);
+
+        if (index < (count - 1))
+            {
+            ptr.Append(KMCOrKeyword);
+            }
+        }
+    ptr.Append(KMCCloseBracket);
+
+    // the array has to be reset as the items have to be returned in a different sort order
+    aMediaArray.Reset();
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryItems);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, criteria));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(criteria);
+
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetAllCategoryItemsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::GetAllCategoryItemsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCategory::GetAllCategoryItemsL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryAll);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetCategoryItemL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::GetCategoryItemL(
+    TUint32 aId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbCategory::GetCategoryItemL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+    ExecuteMediaQueryL(aAttrs, aMedia, *query, aId);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetSubCategoryItemsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::GetSubCategoryItemsL(
+    TMPXGeneralCategory aParentCategory,
+    TUint32 aParentId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCategory::GetSubCategoryItemsL");
+
+    // this is only valid for albums belonging to an artist
+    ASSERT((iCategory == EMPXAlbum) && (aParentCategory == EMPXArtist));
+
+    // to handle the UREL warning
+    (void)aParentCategory;
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryCategorySubcategoryItems, aParentId));
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::CategoryItemExistsL
+// The category records must be in the same database as the corresponding
+// Music record, otherwise when adding a duplicate of a song on a
+// different drive this method will return true and the category record won't
+// be created.
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbCategory::CategoryItemExistsL(
+    TInt aDriveId,
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::CategoryItemExistsL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+    RSqlStatement recordset(
+        iDbManager.ExecuteSelectQueryL(aDriveId, *query, aId));
+
+    TBool exists(recordset.Next() == KSqlAtRow);
+
+    recordset.Close();
+    CleanupStack::PopAndDestroy(query);
+
+    return exists;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetSongsCountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbCategory::GetSongsCountL(
+    TInt aDriveId,
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::GetSongsCountL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryGetSongCount);
+    RSqlStatement recordset(
+        iDbManager.ExecuteSelectQueryL(aDriveId, *query, aId));
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    TInt ret(0);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        ret += recordset.ColumnInt(KMPXTableDefaultIndex);
+        }
+
+    if (err != KSqlAtEnd)
+        {
+        User::Leave(err);
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(query);
+
+    return ret;
+    }
+
+void CMPXDbCategory::UpdateItemL(
+    TUint32 aId, 
+    const CMPXMedia& aMedia, 
+    TInt aDriveId, 
+    CMPXMessageArray* aItemChangedMessages)
+	{
+	// nothing
+	}
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::UpdateMediaL(
+    RSqlStatement& aRecord,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbCategory::UpdateMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            if (attributeId & EMPXMediaGeneralId)
+                {
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+                    aRecord.ColumnInt64(ECategoryUniqueId));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle,
+                    MPXDbCommonUtil::GetColumnTextL(aRecord, ECategoryName));
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+                aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount,
+                    GetSongsCountL(KDbManagerAllDrives,
+                    aRecord.ColumnInt64(ECategoryUniqueId)));
+                }
+            } // end if contentId == KMPXMediaIdGeneral
+        } // end for
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, iCategory);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetCategoryRecordL
+// ----------------------------------------------------------------------------
+//
+RSqlStatement CMPXDbCategory::GetCategoryRecordL(
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::GetCategoryRecordL");
+    HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+    RSqlStatement statement(iDbManager.ExecuteSelectQueryL(*query, aId));
+    CleanupStack::PopAndDestroy(query);
+
+    return statement;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::PreProcessStringLC
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbCategory::PreProcessStringLC(
+    const TDesC& aQuery)
+    {
+    MPX_FUNC("CMPXDbCategory::PreProcessStringLC");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + KMaxTableNameCount * (iTableName->Length() +
+        KCategoryTablePlaceholder().Length()));
+    TPtr queryPtr(query->Des());
+
+    // copy the query string
+    queryPtr = aQuery;
+
+    // replace all instances of the placeholder with the actual table name
+    TInt index(0);
+    while ((index = queryPtr.Find(KCategoryTablePlaceholder)) != KErrNotFound)
+        {
+        queryPtr.Replace(index, KCategoryTablePlaceholder().Length(), *iTableName);
+        }
+
+    return query;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::ProcessRecordsetL
+// Unknown item is stored in the database as NULL (name field). This ensures the
+// unknown item to be the 1st found record if it exists. This will save time in
+// searching for the unknown record among the results and avoid performing
+// descriptor comparison. If the 1st record is the unknown item, it won't be
+// appended to the array until all other records have been put in the array.
+//
+// NOTE: putting unknown item to the end of the array only takes place when title
+//       field is requested. normal sorting algorithm occurs if title isn't
+//       requested.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::ProcessRecordsetL(
+    const TArray<TMPXAttribute>& aAttrs,
+    RSqlStatement& aRecordset,
+    CMPXMediaArray& aMediaArray)
+    {
+    // populate the array
+    TBool firstRecord(ETrue);
+    CMPXMedia* unknownMedia(NULL);
+    TInt prevId(0);
+    TInt err(KErrNone);
+
+    TInt pPath(0);
+    if (aMediaArray.Count())
+        {
+        CMPXMedia* pMedia = aMediaArray[0];
+        if (pMedia->IsSupported(KMPXMediaGeneralValue))
+            { // Query excuted by OpenL
+            pPath = pMedia->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+            MPX_ASSERT(pPath);
+            }
+        }
+    RArray<TMPXItemId> ids;
+    CleanupClosePushL(ids);
+
+    while ((err = aRecordset.Next()) == KSqlAtRow)
+        {
+        TUint32 rowId(aRecordset.ColumnInt64(ECategoryUniqueId));
+        if (prevId == rowId)
+            {
+            continue;
+            }
+
+        prevId = rowId;
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        UpdateMediaL(aRecordset, aAttrs, *media);
+
+        if (firstRecord &&
+            (MPXDbCommonUtil::GetColumnTextL(aRecordset, ECategoryName).Length() == 0))
+            {
+            unknownMedia = media;
+            }
+
+        if (!firstRecord || !unknownMedia)
+            {
+            if (media->IsSupported(KMPXMediaGeneralId) && pPath)
+                {
+                ids.AppendL(media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+                }
+            aMediaArray.AppendL(*media);
+            CleanupStack::PopAndDestroy(media);
+            }
+
+        firstRecord = EFalse;
+        } // end while
+
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(err);
+        }
+
+    if (unknownMedia)
+        {
+        if (unknownMedia->IsSupported(KMPXMediaGeneralId) && pPath)
+            {
+            ids.AppendL(unknownMedia->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+            }
+        aMediaArray.AppendL(*unknownMedia);
+        CleanupStack::PopAndDestroy(unknownMedia);
+        }
+
+    // Append ids to the returned path
+    if (pPath)
+        {
+        ((CMPXCollectionPath*)pPath)->AppendL(ids.Array());
+        }
+    CleanupStack::PopAndDestroy(&ids);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbCategory::CreateTableL");
+
+    // create the table
+    HBufC* query = PreProcessStringLC(KCategoryCreateTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    // do not create an index on the Name field
+    // as it only slows down the insert/update queries overall
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbCategory::DropTableL");
+
+    HBufC* query = PreProcessStringLC(KCategoryDropTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbCategory::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbCategory::CheckTableL");
+
+    HBufC* query = PreProcessStringLC(KCategoryCheckTable);
+    TBool check(DoCheckTable(aDatabase, *query));
+    CleanupStack::PopAndDestroy(query);
+
+    return check;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbcomposer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the category tables:
+*                Artist, Album, Genre and Composer
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include "mpxdbcomposer.h"
+
+// CONSTANTS
+
+// maximum number of table name entries per query
+const TInt KMaxTableNameCount = 2;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbComposer* CMPXDbComposer::NewL(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbComposer::NewL");
+
+    CMPXDbComposer* self = CMPXDbComposer::NewLC(aDbManager, aCategory);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbComposer* CMPXDbComposer::NewLC(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbComposer::NewLC");
+
+    CMPXDbComposer* self = new (ELeave) CMPXDbComposer(aDbManager, aCategory);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbComposer::~CMPXDbComposer()
+    {
+    MPX_FUNC("CMPXDbComposer::~CMPXDbComposer");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbComposer::CMPXDbComposer(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory) :
+    CMPXDbCategory(aDbManager, aCategory)
+    {
+    MPX_FUNC("CMPXDbComposer::CMPXDbComposer");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbComposer::ConstructL()
+    {
+    MPX_FUNC("CMPXDbComposer::ConstructL");
+
+    BaseConstructL();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbgenre.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the category tables:
+*                Artist, Album, Genre and Composer
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include "mpxdbgenre.h"
+
+// CONSTANTS
+
+// maximum number of table name entries per query
+const TInt KMaxTableNameCount = 2;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbGenre* CMPXDbGenre::NewL(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbGenre::NewL");
+
+    CMPXDbGenre* self = CMPXDbGenre::NewLC(aDbManager, aCategory);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbGenre* CMPXDbGenre::NewLC(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbGenre::NewLC");
+
+    CMPXDbGenre* self = new (ELeave) CMPXDbGenre(aDbManager, aCategory);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbGenre::~CMPXDbGenre()
+    {
+    MPX_FUNC("CMPXDbGenre::~CMPXDbGenre");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbGenre::CMPXDbGenre(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory) :
+    CMPXDbCategory(aDbManager, aCategory)
+    {
+    MPX_FUNC("CMPXDbGenre::CMPXDbGenre");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbGenre::ConstructL()
+    {
+    MPX_FUNC("CMPXDbGenre::ConstructL");
+
+    BaseConstructL();
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbhandler.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2939 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is used by db plugin for all database related
+*                functionality. The main responsibilities are:
+*
+*/
+
+
+// INCLUDE FILES
+#include <bautils.h>
+#ifdef RD_MULTIPLE_DRIVE
+#include <driveinfo.h>
+#include <pathinfo.h>
+#endif //RD_MULTIPLE_DRIVE
+
+#include <mpxcollectiondbres.rsg>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxcollectionpath.h>
+#include <mpxlog.h>
+
+#include "mpxresource.h"
+#include "mpxdbcommonutil.h"
+
+#include "mpxdbutil.h"
+#include "mpxcollectiondbdef.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxcollectiondbmanager.h"
+#include "mpxdbplaylist.h"
+#include "mpxdbplaylistsongs.h"
+#include "mpxdbcategory.h"
+#include "mpxdbauxiliary.h"
+#include "mpxdbautoplaylist.h"
+#include "mpxdbhandler.h"
+#include "mpxdbartist.h"
+#include "mpxdbalbum.h"
+#include "mpxdbgenre.h"
+#include "mpxdbcomposer.h"
+
+// CONSTANTS
+_LIT(KMPXVirtualPlaylistExt, ".vir");
+static const TInt KMaxOpInTransaction = 100;
+
+const TInt KSqlDbCorrupted = -321;
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+
+#include <centralrepository.h>
+
+// MTP CenRep Key UID
+const TUid KMPXMtpSettings = {0x101FFC53};
+// MTP CenRep Key for Delete contents
+const TUint32 KMPXMtpSaveDeletedRecordFlag = 0x00000001;
+
+#endif
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbHandler* CMPXDbHandler::NewL(
+    RFs& aFs,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbHandler::NewL");
+    CMPXDbHandler* self = CMPXDbHandler::NewLC(aFs, aResource);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbHandler* CMPXDbHandler::NewLC(
+    RFs& aFs,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbHandler::NewLC");
+    CMPXDbHandler* self = new (ELeave) CMPXDbHandler(aFs, aResource);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbHandler::~CMPXDbHandler()
+    {
+    MPX_FUNC("CMPXDbHandler::~CMPXDbHandler");
+
+    delete iAutoPlaylist;
+
+    delete iDbMusic;
+    delete iDbPlaylist;
+    delete iDbArtist;
+    delete iDbAlbum;
+    delete iDbGenre;
+    delete iDbComposer;
+    delete iDbAuxiliary;
+    delete iDbManager;
+
+    delete iMimeTypes;
+    delete iExtensions;
+    delete iExtensionsMime;
+    delete iExtensionsDrm;
+
+    iDbDrives.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that might leave
+// ----------------------------------------------------------------------------
+//
+CMPXDbHandler::CMPXDbHandler(
+    RFs& aFs,
+    CMPXResource& aResource) :
+    iFs(aFs),
+    iResource(aResource)
+    {
+    MPX_FUNC("CMPXDbHandler::CMPXDbHandler");
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::ConstructL()
+    {
+    MPX_FUNC("CMPXDbHandler::ConstructL");
+
+    iMimeTypes = iResource.ReadDesCArrayL(R_MC_MIME_TYPES);
+    iExtensions = iResource.ReadDesCArrayL(R_MC_MUSIC_FILE_EXTENSIONS);
+    iExtensionsMime = iResource.ReadDesCArrayL(R_MC_FILE_EXTENSIONS_MIME);
+    iExtensionsDrm = iResource.ReadDesCArrayL(R_MC_FILE_EXTENSIONS_DRM);
+    
+    // make sure all databases are created and valid
+    iDbManager = CMPXCollectionDbManager::NewL(iFs);
+    
+    CDesCArrayFlat* musicFolders =
+#ifdef RD_MULTIPLE_DRIVE
+        GetMusicFoldersL();
+#else
+        iResource.ReadDesCArrayL(R_MC_DEFAULT_MUSIC_FOLDERS);
+#endif
+
+    // create the music folders and initialize iDbDrives
+    CleanupStack::PushL(musicFolders);
+    ProcessMusicFoldersL(*musicFolders);
+    CleanupStack::PopAndDestroy(musicFolders);
+
+    // Create the db infrastructure, 
+    //
+    iDbMusic = CMPXDbMusic::NewL(*iDbManager, iResource, *this);
+    iDbPlaylist = CMPXDbPlaylist::NewL(*iDbManager, *this);
+    iDbArtist = CMPXDbArtist::NewL(*iDbManager, EMPXArtist, *this);
+	iDbAlbum = CMPXDbAlbum::NewL(*iDbManager, EMPXAlbum, *this);
+    iDbGenre = CMPXDbGenre::NewL(*iDbManager, EMPXGenre);
+    iDbComposer = CMPXDbComposer::NewL(*iDbManager, EMPXComposer);
+    iAutoPlaylist = CMPXDbAutoPlaylist::NewL(*iDbManager, iFs, iResource);
+    iDbAuxiliary = CMPXDbAuxiliary::NewL(*iDbManager);
+
+    MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives));
+    iCollectionOpen = ETrue;
+
+    // If KErrCorrupt is returned, a database file was found to be corrupted
+    // and was replaced with a new one.  The db plugin can ignore this error and continue
+    // because a new db file was successfully created in a subsequent retry.
+    if ((err != KErrNone) && (err != KErrCorrupt) && (err != KErrDiskFull))
+        {
+        // leave to signal the caller that there was an error why creating and opening
+        // one or more of the databases
+        User::Leave(err);
+        }
+    else if (err == KErrDiskFull)
+        {
+        iOutOfDisk = ETrue;
+        }
+    else
+        {
+        // do nothing
+        }
+
+    // Verify the volume ids of each drive matches the database
+    MPX_TRAP(err,VerifyVolumeIdL());
+    if ((err != KErrNone) && (err != KErrDiskFull))
+        {
+        // leave to signal the caller that there was an error why creating and opening
+        // one or more of the databases
+        User::Leave(err);
+        }
+    else if (err == KErrDiskFull)
+        {
+        iOutOfDisk = ETrue;
+        }
+
+//#ifdef _DEBUG
+//    iDbManager->PrintDatabaseL();    // PREQ2536 the files sqlrowsetutil.h and sqlrowsetutil.cpp has been removed
+//#endif
+
+    MPX_DEBUG2("CMPXDbHandler::ConstructL DbCount[%d]", iDbManager->DatabaseCount());
+    }
+
+// ----------------------------------------------------------------------------
+// Add song to collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::AddSongL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aMessageArray)
+    {
+    MPX_FUNC("CMPXDbHandler::AddSongL");
+
+    BeginTransactionL();
+    TUint32 songId(0);
+    MPX_TRAPD(err, songId = DoAddSongL(aMedia,aMessageArray));
+
+    if (iOutOfDisk && (err == KErrNotFound))
+        {
+        err = KErrDiskFull;
+        }
+    EndTransactionL(err);
+
+    return songId;
+    }
+
+// ----------------------------------------------------------------------------
+// Add song to collection with no database transaction
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::AddSongWithNoTransactionL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aMessageArray)
+    {
+    MPX_FUNC("CMPXDbHandler::AddSongWithNoTransactionL");
+
+    TUint32 songId(0);
+    MPX_TRAPD(err, songId = DoAddSongL(aMedia,aMessageArray));
+
+    if (iOutOfDisk && (err == KErrNotFound))
+        {
+        err = KErrDiskFull;
+        }
+    User::LeaveIfError(err);
+
+    return songId;
+    }
+
+// ----------------------------------------------------------------------------
+// Add playlist to collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::AddPlaylistL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::AddPlaylistL");
+
+    BeginTransactionL();
+    TUint32 playlistId(0);
+    MPX_TRAPD(err, playlistId = DoAddPlaylistL(aMedia));
+    EndTransactionL(err);
+
+    return playlistId;
+    }
+
+// ----------------------------------------------------------------------------
+// Add song to playlist
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::AddSongToPlaylistL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::AddSongToPlaylistL");
+
+    BeginTransactionL();
+    TUint32 playlistId(0);
+    MPX_TRAPD(err, playlistId = DoAddSongToPlaylistL(aMedia));
+    EndTransactionL(err);
+
+    return playlistId;
+    }
+
+// ----------------------------------------------------------------------------
+// Update a song in the collection
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbHandler::UpdateSongL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::UpdateSongL");
+
+    BeginTransactionL();
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+    MPX_TRAPD(err, visibleChange = DoUpdateSongL(aMedia, aItemChangedMessages));
+    EndTransactionL(err);
+    return visibleChange;
+    }
+
+// ----------------------------------------------------------------------------
+// Update a playlist in the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::UpdatePlaylistL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aMessageArray)
+    {
+    MPX_FUNC("CMPXDbHandler::UpdatePlaylistL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoUpdatePlaylistL(aMedia, aMessageArray));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Updates the playlist songs
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::UpdatePlaylistSongsL(
+    const CMPXMedia& aMedia,
+    CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbHandler::UpdatePlaylistSongsL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoUpdatePlaylistSongsL(aMedia, aMessage));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Reorder a song in a playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::ReorderPlaylistL(
+    const TMPXItemId& aPlaylistId,
+    const TMPXItemId& aSongId,
+    TUint aOriginalOrdinal,
+    TUint aNewOrdinal,
+    CMPXMessage& aMessage)
+    {
+    MPX_DEBUG5("-->CMPXDbHandler::ReorderPlaylistL(0x%x, 0x%x, %d, %d)",
+               aPlaylistId.iId2, aSongId.iId2, aOriginalOrdinal, aNewOrdinal);
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoReorderPlaylistL(aPlaylistId, aSongId, aOriginalOrdinal, aNewOrdinal, aMessage));
+    EndTransactionL(err);
+    MPX_DEBUG2("<--CMPXDbHandler::ReorderPlaylistL() error=%d", err);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove the entire music collection database
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveEntireCollectionL()
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveEntireCollectionL");
+    BeginTransactionL();
+    MPX_TRAPD(err, iDbManager->RecreateAllDatabasesL());
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Delete a song from collection
+// The function notifies collection model to perform deletion
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveSongL(
+    TUint32 aSongId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages,
+    TBool aDeleteRecord)
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveSongL");
+
+    MPX_TRAPD(err, DoRemoveSongL(aSongId, aUriArray, aItemChangedMessages, aDeleteRecord));
+
+    MPX_TRAP(err, DoRemoveSongFromPlaylistL(aSongId,aItemChangedMessages));
+
+    }
+
+// ----------------------------------------------------------------------------
+// Removes a category of songs from the music collection,
+// and its corresponding category in the lookup table
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveSongsMatchingCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveSongsMatchingCategoryL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoRemoveSongsMatchingCategoryL(aCategory, aCategoryId, aUriArray, aItemChangedMessages));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Delete songs for the specified artist and album from collection
+// The function notifies collection model to perform deletion
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveSongsMatchingArtistAndAlbumL(
+    TUint32 aArtistId,
+    TUint32 aAlbumId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveSongsMatchingArtistAndAlbumL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoRemoveSongsMatchingArtistAndAlbumL(aArtistId, aAlbumId, aUriArray,
+        aItemChangedMessages));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all playlists from collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveAllPlaylistsL()
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveAllPlaylistsL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoRemoveAllPlaylistsL());
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove specified playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemovePlaylistL(
+    TUint32 aPlaylistId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::RemovePlaylistL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoRemovePlaylistL(aPlaylistId, aUriArray, aItemChangedMessages));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove song from playlist songs table
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RemoveSongFromPlaylistL(
+    TUint32 aPlaylistId,
+    const TMPXItemId& aSongId,
+    TInt aOrdinal,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveSongFromPlaylistL");
+    MPX_DEBUG5("CMPXDbHandler::RemoveSongFromPlaylistL(playlist 0x%x, songId [0x%x,0x%x], ordinal %d)",
+        aPlaylistId, aSongId.iId1, aSongId.iId2, aOrdinal);
+
+    MPX_TRAPD(err, DoRemoveSongFromPlaylistL(aPlaylistId, aSongId, aOrdinal, aItemChangedMessages));
+    if ( err && InTransaction() )
+        {
+        // only end transaction if there's an error
+        EndTransactionL( err );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Cleanup records marked as deleted. This is designated for MTP to clean up records marked as deleted
+// at the end of its session.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::CleanupDeletedRecordsL()
+    {
+    MPX_FUNC("CMPXDbHandler::CleanupDeletedRecordsL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoCleanupDeletedRecordsL());
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+//  Read all songs and cache them into an array ordered by song name
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllSongsL(
+    CMPXMediaArray* aMediaArray,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllSongsL");
+    iDbMusic->GetAllSongsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+//  Read a limited # of songs and cache them into an array ordered by song name
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs,
+                                        CMPXMediaArray& aMediaArray, TInt aLimit)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllSongsLimitedL");
+    iDbMusic->GetAllSongsLimitedL( aAttrs, aMediaArray, aLimit );
+    }
+
+// ----------------------------------------------------------------------------
+//  Read all songs and cache them into an array ordered by song name
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsInBlockL(
+    CMPXMediaArray* aMediaArray,
+    const TArray<TMPXAttribute>& aAttrs,
+    TPtrC aTitle,
+    TUint aNumOfSongs,
+    TBool aAsc)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsInBlockL");
+    iDbMusic->GetSongsInBlockL(aAttrs, *aMediaArray, aTitle, aNumOfSongs, aAsc);
+    }
+
+// ----------------------------------------------------------------------------
+//  Read songs at a particular offset
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsAtOffsetL( CMPXMediaArray* aMediaArray,
+                                       const TArray<TMPXAttribute>& aAttrs,
+                                       TInt aOffset,
+                                       TInt aCount )
+    {
+    MPX_DEBUG1("CMPXDbHandler::GetSongsAtOffsetL <--");
+    iDbMusic->GetSongsAtOffsetL( *aMediaArray, aAttrs, aOffset, aCount );
+    }
+
+// ----------------------------------------------------------------------------
+// Get all songs matching the given artist ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingArtistL(
+    TUint aArtistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingArtistL");
+    iDbMusic->GetSongsForArtistL(aArtistId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all songs matching the given album ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingAlbumL(
+    TUint aAlbumId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingAlbumL");
+    iDbMusic->GetSongsForAlbumL(aAlbumId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Get all songs matching the given artist and album ID
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingArtistAndAlbumL(
+    TUint aArtistId,
+    TUint aAlbumId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingArtistAndAlbumL");
+    iDbMusic->GetSongsForArtistAndAlbumL(aArtistId, aAlbumId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all songs matching the given genre ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingGenreL(
+    TUint aGenreId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingGenreL");
+    iDbMusic->GetSongsForGenreL(aGenreId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all songs matching the given composer ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingComposerL(
+    TUint aComposerId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingComposerL");
+    iDbMusic->GetSongsForComposerL(aComposerId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all songs that belong to the given playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongsMatchingPlaylistL(
+    TUint aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongsMatchingPlaylistL");
+    GetPlaylistSongsL(aPlaylistId, aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get song matching the given song ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongL(
+    TUint32 aSongId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongL");
+    iDbMusic->GetSongL(aSongId, aAttrs, aMedia);
+    }
+
+// ----------------------------------------------------------------------------
+// GetSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetSongL(
+    TUint32 aSongId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongL");
+
+    CMPXMedia* media = CMPXMedia::NewL();
+    CleanupStack::PushL(media);
+
+    GetSongL(aSongId, aAttrs, *media);
+    aMediaArray.AppendL(*media);
+
+    CleanupStack::PopAndDestroy(media);
+    }
+
+// ----------------------------------------------------------------------------
+// Get song matching the given song ID and playlist ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetPlaylistSongL(
+    TUint32 aSongId,
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_DEBUG3("-->CMPXDbHandler::GetPlaylistSongL songId[0x%x] playlistId[0x%x]", aSongId, aPlaylistId);
+
+    // complete the song information from the Music table
+    MPX_TRAPD(err, iDbMusic->GetSongL(aSongId, aAttrs, aMedia));
+
+    //
+    // song not found in Music table
+    //
+    if (err == KErrNotFound)
+        {
+        //
+        // Leave with KErrNotFound if one of the following is true:
+        // 1) the requested song is in an auto playlist. Since auto-playlist isn't
+        //    stored in playlist tables, we won't be able to retrieve info elsewhere
+        // 2) the requested song is in a user playlist but we cannot find the song
+        //    info from playlist tables either
+        //
+        if (EMPXNoAutoPlaylist != iAutoPlaylist->AutoPlaylistTypeL(aPlaylistId) ||
+            !iDbPlaylist->Songs().GetSongL(aPlaylistId, aSongId, aAttrs, aMedia))
+            {
+            User::Leave(KErrNotFound);
+            }
+        }
+
+    //
+    // Unable to read information from Music table
+    //
+    else
+        {
+        // ignore the error if KErrNotFound
+        User::LeaveIfError(err);
+        }
+    MPX_DEBUG1("<--CMPXDbHandler::GetPlaylistSongL");
+    }
+
+// ----------------------------------------------------------------------------
+// GetPlaylistSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetPlaylistSongL(
+    TUint32 aSongId,
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistSongL");
+
+    CMPXMedia* media = CMPXMedia::NewL();
+    CleanupStack::PushL(media);
+
+    GetPlaylistSongL(aSongId, aPlaylistId, aAttrs, *media);
+    aMediaArray.AppendL(*media);
+
+    CleanupStack::PopAndDestroy(media);
+    }
+
+// ----------------------------------------------------------------------------
+// Get song matching the given URI
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::GetSongIdMatchingUriL(
+    const TDesC& aUri)
+    {
+    MPX_FUNC("CMPXDbHandler::GetSongIdMatchingUriL");
+    return MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXCollection, aUri, EFalse);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all artists
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllArtistsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllArtistsL");
+    iDbArtist->GetAllCategoryItemsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all albums
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllAlbumsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllAlbumsL");
+    iDbAlbum->GetAllCategoryItemsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all albums for the given artist ID
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAlbumsMatchingArtistL(
+    TUint aArtistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAlbumsMatchingArtistL");
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL( attributes );
+        
+    TBool tryGetSongCount = EFalse;
+    TInt attrCount(aAttrs.Count());
+    TInt i = 0;
+    for (i = 0; i < attrCount; i++)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral && attributeId & EMPXMediaGeneralCount)
+            {
+            MPX_DEBUG1("    EMPXMediaGeneralCount");
+            
+            attributes.Append(TMPXAttribute(KMPXMediaIdGeneral, attributeId & !EMPXMediaGeneralCount));
+                       
+            tryGetSongCount = ETrue;
+            break;
+            }
+        
+        attributes.Append(aAttrs[i]);
+        }
+    
+    for (TInt j = i+1; j < attrCount; j++)
+        {
+        attributes.Append(aAttrs[j]);
+        }
+    iDbAlbum->GetSubCategoryItemsL(EMPXArtist, aArtistId, attributes.Array(), aMediaArray);
+    CleanupStack::PopAndDestroy(&attributes);
+    
+    TInt pPath(0);
+    if (aMediaArray.Count())
+        {
+        CMPXMedia* pMedia = aMediaArray[0];
+        if (pMedia->IsSupported(KMPXMediaGeneralValue))
+            {
+            pPath = pMedia->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+            MPX_ASSERT(pPath);
+            }
+        }
+    
+    TInt albumCount(aMediaArray.Count());
+    if (albumCount)
+        {
+        if ( tryGetSongCount )
+            {
+            TInt startIndex = pPath ? 1 : 0;
+            
+            for (TInt i = startIndex; i < albumCount; i++)
+                {
+                CMPXMedia* media = aMediaArray[i];
+                TUint32 albumId((media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)));
+
+				TInt songCount = iDbAlbum->GetSongsCountInAlbumMatchingArtistL(aArtistId, albumId);
+
+                media->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, songCount );
+				MPX_DEBUG2("	SongCount[%d]", songCount );				
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Get all genres
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllGenresL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllGenresL");
+    iDbGenre->GetAllCategoryItemsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all composers
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllComposersL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllComposersL");
+    iDbComposer->GetAllCategoryItemsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the playlist ID of the playlist that matches the given URI
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::GetPlaylistIdMatchingUriL(
+    const TDesC& aUri)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistIdMatchingUriL");
+    return iDbPlaylist->GetIdL(aUri);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::IsAutoPlaylistL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::IsAutoPlaylistL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbHandler::IsAutoPlaylistL");
+    return (iAutoPlaylist->AutoPlaylistTypeL(aPlaylistId) != EMPXNoAutoPlaylist);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all user playlist names
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllPlaylistsL(
+    CMPXMediaArray* aMediaArray,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllPlaylistsL");
+    iDbPlaylist->GetAllPlaylistsL(aAttrs, *aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all system playlist names
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetAllSystemPlaylistNamesL(
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllSystemPlaylistNamesL()");
+    iAutoPlaylist->GetAllPlaylistsL(*aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the name of the row matching the given ID
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbHandler::GetNameMatchingIdL(
+    const TUint32 aId) const
+    {
+    MPX_FUNC("CMPXDbHandler::GetNameMatchingIdL()");
+
+    HBufC* name(NULL);
+    TMPXGeneralCategory category(MPX_ITEM_CATEGORY(aId));
+    switch (category)
+        {
+        case EMPXCollection:
+            {
+            // song name
+            name = iDbMusic->GetNameL(aId);
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            // playlist name
+            if (iAutoPlaylist->AutoPlaylistTypeL(aId) != EMPXNoAutoPlaylist)
+                {
+                name = iAutoPlaylist->AutoPlaylistNameL(aId).AllocL();
+                }
+            else
+                {
+                name = iDbPlaylist->GetNameL(aId);
+                }
+            break;
+            }
+        default:
+            {
+            // category name
+            name = DbCategoryL(category)->GetNameL(aId);
+            break;
+            }
+        }
+
+    return name;
+    }
+
+// ----------------------------------------------------------------------------
+// Get the URI of the row matching the given ID
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbHandler::GetUriMatchingIdL(
+    const TUint32 aId) const
+    {
+    MPX_FUNC("CMPXDbHandler::GetUriMatchingIdL");
+
+    HBufC* uri(NULL);
+    switch (MPX_ITEM_CATEGORY(aId))
+        {
+        case EMPXCollection:
+            {
+            // song URI
+            uri = iDbMusic->GetUriL(aId);
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            // playlist URI
+            uri = iDbPlaylist->GetUriL(aId);
+            break;
+            }
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return uri;
+    }
+
+// ----------------------------------------------------------------------------
+// Get category
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetCategoryL(
+    const TUint32 aCategoryId,
+    TMPXGeneralCategory aCategory,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia* aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::GetCategoryL");
+
+    switch (aCategory)
+        {
+        case EMPXPlaylist:
+            {
+            if (iAutoPlaylist->AutoPlaylistTypeL(aCategoryId) != EMPXNoAutoPlaylist)
+                {
+                iAutoPlaylist->GetPlaylistL(aCategoryId, aAttrs, *aMedia);
+                }
+            else
+                {
+                iDbPlaylist->GetPlaylistL(aCategoryId, aAttrs, *aMedia);
+                }
+            break;
+            }
+        default:
+            {
+            DbCategoryL(aCategory)->GetCategoryItemL(aCategoryId, aAttrs, *aMedia);
+            break;
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for all songs
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetAllSongsDurationL()
+    {
+    MPX_FUNC("CMPXDbHandler::GetAllSongsDurationL");
+    return iDbMusic->AllSongsDurationL();
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for an artist
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetArtistDurationL(
+    TInt aArtistId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetArtistDurationL");
+    return iDbMusic->ArtistDurationL(aArtistId);
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for an album
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetAlbumDurationL(
+    TInt aAlbumId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetAlbumDurationL");
+    return iDbMusic->AlbumDurationL(aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for an artist/album combination
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetArtistAlbumDurationL(
+    TInt aArtistId,
+    TInt aAlbumId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetArtistAlbumDurationL");
+    return iDbMusic->ArtistAlbumDurationL(aArtistId, aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for a composer
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetComposerDurationL(
+    TInt aComposerId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetComposerDurationL");
+    return iDbMusic->ComposerDurationL(aComposerId);
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for a genre
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetGenreDurationL(
+    TInt aGenreId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetGenreDurationL");
+    return iDbMusic->GenreDurationL(aGenreId);
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for a user playlist
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetUserPlaylistDurationL(
+    TInt aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetUserPlaylistDurationL");
+
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL(attributes);
+    attributes.AppendL(KMPXMediaGeneralId);
+    attributes.AppendL(TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralDuration));
+
+    CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
+    CleanupStack::PushL(mediaArray);
+
+    GetPlaylistSongsL(aPlaylistId, attributes.Array(), *mediaArray);
+
+    TInt duration(0);
+    TInt count(mediaArray->Count());
+    for (TInt index = 0; index < count; ++index)
+        {
+        CMPXMedia* media((*mediaArray)[index]);
+        if (media->IsSupported(KMPXMediaGeneralDuration))
+            {
+            duration += media->ValueTObjectL<TInt>(KMPXMediaGeneralDuration);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(mediaArray);
+    CleanupStack::PopAndDestroy(&attributes);
+
+    return duration;
+    }
+
+// ----------------------------------------------------------------------------
+//  Get the duration for a playlist
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::GetPlaylistDurationL(
+    TInt aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistDurationL");
+
+    TInt duration(0);
+
+    if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXRecentlyPlayedPlaylist))
+        {
+        duration = iDbMusic->RecentlyPlayedDurationL();
+        }
+    else if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXMostPlayedPlaylist))
+        {
+        duration = iDbMusic->MostPlayedDurationL();
+        }
+    else if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXRecentlyAddedPlaylist))
+        {
+        duration = iDbMusic->RecentlyAddedDurationL();
+        }
+    else
+        {
+        duration = GetUserPlaylistDurationL(aPlaylistId);
+        }
+
+    return duration;
+    }
+
+// ----------------------------------------------------------------------------
+// Find the number of items of a specified type
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbHandler::NumberOfItemsL(
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbHandler::NumberOfItemsL");
+
+    TInt count(0);
+    switch(aCategory)
+        {
+        case EMPXSong:
+            {
+            count = iDbMusic->CountL();
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            // return the total number of playlists, including the system ones
+            count = iDbPlaylist->CountL() + EMPXAutoPlaylistCount;
+            break;
+            }
+        default:
+            {
+            count = DbCategoryL(aCategory)->CountL();
+            break;
+            }
+        }
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::FindAllLC
+// ----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXDbHandler::FindAllLC(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbHandler::FindAllLC");
+
+    // leave if the given media doesn't contain the following attributes
+    if (!aCriteria.IsSupported(KMPXMediaGeneralType) ||
+        !aCriteria.IsSupported(KMPXMediaGeneralCategory))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    supportedIds.AppendL(KMPXMediaIdContainer);
+    MPXDbCommonUtil::FillInSupportedUIDsL(aAttrs, supportedIds);
+
+    CMPXMedia* entries = CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entries);
+
+    CMPXMediaArray* array = CMPXMediaArray::NewL();
+    CleanupStack::PushL(array);
+
+    FindAllL(aCriteria, aAttrs, array);
+
+    entries->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup);
+    entries->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory,
+        aCriteria.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory));
+    entries->SetCObjectValueL(KMPXMediaArrayContents, array);
+    entries->SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+
+    CleanupStack::PopAndDestroy(array);
+    return entries;
+    }
+
+// ----------------------------------------------------------------------------
+// Set the last refreshed time into the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::SetLastRefreshedTimeL(
+    TTime aTime)
+    {
+    MPX_FUNC("CMPXDbHandler::SetLastRefreshedTimeL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, iDbAuxiliary->SetLastRefreshedTimeL(aTime));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the last refreshed time from the collection
+// ----------------------------------------------------------------------------
+//
+TTime CMPXDbHandler::GetLastRefreshedTimeL()
+    {
+    MPX_FUNC("CMPXDbHandler::GetLastRefreshedTimeL");
+    return iDbAuxiliary->LastRefreshedTimeL();
+    }
+
+// ----------------------------------------------------------------------------
+// Set the db corrupted state for all drives
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::SetDBCorruptedL(
+    TBool aCorrupted)
+    {
+    MPX_FUNC("CMPXDbHandler::SetDBCorruptedL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, iDbAuxiliary->SetDBCorruptedL(aCorrupted));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Gets the db corrupted state for all drives
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::IsDBCorruptedL()
+    {
+    MPX_FUNC("CMPXDbHandler::IsDBCorruptedL");
+    return iDbAuxiliary->DBCorruptedL();
+    }
+
+// ----------------------------------------------------------------------------
+// Have the databases been created?
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::DatabaseCreated()
+    {
+    MPX_FUNC("CMPXDbHandler::DatabaseCreatedL");
+
+    TBool AuxilaryDbIsRefreshed(EFalse);
+    TRAP_IGNORE(AuxilaryDbIsRefreshed = iDbAuxiliary->IsRefreshedL());
+    // If none of the databases were available, ie out of disk we return EFalse
+    return iDbManager->IsInitialized() && AuxilaryDbIsRefreshed;
+    }
+
+// ----------------------------------------------------------------------------
+// Open a database
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::OpenDatabaseL(
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbHandler::OpenDatabaseL");
+    MPX_DEBUG2( "CMPXDbHandler::OpenDatabaseL: %i", aDrive);
+    iDbManager->OpenDatabaseL(aDrive);
+
+    // Verify the volume ID after a remount event
+    VerifyVolumeIdL();
+    }
+
+// ----------------------------------------------------------------------------
+// Close a database
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::CloseDatabaseL(
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbHandler::CloseDatabaseL");
+    MPX_DEBUG2( "CMPXDbHandler::CloseDatabaseL drive: %i", aDrive );
+    iDbManager->CloseDatabaseL(aDrive);
+    }
+
+// ----------------------------------------------------------------------------
+// Re-create all databases
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::ReCreateDatabasesL()
+    {
+    MPX_FUNC("CMPXDbHandler::ReCreateDatabasesL");
+    iDbManager->RecreateAllDatabasesL();
+    }
+
+// ----------------------------------------------------------------------------
+// Set handler refresh status
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RefreshStartL()
+    {
+    MPX_FUNC("CMPXDbHandler::RefreshStartL");
+
+    iOutOfDisk = EFalse;
+    // Re-open databases
+    // This is needed for the case where we were OOD before, but user
+    // has cleared some space but now try to refresh
+    MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives));
+    iCollectionOpen = ETrue;
+    // Update (synchronize) music basic table if it's not
+    // in sync with music table
+    if(iSynchronizeBasicTable)
+        {
+        iDbMusic->RefreshEndL();
+        }
+    iSynchronizeBasicTable = ETrue;
+
+    if(err == KErrDiskFull)
+        {
+            iOutOfDisk = ETrue;
+        }
+
+    if(!iOutOfDisk)
+    {
+        MPX_TRAP(err,CheckDiskSpaceOnDrivesL());
+
+        if(err == KErrDiskFull)
+            {
+            iOutOfDisk = ETrue;
+            }
+    }
+    
+    iDbMusic->RefreshStartL();
+
+    BeginTransactionL();
+    iRefresh = ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// Re-set handler refresh status
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::RefreshEndL()
+    {
+    MPX_FUNC("CMPXDbHandler::RefreshEndL");
+    iRefresh = EFalse;
+    EndTransactionL(KErrNone);
+    if (!iOutOfDisk)
+        {
+        // Write last refreshed time as current time
+        // This also sets corrupt = 0
+        TTime curTime;
+        curTime.HomeTime();
+        SetLastRefreshedTimeL(curTime);
+        }
+    iDbMusic->RefreshEndL();
+    //Update of music basic table fails when the collection is not open
+    //Next time the collection is opened the music basic table must be updated
+    if (iCollectionOpen )
+        {
+        iSynchronizeBasicTable = EFalse;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Notification of Mtp status change
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::MtpStartL()
+    {
+    iMtpInUse = ETrue;
+    iOpOnDbCount = 0;
+    iDbManager->BeginL();
+    }
+
+// ----------------------------------------------------------------------------
+// Notification of Mtp status change
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::MtpEndL()
+    {
+    iMtpInUse = EFalse;
+    iOpOnDbCount = 0;
+    iDbManager->CommitL();
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for music
+// ----------------------------------------------------------------------------
+//
+TUint CMPXDbHandler::GetMusicCountL(TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbHandler::GetMusicCountL");
+    TUint total(0);
+
+    //music
+    total += iDbMusic->GetDriveTrackCountL(aDrive);
+
+    return total;
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for playlists
+// ----------------------------------------------------------------------------
+//
+TUint CMPXDbHandler::GetPlaylistCountL(TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistCountL");
+    TUint total(0);
+
+    //playlist
+    total += iDbPlaylist->GetDrivePlaylistCountL(aDrive);
+
+    return total;
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for music and playlists
+// ----------------------------------------------------------------------------
+//
+TUint CMPXDbHandler::GetTotalCountL(TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbHandler::GetTotalCountL");
+    TUint total(0);
+
+    //music
+    total += iDbMusic->GetDriveTrackCountL(aDrive);
+    //playlist
+    total += iDbPlaylist->GetDrivePlaylistCountL(aDrive);
+
+    return total;
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for music and playlists
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                      CDesCArray& aUriArr, TInt& aLastID)
+    {
+    MPX_FUNC("CMPXDbHandler::GetMusicUriArrayL");
+
+    iDbMusic->GetMusicUriArrayL(aDrive,aFromID,aRecords,aUriArr,aLastID);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for music and playlists
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetPlaylistUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                         CDesCArray& aUriArr, TInt& aLastID)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistUriArrayL");
+
+    iDbPlaylist->GetPlaylistUriArrayL(aDrive,aFromID,aRecords,aUriArr,aLastID);
+    }
+
+// ----------------------------------------------------------------------------
+// Starts a transaction on all databases
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::BeginTransactionL()
+    {
+    MPX_FUNC("CMPXDbHandler::BeginTransactionL");
+
+    if(!iMtpInUse)
+        {
+        iDbManager->BeginL();
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Ends a transaction on all databases
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::EndTransactionL(
+    TInt aError)
+    {
+    MPX_FUNC("CMPXDbHandler::EndTransactionL");
+
+    if(iMtpInUse)
+        {
+        if (aError)
+            {
+            iOpOnDbCount = 0;
+            iDbManager->RollbackL();
+            User::Leave(aError);
+            }
+        
+        if(iOpOnDbCount >= KMaxOpInTransaction)
+            {
+            MPX_DEBUG2("CMPXDbHandler::EndTransactionL - %d>KMaxOpInTransaction Commiting",iOpOnDbCount);
+            iOpOnDbCount = 0;
+            iDbManager->CommitL();
+            iDbManager->BeginL();
+            }        
+        }
+    else
+        {
+        if (aError)
+            {
+            MPX_DEBUG2("CMPXDbHandler::EndTransactionL - Rollback [%d]", aError);
+
+            iDbManager->RollbackL();
+            
+            // KSqlDbCorrupted indicates DB corrupted, need to recreate.
+            if ( aError != KSqlDbCorrupted )
+                {
+                User::Leave(aError);
+                }
+            }
+        else
+            {
+            iDbManager->CommitL();
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Checks if the database is currently in a transaction
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::InTransaction()
+    {
+    MPX_FUNC("CMPXDbHandler::InTransaction");
+    return iDbManager->InTransaction();
+    }
+
+// ----------------------------------------------------------------------------
+// Notifies the handler that the collection will be closed.
+// It is called before closing the collection.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::PreCloseCollectionL()
+    {
+    MPX_FUNC("CMPXDbHandler::PreCloseCollectionL");
+    // Complete pending transaction and set the latest refresh time
+    // before closing the databases if collection close event occurs
+    // before the end of the refresh operation
+    if(iRefresh)
+        {
+        EndTransactionL(KErrNone);
+        if (!iOutOfDisk)
+            {
+            // Write last refreshed time as current time
+            // This also sets corrupt = 0
+            TTime curTime;
+            curTime.HomeTime();
+            SetLastRefreshedTimeL(curTime);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Notifies the handler that the collection was closed.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::CollectionClosed()
+    {
+    MPX_FUNC("CMPXDbHandler::CollectionClosed");
+
+    iCollectionOpen = EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+//Notifies the handler that the collection was opened.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::CollectionOpenedL()
+    {
+    MPX_FUNC("CMPXDbHandler::CollectionOpened");
+
+    iCollectionOpen = ETrue;
+    // Update (synchronize) music basic table if it's not
+    // in sync with music table
+    if(iSynchronizeBasicTable)
+        {
+        iDbMusic->RefreshEndL();
+        iSynchronizeBasicTable = EFalse;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Add song to collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::DoAddSongL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aMessageArray)
+    {
+    MPX_FUNC("CMPXDbHandler::DoAddSongL");
+
+    if (!aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    // add the song to the Music table
+    TDriveUnit drive(aMedia.ValueText(KMPXMediaGeneralUri));
+    TUint32 songId(iDbMusic->AddSongL(aMedia, drive,
+                                      iRefresh?NULL:aMessageArray));
+
+    // update the playlist tables
+    // make sure the song db flags are reset and not just updated
+    iDbPlaylist->UpdateSongL(aMedia, ETrue);
+    
+    if(iMtpInUse)
+        {
+        ++iOpOnDbCount;
+        }
+
+    return songId;
+    }
+
+// ----------------------------------------------------------------------------
+// Add playlist to collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::DoAddPlaylistL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::DoAddPlaylistL");
+
+    CMPXMedia* media = CMPXMedia::NewL(aMedia);
+    CleanupStack::PushL(media);
+
+    const TDesC& playlistUri = media->ValueText(KMPXMediaGeneralUri);
+
+    //
+    // client has asked to create a virtual playlist if file name is not specified
+    // in the URI. In this case, generate URI for virtual playlist specified as
+    // follows:
+    //          <dir path>\timestamp.vir
+    //
+    TParsePtrC parser(playlistUri);
+
+    if (!parser.NameOrExtPresent() ||
+        parser.IsNameWild() ||
+        parser.IsExtWild())
+        {
+        HBufC* newUri = HBufC::NewLC(parser.DriveAndPath().Length() + KMCMaxTextLen +
+            KMPXVirtualPlaylistExt().Length());
+
+        TPtr ptr = newUri->Des();
+        ptr.Append(parser.DriveAndPath());
+        TTime time;
+        time.HomeTime();
+        ptr.AppendNum(time.Int64());
+        ptr.Append(KMPXVirtualPlaylistExt);
+
+        // overwrite the old uri with the new one with full path and playlist
+        // playlist filename
+        media->SetTextValueL(KMPXMediaGeneralUri, *newUri);
+
+        CleanupStack::PopAndDestroy(newUri);
+
+        // set DbFlags to indicate that this is a virtual playlist
+        media->SetTObjectValueL<TUint>(KMPXMediaGeneralFlags,
+            KMPXMediaGeneralFlagsSetOrUnsetBit | KMPXMediaGeneralFlagsIsVirtual);
+        }
+
+    // complete the song attributes from the music table
+    UpdatePlaylistSongInfoL(*media);
+
+    // add playlist to the database
+    TUint32 playlistId = iDbPlaylist->AddPlaylistL(*media);
+
+    CleanupStack::PopAndDestroy(media);
+    return playlistId;
+    }
+
+// ----------------------------------------------------------------------------
+// Add song to playlist
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::DoAddSongToPlaylistL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::DoAddSongToPlaylistL");
+
+    CMPXMedia* media = CMPXMedia::NewL(aMedia);
+    CleanupStack::PushL(media);
+
+    // complete the song attributes from the music table
+    UpdatePlaylistSongInfoL(*media);
+
+    // add the songs to the playlist
+    TUint32 playlistId((media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2);
+
+    CMPXMediaArray* ary( aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents) );
+    User::LeaveIfNull( ary );
+    iDbPlaylist->AddSongsL(playlistId,*ary);
+
+    CleanupStack::PopAndDestroy(media);
+    return playlistId;
+    }
+
+// ----------------------------------------------------------------------------
+// Update a song in the collection
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbHandler::DoUpdateSongL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::DoUpdateSongL");
+
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+
+    TUint32 songId(0);
+
+    if (aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        songId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        }
+    if (aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        const TDesC& uri = aMedia.ValueText(KMPXMediaGeneralUri);
+        songId = MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXCollection, uri, EFalse);
+        }
+    if (!songId)
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    // Update the Music table
+    TRAPD(err, visibleChange = iDbMusic->UpdateSongL(songId, aMedia, aItemChangedMessages));
+
+    // do not leave if song is not found in Music table
+    // leave for other errors such as disk full
+    if(err != KErrNone && err != KErrNotFound)
+        {
+        User::Leave(err);
+        }
+
+    // Update the Playlist table
+    TBool visible = EFalse;
+
+    TRAP( err, visible = iDbPlaylist->UpdateSongL(aMedia, EFalse, &aItemChangedMessages));
+
+    // do not leave if song is not found in Playlist table
+    // leave for other errors such as disk full
+    if(err != KErrNone && err != KErrNotFound)
+        {
+        User::Leave(err);
+        }
+
+    // make it visible if either table is updated
+    if (visible)
+        {
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        }
+
+    return visibleChange;
+    }
+
+// ----------------------------------------------------------------------------
+// Update a playlist in the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoUpdatePlaylistL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aMessageArray)
+    {
+    MPX_FUNC("CMPXDbHandler::DoUpdatePlaylistL");
+
+    TUint32 playlistId(0);
+    TInt drive(0);
+
+    CMPXMedia* media = CMPXMedia::NewL(aMedia);
+    CleanupStack::PushL(media);
+
+
+    ProcessPlaylistMediaL(*media, playlistId, drive);
+
+    CMPXMessage* m1 = CMPXMessage::NewL();
+    CleanupStack::PushL(m1);
+    CMPXMessage* m2 = CMPXMessage::NewL();
+    CleanupStack::PushL(m2);
+
+    // send 2 messages to notify the playlist change & to refresh the display (update playlist name)
+    MPXDbCommonUtil::FillItemChangedMessageL(*m1, playlistId, EMPXItemModified,
+            EMPXPlaylist, KDBPluginUid);
+
+    MPXDbCommonUtil::FillItemChangedMessageL(*m2, EBrowsePlaylist, EMPXItemModified,
+                EMPXPlaylist, KDBPluginUid);
+
+    iDbPlaylist->UpdatePlaylistL(*media, *m1, drive);
+
+    aMessageArray.AppendL(*m1);
+    aMessageArray.AppendL(*m2);
+
+
+    CleanupStack::PopAndDestroy(m2);
+    CleanupStack::PopAndDestroy(m1);
+    CleanupStack::PopAndDestroy(media);
+    }
+
+// ----------------------------------------------------------------------------
+// Update a playlist in the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoUpdatePlaylistSongsL(
+    const CMPXMedia& aMedia,
+    CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbHandler::DoUpdatePlaylistSongsL");
+
+    CMPXMedia* media = CMPXMedia::NewL(aMedia);
+    CleanupStack::PushL(media);
+
+    TUint32 playlistId(0);
+    TInt drive(0);
+
+    // get the playlist ID and drive ID
+    ProcessPlaylistMediaL(*media, playlistId, drive);
+    MPXDbCommonUtil::FillItemChangedMessageL(aMessage, playlistId, EMPXItemModified,
+        EMPXPlaylist, KDBPluginUid);
+
+    // complete the song attributes from the Music table
+    UpdatePlaylistSongInfoL(*media);
+
+    // delete existing songs for the playlist first
+    iDbPlaylist->Songs().DeleteSongsL(playlistId, drive);
+
+    // add new songs to the playlist
+    CMPXMediaArray* ary( media->Value<CMPXMediaArray>(KMPXMediaArrayContents ) );
+    User::LeaveIfNull( ary );
+    iDbPlaylist->AddSongsL(playlistId, *ary);
+
+    CleanupStack::PopAndDestroy(media);
+    }
+
+// ----------------------------------------------------------------------------
+// Reorder a song in a playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoReorderPlaylistL(
+    const TMPXItemId& aPlaylistId,
+    const TMPXItemId& aSongId,
+    TUint aOriginalOrdinal,
+    TUint aNewOrdinal,
+    CMPXMessage& aMessage)
+    {
+    MPX_DEBUG1("-->CMPXDbHandler::DoReorderPlaylistL()");
+
+    if (aOriginalOrdinal != aNewOrdinal)
+        {
+        iDbPlaylist->Songs().ReorderSongL(aPlaylistId, aSongId, aOriginalOrdinal, aNewOrdinal);
+
+        MPXDbCommonUtil::FillItemChangedMessageL(aMessage, aPlaylistId.iId2, EMPXItemModified,
+            EMPXPlaylist, KDBPluginUid);
+        }
+
+    MPX_DEBUG1("<--CMPXDbHandler::DoReorderPlaylistL()");
+    }
+
+// ----------------------------------------------------------------------------
+// Delete a song from collection
+// The function notifies collection model to perform deletion
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveSongL(
+    TUint32 aSongId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages,
+    TBool aDeleteRecord)
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemoveSongL");
+
+    // Get the song drive
+    TUint32 artistID(0);
+    TUint32 albumID(0);
+    TUint32 genreID(0);
+    TUint32 composerID(0);
+    TInt drive(0);
+
+    // Get information from the Music table first
+    HBufC* uri = iDbMusic->GetSongInfoL(aSongId, artistID, albumID, genreID, composerID, drive);
+
+    // add the URI to the return array
+    CleanupStack::PushL(uri);
+    aUriArray.AppendL(*uri);
+    CleanupStack::PopAndDestroy(uri);
+
+    // Update the category records
+    TBool categoryExist( EFalse );
+    iDbArtist->DecrementSongsForCategoryL(artistID, drive, &aItemChangedMessages, categoryExist);
+    iDbAlbum->DecrementSongsForCategoryL(albumID, drive, &aItemChangedMessages, categoryExist, artistID);
+    iDbGenre->DecrementSongsForCategoryL(genreID, drive, &aItemChangedMessages, categoryExist);
+    iDbComposer->DecrementSongsForCategoryL(composerID, drive, &aItemChangedMessages, categoryExist);
+
+    // Update the music table
+    TBool deleteRecord(ETrue);
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+    // Mark the song record as deleted if the following is true; otherwise, delete the
+    // song record.
+    //
+    // A client other than MTP has initiated this song deletion (aDeleteRecord is EFalse)
+    // and MTP has turned on its cenrep key to save deleted records and current number of
+    // saved deleted records has not exceeded its maximum, KMCMaxSavedDeletedRecords.
+    //
+    // Songs are marked as deleted in order to support auto-sync. MTP will delete these
+    // marked records at the end of each session via CleanupDeletedRecordsL.
+    //
+    // For performance consideration, if the number of saved records exceeds its maximum,
+    // song record will be deleted.
+    if (!aDeleteRecord && SaveDeletedSongs())
+        {
+        TUint32 savedDeletedRecordCount(iDbAuxiliary->SaveDeletedRecordCountL());
+        MPX_DEBUG2("Current number of saved deleted record count is %d", savedDeletedRecordCount);
+
+        if (savedDeletedRecordCount < KMCMaxSavedDeletedRecords)
+            {
+            deleteRecord = EFalse;
+            TUint32 savedDeletedDriveRecordCount(iDbAuxiliary->SaveDeletedRecordCountL(drive));
+            iDbAuxiliary->SetSaveDeletedRecordCountL(drive,++savedDeletedDriveRecordCount);
+            }
+        }
+#endif
+
+    // delete the song from the Music table
+    iDbMusic->DeleteSongL(aSongId, drive, deleteRecord);
+
+    // add the item changed message
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aSongId, EMPXItemDeleted,
+        EMPXSong, KDBPluginUid);
+        
+
+    if(iMtpInUse)
+        {
+        ++iOpOnDbCount;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Delete a song from playlist tables
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveSongFromPlaylistL(TUint32 aSongId,CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemoveSongFromPlaylistL");
+    // delete song from the playlist tables on all drives
+    iDbPlaylist->DeleteSongL(aSongId, aItemChangedMessages);
+    }
+
+// ----------------------------------------------------------------------------
+// Removes a category of songs from the music collection,
+// and its corresponding category in the lookup table
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveSongsMatchingCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemoveSongsMatchingCategoryL");
+
+    // get the songs for the specified category
+    CMPXMediaArray* songs = CMPXMediaArray::NewL();
+    CleanupStack::PushL(songs);
+
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL(attributes);
+    attributes.AppendL(KMPXMediaGeneralId);
+
+    switch (aCategory)
+        {
+        case EMPXArtist:
+            {
+            iDbMusic->GetSongsForArtistL(aCategoryId, attributes.Array(), *songs);
+            break;
+            }
+        case EMPXAlbum:
+            {
+            iDbMusic->GetSongsForAlbumL(aCategoryId, attributes.Array(), *songs);
+            break;
+            }
+        case EMPXGenre:
+            {
+            iDbMusic->GetSongsForGenreL(aCategoryId, attributes.Array(), *songs);
+            break;
+            }
+        case EMPXComposer:
+            {
+            iDbMusic->GetSongsForComposerL(aCategoryId, attributes.Array(), *songs);
+            break;
+            }
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    CleanupStack::PopAndDestroy(&attributes);
+
+    // iterate the songs and remove them one by one
+    // so records in the category tables can also be updated
+    TInt count(songs->Count());
+    for (TInt index = 0; index < count; ++index)
+        {
+        CMPXMedia* song = (*songs)[index];
+        if (song->IsSupported(KMPXMediaGeneralId))
+            {
+            DoRemoveSongL((song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2,
+                aUriArray, aItemChangedMessages, EFalse);
+            DoRemoveSongFromPlaylistL((song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2,aItemChangedMessages);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(songs);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Delete songs for the specified artist and album from collection
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveSongsMatchingArtistAndAlbumL(
+    TUint32 aArtistId,
+    TUint32 aAlbumId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::RemoveSongsMatchingArtistAndAlbumL");
+
+    // get the songs for the specified artist and album
+    CMPXMediaArray* songs = CMPXMediaArray::NewL();
+    CleanupStack::PushL(songs);
+
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL (attributes);
+    attributes.AppendL(KMPXMediaGeneralId);
+
+    iDbMusic->GetSongsForArtistAndAlbumL(aArtistId, aAlbumId, attributes.Array(), *songs);
+    CleanupStack::PopAndDestroy(&attributes);
+
+    // iterate the songs and remove them one by one
+    // so records in the category tables can also be updated
+    TInt count(songs->Count());
+    for (TInt index = 0; index < count; ++index)
+        {
+        CMPXMedia* song = (*songs)[index];
+        if (song->IsSupported(KMPXMediaGeneralId))
+            {
+            DoRemoveSongL( song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId),
+                aUriArray, aItemChangedMessages, EFalse);
+            DoRemoveSongFromPlaylistL(song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId),aItemChangedMessages);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(songs);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all playlists from collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveAllPlaylistsL()
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemoveAllPlaylistsL");
+    iDbPlaylist->DeleteAllPlaylistsL();
+    }
+
+// ----------------------------------------------------------------------------
+// Remove specified playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemovePlaylistL(
+    TUint32 aPlaylistId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemovePlaylistL");
+
+    HBufC* uri(iDbPlaylist->DeletePlaylistL(aPlaylistId));
+    if (uri)
+        {
+        CleanupStack::PushL(uri);
+        aUriArray.AppendL(*uri);
+        CleanupStack::PopAndDestroy(uri);
+        }
+
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aPlaylistId, EMPXItemDeleted,
+        EMPXPlaylist, KDBPluginUid);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove song from playlist songs table
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoRemoveSongFromPlaylistL(
+    TUint32 aPlaylistId,
+    const TMPXItemId& aSongId,
+    TInt aOrdinal,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::DoRemoveSongFromPlaylistL");
+    MPX_DEBUG5("CMPXDbHandler::DoRemoveSongFromPlaylistL(playlist 0x%x, songId [0x%x,0x%x], ordinal %d)",
+        aPlaylistId, aSongId.iId1, aSongId.iId2, aOrdinal);
+
+    // delete the song
+    iDbPlaylist->DeleteSongL(aPlaylistId, aSongId.iId2, aOrdinal);
+
+    // Send a playlist modified message
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aPlaylistId, EMPXItemModified,
+        EMPXPlaylist, KDBPluginUid);
+
+    // Send a message on the song in the playlist that is deleted
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, aSongId, EMPXItemDeleted,
+        EMPXSong, KDBPluginUid);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::DoCleanupDeletedRecordsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DoCleanupDeletedRecordsL()
+    {
+    MPX_FUNC("CMPXDbHandler::DoCleanupDeletedRecordsL");
+
+    // delete all marked records from the Music table
+    iDbMusic->CleanupL();
+
+    // reset the count in the Auxiliary table
+    iDbAuxiliary->SetSaveDeletedRecordCountL(KDbManagerAllDrives,0);
+    }
+
+// ----------------------------------------------------------------------------
+// FindAllL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::FindAllL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray* aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::FindAllL");
+
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL(attributes);
+    MPXUser::MergeAttributeL(aAttrs, attributes);
+
+    TMPXGeneralCategory category = aCriteria.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory);
+    switch (category)
+        {
+        case EMPXPlaylist:
+            {
+            TUint32 playlistId(0);
+            if (aCriteria.IsSupported(KMPXMediaGeneralId))
+                {
+                playlistId = (aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+                }
+
+            if (iAutoPlaylist->AutoPlaylistTypeL(playlistId) != EMPXNoAutoPlaylist)
+                {
+                CMPXMedia* media = CMPXMedia::NewL();
+                CleanupStack::PushL(media);
+
+                iAutoPlaylist->GetPlaylistL(playlistId, aAttrs, *media);
+
+                aMediaArray->AppendL(*media);
+                CleanupStack::PopAndDestroy(media);
+                }
+            else
+                {
+                iDbPlaylist->FindAllL(aCriteria, attributes.Array(), *aMediaArray);
+                }
+
+            break;
+            }
+        case EMPXSong:
+            {
+            FindSongL(aCriteria, attributes.Array(), *aMediaArray);
+            break;
+            }
+        default:
+            {
+            DbCategoryL(category)->FindAllL(aCriteria, attributes.Array(), *aMediaArray);
+            break;
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&attributes);
+    }
+
+// ----------------------------------------------------------------------------
+// Get song(s) from the music table that match the given criteria
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::FindSongL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCollection::FindSongL");
+
+    TMPXGeneralType type = aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+
+    TUint32 id(0);
+    if (aCriteria.IsSupported(KMPXMediaGeneralId))
+        {
+        id = (aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        }
+
+    TUint32 containerId(0);
+    if (aCriteria.IsSupported(KMPXMediaGeneralContainerId))
+        {
+        containerId = aCriteria.ValueTObjectL<TUint32>(KMPXMediaGeneralContainerId);
+        }
+
+    //////////////////////////////////////////////////////////////////////
+    // Find songs in the specified playlist
+    //////////////////////////////////////////////////////////////////////
+    TMPXGeneralCategory cat(MPX_ITEM_CATEGORY(id));
+
+    if (type == EMPXGroup &&
+        (cat == EMPXPlaylist ||
+        MPX_ITEM_CATEGORY(containerId) == EMPXPlaylist))
+        {
+        TUint32 playlistId = (cat == EMPXPlaylist) ?
+            id : (containerId & KMCCategoryMask);
+
+        GetPlaylistSongsL(playlistId, aAttrs, aMediaArray);
+        }
+
+    //////////////////////////////////////////////////////////////////////
+    // Find a particular song in the specified playlist. This fills the
+    // song with info from Playlist table first then overwrites it with
+    // info from Songs table if Songs table where this song is located
+    // is present in order to support the display of song titles in a
+    // playlist when memory card is removed if the playlist refers to
+    // songs on the memory card. Caller of this scenario is OpenL/MediaL.
+    // When user attempts to play a track in an auto-playlist, we will
+    // find the song from Songs table directly since auto-playlists are
+    // not stored in the Playlist table. Auto-playlists are query-based,
+    // therefore, when memory card is removed, songs on the memory card
+    // will not be shown in the auto-playlist; hence they do not exhibit
+    // the same challenge as user created playlists.
+    //////////////////////////////////////////////////////////////////////
+    else if (type == EMPXItem &&
+        cat == EMPXCollection &&
+        MPX_ITEM_CATEGORY(containerId) == EMPXPlaylist)
+        {
+        if (iAutoPlaylist->AutoPlaylistTypeL(containerId) != EMPXNoAutoPlaylist)
+            {
+            // auto playlist song, get the song details from the music table
+            iDbMusic->FindSongsL(id, 0, type, aCriteria, aAttrs, aMediaArray);
+            }
+        else
+            {
+            GetPlaylistSongL(id, containerId, aAttrs, aMediaArray);
+            }
+        }
+
+    //////////////////////////////////////////////////////////////////////
+    // Find all songs, all songs in a particular album and/or artist, or
+    // a particular song
+    //////////////////////////////////////////////////////////////////////
+    else
+        {
+        iDbMusic->FindSongsL(id, containerId, type, aCriteria, aAttrs, aMediaArray);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Get song(s) in the specified playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::GetPlaylistSongsL(
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::GetPlaylistSongsL");
+    MPX_DEBUG2("CMPXDbHandler::GetPlaylistSongsL(0x%x)", aPlaylistId);
+
+    // check the auto playlists first
+    if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXRecentlyPlayedPlaylist))
+        {
+        iDbMusic->GetRecentlyPlayedSongsL(aAttrs, aMediaArray);
+        }
+    else if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXMostPlayedPlaylist))
+        {
+        iDbMusic->GetMostPlayedSongsL(aAttrs, aMediaArray);
+        }
+    else if (aPlaylistId == iAutoPlaylist->AutoPlaylistIdL(EMPXRecentlyAddedPlaylist))
+        {
+        iDbMusic->GetRecentlyAddedSongsL(aAttrs, aMediaArray);
+        }
+    else
+        {
+        TInt attrCount(aAttrs.Count());
+        if ( attrCount > 1 || (attrCount == 1 && !(aAttrs[0] == KMPXMediaGeneralId)) )
+            {
+	        TInt plDrive(iDbPlaylist->GetDriveIdL(aPlaylistId));
+	        MPX_TRAPD(err, iDbMusic->GetAllSongsL(plDrive, aPlaylistId, aAttrs, aMediaArray));
+
+	        // song not found in Music table
+	        if (err == KErrNotFound)
+	            {
+	            //
+	            // Leave with KErrNotFound if one of the following is true:
+	            // 1) the requested song is in an auto playlist. Since auto-playlist isn't
+	            //    stored in playlist tables, we won't be able to retrieve info elsewhere
+	            // 2) the requested song is in a user playlist but we cannot find the song
+	            //    info from playlist tables either
+	            //
+	           if (EMPXNoAutoPlaylist != iAutoPlaylist->AutoPlaylistTypeL(aPlaylistId) ||
+	                !iDbPlaylist->Songs().GetSongsL(aPlaylistId, aAttrs, aMediaArray))
+	               {
+	               User::Leave(KErrNotFound);
+	               }
+	            }
+	        else
+	            {
+	            // ignore the error if KErrNotFound
+	            User::LeaveIfError(err);
+	            }
+            }
+        else
+            {
+            // get ids of the songs in the playlist
+            iDbPlaylist->Songs().GetSongsL(aPlaylistId, aMediaArray);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Find all albums or the albums for a specified artist
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::FindAlbumL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbHandler::FindAlbumL");
+
+    TMPXGeneralType type = aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+
+    TUint32 id(0);
+    if (aCriteria.IsSupported(KMPXMediaGeneralId))
+        {
+        id = aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+        }
+
+    if ((type == EMPXGroup) && (MPX_ITEM_CATEGORY(id) == EMPXArtist))
+        {
+        // get all the albums for the artist
+        GetAlbumsMatchingArtistL(id, aAttrs, aMediaArray);
+        }
+    else
+        {
+        // look up all albums from album table
+        iDbAlbum->FindAllL(aCriteria, aAttrs, aMediaArray);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Extracts the playlist ID and drive ID from a playlist media instance
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::ProcessPlaylistMediaL(
+    CMPXMedia& aMedia,
+    TUint32& aPlaylistId,
+    TInt& aPlaylistDriveId)
+    {
+    MPX_FUNC("CMPXDbHandler::ProcessPlaylistMediaL");
+
+    if (aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        aPlaylistId = aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            // find drive id of the playlist
+            aPlaylistDriveId = TDriveUnit(aMedia.ValueText(KMPXMediaGeneralUri));
+            }
+        else
+            {
+            // Find drive Id(s) of corresponding Playlist Id
+            aPlaylistDriveId = iDbPlaylist->GetDriveIdL(aPlaylistId);
+            }
+        }
+    else if (aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        const TDesC& playlistUri = aMedia.ValueText(KMPXMediaGeneralUri);
+        // find drive id of the playlist
+        aPlaylistDriveId = TDriveUnit(playlistUri);
+
+        // aMedia does not have an ID, make sure the add it
+        aPlaylistId = GetPlaylistIdMatchingUriL(playlistUri);
+        aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aPlaylistId);
+        }
+    else
+        {
+        User::Leave(KErrArgument);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Makes sure that all songs in the specified playlist have the ID, title and URI attributes
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::UpdatePlaylistSongInfoL(
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbHandler::UpdatePlaylistSongInfoL");
+
+    CMPXMediaArray* mediaArray = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+    User::LeaveIfNull(mediaArray);
+
+    // make sure each song has Id, Uri, and Title before they can be added to playlist
+    TInt count(mediaArray->Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        CMPXMedia* element = mediaArray->AtL(i);
+
+        // copy each song to deal w/ global heap issues
+        CMPXMedia* entry = CMPXMedia::NewL(*element);
+        CleanupStack::PushL(entry);
+
+        // song has everything, go to next song
+        if (entry->IsSupported(KMPXMediaGeneralUri) &&
+            entry->IsSupported(KMPXMediaGeneralId) &&
+            entry->IsSupported(KMPXMediaGeneralTitle))
+            {
+            // pop entry to maintain CleanupStack
+            CleanupStack::PopAndDestroy(entry);
+            continue;
+            }
+
+        // songs must contain (at minimum) an Uri or an Id
+        if (!entry->IsSupported(KMPXMediaGeneralUri) &&
+            !entry->IsSupported(KMPXMediaGeneralId))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        // get Id
+        if (!entry->IsSupported(KMPXMediaGeneralId))
+            {
+            // fill in the ID if not present
+            TParsePtrC parser(entry->ValueText(KMPXMediaGeneralUri));
+            entry->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+                MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXCollection, parser.FullName(), EFalse));
+            }
+
+        CMPXMedia* song(NULL);
+
+        // update songs info
+        TInt error(iDbMusic->GetSongL(*entry, song));
+        TBool result (ETrue);
+
+        // error can only be KErrNone or KErrNotFound
+        // from CMPXDbMusic::GetSongL
+        // if not found in Music, get info from PlaylistSongs (PlaylistSongs & PlaylistSongInfo) DB
+        if (error == KErrNotFound)
+            {
+            RArray<TMPXAttribute> attributes;
+            CleanupClosePushL(attributes);
+            attributes.AppendL(TMPXAttribute(KMPXMediaIdGeneral,
+                EMPXMediaGeneralId | EMPXMediaGeneralTitle | EMPXMediaGeneralUri | EMPXMediaGeneralFlags));
+
+            // this song doesn't exist in Music table. This song is either a broken link or
+            // is of an unsupported song type that exists in the file system. Broken links
+            // have already been marked as such during playlist import.
+            result = iDbPlaylist->Songs().GetSongL(entry->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId), attributes.Array(), song);
+            if (!result)
+                {
+                // song is a broken link
+                //TUint flags = KMPXMediaGeneralFlagsSetOrUnsetBit;
+                //flags |= KMPXMediaGeneralFlagsIsInvalid; // set flag
+                //t->SetTObjectValueL<TUint>( KMPXMediaGeneralFlags, flags );
+
+                if (entry->IsSupported(KMPXMediaGeneralUri))
+                    {
+                    // no valid Id but has Uri, just verify Title is present
+                    // this is the case if the song is a broken link or podcast
+                    if (!entry->IsSupported(KMPXMediaGeneralTitle))
+                        {
+                        // does not have Title, make up the Title from file name
+                        TParsePtrC parser(entry->ValueText(KMPXMediaGeneralUri));
+                        entry->SetTextValueL(KMPXMediaGeneralTitle, parser.Name());
+                        }
+                    }
+                else
+                    {
+                    // no valid Id & no Uri, bad argument
+                    User::Leave(KErrArgument);
+                    }
+                }
+            CleanupStack::PopAndDestroy(&attributes);
+            }
+
+        // update attributes
+        CleanupStack::PushL(song);
+
+        // song not found in Music or Playlist DB, update entry
+        if(error == KErrNotFound && !result)
+            {
+            mediaArray->InsertL(*entry,i);
+            }
+        else  // found in DB, replace entry
+            {
+            mediaArray->InsertL(*song,i);
+            }
+
+        // replace element in the array
+        CleanupStack::PopAndDestroy(song);
+        CleanupStack::PopAndDestroy(entry);
+        mediaArray->Remove(i+1);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::ProcessMusicFoldersL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::ProcessMusicFoldersL(
+    const CDesCArray& aFolders)
+    {
+    MPX_FUNC("CMPXDbHandler::ProcessMusicFoldersL");
+
+    TInt count(aFolders.MdcaCount());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TPtrC16 folder = aFolders.MdcaPoint(i);
+
+        // check if disk is inserted and act accordingly
+        TDriveUnit driveUnit(folder);
+        if (!iFs.IsValidDrive(driveUnit))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        // append the drive to the drive list
+        iDbDrives.AppendL(driveUnit);
+
+        // make sure the folder is created
+        TVolumeInfo info;
+        if (iFs.Volume(info, driveUnit) == KErrNone)
+           {
+            if (!BaflUtils::PathExists(iFs, folder))
+                {
+                // create music folder if necessary
+                TInt err(iFs.MkDirAll(folder));
+                MPX_DEBUG3("Try to create music folder %S return code %d", &folder, err);
+                if (err != KErrAlreadyExists)
+                    {
+                    User::LeaveIfError(err);
+                    }
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::DbCategoryL
+// ----------------------------------------------------------------------------
+//
+CMPXDbCategory* CMPXDbHandler::DbCategoryL(
+    TMPXGeneralCategory aCategory) const
+    {
+    MPX_FUNC("CMPXDbHandler::DbCategoryL");
+
+    CMPXDbCategory* dbCategory(NULL);
+    switch (aCategory)
+        {
+        case EMPXArtist:
+            {
+            dbCategory = (CMPXDbCategory*)iDbArtist;
+            break;
+            }
+        case EMPXAlbum:
+            {
+            dbCategory = (CMPXDbCategory*)iDbAlbum;
+            break;
+            }
+        case EMPXGenre:
+            {
+            dbCategory = (CMPXDbCategory*)iDbGenre;
+            break;
+            }
+        case EMPXComposer:
+            {
+            dbCategory = (CMPXDbCategory*)iDbComposer;
+            break;
+            }
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return dbCategory;
+    }
+
+// ----------------------------------------------------------------------------
+// Verifies that the volume ID of the database matches the drive
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::VerifyVolumeIdL()
+    {
+    MPX_DEBUG1("CMPXDbHandler::VerifyVolumeIdL <--");
+
+    TInt count( iDbDrives.Count() );
+    for( TInt i=0; i<count; ++i )
+        {
+        if( iDbManager->IsOpen( iDbDrives[i] ) )
+            {
+            TVolumeInfo volInfo;
+            iFs.Volume(volInfo, iDbDrives[i] );
+            TUint curId(volInfo.iUniqueID);
+
+            TInt volId = iDbAuxiliary->IdL( iDbDrives[i] );
+
+            // New database, no volume id set, mask out top bit because this is an uint
+            //
+            MPX_DEBUG3("CMPXDBHandler::VerifyVolumeIdL drive:%i db:%i", curId, volId);
+            if( volId == 0 )
+                {
+                MPX_DEBUG1("CMPXDbHandler::VerifyVolumeIdL -- New ID");
+                BeginTransactionL();
+                TRAPD( err, iDbAuxiliary->SetIdL( iDbDrives[i], curId&0x7FFFFFFF ) );
+                EndTransactionL( err );
+                
+                // KSqlDbCorrupted indicates DB corrupted, need to recreate.
+                if ( err == KSqlDbCorrupted )
+                    {
+                    MPX_DEBUG1("CMPXPodcastDbHandler::VerifyVolumeIdL -- Corrupted DB");     
+                    iDbManager->RecreateDatabaseL(iDbDrives[i]);
+                    BeginTransactionL();
+                    TRAPD(err, iDbAuxiliary->SetDBCorruptedL( ETrue ) );
+                    EndTransactionL( err );
+                    }
+                }
+            // Unmatched volume id, mark db as corrupt and break
+            //
+            else if ( (curId&0x7FFFFFFF) != (volId&0x7FFFFFFFF) )
+                {
+                MPX_DEBUG1("CMPXDbHandler::VerifyVolumeIdL -- ID match FAILED");
+                iDbManager->RecreateDatabaseL(iDbDrives[i]);
+                BeginTransactionL();
+                TRAPD(err, iDbAuxiliary->SetDBCorruptedL( ETrue ) );
+                EndTransactionL( err );
+                }
+            }
+        }
+    MPX_DEBUG1("CMPXDbHandler::VerifyVolumeIdL -->");
+    }
+
+
+// ----------------------------------------------------------------------------
+// Checks if there is a drive that has a low disk space
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::CheckDiskSpaceOnDrivesL()
+    {
+    MPX_DEBUG1("CMPXDbHandler::CheckDiskSpaceOnDrivesL <--");
+
+    TInt count( iDbDrives.Count() );
+    for( TInt index=0; index<count; ++index )
+        {
+        iDbManager->CheckDiskSpaceL(iDbDrives[index]);
+        }
+    MPX_DEBUG1("CMPXDbHandler::CheckDiskSpaceOnDrivesL -->");
+    }
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::SaveDeletedSongs
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::SaveDeletedSongs()
+    {
+    MPX_FUNC("CMPXDbHandler::SaveDeletedSongs");
+
+    TBool saveDeletedSongs(ETrue);
+    CRepository* cenrep(NULL);
+    MPX_TRAPD(error, cenrep = CRepository::NewL(KMPXMtpSettings));
+    if (!error)
+        {
+        cenrep->Get(KMPXMtpSaveDeletedRecordFlag, saveDeletedSongs);
+        delete cenrep;
+        MPX_DEBUG2("MTP indicated to save deleted songs? %d", saveDeletedSongs);
+        }
+
+    return saveDeletedSongs;
+    }
+
+#endif
+
+#ifdef RD_MULTIPLE_DRIVE
+
+// ----------------------------------------------------------------------------------------------------------
+// Retrieve all visible music folder locations
+// ----------------------------------------------------------------------------------------------------------
+//
+CDesCArrayFlat* CMPXDbHandler::GetMusicFoldersL()
+    {
+    MPX_FUNC("CMPXDbHandler::GetMusicFoldersL()");
+    TDriveList driveList;
+    TInt driveCount(0);
+    User::LeaveIfError(DriveInfo::GetUserVisibleDrives(iFs, driveList, driveCount));
+    MPX_DEBUG2 ("CMPXDbHandler::GetMusicFoldersL() - driveCount = %d", driveCount);
+
+    CDesCArrayFlat* folders = new (ELeave) CDesCArrayFlat(1); // granularity
+    CleanupStack::PushL(folders);
+
+    for (TInt i = EDriveA; i <= EDriveZ; i++)
+        {
+        if ((driveList[i]) && (!IsRemoteDrive(static_cast<TDriveNumber>(i))))
+            {
+            if (i == EDriveC)
+                {
+                // Append the default phone memory path to the list
+                // of music folders
+                TPtrC rootPath(PathInfo::PhoneMemoryRootPath());
+                folders->AppendL(rootPath);
+                MPX_DEBUG2("CMPXDbHandler::GetMusicFoldersL() - adding...%S", &rootPath);
+                }
+            else
+                {
+                // Get drive letter
+                TChar driveChar;
+                User::LeaveIfError(iFs.DriveToChar(i, driveChar));
+
+                // Append visible drive to list of music folders
+                TBuf<2> drive;
+                drive.Append(driveChar);
+                drive.Append(_L(":"));
+                folders->AppendL(drive);
+                MPX_DEBUG2 ("CMPXDbHandler::GetMusicFoldersL() - adding...%S", &drive);
+                }
+            }
+        }
+
+    CleanupStack::Pop(folders);
+    return folders;
+    }
+
+#endif // RD_MULTIPLE_DRIVE
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::AddCategoryItemL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbHandler::AddCategoryItemL(
+    TMPXGeneralCategory aCategory,
+    const TDesC& aName,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TBool& aItemExist)
+    {
+    MPX_FUNC("CMPXDbHandler::AddCategoryItemL()");
+
+    MPX_PERF_START(CMPXDbHandler_AddCategoryItemL);
+
+    TBool newRecord(EFalse);
+    TUint32 id(DbCategoryL(aCategory)->AddItemL(aName, aDriveId, newRecord, (aCategory != EMPXGenre)));
+    if (newRecord && aItemChangedMessages)
+        {
+        MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemInserted,
+            aCategory, KDBPluginUid);
+        }
+    aItemExist = !newRecord;
+    MPX_PERF_END(CMPXDbHandler_AddCategoryItemL);
+
+    return id;
+    }
+
+TUint32 CMPXDbHandler::AddCategoryItemL(
+        TMPXGeneralCategory aCategory,
+        const TDesC& aName,
+        TUint32 aArtist,
+        const TDesC& aArt,
+        TInt aDriveId,
+        CMPXMessageArray* aItemChangedMessages,
+        TBool& aItemExist)
+	{
+    MPX_FUNC("CMPXDbHandler::AddCategoryItemL()");
+
+    MPX_PERF_START(CMPXDbHandler_AddCategoryItemL);
+
+    TBool newRecord(EFalse);
+
+    TUint32 id = 0;
+    if ( aArtist )
+        {
+        id = iDbAlbum->AddItemL(aName, aArtist, aArt, aDriveId, newRecord, (aCategory != EMPXGenre));
+        }
+    else
+        {
+        id = iDbArtist->AddItemL(aName, aArt, aDriveId, newRecord, (aCategory != EMPXGenre));
+        }
+        
+    if (newRecord && aItemChangedMessages)
+        {
+        MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id, EMPXItemInserted,
+            aCategory, KDBPluginUid);
+        }
+    aItemExist = !newRecord;
+    MPX_PERF_END(CMPXDbHandler_AddCategoryItemL);
+
+    return id;
+	}
+
+void CMPXDbHandler::UpdateCategoryItemL(
+		TMPXGeneralCategory aCategory,
+		TUint32 aCategoryId,
+		const CMPXMedia& aMedia,
+		TInt aDrive, 
+		CMPXMessageArray* aItemChangedMessages)
+	{
+	switch(aCategory)
+	    {
+	    case EMPXAlbum:
+            iDbAlbum->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
+	        break;
+	        
+	    case EMPXArtist:
+	        iDbArtist->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
+	        break;
+
+	    default:
+            DbCategoryL(aCategory)->UpdateItemL(aCategoryId, aMedia, aDrive, aItemChangedMessages);
+	        break;
+	    }
+	}
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::DeleteSongForCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::DeleteSongForCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TBool& aItemExist)
+    {
+    MPX_FUNC("CMPXDbHandler::DeleteSongForCategoryL");
+    DbCategoryL(aCategory)->DecrementSongsForCategoryL(aCategoryId, aDriveId,
+        aItemChangedMessages, aItemExist);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbHandler::HandlePlayCountModifiedL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbHandler::HandlePlayCountModifiedL(
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::HandlePlayCountModifiedL");
+
+    TUint32 plId(iAutoPlaylist->AutoPlaylistIdL(EMPXMostPlayedPlaylist));
+
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, plId, EMPXItemModified,
+        EMPXSong, KDBPluginUid, plId);
+
+    // Force the deprecated ID attribute
+    aItemChangedMessages[aItemChangedMessages.Count() - 1]->
+        SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, plId);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// CMPXDbHandler::HandlePlaybackTimeModifiedL
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbHandler::HandlePlaybackTimeModifiedL(
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbHandler::HandlePlaybackTimeModifiedL");
+
+    TUint32 plId(iAutoPlaylist->AutoPlaylistIdL(EMPXRecentlyPlayedPlaylist));
+
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, plId, EMPXItemModified,
+        EMPXSong, KDBPluginUid, plId);
+
+    // Force the deprecated ID attribute
+    aItemChangedMessages[aItemChangedMessages.Count() - 1]->
+        SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, plId);
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMPXDbHandler::IsRemoteDrive
+// ---------------------------------------------------------------------------
+//
+TBool CMPXDbHandler::IsRemoteDrive(TDriveNumber aDrive)
+    {
+    return iDbManager->IsRemoteDrive(aDrive);
+    }
+
+TInt CMPXDbHandler::HandlePlaylistDurationL(TUint32 aPlaylistId)
+	{
+	return GetPlaylistDurationL(aPlaylistId);
+	}
+
+TInt CMPXDbHandler::HandleGetAlbumsCountForArtistL(TUint32 aArtistId)
+	{
+	return iDbAlbum->GetAlbumsCountForArtistL(aArtistId);
+	}
+
+TBool CMPXDbHandler::HandleIsUnknownArtistL(TUint32 aArtistId)
+    {
+    return iDbArtist->IsUnknownArtistL(aArtistId);
+    }
+
+TUint32 CMPXDbHandler::HandleArtistForAlbumL(const TUint32 aAlbumId)
+    {
+    return iDbMusic->ArtistForAlbumL(aAlbumId);
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbmusic.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2562 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interation with the music table.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxcollectionpath.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediamtpdefs.h>
+#include <mpxcollectiondbres.rsg>
+
+#include "mpxdbcommondef.h"
+#include "mpxdbcommonstd.h"
+#include "mpxdbcommonutil.h"
+#include "mpxresource.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxcollectiondbstd.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbutil.h"
+#include "mpxdbmanager.h"
+#include "mpxdbmusic.h"
+
+// CONSTANTS
+
+// This is what KNullDesC album computes to for the hash
+// to-do: generate this Id through
+//        MPXDbUtil::GenerateUniqueIdL(EMPXAlbum, KNullDesC, EFalse)
+//        instead of hard-coding the number so if GenerateUniqueIdL
+//        is modified, this constant doesn't need to be redefined
+const TInt KUnknownAlbumID = 1770790356;
+// UniqueID column in Uris requests
+const TInt KColUniqueID = 0;
+// URI column in Uris requests
+const TInt KColUri = 1;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbMusic* CMPXDbMusic::NewL(
+    CMPXDbManager& aDbManager,
+    CMPXResource& aResource,
+    MMPXDbMusicObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbMusic::NewL");
+    CMPXDbMusic* self = CMPXDbMusic::NewLC(aDbManager, aResource, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbMusic* CMPXDbMusic::NewLC(
+    CMPXDbManager& aDbManager,
+    CMPXResource& aResource,
+    MMPXDbMusicObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbMusic::NewLC");
+
+    CMPXDbMusic* self = new (ELeave) CMPXDbMusic(aDbManager, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL(aResource);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbMusic::~CMPXDbMusic()
+    {
+    MPX_FUNC("CMPXDbMusic::~CMPXDbMusic");
+    delete iExtensionsDrm;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbMusic::CMPXDbMusic(
+    CMPXDbManager& aDbManager,
+    MMPXDbMusicObserver& aObserver) :
+    CMPXDbTable(aDbManager),
+    iObserver(aObserver)
+    {
+    MPX_FUNC("CMPXDbMusic::CMPXDbMusic");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::ConstructL(
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbMusic::ConstructL");
+
+    BaseConstructL();
+    iExtensionsDrm = aResource.ReadDesCArrayL(R_MC_FILE_EXTENSIONS_DRM);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::AddSongL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbMusic::AddSongL(
+    const CMPXMedia& aMedia,
+    TInt aDrive,
+    CMPXMessageArray* aMessageArray)
+    {
+    MPX_FUNC("CMPXDbMusic::AddSongL");
+
+    TUint32 songId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection,
+        aMedia.ValueText(KMPXMediaGeneralUri), EFalse));
+
+    if (SongExistsL(songId))
+        {
+        // Delete the existing record first and start from scratch
+        DeleteSongL(songId, aDrive, ETrue);
+        }
+    // add the song
+    DoAddSongL(songId, aMedia, aDrive, aMessageArray);
+    
+    return songId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DoAddSongL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::DoAddSongL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    TInt aDrive,
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbMusic::DoAddSongL");
+
+    CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EMusicFieldCount);
+    CleanupStack::PushL(fields);
+    CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EMusicFieldCount);
+    CleanupStack::PushL(values);
+
+    // add known fields
+    MPXDbCommonUtil::AppendValueL(*fields, *values, KMCMusicUniqueId, aSongId);
+    MPXDbCommonUtil::AppendValueL(*fields, *values, KMCMusicDel, 0);
+
+    TTime time;
+    time.HomeTime();
+    HBufC* timeAdded = MPXDbCommonUtil::TTimeToDesLC(time);
+    MPXDbCommonUtil::AppendValueL(*fields, *values, KMCMusicTimeAdded, *timeAdded);
+    CleanupStack::PopAndDestroy(timeAdded);
+
+    // process the media parameter and construct the fields and values array
+    TBool visible(GenerateMusicFieldsValuesL(aSongId, aMedia, aItemChangedMessages,
+        NULL, *fields, *values, aDrive));
+
+    // create the fields and values strings
+    HBufC* fieldStr = MPXDbCommonUtil::StringFromArrayLC(*fields, KMCCommaSign);
+    HBufC* valueStr = MPXDbCommonUtil::StringFromArrayLC(*values, KMCCommaSign);
+
+    // execute the query
+    iDbManager.ExecuteQueryL(aDrive, KQueryMusicInsert, fieldStr, valueStr);
+
+    CleanupStack::PopAndDestroy(valueStr);
+    CleanupStack::PopAndDestroy(fieldStr);
+    CleanupStack::PopAndDestroy(values);
+    CleanupStack::PopAndDestroy(fields);
+
+    return visible;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateSongL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::UpdateSongL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbMusic::UpdateSongL");
+    return DoUpdateSongL(aSongId, aMedia, &aItemChangedMessages);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DoUpdateSongL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::DoUpdateSongL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbMusic::DoUpdateSongL");
+
+    CMPXDbActiveTask::TChangeVisibility visible(CMPXDbActiveTask::ENotVisibile);
+    if (IsSupported(aMedia))
+        {
+        // retrieve the existing record
+        TInt oldSongId(0);
+        oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        if ( oldSongId <= 0 )
+            {
+            oldSongId = aSongId;  
+            }
+        RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetSong, oldSongId));
+        CleanupClosePushL(recordset);
+
+        if (recordset.Next() != KSqlAtRow)
+            {
+            User::Leave(KErrNotFound);
+            }
+
+        TDriveUnit driveUnit(MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+          recordset.ColumnInt64(EMusicVolumeId)));
+        visible = DoUpdateSongL(aSongId, aMedia, driveUnit, aItemChangedMessages,
+          recordset);
+
+        // Update Album table
+		if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName) || aMedia.IsSupported(KMPXMediaMusicArtist))
+			{
+			TUint32 albumId = recordset.ColumnInt64(EMusicAlbum);
+			iObserver.UpdateCategoryItemL(EMPXAlbum, albumId, aMedia, driveUnit, aItemChangedMessages);
+			}
+            
+        // Update Artist table
+        if ( aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName) )
+            {
+            TUint32 artistId = recordset.ColumnInt64(EMusicArtist);
+            iObserver.UpdateCategoryItemL(EMPXArtist, artistId, aMedia, driveUnit, aItemChangedMessages);            
+            }
+        
+        CleanupStack::PopAndDestroy(&recordset);
+        }
+
+    return visible;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DoUpdateSongL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::DoUpdateSongL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    TInt aDrive,
+    CMPXMessageArray* aItemChangedMessages,
+    RSqlStatement& aRecordset)
+    {
+    MPX_FUNC("CMPXDbMusic::DoUpdateSongL");
+
+    CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EMusicFieldCount);
+    CleanupStack::PushL(fields);
+    CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EMusicFieldCount);
+    CleanupStack::PushL(values);
+
+    TInt oldSongId(0);
+    oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+    if ( oldSongId <= 0 )
+        {
+        oldSongId = aSongId;  
+        }
+    // process the media parameter and construct the fields and values array
+    CMPXDbActiveTask::TChangeVisibility visible(GenerateMusicFieldsValuesL(oldSongId, aMedia, aItemChangedMessages,
+        &aRecordset, *fields, *values, aDrive));
+
+    // construct the SET string
+    HBufC* setStr = MPXDbCommonUtil::StringFromArraysLC(*fields, *values, KMCEqualSign, KMCCommaSign);
+    if (setStr->Length())
+        {
+        // execute the query
+        iDbManager.ExecuteQueryL(aDrive, KQueryMusicUpdate, setStr, oldSongId);
+        }
+
+    CleanupStack::PopAndDestroy(setStr);
+    CleanupStack::PopAndDestroy(values);
+    CleanupStack::PopAndDestroy(fields);
+
+    return visible;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DeleteSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::DeleteSongL(
+    TUint32 aSongId,
+    TInt aDrive,
+    TBool aDeleteRecord /* = EFalse */)
+    {
+    MPX_FUNC("CMPXDbMusic::DeleteSongL");
+
+    TPtrC query(aDeleteRecord ? KQueryMusicDelete() : KQueryMusicDeleteUpdate());
+    iDbManager.ExecuteQueryL(aDrive, query, aSongId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DeleteCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::DeleteCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    CDesCArray& /* aUriArray */,
+    CMPXMessageArray& /* aItemChangedMessages */,
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbMusic::DeleteCategoryL");
+    TPtrC ptr(MPXDbUtil::MusicFieldNameForCategoryL(aCategory));
+    iDbManager.ExecuteQueryL(aDrive, KQueryMusicDeleteForCategory, &ptr, aCategoryId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::CleanupL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::CleanupL()
+    {
+    MPX_FUNC("CMPXDbMusic::CleanupL");
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryMusicCleanup);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetNameL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbMusic::GetNameL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbMusic::GetNameL");
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetTitle, aSongId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::LeaveIfError(KErrNotFound);
+        }
+
+    HBufC* title = MPXDbCommonUtil::GetColumnTextL(recordset, KMPXTableDefaultIndex).AllocL();
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return title;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetUriL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbMusic::GetUriL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbMusic::GetUriL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetUri, aSongId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::LeaveIfError(KErrNotFound);
+        }
+
+    // query fields
+    enum
+        {
+        EMusicUriLocation = 0,
+        EMusicUriVolId
+        };
+
+    TUint volId(recordset.ColumnInt64(EMusicUriVolId));
+    HBufC* fullUri = MPXDbCommonUtil::CreateFullPathL(
+        MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId),
+        MPXDbCommonUtil::GetColumnTextL(recordset, EMusicUriLocation));
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return fullUri;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetDriveL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::GetDriveL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbMusic::GetDriveL");
+    return MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+        ExecuteIntQueryL(KQueryMusicVolume, aSongId));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongInfoL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbMusic::GetSongInfoL(
+    TUint32 aSongId,
+    TUint32& aArtistId,
+    TUint32& aAlbumId,
+    TUint32& aGenreId,
+    TUint32& aComposerId,
+    TInt& aDriveId)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongInfoL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicInfo, aSongId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    aDriveId = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+        recordset.ColumnInt64(EMusicVolumeId));
+    aArtistId = recordset.ColumnInt64(EMusicArtist);
+    aAlbumId = recordset.ColumnInt64(EMusicAlbum);
+    aGenreId = recordset.ColumnInt64(EMusicGenre);
+    aComposerId = recordset.ColumnInt64(EMusicComposer);
+    HBufC* uri = ConstructUriL(recordset);
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return uri;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::GetSongL(
+    const CMPXMedia& aCriteria,
+    CMPXMedia*& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongL");
+
+    TUint32 songId(0);
+
+    // find song Id, title, URI, and general flags from its Id and/or URI. Do not use "aCriteria"
+    // because it may contain attributes other than Id and URI. We don't want to search the
+    // song by fields other than the ID and URI because other attributes for the song may have
+    // been changed in the collection since the song was added
+    CMPXMedia* criteria = CMPXMedia::NewL();
+    CleanupStack::PushL(criteria);
+    if (aCriteria.IsSupported(KMPXMediaGeneralId))
+        {
+        songId = (aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        criteria->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, songId);
+        }
+    else if (aCriteria.IsSupported(KMPXMediaGeneralUri))
+        {
+        criteria->SetTextValueL(KMPXMediaGeneralUri,
+            aCriteria.ValueText(KMPXMediaGeneralUri));
+        }
+
+    // get the criteria string
+    HBufC* criteriaStr = GenerateMusicMatchingCriteriaLC(songId, 0, EMPXItem, *criteria);
+
+    // execute the query
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicSong, criteriaStr));
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    if ((err = recordset.Next()) == KSqlAtRow)
+        {
+        RArray<TMPXAttribute> attributes;
+        CleanupClosePushL(attributes);
+        attributes.AppendL(TMPXAttribute(KMPXMediaIdGeneral,
+            EMPXMediaGeneralId | EMPXMediaGeneralTitle | EMPXMediaGeneralUri | EMPXMediaGeneralFlags));
+
+        aMedia = CMPXMedia::NewL();
+        CleanupStack::PushL(aMedia);
+
+        UpdateMediaL(recordset, attributes.Array(), *aMedia);
+
+        CleanupStack::Pop(aMedia);
+        CleanupStack::PopAndDestroy(&attributes);
+
+        err = KErrNone;
+        }
+    else
+        {
+        err = KErrNotFound;
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(criteriaStr);
+    CleanupStack::PopAndDestroy(criteria);
+
+    return err;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetRecentlyPlayedSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetRecentlyPlayedSongsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetRecentlyPlayedSongsL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetRecentlyPlayed,
+        KMPXMaxRecentlyPlayedSongs);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetMostPlayedSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetMostPlayedSongsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetMostPlayedSongsL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetMostPlayed() : KQueryMusicGetMostPlayedNoCategories(),
+        KMPXMaxMostPlayedSongs);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetRecentlyAddedSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetRecentlyAddedSongsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetRecentlyAddedSongsL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetRecentlyAdded() : KQueryMusicGetRecentlyAddedNoCategories());
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::CountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::CountL()
+    {
+    MPX_FUNC("CMPXDbMusic::CountL");
+    return ExecuteSumQueryL(KQueryMusicCount);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetAlbumsForArtistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetAlbumsForArtistL(
+    TUint32 aArtistId,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetAlbumsForArtistL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicAlbum, aArtistId));
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        TUint32 albumId(recordset.ColumnInt64(KMPXTableDefaultIndex));
+
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, albumId);
+        media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+        media->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXAlbum);
+
+        aMediaArray.AppendL(*media);
+        CleanupStack::PopAndDestroy(media);
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(KErrCorrupt);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongL(
+    TInt aSongId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongL");
+    ExecuteMediaQueryL(aAttrs, aMedia, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetSong() : KQueryMusicGetSongNoCategories(), aSongId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetAllSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetAllSongsL(
+    TInt aDrive,
+    TInt aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetAllSongsL");
+    ExecuteMediaQueryL(aDrive, aAttrs, aMediaArray, KQueryMusicGetAllSongsInfobyPl(), aPlaylistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetAllSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetAllSongsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetAllSongsL");
+
+    // do not execute the joins if no category name is required
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetAllSongs() : KQueryMusicGetAllSongsNoCategories());
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetAllSongsLimitedL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetAllSongsLimitedL(const TArray<TMPXAttribute>& aAttrs,  
+                                      CMPXMediaArray& aMediaArray, TInt aLimit)
+    {
+    MPX_FUNC("CMPXDbMusic::GetAllSongsLimitedL");
+    
+    // Gets a subset of the data from all songs ordered by title
+    HBufC* query = HBufC::NewLC( KQueryMusicGetSongsLimited().Length() + KMCIntegerLen );
+    query->Des().Format( KQueryMusicGetSongsLimited, aLimit );
+    ExecuteMediaQueryL(aAttrs, aMediaArray, *query);
+    CleanupStack::PopAndDestroy( query );    
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsInBlockL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsInBlockL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    TPtrC aTitle, 
+    TUint aNumOfSongs, 
+    TBool aAsc)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsInBlockL");
+
+    if (aAsc)
+        { 
+        ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetSongsInBlockAsc,
+                              aTitle, aNumOfSongs, ETrue, EAscQuery );    
+        }
+    else
+        {
+        ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetSongsInBlockDsc,
+                           aTitle, aNumOfSongs, EFalse, EDscQuery );        
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsAtOffsetL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsAtOffsetL( CMPXMediaArray& aMediaArray,
+                                     const TArray<TMPXAttribute>& aAttrs,
+                                     TInt aOffset,
+                                     TInt aCount )
+    {
+    MPX_DEBUG1("CMPXDbMusic::GetSongsAtOffsetL <--");   
+
+    ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryMusicGetSongsAtOffset, 
+                       aCount, aOffset, EOffSetQuery );
+    
+    MPX_DEBUG1("CMPXDbMusic::GetSongsAtOffsetL() -->"); 
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsForArtistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsForArtistL(
+    TUint aArtistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsForArtistL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetSongsForArtist() : KQueryMusicGetSongsForArtistNoCategories(),
+        aArtistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsForAlbumL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsForAlbumL(
+    TUint aAlbumId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsForAlbumL");
+
+    TPtrC query;
+    if (aAlbumId == KUnknownAlbumID)
+        {
+        query.Set(ExtraFieldsRequired(aAttrs) ? KQueryMusicGetSongsForUnknownAlbum() :
+            KQueryMusicGetSongsForUnknownAlbumNoCategories());
+        }
+    else
+        {
+        query.Set(ExtraFieldsRequired(aAttrs) ? KQueryMusicGetSongsForAlbum() :
+            KQueryMusicGetSongsForAlbumNoCategories());
+        }
+
+    ExecuteMediaQueryL(aAttrs, aMediaArray, query, aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsForArtistAndAlbumL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsForArtistAndAlbumL(
+    TUint aArtistId,
+    TUint aAlbumId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsForArtistAndAlbumL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetSongsForArtistAlbum() : KQueryMusicGetSongsForArtistAlbumNoCategories(),
+        aArtistId, aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsForGenreL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsForGenreL(
+    TUint aGenreId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsForGenreL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetSongsForGenre() : KQueryMusicGetSongsForGenreNoCategories(),
+        aGenreId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetSongsForComposerL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetSongsForComposerL(
+    TUint aComposerId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::GetSongsForComposerL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryMusicGetSongsForComposer() : KQueryMusicGetSongsForComposerNoCategories(),
+        aComposerId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::AllSongsDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::AllSongsDurationL()
+    {
+    MPX_FUNC("CMPXDbMusic::AllSongsDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationAll);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ArtistDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::ArtistDurationL(
+    TUint aArtistId)
+    {
+    MPX_FUNC("CMPXDbMusic::ArtistDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationArtist, aArtistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::AlbumDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::AlbumDurationL(
+    TUint aAlbumId)
+    {
+    MPX_FUNC("CMPXDbMusic::AlbumDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationAlbum, aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ArtistAlbumDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::ArtistAlbumDurationL(
+    TUint aArtistId,
+    TUint aAlbumId)
+    {
+    MPX_FUNC("CMPXDbMusic::ArtistAlbumDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationArtistAlbum, aArtistId, aAlbumId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GenreDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::GenreDurationL(
+    TUint aGenreId)
+    {
+    MPX_FUNC("CMPXDbMusic::GenreDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationGenre, aGenreId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ComposerDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::ComposerDurationL(
+    TUint aComposerId)
+    {
+    MPX_FUNC("CMPXDbMusic::ComposerDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationComposer, aComposerId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::RecentlyPlayedDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::RecentlyPlayedDurationL()
+    {
+    MPX_FUNC("CMPXDbMusic::RecentlyPlayedDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationRecentlyPlayed, KMPXMaxRecentlyPlayedSongs);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::MostPlayedDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::MostPlayedDurationL()
+    {
+    MPX_FUNC("CMPXDbMusic::MostPlayedDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationMostPlayed, KMPXMaxMostPlayedSongs);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::RecentlyAddedDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbMusic::RecentlyAddedDurationL()
+    {
+    MPX_FUNC("CMPXDbMusic::RecentlyAddedDurationL");
+    return ExecuteSumQueryL(KQueryMusicDurationRecentlyAdded);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::FindSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::FindSongsL(
+    TUint32 aGeneralId,
+    TUint32 aContainerId,
+    TMPXGeneralType aType,
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbMusic::FindSongsL");
+
+    // get the selection criteria string
+    HBufC* criteriaStr = GenerateMusicMatchingCriteriaLC(aGeneralId, aContainerId, aType,
+        aCriteria);
+
+    // construct the sort order depending on category. Albums are always sorted by track,
+    // then name, except for unknown album. Songs are sorted by name for unknown album.
+    // NULL track number is stored as KMaxTInt so that they will be sorted to the end
+    TPtrC sortOrder;
+    if ((aType == EMPXGroup) && (MPX_ITEM_CATEGORY(aGeneralId) == EMPXAlbum) &&
+        (aGeneralId != MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXAlbum, KNullDesC, EFalse)))
+        {
+        sortOrder.Set(KQueryMusicFindAllSortOrderTrack);
+        }
+    else
+        {
+        sortOrder.Set(KQueryMusicFindAllSortOrderTitle);
+        }
+
+    // construct the query
+    HBufC* query = HBufC::NewLC(KQueryMusicFindAll().Length() + criteriaStr->Length() +
+        sortOrder.Length());
+    query->Des().Format(KQueryMusicFindAll, criteriaStr, &sortOrder);
+
+    // iterate the results and append media objects to the destination array
+    ExecuteMediaQueryL(aAttrs, aMediaArray, *query);
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(criteriaStr);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetDriveTrackCount
+// ----------------------------------------------------------------------------
+//
+TUint CMPXDbMusic::GetDriveTrackCountL(TInt aDrive)
+    {
+    TUint count(0);
+    
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,KQueryMusicCount));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    count = TUint(recordset.ColumnInt64(KMPXTableDefaultIndex));
+    CleanupStack::PopAndDestroy(&recordset);
+    
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GetMusicUriArrayL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::GetMusicUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                    CDesCArray& aUriArr, TInt& aLastID)
+    {
+    MPX_FUNC("CMPXDbMusic::GetMusicUriArrayL");
+    
+    HBufC* query = NULL;
+    if(aFromID == 0)
+        {
+        query = HBufC::NewLC(KQueryMusicGetMusicUris().Length() + KMCIntegerLen);
+        query->Des().Format(KQueryMusicGetMusicUris, aRecords);
+        }
+    else
+        {
+        query = HBufC::NewLC(KQueryMusicGetMusicUrisFrom().Length() + 2*KMCIntegerLen);
+        query->Des().Format(KQueryMusicGetMusicUrisFrom, aFromID, aRecords);
+        }
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,*query));
+    
+    CleanupStack::PopAndDestroy(query);
+    
+    CleanupClosePushL(recordset);
+    
+    TInt lastID = 0;
+    TInt err(KErrNone);
+    while((err = recordset.Next()) == KSqlAtRow)
+        {
+        HBufC* fullPath = MPXDbCommonUtil::CreateFullPathL(aDrive,
+                MPXDbCommonUtil::GetColumnTextL(recordset, KColUri));
+        CleanupStack::PushL(fullPath);
+        aUriArr.AppendL(*fullPath);
+        CleanupStack::PopAndDestroy(fullPath);
+
+        lastID = recordset.ColumnInt(KColUniqueID);
+        }
+    CleanupStack::PopAndDestroy(&recordset);
+
+    aLastID = lastID;
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ArtistForAlbumL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbMusic::ArtistForAlbumL(const TUint32 aId)
+    {
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicGetArtistForAlbum, aId));
+    
+    CleanupClosePushL(recordset);
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    TUint32 artistId = recordset.ColumnInt64(KMPXTableDefaultIndex);            
+    CleanupStack::PopAndDestroy(&recordset);    
+    
+    return artistId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::RefreshStartL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::RefreshStartL()
+    {
+    iRefresh = ETrue;
+    MPX_FUNC("CMPXDbMusic::RefreshStartL");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::RefreshEndL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::RefreshEndL()
+    {
+    MPX_FUNC("CMPXDbMusic::RefreshEndL");
+    iRefresh = EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::SongExistsL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::SongExistsL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbMusic::SongExistsL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryMusicVolumeAll, aSongId));
+    TBool found = (recordset.Next() == KSqlAtRow);
+    recordset.Close();
+
+    return found;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::UpdateMediaL(
+    RSqlStatement& aMusicTable,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::UpdateMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        switch (aAttrs[i].ContentId())
+            {
+            case KMPXMediaIdGeneral:
+                {
+                UpdateMediaGeneralL(aMusicTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            case KMPXMediaIdMusic:
+                {
+                UpdateMediaMusicL(aMusicTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            case KMPXMediaIdDrm:
+                {
+                // DRM is set by drm helper
+                break;
+                }
+            case KMPXMediaIdMTP:
+                {
+                // Only attribute stored in db is MTP drm status
+                UpdateMediaMTPL(aMusicTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            case KMPXMediaIdAudio:
+                {
+                UpdateMediaAudioL(aMusicTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            default:
+                // Do not leave. If this plugin doesn't support
+                // the content id they want, just return what we have
+                break;
+            } // end switch
+        } // end for
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateMediaGeneralL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::UpdateMediaGeneralL(
+    RSqlStatement& aMusicTable,
+    const TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_DEBUG1("-->CMPXDbMusic::UpdateMediaGeneralL");
+    MPX_DEBUG2("    aAttrId=%b", aAttrId);
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem );
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXSong );
+
+    // FIX ME, temporary always fetch item ID
+    //if (aAttrId & EMPXMediaGeneralId)
+    if (!aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        MPX_DEBUG1("    !aMedia.IsSupported(KMPXMediaGeneralId)");
+        TUint32 songId(aMusicTable.ColumnInt64(EMusicUniqueId));
+        TInt columnCount(aMusicTable.ColumnCount());
+        if(columnCount == 37 && aMusicTable.ColumnIndex(_L("PlUId"))==35)
+            {
+            TUint32 pListUId(aMusicTable.ColumnInt64(35));
+            aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, TMPXItemId(pListUId, songId));
+        	}
+        else
+        	{
+        	aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, songId);
+        	}
+        MPX_DEBUG2("    SongId[%d]", songId);
+        }
+    // FIX ME temporary always fetch URI
+    if (aAttrId & EMPXMediaGeneralUri)
+        {
+        MPX_DEBUG1("    !aMedia.IsSupported(KMPXMediaGeneralUri)");
+        HBufC* uri = ConstructUriL(aMusicTable);
+        CleanupStack::PushL(uri);
+        aMedia.SetTextValueL(KMPXMediaGeneralUri, *uri);
+        MPX_DEBUG2("    FullPath[%S]", uri);
+        CleanupStack::PopAndDestroy(uri);
+        }
+    if (aAttrId & EMPXMediaGeneralDrive)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralDrive");            
+        TDriveUnit driveUnit;
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            MPX_DEBUG1("        aMedia.IsSupported(KMPXMediaGeneralUri)");
+            driveUnit = aMedia.ValueText(KMPXMediaGeneralUri);
+            MPX_DEBUG2("        driveUnit=%d", (TInt)driveUnit);
+            }
+        else
+            {
+            MPX_DEBUG1("        !aMedia.IsSupported(KMPXMediaGeneralUri)");                
+            driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+                aMusicTable.ColumnInt64(EMusicVolumeId));
+            MPX_DEBUG2("        driveUnit=%d", (TInt)driveUnit);                
+            }
+
+        TPtrC driveName(driveUnit.Name());
+        aMedia.SetTextValueL(KMPXMediaGeneralDrive, driveName);
+        MPX_DEBUG2("    Drive[%S]", &driveName);
+        }
+    if (aAttrId & EMPXMediaGeneralSize)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralSize");                        
+        // to-do: store this in the DB
+        }
+    if (aAttrId & EMPXMediaGeneralDuration)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralDuration");                                    
+        TInt32 duration(aMusicTable.ColumnInt(EMusicDuration));
+        aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+        MPX_DEBUG2("    Duration[%d]", duration);
+        }
+    if ((aAttrId & EMPXMediaGeneralTitle) && !aMedia.IsSupported(KMPXMediaGeneralTitle))
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralTitle");
+        TPtrC title(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicTitle));
+        aMedia.SetTextValueL(KMPXMediaGeneralTitle, title);
+        MPX_DEBUG2("    Title[%S]", &title);
+        }
+    if ( aAttrId & EMPXMediaGeneralDate)
+		{
+		MPX_DEBUG1("    EMPXMediaGeneralDate");
+		const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL (aMusicTable,
+				EMusicTimeAdded));
+		if ( dateStr.Compare (KNullDesC)!= 0)
+			{
+			TTime dateTime(MPXDbCommonUtil::DesToTTimeL (dateStr));
+			aMedia.SetTObjectValueL<TInt64> (KMPXMediaGeneralDate,
+					dateTime.Int64 ());
+			}
+		MPX_DEBUG2("    Date[%S]", &dateStr);
+		}
+    if (aAttrId & EMPXMediaGeneralComment)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralComment");                        
+        TPtrC comment(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicComment));
+        aMedia.SetTextValueL(KMPXMediaGeneralComment, comment);
+        MPX_DEBUG2("    Comment[%S]", &comment);
+        }
+    if (aAttrId & EMPXMediaGeneralMimeType)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralMimeType");                                    
+        TPtrC mimeType(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicMimeType));
+        aMedia.SetTextValueL(KMPXMediaGeneralMimeType, mimeType);
+        MPX_DEBUG2("    MimeType[%S]", &mimeType);
+        }
+    if (aAttrId & EMPXMediaGeneralSynchronized)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralSynchronized");                                                
+        TInt sync(aMusicTable.ColumnInt(EMusicSync));
+        aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralSynchronized, sync);
+        MPX_DEBUG2("    Synchronized[%d]", sync);
+        }
+    if (aAttrId & EMPXMediaGeneralDeleted)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralDeleted");                                                            
+        TInt del(aMusicTable.ColumnInt(EMusicDeleted));
+        aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralDeleted, del);
+        MPX_DEBUG2("    Deleted[%d]", del);
+        }
+    if (aAttrId & EMPXMediaGeneralModified)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralModified");
+        TInt mod(aMusicTable.ColumnInt(EMusicModified));
+        aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralModified, mod);
+        MPX_DEBUG2("    Modified[%d]", mod);
+        }
+    if (aAttrId & EMPXMediaGeneralCount)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralCount");
+        aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, 1);
+        }
+    if (aAttrId & EMPXMediaGeneralCollectionId)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralCollectionId");            
+        aMedia.SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId,
+            TUid::Uid(KDBPluginUid));
+        }
+    if(aAttrId & EMPXMediaGeneralCopyright)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralCopyright");            
+        TPtrC copyright(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicCopyright));
+        aMedia.SetTextValueL(KMPXMediaGeneralCopyright, copyright);
+        MPX_DEBUG2("    Copyright[%S]", &copyright);
+        }
+    if (aAttrId & EMPXMediaGeneralFlags)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralFlags");            
+        TUint32 dbFlags(aMusicTable.ColumnInt64(EMusicDbFlag));
+        MPX_DEBUG2("        dbFlags=%b", dbFlags);
+        TDriveUnit driveUnit;
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            MPX_DEBUG1("        aMedia.IsSupported(KMPXMediaGeneralUri)");
+            TParsePtrC parse( aMedia.ValueText(KMPXMediaGeneralUri) );
+            if( parse.DrivePresent() )
+                {
+                driveUnit = parse.Drive();
+                }
+            else
+                {
+                driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+                     aMusicTable.ColumnInt64(EMusicVolumeId));    
+                }
+            MPX_DEBUG2("        driveUnit=%d", (TInt)driveUnit);
+            }
+        else
+            {
+            MPX_DEBUG1("        !aMedia.IsSupported(KMPXMediaGeneralUri)");                
+            driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+                aMusicTable.ColumnInt64(EMusicVolumeId));
+            MPX_DEBUG2("        driveUnit=%d", (TInt)driveUnit);                
+            }
+
+        TInt driveId = driveUnit & KMPXMediaGeneralFlagsDriveInfo;  // 5 bits
+        aMedia.SetTObjectValueL<TUint>(KMPXMediaGeneralFlags, dbFlags | driveId);
+
+        MPX_DEBUG2("    GeneralFlags[%b]", dbFlags | driveId);
+        MPX_DEBUG2("    DriveId[%u]", driveId);
+        }
+    if (aAttrId & EMPXMediaGeneralPlayCount)
+        {
+        MPX_DEBUG1("    EMPXMediaGeneralPlayCount");            
+        TUint32 playcount(aMusicTable.ColumnInt(EMusicPlayCount));
+        aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralPlayCount, playcount);
+        MPX_DEBUG2("    PlayCount[%d]", playcount);
+        }
+        
+    MPX_DEBUG1("<--CMPXDbMusic::UpdateMediaGeneralL");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateMediaMusicL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::UpdateMediaMusicL(
+    RSqlStatement& aMusicTable,
+    const TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::UpdateMediaMusicL");
+
+    if (aAttrId & EMPXMediaMusicAlbumArtFileName)
+        {
+        TPtrC art(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicArt));
+            aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art);
+            MPX_DEBUG2("    Album Art File Name[%S]", &art);
+        }
+    if (aAttrId & EMPXMediaMusicArtist)
+        {
+        TPtrC artist(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicArtistName));
+        aMedia.SetTextValueL(KMPXMediaMusicArtist, artist);
+        MPX_DEBUG2("    Artist[%S]", &artist);
+        }
+    if (aAttrId & EMPXMediaMusicAlbum)
+        {
+        TPtrC album(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicAlbumName));
+        aMedia.SetTextValueL(KMPXMediaMusicAlbum, album);
+        MPX_DEBUG2("    Album[%S]", &album);
+        }
+    if ( aAttrId & EMPXMediaMusicYear)
+		{
+		const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL (aMusicTable,
+				EMusicReleaseDate));
+		if ( dateStr.Compare (KNullDesC)!= 0)
+			{
+			TTime dateTime(MPXDbCommonUtil::DesToTTimeL (dateStr));
+			aMedia.SetTObjectValueL<TInt64> (KMPXMediaMusicYear,
+					dateTime.Int64 ());
+			MPX_DEBUG2("    Year[%d]", dateTime.Int64());
+			}
+		MPX_DEBUG2("    ReleaseDate[%S]", &dateStr);
+		}
+    if (aAttrId & EMPXMediaMusicAlbumTrack)
+        {
+        TInt32 track(aMusicTable.ColumnInt(EMusicAlbumTrack));
+        HBufC* hbuf = HBufC::NewLC(KMCIntegerLen);
+        if (track != KMaxTInt)
+            {
+            hbuf->Des().AppendFormat(_L("%d"), track);
+            }
+        aMedia.SetTextValueL(KMPXMediaMusicAlbumTrack, *hbuf);
+        MPX_DEBUG3("    Album Track[%S][%d]", hbuf, track);
+        CleanupStack::PopAndDestroy(hbuf);
+        }
+    if (aAttrId & EMPXMediaMusicGenre)
+        {
+        TPtrC genre(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicGenreName));
+        aMedia.SetTextValueL(KMPXMediaMusicGenre, genre);
+        MPX_DEBUG2("    Music Genre[%S]", &genre);
+        }
+    if (aAttrId & EMPXMediaMusicComposer)
+        {
+        TPtrC composer(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicComposerName));
+        aMedia.SetTextValueL(KMPXMediaMusicComposer, composer);
+        MPX_DEBUG2("    Music Composer[%S]", &composer);
+        }
+    if (aAttrId & EMPXMediaMusicRating)
+        {
+        TUint32 rating(aMusicTable.ColumnInt(EMusicRating));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaMusicRating, rating);
+        MPX_DEBUG2("    Music Rating[%d]", rating);
+        }
+    if (aAttrId & EMPXMediaMusicURL)
+        {
+        TPtrC url(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicUrl));
+        aMedia.SetTextValueL(KMPXMediaMusicURL, url);
+        MPX_DEBUG2("    Music URL[%S]", &url);
+        }
+    if (aAttrId & EMPXMediaMusicOriginalAlbumArtFileName)
+        {
+        // Always set original album art to be file path
+        // Maybe add a new column to db for future if services like rhapsody pushes jpgs to us
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            const TDesC& uri(aMedia.ValueText(KMPXMediaGeneralUri));
+            aMedia.SetTextValueL(KMPXMediaMusicOriginalAlbumArtFileName, uri);
+            MPX_DEBUG2("    Music Original Album Art FullPath[%S]", &uri);
+            }
+        else
+            {
+            HBufC* fullPath = ConstructUriL(aMusicTable);
+            CleanupStack::PushL(fullPath);
+            aMedia.SetTextValueL(KMPXMediaMusicOriginalAlbumArtFileName, *fullPath);
+            MPX_DEBUG2("    Music Original Album Art FullPath[%S]", fullPath);
+            CleanupStack::PopAndDestroy(fullPath);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateMediaAudioL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::UpdateMediaAudioL(
+    RSqlStatement& aMusicTable,
+    const TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::UpdateMediaAudioL");
+
+    if (aAttrId & EMPXMediaAudioBitrate)
+        {
+        TUint32 bitrate(aMusicTable.ColumnInt(EMusicBitRate));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioBitrate, bitrate);
+        MPX_DEBUG2("    Bitrate[%d]", bitrate);
+        }
+    if (aAttrId & EMPXMediaAudioSamplerate)
+        {
+        TUint32 samplerate(aMusicTable.ColumnInt(EMusicSampleRate));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioSamplerate, samplerate);
+        MPX_DEBUG2("    SampleRate[%d]", samplerate);
+        }
+    if (aAttrId & EMPXMediaAudioNumberOfChannels)
+        {
+        TUint32 numchannels(aMusicTable.ColumnInt(EMusicNumChannels));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioNumberOfChannels, numchannels);
+        MPX_DEBUG2("    Num of Channels[%d]", numchannels);
+        }
+    if (aAttrId & EMPXMediaAudioCodec)
+        {
+        TUint32 codec(aMusicTable.ColumnInt(EMusicCodec));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioAudioCodec, codec);
+        MPX_DEBUG2("    Audio Codec[%d]", codec);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateMediaMTPL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::UpdateMediaMTPL(
+    RSqlStatement& aMusicTable,
+    const TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::UpdateMediaMTPL");
+
+    if (aAttrId & KMPXMediaMTPDrmStatus.iAttributeId)
+        {
+        TUint32 val(aMusicTable.ColumnInt(EMusicMTPDrmStatus));
+        aMedia.SetTObjectValueL<TUint16>(KMPXMediaMTPDrmStatus, val);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GenerateMusicFieldsValuesL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbMusic::GenerateMusicFieldsValuesL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aItemChangedMessages,
+    RSqlStatement* aMusicTable,
+    CDesCArray& aFields,
+    CDesCArray& aValues,
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbMusic::GenerateMusicFieldsValuesL");
+
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+    TBool metaDataModified(EFalse);
+    const TArray<TMPXAttribute> attributes = aMedia.Attributes();
+
+    TBool addSongChangedMessage(ETrue);
+    CMPXMessage* songChangedMessage(NULL);
+    if (aItemChangedMessages)
+        {
+        songChangedMessage = CMPXMedia::NewL();
+        CleanupStack::PushL(songChangedMessage);
+        MPXDbCommonUtil::FillItemChangedMessageL(*songChangedMessage, aSongId,
+            aMusicTable ? EMPXItemModified : EMPXItemInserted, EMPXSong, KDBPluginUid);            
+        }
+
+    // NOTE: Attributes being processed here should be listed in IsSupported()
+    TInt attrCount(attributes.Count());
+    for (TInt i = 0; i < attrCount; ++i)
+        {
+        TUint attributeId(attributes[i].AttributeId());
+
+        switch (attributes[i].ContentId())
+            {
+            case KMPXMediaIdGeneral:
+                {
+                if (attributeId & EMPXMediaGeneralDeleted)
+                    {
+                    TBool deleted(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralDeleted));
+                    if (!aMusicTable || (deleted != aMusicTable->ColumnInt(EMusicDeleted)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDel, deleted);
+                        }
+                    MPX_DEBUG2("    Deleted[%d]", deleted);
+                    }
+
+                if (attributeId & EMPXMediaGeneralFlags)
+                    {
+                    TUint flag(aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags));
+                    TUint32 curFlag(0);
+                    if (aMusicTable)
+                        {
+                        curFlag = aMusicTable->ColumnInt64(EMusicDbFlag);
+                        }
+                    TUint32 oldFlag(curFlag);                        
+
+                    if (flag & KMPXMediaGeneralFlagsSetOrUnsetBit)
+                        {
+                        // Set bits
+                        curFlag |= flag;
+                        }
+                    else
+                        {
+                        // Clear bits
+                        curFlag &= (~flag);
+                        }
+
+                    // The field is written ONLY if the flag value is changing
+                    if (((curFlag ^ oldFlag) & 0x7FFFFFFF) != 0)
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDbFlag, curFlag);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        }
+                    MPX_DEBUG2("    GeneralFlags[%b]", curFlag);
+                    }
+
+                if (attributeId & EMPXMediaGeneralTitle)
+                    {
+                    TBool titleChanged(NULL == aMusicTable);
+
+                    const TDesC& title = aMedia.ValueText(KMPXMediaGeneralTitle);
+                    TPtrC truncatedTitle(title.Left(KMCMaxTextLen));
+                    if (aMusicTable)
+                        {
+                        // Title of the song has been changed
+                        if (truncatedTitle.Compare(MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicTitle)) != 0)
+                            {
+                            titleChanged = ETrue;
+                            }
+                        }
+
+                    if (titleChanged)
+                        {
+                        if ( title.Length() == 0 )
+                            {
+                            const TDesC& path = aMedia.ValueText( KMPXMediaGeneralUri );
+                            TParsePtrC parse( path );
+                            TPtrC truncatedParse( parse.Name().Left( KMCMaxTextLen ) );
+
+                            MPXDbCommonUtil::AppendValueL( aFields, aValues, KMCMusicName, truncatedParse );
+                            }
+                        else
+                            {
+                            MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicName, truncatedTitle);
+                            }
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        metaDataModified = ETrue;
+
+                        MPX_DEBUG2("    Title[%S]", &truncatedTitle);
+                        }
+                    }
+
+                if (attributeId & EMPXMediaGeneralUri)
+                    {
+                    const TDesC& uri = aMedia.ValueText(KMPXMediaGeneralUri);
+                    const TDesC& uriTrunc(uri.Mid(KMCPathStartPos));
+
+                    TDriveUnit driveUnit(uri);
+                    TUint volId(MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit));
+
+                    if (!aMusicTable || ((uriTrunc != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicLocation)) ||
+                        (volId != aMusicTable->ColumnInt64(EMusicVolumeId))))
+                        {
+                        // only do the update something changed
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicVolumeId, volId);
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicLocation,
+                            uri.Mid(KMCPathStartPos));
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDRM, DRMTypeL(uri));
+
+                        const TDesC& mimeTypeText(MPXDbCommonUtil::GetMimeTypeForUriL(uri).Des());
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMimeType, mimeTypeText);
+
+                        MPX_DEBUG3("    VolumeId[%u] Location[%S]", volId, &uri);
+                        MPX_DEBUG2("    MimeType[%S]", &mimeTypeText);
+
+                        if (!aMusicTable && !aMedia.IsSupported(KMPXMediaGeneralTitle))
+                            {
+                            TParsePtrC parser(uri);
+                            TPtrC title = parser.Name();
+                            // use file name as song name
+                            MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicName, title);
+
+                            visibleChange = CMPXDbActiveTask::EAllVisible;
+                            MPX_DEBUG2("    Title[%S]", &title);
+                            }
+
+                        // URI of the song has been changed. This changes the Id of the song
+                        if (aMusicTable)
+                            {
+                            TUint32 newSongId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection, uri, EFalse);
+                            if (aSongId != newSongId)
+                                {
+                                MPX_DEBUG3("    CurrentSongId[0x%x] changed to [0x%x]", aSongId, newSongId);
+                                if (songChangedMessage)
+                                    {
+                                    songChangedMessage->SetTObjectValueL<TMPXItemId>(KMPXMessageMediaGeneralId, newSongId);
+                                    songChangedMessage->SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, aSongId);
+                                    }
+
+                                MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicUniqueId, newSongId);
+                                }
+                            }
+                        }
+                    }
+
+                if (attributeId & EMPXMediaGeneralPlayCount)
+                    {
+                    TInt increment(aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralPlayCount));
+                    TUint32 curCount(increment);
+                    if (aMusicTable)
+                        {
+                        curCount += aMusicTable->ColumnInt(EMusicPlayCount);
+                        }
+
+                    if (!aMusicTable || (curCount != aMusicTable->ColumnInt(EMusicPlayCount)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicPlayCount, curCount);
+
+                        // this needs to be visible in order for Recently Played and Most Played
+                        // playlists will be updated
+                        visibleChange = CMPXDbActiveTask::ESingleVisible;
+
+                        if (aItemChangedMessages)
+                            {
+                            iObserver.HandlePlayCountModifiedL(*aItemChangedMessages);
+                            }           
+                        addSongChangedMessage = EFalse;
+                        }
+                        
+                    MPX_DEBUG2("    PlayCount[%d]", curCount);
+                    }
+
+                if (attributeId & EMPXMediaGeneralLastPlaybackTime)
+                    {
+                    HBufC* time = MPXDbCommonUtil::TTimeToDesLC(
+                        TTime(aMedia.ValueTObjectL<TInt64>(KMPXMediaGeneralLastPlaybackTime)));
+                    if (!aMusicTable || (*time != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicTimePlayed)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicTimePlayed, *time);
+                        // this needs to be visible in order for Recently Played playlist to be updated
+                        visibleChange = CMPXDbActiveTask::ESingleVisible;
+
+                        if (aItemChangedMessages)
+                            {
+                            iObserver.HandlePlaybackTimeModifiedL(*aItemChangedMessages);
+                            }           
+                        addSongChangedMessage = EFalse;
+                        }
+                    MPX_DEBUG2("    PlaybackTime[%S]", time);
+                    CleanupStack::PopAndDestroy(time);
+                    }
+
+                if (attributeId & EMPXMediaGeneralDuration)
+                    {
+                    TInt duration(aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralDuration));
+                    if (!aMusicTable || (duration != aMusicTable->ColumnInt(EMusicDuration)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDuration, duration);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Duration[%d]", duration);
+                    }
+
+                if (attributeId & EMPXMediaGeneralSynchronized)
+                    {
+                    TBool synced(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized));
+                    if (!aMusicTable || (synced != aMusicTable->ColumnInt(EMusicSync)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicSync, synced);
+                        }
+                    MPX_DEBUG2("    Synchronized[%d]", synced);
+                    }
+
+                if (attributeId & EMPXMediaGeneralModified)
+                    {
+                    TBool modified(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralModified));
+                    if (!aMusicTable || (modified != aMusicTable->ColumnInt(EMusicModified)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMod, modified);
+                        }
+                    MPX_DEBUG2("    Modified[%d]", modified);
+                    }
+
+                if (attributeId & EMPXMediaGeneralComment)
+                    {
+                    TPtrC comment = aMedia.ValueText(KMPXMediaGeneralComment).Left(KMCMaxTextLen);
+                    if (!aMusicTable || (comment != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicComment)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicComment, comment);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Comment[%S]", &comment);
+                    }
+
+                if (attributeId & EMPXMediaGeneralCopyright)
+                    {
+                    const TDesC& copyright = aMedia.ValueText(KMPXMediaGeneralCopyright).
+                        Left(KMCMaxTextLen);
+                    if (!aMusicTable || (copyright != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicCopyright)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicCopyright, copyright);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Copyright[%S]", &copyright);
+                    }
+                }
+                break;
+
+            case KMPXMediaIdMusic:
+                {
+                if (attributeId & EMPXMediaMusicAlbumTrack)
+                    {
+                    const TDesC& trackNumber = aMedia.ValueText(KMPXMediaMusicAlbumTrack);
+
+                    // KMaxTInt is used to represent null album track
+                    TInt track(KMaxTInt);
+                    if (trackNumber.Length())
+                        {
+                        TLex stringParser(trackNumber);
+
+                        if ((stringParser.Val(track) != KErrNone) ||
+                            (track == 0) || (track > 999))  // Limit track number to 3 characters
+                            {
+                            track = KMaxTInt;
+                            }
+                        }
+
+                    if (!aMusicTable || (track != aMusicTable->ColumnInt(EMusicAlbumTrack)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicTrackNumber, track);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG3("    Album Track[%S][%d]", &trackNumber, track);
+                    }
+
+                if (attributeId & EMPXMediaMusicYear)
+                    {
+                    TInt64 int64(aMedia.ValueTObjectL<TInt64>(KMPXMediaMusicYear));
+
+                    TTime maxTime(0);
+                    maxTime += TTimeIntervalYears(9999);    // Limit years to 4 characters
+                    TTime time(int64);
+
+                    if (time > maxTime)
+                        {
+                        time = Time::NullTTime();
+                        }
+
+                    HBufC* timeStr = MPXDbCommonUtil::TTimeToDesLC(time);
+                    if (!aMusicTable || (*timeStr != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicReleaseDate)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicReleaseDate, *timeStr);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Music Year[%S]", timeStr);
+                    CleanupStack::PopAndDestroy(timeStr);
+                    }
+
+                if (attributeId & EMPXMediaMusicRating)
+                    {
+                    TInt rating(aMedia.ValueTObjectL<TInt>(KMPXMediaMusicRating));
+                    if (!aMusicTable || (rating != aMusicTable->ColumnInt(EMusicRating)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicRating, rating);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Rating[%d]", rating);
+                    }
+
+                if (attributeId & EMPXMediaMusicAlbumArtFileName)
+                    {
+                    const TDesC& albumArtFilename = aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen);
+                    if (!aMusicTable || (albumArtFilename != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicArt)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArt, albumArtFilename);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        metaDataModified = ETrue;
+                        }
+
+                    MPX_DEBUG2("    Album Art Filename[%S]", &albumArtFilename);
+                    }
+
+                if (attributeId & EMPXMediaMusicURL)
+                    {
+                    const TDesC& url = aMedia.ValueText(KMPXMediaMusicURL).Left(KMCMaxTextLen);
+                    if (!aMusicTable || (url != MPXDbCommonUtil::GetColumnTextL(*aMusicTable, EMusicUrl)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicUrl, url);
+                        metaDataModified = ETrue;
+                        }
+
+                    MPX_DEBUG2("    Music URL[%S]", &url);
+                    }
+                }
+                break;
+
+            case KMPXMediaIdAudio:
+                {
+                if (attributeId & EMPXMediaAudioSamplerate)
+                    {
+                    TInt samplerate(aMedia.ValueTObjectL<TInt>(KMPXMediaAudioSamplerate));
+                    if (!aMusicTable || (samplerate != aMusicTable->ColumnInt(EMusicSampleRate)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicSampleRate, samplerate);
+                        metaDataModified = ETrue;
+                        }
+
+                    MPX_DEBUG2("    Sample Rate[%d]", samplerate);
+                    }
+
+                if (attributeId & EMPXMediaAudioBitrate)
+                    {
+                    TInt bitrate(aMedia.ValueTObjectL<TInt>(KMPXMediaAudioBitrate));
+                    if (!aMusicTable || (bitrate != aMusicTable->ColumnInt(EMusicBitRate)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicBitRate, bitrate);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Bitrate[%d]", bitrate);
+                    }
+
+                if (attributeId & EMPXMediaAudioNumberOfChannels)
+                    {
+                    TUint32 val = aMedia.ValueTObjectL<TUint32>(KMPXMediaAudioNumberOfChannels);
+                    if (!aMusicTable || (val != aMusicTable->ColumnInt(EMusicNumChannels)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicNumChannels, val);
+                        }
+                    MPX_DEBUG2("    Num of Channels[%d]", val);
+                    }
+                }
+                break;
+
+            case KMPXMediaIdDrm:
+                {
+                if (attributeId & EMPXMediaDrmType)
+                    {
+                    TInt drmType(aMedia.ValueTObjectL<TInt>(KMPXMediaDrmType));
+                    if (!aMusicTable || (drmType != aMusicTable->ColumnInt(EMusicDRM)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDRM, drmType);
+                        }
+                    MPX_DEBUG2("    DRM type[%d]", drmType);
+                    }
+                    
+                if (attributeId & KMPXMediaDrmRightsStatus.iAttributeId)
+                    {
+                    if (aMusicTable)
+                        {
+                        TMPXMediaDrmRightsStatus status = 
+                                 aMedia.ValueTObjectL<TMPXMediaDrmRightsStatus>(KMPXMediaDrmRightsStatus);
+                        
+                        //.Set the db flag
+                        TUint32 curFlag(aMusicTable->ColumnInt64(EMusicDbFlag));
+                        TUint32 oldFlag(curFlag);
+                        
+                        if ((status != EMPXDrmRightsFull) && (status != EMPXDrmRightsRestricted))
+                            {
+                            // No rights
+                            curFlag |= KMPXMediaGeneralFlagsIsDrmLicenceInvalid;
+                            }
+                        else
+                            {
+                            // Rights valid
+                            curFlag &= (KMPXMediaGeneralFlagsIsDrmLicenceInvalid ^ 0xFFFFFFFF);
+                            }
+                        
+                        // The field is written ONLY if the flag value is changing
+                        if (((curFlag ^ oldFlag) & 0x7FFFFFFF) != 0)
+                        {
+                            MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicDbFlag, curFlag);
+                            visibleChange = CMPXDbActiveTask::EAllVisible;
+                        }
+                            
+                        MPX_DEBUG2("    Rights Status[%d]", curFlag);
+                        }
+                    }
+                    
+                break;
+                }
+
+            case KMPXMediaIdMTP:
+                {
+                if (attributeId & KMPXMediaMTPDrmStatus.iAttributeId)
+                    {
+                    TUint16 drmStatus(aMedia.ValueTObjectL<TUint16>(KMPXMediaMTPDrmStatus));
+                    if (!aMusicTable || (drmStatus != aMusicTable->ColumnInt(EMusicMTPDrmStatus)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMTPDrmStatus, drmStatus);
+                        }
+                    MPX_DEBUG2("    MTP Drm Status[%d]", drmStatus);
+                    }
+                }
+                break;
+
+            default:
+                break;
+            } // end switch
+        } // end for
+
+    // get the current artist/album/genre/composer
+    // this is required because the recordset may be reused by the code below
+    TUint32 artistId(0);
+    TUint32 albumId(0);
+    TUint32 genreId(0);
+    TUint32 composerId(0);
+    if (aMusicTable)
+        {
+        artistId = aMusicTable->ColumnInt64(EMusicArtist);
+        albumId = aMusicTable->ColumnInt64(EMusicAlbum);
+        genreId = aMusicTable->ColumnInt64(EMusicGenre);
+        composerId = aMusicTable->ColumnInt64(EMusicComposer);
+        }
+
+    // update the artist field
+    TUint32 id(0);
+    TUint32 artistIdForAlbum(artistId);
+    if (UpdateCategoryFieldL(EMPXArtist, aMedia, KMPXMediaMusicArtist, artistId,
+        aDrive, aItemChangedMessages, id, 0))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicArtist, id);
+        metaDataModified = (aMusicTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        artistIdForAlbum = id;
+        }
+
+    // update the album field
+	if (UpdateCategoryFieldL(EMPXAlbum, aMedia, KMPXMediaMusicAlbum, albumId,
+		aDrive, aItemChangedMessages, id, artistIdForAlbum))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicAlbum, id);
+        metaDataModified = (aMusicTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        
+        //
+        // added to handle error EALU-73WDJN. If the album name of the last song
+        // in the album for the artist is changed to an existing album name from
+        // artist view, a change message needs to be sent in order for UI to
+        // correctly refresh.
+        //
+        // Fix for EDXU-7BBALS, remove check for HasOtherSongsInArtistAlbumL 
+        // Always send a Album Inserted message when Album change to get Artist updated
+        if (aItemChangedMessages)
+            {
+            // send album added m essage instead of album deleted or modified
+            // to avoid collection paths of other clients being modified
+            MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, albumId, 
+                    EMPXItemInserted, EMPXAlbum, KDBPluginUid);
+            }
+        }
+
+    // update the genre field
+    if (UpdateCategoryFieldL(EMPXGenre, aMedia, KMPXMediaMusicGenre, genreId,
+        aDrive, aItemChangedMessages, id))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicGenre, id);
+        metaDataModified = (aMusicTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        }
+
+    // update the composer field
+    if (UpdateCategoryFieldL(EMPXComposer, aMedia, KMPXMediaMusicComposer, composerId,
+        aDrive, aItemChangedMessages, id))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicComposer, id);
+        metaDataModified = (aMusicTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        }
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+    // Set Mod bit to ETrue if metadata has been updated and caller hasn't explicitly
+    // set/reset it
+    if (aMusicTable &&
+        !aMedia.IsSupported(KMPXMediaGeneralModified) &&
+        metaDataModified)
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCMusicMod, 1);
+        MPX_DEBUG1("    Modified[1]");
+        }
+#endif
+
+    if (aItemChangedMessages)
+        {
+      if (aFields.Count() && addSongChangedMessage)
+          {
+          aItemChangedMessages->AppendL(*songChangedMessage);
+          }
+        CleanupStack::PopAndDestroy(songChangedMessage);
+        }
+        
+    return visibleChange;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DRMTypeL
+// ----------------------------------------------------------------------------
+//
+TMCDrmType CMPXDbMusic::DRMTypeL(
+    const TDesC& aFile)
+    {
+    MPX_FUNC("CMPXDbMusic::DRMTypeL");
+
+    TMCDrmType drm(EMCDrmNone);
+    TInt pos(0);
+    TParsePtrC fullEntry(aFile);
+    TPtrC theExt = fullEntry.Ext();
+
+    if (iExtensionsDrm->Find(theExt, pos) == 0)
+        {
+        drm = MPXDbCommonUtil::GetDRMTypeL(aFile);
+        }
+
+    return drm;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::GenerateMusicMatchingCriteriaLC
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbMusic::GenerateMusicMatchingCriteriaLC(
+    TUint32 aGeneralId,
+    TUint32 aContainerId,
+    TMPXGeneralType aType,
+    const CMPXMedia& aCriteria)
+    {
+    MPX_FUNC("CMPXDbMusic::GenerateMusicMatchingCriteriaLC");
+
+    const TArray<TMPXAttribute> criteria = aCriteria.Attributes();
+    TInt criteriaCount(criteria.Count());
+
+    // construct an array of criteria strings
+    CDesCArrayFlat* sqlCriteria = new (ELeave) CDesCArrayFlat(criteriaCount);
+    CleanupStack::PushL(sqlCriteria);
+
+    // If EMPXMediaGeneralDeleted is not defined, always unset the deleted bit for matching
+    if (!aCriteria.IsSupported(KMPXMediaGeneralDeleted))
+        {
+        sqlCriteria->AppendL(KCriterionMusicNotDeleted);
+        }
+
+    TBool volumeAdded(EFalse);
+    for (TInt i = 0; i < criteriaCount; ++i)
+        {
+        const TMPXAttribute& criterion = criteria[i];
+
+        if (criterion == KMPXMediaGeneralId)
+            {
+            // Set the type if no type is specified
+            TInt category(MPX_ITEM_CATEGORY(aGeneralId));
+
+            if( aType == EMPXNoType )
+                {
+                aType = (category == EMPXCollection) ? EMPXItem : EMPXGroup;
+                }
+
+            TPtrC ptr;
+            if (aType == EMPXItem && (category == EMPXCollection))
+                {
+                ptr.Set(KCriterionMusicUniqueId);
+                }
+            else if (aType == EMPXGroup && (category == EMPXArtist))
+                {
+                ptr.Set(KCriterionMusicArtist);
+                }
+            else if (aType == EMPXGroup && (category == EMPXAlbum))
+                {
+                ptr.Set(KCriterionMusicAlbum);
+                }
+            else if (aType == EMPXGroup && (category == EMPXGenre))
+                {
+                ptr.Set(KCriterionMusicGenre);
+                }
+            else if (aType == EMPXGroup && (category == EMPXComposer))
+                {
+                ptr.Set(KCriterionMusicComposer);
+                }
+            else
+                {
+                User::Leave(KErrNotSupported);
+                }
+
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, ptr, aGeneralId);
+            }
+        else if (criterion == KMPXMediaGeneralContainerId)
+            {
+            TInt containerCategory(MPX_ITEM_CATEGORY(aContainerId));
+
+            if (aType == EMPXGroup && (containerCategory == EMPXArtist))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionMusicArtist, aContainerId);
+                }
+            else if (aType == EMPXGroup && (containerCategory == EMPXAlbum))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionMusicAlbum, aContainerId);
+                }
+            else
+                {
+                //User::Leave(KErrNotSupported);
+                }
+            }
+        else if (criterion == KMPXMediaGeneralTitle)
+            {
+            HBufC* title = MPXDbCommonUtil::ProcessPatternCharsLC(
+                aCriteria.ValueText(KMPXMediaGeneralTitle));
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicTitle, *title);
+            CleanupStack::PopAndDestroy(title);
+            }
+        else if (criterion == KMPXMediaGeneralUri)
+            {
+            // full URI from criteria
+            const TDesC& uri = aCriteria.ValueText(KMPXMediaGeneralUri);
+            TUint32 itemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection,
+                                                                uri, EFalse);
+            
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicUniqueId, itemId);
+            }
+        else if (criterion == KMPXMediaGeneralDrive)
+            {
+            if (!volumeAdded)
+                {
+                // validate the drive letter, TDriveUnit panics if given drive isn't between
+                // 'A' to 'Z'
+                TDriveUnit driveUnit(aCriteria.ValueText(KMPXMediaGeneralDrive));
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicVolume,
+                    MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit));
+                volumeAdded = ETrue;
+                }
+            }
+        else if (criterion == KMPXMediaGeneralSynchronized)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicSync,
+                aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized));
+            }
+        else if (criterion == KMPXMediaGeneralDeleted)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicDeleted,
+                aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralDeleted));
+            }
+        else if (criterion == KMPXMediaGeneralModified)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionMusicModified,
+                aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralModified));
+            }
+         else
+            {
+            // to-do: provide searching ability on the rest of the fields
+            }
+        }
+
+    // construct the final criteria string
+    HBufC* criteriaStr = MPXDbCommonUtil::StringFromArrayLC(*sqlCriteria, KMCAndKeyword);
+
+    CleanupStack::Pop(criteriaStr);
+    CleanupStack::PopAndDestroy(sqlCriteria);
+    CleanupStack::PushL(criteriaStr);
+
+    return criteriaStr;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ConstructUriL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbMusic::ConstructUriL(
+    RSqlStatement& aMusicTable)
+    {
+    MPX_FUNC("CMPXDbMusic::ConstructUriL");
+
+    TUint volId(aMusicTable.ColumnInt64(EMusicVolumeId));
+    TPtrC location(MPXDbCommonUtil::GetColumnTextL(aMusicTable, EMusicLocation));
+    return MPXDbCommonUtil::CreateFullPathL(
+        MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId), location);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbMusic::CreateTableL");
+
+    // Create the table
+    User::LeaveIfError(aDatabase.Exec(KMusicCreateTable));
+
+    // Do not create any other indexes than the one on UniqueId
+    // as they only slow down the database overall
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbMusic::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbMusic::DropTableL");
+    User::LeaveIfError(aDatabase.Exec(KMusicDropTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbMusic::CheckTableL");
+    return DoCheckTable(aDatabase, KMusicCheckTable);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateCategoryFieldL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::UpdateCategoryFieldL(
+    TMPXGeneralCategory aCategory,
+    const CMPXMedia& aMedia,
+    const TMPXAttribute& aAttribute,
+    TUint32 aOldId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TUint32& aItemId)
+    {
+    TBool updated(EFalse);
+    TBool itemNotRemoved( EFalse );
+    TBool itemAdded( EFalse );
+
+    // update category table and add category Id to the music table
+    if (!aOldId || aMedia.IsSupported(aAttribute))
+        {
+        TInt changeMsgCount( 0 );
+        if( aItemChangedMessages )
+            {
+            changeMsgCount = aItemChangedMessages->Count();    
+            }
+        
+        if (aMedia.IsSupported(aAttribute))
+            {
+            TPtrC name(aMedia.ValueText(aAttribute).Left(KMCMaxTextLen));
+
+            // construct the new ID for the category record
+            // only genre is not case sensitive
+            aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory,
+                name, (aCategory != EMPXGenre));
+            if (!aOldId || (aOldId != aItemId))
+                {
+                // only add if the ID changed,
+                // otherwise the song was updated but the artist name was not
+
+                // ignore the return value
+                iObserver.AddCategoryItemL(aCategory, name, aDriveId, 
+                    aItemChangedMessages, itemAdded);
+                updated = ETrue;
+                }
+            }
+        else
+            {
+            // only genre is not case sensitive
+            aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, KNullDesC,
+                (aCategory != EMPXGenre));
+            if (!aOldId || (aOldId != aItemId))
+                {
+                // ignore the return value
+                iObserver.AddCategoryItemL(aCategory, KNullDesC, aDriveId, 
+                    aItemChangedMessages, itemAdded);
+                updated = ETrue;
+                }
+            }
+
+        if (aOldId && (aOldId != aItemId))
+            {
+            iObserver.DeleteSongForCategoryL(aCategory, aOldId, aDriveId, 
+                aItemChangedMessages, itemNotRemoved);
+            updated = ETrue;
+            }
+        
+        // Special case where the item(s) has been renamed.
+        // In this case, a new category is created +1 change msg
+        //               a old category is removed +1 change msg
+        // We merge these 2 change messages into one using the deprecated ID
+        //
+        if( aItemChangedMessages )
+            {
+            TInt newChangeMsgCount( aItemChangedMessages->Count() );
+            if(  newChangeMsgCount - changeMsgCount > 0 )
+                {
+                TInt oldId = KErrNotFound;
+                TInt newId = KErrNotFound;
+                for( TInt i=0; i<newChangeMsgCount; ++i )
+                    {
+                    CMPXMessage& msg = *(*aItemChangedMessages)[i];
+                    
+                    TMPXItemId id = msg.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId);
+                    TMPXChangeEventType changeType = msg.ValueTObjectL<TMPXChangeEventType>(KMPXMessageChangeEventType);
+                    
+                    // Look for the added and deleted category IDs
+                    //
+                    if( id == aOldId && changeType == EMPXItemDeleted )
+                        {
+                        oldId = i;
+                        }
+                    else if( id == aItemId && changeType == EMPXItemInserted )
+                        {
+                        newId = i;
+                        }
+                    }
+                
+                if( oldId != KErrNotFound && 
+                    newId != KErrNotFound )
+                    {
+                    aItemChangedMessages->Remove(oldId);  // category removed
+                    aItemChangedMessages->Remove(newId);  // category added
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aOldId );
+                    }
+                else if ( oldId !=KErrNotFound && itemAdded ) // old item removed, new item already exist
+                    {
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aOldId );
+                    }
+                else if ( newId !=KErrNotFound && itemNotRemoved ) // new item added, old item still exist
+                    {
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aOldId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aItemId );
+                    }
+                }
+            }
+        }
+
+    return updated;
+    }
+
+TBool CMPXDbMusic::UpdateCategoryFieldL(
+    TMPXGeneralCategory aCategory,
+    const CMPXMedia& aMedia,
+    const TMPXAttribute& aAttribute,
+    TUint32 aOldId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TUint32& aItemId, 
+    TUint32 aArtistId)
+    {
+    TBool updated(EFalse);
+    TBool itemNotRemoved( EFalse );
+    TBool itemAdded( EFalse );
+
+    // update category table and add category Id to the music table
+    if (!aOldId || aMedia.IsSupported(aAttribute))
+        {
+        TInt changeMsgCount( 0 );
+        if( aItemChangedMessages )
+            {
+            changeMsgCount = aItemChangedMessages->Count();    
+            }
+        
+        if (aMedia.IsSupported(aAttribute))
+            {
+            TPtrC name(aMedia.ValueText(aAttribute).Left(KMCMaxTextLen));
+
+            // construct the new ID for the category record
+            // only genre is not case sensitive
+            aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory,
+                name, (aCategory != EMPXGenre));
+            if (!aOldId || (aOldId != aItemId))
+                {
+                // only add if the ID changed,
+                // otherwise the song was updated but the artist name was not
+				TPtrC art(KNullDesC);
+				if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+					{
+					art.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
+					}
+
+				iObserver.AddCategoryItemL(aCategory, name, aArtistId, art, aDriveId, aItemChangedMessages, itemAdded);
+                updated = ETrue;
+                }
+            }
+        else
+            {
+            // only genre is not case sensitive
+            aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, KNullDesC,
+                (aCategory != EMPXGenre));
+            if (!aOldId || (aOldId != aItemId))
+                {
+				TPtrC art(KNullDesC);
+				if (aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+					{
+					art.Set(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
+					}
+
+				iObserver.AddCategoryItemL(aCategory, KNullDesC, aArtistId, art, aDriveId, 
+                    aItemChangedMessages, itemAdded);
+                updated = ETrue;
+                }
+            }
+
+        if (aOldId && (aOldId != aItemId))
+            {
+            iObserver.DeleteSongForCategoryL(aCategory, aOldId, aDriveId, 
+                aItemChangedMessages, itemNotRemoved);
+            updated = ETrue;
+            }
+        
+        // Special case where the item(s) has been renamed.
+        // In this case, a new category is created +1 change msg
+        //               a old category is removed +1 change msg
+        // We merge these 2 change messages into one using the deprecated ID
+        //
+        if( aItemChangedMessages )
+            {
+            TInt newChangeMsgCount( aItemChangedMessages->Count() );
+            if(  newChangeMsgCount - changeMsgCount > 0 )
+                {
+                TInt oldId = KErrNotFound;
+                TInt newId = KErrNotFound;
+                for( TInt i=0; i<newChangeMsgCount; ++i )
+                    {
+                    CMPXMessage& msg = *(*aItemChangedMessages)[i];
+                    
+                    TMPXItemId id = msg.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId);
+                    TMPXChangeEventType changeType = msg.ValueTObjectL<TMPXChangeEventType>(KMPXMessageChangeEventType);
+                    
+                    // Look for the added and deleted category IDs
+                    //
+                    if( id == aOldId && changeType == EMPXItemDeleted )
+                        {
+                        oldId = i;
+                        }
+                    else if( id == aItemId && changeType == EMPXItemInserted )
+                        {
+                        newId = i;
+                        }
+                    }
+                
+                if( oldId != KErrNotFound && 
+                    newId != KErrNotFound )
+                    {
+                    aItemChangedMessages->Remove(oldId);  // category removed
+                    aItemChangedMessages->Remove(newId);  // category added
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aOldId );
+                    }
+                else if ( oldId !=KErrNotFound && itemAdded ) // old item removed, new item already exist
+                    {
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aItemId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aOldId );
+                    }
+                else if ( newId !=KErrNotFound && itemNotRemoved ) // new item added, old item still exist
+                    {
+                    MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aOldId, EMPXItemModified,
+                                                            aCategory, KDBPluginUid, aItemId );
+                    }
+                }
+            }
+        }
+
+    return updated;
+    }
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::ExtraFieldsRequired
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::ExtraFieldsRequired(
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_DEBUG1("-->CMPXDbMusic::ExtraFieldsRequired");
+
+    // check if any extra fields are required
+    TUint defaultFields(EMPXMediaGeneralId |
+                        EMPXMediaGeneralType |
+                        EMPXMediaGeneralCategory |
+                        EMPXMediaGeneralTitle |
+                        EMPXMediaGeneralUri |
+                        EMPXMediaGeneralFlags);
+                        
+    TBool extraRequired(EFalse);
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TUint attributeId(aAttrs[i].AttributeId()|defaultFields);
+        MPX_DEBUG2("    attribute content id 0x%x", aAttrs[i].ContentId());
+        MPX_DEBUG3("    attribute id %b, original attribute id %b", attributeId, aAttrs[i].AttributeId());
+
+        if (KMPXMediaIdGeneral != aAttrs[i].ContentId() ||
+            attributeId != defaultFields)
+            {
+            MPX_DEBUG1("    extraRequired YES");
+            extraRequired = ETrue;
+            break;
+            }
+        }
+
+    MPX_DEBUG2("<--CMPXDbMusic::ExtraFieldsRequired returns %d", extraRequired);
+    return extraRequired;
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Test if the given media contains supported attributes
+// ----------------------------------------------------------------------------------------------------------
+//
+TBool CMPXDbMusic::IsSupported(
+  const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbMusic::IsSupported");                   
+
+    // this checklist should match the attributes processed in DoFillInDatabaseInfoL
+    return aMedia.IsSupported(KMPXMediaGeneralTitle) ||
+        aMedia.IsSupported(KMPXMediaGeneralUri) ||
+        aMedia.IsSupported(KMPXMediaGeneralComment) ||
+        aMedia.IsSupported(KMPXMediaGeneralSynchronized) ||
+        aMedia.IsSupported(KMPXMediaGeneralDeleted) ||
+        aMedia.IsSupported(KMPXMediaGeneralModified) ||
+        aMedia.IsSupported(KMPXMediaGeneralCopyright) ||
+        aMedia.IsSupported(KMPXMediaGeneralDuration) ||
+        aMedia.IsSupported(KMPXMediaGeneralFlags) ||
+        aMedia.IsSupported(KMPXMediaGeneralPlayCount) ||
+        aMedia.IsSupported(KMPXMediaGeneralLastPlaybackTime) ||
+        aMedia.IsSupported(KMPXMediaMusicAlbumTrack) ||
+        aMedia.IsSupported(KMPXMediaMusicYear) ||
+        aMedia.IsSupported(KMPXMediaMusicRating) ||
+        aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName) ||
+        aMedia.IsSupported(KMPXMediaMusicURL) ||
+        aMedia.IsSupported(KMPXMediaMusicArtist) ||
+        aMedia.IsSupported(KMPXMediaMusicAlbum) ||
+        aMedia.IsSupported(KMPXMediaMusicGenre) ||
+        aMedia.IsSupported(KMPXMediaMusicComposer) ||
+        aMedia.IsSupported(KMPXMediaAudioSamplerate) ||
+        aMedia.IsSupported(KMPXMediaAudioBitrate) ||
+        aMedia.IsSupported(KMPXMediaAudioNumberOfChannels) ||
+        aMedia.IsSupported(KMPXMediaDrmType) ||
+        aMedia.IsSupported(KMPXMediaDrmRightsStatus) ||
+        aMedia.IsSupported(KMPXMediaMTPDrmStatus);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbplaylist.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1087 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interaction with the playlist tables.
+*
+*/
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <mpxlog.h>
+#include <mpxmediacontainerdefs.h>
+
+#include "mpxdbcommonutil.h"
+#include "mpxdbcommondef.h"
+#include "mpxdbcommonstd.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbmanager.h"
+#include "mpxdbutil.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbplaylistsongs.h"
+#include "mpxdbplaylist.h"
+
+// CONSTANTS
+// UniqueID column in Uris requests
+const TInt KColUniqueID = 0;
+// URI column in Uris requests
+const TInt KColUri = 1;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylist* CMPXDbPlaylist::NewL(
+    CMPXDbManager& aDbManager,
+	MMPXDbPlaylistObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbPlaylist::NewL");
+
+    CMPXDbPlaylist* self = CMPXDbPlaylist::NewLC(aDbManager, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylist* CMPXDbPlaylist::NewLC(
+    CMPXDbManager& aDbManager,
+	MMPXDbPlaylistObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbPlaylist::NewLC");
+
+	CMPXDbPlaylist* self = new (ELeave) CMPXDbPlaylist(aDbManager, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylist::~CMPXDbPlaylist()
+    {
+    MPX_FUNC("CMPXDbPlaylist::~CMPXDbPlaylist");
+    delete iPlaylistSongs;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylist::CMPXDbPlaylist(
+    CMPXDbManager& aDbManager, 
+    MMPXDbPlaylistObserver& aObserver) :
+    CMPXDbTable(aDbManager),
+	iObserver(aObserver)
+    {
+    MPX_FUNC("CMPXDbPlaylist::CMPXDbPlaylist");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::ConstructL()
+    {
+    MPX_FUNC("CMPXDbPlaylist::ConstructL");
+
+    BaseConstructL();
+    iPlaylistSongs = CMPXDbPlaylistSongs::NewL(iDbManager);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::AddPlaylistL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlaylist::AddPlaylistL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::AddPlaylistL");
+
+    // make sure the playlist and the corresponding songs are deleted
+    TUint32 playlistId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXPlaylist,
+        aMedia.ValueText(KMPXMediaGeneralUri), EFalse));
+    DeletePlaylistNoUriL(playlistId);
+
+    // add the playlist
+    return DoAddPlaylistL(aMedia, TDriveUnit(aMedia.ValueText(KMPXMediaGeneralUri)));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::AddSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::AddSongsL(
+    TUint32 aPlaylistId,
+    const CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlaylist::AddSongsL");
+
+    // get the drive ID of corresponding playlist
+    TInt drive(GetDriveIdL(aPlaylistId));
+
+    // add the songs
+    iPlaylistSongs->AddSongsL(aPlaylistId, aMediaArray, drive);
+
+    // update the time for the playlist
+    UpdatePlaylistTimeL(aPlaylistId, drive);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::UpdatePlaylistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::UpdatePlaylistL(
+    const CMPXMedia& aMedia,
+    CMPXMessage& aMessage,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdatePlaylistL");
+
+    TUint32 playlistId((aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2);
+    DoUpdatePlaylistL(playlistId, aMedia, aDriveId, aMessage);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::UpdateSongL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylist::UpdateSongL(
+    const CMPXMedia& aMedia,
+    TBool aResetFlags,
+    CMPXMessageArray* aItemChangedMessages /* = NULL */)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdateSongL");
+
+    // find the song ID
+    TInt oldSongId(0);
+    TInt newSongId(0);
+    if (aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        oldSongId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        }
+    if (aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        newSongId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection,
+            aMedia.ValueText(KMPXMediaGeneralUri), EFalse);
+        }
+    if ( !aMedia.IsSupported( KMPXMediaGeneralId ) && !aMedia.IsSupported( KMPXMediaGeneralUri ))
+        {
+        User::Leave( KErrArgument );
+        }
+
+    if ( newSongId <= 0 )
+        {
+        newSongId = oldSongId;
+        }
+
+    if ( oldSongId <= 0 )
+        {
+        oldSongId = newSongId;
+        }
+
+    // update the PlaylistSongs and PlaylistSongInfo tables first
+    TBool updated(EFalse);
+    TBool visible(iPlaylistSongs->UpdateSongL( oldSongId, aMedia, aResetFlags, updated ));
+    TBool bSongInPlaylists( EFalse );
+    if (updated)
+        {
+        UpdatePlaylistsForSongL( newSongId, aItemChangedMessages,bSongInPlaylists );
+        }
+
+    return visible;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DeleteSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DeleteSongL(
+    TUint32 aSongId,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongL");
+    TBool bSongInPlaylists(EFalse);
+    // add item changed messages for all playlists that contain the song
+    UpdatePlaylistsForSongL (aSongId, &aItemChangedMessages, bSongInPlaylists);
+    if (bSongInPlaylists)
+        {
+        // delete the song from the PlaylistSongs and PlaylistSongInfo tables
+        iPlaylistSongs->DeleteSongL (aSongId);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DeleteSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DeleteSongL(
+    TUint32 aPlaylistId,
+    TUint32 aSongId,
+    TInt aOrdinal)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongL");
+
+    // get playlist drive
+    TInt drive(GetDriveIdL(aPlaylistId));
+
+    // delete the song from the PlaylistSongs / PlaylistSongInfo tables
+    iPlaylistSongs->DeleteSongL(aPlaylistId, aSongId, aOrdinal, drive);
+
+    // update the time for the playlist
+    UpdatePlaylistTimeL(aPlaylistId, drive);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DeletePlaylistL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbPlaylist::DeletePlaylistL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeletePlaylistL");
+
+    // get the uri
+    HBufC* uri = GetUriL(aPlaylistId);
+    if (uri)
+        {
+        CleanupStack::PushL(uri);
+        TDriveUnit drive(*uri);
+
+        // delete the songs from the PlaylistSongs table
+        iPlaylistSongs->DeleteSongsL(aPlaylistId, drive);
+
+        // delete the playlist record from the Playlist table
+        iDbManager.ExecuteQueryL(drive, KQueryPlaylistDelete, aPlaylistId);
+
+        CleanupStack::Pop(uri);
+        }
+
+    return uri;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DeletePlaylistNoUriL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DeletePlaylistNoUriL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeletePlaylistNoUriL");
+
+    TInt drive(0);
+    MPX_TRAPD(err, drive = GetDriveIdL(aPlaylistId));
+    if (err != KErrNotFound)
+        {
+        User::LeaveIfError(err);
+
+        // delete the songs from the PlaylistSongs table
+        iPlaylistSongs->DeleteSongsL(aPlaylistId, drive);
+
+        // delete the playlist record from the Playlist table
+        iDbManager.ExecuteQueryL(drive, KQueryPlaylistDelete, aPlaylistId);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DeleteAllPlaylistsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DeleteAllPlaylistsL()
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteAllPlaylistsL");
+
+    // delete the songs from the PlaylistSongs table
+    iPlaylistSongs->DeleteAllSongsL();
+
+    // delete all playlists
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistDeleteAll);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::CountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylist::CountL()
+    {
+    MPX_FUNC("CMPXDbPlaylist::CountL");
+    return ExecuteSumQueryL(KQueryPlaylistCount);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetPlaylistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::GetPlaylistL(
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetPlaylistL");
+    ExecuteMediaQueryL(aAttrs, aMedia, KQueryPlaylistGet, aPlaylistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetAllPlaylistsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::GetAllPlaylistsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetAllPlaylistsL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryPlaylistGetAll);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetNameL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbPlaylist::GetNameL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetNameL");
+
+    RSqlStatement recordset(GetPlaylistRecordL(aPlaylistId));
+    CleanupClosePushL(recordset);
+
+    HBufC* name(NULL);
+    TInt err(KErrNone);
+    if ((err = recordset.Next()) == KSqlAtRow)
+        {
+        name = MPXDbCommonUtil::GetColumnTextL(recordset, EPlaylistName).AllocL();
+        }
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(err);
+        }
+
+    if (name == NULL)
+        {
+        User::LeaveIfError(KErrNotFound);
+        }
+    return name;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetUriL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbPlaylist::GetUriL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetUriL");
+
+    RSqlStatement recordset(GetPlaylistRecordL(aPlaylistId));
+    CleanupClosePushL(recordset);
+
+    HBufC* uri(NULL);
+    TInt err(KErrNone);
+    if ((err = recordset.Next()) == KSqlAtRow)
+        {
+        uri = MPXDbCommonUtil::CreateFullPathL(
+            MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+            recordset.ColumnInt64(EPlaylistVolumeId)),
+            MPXDbCommonUtil::GetColumnTextL(recordset, EPlaylistUri));
+
+        }
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(err);
+        }
+
+    if (uri == NULL)
+        {
+        User::LeaveIfError(KErrNotFound);
+        }
+
+    return uri;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetIdL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlaylist::GetIdL(
+    const TDesC& aUri)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetIdL");
+    HBufC* uri = MPXDbCommonUtil::ProcessPatternCharsLC( aUri );
+    TUint32 ret = ExecuteIntQueryL(
+        KQueryLikePlaylistId, uri->Mid( KMCPathStartPos ) );
+
+   	CleanupStack::PopAndDestroy( uri );
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::FindAllL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::FindAllL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlaylist::FindAllL");
+
+    // process the requested attributes
+    // the UniqueId is always requested
+    TBool titleRequested(EFalse);
+    TBool counterRequested(EFalse);
+
+    TInt viewingColumnCount(aAttrs.Count());
+    for (TInt i = 0; (i < viewingColumnCount) && !(titleRequested && counterRequested); ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdGeneral)
+            {
+            TUint attributeId(aAttrs[i].AttributeId());
+
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                titleRequested = ETrue;
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+                counterRequested = ETrue;
+                }
+            }
+        }
+
+    TMPXGeneralType type = aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+
+    const TArray<TMPXAttribute> criteria = aCriteria.Attributes();
+    TInt criteriaCount(criteria.Count());
+
+    // process the criteria and construct the criteria string
+    CDesCArrayFlat* criteriaArray = new (ELeave) CDesCArrayFlat(criteriaCount);
+    CleanupStack::PushL(criteriaArray);
+
+    TBool criteriaCounterSet(EFalse);
+    TInt criteriaCounter(0);
+
+    for (TInt i = 0; i < criteriaCount; ++i)
+        {
+        const TMPXAttribute& criterion = criteria[i];
+        if (type == EMPXItem && criterion == KMPXMediaGeneralId)
+            {
+            TUint32 itemId((aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2);
+            if (MPX_ITEM_CATEGORY(itemId) != EMPXPlaylist)
+                {
+                User::Leave(KErrNotSupported);
+                }
+
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistUniqueId, itemId);
+            }
+        else if (criterion == KMPXMediaGeneralTitle)
+            {
+            HBufC* title = MPXDbCommonUtil::ProcessPatternCharsLC(
+                aCriteria.ValueText(KMPXMediaGeneralTitle));
+            if( type == EMPXOtherType )
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistTitle, *title);
+                }
+            else
+                {
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistLikeTitle, *title);
+                }
+            CleanupStack::PopAndDestroy(title);
+            }
+        else if (criterion == KMPXMediaGeneralUri)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistUniqueId,
+                MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXPlaylist,
+                aCriteria.ValueText(KMPXMediaGeneralUri), EFalse));
+            }
+        else if (criterion == KMPXMediaGeneralDrive)
+            {
+            const TDesC& drive(aCriteria.ValueText(KMPXMediaGeneralDrive));
+            TDriveUnit driveUnit(drive);
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistVolumeId,
+                MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit));
+            }
+        else if (criterion == KMPXMediaGeneralSynchronized)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistSync,
+                aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized));
+            }
+        else if (criterion == KMPXMediaGeneralCount)
+            {
+            criteriaCounterSet = ETrue;
+            criteriaCounter = aCriteria.ValueTObjectL<TInt>(KMPXMediaGeneralCount);
+            }
+        }
+
+    // construct criteria string
+    HBufC* criteriaStr = MPXDbCommonUtil::StringFromArrayLC(*criteriaArray, KMCAndKeyword);
+
+    HBufC* query(NULL);
+    if (criteriaStr->Length() > 0)
+        {
+        // construct and execute the query
+        query = HBufC::NewLC(KQueryPlaylistItems().Length() + criteriaStr->Length());
+        query->Des().Format(KQueryPlaylistItems, criteriaStr);
+        }
+    else
+        {
+        query = HBufC::NewLC(KQueryPlaylistGetAll().Length());
+        query->Des().Format(KQueryPlaylistGetAll);
+        }
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(criteriaStr);
+    CleanupStack::PopAndDestroy(criteriaArray);
+
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        // Setup basic info - with first record of a group
+        TUint32 playlistId(recordset.ColumnInt64(EPlaylistUniqueId));
+
+        TBool valid(ETrue);
+        TInt songCount(-1);
+        if (criteriaCounterSet)
+            {
+            songCount = iPlaylistSongs->CountL(playlistId);
+            valid = (criteriaCounter == songCount);
+            }
+
+        if (valid)
+            {
+            // start a new media object
+            CMPXMedia* media = CMPXMedia::NewL();
+            CleanupStack::PushL(media);
+
+            UpdateMediaL(recordset, aAttrs, *media);
+
+            aMediaArray.AppendL(*media);
+            CleanupStack::PopAndDestroy(media);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(err);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetDriveIdL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylist::GetDriveIdL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetDriveIdL");
+    return MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+        ExecuteIntQueryL(KQueryPlaylistDriveId, aPlaylistId));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::Songs
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylistSongs& CMPXDbPlaylist::Songs()
+    {
+    return *iPlaylistSongs;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetDrivePlaylistCount
+// ----------------------------------------------------------------------------
+//
+TUint CMPXDbPlaylist::GetDrivePlaylistCountL(TInt aDrive)
+    {
+    TUint count(0);
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,KQueryPlaylistFileCount));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    count = TUint(recordset.ColumnInt64(KMPXTableDefaultIndex));
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetPlaylistUriArrayL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::GetPlaylistUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                          CDesCArray& aUriArr, TInt& aLastID)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetPlaylistUriArrayL");
+
+    HBufC* query = NULL;
+    if(aFromID == 0)
+        {
+        query = HBufC::NewLC(KQueryPlaylistGetFileUris().Length()
+                            + KMCIntegerLen);
+        query->Des().Format(KQueryPlaylistGetFileUris, aRecords);
+        }
+    else
+        {
+        query = HBufC::NewLC(KQueryPlaylistGetFileUrisFrom().Length()
+                            + 2*KMCIntegerLen);
+        query->Des().Format(KQueryPlaylistGetFileUrisFrom, aFromID, aRecords);
+        }
+
+    RSqlStatement playlist_rs(iDbManager.ExecuteSelectQueryL(aDrive,*query));
+
+    CleanupStack::PopAndDestroy(query);
+
+    CleanupClosePushL(playlist_rs);
+
+    TInt lastID = 0;
+    TInt err(KErrNone);
+    while((err = playlist_rs.Next()) == KSqlAtRow)
+        {
+        HBufC* fullPath = MPXDbCommonUtil::CreateFullPathL(aDrive,
+                MPXDbCommonUtil::GetColumnTextL(playlist_rs, KColUri));
+        CleanupStack::PushL(fullPath);
+        aUriArr.AppendL(*fullPath);
+        CleanupStack::PopAndDestroy(fullPath);
+
+        lastID = playlist_rs.ColumnInt(KColUniqueID);
+        }
+    CleanupStack::PopAndDestroy(&playlist_rs);
+
+    aLastID = lastID;
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::UpdateMediaL(
+    RSqlStatement& aRecord,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdateMediaL");
+
+    TBool countRequested(EFalse);
+	TBool durationRequested(EFalse);
+    TUint32 playlistId(aRecord.ColumnInt64(EPlaylistUniqueId));
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            if (attributeId & EMPXMediaGeneralId)
+                {
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, playlistId);
+                MPX_DEBUG2("    Playlist ID[%u]", playlistId);
+                }
+            if (attributeId & EMPXMediaGeneralCollectionId)
+                {
+                aMedia.SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId,
+                    TUid::Uid(KDBPluginUid));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                TPtrC title(MPXDbCommonUtil::GetColumnTextL(aRecord, EPlaylistName));
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle, title);
+                MPX_DEBUG2("    Title[%S]", &title);
+                }
+            if ((attributeId & EMPXMediaGeneralUri) ||
+                (attributeId & EMPXMediaGeneralDrive) ||
+                (attributeId & EMPXMediaGeneralFlags))
+                {
+                TUint32 volId(aRecord.ColumnInt64(EPlaylistVolumeId));
+                TInt driveId = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId);
+
+                // LTAN-7GH6BZ, crash if eject memory card when adding song to existing playlist
+                // due to special timing issue, it is possible drive number is -1 and create a
+                // panic when use for TDriveUnit
+                MPX_DEBUG3("volId = %d, driveId = %d", volId, driveId);
+
+                // handle possibly delay from framework notification
+                if (driveId < 0)
+                    {
+                    MPX_DEBUG1("invalid driveId, leave with KErrNotReady");
+                    User::Leave(KErrNotReady);
+                    }
+
+                TDriveUnit driveUnit(driveId);
+
+                if (attributeId & EMPXMediaGeneralUri)
+                    {
+                    HBufC* fullPath = MPXDbCommonUtil::CreateFullPathL(driveUnit,
+                        MPXDbCommonUtil::GetColumnTextL(aRecord, EPlaylistUri));
+                    CleanupStack::PushL(fullPath);
+                    aMedia.SetTextValueL(KMPXMediaGeneralUri, *fullPath);
+                    MPX_DEBUG2("    URI[%S]", fullPath);
+                    CleanupStack::PopAndDestroy(fullPath);
+                    }
+                if (attributeId & EMPXMediaGeneralDrive)
+                    {
+                    aMedia.SetTextValueL(KMPXMediaGeneralDrive, driveUnit.Name());
+                    }
+                if (attributeId & EMPXMediaGeneralFlags)
+                    {
+                    TUint32 dbFlags(aRecord.ColumnInt64(EPlaylistDbFlag));
+                    TInt driveId = driveUnit & KMPXMediaGeneralFlagsDriveInfo;  // 5 bits
+                    aMedia.SetTObjectValueL<TUint>(KMPXMediaGeneralFlags, dbFlags | driveId);
+                    }
+                }
+            if (attributeId & EMPXMediaGeneralSynchronized)
+                {
+                aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralSynchronized,
+                    aRecord.ColumnInt(EPlaylistSync));
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+                // make sure the PlaylistSongs query is executed after all fields
+                // from the current record have been processed, otherwise the recordset
+                // may point to something else
+                countRequested = ETrue;
+                }
+            if (attributeId & EMPXMediaGeneralDate)
+                {
+                // convert the time from the internal DB string format
+                // to the int64 format used by TTime
+                aMedia.SetTObjectValueL<TInt64>(KMPXMediaGeneralDate,
+                    MPXDbCommonUtil::DesToTTimeL(
+                    MPXDbCommonUtil::GetColumnTextL(aRecord, EPlaylistTime)).Int64());
+                }
+			if ( attributeId & EMPXMediaGeneralDuration )
+				{		        
+				// make sure the PlaylistSongs query is executed after all fields
+				// from the current record have been processed, otherwise the recordset
+				// may point to something else				
+
+				durationRequested = ETrue;
+				}
+            } // end if contentId == KMPXMediaIdGeneral
+        } // end for
+
+    if (countRequested)
+        {
+		TInt count = iPlaylistSongs->CountL(playlistId);
+        aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount,
+            count );
+        
+        MPX_DEBUG1("    EMPXMediaGeneralCount");
+		MPX_DEBUG2("	Count[%d]", count);				
+        }
+	if (durationRequested)
+		{
+		TInt duration = iObserver.HandlePlaylistDurationL(playlistId);		
+		aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+		
+		MPX_DEBUG1("    EMPXMediaGeneralDuration");
+		MPX_DEBUG2("	Duration[%d]", duration);				
+		}
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXPlaylist);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetPlaylistRecordL
+// ----------------------------------------------------------------------------
+//
+RSqlStatement CMPXDbPlaylist::GetPlaylistRecordL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetPlaylistRecordL");
+    return iDbManager.ExecuteSelectQueryL(KQueryPlaylistGet, aPlaylistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DoAddPlaylistL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlaylist::DoAddPlaylistL(
+    const CMPXMedia& aMedia,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DoAddPlaylistL");
+
+    const TDesC& playlistName(aMedia.ValueText(KMPXMediaGeneralTitle));
+    const TDesC& playlistUri(aMedia.ValueText(KMPXMediaGeneralUri));
+
+    TUint32 playlistId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXPlaylist, playlistUri, EFalse));
+    const CMPXMediaArray* mediaArray = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+    if( !mediaArray )
+        {
+        User::Leave( KErrNoMemory );
+        }
+    // add the songs to the PlaylistSongs table
+    TInt count(mediaArray->Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        iPlaylistSongs->AddSongL(playlistId, i, *mediaArray->AtL(i), aDriveId);
+        }
+
+    // determine the value of DbFlag
+    TUint dbflags(0);
+    if (aMedia.IsSupported(KMPXMediaGeneralFlags))
+        {
+        TUint flag(aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags));
+        if (flag & KMPXMediaGeneralFlagsSetOrUnsetBit )
+            {
+            // Set flag
+            dbflags |= flag;
+            MPX_DEBUG2("    GeneralFlags[%b]", dbflags);
+            }
+        }
+
+    // add playlist record
+    HBufC* time = MPXDbCommonUtil::CurrentTimeDesLC();
+    HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(playlistName);
+    HBufC* uri = MPXDbCommonUtil::ProcessSingleQuotesLC(playlistUri);
+    TPtrC uriPtr(uri->Mid(KMCPathStartPos));
+    TPtrC namePtr(name->Left(KMCMaxTextLen));
+
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistInsert, playlistId, &namePtr,
+        &uriPtr, MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), aDriveId),
+        dbflags, time);
+
+    CleanupStack::PopAndDestroy(uri);
+    CleanupStack::PopAndDestroy(name);
+    CleanupStack::PopAndDestroy(time);
+
+    return playlistId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DoUpdatePlaylistL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DoUpdatePlaylistL(
+    TUint32 aPlaylistId,
+    const CMPXMedia& aMedia,
+    TInt aDriveId,
+    CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DoUpdatePlaylistL");
+
+    // construct the criteria array
+    const TArray<TMPXAttribute> attributes = aMedia.Attributes();
+
+    CDesCArrayFlat* criteriaArray = new (ELeave) CDesCArrayFlat(attributes.Count());
+    CleanupStack::PushL(criteriaArray);
+
+    TInt attrCount(attributes.Count());
+    for (TInt index = 0; index < attrCount; ++index)
+        {
+        TInt contentId(attributes[index].ContentId());
+        TUint attributeId(attributes[index].AttributeId());
+
+        switch(contentId)
+            {
+            case KMPXMediaIdGeneral:
+                {
+                if (attributeId & EMPXMediaGeneralTitle)
+                    {
+                    MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistTitle,
+                        aMedia.ValueText(KMPXMediaGeneralTitle));
+                    }
+                if (attributeId & EMPXMediaGeneralUri)
+                    {
+                    const TDesC& uri(aMedia.ValueText (KMPXMediaGeneralUri));
+
+                    // determine if we are changing URI of an existing playlist.
+                    // if so, update playlist URI + its Id
+                    TUint32 newId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXPlaylist, uri, EFalse));
+
+                    if (aPlaylistId != newId)
+                        {
+                        aMessage.SetTObjectValueL<TMPXItemId>(KMPXMessageMediaGeneralId, newId);
+                        aMessage.SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, aPlaylistId);
+
+                        // Change event handling for renaming a playlist should be like a song
+                        // The item focus should goto the new name of the playlist
+                        // to-do: this should be abstracted from the plugin. framework should
+                        //        have enough info to deal with this scenario, if not, add more
+                        //        info in the message passing back to framework
+                        aMessage.SetTObjectValueL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory,
+                            EMPXSong);
+
+                        // update the PlaylistSongs to reflect playlist id change
+                        iPlaylistSongs->UpdateSongsL(aPlaylistId, newId);
+
+                        // this takes care of processing the single quotes in the URI
+                        MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistUri,
+                            uri.Mid(KMCPathStartPos));
+                        MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistVolumeId,
+                            MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), TDriveUnit(uri)));
+                        MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistUniqueId,
+                            newId);
+                        }
+                    }
+                if (attributeId & EMPXMediaGeneralSynchronized)
+                    {
+                    MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistSync,
+                        aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized));
+                    }
+                }
+                break;
+
+            default:
+                break;
+
+            } // end switch
+        } // end for
+
+    // update the time field to the current time
+    HBufC* time = MPXDbCommonUtil::CurrentTimeDesLC();
+    MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, KCriterionPlaylistTime, *time);
+    CleanupStack::PopAndDestroy(time);
+
+    // construct a string from all criteria
+    HBufC* criteria = MPXDbCommonUtil::StringFromArrayLC(*criteriaArray, KMCCommaSign);
+
+    // execute the query
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistUpdate, criteria, aPlaylistId);
+
+    CleanupStack::PopAndDestroy(criteria);
+    CleanupStack::PopAndDestroy(criteriaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::UpdatePlaylistsForSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::UpdatePlaylistsForSongL(
+    TUint32 aSongId,
+    CMPXMessageArray* aItemChangedMessages, TBool& aSongInPlaylists)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdatePlaylistsForSongL");
+
+    aSongInPlaylists = EFalse;
+    if (aItemChangedMessages)
+        {
+        // get all playlists for the song
+        RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPlaylistGetForSong, aSongId));
+        CleanupClosePushL(recordset);
+
+        // ignore the errors
+        while (recordset.Next() == KSqlAtRow)
+            {
+            aSongInPlaylists = ETrue;
+            // add item changed messages for all of them
+            MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages,
+                recordset.ColumnInt64(KMPXTableDefaultIndex), EMPXItemModified,
+                EMPXPlaylist, KDBPluginUid);
+            }
+
+        CleanupStack::PopAndDestroy(&recordset);
+        }
+    if (aSongInPlaylists)
+        {
+        // update the time for all playlists that contain this song
+        HBufC* time = MPXDbCommonUtil::CurrentTimeDesLC();
+        iDbManager.ExecuteQueryL (KDbManagerAllDrives,
+                KQueryPlaylistUpdateTimeForSong, time, aSongId);
+        CleanupStack::PopAndDestroy (time);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::UpdatePlaylistTimeL(
+    TUint32 aPlaylistId,
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdatePlaylistTimeL");
+
+    HBufC* time = MPXDbCommonUtil::CurrentTimeDesLC();
+    iDbManager.ExecuteQueryL(aDrive, KQueryPlaylistUpdateTime, time, aPlaylistId);
+    CleanupStack::PopAndDestroy(time);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::GetDrivePlaylistDuration
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylist::GetDrivePlaylistDuration(TUint32 aPlaylistId)
+    {
+    return 0;
+    }
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbPlaylist::CreateTableL");
+
+    // create the table
+    User::LeaveIfError(aDatabase.Exec(KPlaylistCreateTable));
+
+    // create the index on the Name field
+    User::LeaveIfError(aDatabase.Exec(KPlaylistNameIndex));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylist::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DropTableL");
+    User::LeaveIfError(aDatabase.Exec(KPlaylistDropTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylist::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylist::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbPlaylist::CheckTableL");
+    return DoCheckTable(aDatabase, KPlaylistCheckTable);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbplaylistsongs.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,832 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interaction with the PlaylistSongs and
+*                PlaylistSongInfo tables.
+*
+*/
+
+
+// INCLUDE FILES
+#include <f32file.h>
+#include <mpxlog.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include "mpxdbcommonutil.h"
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbutil.h"
+#include "mpxdbpluginqueries.h"
+#include "mpxdbmanager.h"
+#include "mpxdbplaylistsongs.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylistSongs* CMPXDbPlaylistSongs::NewL(
+    CMPXDbManager& aDbManager)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::NewL");
+
+    CMPXDbPlaylistSongs* self = CMPXDbPlaylistSongs::NewLC(aDbManager);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylistSongs* CMPXDbPlaylistSongs::NewLC(
+    CMPXDbManager& aDbManager)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::NewLC");
+
+    CMPXDbPlaylistSongs* self = new (ELeave) CMPXDbPlaylistSongs(aDbManager);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylistSongs::~CMPXDbPlaylistSongs()
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::~CMPXDbPlaylistSongs");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlaylistSongs::CMPXDbPlaylistSongs(
+    CMPXDbManager& aDbManager) :
+    CMPXDbTable(aDbManager)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::CMPXDbPlaylistSongs");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::ConstructL()
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::ConstructL");
+    BaseConstructL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::AddSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::AddSongsL(
+    TUint32 aPlaylistId,
+    const CMPXMediaArray& aMediaArray,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::AddSongsL");
+
+    TInt count(aMediaArray.Count());
+    for (TInt index = 0; index < count; ++index)
+        {
+        AddSongL(aPlaylistId, *(aMediaArray[index]), aDriveId);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::AddSongL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlaylistSongs::AddSongL(
+    TUint32 aPlaylistId,
+    const CMPXMedia& aMedia,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::AddSongL");
+    return AddSongL(aPlaylistId, CountL(aPlaylistId), aMedia, aDriveId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::AddSongL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlaylistSongs::AddSongL(
+    TUint32 aPlaylistId,
+    TInt aOrdinal,
+    const CMPXMedia& aMedia,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::AddSongL");
+
+    // the UniqueId field is AUTOINCREMENT and its value is going to be generated
+    // automatically by the database - no need to supply it here
+    TUint32 songId((aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2);
+
+    // insert PlaylistSongs record
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsInsert, aPlaylistId, songId, aOrdinal);
+
+    // if the song is not already in the PlaylistSongInfo table - add it
+    if (!SongInfoExistsL(aDriveId, songId))
+        {
+        // add a new song info record
+        HBufC* uri = MPXDbCommonUtil::ProcessSingleQuotesLC(aMedia.ValueText(KMPXMediaGeneralUri));
+        HBufC* title = MPXDbCommonUtil::ProcessSingleQuotesLC(aMedia.ValueText(KMPXMediaGeneralTitle));
+
+        TUint32 dbFlag(0);
+        if (aMedia.IsSupported(KMPXMediaGeneralFlags))
+            {
+            dbFlag = (aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags));
+            dbFlag = dbFlag & (~KMPXMediaGeneralFlagsDriveInfo); // clear drive info
+            }
+
+        // add the URI without the drive letter
+        TPtrC uriPtr(uri->Mid(KMCPathStartPos));
+        iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongInfoInsert, songId, &uriPtr, title,
+            MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), TDriveUnit(*uri)), dbFlag);
+
+        CleanupStack::PopAndDestroy(title);
+        CleanupStack::PopAndDestroy(uri);
+        }
+
+    return songId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::UpdateSongL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::UpdateSongL(
+    TUint32 aSongId,
+    const CMPXMedia& aMedia,
+    TBool aResetFlags,
+    TBool& aUpdated)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::UpdateSongL");
+
+    aUpdated = EFalse;
+    TBool visibleChange(EFalse);
+
+    // get the current record
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPlaylistSongInfoGet, aSongId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() == KSqlAtRow)
+        {
+        const TArray<TMPXAttribute> attributes = aMedia.Attributes();
+
+        // stores the current song ID, which may change during execution
+        TUint32 songId(aSongId);
+
+        TInt attrCount(attributes.Count());
+        for (TInt i = 0; i < attrCount; ++i)
+            {
+            TInt contentId(attributes[i].ContentId());
+            TUint attributeId(attributes[i].AttributeId());
+
+            switch(contentId)
+                {
+                case KMPXMediaIdGeneral:
+                    {
+                    if (attributeId & EMPXMediaGeneralTitle)
+                        {
+                        // existing title
+                        TPtrC title(aMedia.ValueText(KMPXMediaGeneralTitle).Left(KMCMaxTextLen));
+
+                        // compare with the old title
+                        if (title.Compare(MPXDbCommonUtil::GetColumnTextL(recordset, EPlaylistSongInfoTitle)) != 0)
+                            {
+                            HBufC* titleProc = MPXDbCommonUtil::ProcessSingleQuotesLC(title);
+
+                            // title has changed - update on all drives
+                            iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongInfoUpdateTitle,
+                                titleProc, songId);
+
+                            CleanupStack::PopAndDestroy(titleProc);
+
+                            visibleChange = ETrue;
+                            aUpdated = ETrue;
+                            MPX_DEBUG2("    Title[%S]", &title);
+                            }
+                        }
+
+                    if (attributeId & EMPXMediaGeneralUri)
+                        {
+                        const TDesC& uriOrig(aMedia.ValueText(KMPXMediaGeneralUri));
+                        songId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection, uriOrig, EFalse);
+
+                        if (aSongId != songId)
+                            {
+                            // URI of the song has been changed. This changes the Id of the song and both the
+                            // PlaylistSongs and PlaylistSongInfo tables should be updated accordingly.
+
+                            HBufC* uri = MPXDbCommonUtil::ProcessSingleQuotesLC(uriOrig);
+
+                            // use the URI without the drive letter
+                            TPtrC uriPtr(uri->Mid(KMCPathStartPos));
+
+                            // update the PlaylistSongInfo table on all drives
+                            iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongInfoUpdate, songId,
+                                &uriPtr, MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), TDriveUnit(*uri)), aSongId);
+
+                            // update the PlaylistSongs table on all drives
+                            iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsUpdate, songId,
+                                aSongId);
+
+                            aUpdated = ETrue;
+                            MPX_DEBUG3("    CurrentSongId[0x%x] changed to [0x%x]", aSongId, songId);
+
+                            CleanupStack::PopAndDestroy(uri);
+                            }
+                        }
+
+                    if (attributeId & EMPXMediaGeneralFlags)
+                        {
+                        TUint flag(aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags));
+                        TUint32 curFlag(recordset.ColumnInt64(EPlaylistSongInfoDbFlag));
+
+                        if (flag & KMPXMediaGeneralFlagsSetOrUnsetBit)
+                            {
+                            if (aResetFlags)
+                                {
+                                visibleChange = ETrue;
+                                curFlag = flag;
+                                }
+                            else
+                                {
+                                // Set flag, visible change is true only if the flag status is changing
+                                visibleChange = visibleChange || ((curFlag^flag) & 0x7FFFFFFF);
+                                curFlag |= flag;
+                                }
+                            }
+                        else
+                            {
+                            // Clear flag, visible change is true only if the flag status is changing
+                            visibleChange = visibleChange || (((curFlag^0xFFFFFFFF)^flag) & 0x7FFFFFFF);
+                            curFlag &= (~flag);
+                            }
+
+                        if (visibleChange)
+                            {
+                            // update the flags on all drives
+                            iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongInfoUpdateFlags,
+                                curFlag, songId);
+                            aUpdated = ETrue;
+                            }
+
+                        MPX_DEBUG2("    GeneralFlags[%b]", curFlag);
+                        }
+                    } // end case
+                } // end switch
+            } // end for
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    return visibleChange;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::UpdateSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::UpdateSongsL(
+    TUint32 aPlaylistId,
+    TUint32 aNewPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::UpdateSongsL");
+
+    // update the PlaylistSongs table on all drives
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsUpdatePlaylistId,
+        aNewPlaylistId, aPlaylistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::ReorderSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::ReorderSongL(
+    const TMPXItemId& aPlaylistId,
+    const TMPXItemId& aSongId,
+    TUint aOriginalOrdinal,
+    TUint aNewOrdinal)
+    {
+    MPX_DEBUG1("-->CMPXDbPlaylistSongs::ReorderSongL");
+    MPX_DEBUG5("    playlist[0x%x, 0x%x], song[0x%x, 0x%x]",
+               aPlaylistId.iId1, aPlaylistId.iId2, aSongId.iId1, aSongId.iId2);
+
+    //
+    // Move the song up. The rest of the songs in between the old ordinal and new ordinal
+    // need to be moved down, i.e. their ordinals need to be incremented
+    //
+    if (aOriginalOrdinal > aNewOrdinal)
+        {
+        iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsMoveSongUp,
+            aPlaylistId.iId2, aNewOrdinal, aOriginalOrdinal);
+        }
+
+    //
+    // Move the song down. The rest of the songs in between the old ordinal and new ordinal
+    // need to be moved up, i.e. their ordinals need to be decremented
+    //
+    else if (aOriginalOrdinal < aNewOrdinal)
+        {
+        iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsMoveSongDown,
+            aPlaylistId.iId2, aNewOrdinal, aOriginalOrdinal);
+        }
+
+    //
+    // Change the ordinal of the song itself. If the ordinal is unchanged, no update is
+    // required
+    //
+    if (aOriginalOrdinal != aNewOrdinal)
+        {
+        iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsUpdateSongOrdinal,
+            aNewOrdinal, aSongId.iId1);
+        }
+
+    MPX_DEBUG1("<--CMPXDbPlaylistSongs::ReorderSongL");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteSongL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::DeleteSongL");
+
+    // delete from the PlaylistSongs table on all drives
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsDelete, aSongId);
+
+    // delete from the PlaylistSongInfo table on all drives
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongInfoDelete, aSongId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteSongL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteSongL(
+    TUint32 aPlaylistId,
+    TUint32 aSongId,
+    TInt aOrdinal,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongL");
+
+    // get the number of instances for the song in the playlist
+    TInt count(SongInstanceCountL(aPlaylistId, aSongId));
+
+    if (1 == count)
+        {
+        // just one instance with this ID in the playlist
+        // delete it regardless of the ordinal
+        iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsDeleteSong, aPlaylistId, aSongId);
+
+        // check how many instances of this song are left for all playlists
+        if (!SongCountL(aSongId))
+            {
+            // delete the PlaylistSongInfo record
+            iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongInfoDelete, aSongId);
+            }
+        }
+    else if (count > 1)
+        {
+        // multiple songs with this id in the playlist
+        // try to delete the one with the specified ordinal
+        iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsDeleteSongOrdinal, aPlaylistId,
+            aSongId, aOrdinal);
+        }
+    else
+        {
+        // no such song in the playlist
+        User::Leave(KErrCorrupt);
+        }
+    // adjust song ordinals for the songs after the deleted song
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsUpdateSongOrdinalAfterDelete,
+        aPlaylistId, aOrdinal);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteSongsL(
+    TUint32 aPlaylistId,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongsL");
+
+    // delete the records from the PlaylistSongs table
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsDeletePlaylist, aPlaylistId);
+
+    // delete the unused records from the PlaylistSongInfo table
+    CleanupSongInfoL(aDriveId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteSongsForCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteSongsForCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongsForCategoryL");
+
+    // get the category field name in the Music table
+    TPtrC category = MPXDbUtil::MusicFieldNameForCategoryL(aCategory);
+
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsDeleteForCategory,
+        &category, aCategoryId);
+
+    // delete the unused records from the PlaylistSongInfo table
+    CleanupSongInfoL(aDriveId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteSongsForArtistAndAlbumL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteSongsForArtistAndAlbumL(
+    TUint32 aArtistId,
+    TUint32 aAlbumId,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteSongsForArtistAndAlbumL");
+
+    // delete the songs in the PlaylisSongs table
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongsDeleteForArtistAlbum,
+        aArtistId, aAlbumId);
+
+    // delete the unused records from the PlaylistSongInfo table
+    CleanupSongInfoL(aDriveId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DeleteAllSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DeleteAllSongsL()
+    {
+    MPX_FUNC("CMPXDbPlaylist::DeleteAllSongsL");
+
+    // delete all records from the PlaylistSongs table, all drives
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongsDeleteAll);
+
+    // delete all records from the PlaylistSongInfo table, all drives
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPlaylistSongInfoDeleteAll);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::GetSongsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::GetSongsL(
+    TUint32 aPlaylistId,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_DEBUG2("-->CMPXDbPlaylistSongs::GetSongsL(playlist 0x%x)", aPlaylistId);
+
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL( attributes );
+
+    attributes.AppendL(KMPXMediaGeneralType);
+    attributes.AppendL(KMPXMediaGeneralCategory);
+    attributes.AppendL(KMPXMediaGeneralId);
+    
+    // cannot execute a joined query to the music table
+    // because the song records in the music table may be on a different drive
+    ExecuteMediaQueryL(attributes.Array(), aMediaArray, KQueryPlaylistSongsGetSongs, aPlaylistId);
+
+    CleanupStack::PopAndDestroy(&attributes);
+
+    MPX_DEBUG1("<--CMPXDbPlaylistSongs::GetSongsL");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::GetSongsL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::GetSongsL(
+    TUint32 aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_DEBUG2("-->CMPXDbPlaylistSongs::GetSongsL(playlist 0x%x)", aPlaylistId);
+    TBool valid(EFalse);
+    
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPlaylistSongsGetSongsInfo,
+    		aPlaylistId));
+    CleanupClosePushL(recordset);
+
+    TInt err(KErrNone);
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        UpdateMediaL(recordset, aAttrs, *media);
+
+        aMediaArray.AppendL(*media);
+        CleanupStack::PopAndDestroy(media);
+        }
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    else
+    	{
+    	valid = ETrue;
+    	}
+
+    MPX_DEBUG1("<--CMPXDbPlaylistSongs::GetSongsL");
+    return valid;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::GetSongL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::GetSongL(
+    TUint32 aPlaylistId,
+    TUint32 aSongId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetSongL");
+
+    // get the song
+    TBool valid(EFalse);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPlaylistSongsGetSong,
+        aPlaylistId, aSongId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() == KSqlAtRow)
+        {
+        // convert to media
+        UpdateMediaL(recordset, aAttrs, aMedia);
+        valid = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return valid;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::GetSongL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::GetSongL(
+    const TMPXItemId& aSongId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia*& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::GetSongL");
+
+    // get the song
+    TBool valid(EFalse);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPlaylistSongsGetSongInfo,
+        aSongId.iId1, aSongId.iId2));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() == KSqlAtRow)
+        {
+        // convert to media
+        aMedia = CMPXMedia::NewL();
+        CleanupStack::PushL(aMedia);
+        UpdateMediaL(recordset, aAttrs, *aMedia);
+        CleanupStack::Pop(aMedia);
+        valid = ETrue;
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return valid;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::CountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylistSongs::CountL(
+    TUint32 aPlaylistId)
+    {
+    MPX_FUNC("CMPXDbPlaylist::CountL");
+    return ExecuteSumQueryL(KQueryPlaylistSongsCount, aPlaylistId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::UpdateMediaL(
+    RSqlStatement& aRecord,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlaylist::UpdateMediaL");
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXSong);
+    aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, TMPXItemId(
+        aRecord.ColumnInt64(EPlaylistSongsUniqueId),
+        aRecord.ColumnInt64(EPlaylistSongsSongId)));
+
+/*
+    aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+        aRecord.ColumnInt64(EPlaylistSongsSongId));
+*/
+    TInt count(aAttrs.Count());
+    for (TInt index = 0; index < count; ++index)
+        {
+        TInt contentId(aAttrs[index].ContentId());
+        TUint attributeId(aAttrs[index].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            if (attributeId & EMPXMediaGeneralCollectionId)
+                {
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralCollectionId,
+                    aRecord.ColumnInt64(EPlaylistSongsPlaylistId));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                TPtrC title(MPXDbCommonUtil::GetColumnTextL(aRecord, EPlaylistSongsTitle));
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle, title);
+                MPX_DEBUG2("    Title[%S]", &title);
+                }
+            if (attributeId & EMPXMediaGeneralUri)
+                {
+                TUint volId(aRecord.ColumnInt64(EPlaylistSongsVolumeId));
+                HBufC* uri = MPXDbCommonUtil::CreateFullPathL(
+                    MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId),
+                    MPXDbCommonUtil::GetColumnTextL(aRecord, EPlaylistSongsUri));
+                CleanupStack::PushL(uri);
+
+                aMedia.SetTextValueL(KMPXMediaGeneralUri, *uri);
+
+                MPX_DEBUG2("    URI[%S]", uri);
+                CleanupStack::PopAndDestroy(uri);
+                }
+            if (attributeId & EMPXMediaGeneralFlags)
+                {
+                // assuming song details shouldn't be available for this song
+                TUint32 dbFlags(aRecord.ColumnInt64(EPlaylistSongsDbFlag) |
+                                KMPXMediaGeneralFlagsIsMissingDetails);
+                TUint32 volId(aRecord.ColumnInt64(EPlaylistSongsVolumeId));
+                TDriveUnit driveUnit(EDriveC);
+                if (aMedia.IsSupported(KMPXMediaGeneralUri))
+                    {
+                    // ignore the return value
+                    MPXDbCommonUtil::GetDriveL(aMedia.ValueText(KMPXMediaGeneralUri), driveUnit);
+                    }
+                else
+                    {
+                    driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId);
+                    }
+
+                // the volume the playlist song is located on may be removed
+                if (~dbFlags & KMPXMediaGeneralFlagsIsInvalid)
+                    {
+                    if (((volId != 0) && (MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), volId) == KErrNotFound)) ||
+                        ((volId == 0) && (MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit) == 0)))
+                        {
+                        dbFlags |= KMPXMediaGeneralFlagsIsInvalid;
+                        }
+                    }
+
+                TInt driveId(driveUnit & KMPXMediaGeneralFlagsDriveInfo);  // 5 bits
+                aMedia.SetTObjectValueL<TUint>(KMPXMediaGeneralFlags, dbFlags | driveId);
+                MPX_DEBUG2("    GeneralFlags[%b]", dbFlags | driveId);
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::SongInstanceCountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylistSongs::SongInstanceCountL(
+    TUint32 aPlaylistId,
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::SongInstanceCountL");
+    return ExecuteSumQueryL(KQueryPlaylistSongsPlaylistSongCount, aPlaylistId, aSongId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::SongCountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlaylistSongs::SongCountL(
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::SongCountL");
+    return ExecuteSumQueryL(KQueryPlaylistSongsSongCount, aSongId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::SongInfoExistsL
+// The song info record must be in the same database as the corresponding
+// PlaylistSongs record(s), otherwise when adding a duplicate of a song on a
+// different drive this method will return true and the song info record won't
+// be created.
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::SongInfoExistsL(
+    TInt aDriveId,
+    TUint32 aSongId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::SongInfoExistsL");
+
+    RSqlStatement recordset(
+        iDbManager.ExecuteSelectQueryL(aDriveId, KQueryPlaylistSongInfoExists, aSongId));
+    TBool exists(recordset.Next() == KSqlAtRow);
+    recordset.Close();
+    return exists;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::CleanupSongInfoL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::CleanupSongInfoL(
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::CleanupSongInfoL");
+    iDbManager.ExecuteQueryL(aDriveId, KQueryPlaylistSongInfoCleanup);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::CreateTableL");
+
+    // create the PlaylistSongs table
+    User::LeaveIfError(aDatabase.Exec(KPlaylistSongsCreateTable));
+
+    // create the PlaylistSongInfo table
+    User::LeaveIfError(aDatabase.Exec(KPlaylistSongInfoCreateTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlaylistSongs::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::DropTableL");
+
+    // drop the PlaylistSongs table
+    User::LeaveIfError(aDatabase.Exec(KPlaylistSongsDropTable));
+
+    // drop the PlaylistSongInfo table
+    User::LeaveIfError(aDatabase.Exec(KPlaylistSongInfoDropTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlaylistSongs::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlaylistSongs::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbPlaylistSongs::CheckTableL");
+
+    // check the PlaylistSongs table
+    TBool check = DoCheckTable(aDatabase, KPlaylistSongsCheckTable);
+
+    // check the PlaylistSongInfo table
+    return check && DoCheckTable(aDatabase, KPlaylistSongInfoCheckTable);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4405 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of collection DB Plugin interface
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32cmn.h>
+#include <StringLoader.h>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+
+#include <mpxcmn.h>
+#include <mpxuser.h>
+#include <mpxcollectionpluginobserver.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxmessagecontainerdefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxincrementalopendefs.h>
+#include <mpxcollectionopenlresultdef.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxdrmmediautility.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxlog.h>
+#include <mpxcollectiondbres.rsg>
+#include <mpxdbplugin.mbg>
+#include <centralrepository.h>
+
+#ifdef RD_MULTIPLE_DRIVE
+#include <driveinfo.h>
+#endif //RD_MULTIPLE_DRIVE
+
+#include "mpxresource.h"
+#include "mpxdbcommondef.h"
+#include "mpxdbcommonutil.h"
+
+#include "mpxdbhandler.h"
+#include "mpxdbutil.h"
+#include "mpxcollectiondbdef.h"
+#include "mpxdbplugin.h"
+
+// CONSTANTS
+_LIT(KMPlayerDbPluginMbmFile, "mpxdbplugin.mif");
+const TInt KFirstFetchCount = 400;
+
+const TUid KCRUIDMusicPlayerFeatures = { 0x101FFCD0 };
+const TInt KMusicPlayerFeatures = 1;
+const TInt KDisablePodcasting = 0x80;
+
+const TInt KIncrementalDeleteCount = 400;
+
+const TInt KSQLErrGeneral = -311; // SQL General error. Don't want to include sql header here
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlugin* CMPXDbPlugin::NewL(
+    TAny* /*aInitParams*/)
+    {
+    MPX_FUNC("CMPXDbPlugin::NewL");
+
+    CMPXDbPlugin* self = new (ELeave) CMPXDbPlugin();
+    CleanupStack::PushL (self);
+    self->ConstructL ();
+    CleanupStack::Pop (self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlugin::~CMPXDbPlugin()
+    {
+    MPX_FUNC("CMPXDbPlugin::~CMPXDbPlugin");
+
+    iSelections.Reset();
+    iSelections.Close();
+    iFs.Close();
+    delete iDbHandler;
+    delete iDrmMediaUtility;
+    if (iResource)
+        {
+        iResource->Release();
+        }
+    iMusicLibraryMenuIds.Close();
+    delete iMusicLibraryMenuTitles;
+    delete iMusicLibraryTitles;
+    delete iAllSongsForArtistTitle;
+    delete iMusicMenuTitle;
+
+    if (iActiveTask)
+        {
+        iActiveTask->Cancel();
+        delete iActiveTask;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPlugin::CMPXDbPlugin()
+    {
+    MPX_FUNC("CMPXDbPlugin::CMPXDbPlugin");
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::ConstructL()
+    {
+    MPX_FUNC("CMPXDbPlugin::ConstructL");
+    iFirstDeleteStep = ETrue;
+    User::LeaveIfError(iFs.Connect());
+    iDrmMediaUtility = CMPXDrmMediaUtility::NewL();
+
+    TParse parse;
+    parse.Set( KMPXCollectionDbResourceFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resFile(parse.FullName());
+    User::LeaveIfError(MPXUser::CompleteWithDllPath(resFile));
+    BaflUtils::NearestLanguageFile(iFs, resFile);
+    iResource = CMPXResource::NewL(resFile);
+
+    iDbHandler = CMPXDbHandler::NewL(iFs, *iResource);
+    iMusicLibraryMenuTitles = iResource->ReadMenuArrayL(R_MC_MENU_ITEMS_ARRAY, iMusicLibraryMenuIds);
+    iMusicLibraryTitles = iResource->ReadMenuArrayL(R_MC_TITLE_ITEMS_ARRAY, iMusicLibraryMenuIds );
+    iAllSongsForArtistTitle = iResource->ReadHBufCL(R_MC_ALL_SONGS_FOR_ARTIST);
+
+#ifdef __ENABLE_MUSIC_TEXT_ALIGNMENT
+    iMusicMenuTitle = iResource->ReadHBufCL(R_MPX_QTN_MP_TITLE_MY_MUSIC_MENU_NSERIES);
+#else
+    iMusicMenuTitle = iResource->ReadHBufCL(R_MPX_QTN_MUS_TITLE_MUSIC_MENU);
+#endif // __ENABLE_MUSIC_TEXT_ALIGNMENT
+
+    iActiveTask = CMPXDbActiveTask::NewL(*this);
+
+    CRepository* cenrep(NULL);
+    TRAPD( err, cenrep = CRepository::NewL( KCRUIDMusicPlayerFeatures ) );
+    if( err == KErrNone )
+        {
+        TInt val(0);
+        cenrep->Get( KMusicPlayerFeatures, val );
+        iDisablePodcasting = val&KDisablePodcasting ? ETrue:EFalse;
+        delete cenrep;
+        }
+    else
+        {
+        iDisablePodcasting = EFalse;
+        }
+    iAllSongsValid = ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// Navigates to the given path
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::OpenL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& /*aAttrs*/,
+    CMPXFilter* aFilter)
+    {
+    MPX_FUNC("CMPXDbPlugin::OpenL");
+    MPX_DEBUG_PATH(aPath);
+    //Create a path object to be returned.
+    CMPXCollectionPath* path = CMPXCollectionPath::NewL(aPath);
+    CleanupStack::PushL(path);
+    RArray<TMPXAttribute> openAttrs;
+    CleanupClosePushL(openAttrs);
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+
+    // Replace the attributes requested by the client with the ones below.
+    // This will eventually have to be fixed
+    SetAttributesL(aPath, openAttrs, supportedIds);
+
+    CMPXMedia* entries = CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entries);
+    //Add returned path into media
+    entries->SetTObjectValueL<TInt>(KMPXMediaGeneralValue, (TInt)path);
+
+    TInt error(KErrNone);
+    TBool isASong(EFalse);
+    CMPXCollectionPath* newPath(NULL);
+
+    // Make sure we handle open the correct open mode
+    //
+    TMPXOpenMode openmode = aPath.OpenNextMode();
+    switch (openmode)
+        {
+        case EMPXOpenGroupOrPlaylist:
+            {
+            // Open By Path
+            MPX_TRAP(error, isASong = DoOpenL(aPath, openAttrs.Array(), *entries, aFilter));
+            break;
+            }
+
+        case EMPXOpenPlaylistOnly:
+            {
+            if (aPath.Count() > 0)
+                {
+                // Try to open
+                MPX_TRAP(error, newPath = DoOpenPlaylistL(aPath, openAttrs.Array()));
+                CleanupStack::PushL(newPath);
+                isASong = ETrue;
+                }
+            else // no items
+                {
+                MPX_TRAP(error, isASong = DoOpenL(aPath, openAttrs.Array(), *entries, aFilter));
+                }
+
+            break;
+            }
+
+        default:
+            // do nothing
+            break;
+        }
+
+    // generate the callback
+    if (isASong )
+        {
+        if (openmode == EMPXOpenGroupOrPlaylist)
+            {
+            iObs->HandleOpen(const_cast<CMPXCollectionPath*>(&aPath), error);
+            }
+        else  // openmode == EMPXOpenPlaylistOnly
+            {
+            iObs->HandleOpen(newPath, error);
+            }
+        }
+    else
+        {
+        entries->SetCObjectValueL(KMPXMediaGeneralContainerPath,
+            const_cast<CMPXCollectionPath*>(&aPath));
+        entries->Delete(KMPXMediaGeneralValue);
+        iObs->HandleOpen(entries, path, error);
+        }
+
+    if (newPath)
+        {
+        CleanupStack::PopAndDestroy(newPath);
+        }
+
+    CleanupStack::PopAndDestroy(entries);
+    CleanupStack::PopAndDestroy(&openAttrs);
+    CleanupStack::PopAndDestroy(path);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the extended properties of the current file (async)
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::MediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    const TArray<TCapability>& /*aCaps*/,
+    CMPXAttributeSpecs* /*aSpecs*/)
+    {
+    MPX_FUNC("CMPXDbPlugin::MediaL");
+    MPX_DEBUG_PATH(aPath);
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    if (aPath.Selection().Count())
+        {
+        // it's a container if there are multiple selection, else it's not a container
+        supportedIds.AppendL(KMPXMediaIdContainer);
+        }
+    MPXDbCommonUtil::FillInSupportedUIDsL(aAttrs, supportedIds);
+
+    CMPXMedia* entries = CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entries);
+
+    DoMediaL(aPath, aAttrs, *entries);
+
+    // Also fetch collection details and set the path if required
+    DoHandleOtherMediaAttributesL(aAttrs, aPath, *entries);
+
+    iObs->HandleMedia(entries, KErrNone);
+    CleanupStack::PopAndDestroy(entries);
+    }
+
+// ----------------------------------------------------------------------------
+// Cancel outstanding request
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::CancelRequest()
+    {
+    MPX_FUNC("CMPXDbPlugin::CancelRequest");
+    iActiveTask->Cancel();
+    }
+
+// ----------------------------------------------------------------------------
+// Executes the given command on the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::CommandL(
+    TMPXCollectionCommand aCmd,
+    TInt aArg /* = 0 */)
+    {
+    MPX_FUNC("CMPXDbPlugin::CommandL");
+    MPX_DEBUG2("CMPXDbPlugin::CommandL %d", aCmd);
+    iAllSongsValid = ETrue;
+    switch (aCmd)
+        {
+        case EMcCmdRemoveAll:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcCmdRemoveAll");
+            // Remove EVERYthing from the collection
+            iDbHandler->RemoveEntireCollectionL();
+            break;
+            }
+        case EMcCmdClose:
+        case EMcCloseCollection:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcCloseCollection");
+            // Close the specified database
+            TRAP_IGNORE(iDbHandler->PreCloseCollectionL());
+ #ifdef RD_MULTIPLE_DRIVE
+            MPX_DEBUG1("Multiple drives closing databases");
+            if ( aArg <0)
+                {
+                DriveInfo::TDriveArray driveArray;
+                User::LeaveIfError ( DriveInfo::GetUserVisibleDrives( iFs, driveArray));
+                TInt count( driveArray.Count ());
+                for (TInt i=0; i<count; ++i)
+                    {
+                    MPX_DEBUG2("At drive %i", driveArray[i]);
+                    if (( driveArray[i] != EDriveC) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i])))) 
+                        {
+                        MPX_DEBUG2("Closing database %i", driveArray[i]);
+                        TRAP_IGNORE( iDbHandler->CloseDatabaseL( driveArray[i] ) );
+                        }
+                    }
+                }
+            else
+                {
+                iDbHandler->CloseDatabaseL(aArg);
+                }
+ #else
+            iDbHandler->CloseDatabaseL(aArg);
+ #endif // RD_MULTIPLE_DRIVE
+            iDbHandler->CollectionClosed();
+            break;
+            }
+        case EMcReOpenCollection:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcReOpenCollection");
+            // Open the specified database
+#ifdef RD_MULTIPLE_DRIVE
+            MPX_DEBUG1("Multiple drives opening databases");
+            DriveInfo::TDriveArray driveArray;
+            User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFs, driveArray ) );
+            TInt count( driveArray.Count() );
+            for( TInt i=0; i<count; ++i )
+                {
+                MPX_DEBUG2("At drive %i", driveArray[i]);
+                if( (driveArray[i] != EDriveC)  && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i])))) 
+                    {
+                    TUint driveStatus(0);
+                    User::LeaveIfError( DriveInfo::GetDriveStatus(
+                        iFs, driveArray[i], driveStatus ) );
+                    if( driveStatus & DriveInfo::EDrivePresent )
+                        {
+                        MPX_DEBUG2("Opening database %i", driveArray[i]);
+                        TRAP_IGNORE( iDbHandler->OpenDatabaseL( driveArray[i] ) );
+                        }
+                    }
+                }
+#else
+            iDbHandler->OpenDatabaseL(aArg);
+#endif // RD_MULTIPLE_DRIVE
+            TRAP_IGNORE(iDbHandler->CollectionOpenedL());
+            break;
+            }
+        case EMcRefreshStarted:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcRefreshStarted");
+            iDbHandler->CheckDiskSpaceOnDrivesL();
+            // ask the handler to start a transaction
+            iDbHandler->RefreshStartL();
+            iRefreshing=ETrue;
+            break;
+            }
+        case EMcRefreshEnded:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcRefreshEnded");
+            iDbHandler->CheckDiskSpaceOnDrivesL();
+            // ask the handler to finalize the transaction
+            iDbHandler->RefreshEndL();
+            iRefreshing=EFalse;
+            break;
+            }
+         case EMcCmdReCreateDB:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcCmdReCreateDB");
+            // Recreate all databases
+            iDbHandler->ReCreateDatabasesL();
+            break;
+            }
+         case EMcCmdDbCorrupted:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - EMcCmdDbCorrupted");
+            iDbHandler->SetDBCorruptedL(ETrue);
+            break;
+            }
+        case EMcCmdRefresh:
+        case EMcCmdCollectionInit:
+        case EMcCmdCollectionResyn:
+            {
+            // deprecated
+            break;
+            }
+        case EMcCmdMtpStart:
+            iDbHandler->CheckDiskSpaceOnDrivesL();
+            iMtpInUse = ETrue;
+            iDbHandler->MtpStartL();            
+            break;
+        case EMcCmdMtpEnd:
+            iDbHandler->CheckDiskSpaceOnDrivesL();
+            iMtpInUse = EFalse;
+            iDbHandler->MtpEndL();            
+            break;
+         default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Executes the given command on the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::CommandL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::CommandL");
+
+    if (!aCmd.IsSupported(KMPXCommandGeneralId))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TMPXCommandId commandId = aCmd.ValueTObjectL<TMPXCommandId>(KMPXCommandGeneralId);
+
+    TBool syncOp(EFalse);
+    if (aCmd.IsSupported(KMPXCommandGeneralDoSync))
+        {
+        syncOp = aCmd.ValueTObjectL<TBool>(KMPXCommandGeneralDoSync);
+        }
+
+    // Handle this operation synchronously or asynchronously
+    //
+    if (!syncOp)
+        {
+        iActiveTask->StartL(commandId, aCmd);
+        }
+    else  // Sync operation
+        {
+        switch (commandId)
+            {
+            case KMPXCommandIdCollectionRetrieveUriForDeletion:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionRetrieveUriForDeletion");
+                DoRetrieveUriForDeletionL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionRemove:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionRemove");
+                if ( !iDbHandler->InTransaction() )
+                    {
+                    iDbHandler->BeginTransactionL();
+                    }
+
+                if (iFirstDeleteStep )
+                    {
+                    iFirstDeleteStep = EFalse;
+                    }
+                DoRemovePathL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionRemoveMedia:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionRemoveMedia");
+                DoRemoveMediaL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionCleanupDeletedMedias:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionCleanupDeletedMedias");
+                CleanupDeletedRecordsL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionAdd:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectioAdd");
+                CMPXMedia* media = aCmd.Value<CMPXMedia>(KMPXCommandColAddMedia);
+                User::LeaveIfNull( media );
+                TUint32 id(DoAddL(*media));
+                aCmd.SetTObjectValueL<TMPXItemId>(KMPXCommandColAddRtnId, id);
+                break;
+                }
+            case KMPXCommandIdCollectionSet:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionSet");
+                CMPXMedia* media = aCmd.Value<CMPXMedia>(KMPXCommandColSetMedia);
+                User::LeaveIfNull( media );
+                DoSetL(*media);
+                break;
+                }
+            case KMPXCommandIdCollectionCompleteDelete:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdCollectionCompleteDelete");
+                DoHandleDeleteCompleteL(aCmd);
+                break;
+                }
+            case KMPXCommandIdReorderPlaylist:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdReorderPlaylist");
+                DoReorderPlaylistL(aCmd);
+                break;
+                }
+            case KMPXCommandIdUpdateRefreshTime:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdUpdateRefreshTime");
+                TTime curTime;
+                curTime.HomeTime();
+                iDbHandler->SetLastRefreshedTimeL(curTime);
+                break;
+                }
+            case KMPXCommandCollectionGetCount:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandCollectionGetCount");
+                DoGetCollectionCountL(aCmd);
+                break;
+                }
+            case KMPXCommandCollectionGetURIs:
+                {
+                MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandCollectionGetURIs");
+                DoGetCollectionUriL(aCmd);
+                break;
+                }
+            default:
+                {
+                User::Leave(KErrNotSupported);
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Adds an item (song or playlist) to the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::AddL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlugin::AddL");
+    DoAddL(aMedia);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given path
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::RemoveL(
+    const CMPXCollectionPath& aPath)
+    {
+    MPX_FUNC("CMPXDbPlugin::RemoveL(by path)");
+    MPX_DEBUG_PATH(aPath);
+
+    CMPXMessageArray* msgAry = CMPXMessageArray::NewL();
+    CleanupStack::PushL(msgAry);
+
+    // Return file path for deleted item(s)
+    CDesCArray* fp = DoRemoveL(aPath, *msgAry);
+
+    iObs->HandleRemove(*fp, KErrNone);
+    delete fp;
+
+    // Send Change Messages
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+    DoHandleChangeL(msgAry);
+    CleanupStack::PopAndDestroy(msgAry);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given media properties
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::RemoveL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlugin::RemoveL(by media)");
+    DoRemoveL(aMedia, EFalse);
+    }
+
+// ----------------------------------------------------------------------------
+// Sets/updates the media for an item in the collection
+// DEPRECATED for week 18
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::SetL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlugin::SetL");
+    DoSetL(aMedia);
+    }
+
+// ----------------------------------------------------------------------------
+// Find the items matching the media specifications
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::FindAllL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbPlugin::FindAllL");
+
+    CMPXMedia* entries = FindAllSyncL(aCriteria, aAttrs);
+
+    // notify client. if FindAllL leaves, framework will notify client of the error
+    iObs->HandleFindAll(entries, KErrNone);
+    delete entries;
+    }
+
+// ----------------------------------------------------------------------------
+// Find the items matching the media specifications
+// ----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXDbPlugin::FindAllSyncL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbPlugin::FindAllSyncL");
+
+    CMPXMedia* entries = iDbHandler->FindAllLC(aCriteria, aAttrs);
+
+    if (entries)
+        {
+        CMPXMediaArray* ary = entries->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull( ary );
+        DoSetDrmForArrayL( *ary, aAttrs );
+        }
+
+    CleanupStack::Pop(entries);
+    return entries;
+    }
+
+// ----------------------------------------------------------------------------
+// Get the list of supported capabilities
+// ----------------------------------------------------------------------------
+//
+TCollectionCapability CMPXDbPlugin::GetCapabilities()
+    {
+    // This one supports simple search
+    return EMcSearch;
+    }
+
+// ----------------------------------------------------------------------------
+// Get the list of supported capabilities
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::HandleStepL()
+    {
+    MPX_FUNC("CMPXDbPlugin::HandleStepL");
+
+    TBool done(ETrue);
+
+    switch (iActiveTask->GetTask())
+        {
+        case KMPXCommandIdCollectionSet:
+            {
+            done = DoSetAsyncL();
+            break;
+            }
+        case KMPXCommandIdCollectionAdd:
+            {
+            done = DoAddAsyncL();
+            break;
+            }
+        case KMPXCommandIdCollectionRemove:
+            {
+            DoRemovePathL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionRemoveMedia:
+            {
+            DoRemoveMediaL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionRetrieveUriForDeletion:
+            {
+            DoRetrieveUriForDeletionL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionCleanupDeletedMedias:
+            {
+            CleanupDeletedRecordsL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionCompleteDelete:
+            {
+            DoHandleDeleteCompleteL( iActiveTask->GetCommand() );
+            break;
+            }
+        case KMPXCommandIdUpdateRefreshTime:
+            {
+            MPX_DEBUG1("CMPXDbPlugin::CommandL - KMPXCommandIdUpdateRefreshTime");
+            TTime curTime;
+            curTime.HomeTime();
+            iDbHandler->SetLastRefreshedTimeL(curTime);
+            break;
+            }
+        case KMPXCommandIdIncrementalOpenL:
+            {
+            DoIncrementalOpenL( iActiveTask->GetCommand() );
+            done = ETrue;
+            break;
+            }
+        default:
+            {
+            // Should never happen!
+            ASSERT(0);
+            break;
+            }
+        }
+    return done;
+    }
+
+// ----------------------------------------------------------------------------
+// Handler for async operations completed
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::HandleOperationCompleted(
+    TInt aErr)
+    {
+    MPX_FUNC("CMPXDbPlugin::HandleOperationCompleted");
+    TRAP_IGNORE(DoHandleOperationCompletedL(aErr));
+    }
+
+// ----------------------------------------------------------------------------
+// Process the OpenL command
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXFilter* aFilter )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenL");
+
+    TInt err( KErrNone );
+    CMPXMediaArray* array = CMPXMediaArray::NewL();
+    CleanupStack::PushL(array);
+
+    TInt count(0);
+    TInt levels(aPath.Levels());
+    TBool isASong(EFalse);
+
+    aEntries.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aPath.Id(levels - 1));
+
+    if (1 == levels)
+        {
+        // return the "main menu"
+        count = iMusicLibraryMenuTitles->Count();
+        RArray<TMPXItemId> ids;
+        CleanupClosePushL(ids);
+
+        // due to ui changes, the order of main menu is changed
+        // since multiple clients hardcode indexes to each entry,
+        // the enum cannot be changed, instead we will have to
+        // manually change the display order to minimize the impact to
+        // external clients
+
+        // change from:
+        // all songs, playlist, artist, album, (podcast), genre, composer
+        // to:
+        // artist, album, playlist, all songs, (podcast), genre, composer
+        for (TInt i = EBrowseArtist; i <= EBrowseAlbum; ++i)
+            {
+            MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(i), EMPXGroup,
+                CategoryForBrowseType(static_cast<TMCBrowseType>(i)), iMusicLibraryMenuIds[i]);
+            ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[i]));
+            }
+        MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(1), EMPXGroup,
+            CategoryForBrowseType(static_cast<TMCBrowseType>(1)), iMusicLibraryMenuIds[1]);
+        ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[1]));
+        MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(0), EMPXGroup,
+            CategoryForBrowseType(static_cast<TMCBrowseType>(0)), iMusicLibraryMenuIds[0]);
+        ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[0]));
+
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        if( !iDisablePodcasting )
+            {
+            MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(EBrowsePodcasts), EMPXGroup,
+                CategoryForBrowseType(static_cast<TMCBrowseType>(EBrowsePodcasts)), iMusicLibraryMenuIds[EBrowsePodcasts]);
+            ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[EBrowsePodcasts]));
+            }
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+
+        // Genre and composer
+        for (TInt i = ( EBrowseGenre ); i < count; ++i)
+            {
+            MPXDbCommonUtil::AppendMediaL(*array, iMusicLibraryMenuTitles->MdcaPoint(i), EMPXGroup,
+                CategoryForBrowseType(static_cast<TMCBrowseType>(i)), iMusicLibraryMenuIds[i]);
+            ids.AppendL(TMPXItemId(iMusicLibraryMenuIds[i]));
+            }
+
+        TInt pPath = aEntries.ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+        MPX_ASSERT(pPath);
+        ((CMPXCollectionPath*)pPath)->AppendL(ids.Array());
+        CleanupStack::PopAndDestroy(&ids);
+        SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXCollection, *iMusicMenuTitle);
+        aEntries.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+            KMPXMediaGeneralNonPermissibleActions, EMPXWrite);
+        }
+    else if (levels >= 2)
+        {
+        // Create a media which hold the pointer to the returned path
+        if (aEntries.IsSupported(KMPXMediaGeneralValue))
+            {
+            CMPXMedia* pMedia = CMPXMedia::NewL();
+            CleanupStack::PushL(pMedia);
+            pMedia->SetTObjectValueL<TInt>(KMPXMediaGeneralValue,
+                                          aEntries.ValueTObjectL<TInt>(KMPXMediaGeneralValue));
+            array->AppendL(*pMedia);
+            CleanupStack::PopAndDestroy(pMedia);
+            MPX_ASSERT(array->Count()==1);
+            }
+
+        // check the browse type
+        switch (aPath.Id(1).iId2)
+            {
+            case EBrowseAll:
+                {
+                TBool doIncremental(ETrue);
+                if( aFilter && aFilter->IsSupported( KMPXCollectionOpenLSupportsIncremental ) )
+                    {
+                    doIncremental =
+                         aFilter->ValueTObjectL<TBool>(KMPXCollectionOpenLSupportsIncremental);
+                    }
+
+                if( doIncremental )
+                    {
+                    TRAP( err, isASong = DoOpenIncrementalL( aPath, aAttrs, aEntries, array ) );
+                    }
+                else
+                    {
+                    TRAP( err, isASong = DoOpenBrowseAllL(aPath, aAttrs, aEntries, array) );
+                    }
+                break;
+                }
+
+            case EBrowseArtist:
+                {
+                if( iAllSongsValid )
+                    {
+                    isASong = DoOpenBrowseArtistL( aPath, aAttrs, aEntries, array );
+                    }
+                break;
+                }
+
+            case EBrowseAlbum:
+                {
+                if( iAllSongsValid )
+                    {
+                    isASong = DoOpenBrowseAlbumL( aPath, aAttrs, aEntries, array );
+                    }
+                break;
+                }
+
+            case EBrowsePlaylist:
+                {
+                if( iAllSongsValid )
+                    {
+                    isASong = DoOpenBrowsePlaylistL(aPath, aAttrs, aEntries, array);
+                    }
+
+                break;
+                }
+
+            case EBrowseGenre:
+                {
+                if( iAllSongsValid )
+                    {
+                    isASong = DoOpenBrowseGenreL( aPath, aAttrs, aEntries, array );
+                    }
+                break;
+                }
+
+            case EBrowseComposer:
+                {
+                if( iAllSongsValid )
+                    {
+                    isASong = DoOpenBrowseComposerL( aPath, aAttrs, aEntries, array );
+                    }
+                break;
+                }
+
+            default:
+                {
+                User::Leave(KErrArgument);
+                }
+            }
+        //Remove the first media
+        if ( array->Count() &&
+            (*array)[0]->IsSupported(KMPXMediaGeneralValue))
+            {
+            array->Remove(0);
+            }
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+    aEntries.SetCObjectValueL(KMPXMediaArrayContents, array);
+    aEntries.SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+
+    CleanupStack::PopAndDestroy(array);
+
+    if( err == KSQLErrGeneral )
+        {
+        iAllSongsValid = EFalse;
+        User::Leave( KErrDiskFull );
+        }
+    else if( err != KErrNone )
+        {
+        User::Leave( err );
+        }
+    return isASong;
+    }
+
+
+// ----------------------------------------------------------------------------
+// CMPXDbPlugin::DoOpenIncrementalL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenIncrementalL( const CMPXCollectionPath& aPath,  const TArray<TMPXAttribute>& aAttrs,
+                                       CMPXMedia& aEntries, CMPXMediaArray* aArray)
+    {
+    TBool isASong(EFalse);
+
+    TInt levels(aPath.Levels());
+
+    if( levels == 2 )
+        {
+        // Remove the pPath dummy from the array
+        TInt pPath = aEntries.ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+        aArray->Remove(0);
+        CMPXCollectionPath* p = (CMPXCollectionPath*) pPath;
+
+        RArray<TMPXItemId> ids;
+        CleanupClosePushL( ids );
+
+        iDbHandler->GetAllSongsLimitedL( aAttrs, *aArray, KFirstFetchCount );
+
+        TInt c( aArray->Count() );
+        for( TInt i=0; i<c; ++i )
+            {
+            TMPXItemId id = aArray->AtL(i)->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+            ids.Append( id );
+            }
+
+        // Rest are all blank items
+        CMPXMedia* entry = CMPXMedia::NewL();
+        CleanupStack::PushL(entry);
+        entry->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+        entry->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXSong);
+        entry->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, KMPXInvalidItemId );
+
+        TInt count = iDbHandler->NumberOfItemsL(EMPXSong);
+        count-=c;
+        for( TInt i=0; i<count; ++i )
+            {
+            aArray->AppendL( *entry );
+            ids.Append( KMPXInvalidItemId );
+            }
+        CleanupStack::PopAndDestroy( entry );
+
+        // Set the "Supportes incremental Command" flag
+        //
+        aEntries.SetTObjectValueL( KMPXCollectionOpenLSupportsIncremental, ETrue );
+
+        TMPXOpenDataBlock block;
+        block.iOffset=KErrNotFound;
+        block.iSize=count;
+        aEntries.SetTObjectValueL<TMPXOpenDataBlock>( KMPXCollectionOpenLResultRange, block );
+
+        SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXSong,
+                iMusicLibraryTitles->MdcaPoint(EBrowseAll));
+
+        p->AppendL(ids.Array());
+        CleanupStack::PopAndDestroy( &ids );
+        }
+    else if( levels == 3 )
+        {
+        iDbHandler->GetSongL(aPath.Id(levels - 1).iId2, aAttrs, *aArray);
+        isASong = ETrue;
+        }
+
+
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseAll
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowseAllL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowseAllL");
+
+    TInt levels(aPath.Levels());
+    switch (levels)
+       {
+       // All songs
+       case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseAllL_All);
+
+            iDbHandler->GetAllSongsL(aArray, aAttrs);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXSong,
+                iMusicLibraryTitles->MdcaPoint(EBrowseAll));
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAllL_All);
+            break;
+            }
+
+         // A Song in all songs
+         case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseAllL_Song);
+
+            iDbHandler->GetSongL(aPath.Id(levels - 1).iId2, aAttrs, *aArray);
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAllL_Song);
+            break;
+            }
+
+         default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseAllL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        } // end switch(levels)
+
+    return (levels == 3);
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseArtist
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowseArtistL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowseArtistL");
+
+    TBool isASong(EFalse);
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (levels)
+        {
+        // All artists
+        case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseArtistL_All);
+
+            iDbHandler->GetAllArtistsL(aAttrs, aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXArtist,
+                iMusicLibraryTitles->MdcaPoint(EBrowseArtist));
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseArtistL_All);
+            break;
+            }
+
+        // All albums of an artist
+        case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseArtistL_AllAlbums);
+            // get the albums
+            TInt id(aPath.Id(idIndex).iId2);
+            MPX_ASSERT(aArray->Count());
+            MPX_ASSERT((*aArray)[0]->IsSupported(KMPXMediaGeneralValue));
+            TInt pPath = (*aArray)[0]->ValueTObjectL<TInt>(KMPXMediaGeneralValue);
+            MPX_ASSERT(pPath);
+            iDbHandler->GetAlbumsMatchingArtistL(id, aAttrs, *aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXArtist, id);
+
+            TInt count = aArray->Count();
+            if ( count > 2 )
+                {
+                // Only show "all" item if there is more than 1 album
+                // count for "all" item
+                TInt total = 0;
+                for ( TInt i = 1; i < count; i++ )
+                {
+                TInt temp = (*aArray)[i]->ValueTObjectL<TInt>(KMPXMediaGeneralCount);
+                total += temp;
+                }
+            // Add "all" item under an artist
+            MPXDbCommonUtil::PrependMediaL(*aArray, *iAllSongsForArtistTitle, EMPXItem, EMPXAlbum,
+                aPath.Id(idIndex), 0, 0, 1);
+    
+                (*aArray)[1]->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, total);
+    
+            TMPXItemId allId = ((*aArray)[1]->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+            if (aArray->Count() > 2)
+                { // path media, all id  and at least one media
+                ((CMPXCollectionPath*)pPath)->InsertL(allId, 0);
+                }
+            else
+                { // only has all item
+                ((CMPXCollectionPath*)pPath)->AppendL(allId);
+                    }
+                }
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseArtistL_AllAlbums);
+            break;
+            }
+
+        // All songs of an album for an artist or all songs for an artist
+        case 4:
+            {
+            // all songs for an artist
+            if (aPath.Id(3) == aPath.Id(2))
+                {
+                MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseArtistL_AllSongs);
+
+                TInt id(aPath.Id(idIndex - 1).iId2);
+                iDbHandler->GetSongsMatchingArtistL(id, aAttrs, aArray);
+                SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXSong, id);
+
+                MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseArtistL_AllSongs);
+                }
+            // all songs of an album for an artist
+            else
+                {
+                MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseArtistL_AllSongsForAlbum);
+                TUint32 artistId(aPath.Id(idIndex - 1).iId2);
+
+                if (selections.Count())
+                    {
+                    // Multiple albums
+                    const TInt count(aPath.Selection().Count());
+                    for (TInt i = 0; i < count; ++i)
+                        {
+                        iDbHandler->GetSongsMatchingArtistAndAlbumL(artistId, selections[i].iId2,
+                            aAttrs, aArray);
+                        }
+                    }
+                else
+                    {
+                    // One album
+                    iDbHandler->GetSongsMatchingArtistAndAlbumL(artistId, aPath.Id(idIndex).iId2,
+                        aAttrs, aArray);
+                    }
+
+                SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXAlbum, aPath.Id(idIndex).iId2);
+                MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseArtistL_AllSongsForAlbum);
+                }
+
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseArtistL: retrieved %d items", aArray->Count());
+
+            break;
+            }
+
+        // A Song in an album
+        case 5:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseArtistL_Song);
+
+            iDbHandler->GetSongL(aPath.Id(idIndex).iId2, aAttrs, *aArray);
+            isASong = ETrue;
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseArtistL_Song);
+            break;
+            }
+
+        default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseArtistL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        } // end switch(level)
+
+    CleanupStack::PopAndDestroy(&selections);
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseAlbum
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowseAlbumL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowseAlbumL");
+
+    TBool isASong(EFalse);
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (levels)
+        {
+        // All Albums
+        case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseAlbumL_All);
+
+            iDbHandler->GetAllAlbumsL(aAttrs, aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXAlbum,
+                iMusicLibraryTitles->MdcaPoint(EBrowseAlbum));
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAlbumL_All);
+            break;
+            }
+
+        // All songs in one or multiple albums
+        case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseAlbumL_AllSongs);
+            if (selections.Count())
+                {
+                // Multiple albums
+                const TInt count(aPath.Selection().Count());
+                for (TInt i = 0; i < count; ++i)
+                    {
+                    iDbHandler->GetSongsMatchingAlbumL(selections[i].iId2, aAttrs, aArray);
+                    }
+                }
+            else
+                {
+                // One album
+                iDbHandler->GetSongsMatchingAlbumL(aPath.Id(idIndex).iId2, aAttrs, aArray);
+                }
+
+//            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXAlbum, aPath.Id(idIndex).iId2);
+// added for ganes
+                SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXAlbum, iMusicLibraryTitles->MdcaPoint(EBrowseAlbumSong));
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAlbumL_AllSongs);
+            break;
+            }
+
+        // A song in an album
+        case 4:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseAlbumL_Song);
+
+            iDbHandler->GetSongL(aPath.Id(idIndex).iId2, aAttrs, *aArray);
+            isASong = ETrue;
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseAlbumL_Song);
+            break;
+            }
+
+        default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseAlbumL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&selections);
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowsePlaylist
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowsePlaylistL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowsePlaylistL");
+
+    TBool isASong(EFalse);
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (levels)
+         {
+         case 2:
+            {
+            // All playlists
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowsePlaylistL_All);
+
+            iDbHandler->GetAllPlaylistsL(aArray, aAttrs);
+            iDbHandler->GetAllSystemPlaylistNamesL(aArray);
+
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXPlaylist,
+                iMusicLibraryTitles->MdcaPoint(EBrowsePlaylist));
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowsePlaylistL_All);
+            break;
+            }
+
+         // All songs in a playlist
+         case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowsePlaylistL_AllSongs);
+
+            if (selections.Count())
+                {
+                const TInt count(aPath.Selection().Count());
+                for (TInt i = 0; i < count; ++i)
+                    {
+                    iDbHandler->GetSongsMatchingPlaylistL(selections[i].iId2, aAttrs, aArray);
+                    }
+                }
+            else
+                {
+                iDbHandler->GetSongsMatchingPlaylistL(aPath.Id (idIndex).iId2, aAttrs, aArray);
+                }
+
+            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXPlaylist, aPath.Id(idIndex).iId2);
+
+            // populate EMPXMediaGeneralNonPermissibleActions
+            if (iDbHandler->IsAutoPlaylistL(aPath.Id(idIndex).iId2))
+                {
+                // set non-permissible actions to not writable and cacheable
+                aEntries.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+                    KMPXMediaGeneralNonPermissibleActions, (TMPXGeneralNonPermissibleActions)(EMPXWrite | EMPXCache));
+                }
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowsePlaylistL_AllSongs);
+            break;
+            }
+
+         // Specific song in a playlist
+         case 4:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowsePlaylistL_Song);
+
+            iDbHandler->GetPlaylistSongL(aPath.Id(idIndex).iId2, aPath.Id(idIndex - 1).iId2,
+                aAttrs, *aArray);
+            isASong = ETrue;
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowsePlaylistL_Song);
+            break;
+            }
+
+         default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowsePlaylistL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+       }
+
+    CleanupStack::PopAndDestroy(&selections);
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseGenre
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowseGenreL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowseGenreL");
+
+    TBool isASong(EFalse);
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (levels)
+        {
+        // All genres
+         case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseGenreL_All);
+
+            iDbHandler->GetAllGenresL(aAttrs, aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXGenre,
+                iMusicLibraryTitles->MdcaPoint(EBrowseGenre));
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseGenreL_All);
+            break;
+            }
+
+        // All songs of a genre
+        case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseGenreL_AllSongs);
+
+            if (selections.Count())
+                {
+                const TInt count(aPath.Selection().Count());
+                for (TInt i = 0; i < count; ++i)
+                    {
+                    iDbHandler->GetSongsMatchingGenreL(selections[i].iId2, aAttrs, aArray);
+                    }
+                }
+            else
+                {
+                iDbHandler->GetSongsMatchingGenreL(aPath.Id(idIndex).iId2, aAttrs, aArray);
+                }
+            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXGenre, aPath.Id(idIndex).iId2);
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseGenreL_AllSongs);
+            break;
+            }
+
+        // Specific song in a genre
+        case 4:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseGenreL_Song);
+
+            iDbHandler->GetSongL(aPath.Id(idIndex).iId2, aAttrs, *aArray);
+            isASong = ETrue;
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseGenreL_Song);
+            break;
+            }
+
+        default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseGenreL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&selections);
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseComposer
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoOpenBrowseComposerL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray* aArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenBrowseComposerL");
+
+    TBool isASong(EFalse);
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (levels)
+        {
+        // All composers
+        case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseComposerL_All);
+
+            iDbHandler->GetAllComposersL(aAttrs, aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXComposer,
+                iMusicLibraryTitles->MdcaPoint(EBrowseComposer));
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseComposerL_All);
+            break;
+            }
+
+        // All songs of a composer
+        case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseComposerL_AllSongs);
+            if (selections.Count())
+                {
+                const TInt count(aPath.Selection().Count());
+                for (TInt i = 0; i < count; ++i)
+                    {
+                    iDbHandler->GetSongsMatchingComposerL(selections[i].iId2, aAttrs, aArray);
+                    }
+                }
+            else
+                {
+                iDbHandler->GetSongsMatchingComposerL(aPath.Id(idIndex).iId2, aAttrs, aArray);
+                }
+            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXComposer, aPath.Id(idIndex).iId2);
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseComposerL_AllSongs);
+            break;
+            }
+
+        // Specific song of a composer
+        case 4:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoOpenBrowseComposerL_Song);
+
+            iDbHandler->GetSongL(aPath.Id(idIndex).iId2, aAttrs, *aArray);
+            isASong = ETrue;
+
+            MPX_PERF_END(CMPXDbPlugin_DoOpenBrowseComposerL_Song);
+            break;
+            }
+
+        default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoOpenBrowseComposerL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&selections);
+    return isASong;
+    }
+
+// ----------------------------------------------------------------------------
+// Process the OpenL method with open mode EMPXOpenPlaylistOnly
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionPath* CMPXDbPlugin::DoOpenPlaylistL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoOpenPlaylistL");
+
+    RArray<TMPXItemId> ids;
+    CleanupClosePushL(ids);
+
+    CMPXMedia* entries = CMPXMedia::NewL();
+    CleanupStack::PushL(entries);
+
+    CMPXCollectionPath* path = CMPXCollectionPath::NewL(aPath);
+    CleanupStack::PushL(path);
+
+    // Go through the browse path
+    TInt levels(aPath.Levels());
+    if (levels == 2)
+        {
+        // Create a new collection path
+        CleanupStack::PopAndDestroy( path );
+        path = CMPXCollectionPath::NewL();
+        CleanupStack::PushL( path );
+
+        // Always return all songs here
+        ids.Reset();
+        ids.AppendL( KDBPluginUid );
+        path->AppendL(ids.Array());
+        path->SelectL((TMPXItemId) KDBPluginUid);
+
+        ids.Reset();
+        ids.AppendL(EBrowseAll);
+        path->AppendL(ids.Array());
+        path->SelectL((TMPXItemId) EBrowseAll);
+        path->Set(EMPXOpenPlaylistOnly);
+
+        // Get all item IDs
+        CMPXMediaArray* array = CMPXMediaArray::NewL();
+        CleanupStack::PushL(array);
+
+        DoOpenBrowseAllL(*path, aAttrs, *entries, array);
+
+        entries->SetCObjectValueL(KMPXMediaArrayContents, array);
+        entries->SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+
+        CleanupStack::PopAndDestroy(array);
+
+        DoAppendLevelL(*path, *entries);
+        }
+    else if (levels > 2)
+        {
+        switch (aPath.Id(1).iId2)
+            {
+            case EBrowseAll:
+                {
+                path->Set(EMPXOpenPlaylistOnly);
+                // Returns the same path that we copied
+                break;
+                }
+            case EBrowseArtist:
+                {
+                if (levels == 3)
+                    {
+                    // return all songs of a particular artist (currently highlighted)
+                    path->Set(EMPXOpenGroupOrPlaylist);
+                    ids.Reset();
+                    ids.Append(aPath.Id(2));
+                    path->AppendL(ids.Array());
+                    path->SelectL(aPath.Id(2));
+                    path->Set(EMPXOpenPlaylistOnly);
+
+                    // Opens all songs of an artist and create the corresponding
+                    // Collection playlist by appending all songs of an artist to
+                    // the collection path
+                    //
+                    DoOpenL(*path, aAttrs, *entries, NULL);
+                    DoAppendLevelL(*path, *entries);
+                    }
+                else if (levels == 4)
+                    {
+                    // Open the album of an artist and create the corresponding
+                    // Collection playlist by appending all songs of an artist to
+                    // the collection path
+                    //
+                    path->Set(EMPXOpenPlaylistOnly);
+                    DoOpenL(*path, aAttrs, *entries, NULL);
+                    DoAppendLevelL(*path, *entries);
+                    }
+                else
+                    {
+                    // case is a song no need to open again!
+                    }
+
+                break;
+                }
+            // Playlist, album, genre and composer easier, only 2 levels deep
+            // plugin | category | category contents | songs of category
+            //
+            case EBrowsePlaylist:
+            case EBrowseAlbum:
+            case EBrowseGenre:
+            case EBrowseComposer:
+                {
+                if (!DoOpenL(aPath, aAttrs, *entries, NULL))
+                    {
+                    // If it is not at a song level
+                    // Append all entries to create collection path
+                    //
+                    path->Set(EMPXOpenPlaylistOnly);
+                    DoAppendLevelL( *path, *entries );
+                    }
+                break;
+                }
+            default:
+                {
+                User::Leave(KErrNotSupported);
+                }
+            }
+        }
+    else  // levels < 2
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    // Cleanup
+    CleanupStack::Pop(path);
+    CleanupStack::PopAndDestroy(entries);
+    CleanupStack::PopAndDestroy(&ids);
+
+    return path;
+    }
+
+// ----------------------------------------------------------------------------
+// Process the MediaL command
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoMediaL");
+
+    // Fetch Media for root level
+    //
+    if (aPath.Levels() == 1) //root
+        {
+        DoRootMediaL( aAttrs, aEntries );
+        }
+    // Ensure the database has been merged before attempting MediaL()
+    //
+    else
+        {
+        CMPXMediaArray* array = CMPXMediaArray::NewL();
+        CleanupStack::PushL(array);
+
+        switch (aPath.Id(1).iId2)
+            {
+            case EBrowseAll:
+                {
+                DoAllSongsMediaL(aPath, aAttrs, aEntries, *array);
+                break;
+                } // end case EBrowseAll
+
+            case EBrowseArtist:
+                {
+                DoArtistMediaL(aPath, aAttrs, aEntries, *array);
+                break;
+                } // end case EBrowseArtist
+
+            case EBrowseAlbum:
+                {
+                DoCategoryMediaL(aPath, aAttrs, EMPXAlbum, aEntries, *array);
+                break;
+                } // end case EBrowseAlbum
+
+            case EBrowsePlaylist:
+                {
+                DoCategoryMediaL(aPath, aAttrs, EMPXPlaylist, aEntries, *array);
+                break;
+                } // end case EBrowsePlaylist
+
+            case EBrowseGenre:
+                {
+                DoCategoryMediaL(aPath, aAttrs, EMPXGenre, aEntries, *array);
+                break;
+                } // end case EBrowseGenre
+
+            case EBrowseComposer:
+                {
+                DoCategoryMediaL(aPath, aAttrs, EMPXComposer, aEntries, *array);
+                break;
+                } // end case EBrowseComposer
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+            case EBrowsePodcasts:
+                {
+                break;
+                }
+#endif
+            default:
+                {
+                User::Leave(KErrArgument);
+                }
+            } // end switch(aPath.id(1)
+
+        if (array->Count() > 0)
+            {
+            aEntries.SetCObjectValueL(KMPXMediaArrayContents, array);
+            aEntries.SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+            }
+        CleanupStack::PopAndDestroy(array);
+        }
+    // Else case cannot leave, because this will happen when we have no disk space to
+    // perform the merging. It should NOT leave.
+    //
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for root level
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRootMediaL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRootMediaL");
+
+    TInt count(aAttrs.Count());
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU
+    aMedia.SetTObjectValueL<TMPXGeneralNonPermissibleActions> (
+            KMPXMediaGeneralNonPermissibleActions, (TMPXGeneralNonPermissibleActions)(EMPXWrite | EMPXCache) );
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdGeneral)
+            {
+            TUint att(aAttrs[i].AttributeId());
+            if (att & EMPXMediaGeneralTitle)
+                {
+                HBufC* title(iResource->ReadHBufCL(R_MPX_QTN_MUS_MUSIC));
+                CleanupStack::PushL(title);
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle, *title);
+                CleanupStack::PopAndDestroy(title);
+                }
+            if (att & EMPXMediaGeneralSubTitle)
+                {
+                TInt numSongs(iDbHandler->NumberOfItemsL(EMPXSong));
+                aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, numSongs);
+
+                HBufC* text(iResource->ReadHBufCL((1 == numSongs) ?
+                    R_MPX_QTN_MUS_MUSIC_ONE_SONG : R_MPX_QTN_MUS_MUSIC_NUM_SONGS));
+
+                CleanupStack::PushL(text);
+                aMedia.SetTextValueL(KMPXMediaGeneralSubTitle, *text);
+                CleanupStack::PopAndDestroy(text);
+                }
+            if (att & EMPXMediaGeneralIcon)
+                {
+                TIconInfo icon;
+                icon.bmpfile = KMPlayerDbPluginMbmFile;
+                icon.bitmapId = EMbmMpxdbpluginQgn_graf_mup_dlst_music;
+                icon.maskId = EMbmMpxdbpluginQgn_graf_mup_dlst_music_mask;
+                aMedia.SetTObjectValueL<TIconInfo>(KMPXMediaGeneralIcon, icon);
+                }
+            } // if
+        } // for
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for all songs category
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoAllSongsMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAllSongsMediaL");
+
+    TInt levels(aPath.Levels());
+
+    switch (levels)
+       {
+       // All songs
+       case 2:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoAllSongsMediaL_All);
+            DoRootCategoryMediaL(aAttrs, EBrowseAll, EMPXSong, aEntries);
+            MPX_PERF_END(CMPXDbPlugin_DoAllSongsMediaL_All);
+            break;
+            }
+
+         // A Song in all songs
+         case 3:
+            {
+            MPX_PERF_START(CMPXDbPlugin_DoAllSongsMediaL_Song);
+            GetSongInfoL(aPath, aAttrs, aEntries, aMediaArray);
+            MPX_PERF_END(CMPXDbPlugin_DoAllSongsMediaL_Song);
+            break;
+            }
+
+         default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoAllSongsMediaL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        } // end switch(levels)
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for artists category
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoArtistMediaL (
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoArtistMediaL");
+
+    TInt levels(aPath.Levels());
+    TInt count(aPath.Selection().Count());
+
+     // All artists
+    if (levels == 2)
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoArtistMediaL_All);
+        DoRootCategoryMediaL(aAttrs, EBrowseArtist, EMPXArtist, aEntries);
+        MPX_PERF_END(CMPXDbPlugin_DoArtistMediaL_All);
+        }
+    else if ((levels == 3) && count) // multiple artists selected
+        {
+        RArray<TMPXItemId> selections;
+        CleanupClosePushL(selections);
+        aPath.SelectionL(selections);
+
+        for (TInt i = 0; i < count; ++i)
+            {
+            CMPXMedia* artist = CMPXMedia::NewL();
+            CleanupStack::PushL(artist);
+            iDbHandler->GetCategoryL(selections[i].iId2, EMPXArtist, aAttrs, artist);
+            aMediaArray.AppendL(*artist);
+            CleanupStack::PopAndDestroy(artist);
+            }
+
+        CleanupStack::PopAndDestroy(&selections);
+        }
+    else if (levels == 3) // single artist selected
+        {
+        iDbHandler->GetCategoryL(aPath.Id(2).iId2, EMPXArtist, aAttrs, &aEntries);
+        }
+    else if (levels == 4 && (aPath.Id(3) == aPath.Id(2))) // all songs for an artist
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoArtistMediaL_AllSongs);
+        // Calculate duration directly with SQL
+        if (MPXDbCommonUtil::AttributeExists(aAttrs, KMPXMediaGeneralDuration))
+            {
+            DoDurationL(aEntries, EMPXArtist, aPath.Id(2));
+            }
+
+        MPX_PERF_END(CMPXDbPlugin_DoArtistMediaL_AllSongs);
+        }
+    else if ((levels == 4) && count) // multiple albums of an artist
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoArtistMediaL_AllAlbums);
+
+        RArray<TMPXItemId> selections;
+        CleanupClosePushL(selections);
+        aPath.SelectionL(selections);
+
+        for (TInt i = 0; i < count; ++i)
+            {
+            CMPXMedia* media = CMPXMedia::NewL();
+            CleanupStack::PushL(media);
+            iDbHandler->GetCategoryL(selections[i].iId2, EMPXAlbum, aAttrs, media);
+            aMediaArray.AppendL(*media);
+            CleanupStack::PopAndDestroy(media);
+            }
+
+        CleanupStack::PopAndDestroy(&selections);
+
+        MPX_PERF_END(CMPXDbPlugin_DoArtistMediaL_AllAlbums);
+        }
+    else if (levels == 4) // one album of an artist
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoArtistMediaL_OneAlbum);
+        iDbHandler->GetCategoryL(aPath.Id(3).iId2, EMPXAlbum, aAttrs, &aEntries);
+
+        // Calculate duration
+        if (MPXDbCommonUtil::AttributeExists(aAttrs, KMPXMediaGeneralDuration))
+            {
+            DoDurationL(aEntries, EMPXArtist, aPath.Id(2), EMPXAlbum, aPath.Id(3));
+            }
+
+        MPX_PERF_END(CMPXDbPlugin_DoArtistMediaL_OneAlbum);
+        }
+     else if (levels == 5) // a song/songs in an album
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoArtistMediaL_Song);
+        GetSongInfoL(aPath, aAttrs, aEntries, aMediaArray);
+        MPX_PERF_END(CMPXDbPlugin_DoArtistMediaL_Song);
+        }
+    else
+        {
+        MPX_DEBUG2("CMPXDbPlugin_DoArtistMediaL: Invalid levels[%d]", levels);
+        User::Leave(KErrNotSupported);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for all songs category
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRootCategoryMediaL (
+    const TArray<TMPXAttribute>& aAttrs,
+    TMPXItemId aRootCategoryId,
+    TMPXGeneralCategory aCategory,
+    CMPXMedia& aEntries)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRootCategoryMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdGeneral)
+            {
+            TUint att(aAttrs[i].AttributeId());
+            switch (att)
+                {
+                case EMPXMediaGeneralId:
+                    {
+                    aEntries.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aRootCategoryId);
+                    break;
+                    }
+                case EMPXMediaGeneralTitle:
+                    {
+                    aEntries.SetTextValueL(KMPXMediaGeneralTitle,
+                        iMusicLibraryMenuTitles->MdcaPoint(BrowseTypeForCategory(aCategory)));
+                    break;
+                    }
+                case EMPXMediaGeneralCount:
+                    {
+                    // count number of category
+                    aEntries.SetTObjectValueL<TInt>(KMPXMediaGeneralCount,
+                        iDbHandler->NumberOfItemsL(aCategory));
+                    break;
+                    }
+                case EMPXMediaGeneralDuration:
+                    {
+                    if (aCategory == EMPXSong)
+                        {
+                        DoDurationL(aEntries, EMPXSong);
+                        }
+                    break;
+                    }
+                default:
+                    // not supported
+                    break;
+                } // end switch
+            } // end if
+        } // end for
+
+    aEntries.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup);
+    aEntries.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, aCategory);
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for albums/playlists/genres/composers category
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoCategoryMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    TMPXGeneralCategory aCategory,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoCategoryMediaL");
+
+    TInt levels(aPath.Levels());
+    TInt count(aPath.Selection().Count());
+
+    if (levels == 2) // all albums/playlists/genres/composers
+        {
+        MPX_PERF_START (CMPXDbPlugin_DoCategoryMediaL_All);
+        DoRootCategoryMediaL(aAttrs, aPath.Id(1).iId2, aCategory, aEntries);
+        MPX_PERF_END (CMPXDbPlugin_DoCategoryMediaL_All);
+        }
+    else if (levels == 3 && count) // multiple albums/playlists/genres/composers selected
+        {
+        RArray<TMPXItemId> selections;
+        CleanupClosePushL(selections);
+        aPath.SelectionL(selections);
+
+        for (TInt i = 0; i < count; ++i)
+            {
+            CMPXMedia* media = CMPXMedia::NewL();
+            CleanupStack::PushL(media);
+            iDbHandler->GetCategoryL(selections[i].iId2, aCategory, aAttrs, media);
+            aMediaArray.AppendL(*media);
+            CleanupStack::PopAndDestroy(media);
+            }
+
+        CleanupStack::PopAndDestroy(&selections);
+        }
+    else if (levels == 3) // all songs in an album/playlist/genre/composer
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoCategoryMediaL_Category);
+        TMPXItemId id = aPath.Id(2);
+        iDbHandler->GetCategoryL(id.iId2, aCategory, aAttrs, &aEntries);
+
+        // Calculate duration directly with SQL
+        if (MPXDbCommonUtil::AttributeExists(aAttrs, KMPXMediaGeneralDuration))
+            {
+            DoDurationL(aEntries, aCategory, id);
+            }
+
+        TInt nonPermisAction( aEntries.ValueTObjectL<TInt>(KMPXMediaGeneralNonPermissibleActions));
+        nonPermisAction |= EMPXCache;
+
+        aEntries.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+                    KMPXMediaGeneralNonPermissibleActions, (TMPXGeneralNonPermissibleActions) nonPermisAction );
+
+        MPX_PERF_END(CMPXDbPlugin_DoCategoryMediaL_Category);
+        }
+    else if (levels == 4) // a song/songs in an album/playlist/genre/composer
+        {
+        MPX_PERF_START(CMPXDbPlugin_DoCategoryMediaL_Song);
+        GetSongInfoL(aPath, aAttrs, aEntries, aMediaArray);
+        MPX_PERF_END(CMPXDbPlugin_DoCategoryMediaL_Song);
+        }
+    else
+        {
+        MPX_DEBUG2("CMPXDbPlugin__DoMediaL__EBrowseAlbum: Invalid levels[%d]", levels);
+        User::Leave(KErrNotSupported);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Set all the attributes in CMPXMedia corresponding to KMPXMediaIdDrm
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoSetMediaDrmL(
+    CMPXMedia& aMedia,
+    TUint aDrmAttributes,
+    const TDesC& aLocation)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoSetMediaDrmL");
+
+    iDrmMediaUtility->InitL(aLocation);
+    CleanupClosePushL(*iDrmMediaUtility);
+    const CMPXMedia* drmMedia(iDrmMediaUtility->GetMediaL(aDrmAttributes));
+
+    // Only get attributes if it's a DRM file
+    if (drmMedia)
+        {
+        if ((aDrmAttributes & EMPXMediaDrmType) &&
+            drmMedia->IsSupported(KMPXMediaDrmType))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmType,
+                drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmType));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmRightsStatus) &&
+            drmMedia->IsSupported(KMPXMediaDrmRightsStatus))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmRightsStatus,
+                drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmRightsStatus));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmRightsType) &&
+            drmMedia->IsSupported(KMPXMediaDrmRightsType))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmRightsType,
+                drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmRightsType));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmCount) &&
+            drmMedia->IsSupported(KMPXMediaDrmCount))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmCount,
+                drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmCount));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmProtected) &&
+            drmMedia->IsSupported(KMPXMediaDrmProtected))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmProtected,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmProtected));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmSendingAllowed) &&
+            drmMedia->IsSupported(KMPXMediaDrmSendingAllowed))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmSendingAllowed,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmSendingAllowed));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmCanSetAutomated) &&
+            drmMedia->IsSupported(KMPXMediaDrmCanSetAutomated))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmCanSetAutomated,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmCanSetAutomated));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmHasInfoUrl) &&
+            drmMedia->IsSupported(KMPXMediaDrmHasInfoUrl))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmHasInfoUrl,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmHasInfoUrl));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmHasPreviewUrl) &&
+            drmMedia->IsSupported(KMPXMediaDrmHasPreviewUrl))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmHasPreviewUrl,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmHasPreviewUrl));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmAboutToExpire) &&
+            drmMedia->IsSupported(KMPXMediaDrmAboutToExpire))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmAboutToExpire,
+                drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmAboutToExpire));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmStartTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmStartTime))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmStartTime,
+                drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmStartTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmEndTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmEndTime))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmEndTime,
+                drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmEndTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmIntervalStartTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmIntervalStartTime))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmIntervalStartTime,
+                drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmIntervalStartTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmAccumulatedTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmAccumulatedTime))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmAccumulatedTime,
+                drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmAccumulatedTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmInterval) &&
+            drmMedia->IsSupported(KMPXMediaDrmInterval))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmInterval,
+                drmMedia->ValueTObjectL<TTimeIntervalSeconds>(KMPXMediaDrmInterval));
+            }
+        }
+
+    CleanupStack::PopAndDestroy(iDrmMediaUtility);
+    }
+
+// ----------------------------------------------------------------------------
+// Add media objects to the array with attributes from song details
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::GetSongInfoL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntry,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::GetSongInfoL");
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    MPXDbCommonUtil::FillInSupportedUIDsL(aAttrs, supportedIds);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    //
+    // If we are trying to locate a song from a playlist, we should read available song
+    // info from Playlist table first in case the song is located on a removable
+    // drive and the drive is not currently present. This is achieved by supplying
+    // playlist Id to GetSongMatchingSongIdL. When playlistId is 0, we are reading song
+    // info directly from Songs table. If playlistId is specified, GetSongMatchingSongIdL
+    // will populate song media from Playlist table and if Songs table for the drive
+    // exists, song media will be overwritten with info from Songs table.
+    //
+    TMPXItemId playlistId(0);
+    if (aPath.Id(1) == EBrowsePlaylist)
+        {
+        if (aPath.Levels() < 2)
+            {
+            User::Leave(KErrArgument);
+            }
+
+        playlistId = aPath.Id(aPath.Levels() - 2);
+        }
+
+    TInt countSelection(aPath.Selection().Count());
+    if (countSelection)
+        {
+        // We have a selection, iterate it
+        for (TInt selectionIndex = 0; selectionIndex < countSelection; ++selectionIndex)
+            {
+            CMPXMedia* newEntry = CMPXMedia::NewL(supportedIds.Array());
+            CleanupStack::PushL(newEntry);
+
+            DoGetSongInfoL(aAttrs, selections[selectionIndex].iId2, playlistId.iId2, *newEntry);
+
+            aMediaArray.AppendL(*newEntry);
+            CleanupStack::PopAndDestroy(newEntry);
+            }
+        }
+    else
+        {
+        // No selection, get the attributes for the one song
+        DoGetSongInfoL(aAttrs, aPath.Id(aPath.Levels() - 1).iId2, playlistId.iId2, aEntry);
+        }
+
+    CleanupStack::PopAndDestroy(&selections);
+    CleanupStack::PopAndDestroy(&supportedIds);
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieves the attributes for a media object.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoGetSongInfoL(
+    const TArray<TMPXAttribute>& aAttrs,
+    TInt aEntryId,
+    TInt aPlaylistId,
+    CMPXMedia& aEntry)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoGetSongInfoL");
+
+    if (aPlaylistId)
+        {
+        iDbHandler->GetPlaylistSongL(aEntryId, aPlaylistId, aAttrs, aEntry);
+        }
+    else
+        {
+        iDbHandler->GetSongL(aEntryId, aAttrs, aEntry);
+        }
+
+    const TDesC& location(aEntry.ValueText(KMPXMediaGeneralUri));
+
+    // Check DRM Only if we have a location
+    if (location != KNullDesC)
+        {
+        TUint drmAttributes(0);
+
+        // Compact the attribute set
+        TInt count(aAttrs.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            if (aAttrs[i].ContentId() == KMPXMediaIdDrm)
+                {
+                drmAttributes |= aAttrs[i].AttributeId();
+                }
+            }
+
+        // Set the correct attributes to media, only if requested
+        if (drmAttributes)
+            {
+            DoSetMediaDrmL(aEntry, drmAttributes, location);
+            }
+        }
+
+    // Disable caching for any MediaL() returning song info.
+    TInt nonPermisAction( aEntry.ValueTObjectL<TInt>(KMPXMediaGeneralNonPermissibleActions));
+    nonPermisAction |= EMPXCache;
+
+    aEntry.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+                KMPXMediaGeneralNonPermissibleActions, (TMPXGeneralNonPermissibleActions) nonPermisAction );
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection details
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoHandleOtherMediaAttributesL(
+    const TArray<TMPXAttribute>& aAttrs,
+    const CMPXCollectionPath& aPath,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoHandleOtherMediaAttributesL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdCollectionDetails)
+            {
+            TUint att(aAttrs[i].AttributeId());
+
+            if (att & EMPXMediaColDetailNumberOfItems)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailNumberOfItems,
+                    iDbHandler->NumberOfItemsL(EMPXSong));
+                }
+            if (att & EMPXMediaColDetailDuration)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailDuration,
+                    DoDurationL(aMedia, EMPXSong));
+                }
+            if (att & EMPXMediaColTotalSize)
+                {
+                // todo
+                TInt totalSize(0);
+                aMedia.SetTObjectValueL(KMPXMediaColDetailTotalSize, totalSize);
+                }
+            if (att & EMPXMediaLastRefreshed)
+                {
+                TTime lastRefreshed(iDbHandler->GetLastRefreshedTimeL());
+                aMedia.SetTObjectValueL(KMPXMediaColDetailLastRefreshed,
+                    lastRefreshed.Int64());
+                }
+            if (att & EMPXMediaColDetailDBCreated)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailDBCreated,
+                    iDbHandler->DatabaseCreated());
+                }
+            if (att & EMPXMediaColDetailDBCorrupted)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailDBCorrupted,
+                    iDbHandler->IsDBCorruptedL());
+                }
+            }
+        else if (aAttrs[i] == KMPXMediaGeneralPath)
+            {
+            aMedia.SetCObjectValueL(KMPXMediaGeneralPath,
+                const_cast<CMPXCollectionPath*>(&aPath));
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given path
+// ----------------------------------------------------------------------------
+//
+CDesCArray* CMPXDbPlugin::DoRemoveL(
+    const CMPXCollectionPath& aPath,
+    CMPXMessageArray& aChangeMsgArray)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveL");
+
+    if (aPath.Levels() <= 1)
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    // Return file path for deleted item(s)
+    //
+    CDesCArray* fp = new(ELeave) CDesCArrayFlat(1);
+    CleanupStack::PushL(fp);
+
+    // Ids of the selected items
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    switch (aPath.Id(1).iId2)
+        {
+        case EBrowseAll:
+            {
+            DoRemoveFromAllSongsL(aPath, selections.Array(), *fp, aChangeMsgArray);
+            }
+            break;
+
+        case EBrowseArtist:
+            {
+            DoRemoveFromArtistsL(aPath, selections.Array(), *fp, aChangeMsgArray);
+            }
+            break;
+
+        case EBrowseAlbum: // deliberate fall through
+        case EBrowseGenre: // deliberate fall through
+        case EBrowseComposer: // deliberate fall through
+            {
+            DoRemoveFromCategoriesL(aPath, selections.Array(),
+                CategoryForBrowseType(static_cast<TMCBrowseType>(aPath.Id(1).iId2)), *fp, aChangeMsgArray);
+            }
+            break;
+
+        case EBrowsePlaylist:
+            {
+            DoRemoveFromPlaylistsL(aPath, selections.Array(), *fp, aChangeMsgArray);
+            }
+            break;
+
+        default:
+            {
+            User::Leave(KErrArgument);
+            }
+        } // end switch (aPath.Id(1))
+
+    MPX_DEBUG2("CMPXDbPlugin::RemoveL itemId[%d]", aPath.Id(aPath.Levels() - 1).iId2);
+
+    CleanupStack::PopAndDestroy( &selections );
+    CleanupStack::Pop(fp);
+
+    return fp;
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given media properties
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveL(
+    const CMPXMedia& aMedia,
+    TBool aDeleteRecord)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveL(by media)");
+
+    // Return deleted file paths to caller
+    CDesCArray* fp = new(ELeave) CDesCArrayFlat(1);
+    CleanupStack::PushL(fp);
+
+    // a list of change event messages a result of the item being removed
+    CMPXMessageArray* itemChangedMessages = CMPXMediaArray::NewL();
+    CleanupStack::PushL(itemChangedMessages);
+
+    TUint32 mediaId(0);
+
+    // Removing a container of items
+    //
+    if (aMedia.IsSupported(KMPXMediaArrayContents))
+        {
+        MPX_DEBUG1("CMPXDbPlugin::RemoveL -- Removing a container of items");
+        const CMPXMediaArray* media = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        if( !media )
+            {
+            User::Leave(KErrNoMemory);
+            }
+        const TInt mediaCount(media->Count());
+        for (TInt i = 0; i < mediaCount; ++i)
+            {
+            CMPXMedia* entry = media->AtL(i);
+            if (entry->IsSupported(KMPXMediaGeneralId))
+                {
+                mediaId = entry->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+                }
+            else if (entry->IsSupported(KMPXMediaGeneralUri))
+                {
+                const TDesC& uri = entry->ValueText(KMPXMediaGeneralUri);
+                mediaId = iDbHandler->GetSongIdMatchingUriL(uri);
+                }
+            else
+                {
+                // Unable to process this item
+                continue;
+                }
+
+            iDbHandler->RemoveSongL(mediaId, *fp, *itemChangedMessages, aDeleteRecord);
+            }
+        }
+    // Removing an item with known item id
+    //
+    else if (aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        MPX_DEBUG1("CMPXDbPlugin::RemoveL -- Removing an item by item id");
+        mediaId =  aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+
+        if (MPX_ITEM_CATEGORY(mediaId) != EMPXPlaylist)
+            {
+            iDbHandler->RemoveSongL(mediaId, *fp, *itemChangedMessages, aDeleteRecord);
+            }
+        else
+            {
+            iDbHandler->RemovePlaylistL(mediaId, *fp, *itemChangedMessages);
+            }
+        }
+    // Removing an item with known uri
+    //
+    else if (aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        MPX_DEBUG1("CMPXDbPlugin::RemoveL -- Removing an item by uri");
+        TPtrC uri = aMedia.ValueText( KMPXMediaGeneralUri );
+
+        TMPXGeneralCategory category =
+            aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory);
+
+        if (category == EMPXSong)
+            {
+            mediaId = iDbHandler->GetSongIdMatchingUriL(uri);
+            iDbHandler->RemoveSongL(mediaId, *fp, *itemChangedMessages, aDeleteRecord);
+            }
+        else if (category == EMPXPlaylist)
+            {
+            mediaId = iDbHandler->GetPlaylistIdMatchingUriL(uri);
+            iDbHandler->RemovePlaylistL(mediaId, *fp, *itemChangedMessages);
+            }
+        else
+            {
+            // otherwise unable to process this item
+            }
+        }
+    else
+        {
+        MPX_DEBUG1("CMPXDbPlugin::RemoveL -- Unknown item for removal");
+        User::Leave(KErrNotSupported);
+        }
+
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+
+    // Removing an item always invalidates all songs.
+    //
+    MPXDbCommonUtil::AddItemChangedMessageL(*itemChangedMessages, EBrowseAll,
+                                            EMPXItemModified, EMPXCollection, KDBPluginUid);
+
+    DoHandleChangeL(itemChangedMessages);
+
+    CleanupStack::PopAndDestroy(itemChangedMessages);
+    CleanupStack::PopAndDestroy(fp);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove media by path through a command
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemovePathL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemovePathL(by command)");
+
+    TInt removeError(KErrNone);
+    TBool removeCompleted(ETrue);
+
+    if (!aCmd.IsSupported(KMPXCommandCollectionRemovePath) ||
+        !aCmd.IsSupported(KMPXCommandCollectionRemoveMediaCount))
+        {
+        removeError = KErrArgument;
+        }
+    else
+        {
+        CMPXCollectionPath* path =
+            aCmd.ValueCObjectL<CMPXCollectionPath>(KMPXCommandCollectionRemovePath);
+        CleanupStack::PushL(path);
+
+        // in order to support cancel delete for a category, we need to adjust path. If
+        // the path ends in a category, retrieve all songs under the selected category
+        // and append a new level with all songs under the selected category
+        DoAppendLevelL(*path);
+
+        CMPXCollectionPath* iterationPath = CMPXCollectionPath::NewL(*path);
+        CleanupStack::PushL(iterationPath);
+        iterationPath->ClearSelection();
+
+        // indices of the selected items
+        TArray<TInt> selectionIndices = path->Selection();
+        TInt count(selectionIndices.Count());
+
+        // number of media items to remove in this iteration
+        TInt removeCount = (aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionRemoveMediaCount));
+
+        // remove all in one shot if removeCount is 0 or negative
+        if (removeCount <= 0)
+            {
+            removeCount = count;
+            }
+
+        // If the given path contains multiple selections, remove the first n selected media
+        // and update the path so that client can use this path to call remove iteratively
+        // until all selections are processed
+        //
+        if (count)
+            {
+            for (TInt i = 0; i < removeCount; ++i)
+                {
+                TInt index(selectionIndices[i]);
+
+                MPX_DEBUG4(" path: selected item [index %d] [selectioncount %d] [remove count %d]", index, count, removeCount);
+
+                iterationPath->SelectL(index);
+                path->Remove(index);
+                }
+
+            aCmd.SetCObjectValueL(KMPXCommandCollectionRemovePath, path);
+
+            // indicate to the client that subsequent remove command is required
+            if ((count - removeCount) > 0)
+                {
+                removeCompleted = EFalse;
+                }
+            }
+
+        // Remove the media specified by the path
+        CDesCArray* fp(NULL);
+        TBool supressMsgs(EFalse);
+        CMPXMessageArray* msgAry(NULL);
+
+        if (aCmd.IsSupported(KMPXCommandCollectionRemoveSuppressMsgs) &&
+            aCmd.ValueTObjectL<TBool>(KMPXCommandCollectionRemoveSuppressMsgs))
+            {
+            // Msgs are stored in the command
+            supressMsgs = ETrue;
+
+            CMPXMessageArray* msgs( aCmd.Value<CMPXMessageArray>(KMPXCommandCollectionChangeMsgs) );
+            User::LeaveIfNull( msgs );
+            fp = DoRemoveL(*iterationPath, *msgs);
+            }
+        else
+            {
+            // Msgs will be sent after delete
+            msgAry = CMPXMessageArray::NewL();
+            CleanupStack::PushL(msgAry);
+            fp = DoRemoveL(*iterationPath, *msgAry);
+            }
+
+        CleanupStack::PushL(fp);
+        if (fp->MdcaCount() > removeCount)
+            {
+            removeError = KErrCorrupt;
+            }
+        CleanupStack::PopAndDestroy(fp);
+
+        if (!supressMsgs)
+            {
+            // Send Change Messages
+            iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+            DoHandleChangeL(msgAry);
+            CleanupStack::PopAndDestroy(msgAry);
+            }
+
+        // Cleanup
+        CleanupStack::PopAndDestroy(iterationPath);
+        CleanupStack::PopAndDestroy(path);
+        }
+
+    // mandatory return parameters
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRemoveError, removeError);
+    aCmd.SetTObjectValueL<TBool>(KMPXCommandCollectionRemoveCompleted, removeCompleted);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove media by CMPXMedia through a command
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveMediaL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveMediaL(by command)");
+
+    TInt error(KErrArgument);
+
+    if (aCmd.IsSupported(KMPXCommandCollectionRemoveMedia))
+        {
+        CMPXMedia* media = aCmd.ValueCObjectL<CMPXMedia>(KMPXCommandCollectionRemoveMedia);
+        CleanupStack::PushL(media);
+
+        MPX_TRAP(error, DoRemoveL(*media,
+            aCmd.ValueTObjectL<TBool>(KMPXCommandCollectionRemoveMediaDeleteRecord)));
+
+        CleanupStack::PopAndDestroy(media);
+        }
+
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRemoveMediaError, error);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media/media items from All Songs view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveFromAllSongsL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXItemId>& aSelections,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveFromAllSongsL");
+
+    switch (aPath.Levels())
+        {
+        case 2:
+            {
+            // when the collection is removed, it's intended not to delete the files
+            iDbHandler->RemoveEntireCollectionL();
+            }
+            break;
+
+        case 3:
+            {
+            TInt count(aSelections.Count());
+            if (count)
+                {
+                for (TInt i = 0; i < count; ++i)
+                    {
+                    iDbHandler->RemoveSongL(aSelections[i].iId2, aUriArray, aItemChangedMessages);
+                    } // end for
+                }
+            else
+                {
+                iDbHandler->RemoveSongL(aPath.Id(aPath.Levels() - 1).iId2, aUriArray,
+                     aItemChangedMessages);
+                }
+            }
+            break;
+
+        default:
+            {
+            MPX_DEBUG2("CMPXDbPlugin_DoRemoveFromAllSongsL: Invalid levels[%d]", aPath.Levels());
+            User::Leave(KErrNotSupported);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media/media items from Artists view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveFromArtistsL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXItemId>& aSelections,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveFromArtistsL");
+
+    TInt levels(aPath.Levels());
+    if (levels == 2)
+        {
+        // when the collection is removed, it's intended not to delete the files
+        iDbHandler->RemoveEntireCollectionL();
+        }
+    else
+        {
+        TInt count(aSelections.Count());
+        if (count)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                RemoveFromArtistsL(aPath, aSelections[i].iId2, aUriArray, aItemChangedMessages);
+                }
+            }
+        else
+            {
+            RemoveFromArtistsL(aPath, aPath.Id(levels - 1).iId2, aUriArray, aItemChangedMessages);
+            }
+        }
+
+    MPX_DEBUG2("CMPXDbPlugin__RemoveL__EBrowseArtist: levels[%d]", levels);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media item from Artists view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::RemoveFromArtistsL(
+    const CMPXCollectionPath& aPath,
+    TUint32 aItemId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::RemoveFromArtistsL");
+
+    switch (aPath.Levels())
+        {
+        case 3:
+            {
+            iDbHandler->RemoveSongsMatchingCategoryL(EMPXArtist, aItemId, aUriArray, aItemChangedMessages);
+            break;
+            }
+        case 4:
+            {
+            // remove the songs for the artist and album
+            iDbHandler->RemoveSongsMatchingArtistAndAlbumL(aPath.Id(aPath.Levels() - 2), aItemId,
+                aUriArray, aItemChangedMessages);
+            break;
+            }
+        case 5:
+            {
+            iDbHandler->RemoveSongL(aItemId, aUriArray, aItemChangedMessages);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrArgument);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media/media items from Albums/Genres/Composers view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveFromCategoriesL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXItemId>& aSelections,
+    TMPXGeneralCategory aCategory,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveFromCategoriesL");
+
+    TInt levels(aPath.Levels());
+    if (levels == 2)
+        {
+        // when the collection is removed, it's intended not to delete the files
+        iDbHandler->RemoveEntireCollectionL();
+        }
+    else
+        {
+        TInt count(aSelections.Count());
+        if (count)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                RemoveFromCategoriesL(aPath, aSelections[i].iId2, aCategory,
+                    aUriArray, aItemChangedMessages);
+                }
+            }
+        else
+            {
+            RemoveFromCategoriesL(aPath, aPath.Id(levels - 1).iId2, aCategory,
+                aUriArray, aItemChangedMessages);
+            }
+        }
+
+    MPX_DEBUG2("CMPXDbPlugin__RemoveL__EBrowseAlbum: levels[%d]", levels);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media item from Albums/Genres/Composers view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::RemoveFromCategoriesL(
+    const CMPXCollectionPath& aPath,
+    TUint32 aItemId,
+    TMPXGeneralCategory aCategory,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::RemoveFromCategoriesL");
+
+    switch (aPath.Levels())
+        {
+        case 3:
+            {
+            iDbHandler->RemoveSongsMatchingCategoryL(aCategory, aItemId, aUriArray,
+                aItemChangedMessages);
+            break;
+            }
+        case 4:
+            {
+            iDbHandler->RemoveSongL(aItemId, aUriArray, aItemChangedMessages);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrArgument);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove one or multiple media items from Playlists view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRemoveFromPlaylistsL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXItemId>& aSelections,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRemoveFromPlaylistsL");
+
+    TInt levels(aPath.Levels());
+
+    // all playlists
+    if (levels == 2)
+        {
+        // when the collection is removed, it's intended not to delete the files
+        iDbHandler->RemoveAllPlaylistsL();
+        }
+    else
+        {
+        TArray<TInt> selectionIndices = aPath.Selection();
+        TInt count(selectionIndices.Count());
+
+        // multiple selections
+        if (count)
+            {
+            for (TInt i = (count - 1); i >= 0; --i)
+                {
+                RemoveFromPlaylistsL(aPath, aSelections[i], selectionIndices[i],
+                    aUriArray, aItemChangedMessages);
+                }
+            }
+        // else no selection
+        else
+            {
+            RemoveFromPlaylistsL(aPath, aPath.IdOfIndex(aPath.Index()), aPath.Index(),
+                aUriArray, aItemChangedMessages);
+            }
+        }
+
+    MPX_DEBUG2("CMPXDbPlugin__RemoveL__EBrowsePlaylist: levels[%d]", levels);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media item from Playlists view
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::RemoveFromPlaylistsL(
+    const CMPXCollectionPath& aPath,
+    const TMPXItemId& aItemId,
+    TInt aIndex,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPlugin::RemoveFromPlaylistsL");
+
+    switch (aPath.Levels())
+        {
+        case 3:
+            {
+            iDbHandler->RemovePlaylistL(aItemId.iId2, aUriArray, aItemChangedMessages);
+            break;
+            }
+        case 4:
+            {
+            if ( !iDbHandler->InTransaction() )
+                {
+                iDbHandler->BeginTransactionL();
+                }
+            iDbHandler->RemoveSongFromPlaylistL(aPath.Id(aPath.Levels() - 2).iId2, aItemId,
+                aIndex, aItemChangedMessages);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrArgument);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve URIs associated with this file path for file deletion
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoRetrieveUriForDeletionL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoRetrieveUriForDeletionL");
+
+    // initialize mandatory return parameters
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRetrieveUriError, KErrNone);
+
+    if (!aCmd.IsSupported(KMPXCommandCollectionRetrievePath))
+        {
+        aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRetrieveUriError, KErrArgument);
+        }
+    else
+        {
+        CMPXCollectionPath* path = aCmd.ValueCObjectL<CMPXCollectionPath>(KMPXCommandCollectionRetrievePath);
+        CleanupStack::PushL(path);
+        if (iFirstDeleteStep )
+            {
+            iSelections.Reset( );
+        // in order to support cancel delete for a category, we need to adjust path. If
+        // the path ends in a category, retrieve all songs under the selected category
+        // and append a new level with all songs under the selected category
+        DoAppendLevelL(*path);
+
+        // Ids of the selected items
+            path->SelectionL(iSelections );
+
+        // single selection
+            if (iSelections.Count()== 0 )
+                {
+                iSelections.AppendL(path->Id (path->Levels()- 1 ) );
+                }
+            }
+
+        CDesCArray* fp = new(ELeave) CDesCArrayFlat(4);
+        CleanupStack::PushL(fp);
+
+        TInt count(iSelections.Count());
+        TInt itemCount = count > KIncrementalDeleteCount ? KIncrementalDeleteCount : count;
+        for (TInt i = 0; i < itemCount; ++i )
+            {
+            // do not report song URIs if collection path is for songs within a playlist, i.e.
+            // EBrowsePlaylist and level 4, because client should not be deleting those song
+            // files
+            if (path->Id(1) != EBrowsePlaylist || path->Levels() !=4)
+                {
+                HBufC * uri = iDbHandler->GetUriMatchingIdL (iSelections[0].iId2 );
+                CleanupStack::PushL(uri);
+                fp->AppendL(*uri);
+                CleanupStack::PopAndDestroy(uri);
+                }
+            iSelections.Remove(0);
+            }
+
+        aCmd.SetNoNewLCObjectL(KMPXCommandCollectionRetrieveMediaUriArray, fp);
+        if (iFirstDeleteStep)
+            {
+        aCmd.SetCObjectValueL(KMPXCommandCollectionRetrievePath, path);
+            }
+
+        CleanupStack::PopAndDestroy(fp);
+        CleanupStack::PopAndDestroy(path);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Cleanup deleted records
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::CleanupDeletedRecordsL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::CleanupDeletedRecordsL");
+
+    MPX_TRAPD(error, iDbHandler->CleanupDeletedRecordsL());
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionCleanupError, error);
+    }
+
+// ----------------------------------------------------------------------------
+// Find the duration
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlugin::DoDurationL(
+    CMPXMedia& aMedia,
+    TMPXGeneralCategory aFirstCat,
+    TMPXItemId aId,
+    TMPXGeneralCategory aSecondCat,
+    TMPXItemId aSubId)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoDurationL");
+
+    TInt duration(0);
+
+    switch (aFirstCat)
+        {
+        case EMPXSong:
+            {
+            duration = iDbHandler->GetAllSongsDurationL();
+            break;
+            }
+        case EMPXAlbum:
+            {
+            duration = iDbHandler->GetAlbumDurationL(aId.iId2);
+            break;
+            }
+        case EMPXComposer:
+            {
+            duration = iDbHandler->GetComposerDurationL(aId.iId2);
+            break;
+            }
+        case EMPXGenre:
+            {
+            duration = iDbHandler->GetGenreDurationL(aId.iId2);
+            break;
+            }
+        case EMPXArtist:
+            {
+            if (aSecondCat == EMPXAlbum)
+                {
+                duration = iDbHandler->GetArtistAlbumDurationL(aId.iId2, aSubId.iId2);
+                }
+            else
+                {
+                duration = iDbHandler->GetArtistDurationL(aId.iId2);
+                }
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            duration = iDbHandler->GetPlaylistDurationL(aId.iId2);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+    return duration;
+    }
+
+// ----------------------------------------------------------------------------
+// Append a level to a collection path and set selection to the first item
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPlugin::DoAppendLevelL(
+    CMPXCollectionPath& aPath,
+    CMPXMedia& aMedia )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAppendLevelL");
+
+    RArray<TMPXItemId> ids;
+    CleanupClosePushL(ids);
+
+    // Extract media array, and get all item ids
+    //
+    const CMPXMediaArray* mediaArray = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+    if( !mediaArray )
+        {
+        User::Leave( KErrNoMemory );
+        }
+
+    TInt count(mediaArray->Count());
+    if (count >= 0)
+        {
+        for (TInt i = 0; i < count; ++i)
+            {
+            TMPXItemId id = mediaArray->AtL(i)->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+            ids.AppendL(id);
+            }
+
+        // Put item id array into the path and select the first one
+        aPath.AppendL(ids.Array());
+        if (count > 0)
+            {
+            aPath.Set(0);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&ids);
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Append a level to a collection path and set selection to all songs under the
+// selected category/categories
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoAppendLevelL(
+    CMPXCollectionPath& aPath)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAppendLevelL");
+
+    TMPXItemId contextId(aPath.Id(1));
+    TInt levels(aPath.Levels());
+
+    if ((contextId == EBrowseAll) ||
+        (contextId == EBrowsePlaylist))
+        {
+        return;
+        }
+    else if (levels == 3 || (levels == 4 && contextId == EBrowseArtist))
+        {
+        // retrieve songs in the selected category
+        //
+        CMPXMediaArray* songs = CMPXMediaArray::NewL();
+        CleanupStack::PushL(songs);
+
+        RArray<TMPXAttribute> attributes;
+        CleanupClosePushL(attributes);
+        attributes.AppendL(KMPXMediaGeneralId);
+
+        // Ids of the selected items
+        RArray<TMPXItemId> selections;
+        CleanupClosePushL(selections);
+        aPath.SelectionL(selections);
+
+        // single selection
+        if (selections.Count() == 0)
+            {
+            selections.AppendL(aPath.Id(aPath.Levels() - 1));
+            }
+
+        TInt count(selections.Count());
+
+        // all songs for the selected artist
+        if (contextId == EBrowseArtist && levels == 3)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                iDbHandler->GetSongsMatchingArtistL(selections[i].iId2, attributes.Array(), songs);
+                }
+            if (songs->Count())
+                {
+                aPath.AppendL(selections.Array());
+                }
+            }
+
+        // all songs for the selected artist in the specified album
+        else if ((contextId == EBrowseArtist) && (levels == 4))
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                if (aPath.Id(2) == aPath.Id(3))
+                    {
+                    iDbHandler->GetSongsMatchingArtistL(aPath.Id(3).iId2,
+                        attributes.Array(), songs);
+                    }
+                else
+                    {
+                    iDbHandler->GetSongsMatchingArtistAndAlbumL(aPath.Id(aPath.Levels() - 2),
+                        selections[i].iId2, attributes.Array(), songs);
+                    }
+                }
+            }
+
+         // all songs for the selected album
+        else if (contextId == EBrowseAlbum && levels == 3)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                iDbHandler->GetSongsMatchingAlbumL(selections[i], attributes.Array(), songs);
+                }
+            }
+
+        // all songs for the selected genre
+        else if (contextId == EBrowseGenre && levels == 3)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                iDbHandler->GetSongsMatchingGenreL(selections[i], attributes.Array(), songs);
+                }
+            }
+
+        // all songs for the selected composer
+        else if (contextId == EBrowseComposer && levels == 3)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                iDbHandler->GetSongsMatchingComposerL(selections[i], attributes.Array(), songs);
+                }
+            }
+        else
+            {
+            // else do nothing
+            }
+
+        CleanupStack::PopAndDestroy(&selections);
+        CleanupStack::PopAndDestroy(&attributes);
+
+        // transform from CMPXMediaArray to RArray
+        RArray<TMPXItemId> songIds;
+        CleanupClosePushL(songIds);
+
+        TInt songCount(songs->Count());
+        for (TInt i = 0; i < songCount; ++i)
+            {
+            CMPXMedia* song = (*songs)[i];
+
+            if (song->IsSupported(KMPXMediaGeneralId))
+                {
+                songIds.AppendL(song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+                }
+            }
+
+        // modify the collection path. append another level with all songs under the selected
+        // category/categories selected
+        songCount = songIds.Count();
+
+        if (songCount)
+            {
+            aPath.ClearSelection();
+            aPath.AppendL(songIds.Array());
+
+            // select all
+            for (TInt i = 0; i < songCount; ++i)
+                {
+                aPath.SelectL(songIds[i]);
+                }
+            }
+
+        CleanupStack::PopAndDestroy(&songIds);
+        CleanupStack::PopAndDestroy(songs);
+        }
+    else
+        {
+        // do nothing
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Execute an Add task step
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoAddAsyncL()
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAddAsyncL");
+
+    TBool done(EFalse);
+    const CMPXMedia* task = (iActiveTask->GetCommand().Value<CMPXMedia>(KMPXCommandColAddMedia));
+    if( !task )
+        {
+        User::Leave(KErrNoMemory);
+        }
+
+    CMPXMessageArray& msgArray = iActiveTask->GetChangeMessages();
+
+    if (!task->IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    // Group of items or a single item
+    //
+    if (task->ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+        {
+        if (!task->IsSupported(KMPXMediaArrayContents))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        CMPXMediaArray* ary = task->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull(ary);
+        TInt step( iActiveTask->GetStep() );
+        DoAddItemL( *ary->AtL(step), msgArray );
+
+        if (++step == ary->Count())
+            {
+            done = ETrue;
+            }
+        }
+    else // type == EMPXItem
+        {
+        TUint32 item = DoAddItemL( *task, msgArray );
+        iActiveTask->GetCommand().SetTObjectValueL<TMPXItemId>( KMPXCommandColAddRtnId, item);
+        done = ETrue;
+        }
+
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+    return done;
+    }
+
+// ----------------------------------------------------------------------------
+// Add an item to the collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlugin::DoAddL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAddL");
+
+    if (!aMedia.IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TUint32 itemId(0);
+    CMPXMessageArray* changeMsgAry = CMPXMessageArray::NewL();
+    CleanupStack::PushL(changeMsgAry);
+
+	// start a transaction here
+	if (!iDbHandler->InTransaction())
+		{
+		iDbHandler->BeginTransactionL();
+		}
+
+    // Group of items
+    if (aMedia.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+        {
+        CMPXMediaArray* array = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull( array );
+
+        TInt count(array->Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            // ETrue indicates we are batch committing the songs.
+            // This parameter is only used for the use case of adding
+            // thousands of songs at a time.
+            DoAddItemL(*array->AtL(i), *changeMsgAry, ETrue);
+            }
+        }
+    else // single item
+        {
+        itemId = DoAddItemL(aMedia, *changeMsgAry);
+        }
+
+	// end transaction here.
+	iDbHandler->EndTransactionL(KErrNone);
+
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+    DoHandleChangeL(changeMsgAry);
+    CleanupStack::PopAndDestroy(changeMsgAry);
+
+    return itemId;
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Add an item to the collection
+// ----------------------------------------------------------------------------------------------------------
+//
+TUint32 CMPXDbPlugin::DoAddItemL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aMessageArray,
+    TBool aBatchCommit)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoAddItemL");
+
+    TUint32 itemId(0);
+    if (!aMedia.IsSupported(KMPXMediaGeneralCategory))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    switch (aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory))
+        {
+        case EMPXPlaylist:
+            {
+            if (!aMedia.IsSupported(KMPXMediaArrayContents))
+                {
+                User::Leave(KErrArgument);
+                }
+
+            if (aMedia.IsSupported(KMPXMediaGeneralId))
+                {
+                itemId = iDbHandler->AddSongToPlaylistL(aMedia);
+                MPXDbCommonUtil::AddItemChangedMessageL(aMessageArray, itemId, EMPXItemModified,
+                    EMPXPlaylist, KDBPluginUid);
+                }
+            else if (aMedia.IsSupported(KMPXMediaGeneralUri))
+                {
+                itemId = iDbHandler->AddPlaylistL(aMedia);
+                MPXDbCommonUtil::AddItemChangedMessageL(aMessageArray, EBrowsePlaylist, EMPXItemInserted,
+                    EMPXPlaylist, KDBPluginUid);
+                }
+            else
+                {
+                User::Leave(KErrArgument);
+                }
+            }
+            break;
+
+        case EMPXSong:
+            {
+            // For the use case of adding thousands of songs at once,
+            // we do not create a new database transaction for each song; 
+            // Instead DoAddL() will batch 100 songs under a single transaction.
+            // This enhancement improves performance with MMC-based databases.
+            if (aBatchCommit)
+                {
+                itemId = iDbHandler->AddSongWithNoTransactionL(aMedia, &aMessageArray);
+                }
+            else
+                {
+                itemId = iDbHandler->AddSongL(aMedia, &aMessageArray);
+                }
+            
+            MPXDbCommonUtil::AddItemChangedMessageL(aMessageArray, itemId, EMPXItemInserted,
+                EMPXSong, KDBPluginUid);
+            }
+            break;
+
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    return itemId;
+    }
+
+// ----------------------------------------------------------------------------
+// Update the collection from a media
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoSetL(
+    const CMPXMedia& aMedia )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoSetL");
+
+    if (!aMedia.IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+
+    CMPXMessageArray* changeMsgArray = CMPXMessageArray::NewL();
+    CleanupStack::PushL(changeMsgArray);
+
+    if (aMedia.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+        {
+        if (!aMedia.IsSupported(KMPXMediaArrayContents))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        CMPXMediaArray* array = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull( array );
+        TInt count( array->Count() );
+        for (TInt i = 0; i < count; ++i)
+            {
+            visibleChange = (CMPXDbActiveTask::TChangeVisibility)(visibleChange | DoSetItemL(*array->AtL(i), *changeMsgArray));
+            }
+        }
+    else
+        {
+        visibleChange = DoSetItemL(aMedia, *changeMsgArray);
+        }
+
+    // Handle Change Events
+    if (visibleChange)
+        {
+        iActiveTask->SetVisibleChange(visibleChange);
+        DoHandleChangeL(changeMsgArray);
+        }
+    CleanupStack::PopAndDestroy(changeMsgArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Execute a task step for async set
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPlugin::DoSetAsyncL()
+    {
+    MPX_FUNC("CMPXDbPlugin::DoSetAsyncL");
+
+    TBool done(EFalse);
+    CMPXMedia* task = iActiveTask->GetCommand().Value<CMPXMedia>(KMPXCommandColSetMedia);
+    User::LeaveIfNull( task );
+
+    CMPXMessageArray& msgArray = iActiveTask->GetChangeMessages();
+    CMPXDbActiveTask::TChangeVisibility visibleChange(iActiveTask->GetVisibleChange());
+
+    // Multiple steps can be in a transaction for faster response
+    if( !iDbHandler->InTransaction() )
+        {
+        iDbHandler->BeginTransactionL();
+        }
+
+    if (!task->IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    if (task->ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+        {
+        if (!task->IsSupported(KMPXMediaArrayContents))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        // Multiple items
+        CMPXMediaArray* array = task->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull( array );
+        TInt step = iActiveTask->GetStep();
+        visibleChange = (CMPXDbActiveTask::TChangeVisibility)(visibleChange | DoSetItemL(*array->AtL(step), msgArray));
+
+        if (++step == array->Count())
+            {
+            done = ETrue;
+            }
+        }
+    else // Single item
+        {
+        visibleChange = DoSetItemL(*task, msgArray);
+        done = ETrue;
+        }
+    iActiveTask->SetVisibleChange(visibleChange);
+    return done;
+    }
+
+// ----------------------------------------------------------------------------
+// Update the collection from a media
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbPlugin::DoSetItemL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aMessageArray )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoSetItemL");
+
+    TMPXGeneralCategory category = aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory);
+
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+    switch (category)
+        {
+        case EMPXPlaylist:
+            {
+            if (aMedia.IsSupported(KMPXMediaArrayContents))
+                {
+                CMPXMessage* message = CMPXMedia::NewL();
+                CleanupStack::PushL(message);
+
+                iDbHandler->UpdatePlaylistSongsL(aMedia, *message);
+
+                aMessageArray.AppendL(message); // ownership xfer
+                CleanupStack::Pop(message);
+                }
+            else
+                {
+                iDbHandler->UpdatePlaylistL(aMedia, aMessageArray);
+                }
+
+            visibleChange = CMPXDbActiveTask::ESingleVisible;
+            }
+            break;
+
+        case EMPXSong:
+            {
+            // a list of changed messages as a result of the song being updated
+            visibleChange = iDbHandler->UpdateSongL(aMedia, aMessageArray);
+            }
+            break;
+
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+            break;
+        }
+    return visibleChange; // ownership xfer
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the drm properties for a list of medias
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoSetDrmForArrayL(
+    const CMPXMediaArray& mediaArray,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoSetDrmForArrayL");
+
+    TUint drmAttributes(0);
+
+    // Compact the attribute set
+    //
+    TInt attrCount(aAttrs.Count());
+    for (TInt i = 0; i < attrCount; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdDrm)
+            {
+            drmAttributes |= aAttrs[i].AttributeId();
+            }
+        }
+
+    // Fetch drm attributes for every item
+    //
+    if (drmAttributes)
+        {
+        TInt count(mediaArray.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            if (mediaArray[i]->IsSupported(KMPXMediaGeneralUri))
+                {
+                DoSetMediaDrmL(*mediaArray[i], drmAttributes,
+                    mediaArray[i]->ValueText(KMPXMediaGeneralUri));
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Handle change events
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::HandleChangeL(
+    const CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbPlugin::HandleChange");
+
+    // check if message is filled
+    if (aMessage.IsSupported(KMPXMessageGeneralId))
+        {
+#if _DEBUG
+        PrintMessagesL(aMessage);
+#endif // _DEBUG
+        if(iRefreshing)
+            {
+            if (aMessage.IsSupported(KMPXMessageArrayContents))
+                {
+                const CMPXMessageArray* messageArray = aMessage.Value<CMPXMessageArray>(KMPXMessageArrayContents);
+                if(messageArray)
+                    {
+                    CMPXMessage& message = *((*messageArray)[0]);
+                    TMPXChangeEventType changeType( message.ValueTObjectL<TMPXChangeEventType>( KMPXMessageChangeEventType ) );
+                    TMPXGeneralCategory cat(message.ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory));
+                    if(changeType == EMPXItemInserted && (cat == EMPXSong || cat == EMPXPlaylist || cat == EMPXPodcast))
+                        {
+                        iObs->HandleMessage(aMessage);
+                        }
+                    }
+                }
+            else
+                {
+                TMPXChangeEventType changeType( aMessage.ValueTObjectL<TMPXChangeEventType>( KMPXMessageChangeEventType ) );
+                TMPXGeneralCategory cat(aMessage.ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory));
+                if(changeType == EMPXItemInserted && (cat == EMPXSong || cat == EMPXPlaylist || cat == EMPXPodcast))
+                    {
+                    iObs->HandleMessage(aMessage);
+                    }
+                }
+            }
+        else
+            {
+            if(!iMtpInUse)
+                {
+                iObs->HandleMessage(aMessage);
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Construct a CMPXMedia and call HandleChange
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoHandleChangeL(
+    CMPXMessageArray* aItemChangedMessages,
+    TMPXCommandId aCommandId )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoHandleChangeL");
+
+    if( (iActiveTask->GetVisibleChange() & CMPXDbActiveTask::EAllVisible)
+        && (aCommandId == KMPXCommandIdCollectionSet ||
+            aCommandId == KMPXCommandIdCollectionAdd ||
+            aCommandId == KMPXCommandIdCollectionRemove ||
+            aCommandId == KMPXCommandIdCollectionCompleteDelete ))
+        {
+        MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, EBrowseAll,
+                                                 EMPXItemModified, EMPXCollection, KDBPluginUid);
+        }
+    // group change messages and send to collection client context
+    //
+    CMPXMessage* message = CMPXMessage::NewL();
+    CleanupStack::PushL(message);
+
+    message->SetTObjectValueL<TMPXMessageId>(KMPXMessageGeneralId, KMPXMessageIdItemChanged);
+    message->SetCObjectValueL(KMPXMessageArrayContents, aItemChangedMessages);
+    message->SetTObjectValueL<TInt>(KMPXMessageArrayCount, aItemChangedMessages->Count());
+
+    HandleChangeL(*message);
+
+    CleanupStack::PopAndDestroy(message);
+    }
+
+// ----------------------------------------------------------------------------
+// Handle completion of operation
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoHandleOperationCompletedL(
+    TInt aErr)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoHandleOperationCompletedL");
+
+    // Broadcase change messages
+    //
+    if (iActiveTask->GetVisibleChange())
+        {
+        DoHandleChangeL(&iActiveTask->GetChangeMessages(), iActiveTask->GetTask() );
+        }
+
+    // Callback to engine to signal completion
+    // NOTE: Collection server immediately completes the async message when
+    // Cancel is called, no need to callback to observer
+    if (aErr != KErrCancel)
+        {
+        iObs->HandleCommandComplete(NULL, aErr);
+        }
+
+    if( iDbHandler->InTransaction() )
+        {
+        // Commit if cancelled
+        TInt err(aErr);
+        if( err == KErrCancel )
+            {
+            err = KErrNone;
+            }
+        iDbHandler->EndTransactionL( err );
+        }
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Complete a delete operation
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoHandleDeleteCompleteL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoHandleDeleteCompleteL");
+    iFirstDeleteStep = ETrue;
+    iSelections.Reset();
+    if ( iDbHandler->InTransaction() )
+        {
+        // if it can reach this point in a transaction, there's no error
+        iDbHandler->EndTransactionL( KErrNone );
+        }
+
+    // Change messages
+    if (aCmd.IsSupported(KMPXCommandCollectionDeleteMsgArray))
+        {
+        CMPXMessageArray* msgs = aCmd.Value<CMPXMessageArray>(KMPXCommandCollectionDeleteMsgArray);
+        User::LeaveIfNull( msgs );
+        iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+        DoHandleChangeL(msgs, KMPXCommandIdCollectionCompleteDelete);
+        }
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Reorder a song in a playlist
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoReorderPlaylistL(
+    const CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXDbPlugin::DoReorderPlaylistL");
+
+    if (!aCmd.IsSupported(KMPXCommandReorderPlaylistId) ||
+        !aCmd.IsSupported(KMPXCommandReorderSongId) ||
+        !aCmd.IsSupported(KMPXCommandReorderOriginalOrdinal) ||
+        !aCmd.IsSupported(KMPXCommandReorderNewOrdinal))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    CMPXMessage* message = CMPXMedia::NewL();
+    CleanupStack::PushL(message);
+
+    iDbHandler->ReorderPlaylistL(
+        aCmd.ValueTObjectL<TMPXItemId>(KMPXCommandReorderPlaylistId),
+        aCmd.ValueTObjectL<TMPXItemId>(KMPXCommandReorderSongId),
+        aCmd.ValueTObjectL<TUint>(KMPXCommandReorderOriginalOrdinal),
+        aCmd.ValueTObjectL<TUint>(KMPXCommandReorderNewOrdinal),
+        *message);
+
+    HandleChangeL(*message);
+
+    CleanupStack::PopAndDestroy(message);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Get total songs and playlists count for a database
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoGetCollectionCountL( const CMPXCommand& aCmd )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoGetCollectionCountL");
+    if (!aCmd.IsSupported(KMPXCommandCollectionCountDrive) ||
+        !aCmd.IsSupported(KMPXCommandCollectionCountTable) )
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TInt count = 0;
+    TInt drive = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionCountDrive);
+    TInt table = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionCountTable);
+    switch(table)
+        {
+        case EMPXCollectionCountTrack:
+            count = (TInt)iDbHandler->GetMusicCountL(drive);
+            break;
+        case EMPXCollectionCountPlaylist:
+            count = (TInt)iDbHandler->GetPlaylistCountL(drive);
+            break;
+        case EMPXCollectionCountTotal:
+            count = (TInt)iDbHandler->GetTotalCountL(drive);
+            break;
+        default:
+            User::Leave(KErrArgument);
+        }
+    ((CMPXMedia&)aCmd).SetTObjectValueL<TInt>(KMPXCommandCollectionCountValue, count);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Get URIs for all songs and file playlists in a database
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoGetCollectionUriL( const CMPXCommand& aCmd )
+    {
+    MPX_FUNC("CMPXDbPlugin::DoGetCollectionCountL");
+    if (!aCmd.IsSupported(KMPXCommandCollectionURIDrive) ||
+        !aCmd.IsSupported(KMPXCommandCollectionURITable) ||
+        !aCmd.IsSupported(KMPXCommandCollectionURIFromID) ||
+        !aCmd.IsSupported(KMPXCommandCollectionURIRecords) )
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TInt drive = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionURIDrive);
+    TInt table = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionURITable);
+    TInt fromID = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionURIFromID);
+    TInt recnum = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionURIRecords);
+
+    CDesCArray* uris = new(ELeave) CDesCArrayFlat(4);
+    CleanupStack::PushL(uris);
+    TInt lastID = 0;
+
+    switch(table)
+        {
+        case EMPXCollectionURITrack:
+            iDbHandler->GetMusicUriArrayL(drive, fromID, recnum, *uris, lastID);
+            break;
+        case EMPXCollectionURIPlaylist:
+            iDbHandler->GetPlaylistUriArrayL(drive, fromID, recnum, *uris, lastID);
+            break;
+        default:
+            User::Leave(KErrArgument);
+        }
+
+    ((CMPXMedia&)aCmd).SetNoNewLCObjectL(KMPXCommandCollectionURIList, uris);
+    ((CMPXMedia&)aCmd).SetTObjectValueL(KMPXCommandCollectionURILastID, lastID);
+    CleanupStack::PopAndDestroy(uris);
+    }
+
+
+// ----------------------------------------------------------------------------------------------------------
+// Perform one step of the incremental operation
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXDbPlugin::DoIncrementalOpenL( const CMPXCommand& aCmd )
+    {
+    MPX_DEBUG1("CMPXDbPlugin::DoIncrementalOpenL <--");
+
+    TInt offset = aCmd.ValueTObjectL<TInt>( KMPXCollectionCommandIdIncOpenLOffset );
+    TInt numItems = aCmd.ValueTObjectL<TInt>( KMPXCollectionCommandIdIncOpenLNumItems );
+
+    TReadDirection direction(EReadUnknown);
+    if( aCmd.IsSupported(KMPXCollectionCommandIdIncOpenLAscDsc) &&
+        aCmd.IsSupported(KMPXCollectionCommandIdIncOpenLKeyItem) )
+        {
+        direction = aCmd.ValueTObjectL<TReadDirection>(KMPXCollectionCommandIdIncOpenLAscDsc);
+        }
+
+    CMPXCollectionPath* path =  aCmd.ValueCObjectL<CMPXCollectionPath>(KMPXCollectionCommandIdIncOpenLPath);
+    CleanupStack::PushL( path );
+    MPX_DEBUG_PATH( *path );
+
+    // Switch on level and item selected
+    //
+    TInt levels( path->Levels() );
+    switch( levels )
+        {
+        case 3:  // levels of 3 top level is not stripped
+            {
+            switch( path->Id(1).iId2 )
+                {
+                case EBrowseAll:
+                    {
+                    CMPXMedia* results = CMPXMedia::NewL();
+                    CleanupStack::PushL( results );
+
+                    TMPXOpenDataBlock block;
+                    block.iOffset = offset;
+                    block.iSize = numItems;
+
+                    // Todo: this should come from the UI
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL( attrs );
+                    attrs.AppendL(TMPXAttribute(KMPXMediaIdGeneral,
+                                   EMPXMediaGeneralId | EMPXMediaGeneralType | EMPXMediaGeneralCategory |
+                                   EMPXMediaGeneralTitle | EMPXMediaGeneralFlags));
+                    attrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+                                        EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName ) );
+
+                    // Array to read data from
+                    CMPXMediaArray* array = CMPXMediaArray::NewL();
+                    CleanupStack::PushL( array );
+
+                    // Do we have to use offset or can we use asc/dsc
+                    //
+                    if( direction == EReadUnknown )
+                        {
+                        iDbHandler->GetSongsAtOffsetL( array, attrs.Array(), offset, numItems );
+                        }
+                    else
+                        {
+                        iDbHandler->GetSongsInBlockL( array, attrs.Array(),
+                                                      aCmd.ValueText( KMPXCollectionCommandIdIncOpenLKeyItem ),
+                                                      numItems,
+                                                      direction );
+                        }
+
+                    TInt max( path->Count() );
+                    TInt count(0);
+                    TInt aryCount( array->Count() );
+                    // Update the collection path
+                    while( count<numItems && offset<max &&
+                           count<aryCount )
+                        {
+                        TMPXItemId id = array->AtL(count)->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+                        path->Update( offset, id );
+
+                        // Next items
+                        offset++;
+                        count++;
+                        }
+
+                    // Setup the results
+                    //
+                    results->SetCObjectValueL(KMPXMediaArrayContents, array);
+                    results->SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+                    CleanupStack::PopAndDestroy( array );
+                    CleanupStack::PopAndDestroy( &attrs );
+
+                    // Callback with results
+                    //
+                    results->SetTObjectValueL<TMPXOpenDataBlock>( KMPXCollectionOpenLResultRange, block );
+                    iObs->HandleOpen( results, path, KErrNone );
+                    CleanupStack::PopAndDestroy( results );
+                    break;
+                    }
+                default:
+                    User::Leave(KErrNotSupported);
+                    break;
+                }
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            break;
+            }
+
+        }
+    CleanupStack::PopAndDestroy( path );
+
+    MPX_DEBUG1("CMPXDbPlugin::DoIncrementalOpenL -->");
+    }
+
+// ----------------------------------------------------------------------------
+// Maps a given browse type to a category ID.
+// ----------------------------------------------------------------------------
+//
+TMPXGeneralCategory CMPXDbPlugin::CategoryForBrowseType(
+    TMCBrowseType aBrowseType)
+    {
+    MPX_FUNC("CMPXDbPlugin::CategoryForBrowseType");
+
+    TMPXGeneralCategory cat(EMPXNoCategory);
+
+    switch (aBrowseType)
+        {
+        case EBrowseAll:
+            {
+            cat = EMPXSong;
+            break;
+            }
+        case EBrowseArtist:
+            {
+            cat = EMPXArtist;
+            break;
+            }
+        case EBrowseAlbum:
+            {
+            cat = EMPXAlbum;
+            break;
+            }
+        case EBrowsePlaylist:
+            {
+            cat = EMPXPlaylist;
+            break;
+            }
+        case EBrowseGenre:
+            {
+            cat = EMPXGenre;
+            break;
+            }
+        case EBrowseComposer:
+            {
+            cat = EMPXComposer;
+            break;
+            }
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        case EBrowsePodcasts:
+            {
+            cat = EMPXPodcast;
+            break;
+            }
+#endif
+        default:
+            {
+            // do nothing
+            break;
+            }
+        }
+
+    return cat;
+    }
+
+// ----------------------------------------------------------------------------
+// Maps a given category ID to a browse type.
+// ----------------------------------------------------------------------------
+//
+TMCBrowseType CMPXDbPlugin::BrowseTypeForCategory(
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbPlugin::BrowseTypeForCategory");
+
+    TMCBrowseType browseType(EBrowseComposer);
+
+    switch (aCategory)
+        {
+        case EMPXSong:
+            {
+            browseType = EBrowseAll;
+            break;
+            }
+        case EMPXArtist:
+            {
+            browseType = EBrowseArtist;
+            break;
+            }
+        case EMPXAlbum:
+            {
+            browseType = EBrowseAlbum;
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            browseType = EBrowsePlaylist;
+            break;
+            }
+        case EMPXGenre:
+            {
+            browseType = EBrowseGenre;
+            break;
+            }
+        default:
+            {
+            // do nothing
+            break;
+            }
+        }
+
+    return browseType;
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the type, category and title attributes in the specified media instance
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::SetMediaGeneralAttributesL(
+    CMPXMedia& aMedia,
+    TMPXGeneralType aType,
+    TMPXGeneralCategory aCategory,
+    const TDesC& aTitle)
+    {
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, aType);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, aCategory);
+    aMedia.SetTextValueL(KMPXMediaGeneralTitle, aTitle);
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the type, category and title attributes in the specified media instance
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::SetMediaGeneralAttributesL(
+    CMPXMedia& aMedia,
+    TMPXGeneralType aType,
+    TMPXGeneralCategory aCategory,
+    TInt aId)
+    {
+    MPX_FUNC("CMPXDbPlugin::SetMediaGeneralAttributesL");
+
+    HBufC* title = iDbHandler->GetNameMatchingIdL(aId);
+    CleanupStack::PushL(title);
+    SetMediaGeneralAttributesL(aMedia, aType, aCategory, *title);
+    CleanupStack::PopAndDestroy(title);
+    }
+
+// ----------------------------------------------------------------------------
+// Set the attribute list according to current path
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::SetAttributesL(
+    const CMPXCollectionPath& aPath,
+    RArray<TMPXAttribute>& aAttrs,
+    RArray<TInt>& aSupportedIds )
+    {
+    aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral,
+        EMPXMediaGeneralId | EMPXMediaGeneralType | EMPXMediaGeneralCategory |
+        EMPXMediaGeneralTitle | EMPXMediaGeneralFlags) );
+
+    aSupportedIds.AppendL(KMPXMediaIdContainer);
+    aSupportedIds.AppendL(KMPXMediaIdGeneral);
+
+    TInt levels(aPath.Levels());
+    if ( 2 == levels )
+        {
+        // check the browse type
+        switch ( aPath.Id(1).iId2 )
+            {
+            case EBrowseAll:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+                    EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName ) );
+                aSupportedIds.AppendL( KMPXMediaIdMusic );
+                break;
+                }
+            case EBrowseArtist:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralCount) );
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+                                    EMPXMediaMusicAlbumArtFileName ) );
+                break;
+                }
+            case EBrowseAlbum:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+                    EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName ) );
+                aSupportedIds.AppendL( KMPXMediaIdMusic );
+                break;
+                }
+            case EBrowsePlaylist:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral,
+                    EMPXMediaGeneralCount | EMPXMediaGeneralDuration ) );
+                break;
+                }
+            case EBrowseGenre:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralCount) );
+                break;
+                }
+            case EBrowseComposer:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralCount) );
+                break;
+                }
+            default:
+                {
+                User::Leave(KErrArgument);
+                }
+            }
+        }
+    else if ( 3 == levels )
+        {
+        // check the browse type
+        switch ( aPath.Id(1).iId2 )
+            {
+            case EBrowseArtist:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralCount) );
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic, EMPXMediaMusicAlbumArtFileName ) );
+                aSupportedIds.AppendL( KMPXMediaIdMusic );
+                break;
+                }
+            case EBrowseAlbum:
+            case EBrowsePlaylist:
+            case EBrowseGenre:
+            case EBrowseComposer:
+                {
+                aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+//                    EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName ) );                    
+                //added ganes
+                    EMPXMediaMusicArtist | EMPXMediaMusicAlbumArtFileName | EMPXMediaMusicAlbum) );                    
+                aSupportedIds.AppendL( KMPXMediaIdMusic );
+                break;
+                }
+            }
+        }
+    else if ( (4 == levels) && (aPath.Id(1).iId2 == EBrowseArtist) )
+        {
+        aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic,
+            EMPXMediaMusicArtist | EMPXMediaMusicAlbum | EMPXMediaMusicAlbumArtFileName ) );
+        aSupportedIds.AppendL( KMPXMediaIdMusic );
+        }
+    }
+
+#ifdef _DEBUG
+// ----------------------------------------------------------------------------
+// Print change events
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::PrintMessagesL(
+    const CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbPlugin::PrintMessages");
+
+    if (aMessage.IsSupported(KMPXMessageArrayContents))
+        {
+        const CMPXMessageArray* messageArray =
+            aMessage.Value<CMPXMessageArray>(KMPXMessageArrayContents);
+        if( !messageArray )
+            {
+            User::Leave( KErrNoMemory );
+            }
+
+        TInt count(messageArray->Count());
+        MPX_DEBUG2("%d messages:", count);
+
+        for (TInt i = 0; i < count; ++i)
+            {
+            PrintMessage(*((*messageArray)[i]));
+            }
+        }
+    else
+        {
+        PrintMessage(aMessage);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Print one change event
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPlugin::PrintMessage(
+    const CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXDbPlugin::PrintMessage");
+
+    if (aMessage.IsSupported(KMPXMessageGeneralId))
+        {
+        TMPXItemId id = aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageGeneralId);
+        MPX_DEBUG3("    message id[0x%x, 0x%x]", id.iId1, id.iId2);
+        }
+
+    if (aMessage.IsSupported(KMPXMessageCollectionId))
+        {
+        TUid uid = aMessage.ValueTObjectL<TUid>(KMPXMessageCollectionId);
+        MPX_DEBUG2("    uid [0x%x]", uid.iUid);
+        }
+
+    if (aMessage.IsSupported(KMPXMessageChangeEventType))
+        {
+        MPX_DEBUG2("    change event type [%d]",
+            aMessage.ValueTObjectL<TMPXChangeEventType>(KMPXMessageChangeEventType));
+        }
+
+    if (aMessage.IsSupported(KMPXMessageMediaGeneralCategory))
+        {
+        MPX_DEBUG2("    category [%d]",
+            aMessage.ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory));
+        }
+
+    if (aMessage.IsSupported(KMPXMessageMediaGeneralId))
+        {
+        TMPXItemId id = aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId);
+        MPX_DEBUG3("    media id[0x%x, 0x%x]", id.iId1, id.iId2);
+        }
+
+    if (aMessage.IsSupported(KMPXMessageMediaDeprecatedId))
+        {
+        TMPXItemId id = aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageMediaDeprecatedId);
+        MPX_DEBUG3("    deprecated id [0x%x, 0x%x]", id.iId1, id.iId2);
+        }
+    }
+
+#endif// _DEBUG
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+#include <implementationproxy.h>
+#include "mpxdbplugin.h"
+
+#if (!defined IMPLEMENTATION_PROXY_ENTRY)
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) {{aUid},(TProxyNewLPtr)(aFuncPtr)}
+#endif
+
+// ----------------------------------------------------------------------------
+// The list of implementations
+// ----------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    { IMPLEMENTATION_PROXY_ENTRY(0x101FFC3A, CMPXDbPlugin::NewL) };
+
+// ----------------------------------------------------------------------------
+// The proxy of implementations
+// ----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitedbplugin/src/mpxdbutil.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contains utility functions for the DB plugin
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+
+#include "mpxcollectiondbdef.h"
+#include "mpxdbutil.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Filter out duplicated Ids
+// ----------------------------------------------------------------------------
+//
+void MPXDbUtil::FilterDuplicatedIdsL(
+    const TArray<TUint32>& aIds,
+    RArray<TUint32>& aFilteredIds)
+    {
+    MPX_FUNC("MPXDbUtil::FilterDuplicatedIdsL");
+
+    TInt count(aIds.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        MPX_TRAPD(error, aFilteredIds.InsertInUnsignedKeyOrderL(aIds[i]));
+        if ((error != KErrNone) && (error != KErrAlreadyExists))
+            {
+            User::Leave(error);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbUtil::TableNameForCategoryL
+// ----------------------------------------------------------------------------
+//
+TPtrC MPXDbUtil::TableNameForCategoryL(
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("MPXDbUtil::TableNameForCategoryL");
+
+    TPtrC ptr;
+    switch (aCategory)
+        {
+        case EMPXPlaylist:
+            ptr.Set(KMCPlaylistTable);
+            break;
+        case EMPXArtist:
+            ptr.Set(KMCArtistTable);
+            break;
+        case EMPXAlbum:
+            ptr.Set(KMCAlbumTable);
+            break;
+        case EMPXGenre:
+            ptr.Set(KMCGenreTable);
+            break;
+        case EMPXComposer:
+            ptr.Set(KMCComposerTable);
+            break;
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return ptr;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbUtil::MusicFieldNameForCategoryL
+// ----------------------------------------------------------------------------
+//
+TPtrC MPXDbUtil::MusicFieldNameForCategoryL(
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("MPXDbUtil::MusicFieldNameForCategoryL");
+
+    TPtrC ptr;
+    switch (aCategory)
+        {
+        case EMPXArtist:
+            ptr.Set(KMCMusicArtist);
+            break;
+        case EMPXAlbum:
+            ptr.Set(KMCMusicAlbum);
+            break;
+        case EMPXGenre:
+            ptr.Set(KMCMusicGenre);
+            break;
+        case EMPXComposer:
+            ptr.Set(KMCMusicComposer);
+            break;
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return ptr;
+    }
+
+// End of File
Binary file mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/data/101FE032.SPD has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/data/101FE032.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,9 @@
+; security policy file for Music Collection
+[database]
+read
+capability = None
+write
+capability = WriteDeviceData
+schema
+capability = WriteDeviceData
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/data/101FFC3F.RSS	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+#include <mpxcollectionplugin.hrh>
+#include "mpxpluginresource.hrh"
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: Supported plugin types.
+ *  E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. for music plugin will be: 0x101FFCDA
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags
+ *         Collection specific flags include:
+ *                EMPXCollectionPluginFlagCacheable - Are media results cachable in the collection cache
+ *         General flags include: 
+ *                EMPXPluginFlagPreLoad - Should the plugin be pre loaded when the collection starts
+ *                
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXCollectionPluginPriorities. This value determines
+ *  the returning order when several plugins can support the same set of Uids. 
+ *  Default value of this field is EMPXCollectionPluginPriorityNormal.
+ *
+ * <c>non-cacheable attributes</c> optional
+ *  List of content IDs that cannot be cached in the collection cache.
+ *  The list is a list of hexidecimal numbers, semicolon seperated
+ *  For example, <c>0x101FFC45</c> not cache media objects w/ drm attributes
+ *
+ */
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC3F;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXCollectionPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x101FFC3C;
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "audio/mp3;audio/x-mp3;audio/mp4;audio/3gpp;audio/3gpp2;audio/wav;audio/x-wav;audio/x-au;audio/au;audio/3gp;audio/mpeg;audio/aac;audio/x-ms-wma;x-caf-audio/x-ms-wma;audio/x-pn-realaudio;audio/x-realaudio;audio/vnd.rn-realaudio";
+                    opaque_data = "<s>*<e>.mp3;.aac;.3gp;.3gpp;.3g2;.3gpp2;.m4a;.wav;.mp4;.wma;.dcf;.odf;.asf;.m3u;.rm;.ra"
+                                  "<t>"EMPXCollectionPluginPodCast"</t>"
+                                  "<p>"EMPXCollectionPluginMusic"</p>"
+                                  "<i>"EMPXPluginPriorityNormal"</i>"
+                                  "<c>"EDRMContentId"</c>" // DRM
+                                  "<f>"EPreloadAndCache"</f>";
+                    }
+                };
+            }
+        };
+    }
+            
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/data/PCRes.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,330 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file contains all the resources for the Podcast Collection
+*
+*/
+
+
+//  INCLUDES
+#include <bldvariant.hrh>
+#include <badef.rh>
+#include <pathconfiguration.hrh>
+#include "mpxpodcastcollectiondb.hrh"
+#include <mpxpodcastcollectiondb.loc>
+
+STRUCT MENU_ITEM
+    {
+    LONG   id;
+    STRUCT name;
+    }
+
+STRUCT MENU_ITEM_ARRAY
+    {
+    STRUCT array_of_menu_items[];
+    }
+
+//  RESOURCE IDENTIFIER
+NAME    OAPC // 4 letter ID
+
+//  RESOURCE DEFINITIONS
+
+RESOURCE BA_RSS_SIGNATURE { }
+
+//----------------------------------------------------
+// r_mc_music_library_menu_items
+// Menu items to be displayed in the music library view
+//----------------------------------------------------
+//
+RESOURCE MENU_ITEM_ARRAY r_mc_menu_items_array
+    {
+    array_of_menu_items =
+        {
+        MENU_ITEM {id = EBrowseAll;             name = LBUF {txt = qtn_nmp_all_episodes;};},
+        MENU_ITEM {id = EBrowseTitle;           name = LBUF {txt = qtn_nmp_by_title;};},
+        MENU_ITEM {id = EBrowsePubDate;         name = LBUF {txt = qtn_nmp_by_publish_date;};},
+        MENU_ITEM {id = EBrowseRecentlyAdded;   name = LBUF {txt = qtn_nmp_recently_added;};},
+        MENU_ITEM {id = EBrowseNotPlayed;       name = LBUF {txt = qtn_nmp_not_yet_played;};}
+        };
+    }
+
+//----------------------------------------------------
+// r_mc_music_library_menu_items
+// Menu items to be displayed in the music library view
+//----------------------------------------------------
+//
+RESOURCE MENU_ITEM_ARRAY r_mc_menu_titles_array
+    {
+    array_of_menu_items =
+        {
+        MENU_ITEM {id = EBrowseAll;             name = LBUF {txt = qtn_nmp_title_all_episodes;};},
+        MENU_ITEM {id = EBrowseTitle;           name = LBUF {txt = qtn_mus_title_titles;};},
+        MENU_ITEM {id = EBrowsePubDate;         name = LBUF {txt = qtn_mus_title_publish_date;};},
+        MENU_ITEM {id = EBrowseRecentlyAdded;   name = LBUF {txt = qtn_nmp_title_recently_added;};},
+        MENU_ITEM {id = EBrowseNotPlayed;       name = LBUF {txt = qtn_nmp_unplayed;};}
+        };
+    }
+
+RESOURCE TBUF { buf="PCRES"; }
+
+
+// ** DEFAULT MUSIC FOLDER STRINGS
+
+//----------------------------------------------------
+//
+//    r_mc_default_music_folders
+//
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_default_music_folders
+    {
+    items =
+        {
+        LBUF {txt = text_memory_card_root_path;},
+        LBUF {txt = text_phone_memory_root_path;}
+        };
+    }
+
+//----------------------------------------------------
+// r_mc_music_file_extensions
+// file extensions which be scanned by music collection
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_music_file_extensions
+    {
+    items =
+        {
+#ifdef __WMA
+        LBUF {txt = ".wma";},
+#endif
+        LBUF {txt = ".mp3";},
+        LBUF {txt = ".m4a";},
+        LBUF {txt = ".aac";}
+        };
+    }
+
+//----------------------------------------------------
+// r_mc_file_extensions_mime
+// file extensions which can be scanned by music
+// collection, however, these files types must be
+// checked whether their MIME types match as well
+// because they can be DRM or video files
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_file_extensions_mime
+    {
+    items =
+        {
+        LBUF {txt = "";},
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+        LBUF {txt = ".ra";},
+        LBUF {txt = ".rm";},
+#endif
+        LBUF {txt = ".mp4";},
+        LBUF {txt = ".3gpp";},
+        LBUF {txt = ".3gp";},
+        LBUF {txt = ".3gpp2";},
+        LBUF {txt = ".3g2";},
+        LBUF {txt = ".dcf";},
+        LBUF {txt = ".odf";}
+        };
+    }
+
+//----------------------------------------------------
+// r_mc_file_extensions_drm
+// file extensions which can be scanned by music
+// collection, however, these files types must be
+// checked which type of DRM is used
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_file_extensions_drm
+    {
+    items =
+        {
+        LBUF {txt = "";},
+        LBUF {txt = ".dcf";},
+        LBUF {txt = ".odf";}
+        };
+    }
+
+//----------------------------------------------------
+// r_mc_mime_types
+// Mime types which be scanned by music collection
+//----------------------------------------------------
+//
+RESOURCE ARRAY r_mc_mime_types
+    {
+    items =
+        {
+#ifdef __WMA
+        LBUF {txt = "audio/x-ms-wma";},
+#endif
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+        LBUF {txt = "audio/x-pn-realaudio";},
+        LBUF {txt = "audio/x-realaudio";},
+        LBUF {txt = "audio/vnd.rn-realaudio";},
+//        LBUF {txt = "application/vnd.rn-realmedia";}
+#endif
+        LBUF {txt = "audio/mpeg";},
+        LBUF {txt = "audio/aac";},
+        LBUF {txt = "audio/mp3";},
+        LBUF {txt = "audio/x-mp3";},
+        LBUF {txt = "audio/mp4";},
+        LBUF {txt = "audio/3gpp";},
+        LBUF {txt = "audio/m4a";},
+        LBUF {txt = "audio/3gpp2";},
+        LBUF {txt = "audio/mpeg4";}
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mp_recently_added
+// Text string for recently added playlist
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mp_recently_added
+    {
+    txt = qtn_nmp_recently_added;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mp_unplayed
+// Text string for not yet played playlist
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mp_unplayed
+    {
+    txt = qtn_nmp_not_yet_played;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_podcast_num_episodes
+// Number of episodes text for > 1 episodes or 0
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_podcast_num_episodes
+    {
+    txt = qtn_mus_podcast_num_episodes;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_podcast_one_episode
+// Number of episodes text for a single episode
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_podcast_one_episode
+    {
+    txt = qtn_mus_podcast_one_episode;
+    }
+
+//----------------------------------------------------
+// r_mpx_qtn_nmp_publish_date_array
+// Menu items to be displayed in the music library view
+//----------------------------------------------------
+//
+RESOURCE MENU_ITEM_ARRAY r_mpx_qtn_nmp_publish_date_array
+    {
+    array_of_menu_items =
+        {
+        MENU_ITEM {id = EMPXPublishToday;       name = LBUF {txt = qtn_nmp_publish_date_today;};},
+        MENU_ITEM {id = EMPXPublishYesterday;   name = LBUF {txt = qtn_nmp_publish_date_yesterday;};},
+        MENU_ITEM {id = EMPXPublishThisWeek;    name = LBUF {txt = qtn_nmp_publish_date_this_week;};},
+        MENU_ITEM {id = EMPXPublishLastWeek;    name = LBUF {txt = qtn_nmp_publish_date_last_week;};},
+        MENU_ITEM {id = EMPXPublish2WeekAgo;    name = LBUF {txt = qtn_nmp_publish_date_2_weeks;};},
+        MENU_ITEM {id = EMPXPublish3WeekAgo;    name = LBUF {txt = qtn_nmp_publish_date_3_weeks;};},
+        MENU_ITEM {id = EMPXPublishLastMonth;   name = LBUF {txt = qtn_nmp_publish_date_last_months;};},
+        MENU_ITEM {id = EMPXPublishEarlier;     name = LBUF {txt = qtn_nmp_publish_date_earlier;};},
+        MENU_ITEM {id = EMPXPublishUnknown;     name = LBUF {txt = qtn_nmp_publish_date_unknown;};}
+        };
+    }
+
+//----------------------------------------------------
+// r_mpx_qtn_nmp_episodes_title_published_date_array
+// Episode View titles to be displayed when Episode view
+// is activated via selecting a Publish Date View category
+//----------------------------------------------------
+//
+RESOURCE MENU_ITEM_ARRAY r_mpx_qtn_nmp_episodes_title_published_date_array
+    {
+    array_of_menu_items =
+        {
+        MENU_ITEM {id = EMPXPublishToday;       name = LBUF {txt = qtn_nmp_episodes_title_published_today;};},
+        MENU_ITEM {id = EMPXPublishYesterday;   name = LBUF {txt = qtn_nmp_episodes_title_published_yesterday;};},
+        MENU_ITEM {id = EMPXPublishThisWeek;    name = LBUF {txt = qtn_nmp_episodes_title_published_this_week;};},
+        MENU_ITEM {id = EMPXPublishLastWeek;    name = LBUF {txt = qtn_nmp_episodes_title_published_last_week;};},
+        MENU_ITEM {id = EMPXPublish2WeekAgo;    name = LBUF {txt = qtn_nmp_episodes_title_published_two_weeks_ago;};},
+        MENU_ITEM {id = EMPXPublish3WeekAgo;    name = LBUF {txt = qtn_nmp_episodes_title_published_three_weeks_ago;};},
+        MENU_ITEM {id = EMPXPublishLastMonth;   name = LBUF {txt = qtn_nmp_episodes_title_published_last_month;};},
+        MENU_ITEM {id = EMPXPublishEarlier;     name = LBUF {txt = qtn_nmp_episodes_title_published_earlier;};},
+        MENU_ITEM {id = EMPXPublishUnknown;     name = LBUF {txt = qtn_nmp_episodes_title_published_date_unknown;};}
+        };
+    }
+
+// r_mpx_qtn_mus_podcasts
+// Text for podcast collection plugin menu item within
+// main music player view
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_podcasts    { txt = qtn_mus_podcasts; }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mp_title_my_podcast
+// Title text for Podcast Menu View
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mp_title_my_podcast { txt = qtn_mp_title_my_podcast; }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mp_title_podcasts
+// Title text for Podcast main view
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mp_title_podcasts { txt = qtn_vmp_title_podcasts; }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mp_title_all_episodes
+// Title text Episodes View when accessed via "All episodes"
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mp_title_all_episodes { txt = qtn_nmp_title_all_episodes; }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_title_publish_date
+// Title text for Publish Date View
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_title_publish_date { txt = qtn_mus_title_publish_date; }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_title_publish_date
+// Title text for Titles View
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mus_title_titles { txt = qtn_mus_title_titles; }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mp_title_recently_added
+// Title text Episodes View when accessed via "Recently added"
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mp_title_recently_added { txt = qtn_nmp_recently_added; }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mp_title_unplayed
+// Title text Episodes View when accessed via "Not yet played"
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_mpx_qtn_mp_title_unplayed { txt = qtn_nmp_unplayed; }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project Podcast SQLite plugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxpodcastcollectiondb.loc	APP_LAYER_LOC_EXPORT_PATH(mpxpodcastcollectiondb.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxpodcastdbplugin.mif
+OPTION HEADERFILE mpxpodcastdbplugin.mbg
+OPTION SOURCES -c8,8 qgn_graf_mup_dlst_podcast
+END
+
+
+PRJ_MMPFILES
+
+mpxsqlitepodcastdbplugin.mmp
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1 @@
+/c8,8 qgn_graf_mup_dlst_podcast
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/group/mpxpodcastdbpluginicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxdbplugin
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxpodcastdbplugin.mif
+HEADERFILENAME=$(HEADERDIR)/mpxpodcastdbplugin.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/group/mpxsqlitepodcastdbplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Podcast db plugin project specification
+*
+*/
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxsqlitepodcastdbplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC3F
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN
+
+VERSION 15.0
+
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+#define __ENABLE_PODCAST_IN_MUSIC_MENU
+
+SOURCEPATH      ../src
+SOURCE          mpxpodcastdbpluginproxy.cpp
+SOURCE          mpxpodcastdbplugin.cpp
+SOURCE          mpxpodcastdbhandler.cpp
+SOURCE          mpxdbutil.cpp
+
+SOURCE          mpxpodcastdbmanager.cpp
+SOURCE          mpxdbpodcast.cpp
+SOURCE          mpxdbcategory.cpp
+SOURCE          mpxdbauxiliary.cpp
+
+SOURCEPATH      ../data
+START RESOURCE  101FFC3F.RSS
+TARGET          mpxsqlitepodcastdbplugin.rsc
+END
+
+START RESOURCE  PCRes.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+
+LIBRARY         euser.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+LIBRARY         sqldb.lib
+LIBRARY         bafl.lib
+LIBRARY         apmime.lib
+LIBRARY         sysutil.lib
+#ifdef __MTP_PROTOCOL_SUPPORT
+LIBRARY         centralrepository.lib
+#endif
+#ifdef RD_MULTIPLE_DRIVE
+LIBRARY         PlatformEnv.lib
+#endif //RD_MULTIPLE_DRIVE
+
+LIBRARY         mpxsqlitedbcommon.lib
+LIBRARY         mpxcommon.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxdbauxiliary.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for interacting with the Auxiliary
+*                table.
+*
+*/
+
+
+#ifndef MPXDBAUXILIARY_H
+#define MPXDBAUXILIARY_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing the playlist tables
+*
+* @lib mpxpodcastdbplugin.lib
+*/
+class CMPXDbAuxiliary :
+    public CMPXDbTable
+    {
+    public:
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbManager instance.
+        */
+        static CMPXDbAuxiliary* NewL(CMPXDbManager& aDbManager);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @return New CMPXDbManager instance on the cleanup stack.
+        */
+        static CMPXDbAuxiliary* NewLC(CMPXDbManager& aDbManager);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXDbAuxiliary();
+
+    public:
+
+        /**
+        * Sets the last refreshed time in the auxiliary table.
+        * @param aTime the last refreshed time value
+        */
+        void SetLastRefreshedTimeL(TTime aTime);
+
+        /**
+        * Gets the last refreshed time from the auxiliary table.
+        * @return last refreshed time value
+        */
+        TTime LastRefreshedTimeL();
+
+        /**
+        * Sets the db corrupted flag in the auxiliary table.
+        * @param aCorrupted db corrupted flag value
+        */
+        void SetDBCorruptedL(TBool aCorrupted);
+
+        /**
+        * Gets the db corrupted flag value from the auxiliary table.
+        * @return db corrupted flag value
+        */
+        TBool DBCorruptedL();
+
+        /**
+         * Sets the save deleted record count value.
+         * @param aDrive drive identifier
+         * @param aValue new field value
+         *
+         */
+         void SetSaveDeletedRecordCountL(TInt aDrive,TUint32 aValue);
+
+        /**
+        * Gets the save deleted record count field value.
+        * @return field value
+        */
+        TUint32 SaveDeletedRecordCountL();
+
+        /**
+         * Gets the save deleted record count field value.
+         * @param aDrive drive identifier
+         * @return field value
+         */
+         TUint32 SaveDeletedRecordCountL(TInt aDrive);
+
+        /**
+        * Checks if all databases have been refreshed.
+        * @return EFalse if at least one database has not been refreshed.
+        */
+        TBool IsRefreshedL();
+
+        /**
+        * Get the auxilary id for a drive
+        * @param aDrive drive to get the volume id
+        * @return TInt id for the aux database
+        */
+        TInt IdL( TInt aDrive );
+
+        /**
+        * Set the auxilary id for a drive
+        * @param aDrive,
+        * @param aId
+        */
+        void SetIdL( TInt aDrive, TInt aId );
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor
+        * @param aDbManager database manager to use for database interactions
+        */
+        CMPXDbAuxiliary(CMPXDbManager& aDbManager);
+
+        /**
+        * Safely construct things that can leave
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Column indexes in the auxiliary table
+        */
+        enum TAuxiliaryColumns
+            {
+            EAuxiliaryId = KMPXTableDefaultIndex,
+            EAuxiliaryVersion,
+            EAuxiliaryTimeRefreshed,
+            EAuxiliaryTimeSynced,
+            EAuxiliaryCorrupt,
+            EAuxiliarySavedDeletedRecordCount
+            };
+
+    };
+
+#endif // MPXDBAUXILIARY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxdbcategory.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,253 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class provides the functions to manipulate the a category
+*                table in the podcast collection database.
+*
+*/
+
+
+#ifndef MPXDBCATEGORY_H
+#define MPXDBCATEGORY_H
+
+// INCLUDES
+#include "mpxdbtable.h"
+#include "mpxmediageneraldefs.h"
+#include "mpxpodcastdefs.h"
+
+// FORWARD DECLARATIONS
+class CMPXMediaArray;
+
+// CLASS DECLARATION
+
+/**
+* Responsible for managing all category tables
+*
+* @lib mpxpodcastdbplugin.lib
+*/
+class CMPXDbCategory :
+    public CMPXDbTable
+    {
+    public:
+
+        /**
+        * Two-phased constructor. Leaves on failure. Places the instance on the
+        * cleanup stack.
+        * @param aDbManager Database manager
+        * @param aCategory Category to identify the table
+        * @return New CMPXDbCategory instance
+        */
+        static CMPXDbCategory* NewLC(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory);
+
+        /**
+        * Two-phased constructor. Leaves on failure.
+        * @param aDbManager Database manager
+        * @param aCategory Category to identify the table
+        * @return New CMPXDbCategory instance
+        */
+        static CMPXDbCategory* NewL(CMPXDbManager& aDbManager,
+            TMPXGeneralCategory aCategory);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPXDbCategory();
+
+    public:
+
+        /**
+        * Add a row to the lookup table
+        * @param aName This is the name to be entered into the row
+        * @param aDriveId The Drive Id the name (category) belongs
+        * @param aNewRecord indicates to the caller if a new record is created. ETrue
+        *        if a new row is created in the table; otherwise EFalse.
+        * @param aCaseSensitive indicates whether case sensitivity should be taken
+        *        into consideration when generating the unique row id
+        * @return The unique id of the row added.
+        */
+        TUint32 AddItemL(const TDesC& aName, TInt aDriveId, TBool& aNewRecord,
+            TBool aCaseSensitive = ETrue);
+
+        /**
+        * Get the name field for a given ID.
+        * @param aId identifies the category item
+        * @return name that matches aId. Ownership is abandoned.
+        */
+        HBufC* GetNameL(TUint32 aId);
+
+        /**
+        * Gets the total number of items in the category table.
+        * @return number of items
+        */
+        TInt CountL();
+
+        /**
+        * Find record(s) matching the criteria
+        * @param aCriteria, selection criteria
+        * @param aAttrs, attributes for the matching record(s)
+        * @param aMediaArray returns the matching record(s)
+        */
+        void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Decrement the number of episodes in the row. If the count gets to 0, remove the row.
+        * @param aId The ID of the row to decrement.
+        * @param aDriveId The drive Id the name (category) belongs to. Episodes on different
+        *                  drives may belong to the same podcast title or composer; consequently,
+        *                  one row for each podcast title/composer id and drive ID pair will exist
+        *                  in the look up table with a count existing for each row
+        *                  that tracks the number number of episodes on that drive with that
+        *                  podcast title/composer.
+        * @param aItemChangedMessages Returns the changed messages if valid
+        */
+        void DecrementEpisodesForCategoryL(const TUint32 aId, TInt aDriveId,
+            CMPXMessageArray* aItemChangedMessages);
+
+        /**
+        * Deletes a category.
+        * @param aId identifies the category
+        * @param aDriveId category drive
+        */
+        void DeleteCategoryL(TUint32 aId, TInt aDriveId);
+
+        /**
+        * Gets details for one category item.
+        * @param aId identifies the category item
+        * @param aAttrs attributes to be returned
+        * @param aMedia returns the requested attributes for te item
+        * @leave KErrNotFound if there is no item with the specified ID
+        */
+        void GetCategoryItemL(TUint32 aId, const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia);
+
+        /**
+        * Gets the details for multiple category items.
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray inout parameter, on input contains the IDs of the category items to
+        *       be returned, on exit contains the requested attributes for these items
+        */
+        void GetCategoryItemsL(const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Gets the details for all category items.
+        * @param aAttrs attributes to be returned
+        * @param aMediaArray returns the requested attributes for all items
+        */
+        void GetAllCategoryItemsL(const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Checks if the specified category item exists.
+        * @param aDriveId drive to check or KDbManagerAllDrives
+        * @param aId identifies the category item
+        * @return ETrue if it exists, EFalse otherwise
+        */
+        TBool CategoryItemExistsL(TInt aDriveId, TUint32 aId);
+
+        /**
+        * Gets the number of episodes for a category item
+        * @param aDriveId drive to check or KDbManagerAllDrives
+        * @param aId identifies the category item
+        * @return number of episodes
+        */
+        TInt GetEpisodeCountL(TInt aDriveId, TUint32 aId);
+
+    private:
+
+        /**
+        * Updates the media with information from the table
+        * @param aRecord record containing the source fields
+        * @param aAttrs attributes to be returned
+        * @param aMedia returns the requested attributes
+        */
+        void UpdateMediaL(RSqlStatement& aRecord, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Returns the category record for a given ID
+        * @param aId identifies the category item
+        * @return rowset
+        */
+        RSqlStatement GetCategoryRecordL(TUint32 aId);
+
+        /**
+        * Replaces the table placeholder in the string parameter with the
+        * category table name.
+        * @param aQuery raw query string
+        * @return processed query string, ownership is transferred.
+        */
+        HBufC* PreProcessStringLC(const TDesC& aQuery);
+
+        /**
+        * Processes a recordset by constructing media instances and adding them
+        * to the specified array.
+        * @param aAttrs attributes to be returned
+        * @param aRecordset recordset to be processed
+        * @param aMediaArray returns the media instances
+        */
+        void ProcessRecordsetL(const TArray<TMPXAttribute>& aAttrs,
+            RSqlStatement& aRecordset, CMPXMediaArray& aMediaArray);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager Database manager insteance to be used
+        * @param aCategory category for this instance
+        */
+        CMPXDbCategory(CMPXDbManager& aDbManager, TMPXGeneralCategory aCategory);
+
+        /**
+        * Second-phase constructor.
+        */
+        void ConstructL();
+
+    private:
+
+        /**
+        * Columns in the category table
+        */
+        enum TCategoryColumns
+            {
+            ECategoryUniqueId = KMPXTableDefaultIndex,
+            ECategoryName,
+            ECategoryEpisodeCount
+            };
+
+    protected:      // Data
+
+        HBufC* iTableName;                  // owned
+        TMPXGeneralCategory iCategory;      // identifies this table
+    };
+
+#endif  // CMPXDbCategory_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxdbpodcast.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,870 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class provides the functions to manipulate the Podcast table
+*
+*/
+
+
+#ifndef MPXDBPODCAST_H
+#define MPXDBPODCAST_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <f32file.h>
+#include <e32property.h>
+#include <badesca.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxpodcastdefs.h>
+#include <mpxmessage2.h>
+
+#include "mpxdbtable.h"
+
+#include "mpxpodcastcollectiondbstd.h"
+#include "mpxdbactivetask.h"
+#include "mpxdbcommonstd.h"
+
+// CONSTANTS
+const TInt KMaxSystemPlaylistQuery = 20;
+
+// FORWARD DECLARATIONS
+class CMPXTableView;
+class CMCGenreParser;
+class CMPXCollectionPath;
+
+// CLASS DECLARATION
+
+/**
+* Observer interface for handling the category ID functionality.
+* This is needed because the incoming CMPXMedia parameters in Add and Update methods
+* contain the names for the category items and the Podcast table has to use IDs linking
+* to the category tables. Using this interface removes the dependency to the category
+* class.
+*
+* Note that this interface is only used when information is written to the Podcast table,
+* when information is retrieved the query takes care of also retrieving the names from
+* the corresponding category tables so the outgoing CMPXMedia will contain the correct
+* information.
+*/
+class MMPXDbPodcastObserver
+    {
+    public:
+        /**
+        * Called when a new category item has to be added to a category table.
+        * @param aCategory category type
+        * @param aName name string
+        * @param aDriveId drive to add the category item to
+        * @param aItemChangedMessages NULL or valid changed mesages array to be updated
+        * @return the ID of the category item (new or existing)
+        */
+        virtual TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+            TInt aDriveId, CMPXMessageArray* aItemChangedMessages) = 0;
+
+        /**
+        * Called when the ID of a category item changed for a Music record, for example when
+        * the artist name changed for a song. The implementation is supposed to update the
+        * category record and add corresponding item changed messages to the array parameter.
+        * @param aCategory category type
+        * @param aCategoryId category item ID
+        * @param aItemChangedMessages NULL or valid changed mesages array to be updated
+        */
+        virtual void DeleteEpisodeForCategoryL(TMPXGeneralCategory aCategory,
+            TUint32 aCategoryId, TInt aDriveId,
+            CMPXMessageArray* aItemChangedMessages) = 0;
+    };
+
+/**
+*  Podcast table handler
+*
+*  @lib mpxpodcastdbplugin.lib
+*/
+class CMPXDbPodcast :
+    public CMPXDbTable
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aObserver Observer for podcast notifications
+        * @return New CMPXDbPodcast instance
+        */
+        static CMPXDbPodcast* NewL(CMPXDbManager& aDbManager, CMPXResource& aResource,
+            MMPXDbPodcastObserver& aObserver);
+
+        /**
+        * Two-phased constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aObserver Observer for podcast notifications
+        * @return New CMPXDbPodcast instance
+        */
+        static CMPXDbPodcast* NewLC(CMPXDbManager& aDbManager, CMPXResource& aResource,
+            MMPXDbPodcastObserver& aObserver);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPXDbPodcast();
+
+    public: // New functions
+
+        /**
+        * Add a episode to the podcast table
+        * @param aMedia  media object which contains file path,
+        *                artist, composer, name(title), track, etc...
+        * @param aDrive  drive to add the episode to
+        * @return The unique id of the episode added.
+        */
+        TUint32 AddEpisodeL(const CMPXMedia& aMedia, TInt aDrive);
+
+        /**
+        * Update info for an episode in the Podcast table
+        * @param aEpisodeId episode ID
+        * @param aMedia media object which contains file path,
+        *                artist, composer, name(title), track, etc...
+        * @param aItemChangedMessages a list of change events
+        * @return ETrue if the change is visible in the UI
+        */
+        CMPXDbActiveTask::TChangeVisibility UpdateEpisodeL(TUint32 aEpisodeId, const CMPXMedia& aMedia,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Cleans up the deleted records
+        */
+        void CleanupL();
+
+        /**
+        * Remove an episode from the Podcast table
+        * @param aEpisodeId the ID of the episode to be removed
+        * @param aUriArray on return contains the URI of the deleted episode
+        * @param aItemChangedMessages on return contains changed messages
+        * @param aDeleteRecord indicates whether the client has explictly requested
+        *                to delete the records from the database. If ETrue, records
+        *                associated with the media will be deleted from the database;
+        *                if EFalse, the record will be marked as deleted only.
+        */
+        void DeleteEpisodeL(TUint32 aEpisodeId, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord);
+
+        /**
+        * Remove episodes matching a category from the Podcast table
+        * @param aCategory the category to remove
+        * @param aCategoryId ID of the category to remove
+        * @param aUriArray on return will be filled with all the paths that were removed
+        * @param aItemChangedMessages change events as result of the episode removal
+        */
+        void DeleteCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+            CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove all episodes from the podcast table that are published today
+        * @param aUriArray, on return will be filled with all the paths that were removed
+        * @param aItemChangedMessages change events as result of the episode removal
+        */
+        void DeleteTodayEpisodesL(CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove all episodes from the podcast table that are published yesterday
+        * @param aUriArray, on return will be filled with all the paths that were removed
+        * @param aItemChangedMessages change events as result of the episode removal
+        */
+        void DeleteYesterdayEpisodesL(CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove all episodes from the podcast table that are published this week
+        * @param aUriArray, on return will be filled with all the paths that were removed
+        * @param aItemChangedMessages change events as result of the episode removal
+        */
+        void DeleteThisWeekEpisodesL(CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove all episodes from the podcast table that are published a week ago
+        * @param aUriArray, on return will be filled with all the paths that were removed
+        * @param aItemChangedMessages change events as result of the episode removal
+        */
+        void DeleteLastWeekEpisodesL(CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove all episodes from the podcast table that are published 2 weeks ago
+        * @param aUriArray, on return will be filled with all the paths that were removed
+        * @param aUpdatedPlaylists playlists updated as result of the episode removal
+        * @param aUpdatedCategories, a list of updated categories
+        */
+        void Delete2WeeksAgoEpisodesL(CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove all episodes from the podcast table that are published 3 weeks ago
+        * @param aUriArray, on return will be filled with all the paths that were removed
+        * @param aItemChangedMessages change events as result of the episode removal
+        */
+        void Delete3WeeksAgoEpisodesL(CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove all episodes from the podcast table that are published last month
+        * @param aUriArray, on return will be filled with all the paths that were removed
+        * @param aUpdatedPlaylists playlists updated as result of the episode removal
+        * @param aUpdatedCategories, a list of updated categories
+        */
+        void DeleteLastMonthEpisodesL(CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove all episodes from the podcast table that are published earlier
+        * @param aUriArray, on return will be filled with all the paths that were removed
+        * @param aItemChangedMessages change events as result of the episode removal
+        */
+        void DeleteEarlierEpisodesL(CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove all episodes from the podcast table that do not have a publish date
+        * @param aUriArray on return will be filled with all the paths that were removed
+        * @param aItemChangedMessages change events as result of the episode removal
+        */
+        void DeleteUnknownEpisodesL(CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Get duration for the given episode
+        * @param aEpisodeId episode ID of the episode to search for
+        * @return Episode duration
+        */
+        TInt EpisodeDurationL(TUint32 aEpisodeId);
+
+        /**
+        * Get duration for all episodes
+        * @return Duration value
+        */
+        TInt AllEpisodesDurationL();
+
+        /**
+        * Get duration for all episodes of a specified title
+        * @param aTitleId identifies the title
+        * @return Duration value
+        */
+        TInt TitleDurationL(TUint32 aTitleId);
+
+        /**
+        * Get duration for not played episodes
+        * @return Duration value
+        */
+        TInt NotPlayedDurationL();
+
+        /**
+        * Get duration for recently added episodes
+        * @return Duration value
+        */
+        TInt RecentlyAddedDurationL();
+
+        /**
+        * Get the name of the episode that matches the given episode ID
+        * @param aEpisodeId ID of the episode
+        * @return Episode name, ownership is transferred.
+        */
+        HBufC* GetNameL(TUint32 aEpisodeId);
+
+        /**
+        * Get URI of the episode
+        * @param aEpisodeId ID of the episode
+        * @return Episode URI, ownership is transferred.
+        */
+        HBufC* GetUriL(TUint32 aEpisodeId);
+
+        /**
+        * Get the drive of the episode
+        * @param aEpisodeId ID of the episode
+        * @return Episode drive
+        */
+        TInt GetDriveL(TUint32 aEpisodeId);
+
+        /**
+        * Gets information for an episode
+        * @param aEpisodeId identifies the episode
+        * @param aAttrs attributes to be returned
+        * @param aMedia returns the episode info
+        */
+        void GetEpisodeL(TUint32 aEpisodeId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Gets all episodes
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the episode info
+        */
+        void GetAllEpisodesL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Gets the episodes for a category
+        * @param aCategory category type
+        * @param aCategoryId category item
+        * @param aAttrs attributes to be retrieved
+        * @param aMediaArray returns the episodes info
+        * @param aOrder should the query be ordered, default EFalse
+        */
+        void GetEpisodesForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray,
+            TBool aOrder = EFalse);
+
+        /**
+        * Get all the episodes that match the given title ID
+        * @param aTitleId ID of the title to match
+        * @param aAttrs Array of attributes to return
+        * @param aMediaArray Array to place all the matching episodes' required info
+        */
+        void GetEpisodesMatchingTitleL(TUint aTitleId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the episodes from the podcast table with playcount equal to zero
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Array to place all the matching episodes' required info
+        * @param aIndexOfCurrentlyPlayingItem index of the currently playing
+        *        episode or KErrNotFound(-1) if no currently playing episode within
+        *        this playlist
+        */
+        void GetNotYetPlayedPlaylistEpisodesL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray, TInt& aIndexOfCurrentlyPlayingItem);
+
+        /**
+        * Get the episodes from the podcast table that were added within the last 7 days
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Array to place all the matching episodes' required info
+        * @param aIndexOfCurrentlyPlayingItem index of the currently playing
+        *        episode or KErrNotFound(-1) if no currently playing episode within
+        *        this playlist
+        */
+        void GetRecentlyAddedPlaylistEpisodesL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray, TInt& aIndexOfCurrentlyPlayingItem);
+
+        /**
+        * Get the episodes from the podcast table published today
+        * @param aPublishDateCategoryId if specified (> 0), record the category id in the
+        *        item in the media array
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Array to place all the matching episodes' required info
+        */
+        void GetTodayEpisodesL(const TMPXItemId& aPublishDateCategoryId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the episodes from the podcast table published today
+        * @param aPublishDateCategoryId if specified (> 0), record the category id in the
+        *        item in the media array
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Array to place all the matching episodes' required info
+        */
+        void GetYesterdayEpisodesL(const TMPXItemId& aPublishDateCategoryId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the episodes from the podcast table published this week
+        * @param aPublishDateCategoryId if specified (> 0), record the category id in the
+        *        item in the media array
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Array to place all the matching episodes' required info
+        */
+        void GetThisWeekEpisodesL(const TMPXItemId& aPublishDateCategoryId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the episodes from the podcast table published last week.
+        * @param aPublishDateCategoryId if specified (> 0), record the category id in the
+        *        item in the media array
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Array to place all the matching episodes' required info
+        */
+        void GetLastWeekEpisodesL(const TMPXItemId& aPublishDateCategoryId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the episodes from the podcast table published two weeks ago
+        * @param aPublishDateCategoryId if specified (> 0), record the category id in the
+        *        item in the media array
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Array to place all the matching episodes' required info
+        */
+        void Get2WeeksAgoEpisodesL(const TMPXItemId& aPublishDateCategoryId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the episodes from the podcast table published three weeks ago
+        * @param aPublishDateCategoryId if specified (> 0), record the category id in the
+        *        item in the media array
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Array to place all the matching episodes' required info
+        */
+        void Get3WeeksAgoEpisodesL(const TMPXItemId& aPublishDateCategoryId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the episodes from the podcast table published last month
+        * @param aPublishDateCategoryId if specified (> 0), record the category id in the
+        *        item in the media array
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Array to place all the matching episodes' required info
+        */
+        void GetLastMonthEpisodesL(const TMPXItemId& aPublishDateCategoryId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the episodes from the podcast table published earlier
+        * @param aPublishDateCategoryId if specified (> 0), record the category id in the
+        *        item in the media array
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Array to place all the matching episodes' required info
+        */
+        void GetEarlierEpisodesL(const TMPXItemId& aPublishDateCategoryId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the episodes from the podcast table without a publish date
+        * @param aPublishDateCategoryId if specified (> 0), record the category id in the
+        *        item in the media array
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Array to place all the matching episodes' required info
+        */
+        void GetUnknownEpisodesL(const TMPXItemId& aPublishDateCategoryId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Find the total number of episodes without loading any media objects
+        * Generates a simple sql query to open a column quickly to find the count
+        * @return number of items
+        */
+        TInt CountL();
+
+        /**
+        * Get the number of episodes from the podcast table published today
+        * @return Number of episodes published today.
+        */
+        TInt GetTodayEpisodesCountL();
+
+        /**
+        * Get the number of episodes from the podcast table published today
+        * @return Number of episodes published yesterday.
+        */
+        TInt GetYesterdayEpisodesCountL();
+
+        /**
+        * Get the number of episodes from the podcast table published this week
+        * @return Number of episodes published this week.
+        */
+        TInt GetThisWeekEpisodesCountL();
+
+        /**
+        * Get the number of episodes from the podcast table published last week.
+        * @return Number of episodes published last week.
+        */
+        TInt GetLastWeekEpisodesCountL();
+
+        /**
+        * Get the number of episodes from the podcast table published two weeks ago
+        * @return Number of episodes published 2 weeks ago.
+        */
+        TInt Get2WeeksAgoEpisodesCountL();
+
+        /**
+        * Get the number of episodes from the podcast table published three weeks ago
+        * @return Number of episodes published 3 weeks ago.
+        */
+        TInt Get3WeeksAgoEpisodesCountL();
+
+        /**
+        * Get the number of episodes from the podcast table published last month
+        * @return Number of episodes published last month.
+        */
+        TInt GetLastMonthEpisodesCountL();
+
+        /**
+        * Get the number of episodes from the podcast table published earlieronth.
+        */
+        TInt GetEarlierEpisodesCountL();
+
+        /**
+        * Get the episodes from the podcast table without a publish date
+        * @return Number of episodes without a publish date.
+        */
+        TInt GetUnknownEpisodesCountL();
+
+        /**
+        * Find the total number of episodes recently added.
+        * @return number of episodes
+        */
+        TInt GetRecentlyAddedEpisodesCountL();
+
+        /**
+        * Find the total number of episodes that have not been played without loading
+        * any media objects. Generates a simple sql query to open al column quickly
+        * to find the count
+        * @return number of items
+        */
+        TInt GetNotYetPlayedEpisodesCountL();
+
+        /**
+        * Find episode(s) which match(es) the selection criteria
+        * @param aGeneralId selection criteria (could be episode/album/artist/genre/composer Id)
+        * @param aContainerId selection criteria (could be artist/album id)
+        * @param aType criteria type (EMPXItem or EMPXGroup)
+        * @param aPodcastType podcast criteria type (EMPXPodcastGroup or EMPXPodcastItem)
+        * @param aCriteria selection criteria
+        * @param aAttrs the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray Returns the episodes matching the selection criteria
+        */
+        void FindEpisodesL(TUint32 aGeneralId, TUint32 aContainerId, TMPXGeneralType aType,
+            TMPXPodcastType aPodcastType, const CMPXMedia& aCriteria,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Sets the value of the IsPlaying field for a given episode
+        * @param aEpisodeId identifies the episode
+        * @param aIsPlaying IsPlaying field value
+        */
+        void SetIsPlayingL(TUint32 aEpisodeId, TBool aIsPlaying);
+
+        /**
+        * Returns the podcast count for a given drive
+        * @param aDrive drive
+        * @return the count
+        */
+        TUint GetDrivePodcastCountL(TInt aDrive);
+
+        /**
+        * Get URIs for a given number of podcasts
+        * @param aDrive, specifies drive number for db selection
+        * @param aFromID, specifies unique ID of last record retrieved
+        * @param aRecords, specifies the number of records to get
+        * @param aUriArr, will contain all URIs on return
+        * @param aLastID, will contain unique ID of a last record in the array
+        */
+        void GetPodcastUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                 CDesCArray& aUriArr, TInt& aLastID);
+
+    private:
+
+        /**
+        * Adds an episode to the Podcast table
+        * @param aEpisodeId identifies the episode
+        * @param aMedia contains the episode attributes
+        * @param aDrive drive to add the episode to
+        * @param aItemChangedMessages item changed messages to update
+        */
+        TBool DoAddEpisodeL(TUint32 aEpisodeId, const CMPXMedia& aMedia, TInt aDrive,
+            CMPXMessageArray* aItemChangedMessages);
+
+        /**
+        * Updates an episode in the Podcast table
+        * @param aEpisodeId identifies the episode
+        * @param aMedia contains the episode attributes
+        * @param aItemChangedMessages NULL or item changed messages to update
+        */
+        CMPXDbActiveTask::TChangeVisibility DoUpdateEpisodeL(TUint32 aEpisodeId, const CMPXMedia& aMedia,
+            CMPXMessageArray* aItemChangedMessages);
+
+        /**
+        * Updates an episode in the Podcast table
+        * @param aEpisodeId identifies the episode
+        * @param aMedia contains the episode attributes
+        * @param aDrive drive to add the episode to
+        * @param aItemChangedMessages item changed messages to update
+        * @param aRecordset current episode record in the Podcast table.
+        *       Required to detect any field changes.
+        */
+        CMPXDbActiveTask::TChangeVisibility DoUpdateEpisodeL(TUint32 aEpisodeId, const CMPXMedia& aMedia, TInt aDrive,
+            CMPXMessageArray* aItemChangedMessages, RSqlStatement& aRecordset);
+
+        /**
+        * Deletes an episode corresponding to the current record in aRecordset
+        * @param aRecordset current episode record in the Podcast table.
+        *       Required to detect any field changes.
+        * @param aUriArray Returns the episode URI
+        * @param aItemChangedMessages Returns item changed messages
+        * @param aDeleteRecord ETrue if the episode should be deleted, EFalse if it
+        *       should just be marked as deleted
+        */
+        void DeleteRecordsetL(RSqlStatement& aRecordset, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord = EFalse);
+
+        /**
+        * Remove a episode from the podcast table
+        * @param aRecordset episode record to be removed
+        * @param aUriArray, on return will be filled with all the paths that were removed
+        * @param aItemChangedMessages: change events as result of the episode removal
+        * @param aDeleteRecord: indicates whether the client has explictly requested
+        *                to delete the records from the database. If ETrue, records
+        *                associated with the media will be deleted from the database;
+        *                if EFalse, whether to mark the records as deleted or to delete
+        *                the records will be based on other deciding factors.
+        * @return Error code.
+        */
+        void DoDeleteEpisodeL(RSqlStatement& aRecordset, CDesCArray& aUriArray,
+            CMPXMessageArray& aItemChangedMessages, TBool aDeleteRecord = EFalse);
+
+        /**
+        * Constructs the fields and corresponding values to be written into the Podcast
+        * table for update and insert statements.
+        * @param aEpisodeId identifies the song
+        * @param aMedia contains the new song attributes
+        * @param aItemChangedMessages item changed mesages to add to
+        * @param aPodcastTable points to the existing record in the Podcast table for
+        *       updates or NULL for inserts
+        * @param aFields returns the field names to be updated
+        * @param aValues returns the field values to be updated
+        * @param aDrive drive the song is on
+        * @return ETrue if the change is visible in the UI
+        */
+        CMPXDbActiveTask::TChangeVisibility GeneratePodcastFieldsValuesL(TUint32 aEpisodeId, const CMPXMedia& aMedia,
+            CMPXMessageArray* aItemChangedMessages, RSqlStatement* aPodcastTable,
+            CDesCArray& aFields, CDesCArray& aValues, TInt aDrive);
+
+        /**
+        * Checks if the specified category field (artist/album/genre/composer)
+        * will change and notifies the observer if so.
+        * @param aCategory identifies the category
+        * @param aMedia contains the new record attributes
+        * @param aAttribute corresponding attribute in the media parameter
+        * @param aOldId previous value of the category field or 0 if new record
+        * @param aDriveId drive ID the update is for
+        * @param aItemChangedMessages item changed messages to append to
+        * @param aItemId returns the category item ID
+        * @return ETrue if the field was modified
+        */
+        TBool UpdateCategoryFieldL(TMPXGeneralCategory aCategory, const CMPXMedia& aMedia,
+            const TMPXAttribute& aAttribute, TUint32 aOldId, TInt aDriveId,
+            CMPXMessageArray* aItemChangedMessages, TUint32& aItemId);
+
+        /**
+        * Update the media  with information found in DB
+        * @param aPodcastTable podcast record
+        * @param aAttrs, the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMedia the episode details object
+        */
+        void UpdateMediaL(RSqlStatement& aPodcastTable, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Set the media general attributes in media object with its corresponding
+        * value from the podcast table
+        * @param aPodcastTable podcast record
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaGeneralL(RSqlStatement& aPodcastTable, TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Set the media podcast attributes in media object with its corresponding
+        * value from the podcast table
+        * @param aPodcastTable podcast record
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaMusicL(RSqlStatement& aPodcastTable, TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Set the media audio attributes in media object with its corresponding
+        * value from the podcast table
+        * @param aPodcastTable podcast record
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaAudioL(RSqlStatement& aPodcastTable, TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Set the podcast attributes in media object with its corresponding value
+        * from the podcast table
+        * @param aPodcastTable podcast record
+        * @param aAttrId the required attributes
+        * @param aMedia the media object to set
+        */
+        void UpdateMediaPodcastL(RSqlStatement& aPodcastTable, TUint aAttrId,
+            CMPXMedia& aMedia);
+
+        /**
+        * Get the DRM type of the given file
+        * @param aFile: file
+        * @return DRM type.
+        */
+        TMCDrmType DRMTypeL(const TDesC& aFile);
+
+        /**
+        * Generate matching columns and matching values for podcast table from the given criteria
+        * @param aGeneralId, selection criteria (could be episode/album/artist/genre/composer Id)
+        * @param aContainerId, selection criteria (could be artist/album id)
+        * @param aType, criteria type (EMPXItem or EMPXGroup)
+        * @param aPodcastType, podcast criteria type (EMPXPodcastGroup or EMPXPodcastItem)
+        * @param aCriteria, selection criteria
+        * @return Newly allocated SQL criteria string on the CS.
+        *       Ownership is passed to the caller.
+        */
+        HBufC* GeneratePodcastMatchingCriteriaLC(TUint32 aGeneralId, TUint32 aContainerId,
+            TMPXGeneralType aType, TMPXPodcastType aPodcastType, const CMPXMedia& aCriteria);
+
+        /**
+        * Generate publish date category criteria string for the specified
+        * publish date category
+        * @param aPublishDateCateogry the publish date category to generate
+        *        criteria string for
+        * @return the generated criteria string
+        */
+        HBufC* GeneratePublishDateCategoryCriteriaL(const TUint& aPublishDateCategoryID);
+
+        /**
+        * Generates a full URI from a Podcast record.
+        * @param aRecordset Podcast table record
+        * @return Full URI string. The ownership is passed to the caller.
+        */
+        HBufC* ConstructUriL(RSqlStatement& aRecordset);
+
+        /**
+        * Checks if the specified episode exists.
+        * @param aId identifies the episode
+        * @return ETrue if it exists, EFalse otherwise
+        */
+        TBool EpisodeExistsL(TUint32 aEpisodeId);
+
+        /**
+        * Checks if extra attributes are required. The "standard" attribute set includes:
+        * EMPXMediaGeneralId, EMPXMediaGeneralType, EMPXMediaGeneralCategory,
+        * EMPXMediaGeneralTitle, EMPXMediaGeneralUri, and EMPXMediaGeneralFlags
+        * @param aAttrs attributes to be checked
+        * @return ETrue if extra attributes are required
+        */
+        TBool ExtraFieldsRequired(const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Adds the publish date category ID as a MPXMediaPodcastPubDateCategoryId
+        * attribute to the last media item in the array. Only does this if
+        * the category id is valid (<>0).
+        * @param aPublishDateCategoryId category ID to be added
+        * @param aMediaArray array containing media items
+        */
+        void ProcessPublishDateCategoryL(const TMPXItemId& aPublishDateCategoryId,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Returns the index of the playing item in the arry or KErrNotFound if no
+        * item is marked as playing.
+        * @param aMediaArray array to be processed
+        * @return index of playing item or KErrNotFound
+        */
+        TInt GetPlayingItemL(CMPXMediaArray& aMediaArray);
+
+    private:    // from MMPXTable
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void CreateTableL(RSqlDatabase& aDatabase, TBool aCorruptTable);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual void DropTableL(RSqlDatabase& aDatabase);
+
+        /**
+        * @see MMPXTable
+        */
+        virtual TBool CheckTableL(RSqlDatabase& aDatabase);
+
+    private:
+
+        /**
+        * C++ constructor.
+        * @param aDbManager database manager to use for database interactions
+        * @param aObserver Observer for podcast notifications
+        */
+        CMPXDbPodcast(CMPXDbManager& aDbManager,
+            MMPXDbPodcastObserver& aObserver);
+
+        /**
+        * Symbian 2nd phase constructor.
+        */
+        void ConstructL(CMPXResource& aResource);
+
+    private:
+
+        /**
+        * Column indexes in the music table
+        */
+        enum TPodcastColumns
+            {
+            EPodcastUniqueId = KMPXTableDefaultIndex,
+            EPodcastDeleted,
+            EPodcastDbFlag,
+            EPodcastVolumeId,
+            EPodcastIsPlaying,
+            EPodcastTitle,
+            EPodcastLocation,
+            EPodcastPublishDate,
+            EPodcastAlbumTrack,
+            EPodcastPlayCount,
+            EPodcastTimeAdded,
+            EPodcastTimePlayed,
+            EPodcastDuration,
+            EPodcastSync,
+            EPodcastModified,
+            EPodcastArtist,
+            EPodcastAlbum,
+            EPodcastGenre,
+            EPodcastComposer,
+            EPodcastReleaseDate,
+            EPodcastRating,
+            EPodcastComment,
+            EPodcastCopyright,
+            EPodcastArt,
+            EPodcastUrl,
+            EPodcastDRM,
+            EPodcastLastPlayPosition,
+            EPodcastSampleRate,
+            EPodcastBitRate,
+            EPodcastNumChannels,
+            EPodcastCodec,
+            EPodcastMimeType,
+            EPodcastArtistName,
+            EPodcastAlbumName,
+            EPodcastGenreName,
+            EPodcastComposerName,
+            EPodcastFieldCount
+            };
+
+    private:    // Data
+
+        CDesCArrayFlat* iExtensionsDrm;    // file extensions to check DRM type, owned
+        MMPXDbPodcastObserver& iObserver;
+    };
+
+#endif      // MPXDBPODCAST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxdbutil.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The class MPXDbUtil which contains utilities functions
+*
+*/
+
+
+#ifndef MPXDBUTIL_H
+#define MPXDBUTIL_H
+
+// INCLUDES
+#include <mpxpodcastdefs.h> // Podcast specific
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXMediaArray;
+class RSqlStatement;
+
+// CLASS DECLARATION
+
+/**
+* This static class contains utilities functions used by Podcast Collection
+*
+* @lib mpxpodcastdbplugin.lib
+*/
+class MPXDbUtil
+    {
+    public:
+        /**
+        * Create a media object with title, podcast type, podcast category
+        * and ID then append it to the media array
+        * @param aArray media array
+        * @param aTitle title
+        * @param aType attribute type
+        * @param aCat attribute category
+        * @param aPodcastType attribute podcast type
+        * @param aPodcastCat attribute podcast category
+        * @param aId unique ID
+        * @param aNonPermissibleActions bitmask specifying the non-permissible
+        *       actions for the entry
+        */
+        static void AppendMediaL(CMPXMediaArray& aArray, const TDesC& aTitle,
+            TMPXGeneralType aType, TMPXGeneralCategory aCat,
+            TMPXPodcastType aPodcastType, TMPXPodcastCategory aPodcastCat,
+            TMPXItemId aId = 0, TInt aNonPermissibleActions = 0);
+
+        /**
+        * Returns the Podcast field name for a specified category
+        * @param aCategory identifies the category
+        * @return corresponding field name
+        */
+        static TPtrC PodcastFieldNameForCategoryL(TMPXGeneralCategory aCategory);
+
+        /**
+        * Returns today's date (no hour, minutes, seconds)
+        * @return date value
+        */
+        static TTime Today();
+
+        /**
+        * Returns this month' start date (no hour, minutes, seconds)
+        * @return date value
+        */
+        static TTime MonthStart();
+
+        /**
+        * Returns the index of the current day in week (0-6)
+        * @return index value
+        */
+        static TInt DayNoInWeek();
+
+        /**
+        * Returns the table name for a specified category
+        * @param aCategory identifies the category
+        * @return corresponding table name
+        */
+        static TPtrC TableNameForCategoryL(TMPXGeneralCategory aCategory);
+    };
+
+#endif // MPXDBUTIL_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastcollectiondb.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This file contains declarations for constants of Podcast
+*                Collection. The file can be included in C++ or resource file.
+*
+*/
+
+
+
+#ifndef MPXPODCASTCOLLECTIONDB_HRH
+#define MPXPODCASTCOLLECTIONDB_HRH
+
+enum TMCBrowseType
+    {
+    EBrowseAll = 0,
+    EBrowseTitle,
+    EBrowsePubDate,
+    EBrowseRecentlyAdded,
+    EBrowseNotPlayed
+    };
+
+enum TMPXPublishDate
+    {
+    EMPXPublishToday,
+    EMPXPublishYesterday,
+    EMPXPublishThisWeek,
+    EMPXPublishLastWeek,
+    EMPXPublish2WeekAgo,
+    EMPXPublish3WeekAgo,
+    EMPXPublishLastMonth,
+    EMPXPublishEarlier,
+    EMPXPublishUnknown
+    };
+
+#endif      // MPXPODCASTCOLLECTIONDB_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastcollectiondbdef.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This header file contains macro definitions used by the database subsystem.
+*
+*/
+
+#ifndef MPXPODCASTCOLLECTIONDBDEF_H
+#define MPXPODCASTCOLLECTIONDBDEF_H
+
+// INCLUDES
+#include <mmfmeta.h>
+
+// CONSTANTS
+
+// ================================== DATABASE ================================
+
+// Db filename
+_LIT(KMCDbFile, "pcv6_1.db");
+
+// Collection Db resource file
+_LIT(KMPXCollectionDbResourceFile,  "PCRes.rsc");
+
+// == TABLE NAMES ===============================================
+// The Auxiliary table stores general database metadata like last refresh time etc...
+_LIT(KMCAuxiliaryTable,         "Auxiliary");
+// The Podcast table stores information about the episodes stored within the collection
+_LIT(KMCPodcastTable,           "Podcast");
+// The author table stores information about the authors of the music stored in the collection
+_LIT(KMCAuthorTable,            "Artist"); // podcast author = media artist
+// The Title table stores information about the podcast titles of the episodes stored in the collection
+_LIT(KMCTitleTable,             "Album");  // podcast title = media album
+// The Category table stores information about the category of the episodes stored in the collection
+_LIT(KMCCategoryTable,          "Genre");  // podcast category = media genre
+// The Composer table stores information about the composer of the episodes stored in the collection
+_LIT(KMCComposerTable,          "Composer");
+
+// == Podcast TABLE FIELDS ======================================================
+// Uniqe Id (32 bits). Combination of 4bits of table Id and 28bits of MD5 hashed code
+// (from Path or Name string)
+_LIT(KMCPodcastUniqueId,            "UniqueId");
+_LIT(KMCPodcastVolumeId,            "VolumeId");
+_LIT(KMCPodcastSync,                "Sync");        // Ever SYNCed with PC
+_LIT(KMCPodcastMod,                 "Modified");    // Modified in db
+_LIT(KMCPodcastIsPlaying,           "IsPlaying");   // Episode is currently playing
+_LIT(KMCPodcastDel,                 "Deleted");     // File deleted already
+_LIT(KMCPodcastDuration,            "Duration");
+_LIT(KMCPodcastTimeAdded,           "TimeAdded");
+_LIT(KMCPodcastPlayCount,           "PlayCount");
+_LIT(KMCPodcastTimePlayed,          "TimePlayed");
+_LIT(KMCPodcastRating,              "Rating");
+// NOTE: Location will store the path and file name, without drive-letter
+_LIT(KMCPodcastLocation,            "Location");
+_LIT(KMCPodcastArt,                 "Art");
+_LIT(KMCPodcastDbFlag,              "DbFlag");
+_LIT(KMCPodcastUrl,                 "Url");
+_LIT(KMCPodcastDRM,                 "DRM");
+_LIT(KMCPodcastReleaseDate,         "ReleaseDate");
+_LIT(KMCPodcastPublishDate,         "PublishDate");
+_LIT(KMCPodcastLastPlayPosition,    "LastPlayPosition");
+_LIT(KMCPodcastSampleRate,          "SampleRate");
+_LIT(KMCPodcastBitRate,             "BitRate");
+// Number of channels: required by MTP to support Play4sure
+_LIT(KMCPodcastNumChannels,         "NumChannels");
+// Audio Codec: required by MTP to support Play4sure
+_LIT(KMCPodcastCodec,               "Codec");
+_LIT(KMCPodcastMimeType,            "MimeType");
+
+// From MMF (MmfMeta.h)
+#define KMCPodcastName             KMMFMetaEntrySongTitle           // "title"
+// podcast author = media artist
+#define KMCPodcastAuthor           KMMFMetaEntryArtist              // "artist"
+// podcast title = media album
+#define KMCPodcastTitle            KMMFMetaEntryAlbum               // "album"
+#define KMCPodcastTrackNumber      KMMFMetaEntryAlbumTrack          // "albumtrack"
+// podcast category = media genre
+#define KMCPodcastGenre            KMMFMetaEntryGenre               // "genre"
+#define KMCPodcastComposer         KMMFMetaEntryComposer            // "composer"
+#define KMCPodcastComment          KMMFMetaEntryComment             // "comment"
+#define KMCPodcastCopyright        KMMFMetaEntryCopyright           // "copyright"
+#define KMCPodcastOrigArtist       KMMFMetaEntryOriginalArtist      // "originalartist"
+_LIT(KMCPodcastCategory,           "PodcastCategory");
+// end of MMF support data
+
+// == Category TABLE FIELDS ===================================================
+_LIT(KMCCategoryUniqueId,           "UniqueId");
+_LIT(KMCCategoryName,               "Name");
+_LIT(KMCCategoryCountEpisodes,      "EpisodeCount");
+
+// == Auxiliary TABLE FIELDS ==================================================
+// Version of database
+// The version integer looks like:
+// 31     23      15           0 bit
+// -----------------------------
+// |Major |Minor  |Build       |
+// -----------------------------
+_LIT(KMCAuxVersion,                 "Version");
+
+// Last time db was refreshed
+_LIT(KMCAuxTimeRefresh,             "TimeRefreshed");
+
+// Last time db was synced
+_LIT(KMCAuxTimeSync,                "TimeSynced");
+
+// Database Corrupted bit
+_LIT(KMCPodcastCorruptDB,           "Corrupt");
+
+// Number of records that have been marked as deleted
+_LIT(KMCSavedDeletedRecordCount,    "SaveDeletedRecordCount");
+
+
+#endif // MPXPODCASTCOLLECTIONDBDEF_H
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastcollectiondbstd.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This header file contains constants definitions and type
+*                definition
+*
+*/
+
+
+#ifndef MPXPODCASTCOLLECTIONDBSTD_H
+#define MPXPODCASTCOLLECTIONDBSTD_H
+
+// CONSTANTS
+
+const TInt KDBPluginUid           = 0x101FFC3C;
+const TInt KMCMaxQueryLen         = 500; // 255 max uri length + 245 for query
+const TInt KMCMaxTextLen          = 255; // Maximum field size for categories is 255
+
+const TInt KSystemTableID = 99;
+const TInt KRecentlyPlayedPlaylistUID = 1 | (KSystemTableID << 24);
+const TInt KMostPlayedPlaylistUID     = 2 | (KSystemTableID << 24);
+const TInt KRecentlyAddedPlaylistUID  = 3 | (KSystemTableID << 24);
+const TInt KNotPlayedPlaylistUID      = 4 | (KSystemTableID << 24);
+
+const TInt KPublishAllPlaylistUID       = 11 | (KSystemTableID << 24);
+const TInt KPublishTodayPlaylistUID     = 12 | (KSystemTableID << 24);
+const TInt KPublishYesterdayPlaylistUID = 13 | (KSystemTableID << 24);
+const TInt KPublishThisWeekPlaylistUID  = 14 | (KSystemTableID << 24);
+const TInt KPublishLastWeekPlaylistUID  = 15 | (KSystemTableID << 24);
+const TInt KPublish2WeeksAgoPlaylistUID = 16 | (KSystemTableID << 24);
+const TInt KPublish3WeeksAgoPlaylistUID = 17 | (KSystemTableID << 24);
+const TInt KPublishLastMonthPlaylistUID = 18 | (KSystemTableID << 24);
+const TInt KPublishEarlierPlaylistUID   = 19 | (KSystemTableID << 24);
+const TInt KPublishUnknownPlaylistUID   = 20 | (KSystemTableID << 24);
+
+#endif // MPXPODCASTCOLLECTIONDBSTD_H
+
+// End Of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastdbhandler.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,546 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class provides the functions to manipulate the podcast collection
+*                database.
+*
+*/
+
+
+#ifndef MPXPODCASTDBHANDLER_H
+#define MPXPODCASTDBHANDLER_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <f32file.h>
+
+#include <mpxattribute.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxpodcastdefs.h>
+
+#include "mpxdbcommonstd.h"
+
+#include "mpxpodcastcollectiondbstd.h"
+#include "mpxpodcastcollectiondb.hrh"
+#include "mpxdbpodcast.h"       // For MMPXDbPodcastObserver
+#include "mpxdbactivetask.h"
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXMediaArray;
+
+class CMPXPodcastDbManager;
+class CMPXDbCategory;
+class CMPXDbAuxiliary;
+
+// CLASS DECLARATION
+
+/**
+*  Podcast collection database handler
+*
+*  @lib mpxpodcastdbplugin.lib
+*/
+class CMPXPodcastDbHandler :
+    public CBase,
+    public MMPXDbPodcastObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return New CMPXPodcastDbHandler instance
+        */
+        static CMPXPodcastDbHandler* NewL(RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return New CMPXPodcastDbHandler instance
+        */
+        static CMPXPodcastDbHandler* NewLC(RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPXPodcastDbHandler();
+
+    public:
+
+        /**
+        * Add a episode to the podcast collection database
+        * @param aMedia media object which contains file path,
+        *                  author, name(title), episode no., etc...
+        * @return TUint32 id of the item added
+        */
+        TUint32 AddEpisodeL(const CMPXMedia& aMedia);
+
+        /**
+        * Update episode info for a episode in the podcast collection database
+        * @param aMedia episode details object  which contains file path,
+        *                  author, name(title), episode no., etc...
+        * @param aMessageArray resulted change events
+        * @return ETrue if the change is UI visible
+        */
+        CMPXDbActiveTask::TChangeVisibility UpdateEpisodeL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray);
+
+        /**
+        * Remove all episodes within podcast collection database
+        */
+        void RemoveEntireCollectionL();
+
+        /**
+        * Remove a episode from the podcast collection database
+        * @param aEpisodeId ID of the episode to be removed
+        * @param aUriArray a descriptor array to contain the URI of the deleted file
+        * @param aMessageArray a list of change events as a result of the
+        *                             episode removal
+        * @param aDeleteRecord indicates whether the client has explictly requested
+        *                to delete the records from the database. If ETrue, records
+        *                associated with the media will be deleted from the database;
+        *                if EFalse, whether to mark the records as deleted or to delete
+        *                the records will be based on other deciding factors.
+        */
+        void RemoveEpisodeL(TUint32 aEpisodeId, CDesCArray& aUriArray,
+            CMPXMessageArray& aMessageArray, TBool aDeleteRecord = EFalse);
+
+        /**
+        * Removes a category of episodes from the podcast collection, and its
+        * corresponding category in the lookup table
+        * @param aCategory the category to remove
+        * @param aCategoryId ID of the category to remove
+        * @param aUriArray a descriptor array to contain the URI of the deleted file(s)
+        * @param aMessageArray change events as result of the episode removal
+        */
+        void RemoveEpisodesMatchingCategoryL(TMPXGeneralCategory aCategory,
+            TUint32 aCategoryId, CDesCArray& aUriArray, CMPXMessageArray& aMessageArray);
+
+        /**
+        * Removes a publish date category of episodes from the podcast collection
+        * @param aCategoryId the publish date cateogry to remove
+        * @param aUriArray a descriptor array to contain the URI of the deleted file(s)
+        * @param aMessageArray change events as result of the episode removal
+        */
+        void RemoveEpisodesMatchingPublishDateCategoryL(TUint32 aCategoryId,
+            CDesCArray& aUriArray, CMPXMessageArray& aMessageArray);
+
+        /**
+        * Delete records in all databases which have been marked as deleted
+        */
+        void CleanupDeletedRecordsL();
+
+        /**
+        * Get all episodes from the podcast collection databasee
+        * @param aAttrs Array of attributes to @return
+        * @param aMediaArray Array to place all the episodes' required info
+        */
+        void GetAllEpisodesL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get all the episodes that match the given title ID
+        * @param aTitleId ID of the title to match
+        * @param aAttrs Array of attributes to return
+        * @param aMediaArray Array to place all the matching episodes' required info
+        */
+        void GetEpisodesMatchingTitleL(TUint aTitleId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get all the episodes that match the given playlist ID.
+        * Podcast collection only support Recently Added and Not Yet Played
+        * auto playlists.
+        * @param aPlaylistId ID of the playlist to match
+        * @param aAttrs Array of attributes to return
+        * @param aMediaArray Array to place all the required episode info
+        * @param aIndexOfCurrentlyPlayingItem index of the currently playing
+        *        episode or KErrNotFound (-1) if no currently playing episode within
+        *        this playlist
+        */
+        void GetEpisodesMatchingPlaylistL(TUint aPlaylistId,
+            const TArray<TMPXAttribute>& aAttrs, CMPXMediaArray& aMediaArray,
+            TInt& aIndexOfCurrentlyPlayingItem);
+
+        /**
+        * Get the episode info that matches the given episode ID
+        * @param aEpisodeId ID of the episode
+        * @param aAttrs Array of attributes to return
+        * @param aMediaArray Array to place all the required episode info
+        */
+        void GetEpisodeL(TUint32 aEpisodeId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get the episode info that matches the given episode ID
+        * @aEpisodeId ID of the episode
+        * @param aAttrs Array of attributes to return
+        * @param aMedia CMPXMedia instance to place all the required song info
+        */
+        void GetEpisodeL(TUint32 aEpisodeId, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMedia& aMedia);
+
+        /**
+        * Get the episode ID of the episode that matches the given URI
+        * @param aUri URI to match
+        * @return Episode ID
+        */
+        TUint32 GetEpisodeIdMatchingUriL(const TDesC& aUri);
+
+        /**
+        * Get all the podcast title names from the podcast collection database
+        * @param aAttrs Array of attributes to return
+        * @param aMediaArray Array to place all the titles required info
+        */
+        void GetAllPodcastTitlesL(const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get all episodes matching the specified publish date
+        * @param aPlaylistId the publish date playlist to retrieve
+        * @param aAttrs the attributes to return
+        * @param aPendingCategoryDeletionFlag true if the episodes within a publish
+        *        date category are being retrieved to be deleted
+        * @param aMediaArray Array to place all the episode info
+        */
+        TInt GetEpisodesMatchingPublishPlaylistL(TUint aPlaylistId,
+            const TArray<TMPXAttribute>& aAttrs, TBool aPendingCategoryDeletionFlag,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Get title name using the specified ID
+        * @param aId the id of the title to retrieve the name of
+        * @return the podcast title matching the specified ID, ownership is transferred
+        */
+        HBufC* GetTitleNameMatchingIdL(const TUint32 aId);
+
+        /**
+        * Get URI from the Id
+        * @param aId to search for
+        * @return URI matching the ID, ownership is transferred
+        */
+        HBufC* GetUriMatchingIdL (const TUint32 aId);
+
+        /**
+        * Get the duration for all episodes
+        * @return duration value
+        */
+        TInt GetAllEpisodesDurationL();
+
+        /**
+        * Get the duration for a specified title
+        * @param aTitleId identifies the title
+        * @return duration value
+        */
+        TInt GetTitleDurationL(TUint32 aTitleId);
+
+        /**
+        * Get the duration for the episodes not yet played
+        * @return duration value
+        */
+        TInt GetNotPlayedDurationL();
+
+        /**
+        * Get the duration for recently added episodes
+        * @return duration value
+        */
+        TInt GetRecentlyAddedDurationL();
+
+        /**
+        * Fetch the total number of items in the specified category
+        * @param aCategory category to be queried
+        * @return number of items.
+        */
+        TInt NumberOfItemsL(TMPXPodcastCategory aCategory);
+
+        /**
+        * Find media(s) from the collection
+        * @param aCriteria selection criteria
+        * @param aAttrs attributes for the matching media
+        * @return matching media. Ownership is transferred.
+        */
+        CMPXMedia* FindAllLC(const CMPXMedia& aCriteria,
+            const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Set the last refreshed time
+        * @param aTime the updated last refresh time
+        */
+        void SetLastRefreshedTimeL( TTime aTime );
+
+        /**
+        * Get the last refreshed time
+        * @return last refreshed time
+        */
+        TTime GetLastRefreshedTimeL();
+
+        /**
+        * Set the db corrupted bit in the aux table for all drives
+        * @param aCorrupted flag indicating whether or not the db is corrupted
+        */
+        void SetDBCorruptedL(TBool aCorrupted);
+
+        /**
+        * Get the db corrupted flag
+        * @return ETrue if database is corrupted, else EFalse
+        */
+        TBool IsDBCorruptedL();
+
+        /**
+        * Checks if the database has been created
+        * @return ETrue if file has been created
+        */
+        TBool DatabaseCreated();
+
+        /**
+        * Close and re-open the podcast collection database stored on the specified drive
+        * @param aDrive drive containing the podcast collection database to re-open
+        */
+        void OpenDatabaseL(TInt aDrive);
+
+        /**
+        * Close a database for a particular drive
+        * @param aDrive drive to close
+        */
+        void CloseDatabaseL(TInt aDrive);
+
+        /**
+        * Recreate all podcast databases
+        */
+        void ReCreateDatabasesL();
+
+        /**
+        * Start a refresh operation
+        */
+        void RefreshStartL();
+
+        /**
+        * End a refresh operation
+        */
+        void RefreshEndL();
+
+        /**
+        * Sets the value of the IsPlaying field for a given episode
+        * @param aMedia contains episode information
+        * @param aIsPlaying value of the IsPlaying field
+        */
+        void SetIsPlayingL(const CMPXMedia& aMedia, TBool aIsPlaying);
+
+        /**
+        * Get total record count for podcasts in db
+        * @param aDrive, specifies drive number for db selection
+        * @return count
+        */
+        TUint GetTotalCountL(TInt aDrive);
+
+        /**
+        * Get URIs for all podcasts
+        * @param aDrive, specifies drive number for db selection
+        * @param aFromID, specifies last record's unique ID
+        * @param aRecords, specifies the number of records to get
+        * @param aUriArr, will contain all URIs on return
+        * @param aLastID, will contain a unique ID of last record in the array
+        */
+        void GetPodcastUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                 CDesCArray& aUriArr, TInt& aLastID);
+
+        /**
+        * Starts a transaction
+        */
+        void BeginTransactionL();
+
+        /**
+        * Ends a transaction. Depending on the error code either commits or
+        * rollsback the transaction.
+        * @param aError error code
+        */
+        void EndTransactionL(TInt aError);
+
+        /**
+        * Checks if the database is currently in a transaction.
+        * @return ETrue if database is currently in a transaction, EFalse otherwise
+        */
+        TBool InTransaction();
+        
+        /**
+         * Checks if the spefified drive is a remove drive
+         */      
+        TBool IsRemoteDrive(TDriveNumber aDrive);
+
+    private:
+
+        /**
+        * Find media entry/entries from the collection
+        * @param aCriteria selection criteria
+        * @param aAttrs attributes for the matching media
+        * @param aMediaArray array of matching media entry/entries
+        */
+        void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Find episode(s) which match(es) the selection criteria
+        * @param aCriteria selection criteria
+        * @param aAttrs the attributes to include for the artist(s) matching the
+        *        selection criteria
+        * @param aMediaArray artist(s) matching the selection criteria
+        */
+        void FindEpisodesL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs,
+            CMPXMediaArray& aMediaArray);
+
+        /**
+        * Add an episode to the podcast collection database
+        * @param aMedia media object which contains file path, author, name, podcast title etc...
+        * @return episode Id of the episode that has been added to the database
+        */
+        TUint32 DoAddEpisodeL(const CMPXMedia& aMedia);
+
+        /**
+        * Update episode info for a episode in the podcast collection database
+        * @param aMedia episode details object  which contains file path,
+        *               author, name(title), podcast title, etc...
+        * @param aItemChangedMessages a list of items changed
+        * @return ETrue if UI visible change
+        */
+        CMPXDbActiveTask::TChangeVisibility DoUpdateEpisodeL(const CMPXMedia& aMedia,
+            CMPXMessageArray& aItemChangedMessages);
+
+        /**
+        * Remove a episode from the podcast collection database
+        * @param aEpisodeId ID of the episode to be removed
+        * @param aUriArray a descriptor array to contain the URI of the deleted file
+        * @param aMessageArray change events as result of the episode removal
+        * @param aDeleteRecord if ETrue the episode will be deleted, if EFalse
+        *           it will be marked as deleted
+        */
+        void DoRemoveEpisodeL(TUint32 aEpisodeId, CDesCArray& aUriArray,
+            CMPXMessageArray& aMessageArray, TBool aDeleteRecord);
+
+        /**
+        * Remove the episodes for a category from the podcast collection database
+        * @param aCategory category type
+        * @param aCategoryId category item
+        * @param aUriArray a descriptor array to contain the URI of the deleted file
+        * @param aMessageArray change events as result of the episode removal
+        */
+        void DoRemoveEpisodesMatchingCategoryL(TMPXGeneralCategory aCategory,
+            TUint32 aCategoryId, CDesCArray& aUriArray, CMPXMessageArray& aMessageArray);
+
+        /**
+        * Remove the episodes for a publish date category
+        * @param aCategoryId identifies the publish date category
+        * @param aUriArray a descriptor array to contain the URI of the deleted file
+        * @param aMessageArray change events as result of the episode removal
+        */
+        void DoRemoveEpisodesMatchingPublishDateCategoryL(TUint32 aCategoryId,
+            CDesCArray& aUriArray, CMPXMessageArray& aMessageArray);
+
+        /**
+        * Delete records in all databases which have been marked as deleted
+        */
+        void DoCleanupDeletedRecordsL();
+
+        /**
+        * Makes sure all the folders specified in the array parameter are created,
+        * otherwise it tries to create them. Updates the iDbDrives member variable
+        * with the drives corresponding to the folders.
+        * @param aFolders contains all the folders to be processed
+        */
+        void ProcessPodcastFoldersL(const CDesCArray& aFolders);
+
+        /**
+        * Returns the CMPXDbCategory instance associated with the specified
+        * category type
+        * @param aCategory category type
+        * @return corresponding CMPXDbCategory instance
+        * @leave KErrNotSupported if invalid category
+        */
+        CMPXDbCategory* DbCategoryL(TMPXGeneralCategory aCategory) const;
+
+        /**
+        * Verify the volume id for the databases
+        */
+        void VerifyVolumeIdL();
+
+        /**
+         * Checks if there is a drive that has a low disk space
+         * @leave KErrDiskFull if the space on one of the drives is below the
+         *         critical level
+         */
+        void CheckDiskSpaceOnDrivesL();
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+        /**
+        * Reads the "save deleted records" MTP flag from CenRep and returns
+        * the value.
+        * @return value of the "save deleted records" MTP flag
+        */
+        TBool SaveDeletedSongs();
+#endif
+
+#ifdef RD_MULTIPLE_DRIVE
+        /**
+        * Retrieve all visible podcast folder locations
+        */
+        CDesCArrayFlat* GetPodcastFoldersL();
+#endif // RD_MULTIPLE_DRIVE
+
+    private:    // From MMPXDbPodcastObserver
+
+        /**
+        * @see MMPXDbPodcastObserver
+        */
+        TUint32 AddCategoryItemL(TMPXGeneralCategory aCategory, const TDesC& aName,
+            TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
+
+        /**
+        * @see MMPXDbPodcastObserver
+        */
+        void DeleteEpisodeForCategoryL(TMPXGeneralCategory aCategory, TUint32 aCategoryId,
+            TInt aDriveId, CMPXMessageArray* aItemChangedMessages);
+
+    private:
+        /**
+        * C++ constructor
+        * @param file session
+        */
+        CMPXPodcastDbHandler(RFs& aFs, CMPXResource& aResource);
+
+        /**
+        * Symbian 2nd phase constructor..
+        */
+        void ConstructL();
+
+    private:    // Data
+
+        // owned member variables
+        CMPXPodcastDbManager* iDbManager;
+        CMPXDbPodcast* iDbPodcast;
+        CMPXDbCategory* iDbArtist;
+        CMPXDbCategory* iDbAlbum;
+        CMPXDbCategory* iDbGenre;
+        CMPXDbCategory* iDbComposer;
+        CMPXDbAuxiliary* iDbAuxiliary;
+
+        CDesCArrayFlat* iPodcastPublishDateCat; // podcast publish date category
+        RArray<TInt> iPodcastPublishDateIds;    // podcast publish date ID
+        RArray<TInt> iDbDrives;
+
+        // not owned member variables
+        RFs& iFs;
+        CMPXResource& iResource;
+        TBool iOutOfDisk;                // Are we in out of disk mode?
+    };
+
+#endif      // MPXPODCASTDBHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastdbmanager.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for managing all of podcast collection
+*                databases.
+*
+*/
+
+
+#ifndef MPXPODCASTDBMANAGER_H
+#define MPXPODCASTDBMANAGER_H
+
+// INCLUDES
+#include "mpxdbmanager.h"
+
+// CLASS DECLARATION
+
+/**
+* Database manager specialization for the podcast plugin.
+*
+* @lib mpxpodcastdbplugin.lib
+*/
+class CMPXPodcastDbManager :
+    public CMPXDbManager
+    {
+    public: // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return New CMPXPodcastDbManager instance
+        */
+        static CMPXPodcastDbManager* NewL(RFs& aFs);
+
+        /**
+        * Two-phased constructor.
+        * @param aFs file server session
+        * @return New CMPXPodcastDbManager instance on the CS
+        */
+        static CMPXPodcastDbManager* NewLC(RFs& aFs);
+
+        /**
+        * Destructor
+        */
+        virtual ~CMPXPodcastDbManager();
+
+    public: // New functions
+
+
+    private:
+        /**
+        * C++ default constructor
+        * @param aFs file server session
+        */
+        CMPXPodcastDbManager(RFs& aFs);
+
+        /**
+        * The second phase constructor ConstructL to safely construct things
+        * that can leave
+        */
+        void ConstructL();
+    };
+
+#endif  // MPXPODCASTDBMANAGER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastdbplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,751 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Podcast Collection Database Plugin interface
+*
+*/
+
+
+#ifndef MPXPODCASTDBPLUGIN_H
+#define MPXPODCASTDBPLUGIN_H
+
+// INCLUDES
+#include <badesca.h>
+
+#include <mpxcommonframeworkdefs.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxcollectionplugin.h>
+#include <mpxcollectionpath.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxpodcastdefs.h>
+#include <mpxmessage2.h>
+
+#include "mpxdbactivetask.h"
+#include "mpxpodcastcollectiondb.hrh"
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXPodcastDbHandler;
+class CMPXDrmMediaUtility;
+class CMPXMediaArray;
+class CMPXResource;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+* Plug-in provides access to podcast collection.
+*
+* @lib mpxpodcastdbplugin.lib
+*/
+NONSHARABLE_CLASS(CMPXPodcastDbPlugin) :
+    public CMPXCollectionPlugin,
+    public MMPXDbActiveTaskObserver
+    {
+public: // Constructors and destructor
+
+    /**
+    * Two-phased constructor
+    * @param aInitParams: initialization parameters
+    * @return object constructed
+    */
+    static CMPXPodcastDbPlugin* NewL (TAny* aInitParams);
+
+    /**
+    * Destructor
+    */
+    virtual ~CMPXPodcastDbPlugin();
+
+public: // from base clase
+    /**
+    * From CMPXCollectionPlugin
+    * Navigates to the given path.  This method is serviced
+    * asynchronously and HandleOpenL is called upon completion
+    * @param aPath a path
+    * @param aAttrs attributes requested
+    * @param aFilter filter to apply or NULL if none
+    */
+    void OpenL(const CMPXCollectionPath& aPath,
+               const TArray<TMPXAttribute>& aAttrs,
+               CMPXFilter* aFilter);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Get the extended properties of the item referred to by the
+    * specified collection path.  This method is serviced asynchronously and
+    * HandleMediaL is called upon completion
+    * @param aPath a collection path referring to the item to retrieve the
+    *               extended properties for
+    * @param aAttr: array of attributes requested
+    * @param aCaps platsec capabilities of client requesting media; plug-in
+    *        should also verify its process capabilities (not yet supported)
+    * @aParam aSpecs specifications for attributes (not yet supported)
+    */
+    void MediaL(const CMPXCollectionPath& aPath,
+                const TArray<TMPXAttribute>& aAttrs,
+                const TArray<TCapability>& aCaps,
+                CMPXAttributeSpecs* aSpecs);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Cancel outstanding request. Note*** CancelRequest is not currently
+    * implemented because all requests are processed synchronously
+    */
+    void CancelRequest();
+
+    /**
+    * From CMPXCollectionPlugin
+    * Executes the given TMPXCollectionCommand command on the collection
+    * @param aCmd a command
+    * @param aArg an argument
+    */
+    void CommandL(TMPXCollectionCommand aCmd, TInt aArg = 0);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Executes the given CMPXCommand command on the collection
+    * @param aCmd a command
+    */
+    void CommandL(CMPXCommand& aCmd);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Adds an episode to the collection
+    * @param aMedia Properties of the item
+    */
+    void AddL(const CMPXMedia& aMedia);
+
+    /**
+    * From CMPXCollectionPlugin
+    * Remove an item(s) from the collection database using the given path
+    * Note that the selection indices are hidden within the path
+    * @param aPath: path to the item to be removed
+    *
+    */
+    void RemoveL(const CMPXCollectionPath& aPath);
+
+    /**
+    *  Remove item(s) from the collection database using the given media properties
+    *  @param aMedia Properties of the item(s) to be removed. May cantain a URI
+    *                 or metadata. All item(s) matching the specified properties
+    *                 will be removed.
+    */
+    void RemoveL(const CMPXMedia& aMedia);
+
+    /**
+    *  Sets/updates the specified media for an item in the collection.  Media
+    *  is identified by specifying an ID or URI.
+    *  @param aMedia: new property values for the item
+    */
+    void SetL(const CMPXMedia& aMedia);
+
+    /**
+    * From CMPXCollectionPlugin
+    *  Find the items matching the media specifications.  This method is serviced
+    *  asynchronously and HandleFindAllL is called upon completion
+    *  @param aCriteria Properties of the item that is to be found
+    *  @param aAttrs Requested attributes to return
+    */
+    void FindAllL(const CMPXMedia& aCriteria, const TArray<TMPXAttribute>& aAttrs);
+
+    /**
+    *  From CMPXCollectionPlugin
+    *  Find the items matching the media specifications
+    *  @param aCriteria Properties of the item that is to be found
+    *  @param aAttrs Requested attributes to return
+    *  @return results of the search. Method abandons ownership of results.
+    */
+    CMPXMedia* FindAllSyncL(const CMPXMedia& aCriteria,
+                            const TArray<TMPXAttribute>& aAttrs);
+
+    /**
+    * Get the list of supported capabilities
+    * @return TCollectionCapability, bitmask of supported capabilities
+    */
+    TCollectionCapability GetCapabilities();
+
+    /**
+    * From MMPXDbActiveTaskObserver
+    */
+    TBool HandleStepL();
+
+    /**
+    * From MMPXDbActiveTaskObserver
+    */
+    void HandleOperationCompleted( TInt aErr );
+
+private:
+    /**
+    * Constructor
+    */
+    CMPXPodcastDbPlugin ();
+
+    /**
+    * Symbian 2nd phase constructor.
+    */
+    void ConstructL ();
+
+    /**
+    * Process the OpenL command
+    * @param aPath a path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aFlagToSignalToBePlayed: signals that item is opened to be played if type == episode
+    * @return ETrue if the open is for a episode, EFalse otherwise
+    */
+    TBool DoOpenL(const CMPXCollectionPath& aPath,
+                  const TArray<TMPXAttribute>& aAttrs,
+                  CMPXMedia& aEntries,
+                  TBool aFlagToSignalToBePlayed);
+
+    /**
+    * Process the OpenL(EBrowseAll) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for an episode, EFalse otherwise
+    */
+    TBool DoOpenBrowseAllL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray& aArray);
+
+    /**
+    * Process the OpenL(EBrowsePubDate) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for an episode, EFalse otherwise
+    */
+    TBool DoOpenBrowsePubDateL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray& aArray);
+
+    /**
+    * Process the OpenL(EBrowseTitle) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for an episode, EFalse otherwise
+    */
+    TBool DoOpenBrowseTitleL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray& aArray);
+
+    /**
+    * Process the OpenL(EBrowseRecentlyAdded) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for an episode, EFalse otherwise
+    */
+    TBool DoOpenBrowseRecentlyAddedL(const CMPXCollectionPath& aPath,
+        const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aEntries, CMPXMediaArray& aArray);
+
+    /**
+    * Process the OpenL(EBrowseNotPlayed) command
+    * @param aPath Path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries (Output parameter) collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    * @param aArray (Output parameter) collection items
+    * @return ETrue if the open is for an episode, EFalse otherwise
+    */
+    TBool DoOpenBrowseNotPlayedL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntries, CMPXMediaArray& aArray);
+
+   /**
+    * Process an OpenL command with a EMPXOpenPlaylistOnly open mode
+    * @param aPath path that we want to open
+    * @param aAttrs default attributes to fetch
+    * @param aFlagToSignalToBePlayed: signals that item is opened to be played if type == episode
+    * @return CMPXCollectionPath* which is the new valid browse path
+    *                             Method abandons ownership.
+    */
+    CMPXCollectionPath* DoOpenPlaylistL( const CMPXCollectionPath& aPath,
+                                         const TArray<TMPXAttribute>& aAttrs,
+                                         TBool aFlagToSignalToBePlayed);
+
+    /**
+    * Process the MediaL command
+    * @param aPath a path
+    * @param aAttrs Requested attributes to return
+    * @param aEntries collection items containing media properties
+    *                  of all items, returned if opening a group of items
+    */
+    void DoMediaL(const CMPXCollectionPath& aPath,
+                   const TArray<TMPXAttribute>& aAttrs,
+                   CMPXMedia& aEntries);
+
+    /**
+    * Get the plugin title, subtitle, icons for this plugin
+    * @param aAttrs attributes to find
+    * @param aMedia media object
+    */
+    void DoRootMediaL(const TArray<TMPXAttribute>& aAttrs, CMPXMedia& aMedia);
+
+    /**
+    * Get the media under ALL EPISODES category
+    * @param aPath path that leads to a media under ALL EPISODES
+    * @param aAttrs attributes of media to find
+    * @param aEntries the media referred by the path
+    * @param aMediaArray media entries contained in the media referred by the path
+    */
+    void DoAllEpisodesMediaL(const CMPXCollectionPath& aPath,
+                            const TArray<TMPXAttribute>& aAttrs,
+                            CMPXMedia& aEntries,
+                            CMPXMediaArray& aMediaArray);
+
+    /**
+    * Find the collection media for by publish date category
+    * @param aPath path that leads to a media under BY PUBLISH DATE
+    * @param aAttrs attributes of media to find
+    * @param aEntries the media referred by the path
+    * @param aMediaArray media entries contained in the media referred by the path
+    */
+    void DoByPublishDateMediaL(const CMPXCollectionPath& aPath,
+                                  const TArray<TMPXAttribute>& aAttrs,
+                                  CMPXMedia& aEntries,
+                                  CMPXMediaArray& aMediaArray);
+
+    /**
+    * Find the collection media for by titles category
+    * @param aPath path that leads to a media under TITLES
+    * @param aAttrs attributes of media to find
+    * @param aEntries the media referred by the path
+    * @param aMediaArray media entries contained in the media referred by the path
+    */
+    void DoTitlesMediaL(const CMPXCollectionPath& aPath,
+                          const TArray<TMPXAttribute>& aAttrs,
+                          CMPXMedia& aEntries,
+                          CMPXMediaArray& aMediaArray);
+
+    /**
+    * Find the collection media for by recently added category
+    * @param aPath path that leads to a media under RECENTLY ADDED
+    * @param aAttrs attributes of media to find
+    * @param aEntries the media referred by the path
+    * @param aMediaArray medias contained in the media referred by the path
+    */
+    void DoRecentlyAddedMediaL(const CMPXCollectionPath& aPath,
+                                 const TArray<TMPXAttribute>& aAttrs,
+                                 CMPXMedia& aEntries,
+                                 CMPXMediaArray& aMediaArray);
+
+
+    /**
+    * Find the collection media for by not yet played category
+    * @param aPath path that leads to a media under NOT YET PLAYED
+    * @param aAttrs attributes of media to find
+    * @param aEntries the media referred by the path
+    * @param aMediaArray medias contained in the media referred by the path
+    */
+    void DoNotYetPlayedMediaL(const CMPXCollectionPath& aPath,
+                                const TArray<TMPXAttribute>& aAttrs,
+                                CMPXMedia& aEntries,
+                                CMPXMediaArray& aMediaArray);
+
+    /**
+    * Get the root media.
+    * @param aAttrs attributes of media to find
+    * @param aRootCategoryId Id of the root media in the category, i.e. all albums,
+    *        ...etc.
+    * @param aCategory specifies the category.
+    * @param aEntries the media referred by the path
+    */
+    void DoRootCategoryMediaL(const TArray<TMPXAttribute>& aAttrs,
+                               TMPXItemId aRootCategoryId,
+                               TMPXPodcastCategory aCategory,
+                               CMPXMedia& aEntries);
+
+    /**
+    * Set all the attributes in CMPXMedia corresponding to KMPXMediaIdDrm
+    * @param aMedia, media to update
+    * @param aDrmAttributes, bitwise or of the flags we want
+    * @param aLocation, full file path including filename
+    */
+    void DoSetMediaDrmL(CMPXMedia& aMedia, TUint aDrmAttributes, const TDesC& aLocation);
+
+    /**
+    * Add media objects to the array with attributes from episode details
+    * @param aPath a path
+    * @param aAttrs requested attributes
+    * @param aEntry media to contain information about the container if it contains
+    *        than one entry
+    * @param aMediaArray array to contain all the media objects added
+    */
+    void GetEpisodeInfoL(const CMPXCollectionPath& aPath, const TArray<TMPXAttribute>& aAttrs,
+        CMPXMedia& aEntry, CMPXMediaArray& aMediaArray);
+
+    /**
+    * Add media objects to the array with attributes from episode details
+    * @param aAttrs requested attributes
+    * @param aEntryId episode ID
+    * @param aEntry media to contain information about the container if it contains
+    *        than one entry
+    */
+    void DoGetEpisodeInfoL(const TArray<TMPXAttribute>& aAttrs, TInt aEntryId, CMPXMedia& aEntry);
+
+    /**
+    * Get the collection details from the db
+    * @param aAttrs attributes to find
+    * @param aPath path to be set if required
+    * @param aMedia media object
+    */
+    void DoHandleOtherMediaAttributesL(const TArray<TMPXAttribute>& aAttrs,
+        const CMPXCollectionPath& aPath, CMPXMedia& aMedia);
+
+    /**
+    * Remove an item from the collection database using the given path
+    * Note that the selection indices are hidden within the path
+    * @param aPath path to the item to be removed
+    * @param aChangeMsgArray array to store change messages
+    * @return an array of files associated with the removed media entries
+    */
+    CDesCArray* DoRemoveL(const CMPXCollectionPath& aPath,
+                           CMPXMessageArray& aChangeMsgArray);
+
+    /**
+    * Remove an item/items from the collection database using the given media properties
+    * @param aMedia Properties of the item that is to be removed. It may cantain URI only
+    *                or meta data, all of items matched properties will be removed.
+    * @param aDeleteRecord indicates whether the client has explictly requested
+    *                to delete the records from the database. If ETrue, records
+    *                associated with the media will be deleted from the database;
+    *                if EFalse, whether to mark the records as deleted or to delete
+    *                the records will be based on other deciding factors.
+    */
+    void DoRemoveL(const CMPXMedia& aMedia, TBool aDeleteRecord);
+
+    /**
+    * Remove an item from the collection database using a command
+    * @param aCmd remove command which contains collection path to the media entries to be
+    *        removed. This method should be called until all the selected items are
+    *        removed. When that happens, EMPXCommandCompleted flag is set to ETrue.
+    */
+    void DoRemovePathL(CMPXCommand& aCmd);
+
+    /**
+    * Remove a media entry/entries from the collection database using a command
+    * @param aCmd remove command which contains the media(s) to be removed. This
+    *        will delete the records from the database rather than marking them
+    *        as deleted. Designated caller is MTP.
+    */
+    void DoRemoveMediaL(CMPXCommand& aCmd);
+
+    /**
+    * Remove a media entry/entries from all episodes view
+    * @param aPath collection path that points to the media entry/entries to be removed
+    * @param aSelections multiple media items selected. This array contains the id
+    *        of the selected media.
+    * @param aUriArray a descriptor array containing the URI(s) of the deleted file(s)
+    * @param aItemChangedMessages a list of change events as a result of the
+    *        episode removals
+    */
+    void DoRemoveFromAllEpisodesL(const CMPXCollectionPath& aPath,
+                                  const TArray<TMPXItemId>& aSelections,
+                                  CDesCArray& aUriArray,
+                                  CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove media from Publish Date view
+    * @param aPath collection path that points to the media entry/entries to be removed
+    * @param aSelections multiple media entry/entries selected. This array contains the id
+    *        of the selected media.
+    * @param aUriArray a descriptor array to contain the URI(s) of the deleted file(s)
+    * @param aItemChangedMessages a list of change events as a result of the
+    *        episode removals
+    */
+    void DoRemoveFromPublishDateL(const CMPXCollectionPath& aPath,
+                                  const TArray<TMPXItemId>& aSelections,
+                                  CDesCArray& aUriArray,
+                                  CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media item from Publish Date view
+    * @param aPath collection path that points to the media entry/entries to be removed
+    * @param aItemId ID of the item to be removed
+    * @param aUriArray a descriptor array to contain the URI(s) of the deleted file(s)
+    * @param aItemChangedMessages a list of change events as a result of the
+    *        episode removals
+    */
+    void RemoveFromPublishDateL(const CMPXCollectionPath& aPath, TInt aItemId,
+        CDesCArray& aUriArray, CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media/medias from albums/genres/composers view
+    * @param aPath collection path that points to the media(s) to be removed
+    * @param aSelections multiple medias selected. This array contains the id
+    *        of the selected media.
+    * @param aCategory indicates one of the 3 categories, EMPXAlbum, EMPXGenre, or
+    *        EMPXComposer
+    * @param aUriArray a descriptor array to contain the URI of the deleted file
+    * @param aItemChangedMessages a list of change events as a result of the
+    *        episode removals
+    */
+    void DoRemoveFromCategoriesL(const CMPXCollectionPath& aPath,
+                                 const TArray<TMPXItemId>& aSelections,
+                                 TMPXGeneralCategory aCategory,
+                                 CDesCArray& aUriArray,
+                                 CMPXMessageArray& aItemChangedMessages);
+
+    /**
+    * Remove a media item from albums/genres/composers view
+    * @param aPath collection path that points to the media entry/entries to be removed
+    * @param aItemId ID of the item to be removed
+    * @param aCategory indicates one of the 3 categories, EMPXAlbum, EMPXGenre, or
+    *        EMPXComposer
+    * @param aUriArray a descriptor array to contain the URI(s) of the deleted file(s)
+    * @param aItemChangedMessages a list of change events as a result of the
+    *        episode removals
+    */
+    void RemoveFromCategoriesL(const CMPXCollectionPath& aPath, TInt aItemId,
+        TMPXGeneralCategory aCategory, CDesCArray& aUriArray,
+        CMPXMessageArray& aItemChangedMessages);
+
+   /**
+    * Fetch the duration for a specific category
+    * @param aMedia a media object of which EMPXMediaGeneralDuration is to be
+    *        populated with the duration calculated in this method
+    * @param aCategory category of the ID
+    * @param aId id for identifying which category to calculate the duration for
+    */
+    TInt DoDurationL(CMPXMedia& aMedia, TMPXPodcastCategory aCategory, TMPXItemId aId = 0);
+
+    /**
+    * Retrieves URIs associated with the path for file deletion
+    * @param aCmd command to retrieve associated URIs for the given path. If
+    *        path ends with a particular artist/album/genre/composer, the path
+    *        will be updated to include all episodes in that category. If path
+    *        ends with one or more medias in a particular playlist, an array
+    *        of 0 elements will be returned to avoid client deleting them from
+    *        the file system
+    */
+    void DoRetrieveUriForDeletionL(CMPXCommand& aCmd);
+
+    /**
+    * Deletes records which have been marked as deleted from the collection
+    * @param aCmd command to cleanup deleted medias.
+    *        see KMPXCommandIdCollectionCleanupDeletedMedias defined in
+    *        mpxcollectioncommanddefs.h
+    */
+    void CleanupDeletedRecordsL(CMPXCommand& aCmd);
+
+    /**
+    * Append a collection level to the collection path
+    * @param aPath path to append the level to
+    * @param aMedia media to extract media ids from
+    * @note: Selection will be put on the first episode in the collection path
+    */
+    TInt DoAppendLevelL(CMPXCollectionPath& aPath, CMPXMedia& aMedia);
+
+    /* Append a collection level to the collection path with all episodes under the
+    * selected category/categories (e.g. artist/artist-album/album/genre/composer).
+    * Once the level is appended, all episodes under the selected category/categories
+    * are selected.
+    * @param aPath path to append the level to. Path remains unchanged if it's not
+    *        one of the following:
+    *        1) path ends at an artist or selected artists
+    *        2) path ends at an album of an artist or selected albums of an artist
+    *        3) path ends at an album or selected albums
+    *        4) path ends at a genre or selected genres
+    *        5) path ends at a composer or selected composers
+    */
+    void DoAppendLevelL(CMPXCollectionPath& aPath);
+
+    /**
+    * Execute a task step for an asynchronous add
+    * @return ETrue if done
+    */
+    TBool DoAddAsyncL();
+
+    /**
+    * Add a media object to the collection
+    * @param aMedia media to add
+    * @return TUint32 item id of the item added
+    */
+    TUint32 DoAddL(const CMPXMedia& aMedia);
+
+    /**
+    * Add an item into the collection
+    * @param aMedia media to add
+    * @param aMessageArray change message array
+    * @return TUint32 item id of the item added
+    */
+    TUint32 DoAddItemL(const CMPXMedia& aMedia, CMPXMessageArray& aMessageArray);
+
+    /**
+    * Set a media object to update the collection
+    * @param aMedia media can be an item or a list. The item is treated as a list
+    *               if it contains a media array
+    */
+    void DoSetL(const CMPXMedia& aMedia);
+
+    /**
+    * Execute a task step for an asynchronous set
+    */
+    TBool DoSetAsyncL();
+
+    /**
+    * Send a change message
+    * @param aMessage a change message to be sent
+    */
+    void HandleChangeL(const CMPXMessage& aMessage);
+
+    /**
+    * Construct a CMPXMedia from the array parameter and call HandleChange
+    * @param aItemChangedMessages array in the change message to be sent
+    */
+    void DoHandleChangeL(CMPXMessageArray* aItemChangedMessages);
+
+    /**
+    * Generates and calls back an out of disk CMPXMessage
+    * This function will callback to the client context to
+    * broadcast an out of disk event
+    */
+    void HandleOutOfDiskMessageL();
+
+    /**
+    * Leaving function to handle async op completion
+    * @param aErr error code
+    */
+    void DoHandleOperationCompletedL(TInt aErr);
+
+    /**
+    * Complete a delete operation
+    * Sends out change messages and compacts the database
+    */
+    void DoHandleDeleteCompleteL(CMPXCommand& aCmd);
+
+    /**
+    * Returns the category for a given browse type.
+    * @param aBrowseType browse type
+    * @return Category ID
+    */
+    TMPXPodcastCategory CategoryForBrowseType(TMCBrowseType aBrowseType);
+
+    /**
+    * Returns the browse type for a given category ID.
+    * @param aCategory category ID
+    * @return Browse type
+    */
+    TMCBrowseType BrowseTypeForCategory(TMPXPodcastCategory aCategory);
+
+    /**
+    * Sets the type, category and title attributes in the specified media.
+    * @param aMedia media instance to be updated
+    * @param aGeneralType general type attribute value
+    * @param aType podcast type attribute value
+    * @param aCategory category attribute value
+    * @param aTitle title attribute value
+    * @param aCount general count attribute value
+    */
+    void SetMediaGeneralAttributesL(CMPXMedia& aMedia, TMPXGeneralType aGeneralType,
+        TMPXPodcastType aType, TMPXPodcastCategory aCategory, const TDesC& aTitle,
+        TInt aCount = -1);
+
+    /**
+    * Sets the type, category and title attributes in the specified media.
+    * @param aMedia media instance to be updated
+    * @param aGeneralType general type attribute value
+    * @param aType type attribute value
+    * @param aCategory category attribute value
+    * @param aId ID of the item to the title from
+    * @param aCount general count attribute value
+    */
+    void SetMediaGeneralAttributesL(CMPXMedia& aMedia, TMPXGeneralType aGeneralType,
+        TMPXPodcastType aType, TMPXPodcastCategory aCategory, TInt aId, TInt aCount = -1);
+
+    /**
+    * Get total podcasts count
+    * @param aCmd command to return count
+    *        see KMPXCommandCollectionGetCount defined in
+    *        mpxcollectioncommanddefs.h
+    */
+    void DoGetCollectionCountL( const CMPXCommand& aCmd );
+
+    /**
+    * Get an array of URIs for all podcasts in a given db
+    * @param aCmd command to return CDesCArray
+    *        see KMPXCommandCollectionGetURIs defined in
+    *        mpxcollectioncommanddefs.h
+    */
+    void DoGetCollectionUriL( const CMPXCommand& aCmd );
+
+    /**
+    * Set the attribute list according to current path
+    * @param aPath a path
+    * @param aAttrs attributes array to be filled
+    * @param aSupportedIds array of supported content IDs to be filled
+    */
+    void SetAttributesL( const CMPXCollectionPath& aPath, RArray<TMPXAttribute>& aAttrs,
+                         RArray<TInt>& aSupportedIds );
+    
+#ifdef _DEBUG
+    /**
+    * Prints messages for debugging
+    * @param aMessage message(s) to be printed
+    */
+    void PrintMessagesL(const CMPXMessage& aMessage);
+
+    /**
+    * Prints a single message for debugging
+    * @param aMessage a message to be printed
+    */
+    void PrintMessage(const CMPXMessage& aMessage);
+#endif
+
+private:
+
+    RFs                  iFs;
+    CMPXResource*        iResource;
+    CMPXPodcastDbHandler*iDbHandler;
+    CMPXDrmMediaUtility* iDrmMediaUtility;
+    CDesCArrayFlat*      iPodcastLibraryTitles;                 // podcast library view titles
+    CDesCArrayFlat*      iPodcastLibraryMainMenuItemTitles;     // podcast library item menu item titles
+    RArray<TInt>         iPodcastLibraryMainMenuItemIds;        // podcast library item menu IDs
+    CDesCArrayFlat*      iPodcastTitlePublishDateCat;           // publish date view menu titles
+    RArray<TInt>         iPodcastPublishDateIds;                // publish date view menu IDs
+    CDesCArrayFlat*      iPodcastEpisodeViewPublishDateTitle;   // episodes view publish date titles
+    RArray<TInt>         iPodcastEpisodeViewPublishDateIds;     // episodes view publish date title IDs
+
+    HBufC*               iTitleMyPodcast;       // podcast menu view title string
+    HBufC*               iTitleAllEpisodes;     // All Episodes title string
+    HBufC*               iTitlePubDate;         // Published Date title string
+    HBufC*               iTitleTitles;          // Titles title string
+    HBufC*               iTitleAdded;           // Recently Added title string
+    HBufC*               iTitleUnplayed;        // Not Yet played title string
+
+    TInt                 iStateChangedDrive;    // drive number of the media has just opened/close
+    TInt                 iStateChangedOldMaster;
+    TBool                iStateChangedOpen;
+    TBool                iMtpInUse;
+    TBool                iRefreshing;
+
+    TInt                 iNumberOfEpisodesInCurrentPublishDateCategory;
+
+    CMPXDbActiveTask*    iActiveTask;
+    RArray<TMPXItemId>   iSelections;   //selected items in the path
+    TBool iFirstDeleteStep;
+
+    };
+
+#endif   // MPXPODCASTDBPLUGIN_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/inc/mpxpodcastdbpluginqueries.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Hard coded queries for Podcast collection db
+*
+*/
+
+
+#ifndef MPXPODCASTDBPLUGINQUERIES_H
+#define MPXPODCASTDBPLUGINQUERIES_H
+
+// Various Collection view duration queries
+_LIT(KPodcastCreateTable, "CREATE TABLE Podcast("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"Deleted INTEGER DEFAULT 0,"
+    L"DbFlag INTEGER,"
+    L"VolumeId INTEGER,"
+    L"IsPlaying INTEGER DEFAULT 0,"
+    L"Title TEXT COLLATE NOCASE,"
+    L"Location TEXT,"
+    L"PublishDate TEXT DEFAULT '',"
+    L"AlbumTrack INTEGER,"
+    L"PlayCount INTEGER DEFAULT 0,"
+    L"TimeAdded TEXT,"
+    L"TimePlayed TEXT DEFAULT '',"
+    L"Duration INTEGER,"
+    L"Sync INTEGER DEFAULT 0,"
+    L"Modified INTEGER DEFAULT 0,"
+    L"Artist INTEGER,"
+    L"Album INTEGER,"
+    L"Genre INTEGER,"
+    L"Composer INTEGER,"
+    L"ReleaseDate TEXT DEFAULT '',"
+    L"Rating INTEGER,"
+    L"Comment TEXT,"
+    L"Copyright TEXT,"
+    L"Art TEXT,"
+    L"Url TEXT,"
+    L"DRM INTEGER,"
+    L"LastPlayPosition INTEGER DEFAULT 0,"
+    L"SampleRate INTEGER,"
+    L"BitRate INTEGER,"
+    L"NumChannels INTEGER,"
+    L"Codec INTEGER,"
+    L"MimeType TEXT)");
+
+_LIT(KPodcastDropTable,"DROP TABLE Podcast");
+_LIT(KPodcastCheckTable,"SELECT UniqueId,Deleted,DbFlag,VolumeId,IsPlaying,Title,Location,PublishDate,AlbumTrack,PlayCount,TimeAdded,TimePlayed,Duration,Sync,Modified,Artist,Album,Genre,Composer,ReleaseDate,Rating,Comment,Copyright,Art,Url,DRM,LastPlayPosition,SampleRate,BitRate,NumChannels,Codec,MimeType FROM Podcast");
+
+_LIT(KQueryPodcastInsert, "INSERT INTO :dbname.Podcast(%S) VALUES(%S)");
+_LIT(KQueryPodcastUpdate, "UPDATE :dbname.Podcast SET %S WHERE UniqueId=%u");
+_LIT(KQueryPodcastSetIsPlaying, "UPDATE :dbname.Podcast SET IsPlaying=%u WHERE UniqueId=%u");
+_LIT(KQueryPodcastDelete, "DELETE FROM :dbname.Podcast WHERE UniqueId=%u");
+_LIT(KQueryPodcastDeleteUpdate, "UPDATE :dbname.Podcast SET Deleted=1 WHERE UniqueId=%u");
+_LIT(KQueryPodcastDeleteForCategory, "UPDATE :dbname.Podcast SET Deleted=0 WHERE %S=%u");
+_LIT(KQueryPodcastCleanup, "DELETE FROM :dbname.Podcast WHERE Deleted=1");
+
+_LIT(KQueryPodcastGetTitle, "SELECT Title FROM :dbname.Podcast WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryPodcastVolume, "SELECT VolumeId FROM :dbname.Podcast WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryPodcastAllVolumeIds, "SELECT VolumeId FROM :dbname.Podcast WHERE Deleted=0");
+
+// LTAN-79N8ND/EVXG-7FABHC: temporary fix.  Symbian 9.4 SQLite cannot resolve column number correctly,
+// Use column number instead of column name for ORDER BY, needed when FROM uses more than 1 table
+// calculate column number from SELECT fields, first field is column 1 (not 0)
+/*
+_LIT(KQueryPodcastFindAll, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE %S AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY Podcast.Title");
+*/
+_LIT(KQueryPodcastFindAll, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE %S AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY 6");
+
+_LIT(KQueryPodcastAlbum, "SELECT DISTINCT Album FROM :dbname.Podcast WHERE Deleted=0 AND Artist=%u ORDER BY Album");
+_LIT(KQueryPodcastInfo, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryPodcastCategory, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND %S=%u");
+_LIT(KQueryPodcastCategoryOrdered, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND %S=%u ORDER BY PublishDate DESC,Title");
+_LIT(KQueryPodcastGetUris, "SELECT UniqueId,Location FROM :dbname.Podcast WHERE Deleted=0 ORDER BY UniqueId ASC LIMIT %u");
+_LIT(KQueryPodcastGetUrisFrom, "SELECT UniqueId,Location FROM :dbname.Podcast WHERE Deleted=0 AND UniqueId > %u ORDER BY UniqueId ASC LIMIT %u");
+
+// Note: The no categories queries below only retrieve five fields as opposed to * from the Music table.
+//       This is an optimization that matches the DBMS version of the plugin and assumes that the client
+//       only requests those fields. From the C++ code perspective there is no difference in processing
+//       as the five fields in question reside at the beginning of the table. If the client is modified
+//       to request more attributes then the queries below will have to be changed to return *.
+//       As far as performance goes, the queries that only return five fields are a little faster than
+//       the ones that return *, for example, for a * query that takes 2.1 seconds the equivalent
+//       optimized query is faster by more than 100ms.
+
+// categories included
+_LIT(KQueryPodcastGetEpisode, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND Podcast.UniqueId=%u AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId");
+
+// LTAN-79N8ND/EVXG-7FABHC: temporary fix.  Symbian 9.4 SQLite cannot resolve column number correctly,
+// Use column number instead of column name for ORDER BY, needed when FROM uses more than 1 table
+// calculate column number from SELECT fields, first field is column 1 (not 0)
+/*
+_LIT(KQueryPodcastGetAllEpisodes, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY Podcast.Title");
+*/
+_LIT(KQueryPodcastGetAllEpisodes, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY 6");
+
+_LIT(KQueryPodcastGetEpisodesForAlbum, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND Podcast.Album=%u AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY PublishDate DESC,Title");
+_LIT(KQueryPodcastNotPlayed, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND Podcast.PlayCount=0 AND Podcast.LastPlayPosition=0 AND Podcast.IsPlaying=0 AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY PublishDate DESC,Title");
+_LIT(KQueryPodcastRecentlyAdded, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND julianday(Podcast.TimeAdded)>=julianday('now','start of day','-7 days') AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY TimeAdded DESC,Title");
+
+// LTAN-79N8ND/EVXG-7FABHC: temporary fix.  Symbian 9.4 SQLite cannot resolve column number correctly,
+// Use column number instead of column name for ORDER BY, needed when FROM uses more than 1 table
+// calculate column number from SELECT fields, first field is column 1 (not 0)
+/*
+_LIT(KQueryPodcastToday, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND julianday(Podcast.PublishDate)>=julianday('%S','start of day') AND julianday(Podcast.PublishDate)<julianday('%S','start of day','+1 days') AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY Podcast.PublishDate DESC,Podcast.Title");
+_LIT(KQueryPodcastYesterday, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND julianday(Podcast.PublishDate)>=julianday('%S','start of day','-1 days') AND julianday(Podcast.PublishDate)<julianday('%S','start of day') AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY Podcast.PublishDate DESC,Podcast.Title");
+_LIT(KQueryPodcastBetween, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND julianday(Podcast.PublishDate)>julianday('%S','start of day','-%u days') AND julianday(Podcast.PublishDate)<=julianday('%S','start of day','-%u days') AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY Podcast.PublishDate DESC,Podcast.Title");
+_LIT(KQueryPodcastLastMonth, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND julianday(Podcast.PublishDate)>=julianday('%S','start of month', '-1 month') AND julianday(Podcast.PublishDate)<julianday('%S','start of month') AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY Podcast.PublishDate DESC,Podcast.Title");
+_LIT(KQueryPodcastEarlier, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND julianday(Podcast.PublishDate)<julianday('%S','start of month', '-1 month') AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY Podcast.PublishDate DESC,Podcast.Title");
+_LIT(KQueryPodcastUnknown, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND (Podcast.PublishDate='' OR julianday(Podcast.PublishDate)>=julianday('%S','start of day','+1 days')) AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY Podcast.Title");
+*/
+_LIT(KQueryPodcastToday, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND julianday(Podcast.PublishDate)>=julianday('%S','start of day') AND julianday(Podcast.PublishDate)<julianday('%S','start of day','+1 days') AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY 8 DESC, 6");
+_LIT(KQueryPodcastYesterday, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND julianday(Podcast.PublishDate)>=julianday('%S','start of day','-1 days') AND julianday(Podcast.PublishDate)<julianday('%S','start of day') AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY 8 DESC, 6");
+_LIT(KQueryPodcastBetween, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND julianday(Podcast.PublishDate)>julianday('%S','start of day','-%u days') AND julianday(Podcast.PublishDate)<=julianday('%S','start of day','-%u days') AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY 8 DESC, 6");
+_LIT(KQueryPodcastLastMonth, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND julianday(Podcast.PublishDate)>=julianday('%S','start of month', '-1 month') AND julianday(Podcast.PublishDate)<julianday('%S','start of month') AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY 8 DESC, 6");
+_LIT(KQueryPodcastEarlier, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND julianday(Podcast.PublishDate)<julianday('%S','start of month', '-1 month') AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY 8 DESC, 6");
+_LIT(KQueryPodcastUnknown, "SELECT Podcast.*,Artist.Name,Album.Name,Genre.Name,Composer.Name FROM :dbname.Podcast,:dbname.Artist,:dbname.Album,:dbname.Genre,:dbname.Composer WHERE Podcast.Deleted=0 AND (Podcast.PublishDate='' OR julianday(Podcast.PublishDate)>=julianday('%S','start of day','+1 days')) AND Podcast.Album=Album.UniqueId AND Podcast.Artist=Artist.UniqueId AND Podcast.Genre=Genre.UniqueId AND Podcast.Composer=Composer.UniqueId ORDER BY 6");
+
+// no categories queries
+_LIT(KQueryPodcastGetEpisodeNoCat, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryPodcastGetAllEpisodesNoCat, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 ORDER BY Title");
+_LIT(KQueryPodcastGetEpisodesForAlbumNoCat, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND Album=%u ORDER BY PublishDate DESC,Title");
+_LIT(KQueryPodcastNotPlayedNoCat, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND PlayCount=0 AND LastPlayPosition=0 AND IsPlaying=0 ORDER BY PublishDate DESC,Title");
+_LIT(KQueryPodcastRecentlyAddedNoCat, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND julianday(TimeAdded)>=julianday('now','start of day','-7 days') ORDER BY TimeAdded DESC,Title");
+_LIT(KQueryPodcastTodayNoCat, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND julianday(PublishDate)>=julianday('%S','start of day') AND julianday(PublishDate)<julianday('%S','start of day','+1 days') ORDER BY PublishDate DESC,Title");
+_LIT(KQueryPodcastYesterdayNoCat, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND julianday(PublishDate)>=julianday('%S','start of day','-1 days') AND julianday(PublishDate)<julianday('%S','start of day') ORDER BY PublishDate DESC,Title");
+_LIT(KQueryPodcastBetweenNoCat, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND julianday(PublishDate)>julianday('%S','start of day','-%u days') AND julianday(PublishDate)<=julianday('%S','start of day','-%u days') ORDER BY PublishDate DESC,Title");
+_LIT(KQueryPodcastLastMonthNoCat, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND julianday(PublishDate)>=julianday('%S','start of month', '-1 month') AND julianday(PublishDate)<julianday('%S','start of month') ORDER BY PublishDate DESC,Title");
+_LIT(KQueryPodcastEarlierNoCat, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND julianday(PublishDate)<julianday('%S','start of month', '-1 month') ORDER BY PublishDate DESC,Title");
+_LIT(KQueryPodcastUnknownNoCat, "SELECT * FROM :dbname.Podcast WHERE Deleted=0 AND (PublishDate='' OR julianday(PublishDate)>=julianday('%S','start of day','+1 days')) ORDER BY Title");
+
+// count queries
+_LIT(KQueryPodcastCount, "SELECT count(*) FROM :dbname.Podcast WHERE Deleted=0");
+_LIT(KQueryPodcastTodayCount, "SELECT count(*) FROM :dbname.Podcast WHERE Deleted=0 AND julianday(PublishDate)>=julianday('%S','start of day') AND julianday(PublishDate)<julianday('%S','start of day','+1 days')");
+_LIT(KQueryPodcastYesterdayCount, "SELECT count(*) FROM :dbname.Podcast WHERE Deleted=0 AND julianday(PublishDate)>=julianday('%S','start of day','-1 days') AND julianday(PublishDate)<julianday('%S','start of day')");
+_LIT(KQueryPodcastBetweenCount, "SELECT count(*) FROM :dbname.Podcast WHERE Deleted=0 AND julianday(PublishDate)>julianday('%S','start of day','-%u days') AND julianday(PublishDate)<=julianday('%S','start of day','-%u days')");
+_LIT(KQueryPodcastLastMonthCount, "SELECT count(*) FROM :dbname.Podcast WHERE Deleted=0 AND julianday(PublishDate)>=julianday('%S','start of month', '-1 month') AND julianday(PublishDate)<julianday('%S','start of month')");
+_LIT(KQueryPodcastEarlierCount, "SELECT count(*) FROM :dbname.Podcast WHERE Deleted=0 AND julianday(PublishDate)<julianday('%S','start of month', '-1 month')");
+_LIT(KQueryPodcastUnknownCount, "SELECT count(*) FROM :dbname.Podcast WHERE (PublishDate='' OR julianday(PublishDate)>=julianday('%S','start of day','+1 days')) AND Deleted=0");
+_LIT(KQueryPodcastRecentlyAddedCount, "SELECT count(*) FROM :dbname.Podcast WHERE Deleted=0 AND julianday(TimeAdded)>=julianday('now','start of day','-7 days')");
+_LIT(KQueryPodcastNotPlayedCount, "SELECT count(*) FROM :dbname.Podcast WHERE Deleted=0 AND PlayCount=0 AND LastPlayPosition=0 AND IsPlaying=0");
+
+// duration queries
+_LIT(KQueryPodcastEpisodeDuration, "SELECT Duration FROM :dbname.Podcast WHERE Deleted=0 AND UniqueId=%u");
+_LIT(KQueryPodcastDurationAll, "SELECT sum(Duration) FROM :dbname.Podcast WHERE Deleted=0");
+_LIT(KQueryPodcastDurationAlbum, "SELECT sum(Duration) FROM :dbname.Podcast WHERE Deleted=0 AND Album=%u");
+_LIT(KQueryPodcastNotPlayedDuration, "SELECT sum(Duration) FROM :dbname.Podcast WHERE Deleted=0 AND PlayCount=0");
+_LIT(KQueryPodcastRecentlyAddedDuration, "SELECT Duration FROM :dbname.Podcast WHERE Deleted=0 AND julianday(TimeAdded)>julianday('now','-7 days')");
+
+// == Category table queries ==================================================
+//
+_LIT(KCategoryTablePlaceholder, "##table##");
+
+_LIT(KCategoryCreateTable,"CREATE TABLE ##table##("
+    L"UniqueId INTEGER PRIMARY KEY,"
+    L"Name TEXT COLLATE NOCASE,"
+    L"EpisodeCount INTEGER)");
+
+_LIT(KCategoryDropTable,"DROP TABLE ##table##");
+_LIT(KCategoryCheckTable,"SELECT UniqueId,Name,EpisodeCount FROM ##table##");
+_LIT(KCategoryNameIndex,"CREATE INDEX Index##table##Name ON ##table##(Name)");
+
+_LIT(KQueryCategoryInsert, "INSERT INTO :dbname.##table##(UniqueId,Name,EpisodeCount) VALUES(%u,'%S',%u)");
+_LIT(KQueryCategoryDelete, "DELETE FROM :dbname.##table## WHERE UniqueId=%u");
+
+_LIT(KQueryCategoryCount, "SELECT count(*) FROM :dbname.##table##");
+_LIT(KQueryCategoryItem, "SELECT * FROM :dbname.##table## WHERE UniqueId=%u");
+_LIT(KQueryCategoryItemByEpisodeId, "SELECT ##table##.* FROM :dbname.##table##,:dbname.Podcast WHERE Podcast.Deleted=0 AND Podcast.UniqueId=%u AND ##table##.UniqueId=Podcast.%S");
+_LIT(KQueryCategoryAll, "SELECT * FROM :dbname.##table## ORDER BY Name");
+_LIT(KQueryCategoryItems, "SELECT * FROM :dbname.##table## WHERE %S ORDER BY Name ASC");
+
+_LIT(KQueryCategoryIncrementEpisodeCount, "UPDATE :dbname.##table## SET EpisodeCount=EpisodeCount+1 WHERE UniqueId=%u");
+_LIT(KQueryCategoryDecrementEpisodeCount, "UPDATE :dbname.##table## SET EpisodeCount=EpisodeCount-1 WHERE UniqueId=%u");
+_LIT(KQueryCategoryGetEpisodeCount, "SELECT EpisodeCount FROM :dbname.##table## WHERE UniqueId=%u");
+
+// == Auxiliary table queries =================================================
+//
+_LIT(KAuxiliaryCreateTable, "CREATE TABLE Auxiliary("
+    L"Id INTEGER,"
+    L"Version TEXT,"
+    L"TimeRefreshed TEXT,"
+    L"TimeSynced TEXT,"
+    L"Corrupt INTEGER DEFAULT 0,"
+    L"SaveDeletedRecordCount INTEGER DEFAULT 0)");
+_LIT(KAuxiliaryDropTable,"DROP TABLE Auxiliary");
+_LIT(KAuxiliaryCheckTable, "SELECT Id,Version,TimeRefreshed,TimeSynced,Corrupt,SaveDeletedRecordCount FROM AUXILIARY");
+_LIT(KQueryAuxiliaryInsert, "INSERT INTO Auxiliary(Id,Version,Corrupt) VALUES(0,'6.0.0',%u)");
+
+_LIT(KQueryAuxiliarySetTime, "UPDATE :dbname.Auxiliary SET TimeRefreshed='%S', Corrupt=0");
+_LIT(KQueryAuxiliaryGetTime, "SELECT TimeRefreshed FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliarySetCorrupt, "UPDATE :dbname.Auxiliary SET Corrupt=%u");
+_LIT(KQueryAuxiliaryGetCorrupt, "SELECT Corrupt FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliaryGetCount, "SELECT SaveDeletedRecordCount FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliarySetCount, "UPDATE :dbname.Auxiliary SET SaveDeletedRecordCount=%u");
+_LIT(KQueryAuxiliaryGetId, "SELECT Id FROM :dbname.Auxiliary");
+_LIT(KQueryAuxiliarySetId, "UPDATE :dbname.Auxiliary SET Id=%u");
+
+// Podcast table criteria
+_LIT(KCriterionPodcastNotDeleted, "Podcast.Deleted=0");
+_LIT(KCriterionPodcastUniqueId, "Podcast.UniqueId=%u");
+_LIT(KCriterionPodcastAuthor, "Podcast.artist=%u");
+_LIT(KCriterionPodcastAlbum, "Podcast.album=%u");
+_LIT(KCriterionPodcastGenre, "Podcast.genre=%u");
+_LIT(KCriterionPodcastComposer, "Podcast.composer=%u");
+// SQLite requires LIKE statement to include an ESCAPE clause if an escaped percentage
+// or underscore is to be used as regular search text instead of pattern matching
+// characters. See http://www.sqlite.org/lang_expr.html for an explanation. To supprt
+// partial title matching, our goal is to have the following statement as an example:
+//      SELECT * FROM Podcast WHERE title LIKE '%xyz%' ESCAPE '\'
+// To achieve this, we specify the format to be %%%%%S%%%%. The 1st percentage is the
+// escape character for string formatter to output the 2nd percentage sign. Similiarly
+// for the 3rd, 4th, 6th, 7th, 8th, and 9th. The 5th percentage instructs string formatter
+// to substitute a string, i.e. %S. After subsititution, we will have, for example, %%xyz%%.
+// Because this substituted string will be substituted again into a WHERE clause, we need
+// to escape the percentage signs in order to get %xyz% as the end result.
+_LIT(KCriterionPodcastTitle, "Podcast.title LIKE '%%%%%S%%%%' ESCAPE '\\'");
+_LIT(KCriterionPodcastVolume, "Podcast.VolumeId=%u");
+_LIT(KCriterionPodcastUri, "Podcast.Location='%S'");
+_LIT(KCriterionPodcastSynchronized, "Podcast.Sync=%u");
+_LIT(KCriterionPodcastDeleted, "Podcast.Deleted=%u");
+_LIT(KCriterionPodcastModified, "Podcast.Modified=%u");
+_LIT(KCriterionPodcastPublishDateToday, "julianday(Podcast.PublishDate)>=julianday('%S','start of day') AND julianday(Podcast.PublishDate)<julianday('%S','start of day','+1 days')");
+_LIT(KCriterionPodcastPublishDateYesterday, "julianday(Podcast.PublishDate)>=julianday('%S','start of day','-1 days') AND julianday(Podcast.PublishDate)<julianday('%S','start of day')");
+_LIT(KCriterionPodcastPublishDateBetween, "julianday(Podcast.PublishDate)>julianday('%S','start of day','-%u days') AND julianday(Podcast.PublishDate)<=julianday('%S','start of day','-%u days')");
+_LIT(KCriterionPodcastPublishDateLastMonth, "julianday(Podcast.PublishDate)>=julianday('%S','start of month', '-1 month') AND julianday(Podcast.PublishDate)<julianday('%S','start of month')");
+_LIT(KCriterionPodcastPublishDateEarlier, "julianday(Podcast.PublishDate)<julianday('%S','start of month', '-1 month')");
+_LIT(KCriterionPodcastPublishDateUnknown, "(Podcast.PublishDate='' OR julianday(Podcast.PublishDate)>=julianday('%S','start of day','+1 days'))");
+
+// Category table criteria
+_LIT(KCriterionCategoryUniqueId, "##table##.UniqueId=%u");
+_LIT(KCriterionCategoryName, "##table##.Name LIKE '%%%%%S%%%%' ESCAPE '\\'");
+
+#endif // MPXPODCASTDBPLUGINQUERIES_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/loc/mpxpodcastcollectiondb.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localisation file for MPX Podcast DB
+*
+*/
+
+
+// LOCALISATION STRINGS
+
+//d:Text for first item in podcast main menu.
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_all_episodes "All episodes"
+
+//d:Text for second item in podcast main menu.
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_by_title "By title"
+
+//d:Text for third item in podcast main menu.
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_by_publish_date "By publish date"
+
+//d:Text for fourth item in podcast main menu.
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_recently_added "Recently added"
+
+//d:Text for fifth item in podcast main menu.
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_not_yet_played "Never played"
+
+// *** Title Pane ***
+
+// d:Text for Podcast Collection menu item in main player menu
+// l:list_double_large_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mus_podcasts "Podcasts"
+
+//d:Text in Podcast Menu View title pane
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_mp_title_my_podcast "Podcast Menu"
+
+//d:Text in Podcast View title pane
+//l:title_pane_t2/opt9
+//r:5.1
+//
+#define qtn_vmp_title_podcasts "Podcasts"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via "All Episodes" item in Podcast Menu View
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_title_all_episodes "All episodes"
+
+//d:Text in Publish Date View title pane
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_mus_title_publish_date "Publish date"
+
+//d:Text in Titlew View title pane
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_mus_title_titles "Titles"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via "Recently Added" item in Podcast Menu View
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_title_recently_added "Recently added"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via "Never Played" item in Podcast Menu View
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_unplayed "Never played"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via selecting the "Today" category in the Publish Date View.
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_episodes_title_published_today "Today"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via selecting the "Yesterday" category in the Publish Date View.
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_episodes_title_published_yesterday "Yesterday"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via selecting the "This week" category in the Publish Date View.
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_episodes_title_published_this_week "This week"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via selecting the "Last week" category in the Publish Date View.
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_episodes_title_published_last_week "Last week"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via selecting the "2 weeks ago" category in the Publish Date View.
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_episodes_title_published_two_weeks_ago "2 weeks ago"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via selecting the "3 weeks ago" category in the Publish Date View.
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_episodes_title_published_three_weeks_ago "3 weeks ago"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via selecting the "Last month" category in the Publish Date View.
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_episodes_title_published_last_month "Last month"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via selecting the "Earlier" category in the Publish Date View.
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_episodes_title_published_earlier "Earlier"
+
+//d:Text in Episodes View title pane when view is opened
+//d:via selecting the "Unknown" category in the Publish Date View.
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_nmp_episodes_title_published_date_unknown "Date unknown"
+
+//d:List item representing a publish date category within
+//d:Publish Date View
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_publish_date_today "Today"
+
+//d:List item representing a publish date category within
+//d:Publish Date View
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_publish_date_yesterday "Yesterday"
+
+//d:List item representing a publish date category within
+//d:Publish Date View
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_publish_date_this_week "This week"
+
+//d:List item representing a publish date category within
+//d:Publish Date View
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_publish_date_last_week "Last week"
+
+//d:List item representing a publish date category within
+//d:Publish Date View
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_publish_date_2_weeks "2 weeks ago"
+
+//d:List item representing a publish date category within
+//d:Publish Date View
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_publish_date_3_weeks "3 weeks ago"
+
+//d:List item representing a publish date category within
+//d:Publish Date View
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_publish_date_last_months "Last month"
+
+//d:List item representing a publish date category within
+//d:Publish Date View
+//l:list_single_graphic_pane_t1
+//r:5.0
+//
+#define qtn_nmp_publish_date_earlier "Earlier"
+
+
+// d:List item representing a publish date category within
+// d:Publish Date View
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_nmp_publish_date_unknown "Unknown"
+
+//d:List item within Music Player Main View to show the number of items in the collection.
+//d:Used when number of episodes is 0 (zero) or greater than 1..  %N repesents
+//d:the number of podcasts in the current view.
+//l:list_double_large_graphic_pane_t2
+//r:5.0
+//
+#define qtn_mus_podcast_num_episodes "%N episodes"
+
+//d:List item within Music Player Main View to show the number of items in the collection.
+//d:Used when number of episodes is equal to 1.
+//l:list_double_large_graphic_pane_t2
+//r:5.0
+//
+#define qtn_mus_podcast_one_episode "1 episode"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxdbauxiliary.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,294 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Responsible for interaction with the Auxiliary table.
+*
+*/
+
+
+// INCLUDE FILES
+#include <sqldb.h>
+#include <mpxlog.h>
+
+#include "mpxdbcommonutil.h"
+#include "mpxdbmanager.h"
+
+#include "mpxpodcastdbpluginqueries.h"
+#include "mpxpodcastcollectiondbdef.h"
+#include "mpxdbutil.h"
+#include "mpxdbauxiliary.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary* CMPXDbAuxiliary::NewL(
+    CMPXDbManager& aDbManager)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::NewL");
+
+    CMPXDbAuxiliary* self = CMPXDbAuxiliary::NewLC(aDbManager);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary* CMPXDbAuxiliary::NewLC(
+    CMPXDbManager& aDbManager)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::NewLC");
+
+    CMPXDbAuxiliary* self = new (ELeave) CMPXDbAuxiliary(aDbManager);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary::~CMPXDbAuxiliary()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::~CMPXDbAuxiliary");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbAuxiliary::CMPXDbAuxiliary(
+    CMPXDbManager& aDbManager) :
+    CMPXDbTable(aDbManager)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::CMPXDbAuxiliary");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::ConstructL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::ConstructL");
+    BaseConstructL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetLastRefreshedTimeL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetLastRefreshedTimeL(
+    TTime aTime)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SetLastRefreshedTimeL");
+
+    // update all databases
+    HBufC* time = MPXDbCommonUtil::TTimeToDesLC(aTime);
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryAuxiliarySetTime, time);
+    CleanupStack::PopAndDestroy(time);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::LastRefreshedTimeL
+// ----------------------------------------------------------------------------
+//
+TTime CMPXDbAuxiliary::LastRefreshedTimeL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::LastRefreshedTimeL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    // read the time string and convert it to TTime
+    TTime time(MPXDbCommonUtil::DesToTTimeL(
+    	MPXDbCommonUtil::GetColumnTextL(recordset, KMPXTableDefaultIndex)));
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return time;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetDBCorruptedL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetDBCorruptedL(
+    TBool aCorrupt)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SetDBCorruptedL");
+
+    // update all databases
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryAuxiliarySetCorrupt,
+        aCorrupt);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::DBCorruptedL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAuxiliary::DBCorruptedL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::DBCorruptedL");
+    return (ExecuteSumQueryL(KQueryAuxiliaryGetCorrupt) > 0);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetSaveDeletedRecordCountL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetSaveDeletedRecordCountL(TInt aDrive,
+    TUint32 aValue)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SetSaveDeletedRecordCountL");
+
+    // update all databases
+    iDbManager.ExecuteQueryL(aDrive, KQueryAuxiliarySetCount, aValue);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SaveDeletedRecordCountL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAuxiliary::SaveDeletedRecordCountL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SaveDeletedRecordCountL");
+    return ExecuteSumQueryL(KQueryAuxiliaryGetCount);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SaveDeletedRecordCountL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbAuxiliary::SaveDeletedRecordCountL(TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::SaveDeletedRecordCountL ");
+    return ExecuteIntQueryL(aDrive, KQueryAuxiliaryGetCount);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::IsRefreshedL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAuxiliary::IsRefreshedL()
+    {
+    MPX_FUNC("CMPXDbAuxiliary::IsRefreshedL");
+
+    TBool refreshed(ETrue);
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryAuxiliaryGetTime));
+    CleanupClosePushL(recordset);
+
+    TInt count(0);
+    while (recordset.Next() == KSqlAtRow)
+        {
+        count++;
+
+        // read the time string and convert it to TTime
+        if (Time::NullTTime() == MPXDbCommonUtil::DesToTTimeL(
+        	MPXDbCommonUtil::GetColumnTextL(recordset, KMPXTableDefaultIndex)))
+            {
+            refreshed = EFalse;
+            break;
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+    return refreshed && (count > 0);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::IdL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbAuxiliary::IdL( TInt aDrive )
+    {
+    MPX_DEBUG1("CMPXDbAuxiliary::IdL <--");
+    TInt id(0);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive, KQueryAuxiliaryGetId));
+    CleanupClosePushL( recordset );
+
+    while(recordset.Next() == KSqlAtRow )
+        {
+        id = recordset.ColumnInt(KMPXTableDefaultIndex);
+        }
+
+    CleanupStack::PopAndDestroy( &recordset );
+    MPX_DEBUG1("CMPXDbAuxiliary::IdL -->");
+    return id;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::SetIdL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::SetIdL( TInt aDrive, TInt aId )
+    {
+    MPX_DEBUG1("CMPXDbAuxiliary::SetIdL <--");
+    iDbManager.ExecuteQueryL(aDrive,KQueryAuxiliarySetId, aId);
+    MPX_DEBUG1("CMPXDbAuxiliary::SetIdL -->");
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool aCorruptTable)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::CreateTableL");
+
+    // create the table
+    User::LeaveIfError(aDatabase.Exec(KAuxiliaryCreateTable));
+
+    // insert the default record
+    // use the same length as '%u' is longer than '0' or '1'
+    HBufC* query = KQueryAuxiliaryInsert().AllocLC();
+    query->Des().Format(KQueryAuxiliaryInsert, aCorruptTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbAuxiliary::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::DropTableL");
+    User::LeaveIfError(aDatabase.Exec(KAuxiliaryDropTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbAuxiliary::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbAuxiliary::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbAuxiliary::CheckTableL");
+    return DoCheckTable(aDatabase, KAuxiliaryCheckTable);
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxdbcategory.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,811 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements the base class for the various lookup tables
+*
+*/
+
+
+// INCLUDE FILES
+#include <sqldb.h>
+
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxlog.h>
+
+#include "mpxdbcommonutil.h"
+#include "mpxdbcommondef.h"
+#include "mpxdbmanager.h"
+
+#include "mpxdbutil.h"
+#include "mpxpodcastcollectiondbdef.h"
+#include "mpxpodcastcollectiondbstd.h"
+#include "mpxpodcastdbpluginqueries.h"
+#include "mpxdbcategory.h"
+
+// CONSTANTS
+
+// maximum number of table name entries per query
+const TInt KMaxTableNameCount = 2;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbCategory* CMPXDbCategory::NewL(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbCategory::NewL");
+
+    CMPXDbCategory* self = CMPXDbCategory::NewLC(aDbManager, aCategory);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor, leave object in cleanup stack.
+// ----------------------------------------------------------------------------
+//
+CMPXDbCategory* CMPXDbCategory::NewLC(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("CMPXDbCategory::NewLC");
+
+    CMPXDbCategory* self = new (ELeave) CMPXDbCategory(aDbManager, aCategory);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbCategory::~CMPXDbCategory()
+    {
+    MPX_FUNC("CMPXDbCategory::~CMPXDbCategory");
+    delete iTableName;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbCategory::CMPXDbCategory(
+    CMPXDbManager& aDbManager,
+    TMPXGeneralCategory aCategory) :
+    CMPXDbTable(aDbManager),
+    iCategory(aCategory)
+    {
+    MPX_FUNC("CMPXDbCategory::CMPXDbCategory");
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::ConstructL()
+    {
+    MPX_FUNC("CMPXDbCategory::ConstructL");
+
+    BaseConstructL();
+    iTableName = MPXDbUtil::TableNameForCategoryL(iCategory).AllocL();
+    }
+
+// ----------------------------------------------------------------------------
+// Add a row containing the name to the lookup table
+// If the name already exists in the table, increment the count
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbCategory::AddItemL(
+    const TDesC& aName,
+    TInt aDriveId,
+    TBool& aNewRecord,
+    TBool aCaseSensitive)
+    {
+    MPX_FUNC("CMPXDbCategory::AddItemL");
+
+    // try to find the item first
+    TUint32 rowId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), iCategory, aName, aCaseSensitive));
+    aNewRecord = !CategoryItemExistsL(aDriveId, rowId);
+
+    if (aNewRecord)
+        {
+        // insert new
+        HBufC* query = PreProcessStringLC(KQueryCategoryInsert);
+        HBufC* name = MPXDbCommonUtil::ProcessSingleQuotesLC(aName);
+
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId, name, 1);
+
+        CleanupStack::PopAndDestroy(name);
+        CleanupStack::PopAndDestroy(query);
+        }
+    else
+        {
+        // increment the number of episodes for the category
+        HBufC* query = PreProcessStringLC(KQueryCategoryIncrementEpisodeCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, rowId);
+        CleanupStack::PopAndDestroy(query);
+        }
+
+    return rowId;
+    }
+
+// ----------------------------------------------------------------------------
+// Get the name of the row matching the given ID
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbCategory::GetNameL(
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::GetNameL");
+
+    RSqlStatement recordset(GetCategoryRecordL(aId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::LeaveIfError(KErrNotFound);
+        }
+
+    HBufC* name = MPXDbCommonUtil::GetColumnTextL(recordset, ECategoryName).AllocL();
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return name;
+    }
+
+// ----------------------------------------------------------------------------
+// Count the total number of items
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbCategory::CountL()
+    {
+    MPX_FUNC("CMPXDbCategory::CountL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryCount);
+    TInt count(ExecuteSumQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Find record(s) that match(es) the selection criteria
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::FindAllL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCollection::FindAllL");
+
+    // process the requested attributes
+    // the UniqueId is always requested
+    TBool titleRequested(EFalse);
+    TBool counterRequested(EFalse);
+
+    TInt viewingColumnCount(aAttrs.Count());
+    for (TInt i = 0; i < viewingColumnCount; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            TUint attributeId(aAttrs[i].AttributeId());
+
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                titleRequested = ETrue;
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+                counterRequested = ETrue;
+                }
+            }
+        }
+
+    TMPXGeneralType type = aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+
+    const TArray<TMPXAttribute> criteria = aCriteria.Attributes();
+    TInt criteriaCount(criteria.Count());
+
+    // process the criteria and construct the criteria string
+    CDesCArrayFlat* criteriaArray = new (ELeave) CDesCArrayFlat(criteriaCount + 1);
+    CleanupStack::PushL(criteriaArray);
+
+    TBool criteriaCounterSet(EFalse);
+    TInt criteriaCounter(0);
+    for (TInt i = 0; i < criteriaCount; ++i)
+        {
+        const TMPXAttribute& criterion = criteria[i];
+        if ((type == EMPXItem) && (criterion == KMPXMediaGeneralId))
+            {
+            TUint32 itemId = (aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+            if (MPX_ITEM_CATEGORY(itemId) != iCategory)
+                {
+                User::Leave(KErrNotSupported);
+                }
+
+            HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, itemId);
+            CleanupStack::PopAndDestroy(critStr);
+            }
+        else if (criterion == KMPXMediaGeneralTitle)
+            {
+            HBufC* critStr = PreProcessStringLC(KCriterionCategoryName);
+            HBufC* title = MPXDbCommonUtil::ProcessPatternCharsLC(
+                aCriteria.ValueText(KMPXMediaGeneralTitle));
+            MPXDbCommonUtil::AddSqlCriterionL(*criteriaArray, *critStr, *title);
+            CleanupStack::PopAndDestroy(2, critStr); // title & Str
+            }
+        else if (criterion == KMPXMediaGeneralCount)
+            {
+            criteriaCounterSet = ETrue;
+            criteriaCounter = aCriteria.ValueTObjectL<TInt>(KMPXMediaGeneralCount);
+            }
+        else
+            {
+            // ignore attribute
+            }
+        }
+
+    // construct criteria string
+    HBufC* criteriaStr = MPXDbCommonUtil::StringFromArrayLC(*criteriaArray, KMCAndKeyword);
+
+    // either get all items or items filtered based on criteria
+    HBufC* query = PreProcessStringLC(criteriaStr->Length() ?
+        KQueryCategoryItems() : KQueryCategoryAll());
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, criteriaStr));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(criteriaStr);
+    CleanupStack::PopAndDestroy(criteriaArray);
+
+    CleanupClosePushL(recordset);
+
+    // It is possible to get multiple records with the same ID in the case where the same category
+    // name is present on more than one drive (the unique ID is constructed from the name alone
+    // for categories). The records have to be processed manually as the songs count cannot be
+    // summed in the query.
+    //
+    // Unknown artist/album/genre/composer is stored in the database as NULL (name field). This
+    // ensures the unknown artist/album/genre/composer to be the 1st found record if it exists.
+    // This will save time in searching for the unknown record among the results and avoid
+    // performing descriptor comparison.
+    // If the 1st record is the unknown artist/album/genre/composer, it won't be appended to the
+    // array until all other records have been put in the array.
+    //
+    // NOTE: putting unknown artist/album/genre/composer to the end of the array only takes place
+    //       when title field is requested. normal sorting algorithm occurs if title isn't requested,
+    //       i.e. client requests for Id only. The Id of the unknown record will be the 1st item in
+    //       the array if it exists.
+    //
+    TBool firstGroup(ETrue);
+    CMPXMedia* unknownMedia(NULL);
+    CMPXMedia* media(NULL);
+    TUint32 prevId(0);
+    TUint32 currId(0);
+    TUint32 accumulatedCounter(0);
+    TInt err(KErrNone);
+
+    while ((err = recordset.Next()) == KSqlAtRow)
+        {
+        // Setup basic info - with first record of a group
+        currId = recordset.ColumnInt64(ECategoryUniqueId);
+
+        if (currId != prevId)
+            {
+            // first or new set of records
+            if (media)
+                {
+                // valid previous record set
+                if (criteriaCounterSet && (criteriaCounter != accumulatedCounter))
+                    {
+                    // the counter criterion does not match
+                    // discard the media and unknownMedia
+                    CleanupStack::PopAndDestroy(media);
+                    if (firstGroup && unknownMedia)
+                        {
+                        unknownMedia = NULL;
+                        }
+                    }
+                else
+                    {
+                    if (!firstGroup || !unknownMedia)
+                        {
+                        // append the media to the array
+                        if (counterRequested)
+                            {
+                            media->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, accumulatedCounter);
+                            }
+
+                        aMediaArray.AppendL(*media);
+                        CleanupStack::PopAndDestroy(media);
+                        }
+
+                    firstGroup = EFalse;
+                    }
+                }
+
+            // start a new media object
+            media = CMPXMedia::NewL();
+            CleanupStack::PushL(media);
+
+            media->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+            media->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, iCategory);
+            media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, currId);
+
+            if (titleRequested)
+                {
+                TPtrC name = MPXDbCommonUtil::GetColumnTextL(recordset, ECategoryName);
+                if (firstGroup && (name.Length() == 0))
+                    {
+                    unknownMedia = media;
+                    }
+                media->SetTextValueL(KMPXMediaGeneralTitle, name);
+                }
+
+            accumulatedCounter = 0;
+            prevId = currId;
+            }
+
+        accumulatedCounter += GetEpisodeCountL(KDbManagerAllDrives, currId);
+        }
+
+    // process last record
+    if (media)
+        {
+        // valid previous record set
+        if (criteriaCounterSet && (criteriaCounter != accumulatedCounter))
+            {
+            // the counter criterion does not match
+            // discard the media and unknownMedia
+            CleanupStack::PopAndDestroy(media);
+            if (firstGroup && unknownMedia)
+                {
+                unknownMedia = NULL;
+                }
+            }
+        else
+            {
+            if (!firstGroup || !unknownMedia)
+                {
+                // append the media to the array
+                if (counterRequested)
+                    {
+                    media->SetTObjectValueL<TInt>(KMPXMediaGeneralCount, accumulatedCounter);
+                    }
+
+                aMediaArray.AppendL(*media);
+                CleanupStack::PopAndDestroy(media);
+                }
+            }
+        }
+
+    if (unknownMedia)
+        {
+        aMediaArray.AppendL(*unknownMedia);
+        CleanupStack::PopAndDestroy(unknownMedia); // the first media that contains unknown title
+        }
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(err);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Decrement the number of episodes in the row. If the count gets to 0, remove the row.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::DecrementEpisodesForCategoryL(
+    const TUint32 aId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbCategory::DecrementEpisodesForCategoryL");
+
+    // if just one episode uses this category, use <= just in case
+    if (GetEpisodeCountL(aDriveId, aId) <= 1)
+        {
+        // delete the category
+        DeleteCategoryL(aId, aDriveId);
+
+        if (aItemChangedMessages)
+            {
+            // add the item changed message
+            MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, aId, EMPXItemDeleted,
+                iCategory, KDBPluginUid);
+            }
+        }
+    else
+        {
+        // decrement the number of episodes for the category
+        HBufC* query = PreProcessStringLC(KQueryCategoryDecrementEpisodeCount);
+        iDbManager.ExecuteQueryL(aDriveId, *query, aId);
+        CleanupStack::PopAndDestroy(query);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::DeleteCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::DeleteCategoryL(
+    TUint32 aId,
+    TInt aDriveId)
+    {
+    MPX_FUNC("CMPXDbCategory::DeleteCategoryL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryDelete);
+    iDbManager.ExecuteQueryL(aDriveId, *query, aId);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetCategoryItemL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::GetCategoryItemL(
+    TUint32 aId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbCategory::GetCategoryItemL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+    ExecuteMediaQueryL(aAttrs, aMedia, *query, aId);
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetCategoryItemsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::GetCategoryItemsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCategory::GetCategoryItemsL");
+
+    // have to run one query to get all items as opposed to individual queries
+    // because of the sorting
+
+    // construct the unique ID criteria string
+    // (UniqueId = %u OR UniqueId = %u ...)
+    TInt itemCount(aMediaArray.Count());
+    HBufC* criteria = HBufC::NewLC((2 * KCriterionCategoryUniqueId().Length() +
+        KMCIntegerLen + KMCOrKeyword().Length() + 2) * itemCount);
+    TPtr ptr(criteria->Des());
+    ptr.Append(KMCOpenBracket);
+    for (TInt index = 0; index < itemCount; ++index)
+        {
+        CMPXMedia* media = aMediaArray[index];
+
+        HBufC* critStr = PreProcessStringLC(KCriterionCategoryUniqueId);
+        HBufC* criterion = MPXDbCommonUtil::SqlCriterionLC(*critStr,
+            media->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+        ptr.Append(*criterion);
+        CleanupStack::PopAndDestroy(criterion);
+        CleanupStack::PopAndDestroy(critStr);
+
+        if (index < itemCount - 1)
+            {
+            ptr.Append(KMCOrKeyword);
+            }
+        }
+    ptr.Append(KMCCloseBracket);
+
+    // the array has to be reset as the items have to be returned in a different sort order
+    aMediaArray.Reset();
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryItems);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query, criteria));
+
+    CleanupStack::PopAndDestroy(query);
+    CleanupStack::PopAndDestroy(criteria);
+
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetAllCategoryItemsL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::GetAllCategoryItemsL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCategory::GetAllCategoryItemsL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryAll);
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    CleanupClosePushL(recordset);
+    ProcessRecordsetL(aAttrs, recordset, aMediaArray);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::CategoryItemExistsL
+// The category records must be in the same database as the corresponding
+// Podcast record, otherwise when adding a duplicate of a song on a
+// different drive this method will return true and the category record won't
+// be created.
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbCategory::CategoryItemExistsL(
+    TInt aDriveId,
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::CategoryItemExistsL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+    RSqlStatement recordset(
+        iDbManager.ExecuteSelectQueryL(aDriveId, *query, aId));
+
+    TBool exists(recordset.Next() == KSqlAtRow);
+
+    recordset.Close();
+    CleanupStack::PopAndDestroy(query);
+
+    return exists;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetSongsCountL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbCategory::GetEpisodeCountL(
+    TInt aDriveId,
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::GetEpisodeCountL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryGetEpisodeCount);
+    RSqlStatement recordset(
+        iDbManager.ExecuteSelectQueryL(aDriveId, *query, aId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    TInt ret = recordset.ColumnInt(KMPXTableDefaultIndex);
+
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(query);
+
+    return ret;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::UpdateMediaL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::UpdateMediaL(
+    RSqlStatement& aRecord,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbCategory::UpdateMediaL");
+
+    TInt attrCount(aAttrs.Count());
+    for (TInt i = 0; i < attrCount; ++i)
+        {
+        TInt contentId(aAttrs[i].ContentId());
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if (contentId == KMPXMediaIdGeneral)
+            {
+            if (attributeId & EMPXMediaGeneralId)
+                {
+                aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+                    aRecord.ColumnInt64(ECategoryUniqueId));
+                }
+            if (attributeId & EMPXMediaGeneralTitle)
+                {
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle,
+                    MPXDbCommonUtil::GetColumnTextL(aRecord, ECategoryName));
+                }
+            if (attributeId & EMPXMediaGeneralCount)
+                {
+                aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount,
+                    GetEpisodeCountL(KDbManagerAllDrives,
+                    aRecord.ColumnInt64(ECategoryUniqueId)));
+                }
+            } // end if contentId == KMPXMediaIdGeneral
+        } // end for
+
+    aMedia.SetTObjectValueL(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL(KMPXMediaGeneralCategory, iCategory);
+    // Fix for EXAL-79ZC9M set the right Type and Cat for each item
+    if (iCategory == EMPXAlbum)
+        {
+        aMedia.SetTObjectValueL(KMPXMediaPodcastType, EMPXPodcastGroup);
+        aMedia.SetTObjectValueL(KMPXMediaPodcastCategoryGroup, EMPXTitle);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::GetCategoryRecordL
+// ----------------------------------------------------------------------------
+//
+RSqlStatement CMPXDbCategory::GetCategoryRecordL(
+    TUint32 aId)
+    {
+    MPX_FUNC("CMPXDbCategory::GetCategoryRecordL");
+
+    HBufC* query = PreProcessStringLC(KQueryCategoryItem);
+    RSqlStatement statement(iDbManager.ExecuteSelectQueryL(*query, aId));
+    CleanupStack::PopAndDestroy(query);
+
+    return statement;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::PreProcessStringLC
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbCategory::PreProcessStringLC(
+    const TDesC& aQuery)
+    {
+    MPX_FUNC("CMPXDbCategory::PreProcessStringLC");
+
+    HBufC* query = HBufC::NewLC(aQuery.Length() + KMaxTableNameCount *
+        (iTableName->Length() + KCategoryTablePlaceholder().Length()));
+    TPtr queryPtr(query->Des());
+
+    // copy the query string
+    queryPtr = aQuery;
+
+    // replace all instances of the placeholder with the actual table name
+    TInt index(0);
+    while ((index = queryPtr.Find(KCategoryTablePlaceholder)) != KErrNotFound)
+        {
+        queryPtr.Replace(index, KCategoryTablePlaceholder().Length(), *iTableName);
+        }
+
+    return query;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::ProcessRecordsetL
+// Unknown item is stored in the database as NULL (name field). This ensures the
+// unknown item to be the 1st found record if it exists. This will save time in
+// searching for the unknown record among the results and avoid performing
+// descriptor comparison. If the 1st record is the unknown item, it won't be
+// appended to the array until all other records have been put in the array.
+//
+// NOTE: putting unknown item to the end of the array only takes place when title
+//       field is requested. normal sorting algorithm occurs if title isn't
+//       requested.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::ProcessRecordsetL(
+    const TArray<TMPXAttribute>& aAttrs,
+    RSqlStatement& aRecordset,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbCategory::ProcessRecordsetL");
+
+    // populate the array
+    TBool firstRecord(ETrue);
+    CMPXMedia* unknownMedia(NULL);
+    TInt prevId(0);
+    TInt err(KErrNone);
+
+    while ((err = aRecordset.Next()) == KSqlAtRow)
+        {
+        TUint32 rowId(aRecordset.ColumnInt64(ECategoryUniqueId));
+        if (prevId == rowId)
+            {
+            continue;
+            }
+
+        prevId = rowId;
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL(media);
+
+        UpdateMediaL(aRecordset, aAttrs, *media);
+
+        if (firstRecord && (MPXDbCommonUtil::GetColumnTextL(aRecordset, ECategoryName).Length() == 0))
+            {
+            unknownMedia = media;
+            }
+
+        if (!firstRecord || !unknownMedia)
+            {
+            aMediaArray.AppendL(*media);
+            CleanupStack::PopAndDestroy(media);
+            }
+
+        firstRecord = EFalse;
+        } // end while
+
+    if (err != KSqlAtEnd)
+        {
+        User::LeaveIfError(err);
+        }
+
+    if (unknownMedia)
+        {
+        aMediaArray.AppendL(*unknownMedia);
+        CleanupStack::PopAndDestroy(unknownMedia);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbCategory::CreateTableL");
+
+    // create the table
+    HBufC* query = PreProcessStringLC(KCategoryCreateTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+
+    // create the Name index
+    query = PreProcessStringLC(KCategoryNameIndex);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbCategory::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbCategory::DropTableL");
+
+    HBufC* query = PreProcessStringLC(KCategoryDropTable);
+    User::LeaveIfError(aDatabase.Exec(*query));
+    CleanupStack::PopAndDestroy(query);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbCategory::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbCategory::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbCategory::CheckTableL");
+
+    HBufC* query = PreProcessStringLC(KCategoryCheckTable);
+    TBool check(DoCheckTable(aDatabase, *query));
+    CleanupStack::PopAndDestroy(query);
+
+    return check;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxdbpodcast.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2712 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implements the functions to manipulate the Podcast table
+*
+*/
+
+
+// INCLUDE FILES
+#include <PCRes.rsg>
+#include <sqldb.h>
+
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxpodcastdefs.h>
+#include <mpxlog.h>
+
+#include "mpxdbcommondef.h"
+#include "mpxdbcommonstd.h"
+#include "mpxresource.h"
+#include "mpxdbcommonutil.h"
+#include "mpxdbmanager.h"
+
+#include "mpxdbutil.h"
+#include "mpxpodcastcollectiondbdef.h"
+#include "mpxpodcastdbpluginqueries.h"
+#include "mpxdbpodcast.h"
+
+//CONSTANTS
+// UniqueID column in Uris requests
+const TInt KColUniqueID = 0;
+// URI column in Uris requests
+const TInt KColUri = 1;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPodcast* CMPXDbPodcast::NewL(
+    CMPXDbManager& aDbManager,
+    CMPXResource& aResource,
+    MMPXDbPodcastObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbPodcast::NewL");
+
+    CMPXDbPodcast* self = CMPXDbPodcast::NewLC(aDbManager, aResource, aObserver);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPodcast* CMPXDbPodcast::NewLC(
+    CMPXDbManager& aDbManager,
+    CMPXResource& aResource,
+    MMPXDbPodcastObserver& aObserver)
+    {
+    MPX_FUNC("CMPXDbPodcast::NewLC");
+
+    CMPXDbPodcast* self = new (ELeave) CMPXDbPodcast(aDbManager, aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL(aResource);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CMPXDbPodcast::~CMPXDbPodcast()
+    {
+    MPX_FUNC("CMPXDbPodcast::~CMPXDbPodcast");
+    delete iExtensionsDrm;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXDbPodcast::CMPXDbPodcast(
+    CMPXDbManager& aDbManager,
+    MMPXDbPodcastObserver& aObserver) :
+    CMPXDbTable(aDbManager),
+    iObserver(aObserver)
+    {
+    MPX_FUNC("CMPXDbPodcast::CMPXDbPodcast");
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::ConstructL(
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXDbPodcast::ConstructL");
+
+    BaseConstructL();
+    iExtensionsDrm = aResource.ReadDesCArrayL(R_MC_FILE_EXTENSIONS_DRM);
+    }
+
+// ----------------------------------------------------------------------------
+// Add a episode to the podcast table
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXDbPodcast::AddEpisodeL(
+    const CMPXMedia& aMedia,
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbPodcast::AddEpisodeL");
+
+    if (!aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TUint32 episodeId(MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection,
+        aMedia.ValueText(KMPXMediaGeneralUri), EFalse));
+    if (EpisodeExistsL(episodeId))
+        {
+        DoUpdateEpisodeL(episodeId, aMedia, NULL);
+        }
+    else
+        {
+        // add the song
+        DoAddEpisodeL(episodeId, aMedia, aDrive, NULL);
+        }
+
+    return episodeId;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::UpdateEpisodeL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbPodcast::UpdateEpisodeL(
+    TUint32 aEpisodeId,
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::UpdateEpisodeL");
+    return DoUpdateEpisodeL(aEpisodeId, aMedia, &aItemChangedMessages);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::CleanupL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::CleanupL()
+    {
+    MPX_FUNC("CMPXDbPodcast::CleanupL");
+    iDbManager.ExecuteQueryL(KDbManagerAllDrives, KQueryPodcastCleanup);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a episode from the podcast table
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DeleteEpisodeL(
+    TUint32 aEpisodeId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages,
+    TBool aDeleteRecord)
+    {
+    MPX_FUNC("CMPXDbPodcast::DeleteEpisodeL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastGetEpisode,
+        aEpisodeId));
+    CleanupClosePushL(recordset);
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+    DoDeleteEpisodeL(recordset, aUriArray, aItemChangedMessages, aDeleteRecord);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::DeleteCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DeleteCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::DeleteCategoryL");
+
+    TPtrC ptr(MPXDbUtil::PodcastFieldNameForCategoryL(aCategory));
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastCategory,
+        &ptr, aCategoryId));
+    CleanupClosePushL(recordset);
+    DeleteRecordsetL(recordset, aUriArray, aItemChangedMessages);
+    CleanupStack::PopAndDestroy(&recordset);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all podcast episodes from the podcast table that are published today
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DeleteTodayEpisodesL(
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::DeleteTodayEpisodesL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastToday, now, now));
+    CleanupClosePushL(recordset);
+    DeleteRecordsetL(recordset, aUriArray, aItemChangedMessages);
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(now);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all podcast episodes from the podcast table that are published yesterday
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DeleteYesterdayEpisodesL(
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::DeleteYesterdayEpisodesL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastYesterday, now, now));
+    CleanupClosePushL(recordset);
+    DeleteRecordsetL(recordset, aUriArray, aItemChangedMessages);
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(now);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all podcast episodes from the podcast table that are published this week
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DeleteThisWeekEpisodesL(
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::DeleteThisWeekEpisodesL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastBetween,
+        now, dayNo, now, 1));
+    CleanupClosePushL(recordset);
+    DeleteRecordsetL(recordset, aUriArray, aItemChangedMessages);
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(now);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all podcast episodes from the podcast table that are published last week
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DeleteLastWeekEpisodesL(
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::DeleteLastWeekEpisodesL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastBetween,
+        now, dayNo + 7, now, dayNo));
+    CleanupClosePushL(recordset);
+    DeleteRecordsetL(recordset, aUriArray, aItemChangedMessages);
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(now);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all podcast episodes from the podcast table that are published 2 weeks ago
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::Delete2WeeksAgoEpisodesL(
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::Delete2WeeksAgoEpisodesL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastBetween,
+        now, dayNo + 14, now, dayNo + 7));
+    CleanupClosePushL(recordset);
+    DeleteRecordsetL(recordset, aUriArray, aItemChangedMessages);
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(now);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all podcast episodes from the podcast table that are published 3 weeks ago
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::Delete3WeeksAgoEpisodesL(
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::Delete3WeeksAgoEpisodesL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastBetween,
+        now, dayNo + 21, now, dayNo + 14));
+    CleanupClosePushL(recordset);
+    DeleteRecordsetL(recordset, aUriArray, aItemChangedMessages);
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(now);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all podcast episodes from the podcast table that are published last month
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DeleteLastMonthEpisodesL(
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::DeleteLastMonthEpisodesL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastLastMonth, now, now));
+    CleanupClosePushL(recordset);
+    DeleteRecordsetL(recordset, aUriArray, aItemChangedMessages);
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(now);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all podcast episodes from the podcast table that are published earlier
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DeleteEarlierEpisodesL(
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::DeleteEarlierEpisodesL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastEarlier, now));
+    CleanupClosePushL(recordset);
+    DeleteRecordsetL(recordset, aUriArray, aItemChangedMessages);
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(now);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove all podcast episodes from the podcast table that do not have a published date
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DeleteUnknownEpisodesL(
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::DeleteUnknownEpisodesL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastUnknown, now));
+    CleanupClosePushL(recordset);
+    DeleteRecordsetL(recordset, aUriArray, aItemChangedMessages);
+    CleanupStack::PopAndDestroy(&recordset);
+    CleanupStack::PopAndDestroy(now);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the episode Id and duration
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::EpisodeDurationL(
+    TUint32 aEpisodeId)
+    {
+    MPX_FUNC("CMPXDbPodcast::EpisodeDurationL");
+    return ExecuteSumQueryL(KQueryPodcastEpisodeDuration, aEpisodeId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::AllEpisodesDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::AllEpisodesDurationL()
+    {
+    MPX_FUNC("CMPXDbPodcast::AllEpisodesDurationL");
+    return ExecuteSumQueryL(KQueryPodcastDurationAll);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::TitleDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::TitleDurationL(
+    TUint32 aTitleId)
+    {
+    MPX_FUNC("CMPXDbPodcast::TitleDurationL");
+    return ExecuteSumQueryL(KQueryPodcastDurationAlbum, aTitleId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::NotPlayedDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::NotPlayedDurationL()
+    {
+    MPX_FUNC("CMPXDbPodcast::NotPlayedDurationL");
+    return ExecuteSumQueryL(KQueryPodcastNotPlayedDuration);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::RecentlyAddedDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::RecentlyAddedDurationL()
+    {
+    MPX_FUNC("CMPXDbPodcast::RecentlyAddedDurationL");
+    return ExecuteSumQueryL(KQueryPodcastRecentlyAddedDuration);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the name of the episode matching the given ID
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbPodcast::GetNameL(
+    TUint32 aEpisodeId)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetNameL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastGetTitle,
+        aEpisodeId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    HBufC* name =  recordset.ColumnTextL(KMPXTableDefaultIndex).AllocL();
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return name;
+    }
+
+// ----------------------------------------------------------------------------
+// Get URI of the episode
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbPodcast::GetUriL(
+    TUint32 aEpisodeId)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetUriL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastGetEpisodeNoCat,
+        aEpisodeId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    HBufC* uri = ConstructUriL(recordset);
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return uri;
+    }
+
+// ----------------------------------------------------------------------------
+// Find the drive Ids of corresponding unique Episode Id
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::GetDriveL(
+    TUint32 aEpisodeId)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetDriveL");
+    return MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+        ExecuteIntQueryL(KQueryPodcastVolume, aEpisodeId));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::GetEpisodeL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetEpisodeL(
+    TUint32 aEpisodeId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetEpisodeL");
+    ExecuteMediaQueryL(aAttrs, aMedia, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastGetEpisode() : KQueryPodcastGetEpisodeNoCat(), aEpisodeId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::GetAllEpisodesL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetAllEpisodesL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetAllEpisodesL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastGetAllEpisodes() : KQueryPodcastGetAllEpisodesNoCat());
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::GetEpisodesForCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetEpisodesForCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    TBool aOrder )
+    {
+    MPX_FUNC("CMPXDbPodcast::GetEpisodesForCategoryL");
+    TPtrC ptr(MPXDbUtil::PodcastFieldNameForCategoryL(aCategory));
+
+    if( aOrder )
+        {
+        ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryPodcastCategoryOrdered, ptr, aCategoryId);
+        }
+    else
+        {
+        ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryPodcastCategory, ptr, aCategoryId);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve the episode(s) with the specified title
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetEpisodesMatchingTitleL(
+    TUint aTitleId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetEpisodesMatchingTitleL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastGetEpisodesForAlbum() : KQueryPodcastGetEpisodesForAlbumNoCat(),
+        aTitleId);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all podcast episodes from the podcast table that have not been played
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetNotYetPlayedPlaylistEpisodesL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    TInt& aIndexOfCurrentlyPlayingItem)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetNotYetPlayedPlaylistEpisodesL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastNotPlayed() : KQueryPodcastNotPlayedNoCat());
+
+    aIndexOfCurrentlyPlayingItem = GetPlayingItemL(aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all podcast episodes from the podcast table were added within the last 7 days
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetRecentlyAddedPlaylistEpisodesL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    TInt& aIndexOfCurrentlyPlayingItem)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetRecentlyAddedPlaylistEpisodesL");
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastRecentlyAdded() : KQueryPodcastRecentlyAddedNoCat());
+
+    aIndexOfCurrentlyPlayingItem = GetPlayingItemL(aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all episodes from the podcast table that are published today
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetTodayEpisodesL(
+    const TMPXItemId& aPublishDateCategoryId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetTodayEpisodesL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastToday() : KQueryPodcastTodayNoCat(), *now, *now);
+    CleanupStack::PopAndDestroy(now);
+
+    ProcessPublishDateCategoryL(aPublishDateCategoryId, aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all episodes from the podcast table that are published yesterday
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetYesterdayEpisodesL(
+    const TMPXItemId& aPublishDateCategoryId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetYesterdayEpisodesL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastYesterday() : KQueryPodcastYesterdayNoCat(), *now, *now);
+    CleanupStack::PopAndDestroy(now);
+
+    ProcessPublishDateCategoryL(aPublishDateCategoryId, aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all episodes from the podcast table that are published this weeks
+// This doesn't include Today or Yesterday's episodes
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetThisWeekEpisodesL(
+    const TMPXItemId& aPublishDateCategoryId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetThisWeekEpisodesL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastBetween() : KQueryPodcastBetweenNoCat(),
+        *now, dayNo, *now, 1);
+    CleanupStack::PopAndDestroy(now);
+
+    ProcessPublishDateCategoryL(aPublishDateCategoryId, aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all episodes from the podcast table that are published last weeks
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetLastWeekEpisodesL(
+    const TMPXItemId& aPublishDateCategoryId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetLastWeekEpisodesL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastBetween() : KQueryPodcastBetweenNoCat(),
+        *now, dayNo + 7, *now, dayNo);
+    CleanupStack::PopAndDestroy(now);
+
+    ProcessPublishDateCategoryL(aPublishDateCategoryId, aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all episodes from the podcast table that are published 2 weeks ago
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::Get2WeeksAgoEpisodesL(
+    const TMPXItemId& aPublishDateCategoryId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::Get2WeeksAgoEpisodesL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastBetween() : KQueryPodcastBetweenNoCat(),
+        *now, dayNo + 14, *now, dayNo + 7);
+
+    CleanupStack::PopAndDestroy(now);
+    ProcessPublishDateCategoryL(aPublishDateCategoryId, aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all episodes from the podcast table that are published 3 weeks ago
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::Get3WeeksAgoEpisodesL(
+    const TMPXItemId& aPublishDateCategoryId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::Get3WeeksAgoEpisodesL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastBetween() : KQueryPodcastBetweenNoCat(),
+        *now, dayNo + 21, *now, dayNo + 14);
+    CleanupStack::PopAndDestroy(now);
+
+    ProcessPublishDateCategoryL(aPublishDateCategoryId, aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all episodes from the podcast table that are published last month
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetLastMonthEpisodesL(
+    const TMPXItemId& aPublishDateCategoryId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetLastMonthEpisodesL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastLastMonth() : KQueryPodcastLastMonthNoCat(), *now, *now);
+    CleanupStack::PopAndDestroy(now);
+
+    ProcessPublishDateCategoryL(aPublishDateCategoryId, aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all episodes from the podcast table that are published earlier
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetEarlierEpisodesL(
+    const TMPXItemId& aPublishDateCategoryId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetEarlierEpisodesL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastEarlier() : KQueryPodcastEarlierNoCat(), *now);
+    CleanupStack::PopAndDestroy(now);
+
+    ProcessPublishDateCategoryL(aPublishDateCategoryId, aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all episodes from the podcast table that are published on unknown date
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetUnknownEpisodesL(
+    const TMPXItemId& aPublishDateCategoryId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetUnknownEpisodesL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    ExecuteMediaQueryL(aAttrs, aMediaArray, ExtraFieldsRequired(aAttrs) ?
+        KQueryPodcastUnknown() : KQueryPodcastUnknownNoCat(), *now);
+    CleanupStack::PopAndDestroy(now);
+
+    ProcessPublishDateCategoryL(aPublishDateCategoryId, aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Count the total number of items
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::CountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::CountL");
+    return ExecuteSumQueryL(KQueryPodcastCount);
+    }
+
+// ----------------------------------------------------------------------------
+// Get number of episodes from the podcast table that are published today
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::GetTodayEpisodesCountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::GetTodayEpisodesCountL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    TInt count = ExecuteSumQueryL(KQueryPodcastTodayCount, *now, *now);
+    CleanupStack::PopAndDestroy(now);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Get number of episodes from the podcast table that are published yesterday
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::GetYesterdayEpisodesCountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::GetYesterdayEpisodesCountL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    TInt count = ExecuteSumQueryL(KQueryPodcastYesterdayCount, *now, *now);
+    CleanupStack::PopAndDestroy(now);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Get number of episodes from the podcast table that are published this weeks
+// This doesn't include Today or Yesterday's episodes
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::GetThisWeekEpisodesCountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::GetThisWeekEpisodesCountL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    TInt count = ExecuteSumQueryL(KQueryPodcastBetweenCount, *now, dayNo, *now, 1);
+    CleanupStack::PopAndDestroy(now);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Get number of episodes from the podcast table that are published last weeks
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::GetLastWeekEpisodesCountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::GetLastWeekEpisodesCountL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    TInt count = ExecuteSumQueryL(KQueryPodcastBetweenCount, *now, dayNo + 7, *now, dayNo);
+    CleanupStack::PopAndDestroy(now);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Get number of episodes from the podcast table that are published 2 weeks ago
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::Get2WeeksAgoEpisodesCountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::Get2WeeksAgoEpisodesCountL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    TInt count = ExecuteSumQueryL(KQueryPodcastBetweenCount, *now, dayNo + 14, *now, dayNo + 7);
+    CleanupStack::PopAndDestroy(now);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Get number of episodes from the podcast table that are published 3 weeks ago
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::Get3WeeksAgoEpisodesCountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::Get3WeeksAgoEpisodesCountL");
+
+    TInt dayNo(MPXDbUtil::DayNoInWeek());
+    dayNo++; // shifted by 1 day to get correct results
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    TInt count = ExecuteSumQueryL(KQueryPodcastBetweenCount, *now, dayNo + 21, *now, dayNo + 14);
+    CleanupStack::PopAndDestroy(now);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Get number of episodes from the podcast table that are published last month
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::GetLastMonthEpisodesCountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::GetLastMonthEpisodesCountL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    TInt count = ExecuteSumQueryL(KQueryPodcastLastMonthCount, *now, *now);
+    CleanupStack::PopAndDestroy(now);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Get number of episodes from the podcast table that are published earlier
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::GetEarlierEpisodesCountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::GetEarlierEpisodesCountL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    TInt count = ExecuteSumQueryL(KQueryPodcastEarlierCount, *now);
+    CleanupStack::PopAndDestroy(now);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Get number of episodes from the podcast table that are published on unknown date
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::GetUnknownEpisodesCountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::GetUnknownEpisodesCountL");
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+    TInt count = ExecuteSumQueryL(KQueryPodcastUnknownCount, *now);
+    CleanupStack::PopAndDestroy(now);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Count the number of episodes recently added
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::GetRecentlyAddedEpisodesCountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::GetRecentlyAddedEpisodesCountL");
+    return ExecuteSumQueryL(KQueryPodcastRecentlyAddedCount);
+    }
+
+// ----------------------------------------------------------------------------
+// Get count of all podcast episodes from the Podcast table that have not been played
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::GetNotYetPlayedEpisodesCountL()
+    {
+    MPX_FUNC("CMPXDbPodcast::GetNotYetPlayedPlaylistEpisodes");
+    return ExecuteSumQueryL(KQueryPodcastNotPlayedCount);
+    }
+
+// ----------------------------------------------------------------------------
+// Get episode(s) from the podcast table that match the given criteria
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::FindEpisodesL(
+    TUint32 aGeneralId,
+    TUint32 aContainerId,
+    TMPXGeneralType aType,
+    TMPXPodcastType aPodcastType,
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::FindEpisodesL");
+
+    // set up the selection criteria
+    HBufC* criteriaStr = GeneratePodcastMatchingCriteriaLC(aGeneralId, aContainerId,
+        aType, aPodcastType, aCriteria);
+
+    // iterate the results and append media objects to the destination array
+    ExecuteMediaQueryL(aAttrs, aMediaArray, KQueryPodcastFindAll, *criteriaStr);
+
+    CleanupStack::PopAndDestroy(criteriaStr);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::SetIsPlayingL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::SetIsPlayingL(
+    TUint32 aEpisodeId,
+    TBool aIsPlaying)
+    {
+    MPX_FUNC("CMPXDbPodcast::SetIsPlayingL");
+    TInt drive(GetDriveL(aEpisodeId));
+    iDbManager.ExecuteQueryL(drive, KQueryPodcastSetIsPlaying, aIsPlaying, aEpisodeId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::GetDrivePodcastCountL
+// ----------------------------------------------------------------------------
+//
+TUint CMPXDbPodcast::GetDrivePodcastCountL(TInt aDrive)
+    {
+    TUint count(0);
+
+    //podcast
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,KQueryPodcastCount));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrCorrupt);
+        }
+
+    count = TUint(recordset.ColumnInt64(KMPXTableDefaultIndex));
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::GetPodcastUriArrayL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::GetPodcastUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                        CDesCArray& aUriArr, TInt& aLastID)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetPodcastUriArrayL");
+
+    HBufC* query = NULL;
+    if(aFromID == 0)
+        {
+        query = HBufC::NewLC(KQueryPodcastGetUris().Length()
+                            + KMCIntegerLen);
+        query->Des().Format(KQueryPodcastGetUris, aRecords);
+        }
+    else
+        {
+        query = HBufC::NewLC(KQueryPodcastGetUrisFrom().Length()
+                            + 2*KMCIntegerLen);
+        query->Des().Format(KQueryPodcastGetUrisFrom, aFromID, aRecords);
+        }
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(aDrive,*query));
+
+    CleanupStack::PopAndDestroy(query);
+
+    CleanupClosePushL(recordset);
+
+    TInt lastID = 0;
+    TInt err(KErrNone);
+    while((err = recordset.Next()) == KSqlAtRow)
+        {
+        HBufC* fullPath = MPXDbCommonUtil::CreateFullPathL(aDrive,
+                MPXDbCommonUtil::GetColumnTextL(recordset, KColUri));
+        CleanupStack::PushL(fullPath);
+        aUriArr.AppendL(*fullPath);
+        CleanupStack::PopAndDestroy(fullPath);
+
+        lastID = recordset.ColumnInt(KColUniqueID);
+        }
+    CleanupStack::PopAndDestroy(&recordset);
+
+    aLastID = lastID;
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::DoAddEpisodeL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPodcast::DoAddEpisodeL(
+    TUint32 aEpisodeId,
+    const CMPXMedia& aMedia,
+    TInt aDrive,
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::DoAddEpisodeL");
+
+    CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EPodcastFieldCount);
+    CleanupStack::PushL(fields);
+    CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EPodcastFieldCount);
+    CleanupStack::PushL(values);
+
+    // add known fields
+    MPXDbCommonUtil::AppendValueL(*fields, *values, KMCPodcastUniqueId, aEpisodeId);
+    MPXDbCommonUtil::AppendValueL(*fields, *values, KMCPodcastDel, 0);
+
+    HBufC* date = MPXDbCommonUtil::CurrentDateDesLC();
+    MPXDbCommonUtil::AppendValueL(*fields, *values, KMCPodcastTimeAdded, *date);
+    CleanupStack::PopAndDestroy(date);
+
+    // process the media parameter and construct the fields and values array
+    TBool visible(GeneratePodcastFieldsValuesL(aEpisodeId, aMedia, aItemChangedMessages,
+        NULL, *fields, *values, aDrive));
+
+    // create the fields and values strings
+    HBufC* fieldStr = MPXDbCommonUtil::StringFromArrayLC(*fields, KMCCommaSign);
+    HBufC* valueStr = MPXDbCommonUtil::StringFromArrayLC(*values, KMCCommaSign);
+
+    // execute the query
+    iDbManager.ExecuteQueryL(aDrive, KQueryPodcastInsert, fieldStr, valueStr);
+
+    CleanupStack::PopAndDestroy(valueStr);
+    CleanupStack::PopAndDestroy(fieldStr);
+    CleanupStack::PopAndDestroy(values);
+    CleanupStack::PopAndDestroy(fields);
+
+    return visible;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::DoUpdateEpisodeL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbPodcast::DoUpdateEpisodeL(
+    TUint32 aEpisodeId,
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXDbPodcast::DoUpdateEpisodeL");
+
+    // retrieve the existing record
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastGetEpisode, aEpisodeId));
+    CleanupClosePushL(recordset);
+
+    if (recordset.Next() != KSqlAtRow)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    TDriveUnit driveUnit(MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+        recordset.ColumnInt64(EPodcastVolumeId)));
+    CMPXDbActiveTask::TChangeVisibility visible(DoUpdateEpisodeL(aEpisodeId, aMedia, driveUnit, aItemChangedMessages,
+        recordset));
+
+    CleanupStack::PopAndDestroy(&recordset);
+
+    return visible;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::DoUpdateEpisodeL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbPodcast::DoUpdateEpisodeL(
+    TUint32 aEpisodeId,
+    const CMPXMedia& aMedia,
+    TInt aDrive,
+    CMPXMessageArray* aItemChangedMessages,
+    RSqlStatement& aRecordset)
+    {
+    MPX_FUNC("CMPXDbPodcast::DoUpdateEpisodeL");
+
+    CDesCArrayFlat* fields = new (ELeave) CDesCArrayFlat(EPodcastFieldCount);
+    CleanupStack::PushL(fields);
+    CDesCArrayFlat* values = new (ELeave) CDesCArrayFlat(EPodcastFieldCount);
+    CleanupStack::PushL(values);
+
+    // process the media parameter and construct the fields and values array
+    CMPXDbActiveTask::TChangeVisibility visible(GeneratePodcastFieldsValuesL(aEpisodeId, aMedia, aItemChangedMessages,
+        &aRecordset, *fields, *values, aDrive));
+
+    // construct the SET string
+    HBufC* setStr = MPXDbCommonUtil::StringFromArraysLC(*fields, *values,
+        KMCEqualSign, KMCCommaSign);
+    if (setStr->Length())
+        {
+        // execute the query
+        iDbManager.ExecuteQueryL(aDrive, KQueryPodcastUpdate, setStr, aEpisodeId);
+        }
+
+    CleanupStack::PopAndDestroy(setStr);
+    CleanupStack::PopAndDestroy(values);
+    CleanupStack::PopAndDestroy(fields);
+
+    return visible;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::DeleteRecordsetL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DeleteRecordsetL(
+    RSqlStatement& aRecordset,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages,
+    TBool aDeleteRecord /* = EFalse */)
+    {
+    MPX_FUNC("CMPXDbPodcast::DeleteRecordsetL");
+
+    TInt err(KErrNone);
+    while ((err = aRecordset.Next()) == KSqlAtRow)
+        {
+        DoDeleteEpisodeL(aRecordset, aUriArray, aItemChangedMessages, aDeleteRecord);
+        }
+
+    if (err!= KSqlAtEnd)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a episode from the podcast table
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DoDeleteEpisodeL(
+    RSqlStatement& aRecordset,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages,
+    TBool aDeleteRecord)
+    {
+    MPX_FUNC("CMPXDbPodcast::DoDeleteEpisodeL");
+
+    // add the full path to the URI array
+    HBufC* uri = ConstructUriL(aRecordset);
+    CleanupStack::PushL(uri);
+    aUriArray.AppendL(*uri);
+    TDriveUnit driveUnit(*uri);
+    CleanupStack::PopAndDestroy(uri);
+
+    // process the author
+    iObserver.DeleteEpisodeForCategoryL(EMPXArtist, aRecordset.ColumnInt64(EPodcastArtist),
+        driveUnit, &aItemChangedMessages);
+
+    // process the title
+    iObserver.DeleteEpisodeForCategoryL(EMPXAlbum, aRecordset.ColumnInt64(EPodcastAlbum),
+        driveUnit, &aItemChangedMessages);
+
+    // process the genre
+    iObserver.DeleteEpisodeForCategoryL(EMPXGenre, aRecordset.ColumnInt64(EPodcastGenre),
+        driveUnit, &aItemChangedMessages);
+
+    // process the composer
+    iObserver.DeleteEpisodeForCategoryL(EMPXComposer, aRecordset.ColumnInt64(EPodcastComposer),
+        driveUnit, &aItemChangedMessages);
+
+    // add a change event for removing the episode itself
+    TUint32 episodeId(aRecordset.ColumnInt64(EPodcastUniqueId));
+    MPXDbCommonUtil::AddItemChangedMessageL(aItemChangedMessages, episodeId,
+        EMPXItemDeleted, EMPXPodcast, KDBPluginUid);
+
+    // delete or update the episode
+    iDbManager.ExecuteQueryL(driveUnit, aDeleteRecord ? KQueryPodcastDelete() :
+        KQueryPodcastDeleteUpdate(), episodeId);
+
+    MPX_DEBUG2(_L("CMPXDbPodcast::RemoveEpisodeL Removed episodeId[0x%x]"), episodeId);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::GeneratePodcastFieldsValuesL
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXDbPodcast::GeneratePodcastFieldsValuesL(
+    TUint32 aEpisodeId,
+    const CMPXMedia& aMedia,
+    CMPXMessageArray* aItemChangedMessages,
+    RSqlStatement* aPodcastTable,
+    CDesCArray& aFields,
+    CDesCArray& aValues,
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXDbMusic::GeneratePodcastFieldsValuesL");
+
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+    TBool metaDataModified(EFalse);
+    const TArray<TMPXAttribute> attributes = aMedia.Attributes();
+
+    CMPXMessage* episodeChangedMessage(NULL);
+    if (aItemChangedMessages)
+        {
+        episodeChangedMessage = CMPXMedia::NewL();
+        CleanupStack::PushL(episodeChangedMessage);
+        MPXDbCommonUtil::FillItemChangedMessageL(*episodeChangedMessage, aEpisodeId,
+            aPodcastTable ? EMPXItemModified : EMPXItemInserted, EMPXPodcast, KDBPluginUid);
+        }
+
+    TInt attrCount(attributes.Count());
+    for (TInt i = 0; i < attrCount; ++i)
+        {
+        TInt contentId(attributes[i].ContentId());
+        TUint attributeId(attributes[i].AttributeId());
+
+        switch (contentId)
+            {
+            case KMPXMediaIdGeneral:
+                {
+                if (attributeId & EMPXMediaGeneralTitle)
+                    {
+                    TBool titleChanged(NULL == aPodcastTable);
+
+                    const TDesC& title = aMedia.ValueText(KMPXMediaGeneralTitle);
+                    TPtrC truncatedTitle(title.Left(KMCMaxTextLen));
+                    if (aPodcastTable)
+                        {
+                        // title of the song has been changed
+                        if (truncatedTitle.Compare(aPodcastTable->ColumnTextL(EPodcastTitle)) != 0)
+                            {
+                            titleChanged = ETrue;
+                            }
+                        }
+
+                    if (titleChanged)
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastName, truncatedTitle);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        metaDataModified = ETrue;
+
+                        MPX_DEBUG2("    Title[%S]", &truncatedTitle);
+                        }
+                    }
+
+                if (attributeId & EMPXMediaGeneralUri)
+                    {
+                    const TDesC& uri = aMedia.ValueText(KMPXMediaGeneralUri);
+                    const TDesC& uriTrunc(uri.Mid(KMCPathStartPos));
+
+                    TDriveUnit driveUnit(uri);
+                    TUint volId(MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit));
+
+                    if (!aPodcastTable || ((uriTrunc != aPodcastTable->ColumnTextL(EPodcastLocation)) ||
+                        (volId != aPodcastTable->ColumnInt64(EPodcastVolumeId))))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastVolumeId, volId);
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastLocation, uri.Mid(KMCPathStartPos));
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastDRM, DRMTypeL(uri));
+
+                        const TDesC& mimeTypeText = MPXDbCommonUtil::GetMimeTypeForUriL(uri).Des();
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastMimeType, mimeTypeText);
+
+                        MPX_DEBUG3("    VolumeId[%u] Location[%S]", volId, &uri);
+                        MPX_DEBUG2("    MimeType[%S]", &mimeTypeText);
+
+                        if (!aPodcastTable && !aMedia.IsSupported(KMPXMediaGeneralTitle))
+                            {
+                            TParsePtrC parser(uri);
+                            TPtrC title = parser.Name();
+                            // use file name as song name
+                            MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastName, title.Left(KMCMaxTextLen));
+                            visibleChange = CMPXDbActiveTask::EAllVisible;
+
+                            MPX_DEBUG2("    Title[%S]", &title);
+                            }
+
+                        // URI of the song has been changed. This changes the Id of the song
+                        if (aPodcastTable)
+                            {
+                            TUint32 newEpisodeId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), EMPXCollection, uri, EFalse);
+                            if (aEpisodeId != newEpisodeId)
+                                {
+                                MPX_DEBUG3("    CurrentEpisodeId[0x%x] changed to [0x%x]", aEpisodeId, newEpisodeId);
+
+                                if (episodeChangedMessage)
+                                    {
+                                    episodeChangedMessage->SetTObjectValueL<TMPXItemId>(KMPXMessageMediaGeneralId, newEpisodeId);
+                                    episodeChangedMessage->SetTObjectValueL<TMPXItemId>(KMPXMessageMediaDeprecatedId, aEpisodeId);
+                                    }
+
+                                MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastUniqueId, newEpisodeId);
+                                }
+                            }
+                        }
+                    }
+
+                if (attributeId & EMPXMediaGeneralComment)
+                    {
+                    const TDesC& comment = aMedia.ValueText(KMPXMediaGeneralComment).Left(KMCMaxTextLen);
+
+                    if (!aPodcastTable || (comment != aPodcastTable->ColumnTextL(EPodcastComment)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastComment, comment);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Comment[%S]", &comment);
+                    }
+
+                if (attributeId & EMPXMediaGeneralSynchronized)
+                    {
+                    TBool synced(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized));
+                    if (!aPodcastTable || (synced != aPodcastTable->ColumnInt(EPodcastSync)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastSync, synced);
+                        }
+                    MPX_DEBUG2("    Synchronized[%d]", synced);
+                    }
+
+                if (attributeId & EMPXMediaGeneralDeleted)
+                    {
+                    TBool deleted(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralDeleted));
+                    if (!aPodcastTable || (deleted != aPodcastTable->ColumnInt(EPodcastDeleted)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastDel, deleted);
+                        }
+                    MPX_DEBUG2("    Deleted[%d]", deleted);
+                    }
+
+                if (attributeId & EMPXMediaGeneralModified)
+                    {
+                    TBool modified(aMedia.ValueTObjectL<TBool>(KMPXMediaGeneralModified));
+                    if (!aPodcastTable || (modified != aPodcastTable->ColumnInt(EPodcastModified)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastMod, modified);
+                        }
+                    MPX_DEBUG2("    Modified[%d]", modified);
+                    }
+
+                if (attributeId & EMPXMediaGeneralCopyright)
+                    {
+                    const TDesC& copyright = aMedia.ValueText(KMPXMediaGeneralCopyright).Left(KMCMaxTextLen);
+                    if (!aPodcastTable || (copyright != aPodcastTable->ColumnTextL(EPodcastCopyright)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastCopyright, copyright);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Copyright[%S]", &copyright);
+                    }
+
+                if (attributeId & EMPXMediaGeneralDuration)
+                    {
+                    TInt duration(aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralDuration));
+                    if (!aPodcastTable || (duration != aPodcastTable->ColumnInt(EPodcastDuration)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastDuration, duration);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Duration[%d]", duration);
+                    }
+
+                if (attributeId & EMPXMediaGeneralFlags)
+                    {
+                    TUint flag(aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags));
+                    TUint32 curFlag(0);
+                    if (aPodcastTable)
+                        {
+                        curFlag = aPodcastTable->ColumnInt64(EPodcastDbFlag);
+                        }
+                    TUint32 oldFlag(curFlag);
+
+                    if (flag & KMPXMediaGeneralFlagsSetOrUnsetBit)
+                        {
+                        // Set bits
+                        curFlag |= flag;
+                        }
+                    else
+                        {
+                        // Clear bits
+                        curFlag &= (~flag);
+                        }
+
+                    // The field is written ONLY if the flag value is changing
+                    if (((curFlag ^ oldFlag) & 0x7FFFFFFF) != 0)
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastDbFlag, curFlag);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        }
+                     MPX_DEBUG2("    GeneralFlags[%b]", curFlag);
+                    }
+
+                if (attributeId & EMPXMediaGeneralPlayCount)
+                    {
+                    TInt increment(aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralPlayCount));
+                    TUint32 curCount(increment);
+
+                    // Only add to the current number if the value received is positive
+                    // otherwise reset
+                    if (curCount && aPodcastTable)
+                        {
+                        curCount += aPodcastTable->ColumnInt(EPodcastPlayCount);
+                        }
+
+                    if (!aPodcastTable || (curCount != aPodcastTable->ColumnInt(EPodcastPlayCount)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastPlayCount, curCount);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        }
+                    MPX_DEBUG2("    PlayCount[%d]", curCount);
+                    }
+
+                if (attributeId & EMPXMediaGeneralLastPlaybackPosition)
+                    {
+                    TInt32 lastPlayPosition(aMedia.ValueTObjectL<TInt32>(KMPXMediaGeneralLastPlaybackPosition));
+                    MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastIsPlaying, EFalse);
+
+                    if (!aPodcastTable || (lastPlayPosition != aPodcastTable->ColumnInt(EPodcastLastPlayPosition)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastLastPlayPosition, lastPlayPosition);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        }
+                    MPX_DEBUG2("    Last Playback Position[%d]", lastPlayPosition);
+                    }
+
+                if (attributeId & EMPXMediaGeneralLastPlaybackTime)
+                    {
+                    HBufC* time = MPXDbCommonUtil::TTimeToDesLC(
+                        TTime(aMedia.ValueTObjectL<TInt64>(KMPXMediaGeneralLastPlaybackTime)));
+                    if (!aPodcastTable || (*time != aPodcastTable->ColumnTextL(EPodcastTimePlayed)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastTimePlayed, *time);
+                        }
+                    MPX_DEBUG2("    PlaybackTime[%S]", time);
+                    CleanupStack::PopAndDestroy(time);
+                    }
+                }
+                break;
+
+            case KMPXMediaIdMusic:
+                {
+                if (attributeId & EMPXMediaMusicAlbumTrack)
+                    {
+                    const TDesC& trackNumber = aMedia.ValueText(KMPXMediaMusicAlbumTrack);
+
+                    // KMaxTInt is used to represent null album track
+                    TInt track(KMaxTInt);
+                    if (trackNumber.Length())
+                        {
+                        TLex stringParser(trackNumber);
+                        if (stringParser.Val(track) != KErrNone)
+                            {
+                            track = KMaxTInt;
+                            }
+                        }
+
+                    if (!aPodcastTable || (track != aPodcastTable->ColumnInt(EPodcastAlbumTrack)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastTrackNumber, track);
+                        visibleChange = CMPXDbActiveTask::EAllVisible;
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG3("    Album Track[%S][%d]", &trackNumber, track);
+                    }
+
+                if (attributeId & EMPXMediaMusicYear)
+                    {
+                    TInt64 int64(aMedia.ValueTObjectL<TInt64>(KMPXMediaMusicYear));
+
+                    TTime maxTime(0);
+                    maxTime += TTimeIntervalYears(9999);    // Limit years to 4 characters
+                    TTime time(int64);
+
+                    if (time > maxTime)
+                        {
+                        time = Time::NullTTime();
+                        }
+
+                    HBufC* timeStr = MPXDbCommonUtil::TTimeToDesLC(time);
+                    if (!aPodcastTable || (*timeStr != aPodcastTable->ColumnTextL(EPodcastReleaseDate)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastReleaseDate, *timeStr);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Music Year[%S]", timeStr);
+                    CleanupStack::PopAndDestroy(timeStr);
+                    }
+
+                if (attributeId & EMPXMediaMusicRating)
+                    {
+                    TInt rating(aMedia.ValueTObjectL<TInt>(KMPXMediaMusicRating));
+
+                    if (!aPodcastTable || (rating != aPodcastTable->ColumnInt(EPodcastRating)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastRating, rating);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Rating[%d]", rating);
+                    }
+
+                if (attributeId & EMPXMediaMusicAlbumArtFileName)
+                    {
+                    const TDesC& albumArtFilename(aMedia.ValueText(KMPXMediaMusicAlbumArtFileName).Left(KMCMaxTextLen));
+                    if (!aPodcastTable || (albumArtFilename != aPodcastTable->ColumnTextL(EPodcastArt)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastArt, albumArtFilename);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Album Art Filename[%S]", &albumArtFilename);
+                    }
+
+                if (attributeId & EMPXMediaMusicURL)
+                    {
+                    const TDesC& url(aMedia.ValueText(KMPXMediaMusicURL).Left(KMCMaxTextLen));
+                    if (!aPodcastTable || (url != aPodcastTable->ColumnTextL(EPodcastUrl)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastUrl, url);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Music URL[%S]", &url);
+                    }
+                }
+                break;
+
+            case KMPXMediaIdAudio:
+                {
+                if (attributeId & EMPXMediaAudioSamplerate)
+                    {
+                    TInt samplerate(aMedia.ValueTObjectL<TInt>(KMPXMediaAudioSamplerate));
+                    if (!aPodcastTable || (samplerate != aPodcastTable->ColumnInt(EPodcastSampleRate)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastSampleRate, samplerate);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Sample Rate[%d]", samplerate);
+                    }
+
+                if (attributeId & EMPXMediaAudioBitrate)
+                    {
+                    TInt bitrate(aMedia.ValueTObjectL<TInt>(KMPXMediaAudioBitrate));
+                    if (!aPodcastTable || (bitrate != aPodcastTable->ColumnInt(EPodcastBitRate)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastBitRate, bitrate);
+                        metaDataModified = ETrue;
+                        }
+                    MPX_DEBUG2("    Bitrate[%d]", bitrate);
+                    }
+
+                if (attributeId & EMPXMediaAudioNumberOfChannels)
+                    {
+                    TUint32 val = aMedia.ValueTObjectL<TUint32>(KMPXMediaAudioNumberOfChannels);
+                    if (!aPodcastTable || (val != aPodcastTable->ColumnInt(EPodcastNumChannels)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastNumChannels, val);
+                        }
+                    MPX_DEBUG2("    Num of Channels[%d]", val);
+                    }
+                }
+                break;
+
+            case KMPXMediaIdDrm:
+                {
+                if (attributeId & EMPXMediaDrmType)
+                    {
+                    TInt drmType(aMedia.ValueTObjectL<TInt>(KMPXMediaDrmType));
+                    if (!aPodcastTable || (drmType != aPodcastTable->ColumnInt(EPodcastDRM)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastDRM, drmType);
+                        }
+                    MPX_DEBUG2("    DRM type[%d]", drmType);
+                    }
+
+                if (attributeId & KMPXMediaDrmRightsStatus.iAttributeId)
+                    {
+                    if (aPodcastTable)
+                        {
+                        TMPXMediaDrmRightsStatus status =
+                                 aMedia.ValueTObjectL<TMPXMediaDrmRightsStatus>(KMPXMediaDrmRightsStatus);
+
+                        //.Set the db flag
+                        TUint32 curFlag(aPodcastTable->ColumnInt64(EPodcastDbFlag));
+
+                        if ((status != EMPXDrmRightsFull) && (status != EMPXDrmRightsRestricted))
+                            {
+                            // No rights
+                            curFlag |= KMPXMediaGeneralFlagsIsDrmLicenceInvalid;
+                            }
+                        else
+                            {
+                            // Rights valid
+                            curFlag &= (KMPXMediaGeneralFlagsIsDrmLicenceInvalid ^ 0xFFFFFFFF);
+                            }
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastDbFlag, curFlag);
+                        MPX_DEBUG2("    Rights Status[%d]", curFlag);
+                        }
+                    }
+
+                break;
+                }
+
+            case KMPXMediaIdPodcast:
+                {
+                if (attributeId & EMPXMediaPodcastPubDate)
+                    {
+                    HBufC* time = MPXDbCommonUtil::TTimeToDesLC(
+                        TTime(aMedia.ValueTObjectL<TInt64>(KMPXMediaPodcastPubDate)));
+                    if (!aPodcastTable || (*time != aPodcastTable->ColumnTextL(EPodcastPublishDate)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastPublishDate, *time);
+                        }
+                    MPX_DEBUG2("    PublishDate[%S]", time);
+                    CleanupStack::PopAndDestroy(time);
+                    }
+
+                if (attributeId & EMPXMediaPodcastIsPlaying)
+                    {
+                    TInt isPlaying = aMedia.ValueTObjectL<TBool>(KMPXMediaPodcastIsPlaying);
+                    if (!aPodcastTable || (isPlaying != aPodcastTable->ColumnInt(EPodcastIsPlaying)))
+                        {
+                        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastIsPlaying, isPlaying);
+                        }
+                    MPX_DEBUG2("    IsPlaying[%d]", isPlaying);
+                    }
+
+                break;
+                }
+
+            default:
+                break;
+            } // end switch
+        } // end for
+
+    // get the current author/album/genre/composer
+    // this is required because the recordset may be reused by the code below
+    TUint32 artistId(0);
+    TUint32 albumId(0);
+    TUint32 genreId(0);
+    TUint32 composerId(0);
+    if (aPodcastTable)
+        {
+        artistId = aPodcastTable->ColumnInt64(EPodcastArtist);
+        albumId = aPodcastTable->ColumnInt64(EPodcastAlbum);
+        genreId = aPodcastTable->ColumnInt64(EPodcastGenre);
+        composerId = aPodcastTable->ColumnInt64(EPodcastComposer);
+        }
+
+    // update the artist field
+    TUint32 id(0);
+    if (UpdateCategoryFieldL(EMPXArtist, aMedia, KMPXMediaMusicArtist, artistId,
+        aDrive, aItemChangedMessages, id))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastAuthor, id);
+        metaDataModified = (aPodcastTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        }
+
+    // update the album field
+    if (UpdateCategoryFieldL(EMPXAlbum, aMedia, KMPXMediaMusicAlbum, albumId,
+        aDrive, aItemChangedMessages, id))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastTitle, id);
+        metaDataModified = (aPodcastTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        }
+
+    // update the genre field
+    if (UpdateCategoryFieldL(EMPXGenre, aMedia, KMPXMediaMusicGenre, genreId,
+        aDrive, aItemChangedMessages, id))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastGenre, id);
+        metaDataModified = (aPodcastTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        }
+
+    // update the composer field
+    if (UpdateCategoryFieldL(EMPXComposer, aMedia, KMPXMediaMusicComposer, composerId,
+        aDrive, aItemChangedMessages, id))
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastComposer, id);
+        metaDataModified = (aPodcastTable != NULL);
+        visibleChange = CMPXDbActiveTask::EAllVisible;
+        }
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+    // Set Mod bit to ETrue if metadata has been updated and caller hasn't explicitly
+    // set/reset it
+    if (aPodcastTable &&
+        !aMedia.IsSupported(KMPXMediaGeneralModified) &&
+        metaDataModified)
+        {
+        MPXDbCommonUtil::AppendValueL(aFields, aValues, KMCPodcastMod, 1);
+        MPX_DEBUG1("    Modified[1]");
+        }
+#endif
+
+    if (aItemChangedMessages)
+        {
+        if (aFields.Count())
+        	{
+        	aItemChangedMessages->AppendL(*episodeChangedMessage);
+        	}
+        CleanupStack::PopAndDestroy(episodeChangedMessage);
+        }
+
+    return visibleChange;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbMusic::UpdateCategoryFieldL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPodcast::UpdateCategoryFieldL(
+    TMPXGeneralCategory aCategory,
+    const CMPXMedia& aMedia,
+    const TMPXAttribute& aAttribute,
+    TUint32 aOldId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages,
+    TUint32& aItemId)
+    {
+    MPX_FUNC("CMPXDbPodcast::UpdateCategoryFieldL");
+
+    TBool updated(EFalse);
+
+    // update category table and add category Id to the podcast table
+    if (!aOldId || aMedia.IsSupported(aAttribute))
+        {
+        if (aMedia.IsSupported(aAttribute))
+            {
+            HBufC* name = aMedia.ValueText(aAttribute).AllocLC();
+            name->Des().Trim();
+
+            // only genre is not case sensitive
+            aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, name->Left(KMCMaxTextLen),
+                (aCategory != EMPXGenre));
+            if (!aOldId || (aOldId != aItemId))
+                {
+                // only add if the ID changed,
+                // otherwise the song was updated but the artist name was not
+
+                // ignore the return value
+                iObserver.AddCategoryItemL(aCategory, name->Left(KMCMaxTextLen), aDriveId,
+                    aItemChangedMessages);
+                updated = ETrue;
+                }
+
+            CleanupStack::PopAndDestroy(name);
+            }
+        else
+            {
+            // only genre is not case sensitive
+            aItemId = MPXDbCommonUtil::GenerateUniqueIdL(iDbManager.Fs(), aCategory, KNullDesC,
+                (aCategory != EMPXGenre));
+            if (!aOldId || (aOldId != aItemId))
+                {
+                // ignore the return value
+                iObserver.AddCategoryItemL(aCategory, KNullDesC, aDriveId, aItemChangedMessages);
+                updated = ETrue;
+                }
+            }
+
+        if (aOldId && (aOldId != aItemId))
+            {
+            iObserver.DeleteEpisodeForCategoryL(aCategory, aOldId, aDriveId, aItemChangedMessages);
+            updated = ETrue;
+            }
+        }
+
+    return updated;
+    }
+
+// ----------------------------------------------------------------------------
+// Read episode detail info from DB into media object
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::UpdateMediaL(
+    RSqlStatement& aPodcastTable,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPodcast::UpdateMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        switch (aAttrs[i].ContentId())
+            {
+            case KMPXMediaIdGeneral:
+                {
+                UpdateMediaGeneralL(aPodcastTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            case KMPXMediaIdMusic:
+                {
+                UpdateMediaMusicL(aPodcastTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            case KMPXMediaIdDrm:
+                {
+                // DRM is set by drm helper
+                break;
+                }
+            case KMPXMediaIdAudio:
+                {
+                UpdateMediaAudioL(aPodcastTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            case KMPXMediaIdPodcast:
+                {
+                UpdateMediaPodcastL(aPodcastTable, aAttrs[i].AttributeId(), aMedia);
+                break;
+                }
+            default:
+                // Do not leave. If this plugin doesn't support
+                // the content id they want, just return what we have
+                break;
+            } // end switch
+        } // end for
+    }
+
+// ----------------------------------------------------------------------------
+// Set all the attributes in CMPXMedia corresponding to KMPXMediaIdGeneral
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::UpdateMediaGeneralL(
+    RSqlStatement& aPodcastTable,
+    TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPodcast::UpdateMediaGeneralL");
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXItem);
+    aMedia.SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory, EMPXPodcast);
+
+    // FIX ME, temporary always fetch item ID
+    //if (aAttrId & EMPXMediaGeneralId)
+    if (!aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        TUint32 episodeId(aPodcastTable.ColumnInt64(EPodcastUniqueId));
+        aMedia.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, episodeId);
+        MPX_DEBUG2("    EpisodeId[%d]", episodeId);
+        }
+    // FIX ME temporary always fetch URI
+    //if (aAttrId & EMPXMediaGeneralUri)
+    if (!aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        HBufC* uri = ConstructUriL(aPodcastTable);
+        CleanupStack::PushL(uri);
+        aMedia.SetTextValueL(KMPXMediaGeneralUri, *uri);
+
+        MPX_DEBUG2("    Uri[%S]", uri);
+        CleanupStack::PopAndDestroy(uri);
+        }
+    if (aAttrId & EMPXMediaGeneralDrive)
+        {
+        TDriveUnit driveUnit;
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            driveUnit = aMedia.ValueText(KMPXMediaGeneralUri);
+            }
+        else
+            {
+            driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+                aPodcastTable.ColumnInt64(EPodcastVolumeId));
+            }
+
+        TPtrC driveName(driveUnit.Name());
+        aMedia.SetTextValueL(KMPXMediaGeneralDrive, driveName);
+        MPX_DEBUG2("    Drive[%S]", &driveName);
+        }
+    if (aAttrId & EMPXMediaGeneralSize)
+        {
+        // to-do: store this in the DB
+        HBufC* uri = ConstructUriL(aPodcastTable);
+        CleanupStack::PushL(uri);
+        aMedia.SetTextValueL(KMPXMediaGeneralUri, *uri);
+
+        MPX_DEBUG2("    Uri[%S]", uri);
+        
+        TEntry entry;
+        RFs fs;
+        User::LeaveIfError(fs.Connect());
+        CleanupClosePushL(fs);
+        fs.Entry(*uri, entry);
+        aMedia.SetTObjectValueL<TInt>(
+               TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralSize),
+               entry.iSize);   
+        
+        MPX_DEBUG2("    Size[%d]", entry.iSize);
+        
+        CleanupStack::PopAndDestroy(&fs);
+        CleanupStack::PopAndDestroy(uri);
+        }
+    if (aAttrId & EMPXMediaGeneralDuration)
+        {
+        TInt32 duration(aPodcastTable.ColumnInt(EPodcastDuration));
+        aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+        MPX_DEBUG2("    Duration[%d]", duration);
+        }
+    if ((aAttrId & EMPXMediaGeneralTitle) && !aMedia.IsSupported(KMPXMediaGeneralTitle))
+        {
+        TPtrC title(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastTitle));
+        aMedia.SetTextValueL(KMPXMediaGeneralTitle, title);
+        MPX_DEBUG2("    Title[%S]", &title);
+        }
+    if (aAttrId & EMPXMediaGeneralDate)
+        {
+        const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastTimeAdded));
+        if(dateStr.Compare(KNullDesC) != 0)
+        	{
+            TTime dateTime(MPXDbCommonUtil::DesToTTimeL(dateStr));
+            aMedia.SetTObjectValueL<TInt64>(KMPXMediaGeneralDate, dateTime.Int64());
+        	}
+        MPX_DEBUG2("    Date[%S]", &dateStr);
+        }
+    if (aAttrId & EMPXMediaGeneralComment)
+        {
+        TPtrC comment(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastComment));
+        aMedia.SetTextValueL(KMPXMediaGeneralComment, comment);
+        MPX_DEBUG2("    Comment[%S]", &comment);
+        }
+    if (aAttrId & EMPXMediaGeneralMimeType)
+        {
+        TPtrC mimeType(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastMimeType));
+        aMedia.SetTextValueL(KMPXMediaGeneralMimeType, mimeType);
+        MPX_DEBUG2("    MimeType[%S]", &mimeType);
+        }
+    if (aAttrId & EMPXMediaGeneralSynchronized)
+        {
+        TInt sync(aPodcastTable.ColumnInt(EPodcastSync));
+        aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralSynchronized, sync);
+        MPX_DEBUG2("    Synchronized[%d]", sync);
+        }
+    if (aAttrId & EMPXMediaGeneralDeleted)
+        {
+        TInt del(aPodcastTable.ColumnInt(EPodcastDeleted));
+        aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralDeleted, del);
+        MPX_DEBUG2("    Deleted[%d]", del);
+        }
+    if (aAttrId & EMPXMediaGeneralModified)
+        {
+        TInt mod(aPodcastTable.ColumnInt(EPodcastModified));
+        aMedia.SetTObjectValueL<TBool>(KMPXMediaGeneralModified, mod);
+        MPX_DEBUG2("    Modified[%d]", mod);
+        }
+    if (aAttrId & EMPXMediaGeneralCount)
+        {
+        aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, 1);
+        }
+    if (aAttrId & EMPXMediaGeneralCollectionId)
+        {
+        aMedia.SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId ,
+            TUid::Uid(KDBPluginUid));
+        }
+    if (aAttrId & EMPXMediaGeneralCopyright)
+        {
+        TPtrC copyright(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastCopyright));
+        aMedia.SetTextValueL(KMPXMediaGeneralCopyright, copyright);
+        MPX_DEBUG2("    Copyright[%S]", &copyright);
+        }
+    if (aAttrId & EMPXMediaGeneralFlags)
+        {
+        TUint32 dbFlags(aPodcastTable.ColumnInt64(EPodcastDbFlag));
+        TDriveUnit driveUnit;
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            TParsePtrC parse( aMedia.ValueText(KMPXMediaGeneralUri) );
+            if( parse.DrivePresent() )
+                {
+                driveUnit = parse.Drive();
+                }
+            else
+                {
+                driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+                     aPodcastTable.ColumnInt64(EPodcastVolumeId));
+                }
+            }
+        else
+            {
+            driveUnit = MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(),
+                aPodcastTable.ColumnInt64(EPodcastVolumeId));
+            }
+
+        TInt driveId = driveUnit & KMPXMediaGeneralFlagsDriveInfo;  // 5 bits
+        aMedia.SetTObjectValueL<TUint>(KMPXMediaGeneralFlags, dbFlags | driveId);
+
+        MPX_DEBUG2("    GeneralFlags[%b]", dbFlags | driveId);
+        MPX_DEBUG2("    DriveId[%u]", driveId);
+        }
+    if (aAttrId & EMPXMediaGeneralLastPlaybackPosition)
+        {
+        TInt32 lastPlaybackPosition(aPodcastTable.ColumnInt(EPodcastLastPlayPosition));
+        aMedia.SetTObjectValueL<TInt32>(KMPXMediaGeneralLastPlaybackPosition,
+            lastPlaybackPosition);
+        MPX_DEBUG2("    LastPlayPosition[%d]", lastPlaybackPosition);
+        }
+    if (aAttrId & EMPXMediaGeneralPlayCount)
+        {
+        TUint32 playcount(aPodcastTable.ColumnInt(EPodcastPlayCount));
+        aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralPlayCount, playcount);
+        MPX_DEBUG2("    PlayCount[%d]", playcount);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Set all the attributes in CMPXMedia corresponding to KMPXMediaIdMusic
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::UpdateMediaMusicL(
+    RSqlStatement& aPodcastTable,
+    TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPodcast::UpdateMediaMusicL");
+
+    if (aAttrId & EMPXMediaMusicAlbumArtFileName)
+        {
+        TPtrC art(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastArt));
+        aMedia.SetTextValueL(KMPXMediaMusicAlbumArtFileName, art);
+        MPX_DEBUG2("    Album Art File Name[%S]", &art);
+        }
+    if (aAttrId & EMPXMediaMusicArtist)
+        {
+        TPtrC artist(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastArtistName));
+        aMedia.SetTextValueL(KMPXMediaMusicArtist, artist);
+        MPX_DEBUG2("    Artist[%S]", &artist);
+        }
+    if (aAttrId & EMPXMediaMusicAlbum)
+        {
+        TPtrC album(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastAlbumName));
+        aMedia.SetTextValueL(KMPXMediaMusicAlbum, album);
+        MPX_DEBUG2("    Album[%S]", &album);
+        }
+    if (aAttrId & EMPXMediaMusicYear)
+        {
+        const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastReleaseDate));
+        if(dateStr.Compare(KNullDesC) != 0)
+        	{
+            TTime dateTime(MPXDbCommonUtil::DesToTTimeL(dateStr));
+            aMedia.SetTObjectValueL<TInt64>(KMPXMediaMusicYear, dateTime.Int64());
+            MPX_DEBUG2("    Year[%d]", dateTime.Int64());
+        	}
+        MPX_DEBUG2("    ReleaseDate[%S]", &dateStr);
+        }
+    if (aAttrId & EMPXMediaMusicAlbumTrack)
+        {
+        TInt32 track(aPodcastTable.ColumnInt(EPodcastAlbumTrack));
+        HBufC* hbuf = HBufC::NewLC(KMCIntegerLen);
+        if (track != KMaxTInt)
+            {
+            hbuf->Des().AppendFormat(_L("%d"), track);
+            }
+        aMedia.SetTextValueL(KMPXMediaMusicAlbumTrack, *hbuf);
+        MPX_DEBUG3("    Album Track[%S][%d]", hbuf, track);
+        CleanupStack::PopAndDestroy(hbuf);
+        }
+    if (aAttrId & EMPXMediaMusicGenre)
+        {
+        TPtrC genre(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastGenreName));
+        aMedia.SetTextValueL(KMPXMediaMusicGenre, genre);
+        MPX_DEBUG2("    Music Genre[%S]", &genre);
+        }
+    if (aAttrId & EMPXMediaMusicComposer)
+        {
+        TPtrC composer(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastComposerName));
+        aMedia.SetTextValueL(KMPXMediaMusicComposer, composer);
+        MPX_DEBUG2("    Music Composer[%S]", &composer);
+        }
+    if (aAttrId & EMPXMediaMusicRating)
+        {
+        TUint32 rating(aPodcastTable.ColumnInt(EPodcastRating));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaMusicRating, rating);
+        MPX_DEBUG2("    Music Rating[%d]", rating);
+        }
+    if (aAttrId & EMPXMediaMusicURL)
+        {
+        TPtrC url(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastUrl));
+        aMedia.SetTextValueL(KMPXMediaMusicURL, url);
+        MPX_DEBUG2("    Music URL[%S]", &url);
+        }
+    if (aAttrId & EMPXMediaMusicOriginalAlbumArtFileName)
+        {
+        // Always set original album art to be file path
+        // Maybe add a new column to db for future if services like rhapsody pushes jpgs to us
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            const TDesC& uri(aMedia.ValueText(KMPXMediaGeneralUri));
+            aMedia.SetTextValueL(KMPXMediaMusicOriginalAlbumArtFileName, uri);
+            MPX_DEBUG2("    Music Original Album Art FullPath[%S]", &uri);
+            }
+        else
+            {
+            HBufC* fullPath = ConstructUriL(aPodcastTable);
+            CleanupStack::PushL(fullPath);
+            aMedia.SetTextValueL(KMPXMediaMusicOriginalAlbumArtFileName, *fullPath);
+            MPX_DEBUG2("    Music Original Album Art FullPath[%S]", fullPath);
+            CleanupStack::PopAndDestroy(fullPath);
+            }
+
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Set all the attributes in CMPXMedia corresponding to KMPXMediaIdAudio
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::UpdateMediaAudioL(
+    RSqlStatement& aPodcastTable,
+    TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPodcast::UpdateMediaAudioL");
+
+    if (aAttrId & EMPXMediaAudioBitrate)
+        {
+        TUint32 bitrate(aPodcastTable.ColumnInt(EPodcastBitRate));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioBitrate, bitrate);
+        MPX_DEBUG2("    Bitrate[%d]", bitrate);
+        }
+    if (aAttrId & EMPXMediaAudioSamplerate)
+        {
+        TUint32 samplerate(aPodcastTable.ColumnInt(EPodcastSampleRate));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioSamplerate, samplerate);
+        MPX_DEBUG2("    SampleRate[%d]", samplerate);
+        }
+    if (aAttrId & EMPXMediaAudioNumberOfChannels)
+        {
+        TUint32 numchannels(aPodcastTable.ColumnInt(EPodcastNumChannels));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioNumberOfChannels, numchannels);
+        MPX_DEBUG2("    Num of Channels[%d]", numchannels);
+        }
+    if (aAttrId & EMPXMediaAudioCodec)
+        {
+        TUint32 codec(aPodcastTable.ColumnInt(EPodcastCodec));
+        aMedia.SetTObjectValueL<TUint32>(KMPXMediaAudioAudioCodec, codec);
+        MPX_DEBUG2("    Audio Codec[%d]", codec);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Set all the attributes in CMPXMedia corresponding to KMPXMediaIdPodcast
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::UpdateMediaPodcastL(
+    RSqlStatement& aPodcastTable,
+    TUint aAttrId,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXDbPodcast::UpdateMediaPodcastL");
+
+    //  This episode is currently being played so the playback
+    //  flag needs to be toggled
+    if (aAttrId & EMPXMediaPodcastSetIsPlayingTrue)
+        {
+        SetIsPlayingL(aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId), ETrue);
+        }
+
+    if (aAttrId & EMPXMediaPodcastCategory)
+        {
+        TPtrC genre(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastGenreName));
+        aMedia.SetTextValueL(KMPXMediaPodcastCategory, genre);
+        MPX_DEBUG2("    PodcastCategory[%S]", &genre);
+        }
+    if (aAttrId & EMPXMediaPodcastPubDate)
+        {
+        const TDesC& dateStr(MPXDbCommonUtil::GetColumnTextL(aPodcastTable, EPodcastPublishDate));
+        if(dateStr.Compare(KNullDesC) != 0)
+        	{
+            TTime dateTime(MPXDbCommonUtil::DesToTTimeL(dateStr));
+            aMedia.SetTObjectValueL<TInt64>(KMPXMediaPodcastPubDate, dateTime.Int64());
+        	}
+        MPX_DEBUG2("    Publish Date[%S]", &dateStr);
+        }
+    if (aAttrId & EMPXMediaPodcastIsPlaying)
+        {
+        TInt isPlaying(aPodcastTable.ColumnInt(EPodcastIsPlaying));
+        aMedia.SetTObjectValueL<TBool>(KMPXMediaPodcastIsPlaying, isPlaying);
+        MPX_DEBUG2("    IsPlaying[%d]", isPlaying);
+        }
+
+    TInt lastPlayPos(0);
+    if (aMedia.IsSupported(KMPXMediaGeneralLastPlaybackPosition))
+        {
+        lastPlayPos = aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralLastPlaybackPosition);
+        }
+
+    TUint32 playCount(0);
+    if (aMedia.IsSupported(KMPXMediaGeneralPlayCount))
+        {
+        playCount = aMedia.ValueTObjectL<TUint32>(KMPXMediaGeneralPlayCount);
+        }
+
+    // playcount is incremented after an episode is played to completion
+    if ((lastPlayPos != 0) && (playCount == 0))
+        {
+        aMedia.SetTObjectValueL(KMPXMediaPodcastCategoryGroup, EMPXPartlyPlayed);
+        MPX_DEBUG1( "CMPXDbPodcast::DoSetMediaPodcastL() item is partly played" );
+        }
+    else if ((lastPlayPos == 0) && (playCount == 0))
+        {
+        aMedia.SetTObjectValueL(KMPXMediaPodcastCategoryGroup, EMPXNew);
+        }
+    else
+        {
+        aMedia.SetTObjectValueL(KMPXMediaPodcastCategoryGroup, EMPXCompletelyPlayed);
+        }
+
+    aMedia.SetTObjectValueL(KMPXMediaPodcastType, EMPXPodcastItem);
+    }
+
+// ----------------------------------------------------------------------------
+//  Validate podcast file
+// ----------------------------------------------------------------------------
+//
+TMCDrmType CMPXDbPodcast::DRMTypeL(
+    const TDesC& aFile)
+    {
+    MPX_FUNC("CMPXDbPodcast::DRMTypeL");
+
+    TMCDrmType drm = EMCDrmNone;
+    TInt pos(0);
+    TParsePtrC fullEntry(aFile);
+    TPtrC theExt = fullEntry.Ext();
+
+    if (iExtensionsDrm->Find(theExt,pos) == 0)
+        {
+        drm = MPXDbCommonUtil::GetDRMTypeL(aFile);
+        }
+
+    return drm;
+    }
+
+// ----------------------------------------------------------------------------
+//  Generate viewing columns for podcast table from attributes
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbPodcast::GeneratePodcastMatchingCriteriaLC(
+    TUint32 aGeneralId,
+    TUint32 aContainerId,
+    TMPXGeneralType aType,
+    TMPXPodcastType aPodcastType,
+    const CMPXMedia& aCriteria)
+    {
+    MPX_FUNC("CMPXDbPodcast::GeneratePodcastMatchingCriteriaLC");
+
+    const TArray<TMPXAttribute> criteria = aCriteria.Attributes();
+    TInt criteriaCount(criteria.Count());
+
+    CDesCArrayFlat* sqlCriteria = new (ELeave) CDesCArrayFlat(criteriaCount);
+    CleanupStack::PushL(sqlCriteria);
+
+    // If EMPXMediaGeneralDeleted is not defined, always unset the deleted bit for matching
+    if (!aCriteria.IsSupported(KMPXMediaGeneralDeleted))
+        {
+        sqlCriteria->AppendL(KCriterionPodcastNotDeleted);
+        }
+
+    TBool volumeAdded(EFalse);
+    for (TInt i = 0; i < criteriaCount; ++i)
+        {
+        const TMPXAttribute& criterion = criteria[i];
+
+        if (criterion == KMPXMediaGeneralId)
+            {
+            TInt category(MPX_ITEM_CATEGORY(aGeneralId));
+
+            // Set the type if no type is specified
+            if (aType == EMPXNoType)
+                {
+                aType = (category == EMPXCollection) ? EMPXItem : EMPXGroup;
+                }
+
+            TPtrC ptr;
+            if ((aType == EMPXItem) && (category == EMPXCollection))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionPodcastUniqueId, aGeneralId);
+                }
+            else if ((aType == EMPXGroup) && (category == EMPXArtist))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionPodcastAuthor, aGeneralId);
+                }
+            else if ((aType == EMPXGroup) && (category == EMPXAlbum))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionPodcastAlbum, aGeneralId);
+                }
+            else if ((aType == EMPXGroup) && (category == EMPXGenre))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionPodcastGenre, aGeneralId);
+                }
+            else if ((aType == EMPXGroup) && (category == EMPXComposer))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionPodcastComposer, aGeneralId);
+                }
+            else if ((aPodcastType == EMPXPodcastGroup) && (category == EMPXTitle))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionPodcastAlbum, aGeneralId);
+                }
+            else if ((aType == EMPXGroup) && (category == EMPXNoCategory))
+                {
+                HBufC* sqlCriterion = GeneratePublishDateCategoryCriteriaL(aGeneralId & 0x00FFFFFF);
+                sqlCriteria->AppendL(*sqlCriterion);
+                CleanupStack::PopAndDestroy(sqlCriterion);
+                }
+            else
+                {
+                User::Leave(KErrNotSupported);
+                }
+            }
+        else if (criterion == KMPXMediaGeneralContainerId)
+            {
+            TInt containerCategory(MPX_ITEM_CATEGORY(aContainerId));
+
+            if ((aType == EMPXGroup) && (containerCategory == EMPXArtist))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionPodcastAuthor, aContainerId);
+                }
+            else if ((aType == EMPXGroup) && (containerCategory == EMPXAlbum))
+                {
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria,
+                    KCriterionPodcastAlbum, aContainerId);
+                }
+            else
+                {
+                //User::Leave(KErrNotSupported);
+                }
+            }
+        else if (criterion == KMPXMediaGeneralTitle)
+            {
+            HBufC* title = MPXDbCommonUtil::ProcessPatternCharsLC(
+                aCriteria.ValueText(KMPXMediaGeneralTitle));
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionPodcastTitle, *title);
+            CleanupStack::PopAndDestroy(title);
+            }
+        else if (criterion == KMPXMediaGeneralUri)
+            {
+            const TDesC& uri(aCriteria.ValueText(KMPXMediaGeneralUri));
+
+            // Only set the criteria if Uri is not null Des. a URI has to match to location and volume
+            // columns together.
+            if (uri != KNullDesC)
+                {
+                if (!volumeAdded)
+                    {
+	                TDriveUnit driveUnit(uri);
+	                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionPodcastVolume,
+	                    MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit));
+	                volumeAdded = ETrue;
+                    }
+                MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionPodcastUri,
+                    uri.Mid(KMCPathStartPos));
+                }
+
+            }
+        else if (criterion == KMPXMediaGeneralDrive)
+            {
+            if (!volumeAdded)
+                {
+	            // validate the drive letter, TDriveUnit panics if given drive isn't between
+	            // 'A' to 'Z'
+	            TDriveUnit driveUnit(aCriteria.ValueText(KMPXMediaGeneralDrive));
+	            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionPodcastVolume,
+	                MPXDbCommonUtil::GetVolIdMatchDriveIdL(iDbManager.Fs(), driveUnit));
+                volumeAdded = ETrue;
+                }
+            }
+        else if (criterion == KMPXMediaGeneralSynchronized)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionPodcastSynchronized,
+                 aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralSynchronized));
+            }
+        else if (criterion == KMPXMediaGeneralDeleted)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionPodcastDeleted,
+                 aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralDeleted));
+            }
+        else if (criterion == KMPXMediaGeneralModified)
+            {
+            MPXDbCommonUtil::AddSqlCriterionL(*sqlCriteria, KCriterionPodcastModified,
+                 aCriteria.ValueTObjectL<TBool>(KMPXMediaGeneralModified));
+            }
+         else
+            {
+            // to-do: provide searching ability on the rest of the fields
+            }
+        }
+
+    // construct the final criteria string
+    HBufC* criteriaStr = MPXDbCommonUtil::StringFromArrayLC(*sqlCriteria, KMCAndKeyword);
+
+    CleanupStack::Pop(criteriaStr);
+    CleanupStack::PopAndDestroy(sqlCriteria);
+    CleanupStack::PushL(criteriaStr);
+
+    return criteriaStr;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::GeneratePublishDateCategoryCriteriaL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbPodcast::GeneratePublishDateCategoryCriteriaL(
+    const TUint& aPublishDateCategoryID)
+    {
+    MPX_FUNC("CMPXDbPodcast::GeneratePublishDateCategoryCriteriaL");
+
+    HBufC* criteriaBuffer(NULL);
+
+    HBufC* now = MPXDbCommonUtil::CurrentDateDesLC();
+
+    switch (aPublishDateCategoryID + KPublishTodayPlaylistUID)
+        {
+        case KPublishTodayPlaylistUID:
+            {
+            criteriaBuffer = MPXDbCommonUtil::SqlCriterionLC(KCriterionPodcastPublishDateToday(),
+                *now, *now);
+            break;
+            }
+        case KPublishYesterdayPlaylistUID:
+            {
+            criteriaBuffer = MPXDbCommonUtil::SqlCriterionLC(KCriterionPodcastPublishDateYesterday(),
+                *now, *now);
+            break;
+            }
+        case KPublishThisWeekPlaylistUID:
+            {
+            TInt dayNo(MPXDbUtil::DayNoInWeek());
+            dayNo++; // shifted by 1 day to get correct results
+            criteriaBuffer = MPXDbCommonUtil::SqlCriterionLC(KCriterionPodcastPublishDateBetween(),
+                *now, dayNo,*now, 1);
+            break;
+            }
+        case KPublishLastWeekPlaylistUID:
+            {
+            TInt dayNo(MPXDbUtil::DayNoInWeek());
+            dayNo++; // shifted by 1 day to get correct results
+            criteriaBuffer = MPXDbCommonUtil::SqlCriterionLC(KCriterionPodcastPublishDateBetween(),
+                *now, dayNo + 7, *now, dayNo);
+            break;
+            }
+        case KPublish2WeeksAgoPlaylistUID:
+            {
+            TInt dayNo(MPXDbUtil::DayNoInWeek());
+            dayNo++; // shifted by 1 day to get correct results
+            criteriaBuffer = MPXDbCommonUtil::SqlCriterionLC(KCriterionPodcastPublishDateBetween(),
+                *now, dayNo + 14, *now, dayNo + 7);
+            break;
+            }
+        case KPublish3WeeksAgoPlaylistUID:
+            {
+            TInt dayNo(MPXDbUtil::DayNoInWeek());
+            dayNo++; // shifted by 1 day to get correct results
+            criteriaBuffer = MPXDbCommonUtil::SqlCriterionLC(KCriterionPodcastPublishDateBetween(),
+                *now, dayNo + 21, *now, dayNo + 14);
+            break;
+            }
+        case KPublishLastMonthPlaylistUID:
+            {
+            criteriaBuffer = MPXDbCommonUtil::SqlCriterionLC(KCriterionPodcastPublishDateLastMonth(),
+                *now, *now);
+            break;
+            }
+        case KPublishEarlierPlaylistUID:
+            {
+            criteriaBuffer = MPXDbCommonUtil::SqlCriterionLC(KCriterionPodcastPublishDateEarlier(),
+                *now);
+            break;
+            }
+        case KPublishUnknownPlaylistUID:
+            {
+            criteriaBuffer = MPXDbCommonUtil::SqlCriterionLC(KCriterionPodcastPublishDateUnknown(),
+                *now);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrArgument);
+            }
+        }
+
+    CleanupStack::Pop(criteriaBuffer);
+    CleanupStack::PopAndDestroy(now);
+    CleanupStack::PushL(criteriaBuffer);
+
+    TPtrC ptr(criteriaBuffer->Left(248));
+    MPX_DEBUG2("CriteriaBuffer: %S", &ptr);
+
+    return criteriaBuffer;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::ConstructUriL
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXDbPodcast::ConstructUriL(
+    RSqlStatement& aRecordset)
+    {
+    MPX_FUNC("CMPXDbPodcast::ConstructUriL");
+
+    return MPXDbCommonUtil::CreateFullPathL(
+        MPXDbCommonUtil::GetDriveIdMatchVolIdL(iDbManager.Fs(), aRecordset.ColumnInt64(EPodcastVolumeId)),
+        MPXDbCommonUtil::GetColumnTextL(aRecordset, EPodcastLocation));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::EpisodeExistsL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPodcast::EpisodeExistsL(
+    TUint32 aEpisodeId)
+    {
+    MPX_FUNC("CMPXDbPodcast::EpisodeExistsL");
+
+    RSqlStatement recordset(iDbManager.ExecuteSelectQueryL(KQueryPodcastVolume, aEpisodeId));
+    TBool found = (recordset.Next() == KSqlAtRow);
+    recordset.Close();
+
+    return found;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::ExtraFieldsRequired
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPodcast::ExtraFieldsRequired(
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXDbPodcast::ExtraFieldsRequired");
+
+    TBool extraRequired(EFalse);
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TUint attributeId(aAttrs[i].AttributeId());
+
+        if ((KMPXMediaIdMusic == aAttrs[i].ContentId()) &&
+            ((attributeId & EMPXMediaMusicArtist) ||
+            (attributeId & EMPXMediaMusicAlbum) ||
+            (attributeId & EMPXMediaMusicGenre) ||
+            (attributeId & EMPXMediaMusicComposer)))
+            {
+            // fields from category tables are required
+            extraRequired = ETrue;
+            break;
+            }
+        }
+
+    return extraRequired;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::ProcessPublishDateCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::ProcessPublishDateCategoryL(
+    const TMPXItemId& aPublishDateCategoryId,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::ProcessPublishDateCategoryL");
+
+    TInt count(aMediaArray.Count());
+    if ((aPublishDateCategoryId.iId2 > 0) && (count > 0))
+        {
+        // last item within category, append category ID to aid in removal of
+        // all episodes within a Publish Date View category
+        aMediaArray[count - 1]->SetTObjectValueL<TMPXItemId>(KMPXMediaPodcastPubDateCategoryId,
+            aPublishDateCategoryId);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::GetPlayingItemL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXDbPodcast::GetPlayingItemL(
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXDbPodcast::GetPlayingItemL");
+
+    TInt index(KErrNotFound);
+    TInt count(aMediaArray.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        CMPXMedia* media = aMediaArray[i];
+        if (media->IsSupported(KMPXMediaPodcastIsPlaying) &&
+            media->ValueTObjectL<TBool>(KMPXMediaPodcastIsPlaying))
+            {
+            index = i;
+            break;
+            }
+        }
+
+    return index;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::CreateTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::CreateTableL(
+    RSqlDatabase& aDatabase,
+    TBool /* aCorruptTable */)
+    {
+    MPX_FUNC("CMPXDbPodcast::CreateTableL");
+
+    // Create the table
+    User::LeaveIfError(aDatabase.Exec(KPodcastCreateTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::DropTableL
+// ----------------------------------------------------------------------------
+//
+void CMPXDbPodcast::DropTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbPodcast::DropTableL");
+    User::LeaveIfError(aDatabase.Exec(KPodcastDropTable));
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXDbPodcast::CheckTableL
+// ----------------------------------------------------------------------------
+//
+TBool CMPXDbPodcast::CheckTableL(
+    RSqlDatabase& aDatabase)
+    {
+    MPX_FUNC("CMPXDbPodcast::CheckTableL");
+    return DoCheckTable(aDatabase, KPodcastCheckTable);
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxdbutil.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,221 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Utility functions for the podcast plugin
+*
+*/
+
+
+// INCLUDE FILES
+#include <bautils.h>
+#include <caf/data.h>
+#include <caf/virtualpathptr.h>
+#include <hash.h>
+#include <apgcli.h>
+#include <apmstd.h>
+
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxlog.h>
+
+#include "mpxdbcommonstd.h"
+#include "mpxdbcommonutil.h"
+#include "mpxdbcommondef.h"
+
+#include "mpxdbutil.h"
+#include "mpxpodcastcollectiondbdef.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Append an item into the media array
+// ----------------------------------------------------------------------------
+//
+void MPXDbUtil::AppendMediaL(
+    CMPXMediaArray& aArray,
+    const TDesC& aTitle,
+    TMPXGeneralType aType,
+    TMPXGeneralCategory aCat,
+    TMPXPodcastType aPodcastType,
+    TMPXPodcastCategory aPodcastCat,
+    TMPXItemId aId,
+    TInt aNonPermissibleActions)
+    {
+    MPX_FUNC("MPXDbUtil::AppendMediaL");
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL (supportedIds);
+    supportedIds.AppendL (KMPXMediaIdGeneral);
+    supportedIds.AppendL (KMPXMediaIdPodcast);
+    CMPXMedia* entry = CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PushL (entry);
+    entry->SetTextValueL (KMPXMediaGeneralTitle, aTitle);
+    entry->SetTObjectValueL(KMPXMediaPodcastType, aPodcastType);
+    entry->SetTObjectValueL(KMPXMediaPodcastCategoryGroup, aPodcastCat);
+    entry->SetTObjectValueL(KMPXMediaGeneralId, aId);
+    entry->SetTObjectValueL(KMPXMediaGeneralType, aType);
+    entry->SetTObjectValueL(KMPXMediaGeneralCategory, aCat);
+
+    // temp fix: Beryl BEGIN
+    if ( aNonPermissibleActions != 0 )
+        {
+        // set non-permissible actions
+        entry->SetTObjectValueL(KMPXMediaGeneralNonPermissibleActions,
+            static_cast<TMPXGeneralNonPermissibleActions>(aNonPermissibleActions));
+        }
+    // temp fix: Beryl END
+    aArray.AppendL (entry);
+    CleanupStack::Pop (entry);
+    CleanupStack::PopAndDestroy (&supportedIds);
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbUtil::PodcastFieldNameForCategoryL
+// ----------------------------------------------------------------------------
+//
+TPtrC MPXDbUtil::PodcastFieldNameForCategoryL(
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("MPXDbUtil::PodcastFieldNameForCategoryL");
+
+    TPtrC ptr;
+    switch (aCategory)
+        {
+        case EMPXArtist:
+            ptr.Set(KMCPodcastAuthor);
+            break;
+
+        case EMPXAlbum:
+            ptr.Set(KMCPodcastTitle);
+            break;
+
+        case EMPXGenre:
+            ptr.Set(KMCPodcastGenre);
+            break;
+
+        case EMPXComposer:
+            ptr.Set(KMCPodcastComposer);
+            break;
+
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return ptr;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbUtil::Today
+// ----------------------------------------------------------------------------
+//
+TTime MPXDbUtil::Today()
+    {
+    MPX_FUNC("MPXDbUtil::Today");
+
+    TTime now;  // in microseconds
+    now.HomeTime();
+    TDateTime todayDate = now.DateTime();
+
+    todayDate.SetHour(0);
+    todayDate.SetMinute(0);
+    todayDate.SetSecond(0);
+    todayDate.SetMicroSecond(0);
+
+    return TTime(todayDate);
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbUtil::MonthStart
+// ----------------------------------------------------------------------------
+//
+TTime MPXDbUtil::MonthStart()
+    {
+    MPX_FUNC("MPXDbUtil::MonthStart");
+
+    TTime now;  // in microseconds
+    now.HomeTime();
+    TDateTime lastMonthStartDate = now.DateTime();
+
+    lastMonthStartDate.SetDay(0);  // Day range from 0 to 30
+    lastMonthStartDate.SetHour(0);
+    lastMonthStartDate.SetMinute(0);
+    lastMonthStartDate.SetSecond(0);
+    lastMonthStartDate.SetMicroSecond(0);
+
+    return TTime(lastMonthStartDate);
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbUtil::DayNoInWeek
+// ----------------------------------------------------------------------------
+//
+TInt MPXDbUtil::DayNoInWeek()
+    {
+    MPX_FUNC("MPXDbUtil::DayNoInWeek");
+
+    TTime now;  // in microseconds
+    now.HomeTime();
+
+    // Calculate number of days in this week
+    TDay dayNo = now.DayNoInWeek();
+    TDay firstDay = TLocale().StartOfWeek();
+    TInt numDay(0);
+    if (firstDay == ESunday)
+        {
+        numDay = dayNo + 1;
+        }
+    else
+        {
+        numDay = dayNo - firstDay;
+        }
+
+    return numDay;
+    }
+
+// ----------------------------------------------------------------------------
+// MPXDbUtil::TableNameForCategoryL
+// ----------------------------------------------------------------------------
+//
+TPtrC MPXDbUtil::TableNameForCategoryL(
+    TMPXGeneralCategory aCategory)
+    {
+    MPX_FUNC("MPXDbUtil::TableNameForCategoryL");
+
+    TPtrC ptr;
+    switch (aCategory)
+        {
+        case EMPXArtist:
+            ptr.Set(KMCAuthorTable);
+            break;
+        case EMPXAlbum:
+            ptr.Set(KMCTitleTable);
+            break;
+        case EMPXGenre:
+            ptr.Set(KMCCategoryTable);
+            break;
+        case EMPXComposer:
+            ptr.Set(KMCComposerTable);
+            break;
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return ptr;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbhandler.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1619 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is used by db plugin to add episodes into DB or
+*                remove episodes from DB
+*
+*/
+
+
+// INCLUDE FILES
+#include <PCRes.rsg>
+#include <bautils.h>
+#include <MetaDataUtility.h>
+#ifdef RD_MULTIPLE_DRIVE
+#include <driveinfo.h>
+#include <pathinfo.h>
+#endif //RD_MULTIPLE_DRIVE
+
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxcollectionpath.h>
+#include <mpxlog.h>
+
+#include "mpxdbcommondef.h"
+#include "mpxresource.h"
+#include "mpxdbcommonutil.h"
+
+#include "mpxdbutil.h"
+#include "mpxpodcastcollectiondbdef.h"
+#include "mpxpodcastdbmanager.h"
+#include "mpxdbcategory.h"
+#include "mpxdbauxiliary.h"
+#include "mpxpodcastdbhandler.h"
+#include "mpxpodcastdbpluginqueries.h"
+
+// CONSTANTS
+#if defined (__MTP_PROTOCOL_SUPPORT)
+#include <centralrepository.h>
+
+const TUid KMPXMtpSettings = {0x101FFC53};    // MTP CenRep Key UID
+const TUint32 KMPXMtpSaveDeletedRecordFlag = 0x00000001;      // MTP CenRep Key for Delete contents
+#endif
+const TInt KSqlDbCorrupted = -321;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXPodcastDbHandler* CMPXPodcastDbHandler::NewL(
+    RFs& aFs,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::NewL");
+
+    CMPXPodcastDbHandler* self = CMPXPodcastDbHandler::NewLC(aFs, aResource);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXPodcastDbHandler* CMPXPodcastDbHandler::NewLC(
+    RFs& aFs,
+    CMPXResource& aResource)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::NewLC");
+
+    CMPXPodcastDbHandler* self = new (ELeave) CMPXPodcastDbHandler(aFs, aResource);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXPodcastDbHandler::~CMPXPodcastDbHandler()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::~CMPXPodcastDbHandler");
+
+    delete iDbPodcast;
+    delete iDbArtist;
+    delete iDbAlbum;
+    delete iDbGenre;
+    delete iDbComposer;
+    delete iDbAuxiliary;
+    delete iDbManager;
+
+    delete iPodcastPublishDateCat;
+    iPodcastPublishDateIds.Close();
+    iDbDrives.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that might leave
+// ----------------------------------------------------------------------------
+//
+CMPXPodcastDbHandler::CMPXPodcastDbHandler(
+    RFs& aFs,
+    CMPXResource& aResource) :
+    iFs(aFs),
+    iResource(aResource)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::CMPXPodcastDbHandler");
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::ConstructL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::ConstructL");
+
+    iPodcastPublishDateCat = iResource.ReadMenuArrayL(R_MPX_QTN_NMP_PUBLISH_DATE_ARRAY,
+        iPodcastPublishDateIds);
+    
+    //create db manager
+    iDbManager = CMPXPodcastDbManager::NewL(iFs);
+    CDesCArrayFlat* podcastFolders =
+#ifdef RD_MULTIPLE_DRIVE
+		GetPodcastFoldersL();
+#else
+    	iResource.ReadDesCArrayL(R_MC_DEFAULT_MUSIC_FOLDERS);
+#endif
+
+    // create the podcast folders and initialize iDbDrives
+    CleanupStack::PushL(podcastFolders);
+    ProcessPodcastFoldersL(*podcastFolders);
+    CleanupStack::PopAndDestroy(podcastFolders);
+
+    // create the db infrastructure
+    iDbPodcast = CMPXDbPodcast::NewL(*iDbManager, iResource, *this);
+    iDbArtist = CMPXDbCategory::NewL(*iDbManager, EMPXArtist);
+    iDbAlbum = CMPXDbCategory::NewL(*iDbManager, EMPXAlbum);
+    iDbGenre = CMPXDbCategory::NewL(*iDbManager, EMPXGenre);
+    iDbComposer = CMPXDbCategory::NewL(*iDbManager, EMPXComposer);
+    iDbAuxiliary = CMPXDbAuxiliary::NewL(*iDbManager);
+
+    // make sure all databases are created and valid
+    MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives));
+
+    // If KErrCorrupt is returned, a database file was found to be corrupted
+    // and was replaced with a new one.  The db plugin can ignore this error and continue
+    // because a new db file was successfully created in a subsequent retry.
+    if ((err != KErrNone) && (err != KErrCorrupt) && (err != KErrDiskFull))
+        {
+        // leave to signal the caller that there was an error why creating and opening
+        // one or more of the databases
+        User::Leave(err);
+        }
+    else if (err == KErrDiskFull)
+        {
+        iOutOfDisk = ETrue;
+        }
+    else
+        {
+        // do nothing
+        }
+    // Verify the volume ID Matches
+    MPX_TRAP(err,VerifyVolumeIdL());
+    if ((err != KErrNone) && (err != KErrDiskFull))
+        {
+        // leave to signal the caller that there was an error why creating and opening
+        // one or more of the databases
+        User::Leave(err);
+        }
+    else if (err == KErrDiskFull)
+        {
+        iOutOfDisk = ETrue;
+        }
+
+    // iDbManager->PrintDatabaseL();
+
+    MPX_DEBUG2("CMPXDbHandler::ConstructL DbCount[%d]", iDbManager->DatabaseCount());
+    }
+
+// ----------------------------------------------------------------------------
+// Add episode into collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXPodcastDbHandler::AddEpisodeL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::AddEpisodeL");
+
+    BeginTransactionL();
+
+    TUint32 episodeId(0);
+    MPX_TRAPD(err, episodeId = DoAddEpisodeL(aMedia));
+
+    if (iOutOfDisk && (err == KErrNotFound))
+        {
+        err = KErrDiskFull;
+        }
+    EndTransactionL(err);
+
+    return episodeId;
+    }
+
+// ----------------------------------------------------------------------------
+// Update a episode in the collection
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXPodcastDbHandler::UpdateEpisodeL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::UpdateEpisodeL");
+
+    BeginTransactionL();
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+    MPX_TRAPD(err, visibleChange = DoUpdateEpisodeL(aMedia, aItemChangedMessages));
+    EndTransactionL(err);
+    return visibleChange;
+    }
+
+// ----------------------------------------------------------------------------
+// Remove the entire podcast collection database
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::RemoveEntireCollectionL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::RemoveEntireCollectionL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, iDbManager->RecreateAllDatabasesL());
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Delete a episode from collection
+// The function notifies collection model to perform deletion
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::RemoveEpisodeL(
+    TUint32 aEpisodeId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages,
+    TBool aDeleteRecord)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::RemoveEpisodeL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoRemoveEpisodeL(aEpisodeId, aUriArray, aItemChangedMessages, aDeleteRecord));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Removes a category of episodes from the podcast collection, and its
+// corresponding category in the lookup table
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::RemoveEpisodesMatchingCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::RemoveEpisodesMatchingCategoryL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoRemoveEpisodesMatchingCategoryL(aCategory, aCategoryId,
+        aUriArray, aItemChangedMessages));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Delete episode(s) from collection belonging to specified publish date category
+// The function notifies collection model to perform deletion
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::RemoveEpisodesMatchingPublishDateCategoryL(
+    TUint32 aCategoryId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::RemoveEpisodesMatchingPublishDateCategoryL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoRemoveEpisodesMatchingPublishDateCategoryL(aCategoryId,
+        aUriArray, aItemChangedMessages));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Cleanup records marked as deleted. This is designated for MTP to clean up
+// records marked as deleted at the end of its session.
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::CleanupDeletedRecordsL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::CleanupDeletedRecordsL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, DoCleanupDeletedRecordsL());
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+//  Read all episodes and cache them into an array ordered by episode name
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::GetAllEpisodesL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetAllEpisodesL");
+    iDbPodcast->GetAllEpisodesL(aAttrs, aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve the episode(s) with the specified title
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::GetEpisodesMatchingTitleL(
+    TUint aTitleId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetEpisodesMatchingTitleL");
+    iDbPodcast->GetEpisodesForCategoryL(EMPXAlbum, aTitleId, aAttrs,
+                                        aMediaArray, ETrue);
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve the episode(s) belonging to the specified playlist
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::GetEpisodesMatchingPlaylistL(
+    TUint aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray,
+    TInt& aIndexOfCurrentlyPlayingItem)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetEpisodesMatchingPlaylistL");
+
+    switch (aPlaylistId)
+        {
+        case KRecentlyAddedPlaylistUID:
+            {
+            iDbPodcast->GetRecentlyAddedPlaylistEpisodesL(aAttrs, aMediaArray,
+                aIndexOfCurrentlyPlayingItem);
+            break;
+            }
+        case KNotPlayedPlaylistUID:
+            {
+            iDbPodcast->GetNotYetPlayedPlaylistEpisodesL(aAttrs, aMediaArray,
+                aIndexOfCurrentlyPlayingItem);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve the episode with the specified ID
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::GetEpisodeL(
+    TUint32 aEpisodeId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetEpisodeL");
+
+    CMPXMedia* media = CMPXMedia::NewL();
+    CleanupStack::PushL(media);
+
+    GetEpisodeL(aEpisodeId, aAttrs, *media);
+    aMediaArray.AppendL(*media);
+
+    CleanupStack::PopAndDestroy(media);
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve the episode with the specified ID
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::GetEpisodeL(
+    TUint32 aEpisodeId,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetEpisodeL");
+    iDbPodcast->GetEpisodeL(aEpisodeId, aAttrs, aMedia);
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve the episode with the specified URI
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXPodcastDbHandler::GetEpisodeIdMatchingUriL(
+    const TDesC& aUri)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetEpisodeIdMatchingUriL");
+    return MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXCollection, aUri, EFalse);
+    }
+
+// ----------------------------------------------------------------------------
+// Return all podcast title names
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::GetAllPodcastTitlesL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetAllPodcastTitlesL");
+    iDbAlbum->GetAllCategoryItemsL(aAttrs, aMediaArray);
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve episodes matching the specified publish playlist id
+// ----------------------------------------------------------------------------
+//
+TInt CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL(
+    TUint aPlaylistId,
+    const TArray<TMPXAttribute>& aAttrs,
+    TBool aPendingCategoryDeletionFlag,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL");
+
+    TInt numEpisodes(0);
+    TMPXItemId podcastPublishDateCatId = 0;
+
+    // the deletion helper is retrieving all the media within this category
+    // to delete it so need to record category id within last item so
+    // that the HandleChangeL callback can cause OpenL to be called after the
+    // last item within the category is deleted
+    if (aPendingCategoryDeletionFlag)
+        {
+        TInt categoryID(EMPXOther);
+
+        // pass in the category Id so that the helper method can add
+        // the category Id to the last item in this category to aid
+        // in deletion of a category
+        podcastPublishDateCatId = (aPlaylistId - KPublishTodayPlaylistUID) | (categoryID << 28);
+        }
+
+    switch (aPlaylistId)
+        {
+        case KPublishAllPlaylistUID:
+            {
+            TInt itemCount(iPodcastPublishDateCat->Count());
+            for (TInt i = 0; i < itemCount; ++i)
+                {
+                TMPXItemId itemId = iPodcastPublishDateIds[i];
+                TInt count(0);
+
+                switch (iPodcastPublishDateIds[i] + KPublishTodayPlaylistUID)
+                    {
+                    case KPublishTodayPlaylistUID:
+                        count = iDbPodcast->GetTodayEpisodesCountL();
+                        break;
+                    case KPublishYesterdayPlaylistUID:
+                        count = iDbPodcast->GetYesterdayEpisodesCountL();
+                        break;
+                    case KPublishThisWeekPlaylistUID:
+                        count = iDbPodcast->GetThisWeekEpisodesCountL();
+                        break;
+                    case KPublishLastWeekPlaylistUID:
+                        count = iDbPodcast->GetLastWeekEpisodesCountL();
+                        break;
+                    case KPublish2WeeksAgoPlaylistUID:
+                        count = iDbPodcast->Get2WeeksAgoEpisodesCountL();
+                        break;
+                    case KPublish3WeeksAgoPlaylistUID:
+                        count = iDbPodcast->Get3WeeksAgoEpisodesCountL();
+                        break;
+                    case KPublishLastMonthPlaylistUID:
+                        count = iDbPodcast->GetLastMonthEpisodesCountL();
+                        break;
+                    case KPublishEarlierPlaylistUID:
+                        count = iDbPodcast->GetEarlierEpisodesCountL();
+                        break;
+                    case KPublishUnknownPlaylistUID:
+                        count = iDbPodcast->GetUnknownEpisodesCountL();
+                        break;
+                    default:
+                        User::Leave(KErrNotFound);
+                        break;
+                    };
+
+                if (count > 0)
+                    {
+                    numEpisodes += count;
+                    MPXDbUtil::AppendMediaL(aMediaArray, iPodcastPublishDateCat->MdcaPoint(i),
+                        EMPXGroup, EMPXPlaylist, EMPXPodcastGroup, EMPXPubDate, itemId);
+                    }
+                }
+            break;
+            }
+
+        case KPublishTodayPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL: Published Today"));
+            iDbPodcast->GetTodayEpisodesL(podcastPublishDateCatId, aAttrs, aMediaArray);
+            break;
+
+        case KPublishYesterdayPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL: Published Yesterday"));
+            iDbPodcast->GetYesterdayEpisodesL(podcastPublishDateCatId, aAttrs, aMediaArray);
+            break;
+
+        case KPublishThisWeekPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL: Published This Week"));
+            iDbPodcast->GetThisWeekEpisodesL(podcastPublishDateCatId, aAttrs, aMediaArray);
+            break;
+
+        case KPublishLastWeekPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL: Published Last Week"));
+            iDbPodcast->GetLastWeekEpisodesL(podcastPublishDateCatId, aAttrs, aMediaArray);
+            break;
+
+        case KPublish2WeeksAgoPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL: Published 2 Weeks Ago"));
+            iDbPodcast->Get2WeeksAgoEpisodesL(podcastPublishDateCatId, aAttrs, aMediaArray);
+            break;
+
+        case KPublish3WeeksAgoPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL: Published 3 Weeks Ago"));
+            iDbPodcast->Get3WeeksAgoEpisodesL(podcastPublishDateCatId, aAttrs, aMediaArray);
+            break;
+
+        case KPublishLastMonthPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL: Published Last Month"));
+            iDbPodcast->GetLastMonthEpisodesL(podcastPublishDateCatId, aAttrs, aMediaArray);
+            break;
+
+        case KPublishEarlierPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL: Published Earlier"));
+            iDbPodcast->GetEarlierEpisodesL(podcastPublishDateCatId, aAttrs, aMediaArray);
+            break;
+
+        case KPublishUnknownPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL: Published Unknown"));
+            iDbPodcast->GetUnknownEpisodesL(podcastPublishDateCatId, aAttrs, aMediaArray);
+            break;
+
+        default:
+            MPX_DEBUG2 (_L("CMPXPodcastDbHandler::GetEpisodesMatchingPublishPlaylistL: Invalid publish ID [%d]"), aPlaylistId);
+            User::Leave(KErrNotFound);
+            break;
+        }
+
+    if (aPlaylistId != KPublishAllPlaylistUID)
+        {
+        numEpisodes = aMediaArray.Count();
+        }
+
+    return numEpisodes;
+    }
+
+// ----------------------------------------------------------------------------
+// Get the name of the row matching the given ID
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXPodcastDbHandler::GetTitleNameMatchingIdL(
+    const TUint32 aId)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetTitleNameMatchingIdL");
+    return iDbAlbum->GetNameL(aId);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the URI of the row matching the given ID
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXPodcastDbHandler::GetUriMatchingIdL(
+    const TUint32 aId)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetUriMatchingIdL");
+
+    return iDbPodcast->GetUriL(aId);
+    }
+
+// ----------------------------------------------------------------------------
+// Find episode(s) that satisfy the specified criteria
+// ----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXPodcastDbHandler::FindAllLC(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::FindAllLC");
+
+    // leave if the given media doesn't contain the following attributes
+    if (!aCriteria.IsSupported(KMPXMediaGeneralType) ||
+        !aCriteria.IsSupported(KMPXMediaGeneralCategory))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    supportedIds.AppendL(KMPXMediaIdContainer);
+    MPXDbCommonUtil::FillInSupportedUIDsL(aAttrs, supportedIds);
+
+    CMPXMedia* entries = CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entries);
+
+    CMPXMediaArray* array = CMPXMediaArray::NewL();
+    CleanupStack::PushL(array);
+
+    FindAllL(aCriteria, aAttrs, *array);
+
+    entries->SetTObjectValueL(KMPXMediaGeneralType, EMPXGroup);
+    entries->SetTObjectValueL(KMPXMediaGeneralCategory,
+         aCriteria.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory));
+    entries->SetCObjectValueL(KMPXMediaArrayContents, array);
+    entries->SetTObjectValueL(KMPXMediaArrayCount, array->Count());
+
+    CleanupStack::PopAndDestroy(array);
+    return entries;
+    }
+
+// ----------------------------------------------------------------------------
+// Find the number of items in the database
+// ----------------------------------------------------------------------------
+//
+TInt CMPXPodcastDbHandler::NumberOfItemsL(
+    TMPXPodcastCategory aCategory)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::NumberOfItemsL");
+
+    TInt numOfItems(0);
+
+    switch(aCategory)
+        {
+        case EMPXAll:
+        case EMPXEpisode:
+            {
+            numOfItems = iDbPodcast->CountL();
+            break;
+            }
+        case EMPXRecentlyAdded:
+            {
+            numOfItems = iDbPodcast->GetRecentlyAddedEpisodesCountL();
+            break;
+            }
+        case EMPXNotYetPlayed:
+            {
+            numOfItems = iDbPodcast->GetNotYetPlayedEpisodesCountL();
+            break;
+            }
+        case EMPXTitle:
+            {
+            numOfItems = iDbPodcast->GetNotYetPlayedEpisodesCountL();
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    return numOfItems;
+    }
+
+// ----------------------------------------------------------------------------
+// Has the database been created?
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbHandler::DatabaseCreated()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::DatabaseCreated");
+
+    TBool AuxilaryDbIsRefreshed(EFalse);
+    TRAP_IGNORE(AuxilaryDbIsRefreshed = iDbAuxiliary->IsRefreshedL());
+    // If none of the databases were available, ie out of disk
+    // we return EFalse
+    return iDbManager->IsInitialized() && AuxilaryDbIsRefreshed;
+    }
+
+// ----------------------------------------------------------------------------
+//  CMPXPodcastDbHandler::GetAllEpisodesDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXPodcastDbHandler::GetAllEpisodesDurationL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetAllEpisodesDurationL");
+    return iDbPodcast->AllEpisodesDurationL();
+    }
+
+// ----------------------------------------------------------------------------
+//  CMPXPodcastDbHandler::GetTitleDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXPodcastDbHandler::GetTitleDurationL(
+    TUint32 aTitleId)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetTitleDurationL");
+    return iDbPodcast->TitleDurationL(aTitleId);
+    }
+
+// ----------------------------------------------------------------------------
+//  CMPXPodcastDbHandler::GetNotPlayedDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXPodcastDbHandler::GetNotPlayedDurationL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetNotPlayedDurationL");
+    return iDbPodcast->NotPlayedDurationL();
+    }
+
+// ----------------------------------------------------------------------------
+//  CMPXPodcastDbHandler::GetRecentlyAddedDurationL
+// ----------------------------------------------------------------------------
+//
+TInt CMPXPodcastDbHandler::GetRecentlyAddedDurationL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetRecentlyAddedDurationL");
+    return iDbPodcast->RecentlyAddedDurationL();
+    }
+
+// ----------------------------------------------------------------------------
+// Set the last refreshed time into the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::SetLastRefreshedTimeL(
+    TTime aTime)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::SetLastRefreshedTimeL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, iDbAuxiliary->SetLastRefreshedTimeL(aTime));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the last refreshed time into the collection
+// ----------------------------------------------------------------------------
+//
+TTime CMPXPodcastDbHandler::GetLastRefreshedTimeL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetLastRefreshedTimeL");
+    return iDbAuxiliary->LastRefreshedTimeL();
+    }
+
+// ----------------------------------------------------------------------------
+// Set the db corrupted state for all drives
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::SetDBCorruptedL(
+    TBool aCorrupted)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::SetDBCorruptedL");
+
+    BeginTransactionL();
+    MPX_TRAPD(err, iDbAuxiliary->SetDBCorruptedL(aCorrupted));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Gets the db corrupted state for all drives
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbHandler::IsDBCorruptedL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::IsDBCorruptedL");
+    return iDbAuxiliary->DBCorruptedL();
+    }
+
+// ----------------------------------------------------------------------------
+// Opens a database
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::OpenDatabaseL(
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::OpenDatabaseL");
+    iDbManager->OpenDatabaseL(aDrive);
+
+    // Verify the volume ID after a remount event
+    VerifyVolumeIdL();
+    }
+
+// ----------------------------------------------------------------------------
+// Close a database
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::CloseDatabaseL(
+    TInt aDrive)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::CloseDatabaseL");
+    iDbManager->CloseDatabaseL(aDrive);
+    }
+
+// ----------------------------------------------------------------------------
+// Re-create all databases
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::ReCreateDatabasesL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::ReCreateDatabasesL");
+    iDbManager->RecreateAllDatabasesL();
+    }
+
+// ----------------------------------------------------------------------------
+// Set handler refresh status
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::RefreshStartL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::RefreshStartL");
+
+    iOutOfDisk = EFalse;
+    // Re-open databases
+    // This is needed for the case where we were OOD before, but user
+    // has cleared some space but now try to refresh
+    MPX_TRAPD(err, iDbManager->InitDatabasesL(iDbDrives));
+
+    if(err == KErrDiskFull)
+        {
+        iOutOfDisk = ETrue;
+        }
+
+    if(!iOutOfDisk)
+    {
+        MPX_TRAP(err,CheckDiskSpaceOnDrivesL());
+
+        if(err == KErrDiskFull)
+            {
+            iOutOfDisk = ETrue;
+            }
+    }
+    BeginTransactionL();
+    }
+
+// ----------------------------------------------------------------------------
+// Re-set handler refresh status
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::RefreshEndL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::RefreshEndL");
+
+    EndTransactionL(KErrNone);
+
+    if (!iOutOfDisk)
+        {
+        // Write last refreshed time as current time
+        // This also sets corrupt = 0
+        TTime curTime;
+        curTime.HomeTime();
+        SetLastRefreshedTimeL(curTime);
+//        iDbManager->PrintDatabaseL();    // PREQ2536 the files sqlrowsetutil.h and sqlrowsetutil.cpp has been removed
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXPodcastDbHandler::SetIsPlayingL
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::SetIsPlayingL(
+    const CMPXMedia& aMedia,
+    TBool aIsPlaying)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::SetIsPlayingL");
+
+    TUint32 episodeId(0);
+    if (aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        episodeId = aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+        }
+    else if (aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        const TDesC& location(aMedia.ValueText(KMPXMediaGeneralUri));
+        episodeId = MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXCollection, location, EFalse);
+        }
+    else
+        {
+        User::Leave(KErrArgument);
+        }
+
+    BeginTransactionL();
+    MPX_TRAPD(err, iDbPodcast->SetIsPlayingL(episodeId, aIsPlaying));
+    EndTransactionL(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for podcasts
+// ----------------------------------------------------------------------------
+//
+TUint CMPXPodcastDbHandler::GetTotalCountL(TInt aDrive)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetTotalCountL");
+    TUint total(0);
+
+    total = iDbPodcast->GetDrivePodcastCountL(aDrive);
+
+    return total;
+    }
+
+// ----------------------------------------------------------------------------
+// Get all records count for podcasts
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::GetPodcastUriArrayL(TInt aDrive, TInt aFromID, TInt aRecords,
+                                               CDesCArray& aUriArr, TInt& aLastID)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetTotalUriArrayL");
+
+    iDbPodcast->GetPodcastUriArrayL(aDrive,aFromID,aRecords,aUriArr,aLastID);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXPodcastDbHandler::DoCleanupDeletedRecordsL
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::DoCleanupDeletedRecordsL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::DoCleanupDeletedRecordsL");
+
+    // delete all marked records from the Music table
+    iDbPodcast->CleanupL();
+
+    // reset the count in the Auxiliary table
+    iDbAuxiliary->SetSaveDeletedRecordCountL(KDbManagerAllDrives,0);
+    }
+
+// ----------------------------------------------------------------------------
+// FindAllL helper
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::FindAllL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::FindAllL");
+
+    RArray<TMPXAttribute> attributes;
+    CleanupClosePushL (attributes);
+    MPXUser::MergeAttributeL(aAttrs, attributes);
+
+    // TODO: b10liu: update all users to properly use podcast category?
+    // Some users of FindAll still call without specifying a podcast category group(ie.. delete helper)
+    // so need to check and use media category instead if not available.
+    if (!aCriteria.IsSupported(KMPXMediaPodcastCategoryGroup))
+        {
+        if (!aCriteria.IsSupported(KMPXMediaGeneralCategory))
+            {
+            User::Leave(KErrArgument);
+            }
+        TMPXGeneralCategory category = aCriteria.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory);
+
+        switch (category)
+            {
+            case EMPXAlbum:
+                {
+                if (!aCriteria.IsSupported(KMPXMediaGeneralId))
+                    {
+                    User::Leave(KErrArgument);
+                    }
+                // return all episodes within this title
+                TMPXItemId episodeTitleId = aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+                GetEpisodesMatchingTitleL(episodeTitleId, aAttrs, aMediaArray);
+                break;
+                }
+            case EMPXPodcast:
+            case EMPXSong:
+                {
+                FindEpisodesL(aCriteria, attributes.Array(), aMediaArray);
+                break;
+                }
+            case EMPXGenre:
+            case EMPXPlaylist:
+            case EMPXArtist:
+            case EMPXComposer:
+            default:
+                {
+                DbCategoryL(category)->FindAllL(aCriteria, attributes.Array(), aMediaArray);
+                break;
+                }
+            }
+        }
+    else
+        {
+        TMPXPodcastCategory category =
+             aCriteria.ValueTObjectL<TMPXPodcastCategory>(KMPXMediaPodcastCategoryGroup);
+
+        switch (category)
+            {
+            case EMPXTitle:
+                {
+                if (!aCriteria.IsSupported(KMPXMediaGeneralId))
+                    {
+                    User::Leave(KErrArgument);
+                    }
+                // return all episodes within this title
+                TMPXItemId episodeTitleId = aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+                GetEpisodesMatchingTitleL(episodeTitleId, aAttrs, aMediaArray);
+                break;
+                }
+            case EMPXPubDate:
+                {
+                if (!aCriteria.IsSupported(KMPXMediaGeneralId))
+                    {
+                    User::Leave(KErrArgument);
+                    }
+
+                TMPXItemId categoryId = aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+
+                // zero out the high 4 bits which indicate the general category
+                categoryId.iId2 &= 0x00FFFFFF;
+                GetEpisodesMatchingPublishPlaylistL(categoryId.iId2 + KPublishTodayPlaylistUID, // offset by KPublishTodayPlaylistUID
+                    aAttrs, EFalse, aMediaArray);
+                break;
+                }
+            case EMPXRecentlyAdded:
+            case EMPXNotYetPlayed:
+                {
+                break;
+                }
+            case EMPXAll:
+            case EMPXEpisode:
+            case EMPXNew:
+            case EMPXPartlyPlayed:
+            case EMPXCompletelyPlayed:
+                {
+                FindEpisodesL(aCriteria, attributes.Array(), aMediaArray);
+                break;
+                }
+            default:
+                User::Leave(KErrNotSupported);
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&attributes);
+    }
+
+// ----------------------------------------------------------------------------
+// Get episode(s) from the music table that match the given criteria
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::FindEpisodesL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::FindEpisodesL");
+
+    TMPXGeneralType type(EMPXNoType);
+    if (!aCriteria.IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+    type = aCriteria.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+
+    TMPXPodcastType podcastType(EMPXPodcastNoType);
+    if (aCriteria.IsSupported(KMPXMediaPodcastType))
+        {
+        podcastType = aCriteria.ValueTObjectL<TMPXPodcastType>(KMPXMediaPodcastType);
+        }
+
+    TUint32 id(0);
+    if (aCriteria.IsSupported(KMPXMediaGeneralId))
+        {
+        id = aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+        }
+
+    TUint32 containerId(0);
+    if (aCriteria.IsSupported(KMPXMediaGeneralContainerId))
+        {
+        containerId = aCriteria.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralContainerId);
+        }
+
+    MPX_TRAPD(err, iDbPodcast->FindEpisodesL(id, containerId, type, podcastType,
+        aCriteria, aAttrs, aMediaArray));
+    if (err == KErrNotSupported)
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    User::LeaveIfError(err);
+    }
+
+// ----------------------------------------------------------------------------
+// Add episode to collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXPodcastDbHandler::DoAddEpisodeL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::DoAddEpisodeL");
+
+    if (!aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TDriveUnit drive(aMedia.ValueText(KMPXMediaGeneralUri));
+    return iDbPodcast->AddEpisodeL(aMedia, drive);
+    }
+
+// ----------------------------------------------------------------------------
+// Update a episode in the collection
+// ----------------------------------------------------------------------------
+//
+CMPXDbActiveTask::TChangeVisibility CMPXPodcastDbHandler::DoUpdateEpisodeL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::DoUpdateEpisodeL");
+
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+    TUint32 curId(0);
+    TUint32 newId(0);
+    TInt curDrive(KErrNotFound);
+    TInt newDrive(KErrNotFound);
+
+    // find the episode by Id and update it
+    if( aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        curId = (aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId)).iId2;
+        curDrive = iDbPodcast->GetDriveL(curId);
+        }
+    // find the episode by URI and update it
+    if(aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        const TDesC& uri = aMedia.ValueText(KMPXMediaGeneralUri);
+        if (uri.Length() == 0)
+            {
+            User::Leave( KErrArgument );
+            }
+
+        newDrive = TDriveUnit(uri);
+        newId = MPXDbCommonUtil::GenerateUniqueIdL(iFs, EMPXCollection, uri, EFalse);
+        }
+    if (!curId && !newId)
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    TInt driveId = (curDrive != KErrNotFound) ? curDrive : newDrive;
+
+    if (driveId != KErrNotFound)
+        {
+        TUint32 episodeId = curId ? curId : newId;
+
+        // Update the Podcast table
+        visibleChange = iDbPodcast->UpdateEpisodeL(episodeId, aMedia, aItemChangedMessages);
+        }
+
+    return visibleChange;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXPodcastDbHandler::DoRemoveEpisodeL
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::DoRemoveEpisodeL(
+    TUint32 aEpisodeId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages,
+    TBool aDeleteRecord)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::DoRemoveEpisodeL");
+
+    TBool deleteRecord(ETrue);
+
+#if defined (__MTP_PROTOCOL_SUPPORT)
+    // Mark the song record as deleted if the following is true; otherwise, delete the
+    // song record.
+    //
+    // A client other than MTP has initiated this song deletion (aDeleteRecord is EFalse)
+    // and MTP has turned on its cenrep key to save deleted records and current number of
+    // saved deleted records has not exceeded its maximum, KMCMaxSavedDeletedRecords.
+    //
+    // Songs are marked as deleted in order to support auto-sync. MTP will delete these
+    // marked records at the end of each session via CleanupDeletedMediasL.
+    //
+    // For performance consideration, if the number of saved records exceeds its maximum,
+    // song record will be deleted.
+    if (!aDeleteRecord && SaveDeletedSongs())
+        {
+        TUint32 savedDeletedRecordCount(iDbAuxiliary->SaveDeletedRecordCountL());
+        MPX_DEBUG2("Current number of saved deleted record count is %d", savedDeletedRecordCount);
+
+        if (savedDeletedRecordCount < KMCMaxSavedDeletedRecords)
+            {
+            deleteRecord = EFalse;
+            TInt drive = iDbPodcast->GetDriveL(aEpisodeId);
+            TUint32 savedDeletedDriveRecordCount(iDbAuxiliary->SaveDeletedRecordCountL(drive));
+            iDbAuxiliary->SetSaveDeletedRecordCountL(drive,++savedDeletedDriveRecordCount);
+            }
+        }
+#endif
+
+    // delete the episode
+    iDbPodcast->DeleteEpisodeL(aEpisodeId, aUriArray, aItemChangedMessages, deleteRecord);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXPodcastDbHandler::DoRemoveEpisodesMatchingCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::DoRemoveEpisodesMatchingCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingCategoryL");
+    iDbPodcast->DeleteCategoryL(aCategory, aCategoryId, aUriArray,
+        aItemChangedMessages);
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL(
+    TUint32 aCategoryId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL");
+
+    switch (aCategoryId + KPublishTodayPlaylistUID)
+        {
+        case KPublishTodayPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL: Published Today"));
+            iDbPodcast->DeleteTodayEpisodesL(aUriArray, aItemChangedMessages);
+            break;
+
+        case KPublishYesterdayPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL: Published Yesterday"));
+            iDbPodcast->DeleteYesterdayEpisodesL(aUriArray, aItemChangedMessages);
+            break;
+
+        case KPublishThisWeekPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL: Published This Week"));
+            iDbPodcast->DeleteThisWeekEpisodesL(aUriArray, aItemChangedMessages);
+            break;
+
+        case KPublishLastWeekPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL: Published Last Week"));
+            iDbPodcast->DeleteLastWeekEpisodesL(aUriArray, aItemChangedMessages);
+            break;
+
+        case KPublish2WeeksAgoPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL: Published 2 Weeks Ago"));
+            iDbPodcast->Delete2WeeksAgoEpisodesL(aUriArray, aItemChangedMessages);
+            break;
+
+        case KPublish3WeeksAgoPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL: Published 3 Weeks Ago"));
+            iDbPodcast->Delete3WeeksAgoEpisodesL(aUriArray, aItemChangedMessages);
+            break;
+
+        case KPublishLastMonthPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL: Published Last Month"));
+            iDbPodcast->DeleteLastMonthEpisodesL(aUriArray, aItemChangedMessages);
+            break;
+
+        case KPublishEarlierPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL: Published Earlier"));
+            iDbPodcast->DeleteEarlierEpisodesL(aUriArray, aItemChangedMessages);
+            break;
+
+        case KPublishUnknownPlaylistUID:
+            MPX_DEBUG1 (_L("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL: Published Unknown"));
+            iDbPodcast->DeleteUnknownEpisodesL(aUriArray, aItemChangedMessages);
+            break;
+
+        default:
+            MPX_DEBUG2 (_L("CMPXPodcastDbHandler::DoRemoveEpisodesMatchingPublishDateCategoryL: Invalid publish date ID [%d]"), aCategoryId);
+            // TODO: Leave with error?
+            break;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXPodcastDbHandler::ProcessPodcastFoldersL
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::ProcessPodcastFoldersL(
+    const CDesCArray& aFolders)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::ProcessPodcastFoldersL");
+
+    TInt count(aFolders.MdcaCount());
+    for (TInt i = 0; i < count; ++i)
+        {
+        TPtrC16 folder = aFolders.MdcaPoint(i);
+
+        // check if disk is inserted and act accordingly
+        TDriveUnit driveUnit(folder);
+        if (!iFs.IsValidDrive(driveUnit))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        // append the drive to the drive list
+        iDbDrives.AppendL(driveUnit);
+
+        // make sure the folder is created
+        TVolumeInfo info;
+        if (iFs.Volume(info, driveUnit) == KErrNone)
+           {
+            if (!BaflUtils::PathExists(iFs, folder))
+                {
+                // create music folder if necessary
+                TInt err(iFs.MkDirAll(folder));
+                MPX_DEBUG3("Try to create podcast folder %S return code %d", &folder, err);
+                if (err != KErrAlreadyExists)
+                    {
+                    User::LeaveIfError(err);
+                    }
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXPodcastDbHandler::DbCategoryL
+// ----------------------------------------------------------------------------
+//
+CMPXDbCategory* CMPXPodcastDbHandler::DbCategoryL(
+    TMPXGeneralCategory aCategory) const
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::DbCategoryL");
+
+    CMPXDbCategory* dbCategory(NULL);
+    switch (aCategory)
+        {
+        case EMPXArtist:
+            {
+            dbCategory = iDbArtist;
+            break;
+            }
+        case EMPXAlbum:
+            {
+            dbCategory = iDbAlbum;
+            break;
+            }
+        case EMPXGenre:
+            {
+            dbCategory = iDbGenre;
+            break;
+            }
+        case EMPXComposer:
+            {
+            dbCategory = iDbComposer;
+            break;
+            }
+        default:
+            User::Leave(KErrNotSupported);
+        }
+
+    return dbCategory;
+    }
+
+// ----------------------------------------------------------------------------
+// Starts a transaction on all databases
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::BeginTransactionL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::BeginTransactionL");
+    iDbManager->BeginL();
+    }
+
+// ----------------------------------------------------------------------------
+// Ends a transaction on all databases
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::EndTransactionL(
+    TInt aError)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::EndTransactionL");
+
+    if (aError)
+        {
+        iDbManager->RollbackL();
+        
+        // KSqlDbCorrupted indicates DB corrupted, need to recreate.
+        if ( aError != KSqlDbCorrupted )
+            {
+            User::Leave(aError);
+            }
+        }
+    else
+        {
+        iDbManager->CommitL();
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Checks if the database is currently in a transaction
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbHandler::InTransaction()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::InTransaction");
+    return iDbManager->InTransaction();
+    }
+
+// ----------------------------------------------------------------------------
+// Verifies that the volume ID of the database matches the drive
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::VerifyVolumeIdL()
+    {
+    MPX_DEBUG1("CMPXPodcastDbHandler::VerifyVolumeIdL <--");
+
+    TInt count( iDbDrives.Count() );
+    for( TInt i=0; i<count; ++i )
+        {
+        if( iDbManager->IsOpen(iDbDrives[i]) )
+            {
+            TVolumeInfo volInfo;
+            iFs.Volume(volInfo, iDbDrives[i] );
+            TUint curId(volInfo.iUniqueID);
+
+            TInt volId = iDbAuxiliary->IdL( iDbDrives[i] );
+
+            // New database, no volume id set, mask out top bit because this is an uint
+            //
+            MPX_DEBUG3("CMPXPodcastDbHandler::VerifyVolumeIdL drive:%i db:%i", curId, volId);
+            if( volId == 0 )
+                {
+                MPX_DEBUG1("CMPXPodcastDbHandler::VerifyVolumeIdL -- New ID");
+                BeginTransactionL();
+                TRAPD( err, iDbAuxiliary->SetIdL( iDbDrives[i], curId&0x7FFFFFFF ) );
+                EndTransactionL( err );
+
+                // KSqlDbCorrupted indicates DB corrupted, need to recreate.
+                if ( err == KSqlDbCorrupted )
+                    {
+                    MPX_DEBUG1("CMPXPodcastDbHandler::VerifyVolumeIdL -- Corrupted DB");
+                    iDbManager->RecreateDatabaseL(iDbDrives[i]);
+                    BeginTransactionL();
+                    TRAPD(err, iDbAuxiliary->SetDBCorruptedL( ETrue ) );
+                    EndTransactionL( err );
+                    }
+                }
+            // Unmatched volume id, mark db as corrupt
+            //
+            else if ( (curId&0x7FFFFFFF) != (volId&0x7FFFFFFFF) )
+                {
+                MPX_DEBUG1("CMPXPodcastDbHandler::VerifyVolumeIdL -- ID match FAILED");
+                iDbManager->RecreateDatabaseL(iDbDrives[i]);
+                BeginTransactionL();
+                TRAPD(err, iDbAuxiliary->SetDBCorruptedL( ETrue ) );
+                EndTransactionL( err );
+                }
+            }
+        }
+    MPX_DEBUG1("CMPXPodcastDbHandler::VerifyVolumeIdL -->");
+    }
+
+// ----------------------------------------------------------------------------
+// Checks if there is a drive that has a low disk space
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::CheckDiskSpaceOnDrivesL()
+    {
+    MPX_DEBUG1("CMPXPodcastDbHandler::CheckDiskSpaceOnDrivesL <--");
+
+    TInt count( iDbDrives.Count() );
+    for( TInt index=0; index<count; ++index )
+        {
+        iDbManager->CheckDiskSpaceL(iDbDrives[index]);
+        }
+    MPX_DEBUG1("CMPXPodcastDbHandler::CheckDiskSpaceOnDrivesL -->");
+    }
+#if defined (__MTP_PROTOCOL_SUPPORT)
+
+// ----------------------------------------------------------------------------
+// CMPXPodcastDbHandler::SaveDeletedSongs
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbHandler::SaveDeletedSongs()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::SaveDeletedSongs");
+
+    TBool saveDeletedSongs(ETrue);
+    CRepository* cenrep(NULL);
+    MPX_TRAPD(error, cenrep = CRepository::NewL(KMPXMtpSettings));
+    if (!error)
+        {
+        cenrep->Get(KMPXMtpSaveDeletedRecordFlag, saveDeletedSongs);
+        delete cenrep;
+        MPX_DEBUG2("MTP indicated to save deleted songs? %d", saveDeletedSongs);
+        }
+
+    return saveDeletedSongs;
+    }
+
+#endif
+
+// ----------------------------------------------------------------------------
+// CMPXPodcastDbHandler::AddCategoryItemL
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXPodcastDbHandler::AddCategoryItemL(
+    TMPXGeneralCategory aCategory,
+    const TDesC& aName,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::AddCategoryItemL");
+
+    TBool newRecord(EFalse);
+    TUint32 id(DbCategoryL(aCategory)->AddItemL(aName, aDriveId, newRecord,
+        (aCategory != EMPXGenre)));
+    if (newRecord && aItemChangedMessages)
+        {
+        MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, id,
+            EMPXItemInserted, aCategory, KDBPluginUid);
+        }
+
+    return id;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXPodcastDbHandler::DeleteEpisodeForCategoryL
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbHandler::DeleteEpisodeForCategoryL(
+    TMPXGeneralCategory aCategory,
+    TUint32 aCategoryId,
+    TInt aDriveId,
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::DeleteEpisodeForCategoryL");
+    DbCategoryL(aCategory)->DecrementEpisodesForCategoryL(aCategoryId, aDriveId,
+        aItemChangedMessages);
+    }
+
+#ifdef RD_MULTIPLE_DRIVE
+
+// ----------------------------------------------------------------------------------------------------------
+// Retrieve all visible podcast folder locations
+// ----------------------------------------------------------------------------------------------------------
+//
+CDesCArrayFlat* CMPXPodcastDbHandler::GetPodcastFoldersL()
+    {
+    MPX_FUNC("CMPXPodcastDbHandler::GetPodcastFoldersL()");
+    TDriveList driveList;
+    TInt driveCount(0);
+    User::LeaveIfError(DriveInfo::GetUserVisibleDrives(iFs, driveList, driveCount));
+    MPX_DEBUG2 ("CMPXDbHandler::GetPodcastFoldersL() - driveCount = %d", driveCount);
+
+    CDesCArrayFlat* folders = new (ELeave) CDesCArrayFlat(1); // granularity
+    CleanupStack::PushL(folders);
+
+    for (TInt i = EDriveA; i <= EDriveZ; i++)
+        {
+        if ((driveList[i]) && (!IsRemoteDrive(static_cast<TDriveNumber>(i))))
+            {
+            if (i == EDriveC)
+                {
+                // Append the default phone memory path to the list
+                // of music folders
+                TPtrC rootPath(PathInfo::PhoneMemoryRootPath());
+                folders->AppendL(rootPath);
+                MPX_DEBUG2("CMPXDbHandler::GetPodcastFoldersL() - adding...%S", &rootPath);
+                }
+            else
+                {
+                // Get drive letter
+                TChar driveChar;
+                User::LeaveIfError(iFs.DriveToChar(i, driveChar));
+
+                // Append visible drive to list of music folders
+                TBuf<2> drive;
+                drive.Append(driveChar);
+                drive.Append(_L(":"));
+                folders->AppendL(drive);
+                MPX_DEBUG2 ("CMPXDbHandler::GetPodcastFoldersL() - adding...%S", &drive);
+                }
+            }
+        }
+
+    CleanupStack::Pop(folders);
+    return folders;
+    }
+
+#endif // RD_MULTIPLE_DRIVE
+
+// ---------------------------------------------------------------------------
+// CMPXPodcastDbHandler::IsRemoteDrive
+// ---------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbHandler::IsRemoteDrive(TDriveNumber aDrive)
+    {
+    return iDbManager->IsRemoteDrive(aDrive);
+    }
+
+// End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbmanager.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class is responsible for managing all of podcast collection
+*                databases.
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxlog.h>
+#include "mpxpodcastcollectiondbdef.h"
+#include "mpxpodcastdbmanager.h"
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXPodcastDbManager* CMPXPodcastDbManager::NewL(
+    RFs& aFs)
+    {
+    MPX_FUNC("CMPXPodcastDbManager::NewL");
+
+    CMPXPodcastDbManager* self = CMPXPodcastDbManager::NewLC(aFs);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXPodcastDbManager* CMPXPodcastDbManager::NewLC(
+    RFs& aFs)
+    {
+    MPX_FUNC("CMPXPodcastDbManager::NewLC");
+
+    CMPXPodcastDbManager* self = new (ELeave) CMPXPodcastDbManager(aFs);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXPodcastDbManager::~CMPXPodcastDbManager()
+    {
+    MPX_FUNC("CMPXPodcastDbManager::~CMPXPodcastDbManager");
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMPXPodcastDbManager::CMPXPodcastDbManager(
+    RFs& aFs) :
+    CMPXDbManager(aFs)
+    {
+    MPX_FUNC("CMPXPodcastDbManager::CMPXPodcastDbManager");
+    }
+
+// ----------------------------------------------------------------------------
+// Second phase constructor.
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbManager::ConstructL()
+    {
+    MPX_FUNC("CMPXPodcastDbManager::ConstructL");
+    CMPXDbManager::ConstructL(TFileName(KMCDbFile));
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3194 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of podcast collection DB Plugin interface
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32cmn.h>
+#include <PCRes.rsg>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+
+#include <mpxpodcastdbplugin.mbg>
+#include <mpxcmn.h>
+#include <mpxcollectionpluginobserver.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxmessagecontainerdefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxdrmmediautility.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxlog.h>
+#ifdef RD_MULTIPLE_DRIVE
+#include <driveinfo.h>
+#endif //RD_MULTIPLE_DRIVE
+
+#include "mpxdbcommondef.h"
+#include "mpxresource.h"
+#include "mpxdbcommonstd.h"
+#include "mpxdbcommonutil.h"
+
+#include "mpxpodcastcollectiondbstd.h"
+#include "mpxpodcastdbhandler.h"
+#include "mpxdbutil.h"
+#include "mpxpodcastcollectiondbdef.h"
+#include "mpxpodcastcollectiondb.hrh"
+#include "mpxpodcastdbplugin.h"
+
+// CONSTANTS
+_LIT(KMPlayerDbPluginMbmFile, "mpxpodcastdbplugin.mif");
+const TInt KIncrementalDeleteCount = 400;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXPodcastDbPlugin* CMPXPodcastDbPlugin::NewL(
+    TAny* /* aInitParams */)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::NewL");
+
+    CMPXPodcastDbPlugin* self = new (ELeave) CMPXPodcastDbPlugin();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CMPXPodcastDbPlugin::~CMPXPodcastDbPlugin()
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::~CMPXPodcastDbPlugin");
+
+    iSelections.Reset();
+    iSelections.Close();
+    iFs.Close();
+    delete iDbHandler;
+    delete iDrmMediaUtility;
+    if (iResource)
+        {
+        iResource->Release();
+        }
+    iPodcastLibraryMainMenuItemIds.Close();
+    delete iPodcastLibraryMainMenuItemTitles;
+    delete iPodcastLibraryTitles;
+    iPodcastPublishDateIds.Close();
+    delete iPodcastTitlePublishDateCat;
+    iPodcastEpisodeViewPublishDateIds.Close();
+    delete iPodcastEpisodeViewPublishDateTitle;
+    delete iTitleMyPodcast;
+    delete iTitleAllEpisodes;
+    delete iTitlePubDate;
+    delete iTitleTitles;
+    delete iTitleAdded;
+    delete iTitleUnplayed;
+
+    if (iActiveTask)
+        {
+        iActiveTask->Cancel();
+        delete iActiveTask;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXPodcastDbPlugin::CMPXPodcastDbPlugin()
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::CMPXPodcastDbPlugin");
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::ConstructL ()
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::ConstructL");
+    iFirstDeleteStep = ETrue;
+    User::LeaveIfError(iFs.Connect());
+    iDrmMediaUtility = CMPXDrmMediaUtility::NewL();
+
+    TParse parse;
+    parse.Set( KMPXCollectionDbResourceFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resFile(parse.FullName());
+    User::LeaveIfError(MPXUser::CompleteWithDllPath(resFile));
+    BaflUtils::NearestLanguageFile(iFs, resFile);
+    iResource = CMPXResource::NewL(resFile);
+
+    iDbHandler = CMPXPodcastDbHandler::NewL(iFs, *iResource);
+
+    iPodcastLibraryMainMenuItemTitles = iResource->ReadMenuArrayL(R_MC_MENU_ITEMS_ARRAY,
+        iPodcastLibraryMainMenuItemIds);
+    iPodcastTitlePublishDateCat = iResource->ReadMenuArrayL(R_MPX_QTN_NMP_PUBLISH_DATE_ARRAY,
+        iPodcastPublishDateIds);
+    iPodcastEpisodeViewPublishDateTitle = iResource->ReadMenuArrayL(
+        R_MPX_QTN_NMP_EPISODES_TITLE_PUBLISHED_DATE_ARRAY, iPodcastEpisodeViewPublishDateIds);
+    iTitleMyPodcast = iResource->ReadHBufCL(R_MPX_QTN_MP_TITLE_MY_PODCAST);
+    iTitleAllEpisodes = iResource->ReadHBufCL(R_MPX_QTN_MP_TITLE_ALL_EPISODES);
+    iTitlePubDate = iResource->ReadHBufCL(R_MPX_QTN_MUS_TITLE_PUBLISH_DATE);
+    iTitleTitles = iResource->ReadHBufCL(R_MPX_QTN_MP_TITLE_PODCASTS);
+    iTitleAdded = iResource->ReadHBufCL(R_MPX_QTN_MP_TITLE_RECENTLY_ADDED);
+    iTitleUnplayed = iResource->ReadHBufCL(R_MPX_QTN_MP_TITLE_UNPLAYED);
+    iPodcastLibraryTitles = iResource->ReadMenuArrayL(R_MC_MENU_TITLES_ARRAY,
+        iPodcastLibraryMainMenuItemIds);
+
+    iActiveTask = CMPXDbActiveTask::NewL(*this);
+    }
+
+// ----------------------------------------------------------------------------
+// Navigates to the given path
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::OpenL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXFilter* /*aFilter*/)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::OpenL");
+    MPX_DEBUG_PATH (aPath);
+
+    RArray<TMPXAttribute> openAttrs;
+    CleanupClosePushL(openAttrs);
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+
+    SetAttributesL(aPath, openAttrs, supportedIds);
+
+    CMPXMedia* entries = CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entries);
+
+    TInt error(KErrNone);
+    TBool isEpisode(EFalse);
+    CMPXCollectionPath* newPath(NULL);
+
+    TBool openingForPlayback(EFalse);
+
+    if(aAttrs.Count() == 1 &&
+       aAttrs[0].ContentId() == KMPXMediaIdPodcast)
+    {
+        if(aAttrs[0].AttributeId() & EMPXMediaPodcastSetIsPlayingTrue)
+        {
+        openingForPlayback = ETrue;
+        }
+    }
+
+    // Make sure we handle the correct open mode
+    //
+    TMPXOpenMode openmode = aPath.OpenNextMode();
+    switch (openmode)
+        {
+        case EMPXOpenGroupOrPlaylist:
+            {
+            MPX_TRAP(error, isEpisode = DoOpenL (
+                aPath, openAttrs.Array(), *entries, openingForPlayback));
+            break;
+            }
+
+        case EMPXOpenPlaylistOnly:
+            {
+            if( aPath.Count() > 0 )
+                {
+                // Try to open
+                MPX_TRAP(error, newPath = DoOpenPlaylistL(aPath, openAttrs.Array(), openingForPlayback));
+                CleanupStack::PushL(newPath);
+                isEpisode = ETrue;
+                }
+            else // no items, so open in normal mode
+                {
+                MPX_TRAP(error, isEpisode = DoOpenL (
+                    aPath, openAttrs.Array(), *entries, openingForPlayback));
+                }
+            break;
+            }
+        default:
+            // do nothing
+            break;
+        }
+
+    if (isEpisode)
+        {
+        if (openmode == EMPXOpenGroupOrPlaylist)
+            {
+            iObs->HandleOpen(const_cast<CMPXCollectionPath*>(&aPath), error);
+            }
+        else // openmode == EMPXOpenPlaylistOnly
+            {
+            iObs->HandleOpen(newPath, error);
+            }
+        }
+    else
+        {
+        MPX_DEBUG_PATH (aPath);
+
+        entries->SetCObjectValueL(KMPXMediaGeneralContainerPath,
+            const_cast<CMPXCollectionPath*>(&aPath));
+        iObs->HandleOpen(entries, error);
+        }
+
+    if (newPath)
+        {
+        CleanupStack::PopAndDestroy(newPath);
+        }
+
+    CleanupStack::PopAndDestroy(entries);
+    CleanupStack::PopAndDestroy(&openAttrs);
+    }
+
+// ----------------------------------------------------------------------------
+// Get the extended properties of the current file (async)
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::MediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    const TArray<TCapability>& /*aCaps*/,
+    CMPXAttributeSpecs* /*aSpecs*/)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::MediaL");
+    MPX_DEBUG_PATH(aPath);
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    if (aPath.Selection().Count())
+        {
+        // it's a container if there are multiple selection, else it's not a container
+        supportedIds.AppendL(KMPXMediaIdContainer);
+        }
+    MPXDbCommonUtil::FillInSupportedUIDsL (aAttrs, supportedIds);
+    CMPXMedia* entries = CMPXMedia::NewL(supportedIds.Array());
+    CleanupStack::PopAndDestroy(&supportedIds);
+    CleanupStack::PushL(entries);
+
+    DoMediaL(aPath, aAttrs, *entries);
+
+    // Also fetch collection details
+    DoHandleOtherMediaAttributesL(aAttrs, aPath, *entries);
+
+    iObs->HandleMedia(entries, KErrNone);
+    CleanupStack::PopAndDestroy(entries);
+    }
+
+// ----------------------------------------------------------------------------
+// Cancel outstanding request
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::CancelRequest()
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::CancelRequest");
+    iActiveTask->Cancel();
+    }
+
+// ----------------------------------------------------------------------------
+// Executes the given command on the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::CommandL(
+    TMPXCollectionCommand aCmd,
+    TInt aArg /* = 0 */)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::CommandL");
+
+    switch (aCmd)
+        {
+        case EMcCmdRemoveAll:
+            {
+            MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - EMcCmdRemoveAll");
+            // Remove EVERYthing from the collection
+            iDbHandler->RemoveEntireCollectionL();
+            break;
+            }
+        case EMcCmdClose:
+        case EMcCloseCollection:
+            {
+            MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - EMcCloseCollection");
+            // Close the specified database
+ #ifdef RD_MULTIPLE_DRIVE
+            MPX_DEBUG1("Multiple drives closing databases");
+            if ( aArg <0)
+                {
+                DriveInfo::TDriveArray driveArray;
+                User::LeaveIfError ( DriveInfo::GetUserVisibleDrives ( iFs, driveArray));
+                TInt count( driveArray.Count ());
+                for (TInt i=0; i<count; ++i)
+                    {
+                    MPX_DEBUG2("At drive %i", driveArray[i]);
+                    if ((driveArray[i] != EDriveC) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i])))) 
+                        {
+                        MPX_DEBUG2("Closing database %i", driveArray[i]);
+                        TRAP_IGNORE( iDbHandler->CloseDatabaseL( driveArray[i] ) );
+                        }
+                    }
+                }
+            else
+                {
+                iDbHandler->CloseDatabaseL (aArg);
+                }
+ #else
+            iDbHandler->CloseDatabaseL(aArg);
+ #endif // RD_MULTIPLE_DRIVE
+            break;
+            }
+        case EMcReOpenCollection:
+            {
+            MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - EMcReOpenCollection");
+            // Open the specified database
+#ifdef RD_MULTIPLE_DRIVE
+            MPX_DEBUG1("Multiple drives opening databases");
+            DriveInfo::TDriveArray driveArray;
+            User::LeaveIfError( DriveInfo::GetUserVisibleDrives( iFs, driveArray ) );
+            TInt count( driveArray.Count() );
+            for( TInt i=0; i<count; ++i )
+                {
+                MPX_DEBUG2("At drive %i", driveArray[i]);
+                if (( driveArray[i] != EDriveC ) && (!iDbHandler->IsRemoteDrive(static_cast<TDriveNumber>(driveArray[i])))) 
+                    {
+                    TUint driveStatus(0);
+                    User::LeaveIfError( DriveInfo::GetDriveStatus(
+                        iFs, driveArray[i], driveStatus ) );
+                    if( driveStatus & DriveInfo::EDrivePresent )
+                        {
+                        MPX_DEBUG2("Opening database %i", driveArray[i]);
+                        TRAP_IGNORE( iDbHandler->OpenDatabaseL( driveArray[i] ) );
+                        }
+                    }
+                }
+#else
+            iDbHandler->OpenDatabaseL(aArg);
+#endif // RD_MULTIPLE_DRIVE
+            break;
+            }
+        case EMcRefreshStarted:
+            {
+            MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - EMcRefreshStarted");
+            iDbHandler->RefreshStartL();
+            iRefreshing = ETrue;
+            break;
+            }
+        case EMcRefreshEnded:
+            {
+            MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - EMcRefreshEnded");
+            // ask the handler to finalize the transaction
+            iDbHandler->RefreshEndL();
+            iRefreshing = EFalse;
+            break;
+            }
+         case EMcCmdReCreateDB:
+            {
+            // Recreate all databases
+            MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - EMcCmdReCreateDB");
+            iDbHandler->ReCreateDatabasesL();
+            break;
+            }
+         case EMcCmdDbCorrupted:
+            {
+            MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - EMcCmdDbCorrupted");
+            iDbHandler->SetDBCorruptedL(ETrue);
+            break;
+            }
+        case EMcCmdCollectionInit:
+        case EMcCmdRefresh:
+        case EMcCmdCollectionResyn:
+            {
+            // deprecated
+            break;
+            }
+        case EMcCmdMtpStart:
+            iMtpInUse = ETrue;
+            break;
+        case EMcCmdMtpEnd:
+            iMtpInUse = EFalse;
+            break;
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Executes the given command on the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::CommandL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::CommandL");
+
+    if (!aCmd.IsSupported(KMPXCommandGeneralId))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TMPXCommandId commandId = aCmd.ValueTObjectL<TMPXCommandId>(KMPXCommandGeneralId);
+
+    TBool syncOp(EFalse);
+    if( aCmd.IsSupported(KMPXCommandGeneralDoSync) )
+        {
+        syncOp = aCmd.ValueTObjectL<TBool>(KMPXCommandGeneralDoSync);
+        }
+
+    // Handle this operation synchronously or asynchronously
+    if( !syncOp )
+        {
+        iActiveTask->StartL(commandId, aCmd);
+        }
+    else  // Sync operation
+        {
+        switch (commandId)
+            {
+            case KMPXCommandIdCollectionRetrieveUriForDeletion:
+                {
+                MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - KMPXCommandIdCollectionRetrieveUriForDeletion");
+                DoRetrieveUriForDeletionL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionRemove:
+                {
+                MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - KMPXCommandIdCollectionRemove");
+                if (iFirstDeleteStep )
+                    {
+                    iFirstDeleteStep = EFalse;
+                    }
+                DoRemovePathL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionRemoveMedia:
+                {
+                MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - KMPXCommandIdCollectionRemoveMedia");
+                DoRemoveMediaL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionCleanupDeletedMedias:
+                {
+                MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - KMPXCommandIdCollectionCleanupDeletedMedias");
+                CleanupDeletedRecordsL(aCmd);
+                break;
+                }
+            case KMPXCommandIdCollectionAdd:
+                {
+                MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - KMPXCommandIdCollectioAdd");
+                CMPXMedia* media = aCmd.Value<CMPXMedia>(KMPXCommandColAddMedia);
+                User::LeaveIfNull( media );
+                TInt id = DoAddL(*media);
+                aCmd.SetTObjectValueL<TMPXItemId>(KMPXCommandColAddRtnId, id);
+                break;
+                }
+            case KMPXCommandIdCollectionSet:
+                {
+                MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - KMPXCommandIdCollectionSet");
+                CMPXMedia* media = aCmd.Value<CMPXMedia>(KMPXCommandColSetMedia);
+                User::LeaveIfNull( media );
+                DoSetL(*media);
+                break;
+                }
+            case KMPXCommandIdCollectionCompleteDelete:
+                {
+                MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - KMPXCommandIdCollectionCompleteDelete");
+                DoHandleDeleteCompleteL(aCmd);
+                break;
+                }
+            case KMPXCommandIdUpdateRefreshTime:
+                {
+                MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - KMPXCommandIdUpdateRefreshTime");
+                TTime curTime;
+                curTime.HomeTime();
+                iDbHandler->SetLastRefreshedTimeL(curTime);
+                break;
+                }
+            case KMPXCommandCollectionGetCount:
+                {
+                MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - KMPXCommandCollectionGetCount");
+                DoGetCollectionCountL(aCmd);
+                break;
+                }
+            case KMPXCommandCollectionGetURIs:
+                {
+                MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - KMPXCommandCollectionGetURIs");
+                DoGetCollectionUriL(aCmd);
+                break;
+                }
+            default:
+                {
+                User::Leave(KErrNotSupported);
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Adds a podcast to the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::AddL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::AddL");
+    DoAddL(aMedia);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given path
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::RemoveL(
+    const CMPXCollectionPath& aPath)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::RemoveL(by path)");
+    MPX_DEBUG_PATH(aPath);
+
+    CMPXMessageArray* msgAry = CMPXMessageArray::NewL();
+    CleanupStack::PushL( msgAry );
+
+    // Return file path for deleted item(s)
+    CDesCArray* fp = DoRemoveL(aPath,*msgAry);
+
+    iObs->HandleRemove(*fp, KErrNone);
+    delete fp;
+
+    // Send Change Messages
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+    DoHandleChangeL(msgAry);
+    CleanupStack::PopAndDestroy( msgAry );
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given media properties
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::RemoveL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::RemoveL(by media)");
+    DoRemoveL(aMedia, EFalse);
+    }
+
+// ----------------------------------------------------------------------------
+// Sets/updates the media for an item in the collection
+// DEPRECATED for week 18
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::SetL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::SetL");
+    DoSetL(aMedia);
+    }
+
+// ----------------------------------------------------------------------------
+// Find the items matching the media specifications
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::FindAllL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::FindAllL");
+
+    CMPXMedia* entries = FindAllSyncL(aCriteria, aAttrs);
+
+    // notify client. if FindAllL leaves, framework will notify client of the error
+    iObs->HandleFindAll(entries, KErrNone);
+    delete entries;
+    }
+
+// ----------------------------------------------------------------------------
+// Find the items matching the media specifications
+// ----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXPodcastDbPlugin::FindAllSyncL(
+    const CMPXMedia& aCriteria,
+    const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::FindAllSyncL");
+
+    CMPXMedia* entries = iDbHandler->FindAllLC(aCriteria, aAttrs);
+    CleanupStack::Pop(entries);
+
+    return entries;
+    }
+
+// ----------------------------------------------------------------------------
+// Get the list of supported capabilities
+// ----------------------------------------------------------------------------
+//
+TCollectionCapability CMPXPodcastDbPlugin::GetCapabilities()
+    {
+    // This one supports simple search
+    return EMcSearch;
+    }
+
+// ----------------------------------------------------------------------------
+// Get the list of supported capabilities
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbPlugin::HandleStepL()
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::HandleStepL");
+
+    TBool done(ETrue);
+
+    switch (iActiveTask->GetTask())
+        {
+        case KMPXCommandIdCollectionSet:
+            {
+            done = DoSetAsyncL();
+            break;
+            }
+        case KMPXCommandIdCollectionAdd:
+            {
+            done = DoAddAsyncL();
+            break;
+            }
+        case KMPXCommandIdCollectionRemove:
+            {
+            DoRemovePathL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionRemoveMedia:
+            {
+            DoRemoveMediaL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionRetrieveUriForDeletion:
+            {
+            DoRetrieveUriForDeletionL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionCleanupDeletedMedias:
+            {
+            CleanupDeletedRecordsL(iActiveTask->GetCommand());
+            done = ETrue;
+            break;
+            }
+        case KMPXCommandIdCollectionCompleteDelete:
+            {
+            DoHandleDeleteCompleteL( iActiveTask->GetCommand() );
+            break;
+            }
+        case KMPXCommandIdUpdateRefreshTime:
+            {
+            MPX_DEBUG1("CMPXPodcastDbPlugin::CommandL - KMPXCommandIdUpdateRefreshTime");
+            TTime curTime;
+            curTime.HomeTime();
+            iDbHandler->SetLastRefreshedTimeL(curTime);
+            break;
+            }
+        default:
+            {
+            // Should never happen!
+            ASSERT(0);
+            break;
+            }
+        }
+    return done;
+    }
+
+// ----------------------------------------------------------------------------
+// Handler for async operations completed
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::HandleOperationCompleted(
+    TInt aErr)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::HandleOperationCompleted");
+    TRAP_IGNORE(DoHandleOperationCompletedL(aErr));
+    }
+
+// ----------------------------------------------------------------------------
+// Process the OpenL command
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbPlugin::DoOpenL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+	CMPXMedia& aEntries,
+	TBool aFlagToSignalToBePlayed)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoOpenL");
+
+    CMPXMediaArray* array = CMPXMediaArray::NewL();
+    CleanupStack::PushL(array);
+
+    TInt count(0);
+    TInt levels(aPath.Levels());
+    TBool isEpisode(EFalse);
+
+    aEntries.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, aPath.Id(levels - 1));
+
+    if (1 == levels)
+        {
+        isEpisode = DoOpenBrowseTitleL(aPath, aAttrs, aEntries, *array);
+        }
+    else if (levels >= 2)
+        {
+        isEpisode = DoOpenBrowseTitleL(aPath, aAttrs, aEntries, *array);
+        }
+    else
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    if(isEpisode &&
+       aFlagToSignalToBePlayed)
+        {
+        // opening an episode to be played so set the IsPlaying flag to
+        // prevent this episode from being picked up as Not Yet Played
+        // (need to do this because setting last playback position causes
+        // visible change and the playlist to update)
+        if(array->Count() == 1)
+            {
+            // ignore the error because if there is a problem
+            // updating the media file, the error will show up
+            // when opening the track for playing and be handled
+            // properly by the playback engine and skipped
+            TRAP_IGNORE(iDbHandler->SetIsPlayingL(*((*array)[0]), ETrue));
+            }
+        }
+
+    aEntries.SetCObjectValueL(KMPXMediaArrayContents, array);
+    aEntries.SetTObjectValueL(KMPXMediaArrayCount, array->Count());
+
+    CleanupStack::PopAndDestroy(array);
+
+    return isEpisode;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseAll
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbPlugin::DoOpenBrowseAllL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoOpenBrowseAllL");
+
+    TInt levels(aPath.Levels());
+    switch (levels)
+       {
+       // All Episodes
+       case 2:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowseAllL_All);
+
+            iDbHandler->GetAllEpisodesL(aAttrs, aArray);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXPodcastGroup, EMPXAll,
+                *iTitleAllEpisodes, aArray.Count());
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowseAllL_All);
+            break;
+            }
+
+         // An episode in all episodes
+         case 3:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowseAllL_Episode);
+
+            iDbHandler->GetEpisodeL(aPath.Id(levels - 1), aAttrs, aArray);
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowseAllL_Episode);
+            break;
+            }
+
+         default:
+            {
+            MPX_DEBUG2("CMPXPodcastDbPlugin_DoOpenBrowseAllL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    return (levels == 3);
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowsePubDate
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbPlugin::DoOpenBrowsePubDateL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoOpenBrowsePubDateL");
+
+    TBool isEpisode(EFalse);
+    TInt levels(aPath.Levels());
+
+    switch (levels)
+        {
+        // All By Publish Date Categories
+        case 2:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowsePubDateL_All);
+
+            TInt numEpisodes(iDbHandler->GetEpisodesMatchingPublishPlaylistL(KPublishAllPlaylistUID, aAttrs,
+                    EFalse, aArray));
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXPodcastGroup, EMPXPubDate,
+                *iTitlePubDate);
+            aEntries.SetTObjectValueL(KMPXMediaGeneralNonPermissibleActions, EMPXCache );
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowsePubDateL_All);
+            break;
+            }
+        // All episodes within a specific By Publish Date category
+        case 3:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowsePubDateL_Playlist);
+            iNumberOfEpisodesInCurrentPublishDateCategory =
+                iDbHandler->GetEpisodesMatchingPublishPlaylistL(
+                (aPath.Id(levels - 1).iId2 & 0x00FFFFFF) + KPublishTodayPlaylistUID, // offset by KPublishTodayPlaylistUID
+                aAttrs, EFalse, aArray);
+
+            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXPodcastItem, EMPXEpisode,
+                iPodcastEpisodeViewPublishDateTitle->MdcaPoint(aPath.Id(levels - 1).iId2 & 0x00FFFFFF),
+                iNumberOfEpisodesInCurrentPublishDateCategory);
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowsePubDateL_Playlist);
+            break;
+            }
+        // An episode
+        case 4:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowsePubDateL_Episode);
+
+            iDbHandler->GetEpisodeL(aPath.Id(levels - 1), aAttrs, aArray);
+            isEpisode = ETrue;
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowsePubDateL_Episode);
+            break;
+            }
+        default:
+            {
+            MPX_DEBUG2("CMPXPodcastDbPlugin_DoOpenBrowsePubDateL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        }
+    return isEpisode;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseTitle
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbPlugin::DoOpenBrowseTitleL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoOpenBrowseTitleL");
+
+    TBool isEpisode(EFalse);
+    TInt levels(aPath.Levels());
+
+    switch (levels)
+         {
+         // All Titles
+		 case 1:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowseTitleL_All);
+
+            iDbHandler->GetAllPodcastTitlesL(aAttrs, aArray);
+
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXPodcastGroup, EMPXTitle,
+                *iTitleTitles);
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowseTitleL_All);
+            break;
+            }
+         // All episodes in a title
+		 case 2:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowseTitleL_Title);
+
+            iDbHandler->GetEpisodesMatchingTitleL(aPath.Id(levels - 1).iId2,
+                aAttrs, aArray);
+
+            HBufC* title = iDbHandler->GetTitleNameMatchingIdL(aPath.Id(levels - 1));
+            CleanupStack::PushL(title);
+            SetMediaGeneralAttributesL(aEntries, EMPXItem, EMPXPodcastItem, EMPXEpisode,
+                *title, aArray.Count());
+            CleanupStack::PopAndDestroy(title);
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowseTitleL_Title);
+            break;
+            }
+         // An episode within a title
+         case 3:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowseTitleL_Episode);
+            iDbHandler->GetEpisodeL(aPath.Id(levels - 1), aAttrs, aArray);
+            isEpisode = ETrue;
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowseTitleL_Episode);
+            break;
+            }
+
+         default:
+            {
+            MPX_DEBUG2("CMPXPodcastDbPlugin_DoOpenBrowseTitleL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+       }
+
+    return isEpisode;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseRecentlyAdded
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbPlugin::DoOpenBrowseRecentlyAddedL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoOpenBrowseRecentlyAddedL");
+
+    TBool isEpisode(EFalse);
+    TInt levels(aPath.Levels());
+
+    switch (levels)
+         {
+         case 2:
+            {
+            // All recently added episodes
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowseRecentlyAddedL_All);
+
+            TInt indexOfCurrentlyPlayingItem(KErrNotFound);
+            iDbHandler->GetEpisodesMatchingPlaylistL(KRecentlyAddedPlaylistUID,
+                    aAttrs, aArray, indexOfCurrentlyPlayingItem);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXPodcastGroup, EMPXRecentlyAdded,
+                *iTitleAdded, aArray.Count());
+            aEntries.SetTObjectValueL(KMPXMediaPodcastCurrentlyPlayingIndex,
+                indexOfCurrentlyPlayingItem);
+            // Fix for Autoplaylist, set the permission to not writable and cacheable
+            aEntries.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+                KMPXMediaGeneralNonPermissibleActions, (TMPXGeneralNonPermissibleActions)(EMPXWrite | EMPXCache));
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowseRecentlyAddedL_All);
+            break;
+            }
+         // An episode in the recently added episodes list
+         case 3:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowseRecentlyAddedL_Episode);
+            iDbHandler->GetEpisodeL(aPath.Id(levels - 1), aAttrs, aArray);
+            isEpisode = ETrue;
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowseRecentlyAddedL_Episode);
+            break;
+            }
+         default:
+            {
+            MPX_DEBUG2("CMPXPodcastDbPlugin_DoOpenBrowseRecentlyAddedL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    return isEpisode;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles OpenL called for EBrowseNotPlayed
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbPlugin::DoOpenBrowseNotPlayedL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoOpenBrowseNotPlayedL");
+
+    TBool isEpisode(EFalse);
+    TInt levels(aPath.Levels());
+
+    switch (levels)
+         {
+         case 2:
+            {
+            // All episodes that haven't been played
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowseNotPlayedL_All);
+
+            TInt indexOfCurrentlyPlayingItem(KErrNotFound);
+            iDbHandler->GetEpisodesMatchingPlaylistL(KNotPlayedPlaylistUID, aAttrs, aArray,
+                indexOfCurrentlyPlayingItem);
+            SetMediaGeneralAttributesL(aEntries, EMPXGroup, EMPXPodcastGroup, EMPXNotYetPlayed,
+                *iTitleUnplayed, aArray.Count());
+            aEntries.SetTObjectValueL(KMPXMediaPodcastCurrentlyPlayingIndex,
+                indexOfCurrentlyPlayingItem);
+            // Fix for Autoplaylist, set the permission to not writable and cacheable
+            aEntries.SetTObjectValueL<TMPXGeneralNonPermissibleActions>(
+                KMPXMediaGeneralNonPermissibleActions, (TMPXGeneralNonPermissibleActions)(EMPXWrite | EMPXCache));
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowseNotPlayedL_All);
+            break;
+            }
+         // An episode in the recently added episodes list
+         case 3:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoOpenBrowseNotPlayedL_Episode);
+            iDbHandler->GetEpisodeL(aPath.Id(levels - 1), aAttrs, aArray);
+            isEpisode = ETrue;
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoOpenBrowseNotPlayedL_Episode);
+            break;
+            }
+         default:
+            {
+            MPX_DEBUG2("CMPXPodcastDbPlugin_DoOpenBrowseNotPlayedL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+       }
+
+    return isEpisode;
+    }
+
+// ----------------------------------------------------------------------------
+// Process the OpenL method with open mode EMPXOpenPlaylistOnly
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionPath* CMPXPodcastDbPlugin::DoOpenPlaylistL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    TBool aFlagToSignalToBePlayed)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoOpenPlaylistL");
+
+    RArray<TMPXItemId> ids;
+    CleanupClosePushL(ids);
+
+    CMPXMedia* entries = CMPXMedia::NewL();
+    CleanupStack::PushL(entries);
+
+    CMPXCollectionPath* path = CMPXCollectionPath::NewL( aPath );
+    CleanupStack::PushL( path );
+
+    // Go through the browse path
+    TInt levels(aPath.Levels());
+    if (levels == 2)
+        {
+        // Create a new collection path
+        CleanupStack::PopAndDestroy(path);
+        path = CMPXCollectionPath::NewL();
+        CleanupStack::PushL(path);
+
+        // Always return all episodes here
+        //
+        ids.Reset();
+        ids.AppendL( KDBPluginUid );
+        path->AppendL(ids.Array());
+        path->SelectL((TMPXItemId)KDBPluginUid);
+
+        ids.Reset();
+        ids.AppendL(EBrowseAll);
+        path->AppendL(ids.Array());
+        path->SelectL((TMPXItemId) EBrowseAll);
+        path->Set(EMPXOpenPlaylistOnly);
+
+        // Get all item IDs
+        CMPXMediaArray* array = CMPXMediaArray::NewL();
+        CleanupStack::PushL(array);
+
+        DoOpenBrowseAllL(*path, aAttrs, *entries, *array);
+
+        entries->SetCObjectValueL(KMPXMediaArrayContents, array);
+        entries->SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+
+        CleanupStack::PopAndDestroy(array);
+
+        DoAppendLevelL(*path, *entries);
+        }
+    else if (levels > 2)
+        {
+        TInt selectedId(aPath.Id(1));
+        switch (selectedId)
+            {
+            case EBrowseAll:
+                {
+                path->Set(EMPXOpenPlaylistOnly);
+                if(aFlagToSignalToBePlayed)
+                    {
+                    // Set the episode ID to be played
+                    entries->SetTObjectValueL( KMPXMediaGeneralId, aPath.Id(2) );
+
+                    // ignore the error because if there is a problem
+                    // updating the media file, the error will show up
+                    // when opening the track for playing and be handled
+                    // properly by the playback engine and skipped
+                    TRAP_IGNORE(iDbHandler->SetIsPlayingL(*entries, ETrue));
+                    }
+                break;
+                }
+            case EBrowseTitle:
+            case EBrowsePubDate:
+            case EBrowseRecentlyAdded:
+            case EBrowseNotPlayed:
+                {
+                if (!DoOpenL(aPath, aAttrs, *entries, aFlagToSignalToBePlayed))
+                    {
+                    path->Set(EMPXOpenPlaylistOnly);
+                    // If it is not at a episode level
+                    // Append all entries to create collection path
+                    //
+                    DoAppendLevelL(*path, *entries);
+                    }
+                break;
+                }
+            default:
+                {
+                User::Leave(KErrNotSupported);
+                }
+            }
+        }
+    else  // levels < 2
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    // Cleanup
+    CleanupStack::Pop(path);
+    CleanupStack::PopAndDestroy(entries);
+    CleanupStack::PopAndDestroy(&ids);
+
+    return path;
+    }
+
+// ----------------------------------------------------------------------------
+// Process the MediaL command
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoMediaL");
+
+	CMPXMediaArray* array = CMPXMediaArray::NewL();
+	CleanupStack::PushL(array);
+
+	DoTitlesMediaL(aPath, aAttrs, aEntries, *array);
+
+	if (array->Count() > 0)
+		{
+		aEntries.SetCObjectValueL(KMPXMediaArrayContents, array);
+		aEntries.SetTObjectValueL<TInt>(KMPXMediaArrayCount, array->Count());
+		}
+	CleanupStack::PopAndDestroy(array);
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for root level
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoRootMediaL(
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoRootMediaL");
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU
+    aMedia.SetTObjectValueL<TMPXGeneralNonPermissibleActions> (
+            KMPXMediaGeneralNonPermissibleActions, (TMPXGeneralNonPermissibleActions)(EMPXWrite | EMPXCache) );
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdGeneral)
+            {
+            TUint att = aAttrs[i].AttributeId();
+
+            if (att & EMPXMediaGeneralTitle)
+                {
+                // set the collection plugin name
+                HBufC* title(iResource->ReadHBufCL(R_MPX_QTN_MUS_PODCASTS));
+                CleanupStack::PushL(title);
+                aMedia.SetTextValueL(KMPXMediaGeneralTitle, *title);
+                CleanupStack::PopAndDestroy(title);
+                }
+            if (att & EMPXMediaGeneralSubTitle)
+                {
+                TInt numEpisodes(iDbHandler->NumberOfItemsL(EMPXEpisode));
+
+                HBufC* text(iResource->ReadHBufCL((numEpisodes == 1) ?
+                    R_MPX_QTN_MUS_PODCAST_ONE_EPISODE : R_MPX_QTN_MUS_PODCAST_NUM_EPISODES));
+                CleanupStack::PushL(text);
+                aMedia.SetTextValueL(KMPXMediaGeneralSubTitle, *text);
+                aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralCount, numEpisodes);
+                CleanupStack::PopAndDestroy(text);
+                }
+            if (att & EMPXMediaGeneralIcon)
+                {
+                // set the collection plugin icon
+                TIconInfo icon;
+                icon.bmpfile = KMPlayerDbPluginMbmFile;
+                icon.bitmapId = EMbmMpxpodcastdbpluginQgn_graf_mup_dlst_podcast;
+                icon.maskId = EMbmMpxpodcastdbpluginQgn_graf_mup_dlst_podcast_mask;
+                aMedia.SetTObjectValueL<TIconInfo>(KMPXMediaGeneralIcon, icon );
+                }
+            } // if
+        } // for
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for all episodes category
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoAllEpisodesMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoAllEpisodesMediaL");
+
+    TInt levels(aPath.Levels());
+    switch (levels)
+       {
+        // All episodes
+        case 2:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoAllEpisodesMediaL_All);
+            DoRootCategoryMediaL(aAttrs, aPath.Id(1), EMPXAll, aEntries);
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoAllEpisodesMediaL_All);
+            break;
+            }
+        // An episode in all episodes
+        case 3:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoAllEpisodesMediaL_Episode);
+            GetEpisodeInfoL(aPath, aAttrs, aEntries, aMediaArray);
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoAllEpisodesMediaL_Episode);
+            break;
+            }
+        default:
+            {
+            MPX_DEBUG2("CMPXPodcastDbPlugin_DoAllEpisodesMediaL: Invalid levels[%d]", levels);
+            User::Leave(KErrNotSupported);
+            }
+        } // end switch(levels)
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for by publish date category
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoByPublishDateMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoByPublishDateMediaL");
+
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+    // All By Publish Date Categories
+    if (levels == 2)
+        {
+        MPX_PERF_START(CMPXPodcastDbPlugin_DoByPublishDateMediaL_All);
+        DoRootCategoryMediaL(aAttrs, aPath.Id(1), EMPXPubDate, aEntries);
+        MPX_PERF_END(CMPXPodcastDbPlugin_DoByPublishDateMediaL_All);
+        }
+    else if (levels == 3) // by publish date category selected
+        {
+        MPX_PERF_START(CMPXPodcastDbPlugin_DoByPublishDateMediaL_Category);
+        const TDesC& title = iPodcastEpisodeViewPublishDateTitle->MdcaPoint(
+            aPath.Id(idIndex).iId2 & 0x00FFFFFF);
+        aEntries.SetTextValueL(KMPXMediaGeneralTitle, title);
+        MPX_PERF_END(CMPXPodcastDbPlugin_DoByPublishDateMediaL_Category);
+        }
+     else if (levels == 4) // an episode within the category
+        {
+        MPX_PERF_START(CMPXPodcastDbPlugin_DoByPublishDateMediaL_Episode);
+        GetEpisodeInfoL(aPath, aAttrs, aEntries, aMediaArray);
+        MPX_PERF_END(CMPXPodcastDbPlugin_DoByPublishDateMediaL_Episode);
+        }
+    else
+        {
+        MPX_DEBUG2("CMPXPodcastDbPlugin_DoByPublishDateMediaL: Invalid levels[%d]", levels);
+        User::Leave(KErrNotSupported);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for titles category
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoTitlesMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoTitlesMediaL");
+
+    TInt levels(aPath.Levels());
+    TInt idIndex(levels - 1);
+
+     // All Titles Categories
+    if (levels == 1)
+        {
+        MPX_PERF_START(CMPXPodcastDbPlugin_DoTitlesMediaL_All);
+        DoRootCategoryMediaL(aAttrs, aPath.Id(1), EMPXTitle, aEntries);
+        MPX_PERF_END(CMPXPodcastDbPlugin_DoTitlesMediaL_All);
+        }
+    else if (levels == 2) // All episodes within selected title
+        {
+        MPX_PERF_START (CMPXPodcastDbPlugin_DoTitlesMediaL_Title);
+        iDbHandler->GetAllPodcastTitlesL(aAttrs, aMediaArray);
+        HBufC* title = iDbHandler->GetTitleNameMatchingIdL(aPath.Id(idIndex));
+        CleanupStack::PushL(title);
+        aEntries.SetTextValueL(KMPXMediaGeneralTitle, *title);
+        CleanupStack::PopAndDestroy(title);
+        MPX_PERF_END (CMPXPodcastDbPlugin_DoTitlesMediaL_Title);
+        }
+     else if (levels == 3) // an episode within a selected title
+        {
+        MPX_PERF_START(CMPXPodcastDbPlugin_DoTitlesMediaL_Episode);
+        GetEpisodeInfoL (aPath, aAttrs, aEntries, aMediaArray);
+        MPX_PERF_END(CMPXPodcastDbPlugin_DoTitlesMediaL_Episode);
+        }
+     else
+        {
+        MPX_DEBUG2("CMPXPodcastDbPlugin_DoTitlesMediaL: Invalid levels[%d]", levels);
+        User::Leave(KErrNotSupported);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for recently added
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoRecentlyAddedMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoRecentlyAddedMediaL");
+
+    switch (aPath.Levels())
+       {
+       // All episodes
+       case 2:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoRecentlyAddedMediaL_All);
+            DoRootCategoryMediaL(aAttrs, aPath.Id(1), EMPXRecentlyAdded, aEntries);
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoRecentlyAddedMediaL_All);
+            break;
+            }
+
+         // An episode that was recently added
+         case 3:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoRecentlyAddedMediaL_Episode);
+            GetEpisodeInfoL(aPath, aAttrs, aEntries, aMediaArray);
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoRecentlyAddedMediaL_Episode);
+            break;
+            }
+
+         default:
+            {
+            MPX_DEBUG2("CMPXPodcastDbPlugin_DoRecentlyAddedMediaL: Invalid levels[%d]", aPath.Levels());
+            User::Leave(KErrNotSupported);
+            }
+        } // end switch(levels)
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for recently added
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoNotYetPlayedMediaL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntries,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoNotYetPlayedMediaL");
+
+    switch (aPath.Levels())
+       {
+       // All episodes
+       case 2:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoNotYetPlayedMediaL_All);
+            DoRootCategoryMediaL(aAttrs, aPath.Id(1), EMPXNotYetPlayed, aEntries);
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoNotYetPlayedMediaL_All);
+            break;
+            }
+
+         // An episode that was never played
+         case 3:
+            {
+            MPX_PERF_START(CMPXPodcastDbPlugin_DoNotYetPlayedMediaL_Episode);
+            MPX_TRAPD(err, GetEpisodeInfoL(aPath, aAttrs, aEntries, aMediaArray));
+
+            if (err != KErrNotFound)
+                {
+                // it's o.k if the episode isn't found because the episode
+                // might have finished playing and is no longer
+                // part of the "Not yet played" playlist
+                User::LeaveIfError(err);
+                }
+
+            MPX_PERF_END(CMPXPodcastDbPlugin_DoNotYetPlayedMediaL_Episode);
+            break;
+            }
+
+         default:
+            {
+            MPX_DEBUG2("CMPXPodcastDbPlugin_DoNotYetPlayedMediaL: Invalid levels[%d]", aPath.Levels());
+            User::Leave(KErrNotSupported);
+            }
+        } // end switch(levels)
+    }
+
+// ----------------------------------------------------------------------------
+// Find the collection media for the root menu
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoRootCategoryMediaL(
+    const TArray<TMPXAttribute>& aAttrs,
+    TMPXItemId aRootCategoryId,
+    TMPXPodcastCategory aCategory,
+    CMPXMedia& aEntries)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoRootCategoryMediaL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdGeneral)
+            {
+            TUint att(aAttrs[i].AttributeId());
+
+            if (att & EMPXMediaGeneralId)
+                {
+                aEntries.SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId,
+                    aRootCategoryId);
+                }
+            if (att & EMPXMediaGeneralTitle)
+                {
+                aEntries.SetTextValueL(KMPXMediaGeneralTitle,
+                    iPodcastLibraryTitles->MdcaPoint(BrowseTypeForCategory(aCategory)));
+                }
+            } // end if
+        } // end for
+
+    aEntries.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup);
+    aEntries.SetTObjectValueL<TMPXPodcastCategory>(KMPXMediaGeneralCategory, aCategory);
+    }
+
+// ----------------------------------------------------------------------------
+// Set all the attributes in CMPXMedia corresponding to KMPXMediaIdDrm
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoSetMediaDrmL(
+    CMPXMedia& aMedia,
+    TUint aDrmAttributes,
+    const TDesC& aLocation)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoSetMediaDrmL");
+
+    iDrmMediaUtility->InitL(aLocation);
+    CleanupClosePushL(*iDrmMediaUtility);
+    const CMPXMedia* drmMedia(iDrmMediaUtility->GetMediaL(aDrmAttributes));
+
+    // Only get attributes if it's a DRM file
+    if (drmMedia)
+        {
+        if ((aDrmAttributes & EMPXMediaDrmType) &&
+            drmMedia->IsSupported(KMPXMediaDrmType))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmType,
+                drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmType));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmRightsStatus) &&
+            drmMedia->IsSupported(KMPXMediaDrmRightsStatus))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmRightsStatus,
+                 drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmRightsStatus));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmRightsType) &&
+            drmMedia->IsSupported(KMPXMediaDrmRightsType))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmRightsType,
+                 drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmRightsType));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmCount) &&
+            drmMedia->IsSupported(KMPXMediaDrmCount))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmCount,
+                 drmMedia->ValueTObjectL<TInt>(KMPXMediaDrmCount));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmProtected) &&
+            drmMedia->IsSupported(KMPXMediaDrmProtected))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmProtected,
+                 drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmProtected));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmSendingAllowed) &&
+            drmMedia->IsSupported(KMPXMediaDrmSendingAllowed))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmSendingAllowed,
+                 drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmSendingAllowed));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmCanSetAutomated) &&
+            drmMedia->IsSupported(KMPXMediaDrmCanSetAutomated))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmCanSetAutomated,
+                 drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmCanSetAutomated));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmHasInfoUrl) &&
+            drmMedia->IsSupported(KMPXMediaDrmHasInfoUrl))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmHasInfoUrl,
+                 drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmHasInfoUrl));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmHasPreviewUrl) &&
+            drmMedia->IsSupported(KMPXMediaDrmHasPreviewUrl))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmHasPreviewUrl,
+                 drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmHasPreviewUrl));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmAboutToExpire) &&
+            drmMedia->IsSupported(KMPXMediaDrmAboutToExpire))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmAboutToExpire,
+                 drmMedia->ValueTObjectL<TBool>(KMPXMediaDrmAboutToExpire));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmStartTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmStartTime))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmStartTime,
+                 drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmStartTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmEndTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmEndTime))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmEndTime,
+                 drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmEndTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmIntervalStartTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmIntervalStartTime))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmIntervalStartTime,
+                 drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmIntervalStartTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmAccumulatedTime) &&
+            drmMedia->IsSupported(KMPXMediaDrmAccumulatedTime))
+            {
+            aMedia.SetTObjectValueL(KMPXMediaDrmAccumulatedTime,
+                 drmMedia->ValueTObjectL<TInt64>(KMPXMediaDrmAccumulatedTime));
+            }
+        if ((aDrmAttributes & EMPXMediaDrmInterval) &&
+            drmMedia->IsSupported(KMPXMediaDrmInterval))
+            {
+            aMedia.SetTObjectValueL( KMPXMediaDrmInterval,
+                 drmMedia->ValueTObjectL<TTimeIntervalSeconds>(KMPXMediaDrmInterval));
+            }
+        }
+
+    CleanupStack::PopAndDestroy(iDrmMediaUtility);
+    }
+
+// ----------------------------------------------------------------------------
+// Add media objects to the array with attributes from episode details
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::GetEpisodeInfoL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXAttribute>& aAttrs,
+    CMPXMedia& aEntry,
+    CMPXMediaArray& aMediaArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::GetEpisodeInfoL");
+
+    RArray<TInt> supportedIds;
+    CleanupClosePushL(supportedIds);
+    MPXDbCommonUtil::FillInSupportedUIDsL(aAttrs, supportedIds);
+
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    TInt countSelection(aPath.Selection().Count());
+    if (countSelection)
+        {
+        for (TInt selectionIndex = 0; selectionIndex < countSelection; ++selectionIndex)
+            {
+            CMPXMedia* newEntry = CMPXMedia::NewL(supportedIds.Array());
+            CleanupStack::PushL(newEntry);
+
+            DoGetEpisodeInfoL(aAttrs, selections[selectionIndex].iId2, *newEntry);
+
+            aMediaArray.AppendL(*newEntry);
+            CleanupStack::PopAndDestroy(newEntry);
+            }
+        }
+    else
+        {
+        // No selection, get the attributes for the one song
+        DoGetEpisodeInfoL(aAttrs, aPath.Id(aPath.Levels() - 1).iId2, aEntry);
+        }
+
+    CleanupStack::PopAndDestroy(&selections);
+    CleanupStack::PopAndDestroy(&supportedIds);
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieves the attributes for a media object.
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoGetEpisodeInfoL(
+    const TArray<TMPXAttribute>& aAttrs,
+    TInt aEntryId,
+    CMPXMedia& aEntry)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoGetEpisodeInfoL");
+
+    iDbHandler->GetEpisodeL(aEntryId, aAttrs, aEntry);
+
+    const TDesC& location(aEntry.ValueText(KMPXMediaGeneralUri));
+
+    // Check DRM Only if we have a location
+    if (location != KNullDesC)
+        {
+        TUint drmAttributes(0);
+
+        // Compact the attribute set
+        TInt count(aAttrs.Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            if (aAttrs[i].ContentId() == KMPXMediaIdDrm)
+                {
+                drmAttributes |= aAttrs[i].AttributeId();
+                }
+            }
+
+        // Set the correct attributes to media, only if requested
+        if (drmAttributes)
+            {
+            DoSetMediaDrmL(aEntry, drmAttributes, location);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve the collection details
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoHandleOtherMediaAttributesL(
+    const TArray<TMPXAttribute>& aAttrs,
+    const CMPXCollectionPath& aPath,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoHandleOtherMediaAttributesL");
+
+    TInt count(aAttrs.Count());
+    for (TInt i = 0; i < count; ++i)
+        {
+        if (aAttrs[i].ContentId() == KMPXMediaIdCollectionDetails)
+            {
+            TUint att(aAttrs[i].AttributeId());
+
+            if (att & EMPXMediaColDetailNumberOfItems)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailNumberOfItems,
+                    iDbHandler->NumberOfItemsL(EMPXEpisode) );
+                }
+            if (att & EMPXMediaColDetailDuration)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailDuration,
+                    DoDurationL( aMedia, EMPXEpisode ) );
+                }
+            if (att & EMPXMediaColTotalSize)
+                {
+                TInt totalSize(0);
+                // todo
+                aMedia.SetTObjectValueL(KMPXMediaColDetailTotalSize, totalSize );
+                }
+            if (att & EMPXMediaLastRefreshed)
+                {
+                TTime lastRefreshed = iDbHandler->GetLastRefreshedTimeL();
+                aMedia.SetTObjectValueL(KMPXMediaColDetailLastRefreshed,
+                    lastRefreshed.Int64() );
+                }
+            if (att & EMPXMediaColDetailDBCreated)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailDBCreated,
+                    iDbHandler->DatabaseCreated());
+                }
+            if (att & EMPXMediaColDetailDBCorrupted)
+                {
+                aMedia.SetTObjectValueL(KMPXMediaColDetailDBCorrupted,
+                    iDbHandler->IsDBCorruptedL());
+                }
+            }
+        else if (aAttrs[i] == KMPXMediaGeneralPath)
+            {
+            aMedia.SetCObjectValueL(KMPXMediaGeneralPath,
+                const_cast<CMPXCollectionPath*>(&aPath));
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given path
+// ----------------------------------------------------------------------------
+//
+CDesCArray* CMPXPodcastDbPlugin::DoRemoveL(
+    const CMPXCollectionPath& aPath,
+    CMPXMessageArray& aChangeMsgArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoRemoveL");
+
+    if (aPath.Levels() <= 0)
+        {
+        User::Leave(KErrNotSupported);
+        }
+
+    // Return file path for deleted item(s)
+    //
+    CDesCArray* fp = new(ELeave) CDesCArrayFlat(1);
+    CleanupStack::PushL(fp);
+
+    // Ids of the selected items
+    RArray<TMPXItemId> selections;
+    CleanupClosePushL(selections);
+    aPath.SelectionL(selections);
+
+    DoRemoveFromCategoriesL(aPath, selections.Array(), EMPXAlbum, *fp, aChangeMsgArray);
+
+    MPX_DEBUG2("CMPXPodcastDbPlugin::DoRemoveL itemId[%d]", aPath.Id (aPath.Levels() - 1).iId2);
+
+    CleanupStack::PopAndDestroy(&selections);
+    CleanupStack::Pop(fp);
+
+    return fp;
+    }
+
+// ----------------------------------------------------------------------------
+// Remove media by path through a command
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoRemoveL(
+    const CMPXMedia& aMedia,
+    TBool aDeleteRecord)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoRemoveL(by command)");
+
+    // Return deleted file paths to caller
+    CDesCArray* fp = new(ELeave) CDesCArrayFlat(1);
+    CleanupStack::PushL(fp);
+
+    // a list of change event messages a result of the item being removed
+    CMPXMessageArray* itemChangedMessages = CMPXMediaArray::NewL();
+    CleanupStack::PushL(itemChangedMessages);
+
+    TUint32 podcastEpisodeId(0);
+
+    // Removing a container of items
+    //
+    if (aMedia.IsSupported(KMPXMediaArrayContents))
+        {
+        MPX_DEBUG1("CMPXPodcastDbPlugin::RemoveL -- Removing a container of items");
+        const CMPXMediaArray* media = (aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents));
+        if( !media )
+            {
+            User::Leave( KErrNoMemory );
+            }
+        const TInt mediaCount(media->Count());
+        for (TInt i = 0; i < mediaCount; ++i)
+            {
+            CMPXMedia* entry = media->AtL(i);
+            if( entry->IsSupported(KMPXMediaGeneralId))
+                {
+                podcastEpisodeId = entry->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+                }
+            else if (entry->IsSupported(KMPXMediaGeneralUri))
+                {
+                podcastEpisodeId = iDbHandler->GetEpisodeIdMatchingUriL(
+                    entry->ValueText(KMPXMediaGeneralUri));
+                }
+            else
+                {
+                // Unable to process this item
+                continue;
+                }
+
+            iDbHandler->RemoveEpisodeL(podcastEpisodeId, *fp, *itemChangedMessages,
+                aDeleteRecord);
+            }
+        }
+    // Removing an item with known item id
+    //
+    else if (aMedia.IsSupported(KMPXMediaGeneralId))
+        {
+        MPX_DEBUG1("CMPXPodcastDbPlugin::RemoveL -- Removing an item by item id");
+        podcastEpisodeId = aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+
+        if ((podcastEpisodeId >> 28) != EMPXPlaylist)
+            {
+            iDbHandler->RemoveEpisodeL(podcastEpisodeId, *fp,
+                *itemChangedMessages, aDeleteRecord);
+            }
+        else
+            {
+            MPX_DEBUG1("CMPXPodcastDbPlugin::RemoveL -- Playlists not supported within podcast collection");
+            User::Leave(KErrNotSupported);
+            }
+        }
+    // Removing an item with known uri
+    //
+    else if (aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        MPX_DEBUG1("CMPXPodcastDbPlugin::RemoveL -- Removing an item by uri");
+        podcastEpisodeId = iDbHandler->GetEpisodeIdMatchingUriL(
+            aMedia.ValueText(KMPXMediaGeneralUri));
+        iDbHandler->RemoveEpisodeL(podcastEpisodeId, *fp, *itemChangedMessages,
+            aDeleteRecord);
+        }
+    else
+        {
+        MPX_DEBUG1("CMPXPodcastDbPlugin::RemoveL -- Unknown item for removal");
+        User::Leave(KErrNotSupported);
+        }
+
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+    DoHandleChangeL(itemChangedMessages);
+
+    CleanupStack::PopAndDestroy(itemChangedMessages);
+    CleanupStack::PopAndDestroy(fp);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove an item from the collection database using the given media properties
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoRemovePathL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoRemovePathL(by command)");
+
+    TInt removeError(KErrNone);
+    TBool removeCompleted(ETrue);
+
+    if (!aCmd.IsSupported(KMPXCommandCollectionRemovePath) ||
+        !aCmd.IsSupported(KMPXCommandCollectionRemoveMediaCount))
+        {
+        removeError = KErrArgument;
+        }
+    else
+        {
+        CMPXCollectionPath* path =
+            aCmd.ValueCObjectL<CMPXCollectionPath>(KMPXCommandCollectionRemovePath);
+        CleanupStack::PushL(path);
+
+        // in order to support cancel delete for a category, we need to adjust path. If
+        // the path ends in a category, retrieve all episodes under the selected category
+        // and append a new level with all episodes under the selected category
+        DoAppendLevelL(*path);
+
+        CMPXCollectionPath* iterationPath = CMPXCollectionPath::NewL(*path);
+        CleanupStack::PushL(iterationPath);
+        iterationPath->ClearSelection();
+
+        // indices of the selected items
+        TArray<TInt> selectionIndices = path->Selection();
+        TInt count(selectionIndices.Count());
+
+        // number of medias to remove in this iteration
+        TInt removeCount = (aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionRemoveMediaCount));
+
+        // remove all in one shut if removeCount is 0 or negative
+        if (removeCount <= 0)
+            {
+            removeCount = count;
+            }
+
+        // If the given path contains multiple selections, remove the first n selected media
+        // and update the path so that client can use this path to call remove iteratively
+        // until all selections are processed
+        //
+        if (count)
+            {
+            for (TInt i = 0; i < removeCount; ++i)
+                {
+                TInt index(selectionIndices[i]);
+
+                MPX_DEBUG4(" path: selected item [index %d] [selectioncount %d] [remove count %d]", index, count, removeCount);
+
+                iterationPath->SelectL(index);
+                path->Remove(index);
+                }
+
+            aCmd.SetCObjectValueL(KMPXCommandCollectionRemovePath, path);
+
+            // indicate to the client that subsequent remove command is required
+            if ((count - removeCount) > 0)
+                {
+                removeCompleted = EFalse;
+                }
+            }
+
+        // Remove the media specified by the path
+        CDesCArray* fp(NULL);
+        TBool supressMsgs(EFalse);
+        CMPXMessageArray* msgAry(NULL);
+        if (aCmd.IsSupported(KMPXCommandCollectionRemoveSuppressMsgs) &&
+            aCmd.ValueTObjectL<TBool>(KMPXCommandCollectionRemoveSuppressMsgs) )
+            {
+            // Msgs are stored in the command
+            supressMsgs = ETrue;
+            CMPXMessageArray* msgs( aCmd.Value<CMPXMessageArray>(KMPXCommandCollectionChangeMsgs) );
+            User::LeaveIfNull( msgs );
+            fp = DoRemoveL(*iterationPath, *msgs );
+            }
+        else
+            {
+            // Msgs will be sent after delete
+            msgAry = CMPXMessageArray::NewL();
+            CleanupStack::PushL( msgAry );
+            fp = DoRemoveL(*iterationPath, *msgAry);
+            }
+
+        CleanupStack::PushL(fp);
+        if (fp->MdcaCount() > removeCount)
+            {
+            removeError = KErrCorrupt;
+            }
+        CleanupStack::PopAndDestroy(fp);
+
+        if (!supressMsgs)
+            {
+            // Send Change Messages
+            iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+            DoHandleChangeL(msgAry);
+            CleanupStack::PopAndDestroy(msgAry);
+            }
+
+        // Cleanup
+        CleanupStack::PopAndDestroy(iterationPath);
+        CleanupStack::PopAndDestroy(path);
+        }
+
+    // mandatory return parameters
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRemoveError, removeError);
+    aCmd.SetTObjectValueL<TBool>(KMPXCommandCollectionRemoveCompleted, removeCompleted);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove media by CMPXMedia through a command
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoRemoveMediaL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoRemoveMediaL(by command)");
+
+    TInt error(KErrArgument);
+
+    if (aCmd.IsSupported(KMPXCommandCollectionRemoveMedia))
+        {
+        CMPXMedia* media = aCmd.ValueCObjectL<CMPXMedia>(KMPXCommandCollectionRemoveMedia);
+        CleanupStack::PushL(media);
+
+        MPX_TRAP(error, DoRemoveL(*media,
+            aCmd.ValueTObjectL<TBool>(KMPXCommandCollectionRemoveMediaDeleteRecord)));
+
+        CleanupStack::PopAndDestroy(media);
+        }
+
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRemoveMediaError, error);
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media/media items from All Episodes view
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoRemoveFromAllEpisodesL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXItemId>& aSelections,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoRemoveFromAllEpisodesL");
+
+    switch (aPath.Levels())
+        {
+        case 2:
+            {
+            // when the collection is removed, it's intended not to delete the files
+            iDbHandler->RemoveEntireCollectionL();
+            }
+            break;
+
+        case 3:
+            {
+            TInt count(aSelections.Count());
+            if (count)
+                {
+                for (TInt i = 0; i < count; ++i)
+                    {
+                    iDbHandler->RemoveEpisodeL (aSelections[i], aUriArray,
+                        aItemChangedMessages);
+                    } // end for
+                }
+            else
+                {
+                iDbHandler->RemoveEpisodeL(aPath.Id(aPath.Levels() - 1), aUriArray,
+                    aItemChangedMessages);
+                }
+            }
+            break;
+
+        default:
+            {
+            MPX_DEBUG2("CMPXPodcastDbPlugin_DoRemoveFromAllEpisodesL: Invalid levels[%d]", aPath.Levels());
+            User::Leave(KErrNotSupported);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media/media items from By Publish Date view
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoRemoveFromPublishDateL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXItemId>& aSelections,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoRemoveFromPublishDateL");
+
+    TInt levels(aPath.Levels());
+
+    if (levels == 2)
+        {
+        // when the collection is removed, it's intended no to delete the files
+        iDbHandler->RemoveEntireCollectionL();
+        }
+    else
+        {
+        TInt count(aSelections.Count());
+        if (count)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                RemoveFromPublishDateL(aPath, aSelections[i].iId2, aUriArray, aItemChangedMessages);
+                }
+            }
+        else
+            {
+            RemoveFromPublishDateL(aPath, aPath.Id(levels - 1).iId2, aUriArray, aItemChangedMessages);
+            }
+        }
+
+    MPX_DEBUG2("CMPXPodcastDbPlugin__RemoveL__EBrowsePubDate: levels[%d]", aPath.Levels());
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media item from By Publish Date view
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::RemoveFromPublishDateL(
+    const CMPXCollectionPath& aPath,
+    TInt aItemId,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::RemoveFromPublishDateL");
+
+    switch (aPath.Levels())
+        {
+        case 3:
+            {
+            iDbHandler->RemoveEpisodesMatchingPublishDateCategoryL(aItemId, aUriArray,
+                aItemChangedMessages);
+            break;
+            }
+        case 4:
+            {
+            iDbHandler->RemoveEpisodeL(aItemId, aUriArray,
+                aItemChangedMessages);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrArgument);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media/media items from Titles/Genre etc.. view
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoRemoveFromCategoriesL(
+    const CMPXCollectionPath& aPath,
+    const TArray<TMPXItemId>& aSelections,
+    TMPXGeneralCategory aCategory,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoRemoveFromCategoriesL");
+
+    TInt levels(aPath.Levels());
+    if (levels == 1)
+        {
+        // when the collection is removed, it's intended no to delete the files
+        iDbHandler->RemoveEntireCollectionL();
+        }
+    else
+        {
+        TInt count(aSelections.Count());
+        if (count)
+            {
+            for (TInt i = 0; i < count; ++i)
+                {
+                RemoveFromCategoriesL(aPath, aSelections[i], aCategory, aUriArray,
+                    aItemChangedMessages);
+                }
+            }
+
+        else
+            {
+            RemoveFromCategoriesL(aPath, aPath.Id (aPath.Levels() - 1), aCategory, aUriArray,
+                aItemChangedMessages);
+            }
+        }
+
+    MPX_DEBUG2("CMPXPodcastDbPlugin_DoRemoveFromCategoriesL: levels[%d]", aPath.Levels());
+    }
+
+// ----------------------------------------------------------------------------
+// Remove a media item from Albums/Genres/Composers view
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::RemoveFromCategoriesL(
+    const CMPXCollectionPath& aPath,
+    TInt aItemId,
+    TMPXGeneralCategory aCategory,
+    CDesCArray& aUriArray,
+    CMPXMessageArray& aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::RemoveFromCategoriesL");
+
+    switch (aPath.Levels())
+        {
+        case 2:
+            {
+            iDbHandler->RemoveEpisodesMatchingCategoryL(aCategory, aItemId,
+                aUriArray, aItemChangedMessages);
+            break;
+            }
+        case 3:
+            {
+            iDbHandler->RemoveEpisodeL(aItemId, aUriArray, aItemChangedMessages);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrArgument);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve URIs associated with this file path for file deletion
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoRetrieveUriForDeletionL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoRetrieveUriForDeletionL");
+
+    // initialize mandatory return parameters
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRetrieveUriError, KErrNone);
+
+    if (!aCmd.IsSupported(KMPXCommandCollectionRetrievePath))
+        {
+        aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionRetrieveUriError, KErrArgument);
+        }
+    else
+        {
+        CMPXCollectionPath* path = aCmd.ValueCObjectL<CMPXCollectionPath>(
+            KMPXCommandCollectionRetrievePath);
+        CleanupStack::PushL(path);
+
+        if (iFirstDeleteStep )
+            {
+            iSelections.Reset( );
+            // in order to support cancel delete for a category, we need to adjust path. If
+            // the path ends in a category, retrieve all songs under the selected category
+            // and append a new level with all songs under the selected category
+            DoAppendLevelL(*path );
+
+            // Ids of the selected items
+            path->SelectionL(iSelections );
+
+            // single selection
+            if (iSelections.Count()== 0 )
+                {
+                iSelections.AppendL(path->Id (path->Levels()- 1 ) );
+                }
+            }
+        CDesCArray* fp = new(ELeave) CDesCArrayFlat(4);
+        CleanupStack::PushL(fp);
+
+        TInt count = iSelections.Count();
+        TInt itemCount = count > KIncrementalDeleteCount ? KIncrementalDeleteCount : count;
+        for (TInt i = 0; i < itemCount; ++i)
+            {
+            HBufC* uri = iDbHandler->GetUriMatchingIdL(iSelections[0]);
+            CleanupStack::PushL(uri);
+            fp->AppendL(*uri);
+            CleanupStack::PopAndDestroy(uri);
+            iSelections.Remove(0);
+            
+            }
+        aCmd.SetNoNewLCObjectL (KMPXCommandCollectionRetrieveMediaUriArray, fp);
+        if (iFirstDeleteStep)
+            {
+            aCmd.SetCObjectValueL(KMPXCommandCollectionRetrievePath, path);
+            }
+        CleanupStack::PopAndDestroy(fp);
+        CleanupStack::PopAndDestroy(path);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Cleanup deleted medias
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::CleanupDeletedRecordsL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::CleanupDeletedRecordsL");
+
+    MPX_TRAPD(error, iDbHandler->CleanupDeletedRecordsL());
+    aCmd.SetTObjectValueL<TInt>(KMPXCommandCollectionCleanupError, error);
+    }
+
+// ----------------------------------------------------------------------------
+// Retrieve the duration
+// ----------------------------------------------------------------------------
+//
+TInt CMPXPodcastDbPlugin::DoDurationL(
+    CMPXMedia& aMedia,
+    TMPXPodcastCategory aCategory,
+    TMPXItemId aId)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoDurationL");
+
+    TInt duration(0);
+    switch (aCategory)
+        {
+        case EMPXEpisode:
+            {
+            duration = iDbHandler->GetAllEpisodesDurationL();
+            break;
+            }
+        case EMPXTitle:
+            {
+            duration = iDbHandler->GetTitleDurationL(aId.iId2);
+            break;
+            }
+        case EMPXNotYetPlayed:
+            {
+            duration = iDbHandler->GetNotPlayedDurationL();
+            break;
+            }
+       case EMPXRecentlyAdded:
+            {
+            duration = iDbHandler->GetRecentlyAddedDurationL();
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    aMedia.SetTObjectValueL<TInt>(KMPXMediaGeneralDuration, duration);
+    return duration;
+    }
+
+// ----------------------------------------------------------------------------
+// Append a level to a collection path and set selection to the first level
+// ----------------------------------------------------------------------------
+//
+TInt CMPXPodcastDbPlugin::DoAppendLevelL(
+    CMPXCollectionPath& aPath,
+    CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoAppendLevelL");
+
+    RArray<TMPXItemId> ids;
+    CleanupClosePushL(ids);
+
+    // Extract media array, and get all item ids
+    //
+    const CMPXMediaArray* mediaArray = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+    if( !mediaArray )
+        {
+        User::Leave(KErrNoMemory);
+        }
+    TInt count(mediaArray->Count());
+
+    if (count >= 0)
+        {
+        for (TInt i = 0; i < count; ++i)
+            {
+            TMPXItemId id = mediaArray->AtL(i)->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+            ids.AppendL(id);
+            }
+
+        // Put item id array into the path and select the first one
+        aPath.AppendL(ids.Array());
+        if (count > 0)
+        	{
+	        aPath.Set(0);
+        	}
+        }
+
+    CleanupStack::PopAndDestroy(&ids);
+    return count;
+    }
+
+// ----------------------------------------------------------------------------
+// Append a level to a collection path and set selection to all episodes under the selected category/categories
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoAppendLevelL(
+    CMPXCollectionPath& aPath)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoAppendLevelL");
+
+    TMPXItemId contextId(aPath.Id(1));
+    TInt levels(aPath.Levels());
+
+    if (contextId == EBrowseAll)
+        {
+        return;
+        }
+    else if (levels == 2)
+        {
+        // retrieve episodes in the selected category
+        CMPXMediaArray* episodes = CMPXMediaArray::NewL();
+        CleanupStack::PushL(episodes);
+
+        RArray<TMPXAttribute> attributes;
+        CleanupClosePushL(attributes);
+        attributes.AppendL(KMPXMediaGeneralId);
+
+        // Ids of the selected items
+        RArray<TMPXItemId> selections;
+        CleanupClosePushL(selections);
+        aPath.SelectionL(selections);
+
+        // single selection
+        if (selections.Count() == 0)
+            {
+            selections.AppendL(aPath.Id(aPath.Levels() - 1));
+            }
+
+        TInt count(selections.Count());
+
+        for (TInt i = 0; i < count; ++i)
+            {
+            iDbHandler->GetEpisodesMatchingTitleL(selections[i], attributes.Array(), *episodes);
+            }
+
+        CleanupStack::PopAndDestroy(2, &attributes); // selections & attributes
+
+        // transform from CMPXMediaArray to RArray
+        RArray<TMPXItemId> episodeIds;
+        CleanupClosePushL(episodeIds);
+
+        TInt episodeCount(episodes->Count());
+        for (TInt i = 0; i < episodeCount; ++i)
+            {
+            CMPXMedia* episode = (*episodes)[i];
+
+            if (episode->IsSupported(KMPXMediaGeneralId))
+                {
+                episodeIds.AppendL(episode->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+                }
+            }
+
+        // modify the collection path. append another level with all episodes under the selected
+        // category/categories selected
+        episodeCount = episodeIds.Count();
+
+        if (episodeCount)
+            {
+            aPath.ClearSelection();
+            aPath.AppendL(episodeIds.Array());
+
+            // select all
+            for (TInt i = 0; i < episodeCount; ++i)
+                {
+                aPath.SelectL(episodeIds[i]);
+                }
+            }
+
+        CleanupStack::PopAndDestroy(2, episodes); // episodeIds & episodes
+        }
+    else
+        {
+        // else do nothing
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Execute an Add task step
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbPlugin::DoAddAsyncL()
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoAddAsyncL");
+
+    TBool done(EFalse);
+    CMPXMedia* task = iActiveTask->GetCommand().Value<CMPXMedia>(KMPXCommandColAddMedia);
+    User::LeaveIfNull(task);
+
+    CMPXMessageArray& msgArray = iActiveTask->GetChangeMessages();
+
+    if (!task->IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    // Group of items or a single item
+    //
+    if (task->ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+        {
+        if(!task->IsSupported(KMPXMediaArrayContents))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        CMPXMediaArray* ary = task->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull( ary );
+
+        TInt step( iActiveTask->GetStep() );
+        DoAddItemL(*ary->AtL(step), msgArray);
+
+        if (++step == ary->Count())
+            {
+            done = ETrue;
+            }
+        }
+    else // type == EMPXItem
+        {
+        TUint32 item = DoAddItemL( *task, msgArray );
+        iActiveTask->GetCommand().SetTObjectValueL<TMPXItemId>( KMPXCommandColAddRtnId, item );
+        done = ETrue;
+        }
+
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+    return done;
+    }
+
+// ----------------------------------------------------------------------------
+// Add an item to the collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXPodcastDbPlugin::DoAddL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoAddL");
+
+    TUint32 itemId(0);
+    CMPXMessageArray* changeMsgAry = CMPXMessageArray::NewL();
+    CleanupStack::PushL( changeMsgAry );
+
+    if (!aMedia.IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    // Group of items
+    //
+    if (aMedia.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+        {
+        CMPXMediaArray* ary = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull( ary );
+
+        TInt count(ary->Count());
+        for (TInt i = 0; i < count; ++i)
+            {
+            DoAddItemL(*ary->AtL(i), *changeMsgAry);
+            }
+        }
+    else // single item
+        {
+        itemId = DoAddItemL(aMedia, *changeMsgAry);
+        }
+
+    iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+    DoHandleChangeL(changeMsgAry);
+    CleanupStack::PopAndDestroy(changeMsgAry);
+
+    return itemId;
+    }
+
+// ----------------------------------------------------------------------------
+// Add an item to the collection
+// ----------------------------------------------------------------------------
+//
+TUint32 CMPXPodcastDbPlugin::DoAddItemL(
+    const CMPXMedia& aMedia,
+    CMPXMessageArray& aMessageArray)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoAddItemL");
+
+    TInt itemId(0);
+
+    if (!aMedia.IsSupported(KMPXMediaGeneralCategory))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    switch ( aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory))
+        {
+        case EMPXPodcast:
+        case EMPXSong:
+            {
+            itemId = iDbHandler->AddEpisodeL(aMedia);
+            MPXDbCommonUtil::AddItemChangedMessageL(aMessageArray, itemId, EMPXItemInserted,
+                EMPXPodcast, KDBPluginUid);
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+
+    return itemId;
+    }
+// ----------------------------------------------------------------------------
+// Sets/updates the media for an item in the collection
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoSetL(
+    const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoSetL");
+
+    if (!aMedia.IsSupported(KMPXMediaGeneralType) ||
+        !aMedia.IsSupported(KMPXMediaGeneralCategory))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    CMPXDbActiveTask::TChangeVisibility visibleChange(CMPXDbActiveTask::ENotVisibile);
+
+    switch ( aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory))
+        {
+        case EMPXPodcast:
+        case EMPXSong:
+            {
+            // a list of changed messages as a result of the episode being updated
+            CMPXMessageArray* itemChangedMessages = CMPXMediaArray::NewL();
+            CleanupStack::PushL(itemChangedMessages);
+
+             if (aMedia.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+                {
+                if (!aMedia.IsSupported(KMPXMediaArrayContents))
+                    {
+                    User::Leave(KErrArgument);
+                    }
+
+                CMPXMediaArray* array = aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+                User::LeaveIfNull( array );
+
+                TInt count(array->Count());
+                for (TInt i = 0; i < count; ++i)
+                    {
+                    visibleChange = (CMPXDbActiveTask::TChangeVisibility)(visibleChange |
+                            iDbHandler->UpdateEpisodeL(*array->AtL(i), *itemChangedMessages));
+                    }
+                }
+             else
+                {
+                visibleChange = iDbHandler->UpdateEpisodeL(aMedia,
+                    *itemChangedMessages);
+                }
+
+             if (visibleChange)
+                {
+                iActiveTask->SetVisibleChange(visibleChange);
+                DoHandleChangeL(itemChangedMessages);
+                }
+
+            CleanupStack::PopAndDestroy(itemChangedMessages);
+            }
+            break;
+
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            }
+            break;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Execute a task step for async set
+// ----------------------------------------------------------------------------
+//
+TBool CMPXPodcastDbPlugin::DoSetAsyncL()
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoSetAsyncL");
+
+    TBool done(EFalse);
+    CMPXMedia* task = (iActiveTask->GetCommand().Value<CMPXMedia>(KMPXCommandColSetMedia));
+    User::LeaveIfNull( task );
+
+    CMPXMessageArray& msgArray = iActiveTask->GetChangeMessages();
+    CMPXDbActiveTask::TChangeVisibility visibleChange(iActiveTask->GetVisibleChange());
+
+    // Multiple steps can be in a transaction for faster response
+    if( iDbHandler && !iDbHandler->InTransaction() )
+        {
+        iDbHandler->BeginTransactionL();
+        }
+
+    if (!task->IsSupported(KMPXMediaGeneralType))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    if (task->ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType) == EMPXGroup)
+        {
+        if (!task->IsSupported(KMPXMediaArrayContents))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        // Multiple items
+        CMPXMediaArray* array = task->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+        User::LeaveIfNull( array );
+
+        TInt step = iActiveTask->GetStep();
+        visibleChange = (CMPXDbActiveTask::TChangeVisibility)( visibleChange | iDbHandler->UpdateEpisodeL(*array->AtL(step), msgArray));
+
+        if (++step == array->Count())
+            {
+            done = ETrue;
+            }
+        }
+    else // Single item
+        {
+        visibleChange = iDbHandler->UpdateEpisodeL(*task, msgArray);
+        done = ETrue;
+        }
+    iActiveTask->SetVisibleChange(visibleChange);
+    return done;
+    }
+
+// ----------------------------------------------------------------------------
+// Handle change events
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::HandleChangeL(
+    const CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::HandleChange");
+
+    // check if message is filled
+    if (aMessage.IsSupported(KMPXMessageGeneralId))
+        {
+#ifdef _DEBUG
+        PrintMessagesL(aMessage);
+#endif  // _DEBUG
+        if(iRefreshing)
+            {
+            if (aMessage.IsSupported(KMPXMessageArrayContents))
+                {
+                const CMPXMessageArray* messageArray = aMessage.Value<CMPXMessageArray>(KMPXMessageArrayContents);
+                if(messageArray)
+                    {
+                    CMPXMessage& message = *((*messageArray)[0]);
+                    TMPXChangeEventType changeType( message.ValueTObjectL<TMPXChangeEventType>( KMPXMessageChangeEventType ) );
+                    TMPXGeneralCategory cat(message.ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory));
+                    if(changeType == EMPXItemInserted && (cat == EMPXPodcast || cat == EMPXSong || cat == EMPXPlaylist))
+                        {
+                        iObs->HandleMessage(aMessage);
+                        }
+                    }
+                }
+            else
+                {
+                TMPXChangeEventType changeType( aMessage.ValueTObjectL<TMPXChangeEventType>( KMPXMessageChangeEventType ) );
+                TMPXGeneralCategory cat(aMessage.ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory));
+                if(changeType == EMPXItemInserted && (cat == EMPXPodcast || cat == EMPXSong || cat == EMPXPlaylist))
+                    {
+                    iObs->HandleMessage(aMessage);
+                    }
+                }
+            }
+        else
+            {
+            if(!iMtpInUse)
+                {
+                iObs->HandleMessage(aMessage);
+                }
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Construct a CMPXMedia and call HandleChange
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoHandleChangeL(
+    CMPXMessageArray* aItemChangedMessages)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoHandleChangeL");
+
+    TMPXCommandId cmdId = iActiveTask->GetTask();
+    if((iActiveTask->GetVisibleChange() | CMPXDbActiveTask::EAllVisible)
+        && (cmdId == KMPXCommandIdCollectionSet ||
+            cmdId == KMPXCommandIdCollectionAdd ||
+            cmdId == KMPXCommandIdCollectionRemove ||
+            cmdId == KMPXCommandIdCollectionRemoveMedia ||
+            cmdId == KMPXCommandIdCollectionCompleteDelete ))
+        {
+        MPXDbCommonUtil::AddItemChangedMessageL(*aItemChangedMessages, EBrowseAll,
+                                                 EMPXItemModified, EMPXCollection, KDBPluginUid);
+        }
+
+    // group change messages and send to collection client context
+    CMPXMessage* message = CMPXMessage::NewL();
+    CleanupStack::PushL(message);
+
+    message->SetTObjectValueL<TMPXMessageId>(KMPXMessageGeneralId, KMPXMessageIdItemChanged);
+    message->SetCObjectValueL(KMPXMessageArrayContents, aItemChangedMessages);
+    message->SetTObjectValueL<TInt>(KMPXMessageArrayCount, aItemChangedMessages->Count());
+
+    HandleChangeL(*message);
+
+    CleanupStack::PopAndDestroy(message);
+    }
+
+// ----------------------------------------------------------------------------
+// Handle out of disk events during db merging
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::HandleOutOfDiskMessageL()
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::HandleOutOfDiskMessageL");
+
+    if (iObs)
+        {
+        // Create the msg
+        CMPXMessage* msg = CMPXMessage::NewL();
+        CleanupStack::PushL( msg );
+
+        // Setup the message parameters
+        msg->SetTObjectValueL<TInt>(KMPXMessageGeneralId, KMPXCustomMessageId);
+        msg->SetTObjectValueL<TInt>(KMPXCustomMessageCollectionId, KDBPluginUid);
+        msg->SetTObjectValueL<TInt>(KMPXCustomMessageEventType, EMcsOpen);
+        msg->SetTObjectValueL<TInt>(KMPXCustomMessageErrorCode, KErrDiskFull);
+
+        // Callback and Cleanup
+        iObs->HandleMessage(*msg);
+        CleanupStack::PopAndDestroy(msg);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Handle completion of operation
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoHandleOperationCompletedL(
+    TInt aErr)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoHandleOperationCompletedL");
+
+    if( iDbHandler && iDbHandler->InTransaction() )
+        {
+        // Commit if cancelled
+        TInt err(aErr);
+        if( err == KErrCancel )
+            {
+            err = KErrNone;
+            }
+        iDbHandler->EndTransactionL( err );
+        }
+    
+    // Broadcase change messages
+    //
+    if (iActiveTask->GetVisibleChange())
+        {
+        DoHandleChangeL(&iActiveTask->GetChangeMessages());
+        }
+
+    // Callback to engine to signal completion
+    // NOTE: Collection server immediately completes the async message when
+    // Cancel is called, no need to callback to observer
+    if (aErr != KErrCancel)
+        {
+        iObs->HandleCommandComplete(NULL, aErr);
+        }    
+    }
+     
+
+// ----------------------------------------------------------------------------------------------------------
+// Complete a delete operation
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoHandleDeleteCompleteL(
+    CMPXCommand& aCmd)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoHandleDeleteCompleteL");
+    iFirstDeleteStep = ETrue;
+    iSelections.Reset();
+    // Change messages
+    if (aCmd.IsSupported(KMPXCommandCollectionDeleteMsgArray))
+        {
+        CMPXMessageArray* msgs = aCmd.Value<CMPXMessageArray>(KMPXCommandCollectionDeleteMsgArray);
+        User::LeaveIfNull( msgs );
+        iActiveTask->SetVisibleChange(CMPXDbActiveTask::EAllVisible);
+        DoHandleChangeL(msgs);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Maps a given browse type to a category ID.
+// ----------------------------------------------------------------------------
+//
+TMPXPodcastCategory CMPXPodcastDbPlugin::CategoryForBrowseType(
+    TMCBrowseType aBrowseType)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::CategoryForBrowseType");
+
+    TMPXPodcastCategory cat(EMPXUnknown);
+
+    switch (aBrowseType)
+        {
+        case EBrowseAll:
+            {
+            cat = EMPXAll;
+            break;
+            }
+        case EBrowseTitle:
+            {
+            cat = EMPXTitle;
+            break;
+            }
+        case EBrowsePubDate:
+            {
+            cat = EMPXPubDate;
+            break;
+            }
+        case EBrowseRecentlyAdded:
+            {
+            cat = EMPXRecentlyAdded;
+            break;
+            }
+        case EBrowseNotPlayed:
+            {
+            cat = EMPXNotYetPlayed;
+            break;
+            }
+        default:
+            {
+            // do nothing
+            break;
+            }
+        }
+
+    return cat;
+    }
+
+// ----------------------------------------------------------------------------
+// Maps a given category ID to a browse type.
+// ----------------------------------------------------------------------------
+//
+TMCBrowseType CMPXPodcastDbPlugin::BrowseTypeForCategory(
+    TMPXPodcastCategory aCategory)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::BrowseTypeForCategory");
+
+    TMCBrowseType browseType(EBrowseNotPlayed);
+
+    switch (aCategory)
+        {
+        case EMPXAll:
+            {
+            browseType = EBrowseAll;
+            break;
+            }
+        case EMPXTitle:
+            {
+            browseType = EBrowseTitle;
+            break;
+            }
+        case EMPXPubDate:
+            {
+            browseType = EBrowsePubDate;
+            break;
+            }
+        case EMPXRecentlyAdded:
+            {
+            browseType = EBrowseRecentlyAdded;
+            break;
+            }
+        default:
+            {
+            // do nothing
+            break;
+            }
+        }
+
+    return browseType;
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the type, category and title attributes in the specified media instance
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::SetMediaGeneralAttributesL(
+    CMPXMedia& aMedia,
+    TMPXGeneralType aGeneralType,
+    TMPXPodcastType aType,
+    TMPXPodcastCategory aCategory,
+    const TDesC& aTitle,
+    TInt aCount /* = -1 */)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::SetMediaGeneralAttributesL");
+
+    aMedia.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, aGeneralType);
+    aMedia.SetTObjectValueL<TMPXPodcastType>(KMPXMediaPodcastType, aType);
+    aMedia.SetTObjectValueL<TMPXPodcastCategory>(KMPXMediaPodcastCategoryGroup, aCategory);
+    aMedia.SetTextValueL(KMPXMediaGeneralTitle, aTitle);
+
+    if (aCount >= 0)
+        {
+        aMedia.SetTObjectValueL(KMPXMediaGeneralCount, aCount);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the type, category and title attributes in the specified media instance
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::SetMediaGeneralAttributesL(
+    CMPXMedia& aMedia,
+    TMPXGeneralType aGeneralType,
+    TMPXPodcastType aType,
+    TMPXPodcastCategory aCategory,
+    TInt aId,
+    TInt aCount /* = -1 */)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::SetMediaGeneralAttributesL");
+
+    HBufC* title = iDbHandler->GetTitleNameMatchingIdL(aId);
+    CleanupStack::PushL(title);
+    SetMediaGeneralAttributesL(aMedia, aGeneralType, aType, aCategory, *title, aCount);
+    CleanupStack::PopAndDestroy(title);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Get total podcast count for a database
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoGetCollectionCountL( const CMPXCommand& aCmd )
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoGetCollectionCountL");
+    //as there is only one table containing uri data, KMPXCommandCollectionCountTable is ignored
+    if (!aCmd.IsSupported(KMPXCommandCollectionCountDrive))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TInt drive = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionCountDrive);
+    TInt count = (TInt)iDbHandler->GetTotalCountL(drive);
+    ((CMPXMedia&)aCmd).SetTObjectValueL<TInt>(KMPXCommandCollectionCountValue, count);
+    }
+
+// ----------------------------------------------------------------------------------------------------------
+// Get URIs for all podcasts in a database
+// ----------------------------------------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::DoGetCollectionUriL( const CMPXCommand& aCmd )
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::DoGetCollectionCountL");
+    //as there is only one table containing uri data, KMPXCommandCollectionCountTable is ignored
+    if (!aCmd.IsSupported(KMPXCommandCollectionURIDrive) ||
+        !aCmd.IsSupported(KMPXCommandCollectionURIFromID) ||
+        !aCmd.IsSupported(KMPXCommandCollectionURIRecords) )
+        {
+        User::Leave(KErrArgument);
+        }
+
+    TInt drive = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionURIDrive);
+    TInt fromID = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionURIFromID);
+    TInt recnum = aCmd.ValueTObjectL<TInt>(KMPXCommandCollectionURIRecords);
+
+    CDesCArray* uris = new(ELeave) CDesCArrayFlat(4);
+    CleanupStack::PushL(uris);
+    TInt lastID = 0;
+
+    iDbHandler->GetPodcastUriArrayL(drive, fromID, recnum, *uris, lastID);
+
+    ((CMPXMedia&)aCmd).SetNoNewLCObjectL(KMPXCommandCollectionURIList, uris);
+    ((CMPXMedia&)aCmd).SetTObjectValueL(KMPXCommandCollectionURILastID, lastID);
+    CleanupStack::PopAndDestroy(uris);
+    }
+
+void CMPXPodcastDbPlugin::SetAttributesL(
+    const CMPXCollectionPath& aPath,
+    RArray<TMPXAttribute>& aAttrs,
+    RArray<TInt>& aSupportedIds )
+    {
+    aAttrs.AppendL(TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralTitle |
+        EMPXMediaGeneralDuration | EMPXMediaGeneralSize |
+        EMPXMediaGeneralType | EMPXMediaGeneralCategory | EMPXMediaGeneralId |
+        EMPXMediaGeneralUri | EMPXMediaGeneralFlags | EMPXMediaGeneralCount |
+        EMPXMediaGeneralPlayCount | EMPXMediaGeneralLastPlaybackPosition |
+        EMPXMediaGeneralCollectionId | EMPXMediaGeneralDate));
+    
+    aAttrs.AppendL(TMPXAttribute(KMPXMediaIdPodcast,
+        EMPXMediaPodcastType | EMPXMediaPodcastCategoryGroup | EMPXMediaPodcastIsPlaying));
+
+    aSupportedIds.AppendL(KMPXMediaIdContainer);
+    aSupportedIds.AppendL(KMPXMediaIdGeneral);
+    aSupportedIds.AppendL(KMPXMediaIdPodcast);
+
+    TInt levels(aPath.Levels());
+    if ( 1 < levels )
+        {
+        // All episodes in a title
+        aAttrs.AppendL( TMPXAttribute(KMPXMediaIdMusic, EMPXMediaMusicAlbumArtFileName ) );
+        aSupportedIds.AppendL( KMPXMediaIdMusic );
+        }
+    }
+
+#ifdef _DEBUG
+
+// ----------------------------------------------------------------------------
+// Print change events
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::PrintMessagesL(
+    const CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::PrintMessages");
+
+    if (aMessage.IsSupported(KMPXMessageArrayContents))
+        {
+        const CMPXMessageArray* messageArray =
+            aMessage.Value<CMPXMessageArray>(KMPXMessageArrayContents);
+        if( !messageArray )
+            {
+            User::Leave( KErrNoMemory );
+            }
+
+        TInt count(messageArray->Count());
+        MPX_DEBUG2("%d messages:", count);
+
+        for (TInt i = 0; i < count; ++i)
+            {
+            PrintMessage(*((*messageArray)[i]));
+            }
+        }
+    else
+        {
+        PrintMessage(aMessage);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Print one change event
+// ----------------------------------------------------------------------------
+//
+void CMPXPodcastDbPlugin::PrintMessage(
+    const CMPXMessage& aMessage)
+    {
+    MPX_FUNC("CMPXPodcastDbPlugin::PrintMessage");
+
+    if (aMessage.IsSupported(KMPXMessageGeneralId))
+        {
+        TMPXItemId id = aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageGeneralId);
+        MPX_DEBUG3("    message id[0x%x, 0x%x]", id.iId1, id.iId2);
+        }
+
+    if (aMessage.IsSupported(KMPXMessageCollectionId))
+        {
+        TUid uid = aMessage.ValueTObjectL<TUid>(KMPXMessageCollectionId);
+        MPX_DEBUG2("    uid [0x%x]", uid.iUid);
+        }
+
+    if (aMessage.IsSupported(KMPXMessageChangeEventType))
+        {
+        MPX_DEBUG2("    change event type [%d]",
+             aMessage.ValueTObjectL<TMPXChangeEventType>(KMPXMessageChangeEventType));
+        }
+
+    if (aMessage.IsSupported(KMPXMessageMediaGeneralCategory))
+        {
+        MPX_DEBUG2("    category [%d]",
+             aMessage.ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory));
+        }
+
+    if (aMessage.IsSupported(KMPXMessageMediaGeneralId))
+        {
+        TMPXItemId id = aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId);
+        MPX_DEBUG3("    media id[0x%x, 0x%x]", id.iId1, id.iId2);
+        }
+
+    if (aMessage.IsSupported(KMPXMessageMediaDeprecatedId))
+        {
+        TMPXItemId id = aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId);
+        MPX_DEBUG3("    deprecated id [0x%x, 0x%x]", id.iId1, id.iId2);
+        }
+    }
+
+#endif// _DEBUG
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/mpxsqlitepodcastdbplugin/src/mpxpodcastdbpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+#include <implementationproxy.h>
+#include "mpxpodcastdbplugin.h"
+
+#if (!defined IMPLEMENTATION_PROXY_ENTRY)
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) {{aUid},(TProxyNewLPtr)(aFuncPtr)}
+#endif
+
+// ----------------------------------------------------------------------------
+// The list of implementations
+// ----------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    { IMPLEMENTATION_PROXY_ENTRY(0x101FFC3C, CMPXPodcastDbPlugin::NewL) };
+
+// ----------------------------------------------------------------------------
+// The proxy of implementations
+// ----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount=sizeof(ImplementationTable) / sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/rom/mpxinmemplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxinmemplugin
+*
+*/
+
+
+
+#ifndef MPXINMEMORYDBPLUGIN_IBY
+#define MPXINMEMORYDBPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN(  mpxinmemoryplugin.dll, 101FFCD9.rsc )
+
+#endif // MPXINMEMORYDBPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitedbcommon.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project collection mpxsqlitedbcommon
+*
+*/
+
+
+
+#ifndef MPXSQLITEDBCOMMON_IBY
+#define MPXSQLITEDBCOMMON_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+file=ABI_DIR\BUILD_DIR\mpxsqlitedbcommon.dll          SHARED_LIB_DIR\mpxsqlitedbcommon.dll
+
+#endif // MPXSQLITEDBCOMMON_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitedbhgplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxsqlitedbhgplugin
+*
+*/
+
+
+
+#ifndef MPXSQLITEDBHGPLUGIN_IBY
+#define MPXSQLITEDBHGPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxsqlitedbhgplugin.dll, 10207C85.rsc )
+SCALABLE_IMAGE( APP_RESOURCE_DIR, APP_RESOURCE_DIR, mpxdbhgplugin )
+
+#endif // MPXSQLITEDBHGPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitedbhgpluginrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxsqlitedbhgplugin
+*
+*/
+
+
+
+#ifndef MPXSQLITEDBPLUGINHGRSC_IBY
+#define MPXSQLITEDBPLUGINHGRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxcollectiondbhgres.rsc     APP_RESOURCE_DIR\mpxcollectiondbhgres.rsc
+
+#endif // MPXSQLITEDBPLUGINHGRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitedbplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxsqlitedbplugin
+*
+*/
+
+
+
+#ifndef MPXSQLITEDBPLUGIN_IBY
+#define MPXSQLITEDBPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxsqlitedbplugin.dll, 0x101ffc3e.rsc )
+SCALABLE_IMAGE( APP_RESOURCE_DIR, APP_RESOURCE_DIR, mpxdbplugin )
+
+#endif // MPXSQLITEDBPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitedbpluginrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxsqlitedbplugin
+*
+*/
+
+
+
+#ifndef MPXSQLITEDBPLUGINRSC_IBY
+#define MPXSQLITEDBPLUGINRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxcollectiondbres.rsc     APP_RESOURCE_DIR\mpxcollectiondbres.rsc
+
+#endif // MPXSQLITEDBPLUGINRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitepodcastdbplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxsqlitepodcastdbplugin
+*
+*/
+
+
+
+#ifndef MPXSQLITEPODCASTDBPLUGIN_IBY
+#define MPXSQLITEPODCASTDBPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxsqlitepodcastdbplugin.dll, 0x101ffc3f.rsc )
+SCALABLE_IMAGE( APP_RESOURCE_DIR, APP_RESOURCE_DIR, mpxpodcastdbplugin )
+
+#endif // MPXSQLITEPODCASTDBPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/collectionplugins/rom/mpxsqlitepodcastdbpluginrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxsqlitepodcastdbplugin
+*
+*/
+
+
+
+#ifndef MPXSQLITEPODCASTDBPLUGINRSC_IBY
+#define MPXSQLITEPODCASTDBPLUGINRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\pcres.rsc      APP_RESOURCE_DIR\pcres.rsc
+
+#endif // MPXSQLITEPODCASTDBPLUGINRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for MPX Service Plugins.
+*
+*/
+
+
+#include "../collectionplugins/group/bld.inf"
+#include "../playbackplugins/group/bld.inf"
+#include "../playlistplugins/group/bld.inf"
+#include "../screensaverplugins/group/bld.inf"
+
+PRJ_EXPORTS
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/audioeffects/bwinscw/mpxaudioeffectengineU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,12 @@
+EXPORTS
+	??1CMPXAudioEffectEngine@@UAE@XZ @ 1 NONAME ; CMPXAudioEffectEngine::~CMPXAudioEffectEngine(void)
+	?CreateAudioEffectsL@CMPXAudioEffectEngine@@QAEXXZ @ 2 NONAME ; void CMPXAudioEffectEngine::CreateAudioEffectsL(void)
+	?DestroyAudioEffect@CMPXAudioEffectEngine@@QAEXXZ @ 3 NONAME ; void CMPXAudioEffectEngine::DestroyAudioEffect(void)
+	?NewL@CMPXAudioEffectEngine@@SAPAV1@PAVCMdaAudioPlayerUtility@@@Z @ 4 NONAME ; class CMPXAudioEffectEngine * CMPXAudioEffectEngine::NewL(class CMdaAudioPlayerUtility *)
+	?SetBalanceL@CMPXAudioEffectEngine@@QAEXXZ @ 5 NONAME ; void CMPXAudioEffectEngine::SetBalanceL(void)
+	?SetBassBoostL@CMPXAudioEffectEngine@@QAEXXZ @ 6 NONAME ; void CMPXAudioEffectEngine::SetBassBoostL(void)
+	?SetLoudnessL@CMPXAudioEffectEngine@@QAEXXZ @ 7 NONAME ; void CMPXAudioEffectEngine::SetLoudnessL(void)
+	?SetReverberationL@CMPXAudioEffectEngine@@QAEXXZ @ 8 NONAME ; void CMPXAudioEffectEngine::SetReverberationL(void)
+	?SetStereoWideningL@CMPXAudioEffectEngine@@QAEXXZ @ 9 NONAME ; void CMPXAudioEffectEngine::SetStereoWideningL(void)
+	?SetEqualizerL@CMPXAudioEffectEngine@@QAEXXZ @ 10 NONAME ; void CMPXAudioEffectEngine::SetEqualizerL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/audioeffects/eabi/mpxaudioeffectengineU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,16 @@
+EXPORTS
+	_ZN21CMPXAudioEffectEngine11SetBalanceLEv @ 1 NONAME
+	_ZN21CMPXAudioEffectEngine12SetLoudnessLEv @ 2 NONAME
+	_ZN21CMPXAudioEffectEngine13SetBassBoostLEv @ 3 NONAME
+	_ZN21CMPXAudioEffectEngine17SetReverberationLEv @ 4 NONAME
+	_ZN21CMPXAudioEffectEngine18DestroyAudioEffectEv @ 5 NONAME
+	_ZN21CMPXAudioEffectEngine18SetStereoWideningLEv @ 6 NONAME
+	_ZN21CMPXAudioEffectEngine19CreateAudioEffectsLEv @ 7 NONAME
+	_ZN21CMPXAudioEffectEngine4NewLEP22CMdaAudioPlayerUtility @ 8 NONAME
+	_ZN21CMPXAudioEffectEngineD0Ev @ 9 NONAME
+	_ZN21CMPXAudioEffectEngineD1Ev @ 10 NONAME
+	_ZN21CMPXAudioEffectEngineD2Ev @ 11 NONAME
+	_ZTI21CMPXAudioEffectEngine @ 12 NONAME ; #<TI>#
+	_ZTV21CMPXAudioEffectEngine @ 13 NONAME ; #<VT>#
+	_ZN21CMPXAudioEffectEngine13SetEqualizerLEv @ 14 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/audioeffects/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxaudioeffectengine.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxaudioeffectengine.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/audioeffects/group/mpxaudioeffectengine.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This is the project specification file for audio effect engine.
+*
+*/
+
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxaudioeffectengine.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC10
+
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxaudioeffectengine.cpp
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+
+CAPABILITY      CAP_GENERAL_DLL
+
+LIBRARY         euser.lib
+LIBRARY         SysUtil.lib
+LIBRARY         bafl.lib
+LIBRARY         charconv.lib
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+LIBRARY         environmentalreverbutility.lib
+LIBRARY         stereowideningeffect.lib
+LIBRARY         bassboosteffect.lib
+LIBRARY         mediaclientaudio.lib 
+LIBRARY         loudnesseffect.lib
+LIBRARY         audioequalizerutility.lib
+LIBRARY         equalizer.lib
+LIBRARY         customcommandutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         centralrepository.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/audioeffects/src/mpxaudioeffectengine.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,420 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Engine class that uses the Effects API and saves changes.
+*
+*/
+
+
+// INCLUDE FILES
+#include <centralrepository.h>
+#include <CustomCommandUtility.h>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+
+#include <EnvironmentalReverbUtility.h>
+#include <EnvironmentalReverbUtilityData.h>
+#include <StereoWideningBase.h>
+#include <StereoWideningData.h>
+#include <BassBoostBase.h>
+#include <BassBoostData.h>
+#include <LoudnessBase.h>
+#include <LoudnessData.h>
+#include <AudioEqualizerUtility.h>
+#include <EqualizerConstants.h>
+#include <mpxlog.h>
+
+#include "mpxaudioeffectengine.h"
+
+// Music setting
+const TUid KCRUidMPXMPSettings = {0x101FFCDC};
+const TUint32 KMPXMPEqPresetId = 0x00000001;
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectEngine::NewL()
+// Standard 2-Phased Constructor
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C CMPXAudioEffectEngine* CMPXAudioEffectEngine::NewL(
+    CMdaAudioPlayerUtility* aPlayer )
+    {
+    CMPXAudioEffectEngine* self = new( ELeave ) CMPXAudioEffectEngine( aPlayer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectEngine::CMPXAudioEffectEngine()
+// Constructor
+// -----------------------------------------------------------------------------
+// 
+CMPXAudioEffectEngine::CMPXAudioEffectEngine(CMdaAudioPlayerUtility* aPlayer)
+                                    :iMdaPlayer(aPlayer)   
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectEngine::~CMPXAudioEffectEngine()
+// Virtual destructor
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C CMPXAudioEffectEngine::~CMPXAudioEffectEngine()
+    {    
+    if (iProp)
+        {
+        delete iProp;
+        }
+    DestroyAudioEffect();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectEngine::ConstructL()
+// Standard Second Phased Constructor
+// -----------------------------------------------------------------------------
+// 
+void CMPXAudioEffectEngine::ConstructL()
+    {
+    iProp = new(ELeave) CMPXAudioEffectProperties();   
+    MPX_TRAPD( err, iProp->LoadFromFileL() ); //Loads saved settings if available
+    if( err != KErrNone )
+        {
+        MPX_DEBUG1("CMPXAudioEffectEngine::ConstructL -- reset save to file");
+        iProp->Reset();
+        iProp->SaveToFileL();        
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectEngine::SetBalanceL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void CMPXAudioEffectEngine::SetBalanceL()
+    {
+    iProp->LoadFromFileL();
+    if(iMdaPlayer)
+        {
+        if(iMdaPlayer->SetBalance(iProp->Balance())!=KErrNone)
+            {
+            User::Leave(KErrNotSupported);
+            }
+        } 
+    }
+  
+  
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectEngine::SetReverberationL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void CMPXAudioEffectEngine::SetReverberationL()
+    {
+#ifdef _REVERB
+    if(!iReverbEffect)
+        {
+         //Effect enabled immediately, cmdUtil ownership passed into new object
+        MPX_TRAPD(error, iReverbEffect = 
+                            CEnvironmentalReverbUtility::NewL(*iMdaPlayer));
+        if(!error)
+            {
+            SetReverberationL();
+            }
+        }
+
+    iProp->LoadFromFileL();
+
+    TBuf16<32> reverbation;
+    TBuf16<32> reverbation2;
+  
+    switch( iProp->Reverb() ) //aIndex ranges always from 0 to 7
+        {
+        case 1:   _LIT( KRevName, "Alley" );
+              reverbation.Append( KRevName );
+              break;
+        case 2:   _LIT( KRevName2, "Bathroom" );
+              reverbation.Append( KRevName2 );
+              break;
+        case 3:   _LIT( KRevName3, "Underwater" );
+              reverbation.Append( KRevName3 );
+              break;
+        case 4:   _LIT( KRevName4, "Small room" );
+              reverbation.Append( KRevName4 );
+              break;
+        case 5:   _LIT( KRevName5, "Medium room" );
+              reverbation.Append( KRevName5 );
+              break;
+        case 6:   _LIT( KRevName6, "Large room" );
+              reverbation.Append( KRevName6 );
+              break;
+        case 7:   _LIT( KRevName7, "Large hall" );
+              reverbation.Append( KRevName7 );
+              break;
+        default:  break;
+        }
+    TUint32 count;
+    count = iReverbEffect->NumberOfPreDefinedPresets();
+    TArray<TEfEnvironmentalReverbUtilityPreset> array = iReverbEffect->Presets();
+    
+    if( 0 != iProp->Reverb() )
+        {
+        TInt i = 0;
+        
+        do    //compare descriptors and apply preset if descriptors match
+          {
+          reverbation2.Copy( array[i].iPresetName );
+          if( reverbation2.Compare(reverbation) == 0 )
+            {
+            iReverbEffect->ApplyPresetL( i );
+            i = count;
+            }
+          i++;
+          }while( i < count );
+        }
+    else
+        {
+        iReverbEffect->DisableEnvironmentalReverbL();
+        }
+#endif
+    }
+  
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectEngine::SetStereoWideningL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void CMPXAudioEffectEngine::SetStereoWideningL()
+    {
+#ifdef _STEREO
+    iProp->LoadFromFileL();
+    
+    if(iProp->Stereo())
+        {
+        if(!iStereoEffect)  // If stereo widening is ON and not constructed
+            {
+            TUint stereoLevel = 100;
+            // cmdUtil ownership passed into new object           
+            MPX_TRAPD(error, 
+                  iStereoEffect = CStereoWidening::NewL(*iMdaPlayer, 
+                                                        EFalse, stereoLevel));
+            if(error)
+                {
+                iStereoEffect = NULL;
+                User::Leave(KErrNotSupported);
+                }
+            }
+
+        iStereoEffect->EnableL();
+        TUint8 level = 100;
+        iStereoEffect->SetStereoWideningLevelL( level );
+        iStereoEffect->ApplyL();
+        }
+    else
+        {
+        if (iStereoEffect)   // If audio effects was not on, then no need to disable
+            { 
+            iStereoEffect->DisableL();
+            }
+        }
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectEngine::SetBassBoostL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void CMPXAudioEffectEngine::SetBassBoostL()
+  {
+#ifdef _BASSBOOST
+    iProp->LoadFromFileL();
+    if(iProp->BassBoost())
+        {
+        if (!iBassBoostEffect)
+            {
+            // cmdUtil ownership passed into new object           
+            MPX_TRAPD(error, 
+                  iBassBoostEffect = CBassBoost::NewL(*iMdaPlayer, 
+                                                      iProp->BassBoost()));
+            if (error)
+                {
+                User::Leave(KErrNotSupported);
+                }
+            }
+        iBassBoostEffect->EnableL();
+        }
+    else
+        {
+        if (iBassBoostEffect)
+            {
+            iBassBoostEffect->DisableL();    
+            }
+        }
+#endif
+  }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectEngine::SetLoudnessL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void CMPXAudioEffectEngine::SetLoudnessL()
+    {
+#ifdef _LOUDNESS
+    iProp->LoadFromFileL();
+    if(iProp->Loudness())
+        {
+        if(!iLoudnessEffect)
+            {
+            // cmdUtil ownership passed into new object           
+            MPX_TRAPD(error, 
+                  iLoudnessEffect = CLoudness::NewL(*iMdaPlayer, 
+                                                    iProp->Loudness()));
+            if(error)
+                {
+                iLoudnessEffect = NULL;
+                User::Leave(KErrNotSupported);
+                }
+            else
+                {
+                }
+            } 
+            
+        iLoudnessEffect->EnableL();
+        }
+    else
+        {
+        if( iLoudnessEffect )   // Only disable if it was constructed
+            {
+            iLoudnessEffect->DisableL();
+            }
+        }
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// Sets the equalizer
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void CMPXAudioEffectEngine::SetEqualizerL()
+    {
+    MPX_DEBUG1("CMPXAudioEffectEngine::SetEqualizerL <--");
+    
+    // Create the effect
+    //
+    if( !iEqualizerEffect )
+        {
+        iEqualizerEffect = CAudioEqualizerUtility::NewL(*iMdaPlayer);
+        }
+        
+    // Get equalizer preset id from cenrep
+    //
+    TInt presetId( KEqualizerPresetNone );
+    TRAP_IGNORE(
+        {
+        CRepository* repository = CRepository::NewL( KCRUidMPXMPSettings );
+        repository->Get( KMPXMPEqPresetId, presetId );
+        delete repository;
+        repository = NULL;
+        } );
+
+    // Translate preset ID to index
+    //
+    MPX_DEBUG1("CMPXAudioEffectEngine::SetEqualizerL = finding preset index");
+    
+    TInt index( KErrNotFound );
+    if ( iEqualizerEffect && presetId != KEqualizerPresetNone )
+        {
+        TArray<TEfAudioEqualizerUtilityPreset> presetArray = 
+            iEqualizerEffect->Presets();
+
+        TBool found( EFalse );
+        for ( TInt i = 0; i < presetArray.Count() && found == EFalse; i++ )
+            {
+            if ( presetArray[i].iPresetNameKey == 
+                static_cast<TUint32>( presetId ) )
+                {
+                found = ETrue;
+                index = i;
+                }
+            }
+        }
+    MPX_DEBUG2("CMPXAudioEffectEngine::SetEqualizerL effect index: %i", index);
+    
+    // Apply preset index index or disable if not found
+    //
+    if ( KErrNotFound != index )
+        {
+        iEqualizerEffect->ApplyPresetL( index );
+        }
+    else
+        {
+        iEqualizerEffect->DisableEqualizerL();    
+        }
+        
+    MPX_DEBUG1("CMPXAudioEffectEngine::SetEqualizerL -->");
+    }
+    
+// ---------------------------------------------------------------------------
+// CreateAudioEffectsL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXAudioEffectEngine::CreateAudioEffectsL()
+    {
+    SetEqualizerL();
+    SetStereoWideningL();
+    SetBalanceL();
+    SetLoudnessL();
+    }
+    
+// -----------------------------------------------------------------------------
+// Destroy audio effect
+// -----------------------------------------------------------------------------
+// 
+EXPORT_C void CMPXAudioEffectEngine::DestroyAudioEffect()
+    {
+    if (iReverbEffect)
+        {
+        delete iReverbEffect;     //effect automatically disabled
+        iReverbEffect = NULL;
+        }
+        
+    if (iStereoEffect)
+        {
+        delete iStereoEffect;     //effect automatically disabled
+        iStereoEffect = NULL;
+        }
+    if (iBassBoostEffect)
+        {
+        delete iBassBoostEffect;  //effect automatically disabled
+        iBassBoostEffect = NULL;
+        }
+    if (iLoudnessEffect)
+        {
+        delete iLoudnessEffect;   //effect automatically disabled
+        iLoudnessEffect = NULL;
+        }
+    if (iEqualizerEffect)
+        {
+        delete iEqualizerEffect;  //effect automatically disabled
+        iEqualizerEffect = NULL;
+        }
+    }
+
+//End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project Playback plugins.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../audioeffects/group/bld.inf"
+#include "../localaudio/group/bld.inf"
+#include "../progressdownload/group/bld.inf"
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+#include "../progressdownloadsb/group/bld.inf"
+#endif
+
+PRJ_EXPORTS
+../rom/mpxlocalaudioplugin.iby          CORE_APP_LAYER_IBY_EXPORT_PATH(mpxlocalaudioplugin.iby)
+../rom/mpxaudioeffects.iby              CORE_APP_LAYER_IBY_EXPORT_PATH(mpxaudioeffects.iby)
+../rom/mpxprogressdownloadplugin.iby	CORE_APP_LAYER_IBY_EXPORT_PATH(mpxprogressdownloadplugin.iby)
+../rom/mpxprogressdownloadsbplugin.iby	CORE_APP_LAYER_IBY_EXPORT_PATH(mpxprogressdownloadsbplugin.iby)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/localaudio/data/101ffc04.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file.
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+
+#include <mpxplaybackplugin.hrh>
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: Supported plugin types.
+ *  E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. for music plugin will be: 0x101FFCDA
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags, not used now
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXCollectionPluginPriorities. This value determines
+ *  the returning order when several plugins can support the same set of Uids. 
+ *  Default value of this field is EMPXCollectionPluginPriorityNormal.
+ */
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC04;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXPlaybackPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x101FFC06;
+                    version_no = 1;
+                    display_name = "Local";
+                    default_data = "audio/mp3;audio/3gp;audio/3gpp2;audio/x-ms-wma;x-caf-audio/x-ms-wma;audio/mpeg;"
+                                   "audio/aac;audio/x-mp3;audio/mp4;audio/wav;audio/x-wav;audio/x-au;audio/au";
+                    opaque_data = "<s><e>.mp3;.aac;.3gp;.3gpp;.3g2;.3gpp2;.mp4;.wav;.wma;.asf;.odf;.dcf;.m4a"
+                                  "<t>"EPbLocal"</t>"
+                                  "<i>"EMPXPlaybackPluginPriorityHighest"</i>";
+                    }
+                };
+            }
+        };
+    }
+            
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/localaudio/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxlocalaudioplayback.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxlocalaudioplayback.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/localaudio/group/mpxlocalaudioplayback.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Local audio playback project specification
+*
+*/
+
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxlocalaudioplayback.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC04
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN
+
+VERSION 15.0
+
+//MACRO __S60_WMDRM_CONSUMPTION
+
+SOURCEPATH      ../src
+SOURCE          mpxlocalaudioplayback.cpp
+SOURCE          mpxlocalaudioplaybackproxy.cpp
+
+SOURCEPATH      ../data
+START RESOURCE  101ffc04.rss
+TARGET          mpxlocalaudioplayback.rsc
+END
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+SYSTEMINCLUDE   /epoc32/include/caf
+
+LIBRARY         euser.lib
+LIBRARY         bafl.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         mediaclientaudio.lib
+LIBRARY         mmfcontrollerframework.lib 
+LIBRARY         audioequalizerutility.lib
+LIBRARY         customcommandutility.lib
+LIBRARY         apgrfx.lib
+LIBRARY         apmime.lib 
+LIBRARY         caf.lib
+LIBRARY         cafutils.lib
+LIBRARY         mmcommon.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxaudioeffectengine.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/localaudio/inc/mpxlocalaudioplayback.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,220 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class plays local audio file
+*
+*/
+
+
+
+#ifndef CLOCALAUDIOPLAYBACK_H
+#define CLOCALAUDIOPLAYBACK_H
+
+// INCLUDES
+#include <mpxplaybackplugin.h>
+#include <mdaaudiosampleplayer.h>
+#include <mpxcenrepobserver.h>
+
+// FORWARD DECLARATIONS
+class CMPXCenRepWatcher;
+class CMPXDrmMediaUtility;
+class CMPXAudioEffectEngine;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+*  CMPXLocalAudioPlayback class
+*
+*  Plug-in basically handles audio via MMF's audio player utility.
+*  @lib LocalAudioPlayback.lib
+*/
+NONSHARABLE_CLASS(CMPXLocalAudioPlayback) : public CMPXPlaybackPlugin,
+                                            public MMdaAudioPlayerCallback,
+                                            public MMPXCenRepObserver
+    {
+    private:
+        enum TMPXLocalAudioPlaybackState
+            {
+            EStateNotInitialised,
+            EStateInitialising,
+            EStateInitialised
+            };
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        * @param aInitParams, initialization parameter
+        * @return a pointer to the created instance
+        */
+        static CMPXLocalAudioPlayback* NewL(TAny* aInitParams);
+
+        /**
+        * Destructor
+        * Destroy the object and release all memory objects
+        */
+        ~CMPXLocalAudioPlayback();
+
+    private: // Functions from base classes
+        /**
+        *  from CMPXPlaybackPlugin
+        */
+
+        /**
+        * Set observer
+        *
+        * @param aObs observer
+        */
+        void SetObserver(MMPXPlaybackPluginObserver& aObs);
+
+        /**
+        * Initializes a song for playback
+        * @param aSong the song path
+        */
+        void InitialiseL(const TDesC& aSong);
+
+        /**
+        * Initializes a song for playback
+        * @param aFile file handle of a song
+        */
+        void InitialiseL(RFile& aFile);
+
+        /**
+        * Executes a command on the selected song
+        * @param aCmd a command
+        * @param aData, data
+        */
+        void CommandL(TMPXPlaybackCommand aCmd, TInt aData=0);
+
+        /**
+        * Sets a property of the plugin
+        * @param aProperty a property
+        * @param aValue the value of the setting
+        */
+        void SetL(TMPXPlaybackProperty aProperty,TInt aValue);
+
+        /**
+        * Gets a property of the plugin (async)
+        * @param aProperty a property
+        */
+        void PropertyL(TMPXPlaybackProperty aProperty) const;
+
+        /**
+        * Gets a list of sub players
+        * @return a list of names of sub players
+        */
+        void SubPlayerNamesL();
+
+        /**
+        * Select a sub player
+        * @param aIndex index to the sub player
+        */
+    	void SelectSubPlayerL(TInt aIndex);
+
+        /**
+        * Returns current sub player name
+        * @return friendly name of the current the sub player
+        */
+        const TDesC& SubPlayerName();
+
+        /**
+        * Current sub player index
+        * @return index to the sub player
+        */
+        TInt SubPlayerIndex() const;
+
+        /**
+        * Media properties of the current file (async)
+        * @param aAttrs attributes requested
+        */
+        void MediaL(const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Cancel async request
+        */
+        void CancelRequest();
+
+        /**
+        *  From MMdaAudioPlayerCallback
+        */
+        void MapcInitComplete(TInt aError,
+                              const TTimeIntervalMicroSeconds& aDuration);
+
+        /**
+        *  From MMdaAudioPlayerCallback
+        */
+        void MapcPlayComplete(TInt aError);
+
+        /**
+        * From MMPXCenRepObserver
+        * Handle a change in a setting value.
+        *
+        * @param aRepositoryUid Central repository UID containing the setting
+        * @param aSettingId Id of the setting
+        * @since 3.0
+        */
+        void HandleSettingChange( const TUid& aRepositoryUid,
+                                  TUint32 aSettingId);
+    private:
+       /**
+        * C++ default constructor
+        */
+        CMPXLocalAudioPlayback();
+
+        /**
+        * the second phase constructor ConstructL to safely construct things
+        * that can leave
+        */
+        void ConstructL();
+
+        /**
+        * Sets the volume level in audio controller
+        * @param aVolume Volume level, ranges from 0 - KPbPlaybackVolumeLevelMax
+        */
+        void SetVolume( TInt aVolume );
+
+        /**
+        * Sets the volume level in audio controller to mute.
+        * @param aMute ETrue to indicated mute
+        */
+        void SetMute( TBool aMute );
+
+        /**
+        *  Consumes the rights for the current media according
+        *  to the specified consume type
+        *
+        *  @param aType Type of consumption to execute
+        */
+        void ConsumeRightsL(ContentAccess::TIntent aIntent);
+
+
+    private: // Data
+        CMPXCenRepWatcher* iVolumeWatcher;
+        CMPXCenRepWatcher* iMuteWatcher;
+        CMdaAudioPlayerUtility* iPlayer;
+        HBufC* iSong;
+        TInt iVolume;
+        RFs iFs;
+        RFile iFile;
+        CMPXDrmMediaUtility* iDrmMediaUtility;
+        CMPXAudioEffectEngine* iAudioEffects;
+        TMPXLocalAudioPlaybackState iState;
+        TBool iClosedByAudioPolicy;
+        TBool iConsumeStarted;
+        TBool iAudioEffectsOn;
+        TBool iIsPlaying;
+    };
+
+#endif      // CLOCALAUDIOPLAYBACK_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/localaudio/src/mpxlocalaudioplayback.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1253 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class plays local audio file
+*
+*/
+
+
+// INCLUDE FILES
+//<branchInfo originator="alakurik" since="26-NOV-2007"/>
+// Including adaptationaudiopreference.h instead of audiopreference.h to
+// bring in needed constants for __HIGH_RESOLUTION_VOLUME
+//</branchInfo>
+//BRANCH 26-NOV-2007
+//#include <audiopreference.h>
+//BRANCH_END
+#if defined(__HIGH_RESOLUTION_VOLUME) && !defined(__LOW_POWER_AUDIO_PLAYBACK)
+#include <adaptationaudiopreference.h>
+#else
+#include <AudioPreference.h>
+#endif
+#include <badesca.h>
+#include <apgcli.h>
+#include <mmf/common/mmfcontrollerframeworkbase.h>
+#include <mmf/common/mmfmeta.h>
+#include <mpxmedia.h>
+#include <mpxdrmmediautility.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxplaybackpluginobserver.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediadrmdefs.h>
+#include "mpxaudioeffectengine.h"
+#include <mpxprivatecrkeys.h>
+#include <mpxcenrepwatcher.h>
+
+#include "mpxlocalaudioplayback.h"
+#include "mpxlog.h"
+
+// CONSTANTS
+const TUid  KLocalPlaybackUid={0x101FFC06};
+_LIT(KWmaExtension, ".wma");
+_LIT(KRaExtension, ".ra"); 
+
+    
+// ============================ LOCAL FUNCTIONS ==============================
+LOCAL_C TInt Balance(TInt aMMFBalance)
+    {
+    return (aMMFBalance-KMMFBalanceCenter) *
+           (EPbBalanceMaxRight-EPbBalanceMaxLeft) /
+           (KMMFBalanceMaxRight-KMMFBalanceMaxLeft);
+    }
+
+LOCAL_C TInt MMFBalance(TInt aBalance)
+    {
+    return KMMFBalanceCenter+(KMMFBalanceMaxRight-KMMFBalanceMaxLeft)/
+           (EPbBalanceMaxRight-EPbBalanceMaxLeft)*aBalance;
+    }
+
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXLocalAudioPlayback* CMPXLocalAudioPlayback::NewL(TAny* /*aInitParams*/)
+    {
+    CMPXLocalAudioPlayback* p=new(ELeave)CMPXLocalAudioPlayback();
+    CleanupStack::PushL(p);
+    p->ConstructL();
+    CleanupStack::Pop(p);
+    return p;
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::ConstructL()
+    {
+    MPX_FUNC_EX("CMPXLocalAudioPlayback::ConstructL()");
+    iVolumeWatcher = CMPXCenRepWatcher::NewL(KCRUidMPXSettings,
+                                             KMPXPlaybackVolume,
+                                             this);
+
+    iMuteWatcher = CMPXCenRepWatcher::NewL(KCRUidMPXSettings,
+                                           KMPXPlaybackMute,
+                                           this);
+
+    iPlayer = CMdaAudioPlayerUtility::NewL(*this,
+#ifdef __LOW_POWER_AUDIO_PLAYBACK
+                        KAudioPriorityMusicPlayer,
+                        TMdaPriorityPreference(KAudioPrefMusicLocalPlayback));
+#else
+#ifdef __HIGH_RESOLUTION_VOLUME
+                        KAudioPriorityTwentyStepsVolumeMusicPlayer,
+                        TMdaPriorityPreference(KAudioPrefTwentyStepsVolumeMusicPlayerPlayback));
+#else
+                        KAudioPriorityRealOnePlayer,
+                        TMdaPriorityPreference(KAudioPrefRealOneLocalPlayback));
+#endif // __HIGH_RESOLUTION_VOLUME
+#endif // __LOW_POWER_AUDIO_PLAYBACK
+
+    User::LeaveIfError(iFs.Connect());
+    iFs.ShareProtected();
+    iDrmMediaUtility = CMPXDrmMediaUtility::NewL();
+    iAudioEffects = CMPXAudioEffectEngine::NewL( iPlayer );
+    }
+
+// ----------------------------------------------------------------------------
+// C++ constructor
+// ----------------------------------------------------------------------------
+//
+CMPXLocalAudioPlayback::CMPXLocalAudioPlayback()
+	: iAudioEffectsOn(ETrue), iIsPlaying(EFalse)
+    {}
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXLocalAudioPlayback::~CMPXLocalAudioPlayback()
+    {
+    MPX_FUNC_EX("CMPXLocalAudioPlayback::~CMPXLocalAudioPlayback");
+    delete iMuteWatcher;
+    delete iVolumeWatcher;
+    if ( iDrmMediaUtility )
+        {
+        TRAP_IGNORE( ConsumeRightsL( ContentAccess::EStop ) );
+        iDrmMediaUtility->Close();
+        delete iDrmMediaUtility;
+        }
+    if( iAudioEffects )
+        {
+        iAudioEffects->DestroyAudioEffect();
+        delete iAudioEffects;
+        }
+    if (iPlayer)
+        {
+        iPlayer->Close();
+        delete iPlayer;
+        }
+    iFile.Close();
+    iFs.Close();
+    delete iSong;
+    }
+
+// ----------------------------------------------------------------------------
+// Set observer
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::SetObserver(MMPXPlaybackPluginObserver& aObs)
+    {
+    MPX_FUNC_EX("CMPXLocalAudioPlayback::SetObserver(MMPXPlaybackPluginObserver& aObs)");
+    iObs = &aObs;
+    }
+
+// ----------------------------------------------------------------------------
+// Initializes a song for playback
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::InitialiseL(const TDesC& aSong)
+    {
+    MPX_DEBUG3("-->CMPXLocalAudioPlayback::InitialiseL 0x%08x, (%S)", this, &aSong);
+
+    iDrmMediaUtility->Close();
+    delete iSong;
+    iSong = NULL;
+    iSong = aSong.AllocL();
+    iFile.Close();
+    TInt err( iFile.Open( iFs, aSong, EFileRead | EFileShareReadersOrWriters ));
+    // Remap KErrNotReady to KErrNotFound, because it is referencing a drive
+    // that is not existent
+    if ( KErrNotReady == err )
+        {
+        err = KErrNotFound;
+        }
+    User::LeaveIfError( err );
+    
+#if defined(__HIGH_RESOLUTION_VOLUME)
+    TParsePtrC parser(aSong);
+    
+    // Merlin twentysteps hack start
+    if (parser.Ext().CompareF(KWmaExtension) == 0 || parser.Ext().CompareF(KRaExtension) == 0)
+        {
+        // This is a wma song, need to delete iPlayer and reset the volume resolution
+        // this is because the volume level 20 is not supported for wma with headphone
+        MPX_DEBUG1("CMPXLocalAudioPlayback::InitialiseL it is a wma file, so set to 10 steps");
+        delete iAudioEffects;
+        iAudioEffects = NULL;
+        delete iPlayer;
+        iPlayer = NULL;
+        iPlayer = CMdaAudioPlayerUtility::NewL(*this,
+                        KAudioPriorityRealOnePlayer,
+                        TMdaPriorityPreference(KAudioPrefRealOneLocalPlayback));
+        // Also regenerate audio effects
+        iAudioEffects = CMPXAudioEffectEngine::NewL( iPlayer );
+        }                        
+    // Merlin twentysteps hack end
+#endif // __HIGH_RESOLUTION_VOLUME
+    TMMFileHandleSource source(iFile, KDefaultContentObject, EPlay);
+    iPlayer->OpenFileL(source);
+    iDrmMediaUtility->InitL( iFile );
+    iState = EStateInitialising;
+    iClosedByAudioPolicy = EFalse;
+    iConsumeStarted = EFalse;
+
+    MPX_DEBUG3("<--CMPXLocalAudioPlayback::InitialiseL 0x%08x, (%S)", this, &aSong);
+    }
+
+// ----------------------------------------------------------------------------
+// Initializes a song for playback
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::InitialiseL(RFile& aSong)
+    {
+    MPX_DEBUG2("-->CMPXLocalAudioPlayback::InitialiseL(RFile) 0x%08x", this);
+
+    iDrmMediaUtility->Close();
+    delete iSong;
+    iSong = NULL;
+    iSong = HBufC::NewL(KMaxFileName);
+    TPtr ptr = iSong->Des();
+    aSong.FullName(ptr);
+    
+#if defined(__HIGH_RESOLUTION_VOLUME)
+    TParsePtrC parser(ptr);
+    
+    // Merlin twentysteps hack start
+    if (parser.Ext().CompareF(KWmaExtension) == 0 || parser.Ext().CompareF(KRaExtension) == 0)
+        {
+        // This is a wma song, need to delete iPlayer and reset the volume resolution
+        // this is because the volume level 20 is not supported for wma with headphone
+        delete iAudioEffects;
+        iAudioEffects = NULL;
+        delete iPlayer;
+        iPlayer = NULL;
+        iPlayer = CMdaAudioPlayerUtility::NewL(*this,
+                        KAudioPriorityRealOnePlayer,
+                        TMdaPriorityPreference(KAudioPrefRealOneLocalPlayback));
+        // Also regenerate audio effects
+        iAudioEffects = CMPXAudioEffectEngine::NewL( iPlayer );
+        }    
+    // Merlin twentysteps hack end
+#endif // __HIGH_RESOLUTION_VOLUME
+    TMMFileHandleSource source(aSong, KDefaultContentObject, EPlay);
+    iPlayer->OpenFileL(source);
+    User::LeaveIfError( iFile.Duplicate( aSong ));
+    iDrmMediaUtility->InitL( iFile );
+    iState = EStateInitialising;
+    iClosedByAudioPolicy = EFalse;
+    iConsumeStarted = EFalse;
+
+    MPX_DEBUG2("<--CMPXLocalAudioPlayback::InitialiseL(RFile) 0x%08x", this);
+    }
+
+// ----------------------------------------------------------------------------
+// Executes a command on the selected song
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::CommandL(TMPXPlaybackCommand aCmd, TInt aData)
+    {
+    MPX_DEBUG3("-->CMPXLocalAudioPlayback::CommandL 0x%08x cmd %d", this, aCmd);
+    switch(aCmd)
+        {
+        case EPbCmdPlay:
+            {
+            // If closed by audio policy, then play command will need to
+            // re-initialise the plugin first.
+            if ( iClosedByAudioPolicy )
+                {
+                HBufC* song( iSong->AllocLC() );
+                InitialiseL( *song );
+                iConsumeStarted = ETrue;
+                CleanupStack::PopAndDestroy( song );
+                iClosedByAudioPolicy = EFalse;
+                }
+            else
+                {
+                // Treat song as play complete if try to play at end of song
+                TTimeIntervalMicroSeconds dur( iPlayer->Duration() );
+                TTimeIntervalMicroSeconds pos( 0 );
+                TInt err( iPlayer->GetPosition( pos ));
+                MPX_DEBUG4("CMPXLocalAudioPlayback::CommandL(): dur=%d, pos=%d, err=%d", I64INT(dur.Int64()), I64INT(pos.Int64()), err);
+                if ( !err &&
+                     Abs( dur.Int64() - pos.Int64() ) < KPbMilliMultiplier &&
+                     dur.Int64() > KPbMilliMultiplier )
+                    {
+                    MapcPlayComplete( KErrNone );
+                    }
+                else
+                    {
+                    if (iConsumeStarted)
+                        {
+                        TRAPD( drmErr, ConsumeRightsL( ContentAccess::EContinue ) );
+                        if ( drmErr == KErrCANoRights )
+                            {
+                            iDrmMediaUtility->Close();
+                            iPlayer->Stop();
+                            iIsPlaying = EFalse;
+                            iAudioEffects->DestroyAudioEffect();
+                            iPlayer->Close();
+                            iObs->HandlePluginEvent(
+                                    MMPXPlaybackPluginObserver::EPStopped, 0,
+                                    drmErr);
+                            iFile.Close();
+                            iState = EStateNotInitialised;
+                            iObs->HandlePluginEvent(
+                                    MMPXPlaybackPluginObserver::EPClosed,
+                                    EPbCmdStop, drmErr);
+                            iClosedByAudioPolicy = EFalse;
+                            break;
+                            }
+                        }
+                    else
+                        {
+                        MPX_TRAPD( AEErr,  ConsumeRightsL( ContentAccess::EPlay ) );
+                        if (AEErr == KErrDiskFull)
+                        	{
+                        	iDrmMediaUtility->Close();
+				            iPlayer->Stop();
+				            iIsPlaying = EFalse;
+				            iAudioEffects->DestroyAudioEffect();
+				            iPlayer->Close();
+				            iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPStopped,
+				                    0, KErrDiskFull);
+				            iFile.Close();
+				            iState = EStateNotInitialised;
+				            iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPClosed,
+				                                    EPbCmdStop, KErrDiskFull);
+				            iClosedByAudioPolicy = EFalse;
+				            break;
+                        	}
+                        iConsumeStarted = ETrue;
+                        }
+
+					if ( iAudioEffectsOn )
+						{
+                    	MPX_TRAP( err,  iAudioEffects->CreateAudioEffectsL() );
+						}
+
+                    iPlayer->Play();
+                    iIsPlaying = ETrue;
+
+                    if( iAudioEffectsOn && err != KErrNone )
+                        {
+                        MPX_TRAP( err,  iAudioEffects->CreateAudioEffectsL() );
+                        }
+
+                    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPlaying,
+                                             0, KErrNone);
+                    }
+                }
+            break;
+            }
+        case EPbCmdPause:
+            {
+            TRAP_IGNORE( ConsumeRightsL( ContentAccess::EPause ) );
+
+            TInt err( iPlayer->Pause() );
+            iIsPlaying = EFalse;
+            iAudioEffects->DestroyAudioEffect();
+
+            MPX_DEBUG2("CMPXLocalAudioPlayback::CommandL(): Pause err = %d", err);
+            // If pause is not supported, resend the play command so plugin
+            // state is correct.
+            // This is for cases like playing .RNG files
+            if ( KErrNotSupported == err )
+                {
+                iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused,
+                                         0,
+                                         KErrNone);
+                iPlayer->Play();
+                iIsPlaying = ETrue;
+                iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPlaying,
+                                         0,
+                                         KErrNone);
+                }
+            else
+                {
+                iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused,
+                                         0,
+                                         err);
+                }
+            iClosedByAudioPolicy = EFalse;
+            break;
+            }
+        case EPbCmdStop:
+            {
+            TRAP_IGNORE( ConsumeRightsL( ContentAccess::EStop ));
+            iConsumeStarted = EFalse;
+            iDrmMediaUtility->Close();
+            iPlayer->Stop();
+            iIsPlaying = EFalse;
+            iAudioEffects->DestroyAudioEffect();
+            iPlayer->Close();
+
+            iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPStopped,
+                    0, KErrNone);
+            iFile.Close();
+            iState = EStateNotInitialised;
+            iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPClosed,
+                                    EPbCmdStop, KErrNone);
+            iClosedByAudioPolicy = EFalse;
+            break;
+            }
+        case EPbCmdClose:
+            {
+            TRAP_IGNORE( ConsumeRightsL( ContentAccess::EStop ));
+            iConsumeStarted = EFalse;
+            iDrmMediaUtility->Close();
+            iAudioEffects->DestroyAudioEffect();
+            iPlayer->Close();
+            iIsPlaying = EFalse;
+            iFile.Close();
+            iState = EStateNotInitialised;
+            iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPClosed,
+                                    EPbCmdClose, KErrNone);
+            iClosedByAudioPolicy = EFalse;
+            break;
+            }
+        case EPbApplyEffect:
+            {
+            // Re-init audio effects
+            MPX_DEBUG1("CMPXLocalAudioPlayback::CommandL EPbApplyEffect");
+            if( ( aData == KAudioEffectsID || aData == KEqualizerID ) &&
+                ( EStateInitialised == iState ) )
+                {
+                TRAP_IGNORE( iAudioEffects->CreateAudioEffectsL() );
+                iAudioEffectsOn = ETrue;
+                }
+            break;
+            }
+        case EPbCmdCloseItem:
+            {
+            iDrmMediaUtility->Close();
+            iPlayer->Close();
+            iIsPlaying = EFalse;
+            iFile.Close();
+            iState = EStateNotInitialised;
+            iClosedByAudioPolicy = EFalse;
+            break;
+            }
+        case EPbCmdDisableEffect:
+        	{
+			iAudioEffectsOn = EFalse;
+			break;
+			}
+		default:
+			break;
+        }
+    MPX_DEBUG3("<--CMPXLocalAudioPlayback::CommandL 0x%08x cmd %d", this, aCmd);
+    }
+
+// ----------------------------------------------------------------------------
+// Sets a property of the plugin
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::SetL(TMPXPlaybackProperty aProperty,TInt aValue)
+    {
+    MPX_DEBUG4("-->CMPXLocalAudioPlayback::SetL 0x%08x, (prop %d, val %d)",
+               this, aProperty, aValue);
+    TBool isSupported=ETrue;
+    switch(aProperty)
+        {
+        case EPbPropertyVolume:
+            {
+            SetVolume( aValue );
+            break;
+            }
+        case EPbPropertyVolumeRamp:
+            iPlayer->SetVolumeRamp(TTimeIntervalMicroSeconds(TInt64(aValue)));
+            break;
+        case EPbPropertyMute:
+            SetMute( aValue );
+            break;
+        case EPbPropertyBalance:
+            iPlayer->SetBalance(MMFBalance(aValue));
+            break;
+        case EPbPropertyPosition:
+            {
+            TInt64 pos(aValue);
+            pos *= KPbMilliMultiplier;
+            
+            if (iIsPlaying)
+                {
+                iPlayer->Pause();
+                iPlayer->SetPosition(pos);
+                //Handle error of license expired when tapping the progress playing bar 
+                TRAPD( drmErr, ConsumeRightsL( ContentAccess::EContinue ) );
+                if ( drmErr == KErrCANoRights )
+                    {
+                    iDrmMediaUtility->Close();
+                    iPlayer->Stop();
+                    iIsPlaying = EFalse;
+                    iAudioEffects->DestroyAudioEffect();
+                    iPlayer->Close();
+                    iObs->HandlePluginEvent(
+                            MMPXPlaybackPluginObserver::EPStopped, 0, drmErr);
+                    iFile.Close();
+                    iState = EStateNotInitialised;
+                    iObs->HandlePluginEvent(
+                            MMPXPlaybackPluginObserver::EPClosed, EPbCmdStop,
+                            drmErr);
+                    iClosedByAudioPolicy = EFalse;
+                    return;
+                    }
+                iPlayer->Play();
+                }
+            else
+                {
+                iPlayer->SetPosition(pos);
+                }
+            }
+            break;
+        default:
+            isSupported=EFalse;
+        }
+
+    if (!isSupported)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPSetComplete,
+                             aProperty, KErrNone);
+    MPX_DEBUG4("<--CMPXLocalAudioPlayback::SetL 0x%08x, (prop %d, val %d)",
+               this, aProperty, aValue);
+    }
+
+// ----------------------------------------------------------------------------
+// Gets a property of the plugin (async)
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::PropertyL(TMPXPlaybackProperty aProperty) const
+    {
+    MPX_DEBUG3("-->CMPXLocalAudioPlayback::PropertyL 0x%08x (prop %d)",
+               this, aProperty);
+    TBool isSupported=ETrue;
+    TInt value=KErrNotFound;
+    TInt err(KErrNone);
+    switch(aProperty)
+        {
+        case EPbPropertyVolume:
+            {
+            value = iVolumeWatcher->CurrentValueL();
+            break;
+            }
+        case EPbPropertyMaxVolume:
+            value=iPlayer->MaxVolume();
+            break;
+        case EPbPropertyMute:
+            value = iMuteWatcher->CurrentValueL();
+            break;
+        case EPbPropertyBalance:
+            err = iPlayer->GetBalance(value);
+            value=Balance(value);
+            break;
+        case EPbPropertyDuration:
+            {
+            TTimeIntervalMicroSeconds duration = iPlayer->Duration();
+            value = duration.Int64() / KPbMilliMultiplier;
+            }
+            break;
+        case EPbPropertyPosition:
+            {
+            TTimeIntervalMicroSeconds pos;
+            iPlayer->GetPosition(pos);
+            MPX_DEBUG2("CMPXLocalAudioPlayback::PropertyL position %ld", pos.Int64());
+            value = pos.Int64() / KPbMilliMultiplier;
+            }
+            break;
+        case EPbPropertySupportedFeatures:
+            value = EPbFeatureBalance | EPbFeatureVolumeRamp;
+            break;
+        default:
+            isSupported=EFalse;
+        }
+    if (!isSupported)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    iObs->HandleProperty(aProperty,value,err);
+    MPX_DEBUG3("<--CMPXLocalAudioPlayback::PropertyL 0x%08x (prop %d)",
+               this, aProperty);
+    }
+
+// ----------------------------------------------------------------------------
+// Gets a list of sub players, UPnP only
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::SubPlayerNamesL()
+    {
+    iObs->HandleSubPlayerNames(KLocalPlaybackUid, NULL, ETrue, KErrNone);
+    }
+
+// ----------------------------------------------------------------------------
+// Select a sub player
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::SelectSubPlayerL(TInt /*aIndex*/)
+    {
+    User::Leave(KErrNotSupported);
+    }
+
+// ----------------------------------------------------------------------------
+// Returns current sub player name
+// ----------------------------------------------------------------------------
+//
+const TDesC& CMPXLocalAudioPlayback::SubPlayerName()
+    {
+    return KNullDesC; //No subplayer name for local playback
+    }
+
+// ----------------------------------------------------------------------------
+// Current sub player index
+// ----------------------------------------------------------------------------
+//
+TInt CMPXLocalAudioPlayback::SubPlayerIndex() const
+   {
+   return KErrNotFound;
+   }
+
+// ----------------------------------------------------------------------------
+// Gets media properties
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::MediaL(const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_DEBUG2("-->CMPXLocalAudioPlayback::MediaL 0x%08x", this);
+    RArray<TInt> suppIds;
+    CleanupClosePushL(suppIds);
+    suppIds.AppendL(KMPXMediaIdMusic);
+    suppIds.AppendL(KMPXMediaIdGeneral);
+    suppIds.AppendL(KMPXMediaIdAudio);
+    suppIds.AppendL(KMPXMediaIdDrm);
+    CMPXMedia* media=CMPXMedia::NewL(suppIds.Array());
+    CleanupStack::PopAndDestroy(&suppIds);
+    CleanupStack::PushL(media);
+
+    if ( EStateInitialised == iState )
+        {
+        TUint attrG(0); // General attributes
+        TUint attrA(0); // Audio attributes
+        TUint attrM(0); // Music attributes
+        TUint attrD(0); // DRM attributes
+
+        for (TInt i=aAttrs.Count(); --i>=0;)
+            {
+            TMPXAttribute attr(aAttrs[i]);
+            if (attr.ContentId() == KMPXMediaIdGeneral)
+                {
+                attrG |= attr.AttributeId();
+                }
+            else if (attr.ContentId() == KMPXMediaIdMusic)
+                {
+                attrM |= attr.AttributeId();
+                }
+            else if (attr.ContentId() == KMPXMediaIdAudio)
+                {
+                attrA |= attr.AttributeId();
+                }
+            else if ( attr.ContentId() == KMPXMediaIdDrm )
+                {
+                attrD |= attr.AttributeId();
+                }
+            }
+
+        TInt metaCount = 0;
+
+        // Get metadata from MMF
+        TInt error = iPlayer->GetNumberOfMetaDataEntries(metaCount);
+        CMMFMetaDataEntry* metaData = NULL;
+
+        if (!error)
+            {
+            for (TInt i = 0; i < metaCount; ++i)
+                {
+                metaData = iPlayer->GetMetaDataEntryL(i);
+                CleanupStack::PushL(metaData);
+
+                if (metaData->Name().CompareF(KMMFMetaEntrySongTitle()) == 0 &&
+                    attrG & EMPXMediaGeneralTitle)
+                    { // TODO to check request
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralTitle),
+                        metaData->Value());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryArtist()) == 0 &&
+                    attrM & EMPXMediaMusicArtist)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicArtist),
+                        metaData->Value());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryAlbum()) == 0 &&
+                    attrM & EMPXMediaMusicAlbum)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicAlbum),
+                        metaData->Value());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryYear()) == 0 &&
+                    attrM & EMPXMediaMusicYear)
+                    {
+                    TInt year;
+                    TLex lex( metaData->Value() );
+                    lex.Val( year );
+
+                    TDateTime dt;
+                    dt.SetYear( year );
+                    TTime time( dt );
+
+                    media->SetTObjectValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicYear),
+                        time.Int64());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryComment()) == 0 &&
+                    attrG & EMPXMediaGeneralComment)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralComment),
+                        metaData->Value());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryComposer()) == 0 &&
+                    attrM & EMPXMediaMusicComposer)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicComposer),
+                        metaData->Value());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryAlbumTrack()) == 0 &&
+                    attrM & EMPXMediaMusicAlbumTrack)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicAlbumTrack),
+                        metaData->Value());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryGenre()) == 0 &&
+                    attrM & EMPXMediaMusicGenre)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicGenre),
+                        metaData->Value());
+                    }
+                //else if (metaData->Name().CompareF(KMMFMetaEntryWOAF()) == 0 &&
+                //    attrM & EMPXMediaMusicGenre)
+                //    {
+                    //media->SetTextValueL(
+                    //    TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicGenre),
+                    //    metaData->Value());
+                    //}
+                else if (metaData->Name().CompareF(KMMFMetaEntryAPIC()) == 0 &&
+                    attrM & EMPXMediaMusicAlbumArtFileName)
+                    {
+                    // TODO check collection if user defined album art available
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicAlbumArtFileName),
+                        *iSong);
+                    }
+
+                CleanupStack::PopAndDestroy(metaData);
+                metaData = NULL;
+                }
+            if ( attrG & EMPXMediaGeneralTitle )
+                {
+                if ( !media->IsSupported(
+                    TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralTitle ) ) )
+                    {
+                    TParsePtrC ptr( *iSong );
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralTitle),
+                        ptr.Name() );
+                    }
+                }
+            }
+        if (attrG & EMPXMediaGeneralUri)
+            {
+            media->SetTextValueL(
+                TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralUri),
+                *iSong);
+            }
+
+        if (attrG & EMPXMediaGeneralDuration)
+            {
+            TTimeIntervalMicroSeconds duration = iPlayer->Duration();
+            media->SetTObjectValueL<TInt>(
+                   TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralDuration),
+                   duration.Int64() / KPbMilliMultiplier);
+            }
+
+
+        // Set bitrate TODO
+        TPckgBuf<TMMFAudioConfig> data;
+
+        const TMMFMessageDestinationPckg
+            destinationPckg(KUidInterfaceMMFAudioController);
+
+        if (attrA & EMPXMediaAudioBitrate)
+            {
+            error = iPlayer->CustomCommandSync(destinationPckg,
+                EMMFAudioControllerGetSourceBitRate, KNullDesC8, KNullDesC8, data);
+            if (!error)
+                {
+                media->SetTObjectValueL<TInt>(
+                       TMPXAttribute(KMPXMediaIdAudio, EMPXMediaAudioBitrate),
+                       data().iSampleRate);
+                }
+            }
+
+        if (attrA & EMPXMediaAudioSamplerate)
+            {
+
+            // Set sampling rate
+            error = iPlayer->CustomCommandSync(destinationPckg,
+                EMMFAudioControllerGetSourceSampleRate, KNullDesC8, KNullDesC8, data);
+            if (!error)
+                {
+                media->SetTObjectValueL<TInt>(
+                       KMPXMediaAudioSamplerate,
+                       data().iSampleRate);
+                }
+            }
+       if (attrG & EMPXMediaGeneralSize)
+            {
+            TEntry entry;
+            iFs.Entry(iSong->Des(), entry);
+            media->SetTObjectValueL<TInt>(
+                   TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralSize),
+                   entry.iSize);
+            }
+
+       if (attrG & EMPXMediaGeneralMimeType)
+            {
+            RApaLsSession aps;
+            error  = aps.Connect(); // always fail in console test
+            if (KErrNone == error)
+                {
+                CleanupClosePushL(aps);
+                TDataType dataType;
+                TUid ignore;
+                if(aps.AppForDocument(iSong->Des(),ignore,dataType)==KErrNone)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralMimeType),
+                        dataType.Des());
+                    }
+                CleanupStack::PopAndDestroy(&aps);
+                } // Notes, STIF console test always fail
+            }
+
+        // Set DRM info
+        const CMPXMedia* drmMedia( iDrmMediaUtility->GetMediaL( attrD ));
+        if ( drmMedia )
+            {
+            TInt count( drmMedia->Count() );
+            for ( TInt i = 0; i < count; i++ )
+                {
+                TUint attrId( drmMedia->Attribute(i).AttributeId() );
+                if ( attrD & attrId )
+                    {
+                    TMPXAttribute mpxAtt( KMPXMediaIdDrm, attrId );
+                    switch ( attrId )
+                        {
+                        case EMPXMediaDrmType:
+                        case EMPXMediaDrmRightsStatus:
+                        case EMPXMediaDrmRightsType:
+                        case EMPXMediaDrmCount:
+                            {
+                            TInt val(
+                                drmMedia->ValueTObjectL<TInt>( mpxAtt ));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        case EMPXMediaDrmProtected:
+                        case EMPXMediaDrmSendingAllowed:
+                        case EMPXMediaDrmCanSetAutomated:
+                        case EMPXMediaDrmHasInfoUrl:
+                        case EMPXMediaDrmHasPreviewUrl:
+                        case EMPXMediaDrmAboutToExpire:
+                            {
+                            TBool val(
+                                drmMedia->ValueTObjectL<TBool>( mpxAtt ));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        case EMPXMediaDrmStartTime:
+                        case EMPXMediaDrmEndTime:
+                        case EMPXMediaDrmIntervalStartTime:
+                        case EMPXMediaDrmAccumulatedTime:
+                            {
+                            TInt64 val(
+                                drmMedia->ValueTObjectL<TInt64>( mpxAtt ));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        case EMPXMediaDrmInterval:
+                            {
+                            TTimeIntervalSeconds val(
+                                drmMedia->ValueTObjectL<TTimeIntervalSeconds>(mpxAtt));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        default:
+                            {
+                            break;
+                            }
+                        }   // end switch (attriId)
+                    }   // end if ( attrD & attrId )
+                }
+            }
+        }
+
+    iObs->HandleMedia(*media, KErrNone);
+    CleanupStack::PopAndDestroy(media);
+    MPX_DEBUG2("<--CMPXLocalAudioPlayback::MediaL 0x%08x", this);
+    }
+
+// ----------------------------------------------------------------------------
+// Cancel request
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::CancelRequest()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// File open complete event
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::MapcInitComplete(TInt aError,
+                                const TTimeIntervalMicroSeconds& aDuration)
+    {
+    MPX_DEBUG4("-->CMPXLocalAudioPlayback::MapcInitComplete 0x%08x err (%d) duration (%Ld)",
+               this, aError, aDuration.Int64());
+    iState = EStateInitialised;
+
+    // Restore volume level
+    if ( KErrNone == aError )
+        {
+        TInt currentVol( 0 );
+        MPX_TRAPD( volError, currentVol = iVolumeWatcher->CurrentValueL() );
+        if ( volError == KErrNone )
+            {
+            SetVolume( currentVol );
+            TBool mute( EFalse);
+            MPX_TRAPD( muteError, mute = iMuteWatcher->CurrentValueL() );
+            if ( muteError == KErrNone && mute )
+                {
+                SetMute(mute);
+                }
+            }
+        }
+
+    // Disable automatic DRM consumption
+    if ( iPlayer )
+        {
+        MMMFDRMCustomCommand* drmCustom = iPlayer->GetDRMCustomCommand();
+        if ( drmCustom )
+            {
+            drmCustom->DisableAutomaticIntent( ETrue );
+            }
+        }
+
+    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPInitialised,
+                            aDuration.Int64()/KPbMilliMultiplier,aError);
+
+    MPX_DEBUG4("<--CMPXLocalAudioPlayback::MapcInitComplete 0x%08x err (%d) duration (%Ld)",
+               this, aError, aDuration.Int64());
+    }
+
+// ----------------------------------------------------------------------------
+// File play complete event
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::MapcPlayComplete(TInt aError)
+    {
+    MPX_DEBUG3("-->CMPXLocalAudioPlayback::MapcPlayComplete 0x%08x (err %d)",
+               this, aError);
+    iState = EStateNotInitialised;
+    iIsPlaying = EFalse;
+    if ( KErrNone != aError )
+        {
+        TRAP_IGNORE( ConsumeRightsL( ContentAccess::EPause ) );
+        }
+    else
+        {
+        TRAP_IGNORE( ConsumeRightsL( ContentAccess::EStop ) );
+        if ( iConsumeStarted )
+            {
+            iConsumeStarted = EFalse;
+            }
+        }
+
+    TRAP_IGNORE( iAudioEffects->DestroyAudioEffect() );
+
+    // If killed by audio policy, mimic a paused state
+    if ( KErrDied == aError || KErrAccessDenied == aError || KErrInUse == aError )
+        {
+        iClosedByAudioPolicy = ETrue;
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused,
+                                 0,
+                                 aError );
+        }
+     // If disk removed
+     else if( KErrNotReady == aError )
+        {
+        MPX_DEBUG1("CMPXLocalAudioPlayback::MapcPlayComplete - KErrNotReady");
+
+        iClosedByAudioPolicy = EFalse;
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPStopped,
+                                 0,
+                                 KErrNone );
+        }
+    else
+        {
+        iClosedByAudioPolicy = EFalse;
+        iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPlayComplete,0,aError);
+        }
+    MPX_DEBUG3("<--CMPXLocalAudioPlayback::MapcPlayComplete 0x%08x (err %d)",
+               this, aError);
+    }
+
+// ----------------------------------------------------------------------------
+// Handle a change in a setting value.
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::HandleSettingChange(
+    const TUid& aRepositoryUid,
+    TUint32 aSettingId )
+    {
+    MPX_DEBUG2("-->CMPXLocalAudioPlayback::HandleSettingChange 0x%08x", this);
+
+    if ( KCRUidMPXSettings == aRepositoryUid &&
+         KMPXPlaybackVolume == aSettingId )
+        {
+        MPX_DEBUG1("CMPXLocalAudioPlayback::HandleSettingChange() Volume setting changed");
+        TInt vol( 0 );
+        MPX_TRAPD( error, vol = iVolumeWatcher->CurrentValueL() );
+        if ( EStateInitialised == iState && error == KErrNone )
+            {
+            SetVolume( vol );
+            }
+        else if ( error == KErrNone )
+            {
+            // Do not need to set volume if not initialised,
+            // just notify observers
+            iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPVolumeChanged,
+                                     vol,
+                                     KErrNone);
+            }
+        }
+    else if ( KCRUidMPXSettings == aRepositoryUid &&
+         KMPXPlaybackMute == aSettingId )
+        {
+        MPX_DEBUG1("CMPXLocalAudioPlayback::HandleSettingChange() Mute setting changed");
+        TBool mute( EFalse );
+        MPX_TRAPD( error, mute = static_cast<TBool>(iMuteWatcher->CurrentValueL()) );
+        if ( EStateInitialised == iState && error == KErrNone )
+            {
+            TInt oldVolume( 0 );
+            iPlayer->GetVolume( oldVolume );
+            if ( (mute && oldVolume != 0) || (!mute && oldVolume == 0) )
+                {
+                SetMute( mute );
+                }
+            }
+        else if ( error == KErrNone )
+            {
+            // Do not need to set volume if not initialised,
+            // just notify observers
+            iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPMuteChanged,
+                                     mute,
+                                     KErrNone);
+            }
+        }
+    MPX_DEBUG2("<--CMPXLocalAudioPlayback::HandleSettingChange 0x%08x", this);
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the volume level in audio controller
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::SetVolume( TInt aVolume )
+    {
+    MPX_DEBUG3("-->CMPXLocalAudioPlayback::SetVolume 0x%08x vol (%d)", this, aVolume);
+
+    // Ensure that level is within min and max values
+    if ( aVolume > KPbPlaybackVolumeLevelMax )
+        {
+        aVolume = KPbPlaybackVolumeLevelMax;
+        }
+    if ( aVolume < KPbPlaybackVolumeLevelMin )
+        {
+        aVolume = KPbPlaybackVolumeLevelMin;
+        }
+
+    TBool changed( EFalse );
+    // Change MMF Audio player's volume
+    if ( EStateInitialised == iState )
+        {
+        TInt newVolume( aVolume * iPlayer->MaxVolume() / 100 );
+        MPX_DEBUG2("CMPXLocalAudioPlayback::SetVolume(): Setting volume = %d", newVolume);
+
+        // First check if MMF Audio player's volume is changed by new value
+        TInt oldVolume( 0 );
+        iPlayer->GetVolume( oldVolume );
+        if ( newVolume != oldVolume )
+            {
+            iPlayer->SetVolume( newVolume );
+            changed = ETrue;
+            }
+        }
+
+    // Change setting in cenrep
+    TInt currentVol( 0 );
+    MPX_TRAPD( volError, currentVol = iVolumeWatcher->CurrentValueL() );
+    if ( volError == KErrNone && aVolume != currentVol )
+        {
+        MPX_TRAP( volError, iVolumeWatcher->SetValueL( aVolume ) );
+        if( aVolume == 0 )
+            {
+            MPX_TRAP( volError, iMuteWatcher->SetValueL( ETrue ) );
+            }
+        else if( aVolume > 0 )
+            {
+            TBool currentMute( EFalse );
+            
+            MPX_TRAP( volError, currentMute = iMuteWatcher->CurrentValueL() );
+            if( volError == KErrNone && currentMute )
+                {
+                MPX_TRAP( volError, iMuteWatcher->SetValueL( EFalse ) );
+                }
+            }
+        }
+
+    // Notify observer if value changed
+    if ( changed )
+        {
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPVolumeChanged,
+                                 aVolume,
+                                 KErrNone);
+        }
+
+    MPX_DEBUG3("<--CMPXLocalAudioPlayback::SetVolume 0x%08x vol (%d)", this, aVolume);
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the volume level in audio controller
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::SetMute( TBool aMute )
+    {
+    MPX_DEBUG3("-->CMPXLocalAudioPlayback::SetMute 0x%08x vol (%d)", this, aMute);
+
+    TBool changed( EFalse );
+    // Change MMF Audio player's volume
+    if ( EStateInitialised == iState )
+        {
+        TInt currentVolume(0);
+        iPlayer->GetVolume(currentVolume);
+		if ( aMute && currentVolume != 0 )
+			{
+			iVolume = currentVolume;
+			iPlayer->SetVolume(0);
+			changed = ETrue;
+			}
+		else if ( !aMute && currentVolume == 0 )      // UnMute
+			{
+			iPlayer->SetVolume(iVolume);
+			changed = ETrue;
+			}
+        }
+
+    // Change setting in cenrep
+    TBool currentMute( EFalse );
+    MPX_TRAPD( muteError, currentMute = iMuteWatcher->CurrentValueL() );
+    if ( muteError == KErrNone )
+        {
+        if ( aMute && !currentMute )
+            {
+            MPX_TRAP( muteError, iMuteWatcher->SetValueL( aMute ) );
+            }
+        else if ( !aMute && currentMute )
+            {
+            MPX_TRAP( muteError, iMuteWatcher->SetValueL( aMute ) );
+            }
+        }
+
+    // Notify observer if value changed
+    if ( changed )
+        {
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPMuteChanged,
+                                 aMute,
+                                 KErrNone);
+        }
+
+    MPX_DEBUG3("<--CMPXLocalAudioPlayback::SetMute 0x%08x vol (%d)", this, aMute);
+    }
+
+// ----------------------------------------------------------------------------
+// Consumes the rights for the current media
+// ----------------------------------------------------------------------------
+//
+void CMPXLocalAudioPlayback::ConsumeRightsL(ContentAccess::TIntent aIntent)
+    {
+    MPX_FUNC("CMPXLocalAudioPlayback::ConsumeRightsL()");
+    // Fix for error: PNUI-7Q8GL6
+    // Normally,this case does not happen.
+    // In EStateInitialising state,consumerights is forbidden.
+    if ( iState == EStateInitialising )
+        {
+        return;
+        }
+    if ( iPlayer )
+        {
+        MMMFDRMCustomCommand* drmCustom = iPlayer->GetDRMCustomCommand();
+        if ( drmCustom )
+            {
+            switch ( aIntent )
+                {
+                case ContentAccess::EPlay:
+                case ContentAccess::EStop:
+                case ContentAccess::EPause:
+                case ContentAccess::EContinue:
+                    {
+                    break;
+                    }
+                default:
+                    {
+                    aIntent = ContentAccess::EUnknown;
+                    iConsumeStarted = EFalse;
+                    break;
+                    }
+                }
+            TInt returnCode( drmCustom->ExecuteIntent(aIntent) );
+            MPX_DEBUG2("CMPXLocalAudioPlayback::ConsumeRightsL() ExecuteIntent return (%d)", returnCode);
+            User::LeaveIfError(returnCode);
+            }
+        }
+    }
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/localaudio/src/mpxlocalaudioplaybackproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+#include <implementationproxy.h>
+#include "mpxlocalaudioplayback.h"
+
+#if (!defined IMPLEMENTATION_PROXY_ENTRY)
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) {{aUid},(TProxyNewLPtr)(aFuncPtr)}
+#endif
+
+// ----------------------------------------------------------------------------
+// The list of implementations
+// ----------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { IMPLEMENTATION_PROXY_ENTRY(0x101FFC06, CMPXLocalAudioPlayback::NewL) };
+
+// ----------------------------------------------------------------------------
+// The proxy of implementations
+// ----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownload/data/101ffc08.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file.
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+#include <mpxplaybackplugin.hrh>
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: Supported plugin types.
+ *  E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. for music plugin will be: 0x101FFCDA
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags, not used now
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXCollectionPluginPriorities. This value determines
+ *  the returning order when several plugins can support the same set of Uids. 
+ *  Default value of this field is EMPXCollectionPluginPriorityNormal.
+ */
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC08;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXPlaybackPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x101FFC09;
+                    version_no = 1;
+                    display_name = "progress download";
+                    default_data = "audio/mp3;audio/3gp;audio/3gpp2;audio/x-ms-wma;x-caf-audio/x-ms-wma;audio/mpeg;"
+                                   "audio/aac;audio/x-mp3;audio/mp4;audio/wav;audio/x-wav;audio/x-au;audio/au";
+                    opaque_data = "<s>http<e>.mp3;.aac;.3gp;.3gpp;.3g2;.3gpp2;.mp4;.wav;.wma;.asf;.odf;.dcf;.m4a"
+                                  "<t>"EPbLocal"</t>";
+                    }
+                };
+            }
+        };
+    }
+            
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownload/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxprogressdownload.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxprogressdownload.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownload/group/mpxprogressdownload.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Local audio playback project specification
+*
+*/
+
+
+
+#include   <bldvariant.hrh>
+#include   <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxprogressdownload.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC08
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxprogressdownload.cpp
+SOURCE          mpxprogressdownloadproxy.cpp
+
+SOURCEPATH      ../data
+START RESOURCE  101ffc08.rss
+TARGET          mpxprogressdownload.rsc
+END
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+LIBRARY         euser.lib
+LIBRARY         bafl.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         mediaclientaudio.lib
+LIBRARY         mmfcontrollerframework.lib 
+LIBRARY         audioequalizerutility.lib
+LIBRARY         customcommandutility.lib
+LIBRARY         apgrfx.lib
+LIBRARY         apmime.lib 
+LIBRARY         caf.lib
+LIBRARY         cafutils.lib
+LIBRARY         progressivedownloadutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         estor.lib 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownload/inc/mpxprogressdownload.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,241 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class manages progress download
+*
+*/
+
+
+
+#ifndef CMPXPROGRESSDOWNLOAD_H
+#define CMPXPROGRESSDOWNLOAD_H
+
+// INCLUDES
+#include <ProgressiveDownloadUtility.h>
+#include <MAudioPdPlayUtility.h>
+#include <mpxplaybackplugin.h>
+#include <mpxcenrepobserver.h>
+#include <mpxplaybackcommanddefs.h>
+
+// FORWARD DECLARATIONS
+class CMPXDrmMediaUtility;
+class CMPXCenRepWatcher;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+*  CMPXProgressDownload class
+*
+*  Plug-in basically handles download via S60's progress download utility.
+*  @lib LocalAudioPlayback.lib
+*/
+NONSHARABLE_CLASS(CMPXProgressDownload) : public CMPXPlaybackPlugin,
+                                          public MAudioPdPlayUtilityCallback,
+                                          public MMPXCenRepObserver
+    {
+    private:
+        enum TMPXLocalAudioPlaybackState
+            {
+            EStateNotInitialised,
+            EStateInitialising,
+            EStateInitialised
+            };
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        * @param aInitParams, initialization parameter
+        * @return a pointer to the created instance
+        */
+        static CMPXProgressDownload* NewL(TAny* aInitParams);
+
+        /**
+        * Destructor
+        * Destroy the object and release all memory objects
+        */
+        ~CMPXProgressDownload();
+
+    private: // Functions from base classes
+        /**
+        *  from CMPXPlaybackPlugin
+        */
+
+        /**
+        * Initializes a song for playback
+        * @param aSong the song path
+        */
+        void InitialiseL(const TDesC& aSong);
+
+        /**
+        * Initializes a song for playback
+        * @param aFile file handle of a song
+        */
+        void InitialiseL(RFile& aFile);
+
+        /**
+        * Executes a command on the selected song
+        * @param aCmd a command
+        * @param aData data (optional)
+        */
+        void CommandL(TMPXPlaybackCommand aCmd, TInt aData=0);
+
+        /**
+        * Executes a command
+        * @param aCmd Command
+        */
+        void CommandL(CMPXCommand& aCmd);
+
+        /**
+        * Sets a property of the plugin
+        * @param aProperty a property
+        * @param aValue the value of the setting
+        */
+        void SetL(TMPXPlaybackProperty aProperty,TInt aValue);
+
+        /**
+        * Gets a property of the plugin (async)
+        * @param aProperty a property
+        */
+        void PropertyL(TMPXPlaybackProperty aProperty) const;
+
+        /**
+        * Gets a list of sub players
+        * @return a list of names of sub players
+        */
+        void SubPlayerNamesL();
+
+        /**
+        * Select a sub player
+        * @param aIndex index to the sub player
+        */
+    	void SelectSubPlayerL(TInt aIndex);
+
+        /**
+        * Returns current sub player name
+        * @return friendly name of the current the sub player
+        */
+        const TDesC& SubPlayerName();
+
+        /**
+        * Current sub player index
+        * @return index to the sub player
+        */
+        TInt SubPlayerIndex() const;
+
+        /**
+        * Media properties of the current file (async)
+        * @param aAttrs attributes requested
+        */
+        void MediaL(const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Cancel async request
+        */
+        void CancelRequest();
+
+        /**
+        *  From MMdaAudioPlayerCallback which is the base class of
+        *  MAudioPdPlayUtilityCallback
+        */
+        void MapcInitComplete(TInt aError,
+                              const TTimeIntervalMicroSeconds& aDuration);
+
+        /**
+        *  From MMdaAudioPlayerCallback which is the base class of
+        *  MAudioPdPlayUtilityCallback
+        */
+        void MapcPlayComplete(TInt aError);
+
+        /**
+        * MProgressiveDownloadUtilityCallback which is the base class of
+        * MAudioPdPlayUtilityCallback
+        */
+        void Paused();
+
+        /**
+        * MProgressiveDownloadUtilityCallback which is the base class of
+        * MAudioPdPlayUtilityCallback
+        */
+        void Playing();
+
+        /**
+        * MAudioPdPlayUtilityCallback
+        */
+        void HandleDownloadEventL(TUint aTransactionID,
+                                  TBrCtlDownloadEvent aEvent,
+                                  TUint aValue);
+
+        /**
+        * From MMPXCenRepObserver
+        * Handle a change in a setting value.
+        *
+        * @param aRepositoryUid Central repository UID containing the setting
+        * @param aSettingId Id of the setting
+        * @since 3.0
+        */
+        void HandleSettingChange( const TUid& aRepositoryUid,
+                                  TUint32 aSettingId);
+
+    private:
+       /**
+        * C++ default constructor
+        */
+        CMPXProgressDownload();
+
+        /**
+        * the second phase constructor ConstructL to safely construct things
+        * that can leave
+        */
+        void ConstructL();
+
+        /**
+        * Sets the volume level in audio controller
+        * @param aVolume Volume level, ranges from 0 - KPbPlaybackVolumeLevelMax
+        */
+        void SetVolume( TInt aVolume );
+
+        /**
+        * Sets the volume level in audio controller to mute.
+        * @param aMute ETrue to indicated mute
+        */
+        void SetMute( TBool aMute );
+
+        /**
+        *  Consumes the rights for the current media according
+        *  to the specified consume type
+        *
+        *  @param aType Type of consumption to execute
+        */
+        void ConsumeRightsL(ContentAccess::TIntent aIntent);
+
+    private: // Data
+        CMPXCenRepWatcher* iVolumeWatcher;
+        CMPXCenRepWatcher* iMuteWatcher;
+        CProgressiveDownloadUtility* iPdUtil; // owned
+        MAudioPdPlayUtility* iPdPlayer; // owned
+        HBufC* iPdPath;
+        TUint iTransactionId;
+        TInt iVolume;
+        TInt iFeatureFlag;
+        CMPXDrmMediaUtility* iDrmMediaUtility;
+        TMPXPlaybackPdDownloadState iDownloadState;
+        TInt iDownloadBytes;
+        TInt iDownloadSize;
+        TMPXLocalAudioPlaybackState iState;
+        TBool iConsumeStarted;
+    };
+
+#endif      // CMPXPROGRESSDOWNLOAD_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownload/src/mpxprogressdownload.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1316 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class manages progress download
+*
+*/
+
+
+// INCLUDE FILES
+#include <f32plugin.h>
+#include <AudioPreference.h>
+#include <badesca.h>
+#include <apgcli.h>
+#include <mmf/common/mmfcontrollerframeworkbase.h>
+#include <mmf/common/mmfmeta.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxmedia.h>
+#include <mpxplaybackpluginobserver.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxcmn.h>
+#include <mpxdrmmediautility.h>
+#include <mpxprivatecrkeys.h>
+#include <mpxcenrepwatcher.h>
+#include <mpxlog.h>
+
+#include "mpxprogressdownload.h"
+
+
+// CONSTANTS
+const TUid KProgressDownloadUid={0x101FFC09};
+const TInt KProgressPlayEndThreshold=8000000; // 8 seconds, in milliseconds
+
+_LIT(KMMFMetaEntryAuthor, "author"); // For WMA progressive download
+
+// ============================ LOCAL FUNCTIONS ==============================
+LOCAL_C TInt Balance(TInt aMMFBalance)
+    {
+    return (aMMFBalance-KMMFBalanceCenter) *
+           (EPbBalanceMaxRight-EPbBalanceMaxLeft) /
+           (KMMFBalanceMaxRight-KMMFBalanceMaxLeft);
+    }
+
+LOCAL_C TInt MMFBalance(TInt aBalance)
+    {
+    return KMMFBalanceCenter+(KMMFBalanceMaxRight-KMMFBalanceMaxLeft)/
+           (EPbBalanceMaxRight-EPbBalanceMaxLeft)*aBalance;
+    }
+
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXProgressDownload* CMPXProgressDownload::NewL(TAny* /*aInitParams*/)
+    {
+    CMPXProgressDownload* p=new(ELeave)CMPXProgressDownload();
+    CleanupStack::PushL(p);
+    p->ConstructL();
+    CleanupStack::Pop(p);
+    return p;
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::ConstructL()
+    {
+    iVolumeWatcher = CMPXCenRepWatcher::NewL(KCRUidMPXSettings,
+                                             KMPXPlaybackVolume,
+                                             this);
+    iMuteWatcher = CMPXCenRepWatcher::NewL(KCRUidMPXSettings,
+                                           KMPXPlaybackMute,
+                                           this);
+    iFeatureFlag = EPbFeatureBalance | EPbFeatureVolumeRamp;
+    iDrmMediaUtility = CMPXDrmMediaUtility::NewL();
+    }
+
+// ----------------------------------------------------------------------------
+// C++ constructor
+// ----------------------------------------------------------------------------
+//
+CMPXProgressDownload::CMPXProgressDownload()
+    {}
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXProgressDownload::~CMPXProgressDownload()
+    {
+    delete iMuteWatcher;
+    delete iVolumeWatcher;
+    if ( iDrmMediaUtility )
+        {
+        if ( EPbDlStateDownloadCompleted == iDownloadState )
+            {
+            TRAP_IGNORE( ConsumeRightsL( ContentAccess::EStop ) );
+            }
+        delete iDrmMediaUtility;
+        }
+    if (iPdPlayer)
+        {
+        iPdPlayer->Close();
+        iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPActive,EFalse,KErrNone);
+        delete iPdPlayer;
+        }
+    delete iPdUtil;
+    delete iPdPath;
+    }
+
+// ----------------------------------------------------------------------------
+// Initializes a song for playback
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::InitialiseL(const TDesC& aSong)
+    {
+    MPX_DEBUG2("CMPXProgressDownload::InitialiseL(%S) entering", &aSong );
+
+    // Re-initialize ProgressiveDownloadUtility to make sure multiple sequential
+    // downloads work
+    delete iPdPlayer;
+    iPdPlayer = NULL;
+    delete iPdUtil;
+    iPdUtil = NULL;
+    iPdUtil = CProgressiveDownloadUtility::NewL();
+
+    iPdPlayer = iPdUtil->OpenL( aSong, *this );
+    delete iPdPath;
+    iPdPath = NULL;
+    iPdPath = aSong.AllocL();
+    iDownloadState = EPbDlStateBuffering;
+    iState = EStateInitialising;
+    iConsumeStarted = EFalse;
+
+    MPX_DEBUG1("CMPXProgressDownload::InitialiseL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Initializes a song for playback
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::InitialiseL(RFile& aSong)
+    {
+    MPX_DEBUG1("CMPXProgressDownload::InitialiseL(RFile) entering");
+
+    // Re-initialize ProgressiveDownloadUtility to make sure multiple sequential
+    // downloads work
+    delete iPdPlayer;
+    iPdPlayer = NULL;
+    delete iPdUtil;
+    iPdUtil = NULL;
+    iPdUtil = CProgressiveDownloadUtility::NewL();
+
+    iPdPlayer = iPdUtil->OpenL( aSong, *this );
+    delete iPdPath;
+    iPdPath = NULL;
+    TFileName filename;
+    aSong.FullName(filename);
+    iPdPath = filename.AllocL();
+    iDownloadState = EPbDlStateBuffering;
+    iState = EStateInitialising;
+    iConsumeStarted = EFalse;
+
+    MPX_DEBUG1("CMPXProgressDownload::InitialiseL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Executes a command on the selected song
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::CommandL(TMPXPlaybackCommand aCmd, TInt /*aData*/)
+    {
+    MPX_DEBUG2("CMPXProgressDownload::CommandL(%d) entering", aCmd);
+
+    if (iPdPlayer)
+        {
+        switch(aCmd)
+            {
+            case EPbCmdPlay:
+                {
+                if ( EPbDlStateDownloadCompleted == iDownloadState )
+                    {
+                    if (iConsumeStarted)
+                        {
+                        ConsumeRightsL( ContentAccess::EContinue );
+                        }
+                    else
+                        {
+                        MPX_TRAPD( AEErr,  ConsumeRightsL( ContentAccess::EPlay ) );
+                        if (AEErr == KErrDiskFull)
+                        	{
+                			iDrmMediaUtility->Close();
+                			iPdPlayer->Close();
+                			iState = EStateNotInitialised;
+                			iDownloadState = EPbDlStateNotDownloading;
+                			iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPClosed,
+                                         0, KErrDiskFull);
+				            break;
+                        	}
+                        iConsumeStarted = ETrue;
+                        }
+                    }
+                iPdPlayer->Play();
+                iState = EStateInitialised;
+                iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPlaying,
+                                         0, KErrNone);
+                break;
+                }
+            case EPbCmdPause:
+                if ( EPbDlStateDownloadCompleted == iDownloadState && iConsumeStarted )
+                    {
+                    ConsumeRightsL( ContentAccess::EPause );
+                    }
+                iPdPlayer->Pause();
+                iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPaused,
+                                         0, KErrNone);
+                break;
+            case EPbCmdStop:
+                if ( EPbDlStateDownloadCompleted == iDownloadState && iConsumeStarted )
+                    {
+                    ConsumeRightsL( ContentAccess::EStop );
+                    iConsumeStarted = EFalse;
+                    }
+                iDrmMediaUtility->Close();
+                iPdPlayer->Stop();
+                iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPStopped,
+                                         0, KErrNone);
+                break;
+            case EPbCmdClose:
+                if ( EPbDlStateDownloadCompleted == iDownloadState && iConsumeStarted )
+                    {
+                    ConsumeRightsL( ContentAccess::EStop );
+                    iConsumeStarted = EFalse;
+                    }
+                iDrmMediaUtility->Close();
+                iPdPlayer->Close();
+                iState = EStateNotInitialised;
+                iDownloadState = EPbDlStateNotDownloading;
+                iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPClosed,
+                                         0, KErrNone);
+                break;
+            }
+        }
+
+    MPX_DEBUG1("CMPXProgressDownload::CommandL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Executes a command
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::CommandL( CMPXCommand& aCmd )
+    {
+    MPX_FUNC("CMPXProgressDownload::CommandL(CMPXCommand)");
+
+    ASSERT( aCmd.IsSupported( KMPXCommandGeneralId ));
+    TInt id( aCmd.ValueTObjectL<TInt>( KMPXCommandGeneralId ));
+    if ( KMPXCommandIdPlaybackPD == id )
+        {
+        ASSERT(aCmd.IsSupported(KMPXCommandPlaybackGeneralType));
+        TMPXPlaybackPdCommand cmd(
+            static_cast<TMPXPlaybackPdCommand>(
+                aCmd.ValueTObjectL<TInt>(KMPXCommandPlaybackGeneralType)));
+        switch ( cmd )
+            {
+            case ( EPbCmdStartPd ):
+                {
+                ASSERT( aCmd.IsSupported( KMPXCommandPlaybackPDTransactionID ));
+                iTransactionId = aCmd.ValueTObjectL<TUint>( KMPXCommandPlaybackPDTransactionID );
+                break;
+                }
+            case ( EPbCmdFinishPd ):
+                {
+                iObs->HandlePluginEvent(
+                        MMPXPlaybackPluginObserver::EPPlayComplete,
+                        0,
+                        KErrNone);
+                break;
+                }
+            case ( EPbCmdHandlePdEvent ):
+                {
+                ASSERT( aCmd.IsSupported( KMPXCommandPlaybackPDTransactionID ) &&
+                        aCmd.IsSupported( KMPXCommandPlaybackPDEvent ) &&
+                        aCmd.IsSupported( KMPXCommandPlaybackGeneralData ));
+                TUint transId( aCmd.ValueTObjectL<TUint>( KMPXCommandPlaybackPDTransactionID ));
+                TBrCtlDownloadEvent event(
+                    aCmd.ValueTObjectL<TBrCtlDownloadEvent>( KMPXCommandPlaybackPDEvent ));
+                TUint val( aCmd.ValueTObjectL<TUint>( KMPXCommandPlaybackGeneralData ));
+                HandleDownloadEventL( transId, event, val );
+                break;
+                }
+            case ( EPbCmdGetPdStatus ):
+                {
+                aCmd.SetTObjectValueL<TUint>(
+                        KMPXCommandPlaybackPDTransactionID,
+                        iTransactionId );
+                aCmd.SetTObjectValueL<TMPXPlaybackPdDownloadState>(
+                        KMPXCommandPlaybackPDState,
+                        static_cast<TMPXPlaybackPdDownloadState>(iDownloadState));
+                aCmd.SetTObjectValueL<TInt>(
+                        KMPXCommandPlaybackPDDownloadedBytes,
+                        iDownloadBytes );
+                aCmd.SetTObjectValueL<TInt>(
+                        KMPXCommandPlaybackPDTotalBytes,
+                        iDownloadSize );
+                break;
+                }
+            case ( EPbCmdPausePd ):
+                {
+                iObs->HandlePluginEvent(
+                        MMPXPlaybackPluginObserver::EPDownloadCmdPauseDownload,
+                        iTransactionId,
+                        KErrNone );
+                break;
+                }
+            case ( EPbCmdResumePd ):
+                {
+                iObs->HandlePluginEvent(
+                        MMPXPlaybackPluginObserver::EPDownloadCmdResumeDownload,
+                        iTransactionId,
+                        KErrNone );
+                break;
+                }
+            case ( EPbCmdCancelPd ):
+                {
+                iObs->HandlePluginEvent(
+                        MMPXPlaybackPluginObserver::EPDownloadCmdCancelDownload,
+                        iTransactionId,
+                        KErrNone);
+                break;
+                }
+            default:
+                break;
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Sets a property of the plugin
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::SetL(TMPXPlaybackProperty aProperty, TInt aValue)
+    {
+    MPX_DEBUG3("CMPXProgressDownload::SetL(%d, %d) entering", aProperty, aValue);
+
+    TBool isSupported=ETrue;
+    switch(aProperty)
+        {
+        case EPbPropertyVolume:
+            {
+            SetVolume( aValue );
+            break;
+            }
+        case EPbPropertyVolumeRamp:
+            iPdPlayer->SetVolumeRamp(TTimeIntervalMicroSeconds(TInt64(aValue)));
+            break;
+        case EPbPropertyMute:
+            SetMute( aValue );
+            break;
+        case EPbPropertyBalance:
+            iPdPlayer->SetBalance(MMFBalance(aValue));
+            break;
+        case EPbPropertyPosition:
+            {
+            TInt64 pos(aValue);
+            pos *= KPbMilliMultiplier;
+            iPdPlayer->SetPosition(pos);
+            }
+            break;
+        default:
+            isSupported=EFalse;
+        }
+
+    if (!isSupported)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPSetComplete,
+                             aProperty, KErrNone);
+
+    MPX_DEBUG1("CMPXProgressDownload::SetL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Gets a property of the plugin (async)
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::PropertyL(TMPXPlaybackProperty aProperty) const
+    {
+    MPX_DEBUG2("CMPXProgressDownload::ValueL(%d) entering", aProperty);
+
+    TBool isSupported=ETrue;
+    TInt value=KErrNotFound;
+    TInt err(KErrNone);
+    switch(aProperty)
+        {
+        case EPbPropertyVolume:
+            {
+            value = iVolumeWatcher->CurrentValueL();
+            break;
+            }
+        case EPbPropertyMaxVolume:
+            value=iPdPlayer->MaxVolume();
+            break;
+        case EPbPropertyMute:
+            value = iMuteWatcher->CurrentValueL();
+            break;
+        case EPbPropertyBalance:
+            err = iPdPlayer->GetBalance(value);
+            value=Balance(value);
+            break;
+        case EPbPropertyDuration:
+            {
+            TTimeIntervalMicroSeconds duration = iPdPlayer->Duration();
+            value = duration.Int64() / KPbMilliMultiplier;
+            }
+            break;
+        case EPbPropertyPosition:
+            {
+            TTimeIntervalMicroSeconds pos;
+            iPdPlayer->GetPosition(pos);
+            value = pos.Int64() / KPbMilliMultiplier;
+            }
+            break;
+        case EPbPropertySupportedFeatures:
+            value = iFeatureFlag;
+            break;
+        default:
+            isSupported=EFalse;
+        }
+    if (!isSupported)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    iObs->HandleProperty(aProperty,value,err);
+
+    MPX_DEBUG1("CMPXProgressDownload::ValueL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Gets a list of sub players, UPnP only
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::SubPlayerNamesL()
+    {
+    iObs->HandleSubPlayerNames(KProgressDownloadUid, NULL, ETrue, KErrNone);
+    }
+
+// ----------------------------------------------------------------------------
+// Select a sub player
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::SelectSubPlayerL(TInt /*aIndex*/)
+    {
+    User::Leave(KErrNotSupported);
+    }
+
+// ----------------------------------------------------------------------------
+// Returns current sub player name
+// ----------------------------------------------------------------------------
+//
+const TDesC& CMPXProgressDownload::SubPlayerName()
+    {
+    return KNullDesC; //No subplayer name for local playback
+    }
+
+// ----------------------------------------------------------------------------
+// Current sub player index
+// ----------------------------------------------------------------------------
+//
+TInt CMPXProgressDownload::SubPlayerIndex() const
+   {
+   return KErrNotFound;
+   }
+
+// ----------------------------------------------------------------------------
+// Gets media properties
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::MediaL(const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_DEBUG1("CMPXProgressDownload::MediaL() entering");
+
+    RArray<TInt> suppIds;
+    CleanupClosePushL(suppIds);
+    suppIds.AppendL(KMPXMediaIdMusic);
+    suppIds.AppendL(KMPXMediaIdGeneral);
+    suppIds.AppendL(KMPXMediaIdAudio);
+    CMPXMedia* media=CMPXMedia::NewL(suppIds.Array());
+    CleanupStack::PopAndDestroy(&suppIds);
+    CleanupStack::PushL(media);
+
+    TUint attrG(0); // General attributes
+    TUint attrA(0); // Audio attributes
+    TUint attrM(0); // Music attributes
+    TUint attrD(0); // DRM attributes
+
+    for (TInt i=aAttrs.Count(); --i>=0;)
+        {
+        TMPXAttribute attr(aAttrs[i]);
+        if (attr.ContentId() == KMPXMediaIdGeneral)
+            {
+            attrG |= attr.AttributeId();
+            }
+        else if (attr.ContentId() == KMPXMediaIdMusic)
+            {
+            attrM |= attr.AttributeId();
+            }
+        else if (attr.ContentId() == KMPXMediaIdAudio)
+            {
+            attrA |= attr.AttributeId();
+            }
+        else if ( attr.ContentId() == KMPXMediaIdDrm )
+            {
+            attrD |= attr.AttributeId();
+            }
+        }
+
+    // Get number of metadata
+    TInt metaCount = 0;
+
+    // Get metadata from MMF
+    TInt error = iPdPlayer->GetNumberOfMetaDataEntries(metaCount);
+    MPX_DEBUG3("CMPXProgressDownload::MediaL(): metaCount = %d, error = %d", metaCount, error);
+    CMMFMetaDataEntry* metaData = NULL;
+
+    if (!error)
+        {
+        if ( metaCount > 0 )
+            {
+            for (TInt i = 0; i < metaCount; ++i)
+                {
+                metaData = iPdPlayer->GetMetaDataEntryL(i);
+                CleanupStack::PushL(metaData);
+
+                if (metaData->Name().CompareF(KMMFMetaEntrySongTitle()) == 0 &&
+                    attrG & EMPXMediaGeneralTitle)
+                    { // TODO to check request
+                    if ( metaData->Value().Length() > 0 )
+                        {
+                        media->SetTextValueL(
+                            TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralTitle),
+                            metaData->Value());
+                        }
+                    else if ( iPdPath )
+                        {
+                        TParsePtrC ptr( *iPdPath );
+                        media->SetTextValueL(
+                            TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralTitle),
+                            ptr.Name() );
+                        }
+                    else
+                        {
+                        media->SetTextValueL(
+                            TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralTitle),
+                            KNullDesC );
+                        }
+                    }
+                else if( ( metaData->Name().CompareF( KMMFMetaEntryArtist() ) == 0 ||
+                        metaData->Name().CompareF( KMMFMetaEntryAuthor() ) == 0 ) &&
+                    attrM & EMPXMediaMusicArtist)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicArtist),
+                        metaData->Value());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryAlbum()) == 0 &&
+                    attrM & EMPXMediaMusicAlbum)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicAlbum),
+                        metaData->Value());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryYear()) == 0 &&
+                    attrM & EMPXMediaMusicYear)
+                    {
+                    TInt year;
+                    TLex lex( metaData->Value() );
+                    lex.Val( year );
+
+                    TDateTime dt;
+                    dt.SetYear( year );
+                    TTime time( dt );
+
+                    media->SetTObjectValueL(
+                            TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicYear),
+                            time.Int64());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryComment()) == 0 &&
+                    attrG & EMPXMediaGeneralComment)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralComment),
+                        metaData->Value());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryComposer()) == 0 &&
+                    attrM & EMPXMediaMusicComposer)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicComposer),
+                        metaData->Value());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryAlbumTrack()) == 0 &&
+                    attrM & EMPXMediaMusicAlbumTrack)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicAlbumTrack),
+                        metaData->Value());
+                    }
+                else if (metaData->Name().CompareF(KMMFMetaEntryGenre()) == 0 &&
+                    attrM & EMPXMediaMusicGenre)
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicGenre),
+                        metaData->Value());
+                    }
+                //else if (metaData->Name().CompareF(KMMFMetaEntryWOAF()) == 0 &&
+                //    attrM & EMPXMediaMusicGenre)
+                //    {
+                    //media->SetTextValueL(
+                    //    TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicGenre),
+                    //    metaData->Value());
+                    //}
+                else if (metaData->Name().CompareF(KMMFMetaEntryAPIC()) == 0 &&
+                    attrM & EMPXMediaMusicAlbumArtFileName)
+                    {
+                    // TODO check collection if user defined album art available
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicAlbumArtFileName),
+                        *iPdPath);
+                    }
+                CleanupStack::PopAndDestroy(metaData);
+                metaData = NULL;
+                }
+            }
+        else // metaCount == 0
+            {
+            // no metadata available, use file path for a couple of the attributes
+            if ( attrG & EMPXMediaGeneralTitle )
+                { // TODO to check request
+                MPX_DEBUG2( "CMPXProgressDownload::MediaL() iPdPath = 0x%x", iPdPath );
+                if ( iPdPath )
+                    {
+                    TParsePtrC ptr( *iPdPath );
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralTitle),
+                        ptr.Name() );
+                    }
+                else
+                    {
+                    media->SetTextValueL(
+                        TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralTitle),
+                        KNullDesC );
+                    }
+                }
+            if ( ( attrM & EMPXMediaMusicAlbumArtFileName ) && iPdPath )
+                {
+                // TODO check collection if user defined album art available
+                media->SetTextValueL(
+                    TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicAlbumArtFileName),
+                    *iPdPath);
+                }
+            }
+        }
+    else // if error, then use the file path to display (for the Active Idle case)
+        {
+        if ( attrG & EMPXMediaGeneralTitle )
+            {
+            MPX_DEBUG2( "**** CMPXProgressDownload::MediaL() iPdPath = 0x%x", iPdPath );
+            if ( iPdPath )
+                {
+                TParsePtrC ptr( *iPdPath );
+                media->SetTextValueL(
+                    TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralTitle),
+                    ptr.Name() );
+                }
+            else
+                {
+                media->SetTextValueL(
+                    TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralTitle),
+                    KNullDesC );
+                }
+            }
+        }
+
+
+   if (attrG & EMPXMediaGeneralUri)
+        {
+        media->SetTextValueL(
+            TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralUri),
+            *iPdPath);
+        }
+
+    if (attrG & EMPXMediaGeneralDuration)
+        {
+        TTimeIntervalMicroSeconds duration = iPdPlayer->Duration();
+        media->SetTObjectValueL<TInt>(
+               TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralDuration),
+               duration.Int64() / KPbMilliMultiplier);
+        }
+
+    // Set bitrate
+    TPckgBuf<TMMFAudioConfig> data;
+
+    const TMMFMessageDestinationPckg
+        destinationPckg(KUidInterfaceMMFAudioController);
+
+    if (attrA & EMPXMediaAudioBitrate)
+        {
+        error = iPdPlayer->CustomCommandSync(destinationPckg,
+            EMMFAudioControllerGetSourceBitRate, KNullDesC8, KNullDesC8, data);
+        if (!error)
+            {
+            media->SetTObjectValueL<TInt>(
+                   TMPXAttribute(KMPXMediaIdAudio, EMPXMediaAudioBitrate),
+                   data().iSampleRate);
+            }
+        }
+
+    if (attrA & EMPXMediaAudioSamplerate)
+        {
+
+        // Set sampling rate
+        error = iPdPlayer->CustomCommandSync(destinationPckg,
+            EMMFAudioControllerGetSourceSampleRate, KNullDesC8, KNullDesC8, data);
+        if (!error)
+            {
+            media->SetTObjectValueL<TInt>(
+                   KMPXMediaAudioSamplerate,
+                   data().iSampleRate);
+            }
+        }
+
+   if (attrG & EMPXMediaGeneralSize)
+        {
+        RFs fs;
+        User::LeaveIfError(fs.Connect());
+        CleanupClosePushL(fs);
+        TEntry entry;
+        fs.Entry(iPdPath->Des(), entry);
+        media->SetTObjectValueL<TInt>(
+               TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralSize),
+               entry.iSize);
+        CleanupStack::PopAndDestroy(&fs);
+        }
+
+   if (attrG & EMPXMediaGeneralMimeType)
+        {
+        RApaLsSession aps;
+        error  = aps.Connect(); // always fail in console test
+        if (KErrNone == error)
+            {
+            CleanupClosePushL(aps);
+            TDataType dataType;
+            TUid ignore;
+            if(aps.AppForDocument(iPdPath->Des(),ignore,dataType)==KErrNone)
+                {
+                media->SetTextValueL(
+                    TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralMimeType),
+                    dataType.Des());
+                }
+            CleanupStack::PopAndDestroy(&aps);
+            } // Notes, STIF console test always fail
+        }
+
+    // Set DRM info
+    // Only try to get DRM info if the song has completed downloading
+    MPX_DEBUG2("CMPXProgressDownload::MediaL(): iDownloadState = %d", iDownloadState);
+    if ( EPbDlStateDownloadCompleted == iDownloadState )
+        {
+        const CMPXMedia* drmMedia( iDrmMediaUtility->GetMediaL( attrD ));
+        if ( drmMedia )
+            {
+            TInt count( drmMedia->Count() );
+            for ( TInt i = 0; i < count; i++ )
+                {
+                TUint attrId( drmMedia->Attribute(i).AttributeId() );
+                if ( attrD & attrId )
+                    {
+                    TMPXAttribute mpxAtt( KMPXMediaIdDrm, attrId );
+                    switch ( attrId )
+                        {
+                        case EMPXMediaDrmType:
+                        case EMPXMediaDrmRightsStatus:
+                        case EMPXMediaDrmRightsType:
+                        case EMPXMediaDrmCount:
+                            {
+                            TInt val(
+                                drmMedia->ValueTObjectL<TInt>( mpxAtt ));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        case EMPXMediaDrmProtected:
+                        case EMPXMediaDrmSendingAllowed:
+                        case EMPXMediaDrmCanSetAutomated:
+                        case EMPXMediaDrmHasInfoUrl:
+                        case EMPXMediaDrmHasPreviewUrl:
+                        case EMPXMediaDrmAboutToExpire:
+                            {
+                            TBool val(
+                                drmMedia->ValueTObjectL<TBool>( mpxAtt ));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        case EMPXMediaDrmStartTime:
+                        case EMPXMediaDrmEndTime:
+                        case EMPXMediaDrmIntervalStartTime:
+                        case EMPXMediaDrmAccumulatedTime:
+                            {
+                            TInt64 val(
+                                drmMedia->ValueTObjectL<TInt64>( mpxAtt ));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        case EMPXMediaDrmInterval:
+                            {
+                            TTimeIntervalSeconds val(
+                                drmMedia->ValueTObjectL<TTimeIntervalSeconds>(mpxAtt));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        default:
+                            {
+                            break;
+                            }
+                        }   // end switch (attriId)
+                    }   // end if ( attrD & attrId )
+                }
+            }
+        }
+
+    iObs->HandleMedia(*media, KErrNone);
+    CleanupStack::PopAndDestroy(media);
+
+    MPX_DEBUG1("CMPXProgressDownload::MediaL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Cancel request
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::CancelRequest()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// File open complete event
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::MapcInitComplete(TInt aError,
+                                const TTimeIntervalMicroSeconds& aDuration)
+    {
+    MPX_DEBUG2("CMPXProgressDownload::MapcInitComplete(%d) entering", aError);
+
+    iState = EStateInitialised;
+
+    // Restore volume level
+    if ( KErrNone == aError )
+        {
+        TInt currentVol( 0 );
+        MPX_TRAPD( volError, currentVol = iVolumeWatcher->CurrentValueL() );
+        if ( volError == KErrNone )
+            {
+            SetVolume( currentVol );
+            TBool mute( EFalse);
+            MPX_TRAPD( muteError, mute = iMuteWatcher->CurrentValueL() );
+            if ( muteError == KErrNone && mute )
+                {
+                SetMute(mute);
+                }
+            }
+        }
+
+    if ( iPdPlayer )
+        {
+        MMMFDRMCustomCommand* drmCustom = iPdPlayer->GetDRMCustomCommand();
+        if ( drmCustom )
+            {
+            drmCustom->DisableAutomaticIntent( ETrue );
+            }
+        }
+    if ( EPbDlStateDownloadCompleted == iDownloadState )
+        {
+        TRAP_IGNORE( iDrmMediaUtility->InitL( *iPdPath ));
+        }
+
+    if ( EPbDlStateBuffering == iDownloadState )
+        {
+        iDownloadState = EPbDlStateDownloading;
+        TRAP_IGNORE(
+            iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPDownloadStateChanged,
+                                     iDownloadState, aError));
+        }
+
+    TRAP_IGNORE(
+        iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPActive,
+                                 ETrue,aError);
+        iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPInitialised,
+                                aDuration.Int64()/KPbMilliMultiplier,aError);
+        iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPaused,
+                                 0,aError));
+
+    MPX_DEBUG1("CMPXProgressDownload::MapcInitComplete() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// File play complete event
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::MapcPlayComplete(TInt aError)
+    {
+    MPX_DEBUG2("CMPXProgressDownload::MapcPlayComplete(%d) entering", aError);
+
+    iState = EStateNotInitialised;
+
+    // START WORKAROUND
+    // Check if error is KErrDied and played to the end, then just
+    // treat that as a normal play complete and overwrite the error
+    // handling here
+    // NOTE: This is only a temporary workaround for S60 3.1.
+    // S60 3.2 will have a proper fix in the PD Utility
+    if ( KErrDied == aError )
+        {
+        MPX_DEBUG2("MPXProgressDownload::MapcPlayComplete(): iDownloadState = %d", iDownloadState);
+        if ( EPbDlStateDownloadCompleted == iDownloadState )
+            {
+            TTimeIntervalMicroSeconds dur( iPdPlayer->Duration() );
+            TTimeIntervalMicroSeconds pos;
+            iPdPlayer->GetPosition(pos);
+            if ( Abs( dur.Int64() - pos.Int64() ) < KProgressPlayEndThreshold &&
+                 dur.Int64() > KProgressPlayEndThreshold )
+                {
+                MPX_DEBUG1("CMPXProgressDownload::MapcPlayComplete(): Resetting error to KErrNone");
+                aError = KErrNone;
+                }
+            }
+        }
+    // END WORKAROUND
+
+    // KErrEof is sometimes returned when play finishes at the end
+    if ( KErrEof == aError )
+        {
+        aError = KErrNone;
+        }
+
+    if ( iConsumeStarted )
+        {
+        if ( KErrNone != aError )
+            {
+            TRAP_IGNORE( ConsumeRightsL( ContentAccess::EPause ) );
+            }
+        else
+            {
+            TRAP_IGNORE( ConsumeRightsL( ContentAccess::EStop ) );
+            }
+        iConsumeStarted = EFalse;
+        }
+
+    // If killed by audio policy, mimic a paused state
+    if ( KErrDied == aError )
+        {
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused,
+                                 0,
+                                 aError );
+        }
+    else
+        {
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPlayComplete,
+                                 0,
+                                 aError);
+        }
+
+    MPX_DEBUG1("CMPXProgressDownload::MapcPlayComplete() exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXProgressDownload::Paused
+// -----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::Paused()
+    {
+    MPX_DEBUG1("CMPXProgressDownload::Paused() entering");
+
+    // This callback will only be called when the PD Utility runs out
+    // of data (i.e. all downloaded content has been played).
+    iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused,
+                             0,
+                             KErrUnderflow);
+    MPX_DEBUG1("CMPXProgressDownload::Paused() exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXProgressDownload::Playing
+// -----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::Playing()
+    {
+    MPX_DEBUG1("CMPXProgressDownload::Playing() entering");
+    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPlaying,
+                             0,
+                             KErrNone);
+    MPX_DEBUG1("CMPXProgressDownload::Playing() exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXProgressDownload::HandleDownloadEventL
+// -----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::HandleDownloadEventL(TUint aTransactionID,
+                                                TBrCtlDownloadEvent aEvent,
+                                                TUint aValue)
+    {
+    MPX_DEBUG4("CMPXProgressDownload::HandleDownloadEventL(%d, %d, %d) entering",
+               aTransactionID, aEvent, aValue);
+
+    // Notes. It is API in current music player which is called by MusicShop
+    //
+    if (iPdPlayer)
+        {
+        iPdPlayer->HandleDownloadEventL( aTransactionID, aEvent, aValue );
+
+        __ASSERT_DEBUG(
+            aTransactionID == iTransactionId,
+            User::Panic(_L("CMPlayerAudioUIController::HandleProgressiveDownloadEventL"),
+                        KErrArgument));
+
+        switch (aEvent)
+            {
+            case EDownloadEventStarted:
+                {
+                iDownloadState = EPbDlStateBuffering;
+                iDownloadSize = static_cast<TInt>( aValue );
+
+                // send new state
+                iObs->HandlePluginEvent(
+                            MMPXPlaybackPluginObserver::EPDownloadStateChanged,
+                            iDownloadState,
+                            KErrNone);
+                iObs->HandlePluginEvent(
+                            MMPXPlaybackPluginObserver::EPDownloadStarted,
+                            iDownloadSize,
+                            KErrNone );
+                break;
+                }
+            case EDownloadEventCompleted:
+                {
+                iDownloadState = EPbDlStateDownloadCompleted;
+                iDownloadSize = static_cast<TInt>( aValue );
+                iDownloadBytes = iDownloadSize;
+                iObs->HandlePluginEvent(
+                            MMPXPlaybackPluginObserver::EPDownloadStateChanged,
+                            iDownloadState,
+                            KErrNone);
+                break;
+                }
+            case EDownloadEventCanceled:
+                {
+                iDownloadState = EPbDlStateNotDownloading;
+                iObs->HandlePluginEvent(
+                            MMPXPlaybackPluginObserver::EPDownloadStateChanged,
+                            iDownloadState,
+                            KErrNone);
+                break;
+                }
+            case EDownloadEventError:
+                {
+                iDownloadState = EPbDlStateDownloadError;
+                iObs->HandlePluginEvent(
+                            MMPXPlaybackPluginObserver::EPDownloadStateChanged,
+                            iDownloadState,
+                            KErrNone);
+                break;
+                }
+            case EDownloadEventProgress:
+                {
+                if ( EPbDlStateDownloadPaused == iDownloadState )
+                    {
+                    iDownloadState = EPbDlStateDownloading;
+                    iObs->HandlePluginEvent(
+                                MMPXPlaybackPluginObserver::EPDownloadStateChanged,
+                                iDownloadState,
+                                KErrNone);
+                    }
+                iDownloadBytes = static_cast<TInt>( aValue );
+                iObs->HandlePluginEvent(
+                            MMPXPlaybackPluginObserver::EPDownloadPositionChanged,
+                            iDownloadBytes,
+                            KErrNone);
+                break;
+                }
+            case EDownloadEventPaused:
+                {
+                iDownloadState = EPbDlStateDownloadPaused;
+                iObs->HandlePluginEvent(
+                            MMPXPlaybackPluginObserver::EPDownloadStateChanged,
+                            iDownloadState,
+                            KErrNone);
+                break;
+                }
+            case EDownloadEventPausable:
+                {
+                iFeatureFlag |= EPbFeaturePdPausable;
+                iObs->HandlePluginEvent(
+                            MMPXPlaybackPluginObserver::EPSupportedFeaturesChanged,
+                            iFeatureFlag,
+                            KErrNone);
+                break;
+                }
+            default:
+                {
+                // pass
+                break;
+                }
+            }
+        }
+    MPX_DEBUG1("CMPXProgressDownload::HandleDownloadEventL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Handle a change in a setting value.
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::HandleSettingChange(
+    const TUid& aRepositoryUid,
+    TUint32 aSettingId )
+    {
+    MPX_DEBUG1("CMPXProgressDownload::HandleSettingChange() entering");
+
+    if ( KCRUidMPXSettings == aRepositoryUid &&
+         KMPXPlaybackVolume == aSettingId )
+        {
+        MPX_DEBUG1("CMPXProgressDownload::HandleSettingChange() Volume setting changed");
+        TInt currentVol( 0 );
+        MPX_TRAPD( volError, currentVol = iVolumeWatcher->CurrentValueL() );
+        if ( KErrNone == volError )
+            {
+            SetVolume( currentVol );
+            }
+        }
+    else if ( KCRUidMPXSettings == aRepositoryUid &&
+         KMPXPlaybackMute == aSettingId )
+        {
+        MPX_DEBUG1("CMPXProgressDownload::HandleSettingChange() Mute setting changed");
+        TBool mute( EFalse );
+        MPX_TRAPD( error, mute = static_cast<TBool>(iMuteWatcher->CurrentValueL()) );
+        if ( error == KErrNone )
+            {
+            TInt oldVolume( 0 );
+            iPdPlayer->GetVolume( oldVolume );
+            if ( (mute && oldVolume != 0) || (!mute && oldVolume == 0) )
+                {
+                SetMute( mute );
+                }
+            }
+        }
+    MPX_DEBUG1("CMPXProgressDownload::HandleSettingChange() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the volume level in audio controller
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::SetVolume( TInt aVolume )
+    {
+    MPX_DEBUG2("CMPXProgressDownload::SetVolume(%d) entering", aVolume);
+
+    // Ensure that level is within min and max values
+    if ( aVolume > KPbPlaybackVolumeLevelMax )
+        {
+        aVolume = KPbPlaybackVolumeLevelMax;
+        }
+    if ( aVolume < KPbPlaybackVolumeLevelMin )
+        {
+        aVolume = KPbPlaybackVolumeLevelMin;
+        }
+
+    TBool changed( EFalse );
+    // Change MMF Audio player's volume
+    if ( EStateInitialised == iState )
+        {
+        TInt newVolume( aVolume * iPdPlayer->MaxVolume() / 100 );
+        MPX_DEBUG2("CMPXProgressDownload::SetVolume(): Setting volume = %d", newVolume);
+
+        // First check if MMF Audio player's volume is changed by new value
+        TInt oldVolume( 0 );
+        iPdPlayer->GetVolume( oldVolume );
+        if ( newVolume != oldVolume )
+            {
+            iPdPlayer->SetVolume( newVolume );
+            changed = ETrue;
+            }
+        }
+
+    // Change setting in cenrep
+    TInt currentVol( 0 );
+    MPX_TRAPD( volError, currentVol = iVolumeWatcher->CurrentValueL() );
+    if ( volError == KErrNone && aVolume != currentVol )
+        {
+        MPX_TRAP( volError, iVolumeWatcher->SetValueL( aVolume ) );
+        }
+
+    // Notify observer if value changed
+    if ( changed )
+        {
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPVolumeChanged,
+                                 aVolume,
+                                 KErrNone);
+        }
+
+    MPX_DEBUG1("CMPXProgressDownload::SetVolume() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the volume level in audio controller
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::SetMute( TBool aMute )
+    {
+    MPX_DEBUG3("-->CMPXProgressDownload::SetMute 0x%08x vol (%d)", this, aMute);
+
+    TBool changed( EFalse );
+    // Change MMF Audio player's volume
+    TInt currentVolume(0);
+    iPdPlayer->GetVolume(currentVolume);
+    if ( aMute && currentVolume != 0 )
+        {
+        iVolume = currentVolume;
+        iPdPlayer->SetVolume(0);
+        changed = ETrue;
+        }
+    else if ( !aMute && currentVolume == 0 )      // UnMute
+        {
+        iPdPlayer->SetVolume(iVolume);
+        changed = ETrue;
+        }
+
+    // Change setting in cenrep
+    TBool currentMute( EFalse );
+    MPX_TRAPD( muteError, currentMute = iMuteWatcher->CurrentValueL() );
+    if ( muteError == KErrNone )
+        {
+        if ( aMute && !currentMute )
+            {
+            MPX_TRAP( muteError, iMuteWatcher->SetValueL( aMute ) );
+            }
+        else if ( !aMute && currentMute )
+            {
+            MPX_TRAP( muteError, iMuteWatcher->SetValueL( aMute ) );
+            }
+        }
+
+    // Notify observer if value changed
+    if ( changed )
+        {
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPMuteChanged,
+                                 aMute,
+                                 KErrNone);
+        }
+
+    MPX_DEBUG3("<--CMPXProgressDownload::SetMute 0x%08x vol (%d)", this, aMute);
+    }
+
+// ----------------------------------------------------------------------------
+// Consumes the rights for the current media
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownload::ConsumeRightsL(ContentAccess::TIntent aIntent)
+    {
+    MPX_DEBUG2("-->CMPXProgressDownload::ConsumeRightsL(%d)", aIntent);
+    if ( iPdPlayer )
+        {
+        MMMFDRMCustomCommand* drmCustom = iPdPlayer->GetDRMCustomCommand();
+        if ( drmCustom )
+            {
+            switch ( aIntent )
+                {
+                case ContentAccess::EPlay:
+                case ContentAccess::EStop:
+                case ContentAccess::EPause:
+                case ContentAccess::EContinue:
+                    {
+                    break;
+                    }
+                default:
+                    {
+                    aIntent = ContentAccess::EUnknown;
+                    iConsumeStarted = EFalse;
+                    break;
+                    }
+                }
+            MPX_DEBUG2("-->CMPXProgressDownload::ConsumeRightsL(): Executing intent %d", aIntent);
+            TInt returnCode( drmCustom->ExecuteIntent(aIntent) );
+            MPX_DEBUG2("CMPXProgressDownload::ConsumeRightsL() ExecuteIntent return (%d)", returnCode);
+            User::LeaveIfError(returnCode);
+            }
+        }
+    MPX_DEBUG2("<--CMPXProgressDownload::ConsumeRightsL(%d)", aIntent);
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownload/src/mpxprogressdownloadproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+#include <implementationproxy.h>
+#include "mpxprogressdownload.h"
+
+#if (!defined IMPLEMENTATION_PROXY_ENTRY)
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) {{aUid},(TProxyNewLPtr)(aFuncPtr)}
+#endif
+
+// ----------------------------------------------------------------------------
+// The list of implementations
+// ----------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { IMPLEMENTATION_PROXY_ENTRY(0x101FFC09, CMPXProgressDownload::NewL) };
+
+// ----------------------------------------------------------------------------
+// The proxy of implementations
+// ----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/data/10207bcc.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file.
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+#include <mpxplaybackplugin.hrh>
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: Supported plugin types.
+ *  E.g. if podcast plugin may support music plugin as well, KMPXColPluginMusic
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. for music plugin will be: 0x101FFCDA
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags, not used now
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXCollectionPluginPriorities. This value determines
+ *  the returning order when several plugins can support the same set of Uids. 
+ *  Default value of this field is EMPXCollectionPluginPriorityNormal.
+ */
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x10207BCC;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXPlaybackPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = 0x10207BCD;
+                    version_no = 1;
+                    display_name = "progress download sb";
+                    default_data = "audio/mp3;audio/3gp;audio/3gpp2;audio/x-ms-wma;x-caf-audio/x-ms-wma;audio/mpeg;"
+                                   "audio/aac;audio/x-mp3;audio/mp4;audio/wav;audio/x-wav;audio/x-au;audio/au";
+                    opaque_data = "<s>http<e>.mp3;.aac;.3gp;.3gpp;.3g2;.3gpp2;.mp4;.wav;.wma;.asf;.odf;.dcf;.m4a"
+                                  "<t>"EPbLocal"</t>";
+                    }
+                };
+            }
+        };
+    }
+            
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxprogressdownloadEMC.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxprogressdownloadSB.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/group/mpxprogressdownloadSB.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Local audio playback project specification
+*
+*/
+
+
+
+#include   <bldvariant.hrh>
+#include   <data_caging_paths.hrh>
+#include   <platform_paths.hrh>
+
+TARGET          mpxprogressdownloadsb.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x10207BCC
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxprogressdownloadsb.cpp
+SOURCE          mpxprogressdownloadsbproxy.cpp
+
+SOURCEPATH      ../data
+START RESOURCE  10207bcc.rss
+TARGET          mpxprogressdownloadsb.rsc
+END
+
+USERINCLUDE     ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         bafl.lib
+LIBRARY         ecom.lib
+LIBRARY         efsrv.lib
+LIBRARY         mmfcontrollerframework.lib 
+LIBRARY         audioequalizerutility.lib
+LIBRARY         customcommandutility.lib
+LIBRARY         apgrfx.lib
+LIBRARY         apmime.lib 
+LIBRARY         caf.lib
+LIBRARY         cafutils.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         estor.lib
+LIBRARY         metadatautility.lib
+LIBRARY         EnhancedMediaClient.lib
+LIBRARY         mmfstandardcustomcommands.lib
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/inc/mpxprogressdownloadsb.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,259 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class manages progress download via Enhanced Media Client
+*
+*/
+
+
+
+#ifndef CMPXProgressDownloadSBSB_H
+#define CMPXProgressDownloadSBSB_H
+
+// INCLUDES
+#include <caf/content.h>
+#include <mpxplaybackplugin.h>
+#include <mpxcenrepobserver.h>
+#include <mpxplaybackcommanddefs.h>
+
+#include <MMControlFactory.h>
+#include <StreamControl.h>
+#include <SinkControl.h>
+#include <ControlObserver.h>
+#include <Events.h>
+#include <ProgDLSource.h>
+#include <SourceControlObserver.h>
+#include <StreamControlObserver.h>
+#include <VolumeControl.h>
+#include <apgcli.h>
+
+using multimedia::MStreamControl;
+using multimedia::MControlObserver;
+using multimedia::MProgDLSource;
+using multimedia::MControl;
+using multimedia::MSinkControl;
+using multimedia::CMultimediaFactory;
+using multimedia::MVolumeControl;
+
+
+
+// FORWARD DECLARATIONS
+class CMPXCenRepWatcher;
+class CMPXDrmMediaUtility;
+class RMMFDRMCustomCommands;
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+*  CMPXProgressDownloadSB class
+*
+*  Plug-in basically handles download via S60's enhanced media client.
+*  @lib mpxprogressdownloadsb.lib
+*/
+NONSHARABLE_CLASS(CMPXProgressDownloadSB) : public CMPXPlaybackPlugin,
+                                            public MMPXCenRepObserver,
+                                            public MControlObserver
+    {
+    private:
+        enum TMPXLocalAudioPlaybackState
+            {
+            EStateNotInitialised,
+            EStateInitialising,
+            EStateInitialised
+            };
+    public: // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        * @param aInitParams, initialization parameter
+        * @return a pointer to the created instance
+        */
+        static CMPXProgressDownloadSB* NewL(TAny* aInitParams);
+
+        /**
+        * Destructor
+        * Destroy the object and release all memory objects
+        */
+        ~CMPXProgressDownloadSB();
+
+    private: // Functions from base classes
+        /**
+        *  from CMPXPlaybackPlugin
+        */
+
+        /**
+        * Initializes a song for playback
+        * @param aSong the song path
+        */
+        void InitialiseL(const TDesC& aSong);
+
+        /**
+        * Initializes a song for playback
+        * @param aFile file handle of a song
+        */
+        void InitialiseL(RFile& aFile);
+
+        /**
+        * Executes a command on the selected song
+        * @param aCmd a command
+        * @param aData data (optional)
+        */
+        void CommandL(TMPXPlaybackCommand aCmd, TInt aData=0);
+
+        /**
+        * Executes a command
+        * @param aCmd Command
+        */
+        void CommandL(CMPXCommand& aCmd);
+
+        /**
+        * Sets a property of the plugin
+        * @param aProperty a property
+        * @param aValue the value of the setting
+        */
+        void SetL(TMPXPlaybackProperty aProperty,TInt aValue);
+
+        /**
+        * Gets a property of the plugin (async)
+        * @param aProperty a property
+        */
+        void PropertyL(TMPXPlaybackProperty aProperty) const;
+
+        /**
+        * Gets a list of sub players
+        * @return a list of names of sub players
+        */
+        void SubPlayerNamesL();
+
+        /**
+        * Select a sub player
+        * @param aIndex index to the sub player
+        */
+        void SelectSubPlayerL(TInt aIndex);
+
+        /**
+        * Returns current sub player name
+        * @return friendly name of the current the sub player
+        */
+        const TDesC& SubPlayerName();
+
+        /**
+        * Current sub player index
+        * @return index to the sub player
+        */
+        TInt SubPlayerIndex() const;
+
+        /**
+        * Media properties of the current file (async)
+        * @param aAttrs attributes requested
+        */
+        void MediaL(const TArray<TMPXAttribute>& aAttrs);
+
+        /**
+        * Cancel async request
+        */
+        void CancelRequest();
+
+
+        /**
+        *  From MControlObserver
+        */
+        void Event( MControl* aControl, TUint aEventType, TAny* aEventObject );
+
+
+        /**
+        * From MMPXCenRepObserver
+        * Handle a change in a setting value.
+        *
+        * @param aRepositoryUid Central repository UID containing the setting
+        * @param aSettingId Id of the setting
+        * @since 3.0
+        */
+        void HandleSettingChange( const TUid& aRepositoryUid,
+                                  TUint32 aSettingId);
+
+    private:
+       /**
+        * C++ default constructor
+        */
+        CMPXProgressDownloadSB();
+
+        /**
+        * the second phase constructor ConstructL to safely construct things
+        * that can leave
+        */
+        void ConstructL();
+
+        /**
+        * Sets the volume level in audio controller
+        * @param aVolume Volume level, ranges from 0 - KPbPlaybackVolumeLevelMax
+        */
+        void SetVolume( TInt aVolume );
+
+        /**
+        * Sets the volume level in audio controller to mute.
+        * @param aMute ETrue to indicated mute
+        */
+        void SetMute( TBool aMute );
+
+        void ResetEnhancedMediaClient();
+
+        void MoveDownloadedFileToMusicFolderL();
+
+        /**
+        *  Consumes the rights for the current media according
+        *  to the specified consume type
+        *
+        *  @param aType Type of consumption to execute
+        */
+        void ConsumeRights(ContentAccess::TIntent aIntent);
+    private: // Data
+
+        RFs iFs;
+
+        CMPXCenRepWatcher* iVolumeWatcher;
+        CMPXCenRepWatcher* iMuteWatcher;
+
+        TInt32 iDownloadID;
+        MStreamControl* iMStreamControl; // owned
+        MSinkControl* iMAudioSink; // owned
+        MProgDLSource* iMAudioProgDLSource; // owned
+        MVolumeControl*  iMVolumeControl; // owned
+        CMultimediaFactory* iFactory; // owned
+        TBool iStreamBuffering;
+        TBool iFirstBuffer;
+        TBool iFileSaved;
+        RMMFDRMCustomCommands* iDrmCustomCommand;
+
+        RFile* iFileHandle; // not owned
+        HBufC16* iPdPath;
+        TUint iTransactionId;
+        TInt iVolume;
+        TInt iFeatureFlag;
+        CMPXDrmMediaUtility* iDrmMediaUtility;
+        TMPXPlaybackPdDownloadState iDownloadState;
+        TInt iDownloadBytes;
+        TInt iDownloadSize;
+        TMPXLocalAudioPlaybackState iState;
+        TFileName iMovedFileName;
+        TDataType iMimeType;
+        TBool iPlaying;
+        TBool iConsumeStarted;
+        TBool iOngoingCmdCancelDownload;
+        TInt iErrorOfStreamClosedEvent;
+
+    };
+
+#endif      // CMPXProgressDownloadSBSB_H
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/src/mpxprogressdownloadsb.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1502 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class manages progress download using Enhanced Media
+                 Client API
+*
+*/
+
+
+// INCLUDE FILES
+#include <f32plugin.h>
+#include <AudioPreference.h>
+#include <badesca.h>
+#include <mmf/common/mmfcontrollerframeworkbase.h>
+#include <mmf/common/mmfmeta.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxmedia.h>
+#include <mpxplaybackpluginobserver.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxcmn.h>
+#include <mpxdrmmediautility.h>
+#include <mpxprivatecrkeys.h>
+#include <mpxcenrepwatcher.h>
+#include <mpxlog.h>
+#include <pathinfo.h>
+
+#include <mmf/common/mmfdrmcustomcommands.h>
+#include <MetaDataUtility.h>
+#include <MetaDataFieldContainer.h>
+
+#include <MMControlFactory.h>
+using namespace multimedia;
+
+
+#include "mpxprogressdownloadsb.h"
+
+
+// CONSTANTS
+const TUid KProgressDownloadUid={0x10207BCD};
+
+// ============================ LOCAL FUNCTIONS ==============================
+
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXProgressDownloadSB* CMPXProgressDownloadSB::NewL(TAny* /*aInitParams*/)
+    {
+    CMPXProgressDownloadSB* p=new(ELeave)CMPXProgressDownloadSB();
+    CleanupStack::PushL(p);
+    p->ConstructL();
+    CleanupStack::Pop(p);
+    return p;
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::ConstructL()
+    {
+    iVolumeWatcher = CMPXCenRepWatcher::NewL(KCRUidMPXSettings,
+                                             KMPXPlaybackVolume,
+                                             this);
+    iMuteWatcher = CMPXCenRepWatcher::NewL(KCRUidMPXSettings,
+                                           KMPXPlaybackMute,
+                                           this);
+    iFeatureFlag = EPbFeatureBalance | EPbFeatureVolumeRamp;
+    iDrmMediaUtility = CMPXDrmMediaUtility::NewL();
+
+    //Create Factory
+    TInt status = CMultimediaFactory::CreateFactory( iFactory );
+    User::LeaveIfError(status);
+
+    User::LeaveIfError(iFs.Connect());
+
+    }
+
+// ----------------------------------------------------------------------------
+// C++ constructor
+// ----------------------------------------------------------------------------
+//
+CMPXProgressDownloadSB::CMPXProgressDownloadSB()
+    : iStreamBuffering(EFalse),
+      iFirstBuffer(EFalse),
+      iFileSaved(EFalse),
+      iDownloadBytes(0),
+      iDownloadSize(0),
+      iFileHandle(NULL),
+      iPdPath(NULL),
+      iPlaying(EFalse),
+      iOngoingCmdCancelDownload(EFalse),
+      iErrorOfStreamClosedEvent(KErrNone)
+    {}
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXProgressDownloadSB::~CMPXProgressDownloadSB()
+    {
+    delete iMuteWatcher;
+    delete iVolumeWatcher;
+    if ( iDrmMediaUtility )
+        {
+        if ( EPbDlStateDownloadCompleted == iDownloadState )
+            {
+            ConsumeRights( ContentAccess::EStop );
+            }
+        iDrmMediaUtility->Close();
+        delete iDrmMediaUtility;
+        iDrmMediaUtility = NULL;
+        }
+
+    ResetEnhancedMediaClient();
+    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPActive, EFalse, KErrNone);
+
+    delete iFactory;
+    iFactory = NULL;
+    delete iPdPath;
+    delete iDrmCustomCommand;
+    iDrmCustomCommand = NULL;
+
+    iFs.Close();
+    }
+
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::ResetEnhancedMediaClient()
+    {
+
+    if (iMStreamControl)
+        {
+        iMStreamControl->Close();
+        }
+
+    if (iMAudioProgDLSource)
+        {
+        iMAudioProgDLSource->Close();
+        }
+
+    if(iFactory)
+        {
+        if(iMStreamControl)
+            {
+            iFactory->DeleteStreamControl(iMStreamControl);
+            iMStreamControl = NULL;
+            }
+
+        if(iMAudioProgDLSource)
+           {
+           MSourceControl* objPtr = iMAudioProgDLSource;
+           iFactory->DeleteSourceControl(objPtr);
+           iMAudioProgDLSource = NULL;
+           }
+
+
+        if(iMAudioSink)
+            {
+            MSinkControl* objPtr = iMAudioSink;
+            iFactory->DeleteSinkControl(objPtr);
+            iMAudioSink = NULL;
+            }
+
+        if(iMVolumeControl)
+            {
+            MEffectControl* effectObj = iMVolumeControl;
+            iFactory->DeleteEffectControl(effectObj);
+            iMVolumeControl = NULL;
+            }
+        }
+
+
+    }
+
+// ----------------------------------------------------------------------------
+// Initializes a song for playback
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::InitialiseL(const TDesC& aSong)
+    {
+    MPX_DEBUG2("CMPXProgressDownloadSB::InitialiseL(%S) entering", &aSong );
+
+    // Re-initializes EMC to make sure multiple sequential
+    // downloads work
+    ResetEnhancedMediaClient();
+
+    //Create Stream Source
+    TInt err = iFactory->CreateStreamControl( KStreamControl, iMStreamControl );
+    User::LeaveIfError(err);
+    iMStreamControl->AddObserver( *this );
+
+    //Create PD Source
+    if ( iMStreamControl == NULL )
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    if ( iMAudioProgDLSource != NULL )
+        {
+        User::Leave(KErrAlreadyExists);
+        }
+
+    MSourceControl* tempCtrl(NULL);
+    err = iFactory->CreateSourceControl( KProgDLSourceControl, tempCtrl );
+    User::LeaveIfError(err);
+
+    iMAudioProgDLSource = static_cast<MProgDLSource*>(tempCtrl);
+
+    //Open PDL Source
+    err = iMAudioProgDLSource->Open(aSong, iTransactionId);
+    User::LeaveIfError(err);
+
+    err = iMAudioProgDLSource->AddObserver( *this );
+     User::LeaveIfError(err);
+
+    err = iMStreamControl->AddSource( *iMAudioProgDLSource );
+    User::LeaveIfError(err);
+
+
+    //Create Sink
+    MSinkControl* tempSinkCtrl(NULL);
+    err = iFactory->CreateSinkControl( KMMFAudioOutputSinkControl, tempSinkCtrl );
+    User::LeaveIfError(err);
+    iMAudioSink = tempSinkCtrl;
+    iMStreamControl->AddSink( *iMAudioSink );
+
+    //Create Volume Control
+    MEffectControl* effectCtrl(NULL);
+    err = iFactory->CreateEffectControl( KVolumeEffectControl, effectCtrl );
+    User::LeaveIfError(err);
+
+    iMVolumeControl = static_cast<MVolumeControl*>(effectCtrl);
+    err = iMStreamControl->AddEffect( *iMVolumeControl );
+
+    //Open Stream
+    iMStreamControl->SetPriority( KAudioPriorityRealOnePlayer, KAudioPrefRealOneLocalPlayback );
+    err =  iMStreamControl->Open();
+    User::LeaveIfError(err);
+    iStreamBuffering = ETrue;
+
+    delete iPdPath;
+    iPdPath = NULL;
+    iPdPath = aSong.AllocL();
+    iDownloadState = EPbDlStateBuffering;
+    iState = EStateInitialising;
+    iConsumeStarted = EFalse;
+    iFileSaved = EFalse;
+    MPX_DEBUG1("CMPXProgressDownloadSB::InitialiseL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Initializes a song for playback
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::InitialiseL(RFile& /*aSong*/)
+    {
+    MPX_DEBUG1("CMPXProgressDownloadSB::InitialiseL(RFile) entering");
+    User::Leave(KErrNotSupported);
+    }
+
+// ----------------------------------------------------------------------------
+// Executes a command on the selected song
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::CommandL(
+    TMPXPlaybackCommand aCmd,
+    TInt /*aData*/)
+    {
+    MPX_DEBUG2("CMPXProgressDownloadSB::CommandL(%d) entering", aCmd);
+
+    if ( iMStreamControl )
+        {
+        switch( aCmd )
+            {
+            case EPbCmdPlay:
+                {
+                if ( EPbDlStateDownloadCompleted == iDownloadState )
+                    {
+                    if ( iConsumeStarted )
+                        {
+                        ConsumeRights( ContentAccess::EContinue );
+                        }
+                    else
+                        {
+                        ConsumeRights( ContentAccess::EPlay );
+                        iConsumeStarted = ETrue;
+                        }
+                    iMStreamControl->Start();
+                    }
+                if ( iMStreamControl->GetState() == MStreamControl::EXECUTING )
+                    {
+                    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPlaying,
+                                             0, KErrNone);
+                    }
+                else
+                    {
+                    iMStreamControl->Start();
+                    }
+
+                break;
+                }
+            case EPbCmdPause:
+                if ( EPbDlStateDownloadCompleted == iDownloadState && iConsumeStarted )
+                    {
+                    ConsumeRights( ContentAccess::EPause );
+                    }
+                TInt ret = iMStreamControl->Pause();
+                iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPaused, 0, ret);
+                break;
+            case EPbCmdStop:
+                iMStreamControl->Stop();
+                iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPStopped,
+                                         0, KErrNone);
+                if ( EPbDlStateDownloadCompleted == iDownloadState && iConsumeStarted )
+                    {
+                    ConsumeRights( ContentAccess::EStop );
+                    iConsumeStarted = EFalse;
+                    if ( !iFileSaved )
+                        {
+                        iDrmMediaUtility->Close(); // release file handle so we can move file.
+                        MoveDownloadedFileToMusicFolderL();
+                        }
+                    }
+                iDrmMediaUtility->Close();
+                break;
+            case EPbCmdClose:
+                if ( EPbDlStateDownloadCompleted == iDownloadState && iConsumeStarted  )
+                    {
+                    ConsumeRights( ContentAccess::EStop );
+                    iConsumeStarted = EFalse;
+                    if ( !iFileSaved )
+                        {
+                        iDrmMediaUtility->Close(); // release file handle so we can move file.
+                        MoveDownloadedFileToMusicFolderL();
+                        }
+                    }
+                iDrmMediaUtility->Close();
+                iState = EStateNotInitialised;
+                iDownloadState = EPbDlStateNotDownloading;
+                iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPClosed,
+                                         0, KErrNone);
+                break;
+            }
+        }
+
+    MPX_DEBUG1("CMPXProgressDownloadSB::CommandL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Executes a command
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::CommandL( CMPXCommand& aCmd )
+    {
+    MPX_FUNC("CMPXProgressDownloadSB::CommandL(CMPXCommand)");
+
+    ASSERT( aCmd.IsSupported( KMPXCommandGeneralId ));
+    TInt id( *aCmd.Value<TInt>( KMPXCommandGeneralId ));
+    if ( KMPXCommandIdPlaybackPD == id )
+        {
+        ASSERT(aCmd.IsSupported(KMPXCommandPlaybackGeneralType));
+        TMPXPlaybackPdCommand cmd(
+            static_cast<TMPXPlaybackPdCommand>(
+                *aCmd.Value<TInt>(KMPXCommandPlaybackGeneralType)));
+        switch ( cmd )
+            {
+            case ( EPbCmdStartPd ):
+                {
+                ASSERT( aCmd.IsSupported( KMPXCommandPlaybackPDTransactionID ));
+                iTransactionId = *aCmd.Value<TUint>( KMPXCommandPlaybackPDTransactionID );
+                break;
+                }
+            case ( EPbCmdFinishPd ):
+                {
+                iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPlayComplete,
+                                         0,KErrNone);
+                break;
+                }
+            case ( EPbCmdGetPdStatus ):
+                {
+                aCmd.SetTObjectValueL<TUint>(
+                        KMPXCommandPlaybackPDTransactionID,
+                        iTransactionId );
+                aCmd.SetTObjectValueL<TMPXPlaybackPdDownloadState>(
+                        KMPXCommandPlaybackPDState,
+                        static_cast<TMPXPlaybackPdDownloadState>(iDownloadState));
+                aCmd.SetTObjectValueL<TInt>(
+                        KMPXCommandPlaybackPDDownloadedBytes,
+                        iDownloadBytes );
+                aCmd.SetTObjectValueL<TInt>(
+                        KMPXCommandPlaybackPDTotalBytes,
+                        iDownloadSize );
+                break;
+                }
+            case ( EPbCmdPausePd ):
+                {
+                iObs->HandlePluginEvent(
+                        MMPXPlaybackPluginObserver::EPDownloadCmdPauseDownload,
+                        iTransactionId,
+                        KErrNone );
+                break;
+                }
+            case ( EPbCmdResumePd ):
+                {
+                iMAudioProgDLSource->ResumeDownload();
+
+                iObs->HandlePluginEvent(
+                        MMPXPlaybackPluginObserver::EPDownloadCmdResumeDownload,
+                        iTransactionId,
+                        KErrNone );
+                break;
+                }
+            case ( EPbCmdCancelPd ):
+                {
+
+                iMStreamControl->Stop();
+                iMStreamControl->Close();
+                iMAudioProgDLSource->CancelDownload();
+                iOngoingCmdCancelDownload = ETrue;
+                iObs->HandlePluginEvent(
+                        MMPXPlaybackPluginObserver::EPDownloadCmdCancelDownload,
+                        iTransactionId,
+                        KErrNone);
+                break;
+                }
+            default:
+                break;
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Sets a property of the plugin
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::SetL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue)
+    {
+    MPX_DEBUG3("CMPXProgressDownloadSB::SetL(%d, %d) entering", aProperty, aValue);
+
+    TBool isSupported=ETrue;
+    switch(aProperty)
+        {
+        case EPbPropertyVolume:
+            {
+            SetVolume(aValue);
+            }
+            break;
+        case EPbPropertyVolumeRamp:
+            {
+            TInt curVol = 0;
+            MVolumeControl::TVolumeRampMode aMode = MVolumeControl::EIMMEDIATE;
+            TUint64 duration = aValue;
+            TInt err = iMVolumeControl->GetVolume(curVol);
+            if(iMVolumeControl)
+                {
+                iMVolumeControl->SetVolumeRamp(0, curVol, duration, aMode);
+                iMVolumeControl->Apply();
+                }
+            }
+            break;
+        case EPbPropertyMute:
+            SetMute( aValue );
+            break;
+        case EPbPropertyBalance:
+            break;
+        default:
+            isSupported=EFalse;
+        }
+
+    if (!isSupported)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPSetComplete,
+                             aProperty, KErrNone);
+
+    MPX_DEBUG1("CMPXProgressDownloadSB::SetL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Gets a property of the plugin (async)
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::PropertyL(TMPXPlaybackProperty aProperty) const
+    {
+    MPX_DEBUG2("CMPXProgressDownloadSB::ValueL(%d) entering", aProperty);
+
+    TBool isSupported=ETrue;
+    TInt value=KErrNotFound;
+    TInt err(KErrNone);
+    switch(aProperty)
+        {
+        case EPbPropertyVolume:
+            value = iVolumeWatcher->CurrentValueL();
+            break;
+        case EPbPropertyMaxVolume:
+            iMVolumeControl->GetMaxVolume(value);
+            break;
+        case EPbPropertyMute:
+            value = iMuteWatcher->CurrentValueL();
+            break;
+        case EPbPropertyBalance:
+            //err = iPdPlayer->GetBalance(value);
+            //value=Balance(value);
+            break;
+        case EPbPropertyDuration:
+            {
+            TInt64 duration;
+            iMStreamControl->GetDuration(duration);
+            value = duration / KPbMilliMultiplier;
+            }
+            break;
+        case EPbPropertyPosition:
+            {
+            TInt64 pos;
+            iMStreamControl->GetPosition(pos);
+            value = pos / KPbMilliMultiplier;
+            }
+            break;
+        case EPbPropertySupportedFeatures:
+            value = iFeatureFlag;
+            break;
+        default:
+            isSupported=EFalse;
+        }
+    if (!isSupported)
+        {
+        User::Leave(KErrNotSupported);
+        }
+    iObs->HandleProperty(aProperty,value,err);
+
+    MPX_DEBUG1("CMPXProgressDownloadSB::ValueL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Gets a list of sub players, UPnP only
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::SubPlayerNamesL()
+    {
+    iObs->HandleSubPlayerNames(KProgressDownloadUid, NULL, ETrue, KErrNone);
+    }
+
+// ----------------------------------------------------------------------------
+// Select a sub player
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::SelectSubPlayerL(TInt /*aIndex*/)
+    {
+    User::Leave(KErrNotSupported);
+    }
+
+// ----------------------------------------------------------------------------
+// Returns current sub player name
+// ----------------------------------------------------------------------------
+//
+const TDesC& CMPXProgressDownloadSB::SubPlayerName()
+    {
+    return KNullDesC; //No subplayer name for local playback
+    }
+
+// ----------------------------------------------------------------------------
+// Current sub player index
+// ----------------------------------------------------------------------------
+//
+TInt CMPXProgressDownloadSB::SubPlayerIndex() const
+   {
+   return KErrNotFound;
+   }
+
+// ----------------------------------------------------------------------------
+// Gets media properties
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::MediaL(const TArray<TMPXAttribute>& aAttrs)
+    {
+    MPX_DEBUG1("CMPXProgressDownloadSB::MediaL() entering");
+
+    RArray<TInt> suppIds;
+    CleanupClosePushL(suppIds);
+    suppIds.AppendL(KMPXMediaIdMusic);
+    suppIds.AppendL(KMPXMediaIdGeneral);
+    suppIds.AppendL(KMPXMediaIdAudio);
+    CMPXMedia* media=CMPXMedia::NewL(suppIds.Array());
+    CleanupStack::PopAndDestroy(&suppIds);
+    CleanupStack::PushL(media);
+
+    TUint attrG(0); // General attributes
+    TUint attrA(0); // Audio attributes
+    TUint attrM(0); // Music attributes
+    TUint attrD(0); // DRM attributes
+
+    TInt error(KErrNone);
+
+    for (TInt i=aAttrs.Count(); --i>=0;)
+        {
+        TMPXAttribute attr(aAttrs[i]);
+        if (attr.ContentId() == KMPXMediaIdGeneral)
+            {
+            attrG |= attr.AttributeId();
+            }
+        else if (attr.ContentId() == KMPXMediaIdMusic)
+            {
+            attrM |= attr.AttributeId();
+            }
+        else if (attr.ContentId() == KMPXMediaIdAudio)
+            {
+            attrA |= attr.AttributeId();
+            }
+        else if ( attr.ContentId() == KMPXMediaIdDrm )
+            {
+            attrD |= attr.AttributeId();
+            }
+        }
+
+
+    // Get the mime type
+
+    RApaLsSession aps;
+    error  = aps.Connect(); // always fail in console test
+    if ( KErrNone == error )
+        {
+        CleanupClosePushL(aps);
+        TUid ignore;
+        aps.AppForDocument( iPdPath->Des(), ignore, iMimeType );
+        CleanupStack::PopAndDestroy(&aps);
+        }
+
+    //MPX_DEBUG2("CMPXProgressDownloadSB::MediaL() mime type = %S", iMimeType.Des8().Ptr() );
+
+	if ( iPlaying )
+	{
+
+    CMetaDataUtility *metaDataUtility = CMetaDataUtility::NewL();
+    CleanupStack::PushL( metaDataUtility );
+
+    TInt err = KErrNone;
+    if ( iMimeType.Des8().Length() )
+        {
+        if ( iFileHandle )
+            {
+            TRAP( err, metaDataUtility->OpenFileL( *iFileHandle, iMimeType.Des8() ) );
+            }
+        else
+            {
+            TRAP( err, metaDataUtility->OpenFileL( *iPdPath, iMimeType.Des8() ) );
+            }
+        }
+    else
+        {
+        if ( iFileHandle )
+            {
+            TRAP( err, metaDataUtility->OpenFileL( *iFileHandle ) );
+            }
+        else
+            {
+            TRAP( err, metaDataUtility->OpenFileL( *iPdPath ) );
+            }
+        }
+
+    MPX_DEBUG2("CMPXProgressDownloadSB::MediaL() Metadata utility error = %d", err);
+
+
+    if ( err == KErrNone )
+        {
+        // Get number of metadata
+        TInt count = metaDataUtility->MetaDataCount();
+        for( TInt i = 0; i < count; i++ )
+            {
+            TMetaDataFieldId fieldId;
+
+            TPtrC field = metaDataUtility->MetaDataFieldsL().At( i, fieldId );
+            if( field != KNullDesC )
+                {
+                switch( fieldId )
+                    {
+                    case EMetaDataSongTitle:
+                        {
+                        if ( attrG & EMPXMediaGeneralTitle )
+                            {
+                            media->SetTextValueL(
+                                TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralTitle),
+                                field );
+                            }
+                        break;
+                        }
+                    case EMetaDataArtist:
+                        {
+                        if ( attrM & EMPXMediaMusicArtist )
+                            {
+                            media->SetTextValueL(
+                                TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicArtist),
+                                field );
+                            }
+                        break;
+                        }
+                    case EMetaDataAlbum:
+                        {
+                        if ( attrM & EMPXMediaMusicAlbum )
+                            {
+                            media->SetTextValueL(
+                                TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicAlbum),
+                                field );
+                            }
+                        break;
+                        }
+                    case EMetaDataYear:
+                        {
+                        if ( attrM & EMPXMediaMusicYear )
+                            {
+                            TInt year;
+                            TLex lex( field );
+                            lex.Val( year );
+
+                            TDateTime dt;
+                            dt.SetYear( year );
+                            TTime time( dt );
+
+                            media->SetTObjectValueL(
+                                    TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicYear),
+                                    time.Int64());
+                            }
+                        break;
+                        }
+                    case EMetaDataAlbumTrack:
+                        {
+                        if ( attrM & EMPXMediaMusicAlbumTrack )
+                            {
+                            media->SetTextValueL(
+                                TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicAlbumTrack),
+                                field );
+                            }
+                        break;
+                        }
+                    case EMetaDataGenre:
+                        {
+                        if ( attrM & EMPXMediaMusicGenre )
+                            {
+                            media->SetTextValueL(
+                                TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicGenre),
+                                field );
+                            }
+                        break;
+                        }
+                    case EMetaDataComposer:
+                        {
+                        if ( attrM & EMPXMediaMusicComposer )
+                            {
+                            media->SetTextValueL(
+                                TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicComposer),
+                                field );
+                            }
+                        break;
+                        }
+                    case EMetaDataComment:
+                        {
+                        if ( attrG & EMPXMediaGeneralComment )
+                            {
+                            media->SetTextValueL(
+                                TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralComment),
+                                field );
+                            }
+                        break;
+                        }
+                    case EMetaDataJpeg:
+                        if ( attrM & EMPXMediaMusicAlbumArtFileName )
+                            {
+                            media->SetTextValueL(
+                                TMPXAttribute(KMPXMediaIdMusic,EMPXMediaMusicAlbumArtFileName),
+                                *iPdPath);
+                            }
+                         break;
+                    default:
+                        {
+                        // nothing to do
+                        break;
+                        }
+                    }
+                }
+            }
+        }
+
+    metaDataUtility->ResetL();
+    CleanupStack::PopAndDestroy(metaDataUtility);
+
+	}
+
+
+   if (attrG & EMPXMediaGeneralUri)
+        {
+        media->SetTextValueL(
+            TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralUri),
+            *iPdPath);
+        }
+
+   if (attrG & EMPXMediaGeneralDuration)
+        {
+        TInt64 duration;
+        iMStreamControl->GetDuration(duration);
+        media->SetTObjectValueL<TInt>(
+               TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralDuration),
+               duration/ KPbMilliMultiplier);
+        }
+
+
+    // Set bitrate
+    if (attrA & EMPXMediaAudioBitrate)
+        {
+        TUint bitRate;
+        error = iMAudioProgDLSource->GetBitRate(bitRate);
+
+        if (!error)
+            {
+            media->SetTObjectValueL<TInt>(
+                   TMPXAttribute(KMPXMediaIdAudio, EMPXMediaAudioBitrate),
+                   bitRate);
+            }
+        }
+
+    if (attrA & EMPXMediaAudioSamplerate)
+        {
+        // TODO: How to get sampling rate through ProgDLSource?
+
+        }
+
+   if (attrG & EMPXMediaGeneralSize)
+        {
+        RFs fs;
+        User::LeaveIfError(fs.Connect());
+        CleanupClosePushL(fs);
+        TEntry entry;
+        fs.Entry(iPdPath->Des(), entry);
+        media->SetTObjectValueL<TInt>(
+               TMPXAttribute(KMPXMediaIdGeneral, EMPXMediaGeneralSize),
+               entry.iSize);
+        CleanupStack::PopAndDestroy(&fs);
+        }
+
+   if (attrG & EMPXMediaGeneralMimeType)
+        {
+        if ( iMimeType.Des().Length() )
+            {
+            media->SetTextValueL(
+                TMPXAttribute(KMPXMediaIdGeneral,EMPXMediaGeneralMimeType),
+                iMimeType.Des());
+            }
+
+        }
+
+    // Set DRM info
+    // Only try to get DRM info if the song has completed downloading
+    if ( EPbDlStateDownloadCompleted == iDownloadState )
+        {
+        const CMPXMedia* drmMedia( iDrmMediaUtility->GetMediaL( attrD ));
+        if ( drmMedia )
+            {
+            TInt count( drmMedia->Count() );
+            for ( TInt i = 0; i < count; i++ )
+                {
+                TUint attrId( drmMedia->Attribute(i).AttributeId() );
+                if ( attrD & attrId )
+                    {
+                    TMPXAttribute mpxAtt( KMPXMediaIdDrm, attrId );
+                    switch ( attrId )
+                        {
+                        case EMPXMediaDrmType:
+                        case EMPXMediaDrmRightsStatus:
+                        case EMPXMediaDrmRightsType:
+                        case EMPXMediaDrmCount:
+                            {
+                            TInt val(
+                                *drmMedia->Value<TInt>( mpxAtt ));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        case EMPXMediaDrmProtected:
+                        case EMPXMediaDrmSendingAllowed:
+                        case EMPXMediaDrmCanSetAutomated:
+                        case EMPXMediaDrmHasInfoUrl:
+                        case EMPXMediaDrmHasPreviewUrl:
+                        case EMPXMediaDrmAboutToExpire:
+                            {
+                            TBool val(
+                                *drmMedia->Value<TBool>( mpxAtt ));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        case EMPXMediaDrmStartTime:
+                        case EMPXMediaDrmEndTime:
+                        case EMPXMediaDrmIntervalStartTime:
+                        case EMPXMediaDrmAccumulatedTime:
+                            {
+                            TInt64 val(
+                                *drmMedia->Value<TInt64>( mpxAtt ));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        case EMPXMediaDrmInterval:
+                            {
+                            TTimeIntervalSeconds val(
+                                *drmMedia->Value<TTimeIntervalSeconds>(mpxAtt));
+                            media->SetTObjectValueL( mpxAtt, val );
+                            break;
+                            }
+                        default:
+                            {
+                            break;
+                            }
+                        }   // end switch (attriId)
+                    }   // end if ( attrD & attrId )
+                }
+            }
+        }
+
+    iObs->HandleMedia(*media, KErrNone);
+    CleanupStack::PopAndDestroy(media);
+
+    MPX_DEBUG1("CMPXProgressDownloadSB::MediaL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Cancel request
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::CancelRequest()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXProgressDownloadSB::Event
+// -----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::Event(
+    MControl* aControl,
+    TUint aEventType,
+    TAny* aEventObject )
+    {
+
+    MPX_DEBUG1("CMPXProgressDownloadSB::Event() entering");
+
+    if (( aControl == NULL) || (aEventObject == NULL ))
+        {
+        MPX_DEBUG3("CMPXProgressDownloadSB::Event() Error: aControl=%x aEventObject=%x", aControl, aEventObject);
+        }
+
+
+    switch ( aEventType )
+        {
+        case MStreamControlObserver::KStateChangedEvent:
+            {
+            MStreamControl* control1 = (MStreamControl*)(aControl);
+            MPX_DEBUG2("CMPXProgressDownloadSB::Event:EStateChanged[%d]",control1->GetState());
+
+            MStateChangedEvent* event = (MStateChangedEvent*)aEventObject;
+            switch( event->GetState())
+                {
+                case MStreamControl::INITIALIZED:
+                    MPX_DEBUG1("CMPXProgressDownloadSB::Event:EStateChanged[INITIALIZED]");
+                    if( event->GetErrorCode() == KErrNone && iState == EStateInitialising )
+                        {
+                        delete iDrmCustomCommand;
+                        iDrmCustomCommand = NULL;
+                        iDrmCustomCommand = (RMMFDRMCustomCommands*)iMStreamControl->CustomInterface(KUidInterfaceMMFDRMControl);
+
+                        if ( iDrmCustomCommand )
+                            {
+                            TInt drmCCErr = iDrmCustomCommand->DisableAutomaticIntent(ETrue);
+                            // TODO:
+                            // for wmdrm pdl, we need to let helix consume rights.
+                            // by calling ExecuteIntent() when playback completes.
+                            }
+                        iState = EStateInitialised;
+                        // Restore volume level
+                        TInt currentVol( 0 );
+                        MPX_TRAPD( volError, currentVol = iVolumeWatcher->CurrentValueL() );
+                        if ( volError == KErrNone )
+                            {
+                            SetVolume( currentVol );
+                            TBool mute( EFalse);
+                            MPX_TRAPD( muteError, mute = iMuteWatcher->CurrentValueL() );
+                            if ( muteError == KErrNone && mute )
+                                {
+                                SetMute(mute);
+                                }
+                            }
+                        iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPActive, ETrue, event->GetErrorCode());
+                        iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPaused, 0, event->GetErrorCode());
+                        }
+                    else if ( event->GetErrorCode() == KErrEof ) // Playback Complete
+                        {
+                        MPX_DEBUG2("CMPXProgressDownloadSB::Event:EStateChanged[PlaybackComplete] errorcode=%d",event->GetErrorCode());
+                        if ( iDownloadState == EPbDlStateDownloadCompleted && !iFileSaved )
+                            {
+                            if ( event->GetErrorCode() == KErrEof )
+                                {
+                                ConsumeRights( ContentAccess::EStop );
+                                }
+                            else
+                                {
+                                ConsumeRights( ContentAccess::EPause );
+                                }
+                            MoveDownloadedFileToMusicFolderL();
+                            }
+                        }
+                    else if ( event->GetErrorCode() == KErrDied || event->GetErrorCode() == KErrInUse ||
+                            event->GetErrorCode() == KErrAccessDenied )
+                        {
+                        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPaused,
+                                                 0, event->GetErrorCode() );
+                        }
+                    else
+                        {
+                        //Todo: Error cases such as no rights to play.
+                        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPlayComplete, 0, event->GetErrorCode());
+                        }
+                    break;
+                case MStreamControl::CLOSED:
+                    MPX_DEBUG1("CMPXProgressDownloadSB::Event:EStateChanged[Closed]");
+           //         if ( iDownloadState == EPbDlStateDownloadCompleted )
+           //             {
+           //             MoveDownloadedFileToMusicFolderL();	//The file should be moved somewhere else.
+           //             }
+                    iErrorOfStreamClosedEvent = event->GetErrorCode();
+                    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPClosed, 0, event->GetErrorCode() );
+                    break;
+                case MStreamControl::PRIMED:
+                    MPX_DEBUG1("CMPXProgressDownloadSB::Event:EStateChanged[Primed]");
+                    TInt64 duration;
+                    if (iMStreamControl->GetDuration(duration) != KErrUnknown )
+                        {
+                        MPX_DEBUG2("CMPXProgressDownloadSB::Event:KDurationChangedEvent Duration = %d", I64INT(duration));
+                        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDurationChanged, duration / KPbMilliMultiplier, KErrNone);
+                        }
+                    break;
+                case MStreamControl::EXECUTING://Playing
+                    {
+                    MPX_DEBUG1("CMPXProgressDownloadSB::Event:EStateChanged[Playing]");
+                    iStreamBuffering = EFalse;
+                    iPlaying = ETrue;
+                 // Send the Started-message here since View may not have been initialized earlier.
+                	TUint expectedFileSize = 0;
+                	iMAudioProgDLSource->GetExpectedFileSize(expectedFileSize);
+                	iDownloadSize = expectedFileSize;
+                	iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadStarted,
+                	                         iDownloadSize,
+                	                         KErrNone );
+
+                    if ( iDownloadState == EPbDlStateBuffering )
+                        {
+                        iDownloadState = EPbDlStateDownloading;
+                        iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPDownloadStateChanged, iDownloadState, KErrNone);
+                        }
+                    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPlaying, 0, event->GetErrorCode());
+                    TInt64 duration;
+                    if (iMStreamControl->GetDuration(duration) != KErrUnknown )
+                        {
+                        MPX_DEBUG2("CMPXProgressDownloadSB::Event:EStateChanged Duration = %d", I64INT(duration));
+                        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDurationChanged, duration / KPbMilliMultiplier, KErrNone);
+                        }
+                    }
+                    break;
+                case MStreamControl::BUFFERING:
+                    MPX_DEBUG2("CMPXProgressDownloadSB::Event:EStateChanged[Buffering] errorcode= %d",event->GetErrorCode());
+                    iStreamBuffering = ETrue;
+                    if ( iDownloadState != EPbDlStateDownloadPaused ||
+                         iDownloadState != EPbDlStateDownloadCanceled ||
+                         iDownloadState != EPbDlStateDownloadError ||
+                         iDownloadState != EPbDlStateNotDownloading
+                         )
+                        {
+                        iDownloadState = EPbDlStateBuffering;
+                        }
+                    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPaused, 0, event->GetErrorCode());
+                    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPDownloadStateChanged, iDownloadState, KErrNone);
+                    break;
+                case MStreamControl::PAUSED:
+                    MPX_DEBUG1("CMPXProgressDownloadSB::Event:EStateChanged[Paused]");
+                    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPPaused, 0, event->GetErrorCode());
+                    break;
+                default:
+                    break;
+                }
+            }
+            break;
+
+        case MStreamControlObserver::KDurationChangedEvent:
+            MPX_DEBUG1("CMPXProgressDownloadSB::Event:KDurationChangedEvent");
+            TInt64 duration;
+            if (iMStreamControl->GetDuration(duration) != KErrUnknown )
+                {
+                MPX_DEBUG2("CMPXProgressDownloadSB::Event:KDurationChangedEvent Duration = %d", I64INT(duration));
+                iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDurationChanged, duration / KPbMilliMultiplier, KErrNone);
+                }
+            break;
+
+        case MSourceControlObserver::KDownloadStatusChangedEvent:
+            {
+            MProgDLSource* control1 = (MProgDLSource*)(aControl);
+            MPX_DEBUG2("CMPXProgressDownloadSB::Event:DownloadStatus[%d]",control1->GetDownloadStatus());
+            switch ( control1->GetDownloadStatus() )
+                {
+
+                case MProgDLSource::EConnecting:
+                    MPX_DEBUG1("CMPXProgressDownloadSB::Event:DownloadStatus [connecting]");
+                    break;
+
+                case MProgDLSource::EStarted:
+                    {
+                    MPX_DEBUG1("CMPXProgressDownloadSB::Event:DownloadStatus [started]");
+                    iDownloadState = EPbDlStateDownloading;
+                    iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadStateChanged,
+                                             iDownloadState,
+                                             KErrNone);
+
+                    TUint expectedFileSize = 0;
+                    iMAudioProgDLSource->GetExpectedFileSize(expectedFileSize);
+                    iDownloadSize = expectedFileSize;
+                    iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadStarted,
+                                             iDownloadSize,
+                                             KErrNone );
+                    }
+                    break;
+
+                case MProgDLSource::EPaused:
+                    {
+                    MPX_DEBUG1("CMPXProgressDownloadSB::Event:DownloadStatus [paused]");
+                    iDownloadState = EPbDlStateDownloadPaused;
+                    iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadStateChanged,
+                                             iDownloadState,
+                                             KErrNone);
+
+                    }
+                    break;
+
+                case MProgDLSource::EDeleted: 	//download has been canceled from Browser
+                    {							//or Browser has Exited
+                    MPX_DEBUG1("CMPXProgressDownloadSB::Event:DownloadStatus [deleted]");
+
+                    iMStreamControl->Stop();
+                    iMStreamControl->Close();
+                    iDrmMediaUtility->Close();
+                    //Stop the play
+                    iObs->HandlePluginEvent(MMPXPlaybackPluginObserver::EPStopped,
+                                             0, KErrNone);
+                    iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPlayComplete, 0, KErrNone);
+                    if (!iOngoingCmdCancelDownload) // when Dl was canceled by browser
+                        {
+                        iObs->HandlePluginEvent(
+                                MMPXPlaybackPluginObserver::EPDownloadCmdCancelDownload,
+                                iTransactionId,
+                                KErrNone);
+                        }
+                    break;                    
+                    }
+                case MProgDLSource::ECompleted:
+                    {
+                    MPX_DEBUG1("CMPXProgressDownloadSB::Event:DownloadStatus [completed]");
+                    iDownloadState = EPbDlStateDownloadCompleted;
+
+                    // and notify playback engine of the change.
+                    iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadPositionChanged,
+                                             iDownloadSize,
+                                             KErrNone);
+
+                    if ((iState == EStateNotInitialised || 
+                        (iState == EStateInitialising && iErrorOfStreamClosedEvent == KErrCANoRights)) 
+                        && !iFileSaved )
+                         {
+                         MoveDownloadedFileToMusicFolderL();
+                         }
+                     iErrorOfStreamClosedEvent = KErrNone ;
+
+
+                    iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadStateChanged,
+                                             iDownloadState,
+                                             KErrNone);
+                    }
+                    break;
+                case MProgDLSource::EFailed:
+                case MProgDLSource::EUnknown:
+                    MPX_DEBUG1("CMPXProgressDownloadSB::Event:DownloadStatus [failed]");
+                    iDownloadState = EPbDlStateDownloadError;
+                    iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadStateChanged,
+                                             iDownloadState,
+                                             KErrNone);
+                    break;
+                default:
+                  break;
+                }
+            }
+            break;
+
+        case MSourceControlObserver::KFileMoveCompleteEvent:
+            {
+            MPX_DEBUG1("CMPXProgressDownloadSB::Event:KFileMoveCompleteEvent");
+
+            MErrorCode* errorObj = (MErrorCode*)aEventObject;
+            TInt fileMoveError = errorObj->GetErrorCode();
+
+            if ( !fileMoveError )
+                {
+                delete iPdPath;
+                iPdPath = NULL;
+                iPdPath = iMovedFileName.AllocL();
+                iFileSaved = ETrue;
+                }
+            else
+                {
+                // TODO: If file is renamed, we need to get the new path.
+                if( fileMoveError == KErrAlreadyExists )
+                    {
+                    TPtr ptr( NULL, 0 );
+                    iMAudioProgDLSource->FileName( ptr );
+                    delete iPdPath;
+                    iPdPath = NULL;
+                    iPdPath = ptr.AllocL();
+                    iFileSaved = ETrue;
+                    }
+                }
+
+            TRAP_IGNORE( iDrmMediaUtility->InitL( *iPdPath ));
+            iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPPlayComplete, 0, KErrNone);
+
+            if ( !fileMoveError || fileMoveError == KErrAlreadyExists )
+                {
+                iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadFileMoved, (TInt)iPdPath, KErrNone);
+                }
+            break;
+            }
+        case MSourceControlObserver::KPercentageDownloadedChangedEvent:
+            {
+            MPX_DEBUG1("CMPXProgressDownloadSB::Event:KPercentageDownloadedChangedEvent");
+
+            if (iDownloadState == EPbDlStateDownloadPaused)
+                {
+                iDownloadState = EPbDlStateBuffering;
+                }
+
+            // update current file size
+            TUint currentFileSize = 0;
+            TUint expectedFileSize = 0;
+
+            iMAudioProgDLSource->GetCurrentFileSize(currentFileSize);
+            iMAudioProgDLSource->GetExpectedFileSize(expectedFileSize);
+            iDownloadBytes = currentFileSize;
+            if (expectedFileSize != iDownloadSize)
+            	{
+                iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadingUpdated,
+                                         expectedFileSize,
+                                         KErrNone);            	
+            	}
+            iDownloadSize = expectedFileSize;
+
+            // and notify playback engine of the change.
+            iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPDownloadPositionChanged,
+                                     iDownloadBytes,
+                                     KErrNone);
+
+            }
+            break;
+
+        default:
+            break;
+        }//end switch (aEventType)
+    MPX_DEBUG1("CMPXProgressDownloadSB::Event() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Handle a change in a setting value.
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::HandleSettingChange(
+    const TUid& aRepositoryUid,
+    TUint32 aSettingId )
+    {
+    MPX_DEBUG1("CMPXProgressDownloadSB::HandleSettingChange() entering");
+
+    if ( KCRUidMPXSettings == aRepositoryUid &&
+         KMPXPlaybackVolume == aSettingId )
+        {
+        MPX_DEBUG1("CMPXProgressDownloadSB::HandleSettingChange() Volume setting changed");
+        TInt vol( 0 );
+        MPX_TRAPD( error, vol = iVolumeWatcher->CurrentValueL() );
+        if ( error == KErrNone )
+            {
+            SetVolume( vol );
+            }
+        }
+    else if ( KCRUidMPXSettings == aRepositoryUid &&
+         KMPXPlaybackMute == aSettingId )
+        {
+        MPX_DEBUG1("CMPXProgressDownloadSB::HandleSettingChange() Mute setting changed");
+        TBool mute( EFalse );
+        MPX_TRAPD( error, mute = static_cast<TBool>(iMuteWatcher->CurrentValueL()) );
+        if ( error == KErrNone )
+            {
+            TInt oldVolume( 0 );
+            iMVolumeControl->GetVolume( oldVolume );
+            if ( (mute && oldVolume != 0) || (!mute && oldVolume == 0) )
+                {
+                SetMute( mute );
+                }
+            }
+        }
+    MPX_DEBUG1("CMPXProgressDownloadSB::HandleSettingChange() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the volume level in audio controller
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::SetVolume( TInt aVolume )
+    {
+    MPX_DEBUG2("CMPXProgressDownloadSB::SetVolume(%d) entering", aVolume);
+
+    // Ensure that level is within min and max values
+    if ( aVolume > KPbPlaybackVolumeLevelMax )
+        {
+        aVolume = KPbPlaybackVolumeLevelMax;
+        }
+    if ( aVolume < KPbPlaybackVolumeLevelMin )
+        {
+        aVolume = KPbPlaybackVolumeLevelMin;
+        }
+
+    TBool changed( EFalse );
+    // Change MMF Audio player's volume
+    if ( EStateInitialised == iState )
+        {
+        TInt maxVolume(0);
+        iMVolumeControl->GetMaxVolume(maxVolume);
+        TInt newVolume( aVolume * maxVolume / 100 );
+        MPX_DEBUG2("CMPXProgressDownloadSB::SetVolume(): Setting volume = %d", newVolume);
+
+        // First check if MMF Audio player's volume is changed by new value
+        TInt oldVolume( 0 );
+        iMVolumeControl->GetVolume( oldVolume );
+        if ( newVolume != oldVolume )
+            {
+            iMVolumeControl->SetVolume( newVolume );
+            iMVolumeControl->Apply();
+            changed = ETrue;
+            }
+        }
+
+    // Change setting in cenrep
+    if ( aVolume != iVolumeWatcher->CurrentValueL() )
+        {
+        iVolumeWatcher->SetValueL( aVolume );
+        }
+
+    // Notify observer if value changed
+    if ( changed )
+        {
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPVolumeChanged,
+                                 aVolume,
+                                 KErrNone);
+        }
+
+    MPX_DEBUG1("CMPXProgressDownloadSB::SetVolume() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Sets the volume level in audio controller
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::SetMute( TBool aMute )
+    {
+    MPX_DEBUG3("-->CMPXProgressDownloadSB::SetMute 0x%08x vol (%d)", this, aMute);
+
+    TBool changed( EFalse );
+    // Change MMF Audio player's volume
+    TInt currentVolume(0);
+    iMVolumeControl->GetVolume(currentVolume);
+    if ( aMute && currentVolume != 0 )
+        {
+        iVolume = currentVolume;
+        TInt vol = 0;
+        iMVolumeControl->SetVolume(vol);
+        iMVolumeControl->Apply();
+        changed = ETrue;
+        }
+    else if ( !aMute && currentVolume == 0 )      // UnMute
+        {
+        iMVolumeControl->SetVolume(iVolume);
+        iMVolumeControl->Apply();
+        changed = ETrue;
+        }
+
+    // Change setting in cenrep
+    TBool currentMute( EFalse );
+    MPX_TRAPD( muteError, currentMute = iMuteWatcher->CurrentValueL() );
+    if ( muteError == KErrNone )
+        {
+        if ( aMute && !currentMute )
+            {
+            MPX_TRAP( muteError, iMuteWatcher->SetValueL( aMute ) );
+            }
+        else if ( !aMute && currentMute )
+            {
+            MPX_TRAP( muteError, iMuteWatcher->SetValueL( aMute ) );
+            }
+        }
+
+    // Notify observer if value changed
+    if ( changed )
+        {
+        iObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPMuteChanged,
+                                 aMute,
+                                 KErrNone);
+        }
+
+    MPX_DEBUG3("<--CMPXProgressDownloadSB::SetMute 0x%08x vol (%d)", this, aMute);
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXProgressDownloadSB::MoveDownloadedFileToMusicFolderL
+// -----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::MoveDownloadedFileToMusicFolderL()
+    {
+    if ( iFileSaved || ( (*iPdPath).Length() == 0 ) )
+        {
+        return;
+        }
+
+    MPX_DEBUG1("CMPXProgressDownloadSB::MoveDownloadedFileToMusicFolderL() entering");
+    TParse parse;
+    parse.Set(*iPdPath,NULL,NULL);
+    TPtrC drive = parse.Drive();
+
+    iMovedFileName.Copy(drive);
+    iMovedFileName.Append(_L("\\Data\\") );
+    iMovedFileName.Append(_L("Download\\") );
+    iFs.MkDirAll(iMovedFileName);
+    iMovedFileName.Append(parse.NameAndExt() );
+    TInt error = iMAudioProgDLSource->MoveFile(iMovedFileName);
+
+    if ( !error )
+        {
+        iFileSaved = ETrue;
+        }
+
+    MPX_DEBUG1("CMPXProgressDownloadSB::MoveDownloadedFileToMusicFolderL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Consumes the rights for the current media
+// ----------------------------------------------------------------------------
+//
+void CMPXProgressDownloadSB::ConsumeRights(
+    ContentAccess::TIntent aIntent )
+    {
+    MPX_DEBUG2("-->CMPXProgressDownloadSB::ConsumeRights(%d)", aIntent);
+    if ( iDrmCustomCommand )
+        {
+        switch ( aIntent )
+            {
+            case ContentAccess::EPlay:
+            case ContentAccess::EStop:
+            case ContentAccess::EPause:
+            case ContentAccess::EContinue:
+                {
+                break;
+                }
+            default:
+                {
+                aIntent = ContentAccess::EUnknown;
+                iConsumeStarted = EFalse;
+                break;
+                }
+            }
+        MPX_DEBUG2("-->CMPXProgressDownloadSB::ConsumeRights(): Executing intent %d", aIntent);
+        iDrmCustomCommand->ExecuteIntent(aIntent);
+        }
+    MPX_DEBUG2("<--CMPXProgressDownloadSB::ConsumeRights(%d)", aIntent);
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/progressdownloadsb/src/mpxprogressdownloadsbproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+#include <ecom/implementationproxy.h>
+#include "mpxprogressdownloadsb.h"
+
+
+#if (!defined IMPLEMENTATION_PROXY_ENTRY)
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY(aUid,aFuncPtr) {{aUid},(TProxyNewLPtr)(aFuncPtr)}
+#endif
+
+// ----------------------------------------------------------------------------
+// The list of implementations
+// ----------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    { IMPLEMENTATION_PROXY_ENTRY(0x10207BCD, CMPXProgressDownloadSB::NewL) };
+
+// ----------------------------------------------------------------------------
+// The proxy of implementations
+// ----------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/rom/mpxaudioeffects.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxaudioeffectengine
+*
+*/
+
+
+#ifndef MPXAUDIOEFFECTS_IBY
+#define MPXAUDIOEFFECTS_IBY
+
+file=ABI_DIR\BUILD_DIR\mpxaudioeffectengine.dll SHARED_LIB_DIR\mpxaudioeffectengine.dll
+
+#endif  // MPXAUDIOEFFECTS_IBY
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/rom/mpxlocalaudioplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for local audio plugin
+*
+*/
+
+#ifndef MPXLOCALAUDIOPLUGIN_IBY
+#define MPXLOCALAUDIOPLUGIN_IBY
+
+#include <bldvariant.hrh>
+
+ECOM_PLUGIN(mpxlocalaudioplayback.dll,101FFC04.rsc)
+
+#endif // MPXLOCALAUDIOPLUGIN_IBY
+
+//  End of File  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/rom/mpxprogressdownloadplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for progressive download plugin
+*
+*/
+
+#ifndef MPXPROGRESSDOWNPLUGIN_IBY
+#define MPXPROGRESSDOWNPLUGIN_IBY
+
+#include <bldvariant.hrh>
+
+ECOM_PLUGIN(mpxprogressdownload.dll,101FFC08.rsc)
+
+#endif // MPXPROGRESSDOWNPLUGIN_IBY
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playbackplugins/rom/mpxprogressdownloadsbplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for progressive download plugin for standalone browser 
+*
+*/
+
+#ifndef MPXPROGRESSDOWNSBPLUGIN_IBY
+#define MPXPROGRESSDOWNSBPLUGIN_IBY
+
+#include <bldvariant.hrh>
+
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+ECOM_PLUGIN(mpxprogressdownloadsb.dll, mpxprogressdownloadsb.rsc)
+#endif
+
+#endif // MPXPROGRESSDOWNSBPLUGIN_IBY
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for playlist plugins.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../m3uplaylistplugin/group/bld.inf"
+
+PRJ_EXPORTS
+../rom/mpxm3uplaylistplugin.iby          CORE_APP_LAYER_IBY_EXPORT_PATH(mpxm3uplaylistplugin.iby)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/inc/mpxm3uplaylistexporter.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,193 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Exports a m3u playlist file
+*
+*/
+
+
+#ifndef MPXM3UPLAYLISTEXPORTER_H
+#define MPXM3UPLAYLISTEXPORTER_H
+
+#include <f32file.h>
+#include <mpxplaylistpluginobserver.h>
+
+/**
+*  CMPXM3uPlaylistExporter exports a m3u playlist file. Each instance can
+*  only handle the export of one m3u file and the processing starts as
+*  soon as the object is instantiated.
+*
+*  When processing is complete, CMPXM3uPlaylistExporter will invoke
+*  callback through MMPXPlaylistPluginObserver interface. Once completed,
+*  the exporting service cannot be restarted. A new instance is required
+*  if the client wishes to export another m3u playlist file.
+*/
+class CMPXM3uPlaylistExporter : public CActive
+    {
+public: // Constructors and destructor
+    
+    /**
+    * Two-phased constructor
+    *
+    * @param aFs a file session handle
+    * @param aObserver reference to the playlist plugin observer
+    * @param aPlaylist playlist to be externalized
+    * @param aFilePath File path for where the playlist should be placed
+    * @param aStatus caller's request status
+    * @return object of constructed
+    */
+    IMPORT_C static CMPXM3uPlaylistExporter* NewL(
+        RFs* aFs,
+        MMPXPlaylistPluginObserver* aObserver,
+        const CMPXMedia& aPlaylist,
+        const TDesC& aFilePath,
+        TRequestStatus& aStatus );
+
+    /**
+    * Destructor
+    */
+    IMPORT_C virtual ~CMPXM3uPlaylistExporter();
+
+    
+protected:
+
+    /**
+    * Constructor
+    *
+    * @param aFs a file session handle
+    * @param aObserver reference to the playlist plugin observer
+    * @param aPlaylist playlist to be externalized
+    * @param aStatus caller's request status
+    * @return object of constructed    
+    */
+    IMPORT_C CMPXM3uPlaylistExporter(
+        RFs* aFs,
+        MMPXPlaylistPluginObserver* aObserver,
+        const CMPXMedia& aPlaylist,
+        TRequestStatus& aStatus );
+    
+    /**
+    * 2nd phase constructor
+    *
+    * @param aFilePath File path for where the playlist should be placed
+    */
+    IMPORT_C virtual void ConstructL(
+        const TDesC& aFilePath);    
+   
+    /**
+    *  From CActive
+    *  Handles an active object's request completion event
+    */
+    IMPORT_C virtual void RunL();
+
+    /**
+    * From CActive
+    * Implements cancellation of an outstanding request.
+    */
+    IMPORT_C virtual void DoCancel();
+
+    /**
+    * Does a step of the task
+    */
+    IMPORT_C virtual void DoTaskStep();
+    
+private:
+
+    /**
+    * externalize a set number of the medias. This will be called until all
+    * the given medias have been processed
+    */
+    void ExternalizeL();
+    
+    /**
+    * Populates iLines with HBufC8's each representing one line of playlist
+    * file.
+    */
+    void PopulateLineArrayL();
+
+    /**
+    * Converts iLine to 8-bit ASCII and places it to iLines array.
+    */
+    void AddLineToArrayL();
+
+    /**
+    * Creates a header string, which tells that the playlist is in the
+    * extented m3u format, and stores it to iLine.
+    */
+    void CreateHeaderLineL();
+
+    /**
+    * If media has title defined, creates extented info tag containing
+    * audio clip length and title. Info tag is stored to iLine.
+    */
+    void CreateExtentedInfoLineL(
+            const CMPXMedia& aMedia);
+
+    /**
+    * Creates a string containing iItem's relative or absolute path (path
+    * is relative if the audio clip is stored to the same directory, or 
+    * it's sub-directories, as the playlist file). The stirng is stored to
+    * iLine.
+    */
+    void CreatePathLineL(
+            const CMPXMedia& aMedia,
+            const TDesC& aCurrentFolder,
+            TBool aAddNewLine);
+
+    /**
+    * Caluculates the length of the final playlist file, creates new buffer
+    * with that length, and appends all lines from iLines to it and frees
+    * iLines
+    */
+    void FlushLineArrayToBufferL();
+
+    /**
+    * Writes playlist data from buffer to a file.
+    */
+    void WritePlaylistToFileL();
+
+    /**
+    * Reset data members after processing the current request.
+    */
+    void Cleanup();
+
+    /**
+    * Notify client of the specified error through MMPXPlaylistPluginObserver
+    * interface
+    */
+    void NotifyClient(TInt aError);
+         
+protected:    // Data
+
+    const CMPXMedia&                    iPlaylist;
+    CMPXMediaArray*                     iMedias;
+    HBufC*                              iPlaylistFilePath;
+    TInt                                iDriveNumber;
+    TBool                               iPlaylistFileCreated;
+
+    HBufC8*                             iPlaylistBuf;
+    RPointerArray<HBufC8>               iLines;
+    HBufC*                              iLine;
+
+    RFs*                                iFs;       // not owned
+    MMPXPlaylistPluginObserver*         iObserver; // not owned
+    
+    TInt                                iCurrentMedia;
+    TBool                               iMoreToDo;
+
+    TRequestStatus*                     iCallerStatus;    
+    };
+
+#endif   // MPXM3UPLAYLISTIMPORTER_H
+            
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/inc/mpxm3uplaylistimporter.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,234 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Imports a m3u playlist file
+*
+*/
+
+
+#ifndef MPXM3UPLAYLISTIMPORTER_H
+#define MPXM3UPLAYLISTIMPORTER_H
+
+#include <mpxplaylistpluginobserver.h>
+#include <f32file.h>
+#include <charconv.h>
+
+
+class CMPXMediaArray;
+
+/**
+*  CMPXM3uPlaylistImporter imports a m3u playlist file. Each instance can
+*  only handle the import of one m3u file and the processing starts as
+*  soon as the object is instantiated.
+*
+*  When processing is complete, CMPXM3uPlaylistImporter will invoke
+*  callback through MMPXPlaylistPluginObserver interface. Once completed,
+*  the importing service cannot be restarted. A new instance is required
+*  if the client wishes to import another m3u playlist file.
+*/
+class CMPXM3uPlaylistImporter : public CActive
+    {
+public: // Constructors and destructor
+    
+    /**
+    * Two-phased constructor
+    *
+    * @param aFs a file session handle
+    * @param aObserver reference to the playlist plugin observer
+    * @param aPlaylistUri URI of the playlist file to be internalized
+    * @param aTopCharacterSet top character set for the current locale
+    * @param aAvailableCharacterSet available character set in the system
+    * @param aStatus caller's request status
+    * @return object of constructed
+    */
+    IMPORT_C static CMPXM3uPlaylistImporter* NewL(
+                RFs* aFs,
+                MMPXPlaylistPluginObserver* aObserver,
+                const TDesC& aPlaylistUri,
+                const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aTopCharacterSet,
+                const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aAvailableCharacterSet,
+                TRequestStatus& aStatus );
+
+    /**
+    * Destructor
+    */
+    IMPORT_C virtual ~CMPXM3uPlaylistImporter();
+    
+protected:
+
+    /**
+    * Constructor
+    *
+    * @param aFs a file session handle
+    * @param aObserver reference to the playlist plugin observer
+    * @param aTopCharacterSet top character set for the current locale
+    * @param aAvailableCharacterSet available character set in the system
+    * @param aStatus caller's request status
+    */
+    IMPORT_C CMPXM3uPlaylistImporter(
+                RFs* aFs,
+                MMPXPlaylistPluginObserver* aObserver,
+                const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aTopCharacterSet,
+                const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aAvailableCharacterSet,
+                TRequestStatus& aStatus );
+    
+    /**
+    * 2nd phase constructor
+    *
+    * @param aPlaylistUri URI of the playlist file to be internalized
+    */
+    IMPORT_C virtual void ConstructL( const TDesC& aPlaylistUri );
+   
+    /**
+    *  From CActive
+    *  Handles an active object's request completion event
+    */
+    IMPORT_C virtual void RunL();
+
+    /**
+    * From CActive
+    * Implements cancellation of an outstanding request.
+    */
+    IMPORT_C virtual void DoCancel();
+
+    /**
+    * Does a step of the task
+    */
+    IMPORT_C virtual void DoTaskStep();
+    
+    /**
+    * Does a step of the task, leave if there is an error
+    */
+    IMPORT_C virtual void DoTaskStepL();
+
+private:
+
+    /**
+    * Reads data from playlist file to the buffer
+    */
+    void ReadPlaylistFileToBufferL();
+    
+    /**
+    * Auto detects the character encoding from the supplied character
+    * set
+    * @param aSample a sample of the file
+    * @param aCharSetId auto-detected character set for the supplied
+    *        sample
+    * @param aCharacterSet a character set to detect the encoding from
+    * @return KErrNone if a character set is found; otherwise
+    *         KErrNotFound.
+    */
+    TInt DetectCharacterSetL(
+        const TDesC8& aSample,
+        const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aCharacterSet,
+        TUint& aCharSetId);
+    
+    /**
+    * Parses the buffer where playlist file was read to.
+    */
+    void ParsePlaylistBufferL(
+            CMPXMediaArray& aPlaylist,
+            TInt& aInvalidItemCount);
+
+    /**
+    * Reads next line from iBuffer and stores it to iLine. Returns EFalse
+    * if there are no more new lines.
+    */
+    TBool ReadNextLineL();
+
+    /**
+    * Decides what to do with an iLine read from iBuffer
+    */
+    void ProcessLineL(
+            CMPXMediaArray& aPlaylist,
+            TInt& aInvalidItemCount);
+
+    /**
+    * Parses path or extended info from an iLine and stores them to iItem
+    */
+    TInt ParseLineL(
+            CMPXMedia* aItem,
+            TInt& aInvalidItemCount);
+
+    /**
+    * Parses and returns an absolute path if aPath is relative to playlist
+    * file's path. If path is not valid or it doesn't exist, error code is
+    * returned in aError.
+    *
+    * caller assumes ownership of the returned HBufC
+    */
+    HBufC* ParseAbsolutePathLC(
+            const TDesC& aPath,
+            TInt& aError);
+
+    /**
+    * compose CMPXMedia to be sent back to the client
+    */
+    void ComposePlaylistL();
+    
+    /**
+    * Reset data members for after completing the current request
+    */
+    void Cleanup();
+    
+    /**
+    * Notify client of the specified error through MMPXPlaylistPluginObserver
+    * interface
+    */
+    void NotifyClient(TInt aError);
+
+protected:
+
+    enum TMPXM3UImporterState
+        {
+        EMPXM3UReadBufferWithAutoDetectEncoding,
+        EMPXM3UParseWithAutoDetectEncoding,
+        EMPXM3UComposePlaylistMedia
+        };
+                         
+protected:    // Data
+
+    HBufC*                              iBuffer;
+    TPtrC                               iBufferPtr;
+
+    TPtrC                               iPlaylistFilePath;
+
+    HBufC*                              iLine;
+
+    RFs*                                iFs;      // not owned
+    MMPXPlaylistPluginObserver*         iObserver;// not owned
+    
+    TBool                               iExtendedFormat;
+    
+    TRequestStatus*                     iCallerStatus;
+
+    TInt                                iEndLineNumber;  
+    TInt                                iCurrentLineNumber;
+    TBool                               iMoreToDo;
+    TBool                               iEndOfFile;
+    CMPXMedia*                          iItem;
+
+    CMPXMediaArray*                     iAutoEncodingPlaylistArray;
+    TInt                                iAutoEncodingInvalidItems;
+    
+    CMPXMedia*                          iPlaylist;
+    
+    TMPXM3UImporterState                iState;
+    
+    const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>&     iTopCharacterSet;
+    const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>&     iAvailableCharacterSet;
+    };
+
+#endif   // MPXM3UPLAYLISTIMPORTER_H
+            
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/BWINS/mpxm3uplaylistparsersU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,17 @@
+EXPORTS
+	??0CMPXM3uPlaylistExporter@@IAE@PAVRFs@@PAVMMPXPlaylistPluginObserver@@ABVCMPXMedia@@AAVTRequestStatus@@@Z @ 1 NONAME ; CMPXM3uPlaylistExporter::CMPXM3uPlaylistExporter(class RFs *, class MMPXPlaylistPluginObserver *, class CMPXMedia const &, class TRequestStatus &)
+	??0CMPXM3uPlaylistImporter@@IAE@PAVRFs@@PAVMMPXPlaylistPluginObserver@@ABV?$CArrayFix@USCharacterSet@CCnvCharacterSetConverter@@@@2AAVTRequestStatus@@@Z @ 2 NONAME ; CMPXM3uPlaylistImporter::CMPXM3uPlaylistImporter(class RFs *, class MMPXPlaylistPluginObserver *, class CArrayFix<struct CCnvCharacterSetConverter::SCharacterSet> const &, class CArrayFix<struct CCnvCharacterSetConverter::SCharacterSet> const &, class TRequestStatus &)
+	??1CMPXM3uPlaylistExporter@@UAE@XZ @ 3 NONAME ; CMPXM3uPlaylistExporter::~CMPXM3uPlaylistExporter(void)
+	??1CMPXM3uPlaylistImporter@@UAE@XZ @ 4 NONAME ; CMPXM3uPlaylistImporter::~CMPXM3uPlaylistImporter(void)
+	?ConstructL@CMPXM3uPlaylistExporter@@MAEXABVTDesC16@@@Z @ 5 NONAME ; void CMPXM3uPlaylistExporter::ConstructL(class TDesC16 const &)
+	?ConstructL@CMPXM3uPlaylistImporter@@MAEXABVTDesC16@@@Z @ 6 NONAME ; void CMPXM3uPlaylistImporter::ConstructL(class TDesC16 const &)
+	?DoCancel@CMPXM3uPlaylistExporter@@MAEXXZ @ 7 NONAME ; void CMPXM3uPlaylistExporter::DoCancel(void)
+	?DoCancel@CMPXM3uPlaylistImporter@@MAEXXZ @ 8 NONAME ; void CMPXM3uPlaylistImporter::DoCancel(void)
+	?DoTaskStep@CMPXM3uPlaylistExporter@@MAEXXZ @ 9 NONAME ; void CMPXM3uPlaylistExporter::DoTaskStep(void)
+	?DoTaskStep@CMPXM3uPlaylistImporter@@MAEXXZ @ 10 NONAME ; void CMPXM3uPlaylistImporter::DoTaskStep(void)
+	?DoTaskStepL@CMPXM3uPlaylistImporter@@MAEXXZ @ 11 NONAME ; void CMPXM3uPlaylistImporter::DoTaskStepL(void)
+	?NewL@CMPXM3uPlaylistExporter@@SAPAV1@PAVRFs@@PAVMMPXPlaylistPluginObserver@@ABVCMPXMedia@@ABVTDesC16@@AAVTRequestStatus@@@Z @ 12 NONAME ; class CMPXM3uPlaylistExporter * CMPXM3uPlaylistExporter::NewL(class RFs *, class MMPXPlaylistPluginObserver *, class CMPXMedia const &, class TDesC16 const &, class TRequestStatus &)
+	?NewL@CMPXM3uPlaylistImporter@@SAPAV1@PAVRFs@@PAVMMPXPlaylistPluginObserver@@ABVTDesC16@@ABV?$CArrayFix@USCharacterSet@CCnvCharacterSetConverter@@@@3AAVTRequestStatus@@@Z @ 13 NONAME ; class CMPXM3uPlaylistImporter * CMPXM3uPlaylistImporter::NewL(class RFs *, class MMPXPlaylistPluginObserver *, class TDesC16 const &, class CArrayFix<struct CCnvCharacterSetConverter::SCharacterSet> const &, class CArrayFix<struct CCnvCharacterSetConverter::SCharacterSet> const &, class TRequestStatus &)
+	?RunL@CMPXM3uPlaylistExporter@@MAEXXZ @ 14 NONAME ; void CMPXM3uPlaylistExporter::RunL(void)
+	?RunL@CMPXM3uPlaylistImporter@@MAEXXZ @ 15 NONAME ; void CMPXM3uPlaylistImporter::RunL(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/data/101FFC22.RSS	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource file.
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+#include <mpxplaylistenginedefs.hrh>
+#include "mpxm3uplaylistdefs.hrh"
+
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = KMPXM3uPlaylistPluginDllUid; // mpxm3uplaylistplugin.dll
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXPlaylistInterfaceUid; // Uid for CMPXPlaylistPlugin interface
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXM3uPlaylistImplUid; // CMPXM3uPlaylistPlugin
+                    version_no = 1;
+                    display_name = "m3u playlist";
+                    default_data = "playlist/mpegurl";
+                    opaque_data = "<e>.m3u<t>1";
+                    }
+                };
+            }
+        };
+    }
+            
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/eabi/mpxm3uplaylistparsersU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+EXPORTS
+	_ZN23CMPXM3uPlaylistExporter10ConstructLERK7TDesC16 @ 1 NONAME
+	_ZN23CMPXM3uPlaylistExporter10DoTaskStepEv @ 2 NONAME
+	_ZN23CMPXM3uPlaylistExporter4NewLEP3RFsP26MMPXPlaylistPluginObserverRK9CMPXMediaRK7TDesC16R14TRequestStatus @ 3 NONAME
+	_ZN23CMPXM3uPlaylistExporter4RunLEv @ 4 NONAME
+	_ZN23CMPXM3uPlaylistExporter8DoCancelEv @ 5 NONAME
+	_ZN23CMPXM3uPlaylistExporterC1EP3RFsP26MMPXPlaylistPluginObserverRK9CMPXMediaR14TRequestStatus @ 6 NONAME
+	_ZN23CMPXM3uPlaylistExporterC2EP3RFsP26MMPXPlaylistPluginObserverRK9CMPXMediaR14TRequestStatus @ 7 NONAME
+	_ZN23CMPXM3uPlaylistExporterD0Ev @ 8 NONAME
+	_ZN23CMPXM3uPlaylistExporterD1Ev @ 9 NONAME
+	_ZN23CMPXM3uPlaylistExporterD2Ev @ 10 NONAME
+	_ZN23CMPXM3uPlaylistImporter10ConstructLERK7TDesC16 @ 11 NONAME
+	_ZN23CMPXM3uPlaylistImporter10DoTaskStepEv @ 12 NONAME
+	_ZN23CMPXM3uPlaylistImporter11DoTaskStepLEv @ 13 NONAME
+	_ZN23CMPXM3uPlaylistImporter4NewLEP3RFsP26MMPXPlaylistPluginObserverRK7TDesC16RK9CArrayFixIN25CCnvCharacterSetConverter13SCharacterSetEESC_R14TRequestStatus @ 14 NONAME
+	_ZN23CMPXM3uPlaylistImporter4RunLEv @ 15 NONAME
+	_ZN23CMPXM3uPlaylistImporter8DoCancelEv @ 16 NONAME
+	_ZN23CMPXM3uPlaylistImporterC1EP3RFsP26MMPXPlaylistPluginObserverRK9CArrayFixIN25CCnvCharacterSetConverter13SCharacterSetEES9_R14TRequestStatus @ 17 NONAME
+	_ZN23CMPXM3uPlaylistImporterC2EP3RFsP26MMPXPlaylistPluginObserverRK9CArrayFixIN25CCnvCharacterSetConverter13SCharacterSetEES9_R14TRequestStatus @ 18 NONAME
+	_ZN23CMPXM3uPlaylistImporterD0Ev @ 19 NONAME
+	_ZN23CMPXM3uPlaylistImporterD1Ev @ 20 NONAME
+	_ZN23CMPXM3uPlaylistImporterD2Ev @ 21 NONAME
+	_ZTI23CMPXM3uPlaylistExporter @ 22 NONAME ; #<TI>#
+	_ZTI23CMPXM3uPlaylistImporter @ 23 NONAME ; #<TI>#
+	_ZTV23CMPXM3uPlaylistExporter @ 24 NONAME ; #<VT>#
+	_ZTV23CMPXM3uPlaylistImporter @ 25 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project m3u playlist plugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxm3uplaylistparsers.mmp
+mpxm3uplaylistplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/group/mpxm3uplaylistparsers.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  m3u parsers
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET           mpxm3uplaylistparsers.dll
+CAPABILITY       CAP_GENERAL_DLL
+TARGETTYPE       DLL
+UID              0x1000008D 0x101FFC28
+VENDORID         VID_DEFAULT
+
+VERSION 15.0
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+SOURCE          mpxm3uplaylistimporter.cpp
+SOURCE          mpxm3uplaylistexporter.cpp
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+LIBRARY         bafl.lib
+LIBRARY         charconv.lib
+LIBRARY         SysUtil.lib
+LIBRARY         mpxcommon.lib
+#ifdef RD_MULTIPLE_DRIVE
+LIBRARY         PlatformEnv.lib
+#endif //RD_MULTIPLE_DRIVE
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/group/mpxm3uplaylistplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  m3u playlist plugin project specification
+*
+*/
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxm3uplaylistplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC22
+
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_ECOM_PLUGIN
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxm3uplaylistplugin.cpp
+
+SOURCEPATH      ../data
+START RESOURCE  101FFC22.RSS
+TARGET          mpxm3uplaylistplugin.rsc
+END
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+LIBRARY         euser.lib
+LIBRARY         efsrv.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxm3uplaylistparsers.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/inc/mpxm3uplaylistdefs.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  m3u playlist definitions
+*
+*/
+
+
+
+#ifndef MPXM3UPLAYLISTDEFS_H
+#define MPXM3UPLAYLISTDEFS_H
+
+// CONSTANTS
+_LIT(KMPXM3UTagExtm3u, "#EXTM3U");
+_LIT(KMPXM3UTagExtinf, "#EXTINF:");
+_LIT(KMPXM3UTagExt, "#");
+_LIT(KMPXM3UPoint, ",");
+_LIT(KMPXM3ULineChange, "\n");
+_LIT(KMPXM3UAbsPath, ":\\");
+_LIT(KMPXM3UExtension, ".m3u");
+
+const TInt KMPXM3UCarriageReturn = 13;
+const TInt KMPXM3ULengthOfLineChange = 1;
+const TInt KMPXM3UMaxLengthOfExtinfStaticPart = 16;
+const TInt KMPXM3UMaxTimeEntry = 999999; // ~278 hours
+const TInt KMPXM3UNoOffset = 0;
+// A 16-bit Unicode character may take 3 bytes at maximum when encoded to UTF-8
+const TInt KMPXM3UUtf8ConvMultiplier = 3;
+
+const TInt KMPXM3UIgnoreTimeEntry = -1;
+const TInt KMPXM3UPlaylistMaxItemCount = KMaxTInt;
+
+
+const TInt KPlaylistSampleLength = 10000;     // bytes
+const TInt KPlaylistMaxSampleLength = 130000; // bytes
+const TInt KMPXM3UNumOfLinesToProcess = 200;
+const TInt KMPXM3UNumOfMediasToProcess = 200;
+
+// MODULE DATA STRUCTURES
+enum TMPXM3UPlaylistLineType
+    {
+    EMPXM3UPlaylistLineTypeExtinf = 1,
+    EMPXM3UPlaylistLineTypePath = 2,
+    EMPXM3UPlaylistLineTypeNotSupported = 3,
+    EMPXM3UPlaylistLineTypeCorrupted = 4
+    };
+
+#endif      // MPXM3UPLAYLISTDEFS_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/inc/mpxm3uplaylistdefs.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common definition
+*
+*/
+
+
+#ifndef MPXM3UPLAYLISTDEFS_HRH
+#define MPXM3UPLAYLISTDEFS_HRH
+
+
+#define KMPXM3uPlaylistPluginDllUid 0x101FFC22
+#define KMPXM3uPlaylistImplUid 0x101FFC21
+
+#define KMPXM3uPlaylistParsersDllUid 0x101FFC28
+
+#endif // MPXPLAYLISTENGINEDEFS_HRH
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/inc/mpxm3uplaylistplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of m3u playlist plugin interface
+*
+*/
+
+
+#ifndef MPXM3UPLAYLISTPLUGIN_H
+#define MPXM3UPLAYLISTPLUGIN_H
+
+// INCLUDES
+#include <mpxplaylistplugin.h>
+
+// FORWARD DECLARATIONS
+class MMPXPlaylistPluginObserver;
+class CMPXM3uPlaylistImporter;
+class CMPXM3uPlaylistExporter;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+*  CMPXM3uPlaylistPlugin implements CMPXPlaylistPlugin to provide m3u
+*  playlist importing and exporting services. 
+*/
+NONSHARABLE_CLASS(CMPXM3uPlaylistPlugin) : public CMPXPlaylistPlugin
+    {
+public: // Constructors and destructor
+    
+    /**
+    * Two-phased constructor
+    *
+    * @param aInitParams constructor parameters
+    * @return object of constructed
+    */
+    static CMPXM3uPlaylistPlugin* NewL(TAny* aInitParams);
+
+    /**
+    * Destructor
+    */
+    ~CMPXM3uPlaylistPlugin();
+    
+public: // from base clase CMPXPlaylistPlugin
+
+    /** 
+    * Internalize a playlist
+    *
+    * @param aStatus caller's request status
+    * @param aPlaylist a playlist
+    */
+    void InternalizePlaylistL(
+        TRequestStatus& aStatus,
+        const TDesC& aPlaylistUri);
+
+    /** 
+    * Externalize a playlist
+    *
+    * @param aStatus caller's request status
+    * @param aPlaylist playlist to be externalized
+    * @param aFilePath File path for where the playlist should be placed
+    */
+    void ExternalizePlaylistL(
+        TRequestStatus& aStatus,
+        const CMPXMedia& aPlaylist,
+        const TDesC& aFilePath);
+
+    /**
+    * Required attributes for the medias in the playlist in order to
+    * externalize them to a M3U playlist.
+    *
+    * @return an array of attributes required in order to externalize
+    * a playlist media into a M3U playlist file.
+    */
+    const TArray<TMPXAttribute> RequiredAttributes() const;
+
+    /**
+    * Optional attributes for the medias in the playlist for externalizing
+    * them to a M3U playlist
+    *
+    * @return an array of attributes which are optional when externalizing
+    * a playlist media into a M3U playlist file
+    */
+    const TArray<TMPXAttribute> OptionalAttributes() const;
+
+    /**
+    * Returns the file extension the plugin handles
+    *
+    * @return file extension which includes the period.
+    */
+    const TDesC& FileExtension() const;
+
+    /**
+    * cancel a client request
+    */
+    void Cancel();
+    
+private:
+
+    /**
+    * C++ Constructor
+    */
+    CMPXM3uPlaylistPlugin();
+
+    /**
+    * 2nd phase constructor
+    */    
+    void ConstructL();
+    
+private:
+
+    CMPXM3uPlaylistImporter* iImporter;
+    CMPXM3uPlaylistExporter* iExporter;
+    RArray<TMPXAttribute>    iRequiredAttributes;
+    RArray<TMPXAttribute>    iOptionalAttributes;
+    };
+
+#endif   // MPXM3UPLAYLISTPLUGIN_H
+            
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/src/mpxm3uplaylistexporter.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,543 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  externalizes a m3u playlist
+*
+*  CMPXM3uPlaylistExporter is a self-completing CActiveObject. It starts
+*  its exporting process by invoking DoTaskStep as soon as it's instantiated.
+*  Although it doesn't have a state machine, it will still process the request
+*  in steps. In each step, a fixed number of medias, KMPXM3UNumOfMediasToProcess,
+*  are processed. These medias will be converted into M3U line array,
+*  M3U line array will be transformed into buffer, and then the buffer will be
+*  flashed into the file. Once done, it completes its own request and RunL is
+*  called where DoTaskStep is called again to process another
+*  KMPXM3UNumOfMediasToProcess until all medias have been processed.
+*  After all medias have been processed, it notifies its caller of the
+*  results through MMPXPlaylistPluginObserver interface. Once its caller
+*  completes processing of these results, caller's request is completed.
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include <bautils.h>
+#include <utf.h>
+#include <charconv.h>
+#include <sysutil.h>
+#ifdef RD_MULTIPLE_DRIVE
+#include <driveinfo.h>
+#endif //RD_MULTIPLE_DRIVE
+#include <mpxlog.h>
+#include <mpxmediaarray.h>
+#include <mpxattribute.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include "mpxm3uplaylistdefs.h"
+#include "mpxm3uplaylistexporter.h"
+
+
+// ============================ MEMBER FUNCTIONS ==============================
+// ----------------------------------------------------------------------------
+// Constructor.
+// ----------------------------------------------------------------------------
+EXPORT_C CMPXM3uPlaylistExporter::CMPXM3uPlaylistExporter(
+            RFs* aFs,
+            MMPXPlaylistPluginObserver* aObserver,
+            const CMPXMedia& aPlaylist,
+            TRequestStatus& aStatus ) :
+    CActive( EPriorityStandard ),
+    iPlaylist( aPlaylist ),
+    iDriveNumber( EDriveE ),
+    iPlaylistFileCreated( EFalse ),
+    iFs( aFs ),
+    iObserver( aObserver ),
+    iCurrentMedia( -1 ),
+    iMoreToDo( ETrue ),
+    iCallerStatus( &aStatus )
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// ----------------------------------------------------------------------------
+// 2nd phase constructor
+// ----------------------------------------------------------------------------
+EXPORT_C void CMPXM3uPlaylistExporter::ConstructL(
+            const TDesC& aFilePath )
+    {
+    MPX_DEBUG1("CMPXM3uPlaylistExporter::ConstructL() entering");
+
+    // aFilePath should exist
+    __ASSERT_DEBUG(aFilePath.Length(), User::Leave(KErrCorrupt));
+
+#ifdef RD_MULTIPLE_DRIVE
+    // Use the default MMC drive
+    User::LeaveIfError( DriveInfo::GetDefaultDrive(
+        DriveInfo::EDefaultRemovableMassStorage,
+        iDriveNumber ) );
+#endif // RD_MULTIPLE_DRIVE
+
+    // retrieve playlist medias
+    CMPXMediaArray* ary = iPlaylist.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+    User::LeaveIfNull( ary );
+    iMedias = CMPXMediaArray::NewL( *ary );
+
+    // check if the playlist name contains invalid characters for the file system
+    // if so, use filename provided in the URI if provided; otherwise leave with
+    // KErrBadName
+    const TDesC& playlistName =
+        iPlaylist.ValueText(KMPXMediaGeneralTitle);
+
+    HBufC* playlistFilename(NULL);
+
+    if (iFs->IsValidName(playlistName))
+        {
+        playlistFilename = playlistName.AllocLC();
+        }
+    else if (iPlaylist.IsSupported(KMPXMediaGeneralUri))
+        {
+        TParsePtrC parse(iPlaylist.ValueText(KMPXMediaGeneralUri));
+        playlistFilename = parse.Name().AllocLC();
+        }
+    else
+        {
+        User::Leave(KErrBadName);
+        }
+
+    // set playlist file path
+    iPlaylistFilePath =
+        HBufC::NewL( playlistFilename->Length() +
+                     aFilePath.Length() +
+                     KMPXM3UExtension().Length() );
+
+    TPtr playlistFilePath = iPlaylistFilePath->Des();
+
+    playlistFilePath.Append(aFilePath);
+    playlistFilePath.Append(*playlistFilename);
+    playlistFilePath.Append(KMPXM3UExtension);
+
+    CleanupStack::PopAndDestroy(playlistFilename);
+
+    // determine designation drive number
+    TParsePtrC parse(*iPlaylistFilePath);
+    TPtrC drive = parse.Drive();
+    User::LeaveIfError(iFs->CharToDrive(TChar(drive.Ptr()[0]), iDriveNumber));
+
+    *iCallerStatus = KRequestPending;
+
+    TRequestStatus* status = &iStatus;
+    *status = KRequestPending;
+    User::RequestComplete(status, KErrNone);
+    SetActive();
+
+    MPX_DEBUG1("CMPXM3uPlaylistExporter::ConstructL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+EXPORT_C CMPXM3uPlaylistExporter* CMPXM3uPlaylistExporter::NewL(
+            RFs* aFs,
+            MMPXPlaylistPluginObserver* aObserver,
+            const CMPXMedia& aPlaylist,
+            const TDesC& aFilePath,
+            TRequestStatus& aStatus )
+    {
+    CMPXM3uPlaylistExporter* self =
+        new(ELeave)CMPXM3uPlaylistExporter(aFs, aObserver, aPlaylist, aStatus );
+    CleanupStack::PushL(self);
+    self->ConstructL( aFilePath );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+EXPORT_C CMPXM3uPlaylistExporter::~CMPXM3uPlaylistExporter()
+    {
+    Cancel();
+    Cleanup();
+
+    delete iMedias;
+    delete iPlaylistFilePath;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles request completion event
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXM3uPlaylistExporter::RunL()
+    {
+    MPX_DEBUG1("CMPXM3uPlaylistImporter::RunL");
+
+    if ( iMoreToDo && iStatus.Int() == KErrNone )
+        {
+        DoTaskStep();
+        SetActive();
+        }
+    else
+        {
+        User::RequestComplete( iCallerStatus, iStatus.Int() );
+        Cleanup();
+        NotifyClient(iStatus.Int());
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Implements cancellation of an outstanding request.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXM3uPlaylistExporter::DoCancel()
+    {
+    MPX_DEBUG1("CMPXM3uPlaylistExporter::DoCancel");
+
+    TInt error( KErrCancel );
+    Cleanup();
+
+    // notify client. return the playlist with the least invalid paths
+    NotifyClient(error);
+
+    if ( iCallerStatus )
+        {
+        User::RequestComplete( iCallerStatus, error );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Performs one step of the task.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXM3uPlaylistExporter::DoTaskStep()
+    {
+    MPX_DEBUG1("CMPXM3uPlaylistExporter::DoTaskStep()");
+
+    TRequestStatus* status = &iStatus;
+    *status = KRequestPending;
+
+    TInt error( KErrNone );
+
+    MPX_TRAP( error, ExternalizeL() );
+
+    User::RequestComplete( status, error );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistExporter::ExternalizeL
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistExporter::ExternalizeL()
+    {
+    PopulateLineArrayL();
+    FlushLineArrayToBufferL();
+    WritePlaylistToFileL();
+    Cleanup();
+
+    if (iMedias->Count() == 0)
+        {
+        iMoreToDo = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistExporter::PopulateLineArrayL
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistExporter::PopulateLineArrayL()
+    {
+    MPX_DEBUG2("Before PopulateLineArrayL: heap size = %d", User::Heap().Size());
+
+    // Parse lowercase path to the current folder
+    // Convert playlist file path to lower case
+    HBufC* plTmp = iPlaylistFilePath->AllocLC();
+
+    TPtr ptr(plTmp->Des());
+    ptr.LowerCase();
+
+    TParse playlistPath;
+    playlistPath.Set(*plTmp, NULL, NULL);
+    // Path to the folder, where playlist file is located to
+    TPtrC currentFolder = playlistPath.DriveAndPath();
+
+    TInt count = iMedias->Count();
+    TBool addNewLine(ETrue);
+    for (TInt i = 0; i < KMPXM3UNumOfMediasToProcess && i < count; i++)
+        {
+        CMPXMedia* item = (*iMedias)[0];
+
+        // Create and write Extented format tag if this is
+        // the first media being processed
+        if (++iCurrentMedia == 0)
+            {
+            CreateHeaderLineL();
+            AddLineToArrayL();
+            }
+
+        // Create and write extendted info line
+        CreateExtentedInfoLineL(*item);
+        AddLineToArrayL();
+
+        // Create and write path line
+        if (i == count-1)
+            {
+            // This is last item => no new line
+            addNewLine = EFalse;
+            }
+
+        CreatePathLineL(*item, currentFolder, addNewLine);
+
+        // delete media now to save memory consumption
+        iMedias->Remove(0);
+
+        AddLineToArrayL();
+        }
+
+    CleanupStack::PopAndDestroy(plTmp ); // plTmp
+
+    MPX_DEBUG2("After PopulateLineArrayL: heap size = %d", User::Heap().Size());
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistExporter::AddLineToArrayL
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistExporter::AddLineToArrayL()
+    {
+    if (iLine)
+        {
+        // Convert line from Unicode to UTF-8
+        // UTF-8 encoded character may consume several bytes =>
+        // multiply the descriptor length in order to prevent overflow.
+        HBufC8* line = HBufC8::NewLC(iLine->Length() * KMPXM3UUtf8ConvMultiplier);
+
+        TPtr8 ptr = line->Des();
+         // According to current knowledge, this should not be ASCII
+        CnvUtfConverter::ConvertFromUnicodeToUtf8(ptr, *iLine);
+
+        iLines.AppendL(line);
+        CleanupStack::Pop( line );
+
+        delete iLine;
+        iLine = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistExporter::CreateHeaderLineL
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistExporter::CreateHeaderLineL()
+    {
+    delete iLine;
+    iLine = NULL;
+
+    iLine = HBufC::NewL(KMPXM3UTagExtm3u().Length() + KMPXM3ULengthOfLineChange);
+    TPtr ptr = iLine->Des();
+
+    ptr.Append(KMPXM3UTagExtm3u);
+    ptr.Append(KMPXM3ULineChange);
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistExporter::CreateExtentedLineL
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistExporter::CreateExtentedInfoLineL(
+            const CMPXMedia& aMedia)
+    {
+    delete iLine;
+    iLine = NULL;
+
+    const TDesC& title =
+        (aMedia.IsSupported(KMPXMediaGeneralTitle)) ?
+            aMedia.ValueText(KMPXMediaGeneralTitle) : KNullDesC();
+
+    if (title.Length())
+        {
+        TInt timeEntry(0);
+
+        if (aMedia.IsSupported(KMPXMediaGeneralDuration))
+            {
+            timeEntry = aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralDuration);
+            }
+
+        if (timeEntry < KMPXM3UIgnoreTimeEntry || timeEntry > KMPXM3UMaxTimeEntry)
+            {
+            timeEntry = KMPXM3UIgnoreTimeEntry;
+            }
+
+        iLine = HBufC::NewL(KMPXM3UMaxLengthOfExtinfStaticPart + title.Length());
+
+        TPtr ptr = iLine->Des();
+
+        ptr.Append(KMPXM3UTagExtinf);
+        ptr.AppendNum(timeEntry);
+        ptr.Append(KMPXM3UPoint);
+        ptr.Append(title);
+        ptr.Append(KMPXM3ULineChange);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistExporter::CreatePathLineL
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistExporter::CreatePathLineL(
+            const CMPXMedia& aMedia,
+            const TDesC& aCurrentFolder,
+            TBool aAddNewLine )
+    {
+    if (!aMedia.IsSupported(KMPXMediaGeneralUri))
+        {
+        User::Leave(KErrArgument);
+        }
+
+    // Temporary pointer to item path
+    const TDesC& itemPath = aMedia.ValueText(KMPXMediaGeneralUri);
+
+    delete iLine;
+    iLine = NULL;
+    iLine = HBufC::NewL(itemPath.Length() + KMPXM3ULengthOfLineChange);
+    TPtr ptr = iLine->Des();
+
+    // Create temporary copy of the path and set it lowercase
+    HBufC* path = itemPath.AllocLC();
+    path->Des().LowerCase();
+    // Try to find current folder path from the item path
+    TInt offset = path->Find(aCurrentFolder);
+
+    if (offset != KErrNotFound)
+        {
+        // File is under the current folder => append relative path
+        ptr.Append(itemPath.Mid(aCurrentFolder.Length()));
+        }
+    else
+        {
+        // File is not under the current path => append absolute path
+        ptr.Append(itemPath);
+        }
+
+    CleanupStack::PopAndDestroy(path); // path
+
+    if (aAddNewLine)
+        {
+        ptr.Append(KMPXM3ULineChange);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistExporter::FlushLineArrayToBufferL
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistExporter::FlushLineArrayToBufferL()
+    {
+    MPX_DEBUG2("Before FlushLineArrayToBufferL: heap size = %d", User::Heap().Size());
+
+    TInt length(0);
+    TInt count = iLines.Count();
+    for (TInt ii = 0; ii < count; ++ii)
+        {
+        length += iLines[ii]->Length();
+        }
+
+    delete iPlaylistBuf;
+    iPlaylistBuf = NULL;
+    iPlaylistBuf = HBufC8::NewL(length);
+    TPtr8 ptr = iPlaylistBuf->Des();
+
+    for (TInt jj = 0; jj < count; ++jj)
+        {
+        ptr.Append(*iLines[0]);
+        // delete the line from the lines array now to save memory consumption
+        delete iLines[0];
+
+        // remove the appended element from the array
+        iLines.Remove(0);
+        }
+
+    MPX_DEBUG2("After FlushLineArrayToBufferL: heap size = %d", User::Heap().Size());
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistExporter::WritePlaylistToFileL
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistExporter::WritePlaylistToFileL()
+    {
+    // Open playlist file
+    RFile file;
+    if (!iPlaylistFileCreated)
+        {
+        User::LeaveIfError(file.Replace(*iFs, *iPlaylistFilePath, EFileWrite));
+        iPlaylistFileCreated = ETrue;
+        }
+    else
+        {
+        User::LeaveIfError(file.Open(*iFs, *iPlaylistFilePath, EFileWrite));
+        }
+    CleanupClosePushL(file);
+
+    // Calculate the increase in the playlist file size
+    TInt oldSize;
+    User::LeaveIfError(file.Size(oldSize));
+    TInt sizeIncr = iPlaylistBuf->Size() - oldSize;
+
+    if (sizeIncr > 0 &&
+        SysUtil::DiskSpaceBelowCriticalLevelL(iFs, sizeIncr, iDriveNumber))
+        {
+        // Don't show any own notes here
+        User::Leave(KErrDiskFull);
+        }
+
+    // Write file to permanent memory
+    User::LeaveIfError(file.Write(oldSize, *iPlaylistBuf));
+
+    file.Flush();
+    CleanupStack::PopAndDestroy(&file); // file
+    }
+
+// ----------------------------------------------------------------------------
+// Cleanup.
+// ----------------------------------------------------------------------------
+void CMPXM3uPlaylistExporter::Cleanup()
+    {
+    iLines.ResetAndDestroy();
+
+    delete iLine;
+    iLine = NULL;
+
+    delete iPlaylistBuf;
+    iPlaylistBuf = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles notifications to the client
+// ----------------------------------------------------------------------------
+void CMPXM3uPlaylistExporter::NotifyClient( TInt aError )
+    {
+    MPX_DEBUG2("CMPXM3uPlaylistExporter::NotifyClient(%d)", aError);
+
+    if ( iObserver )
+        {
+        // notify client. return the playlist with the least invalid paths
+        TRAP_IGNORE(iObserver->HandlePlaylistL( *iPlaylistFilePath, aError ));
+        }
+
+    if ( aError )
+        {
+        // delete the partial playlist file.
+        iFs->Delete(*iPlaylistFilePath);
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/src/mpxm3uplaylistimporter.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,811 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Imports a m3u playlist file
+*
+*/
+
+
+// INCLUDE FILES
+#include <bautils.h>
+#include <utf.h>
+#include <charconv.h>
+#include <mpxlog.h>
+#include <mpxmediaarray.h>
+#include <mpxattribute.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include "mpxm3uplaylistdefs.h"
+#include "mpxm3uplaylistimporter.h"
+
+
+// ============================ CONSTANTS ==============================
+const TUint KUnicodeBOM = 0xFEFF;
+const TInt KMinimumConfidenceRequired = 60;
+const TInt KPathStartingChars = 3;
+
+// ============================ MEMBER FUNCTIONS ==============================
+// ----------------------------------------------------------------------------
+// Constructor. 
+// ----------------------------------------------------------------------------
+EXPORT_C CMPXM3uPlaylistImporter::CMPXM3uPlaylistImporter(
+            RFs* aFs,
+            MMPXPlaylistPluginObserver* aObserver,
+            const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aTopCharacterSet,
+            const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aAvailableCharacterSet,
+            TRequestStatus& aStatus ) :
+    CActive( EPriorityStandard ),
+    iFs( aFs ),
+    iObserver( aObserver ),
+    iCallerStatus( &aStatus ),
+    iEndLineNumber( KMPXM3UNumOfLinesToProcess ),
+    iCurrentLineNumber( 0 ),
+    iMoreToDo( ETrue ),
+    iEndOfFile( EFalse ),
+    iAutoEncodingInvalidItems( 0 ),
+    iState( EMPXM3UReadBufferWithAutoDetectEncoding ),
+    iTopCharacterSet( aTopCharacterSet ),
+    iAvailableCharacterSet( aAvailableCharacterSet )
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ----------------------------------------------------------------------------
+// 2nd phase constructor
+// ----------------------------------------------------------------------------
+EXPORT_C void CMPXM3uPlaylistImporter::ConstructL( const TDesC& aPlaylistUri )
+    {
+    MPX_DEBUG2("CMPXM3uPlaylistImporter::ConstructL(%S) entering", &aPlaylistUri);
+
+    __ASSERT_DEBUG(aPlaylistUri.Length() != 0, User::Leave(KErrArgument));
+    iPlaylistFilePath.Set(aPlaylistUri);
+
+    iAutoEncodingPlaylistArray = CMPXMediaArray::NewL();
+    
+    *iCallerStatus = KRequestPending;
+
+    TRequestStatus* status = &iStatus;
+    *status = KRequestPending;
+    User::RequestComplete(status, KErrNone);   
+    SetActive();
+    
+    MPX_DEBUG1("CMPXM3uPlaylistImporter::ConstructL() exiting");
+    }
+    
+// ----------------------------------------------------------------------------
+// Two-phased constructor. 
+// ----------------------------------------------------------------------------
+EXPORT_C CMPXM3uPlaylistImporter* CMPXM3uPlaylistImporter::NewL(
+            RFs* aFs,
+            MMPXPlaylistPluginObserver* aObserver,
+            const TDesC& aPlaylistUri,
+            const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aTopCharacterSet,
+            const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aAvailableCharacterSet,
+            TRequestStatus& aStatus )            
+    {
+    CMPXM3uPlaylistImporter* self =
+        new(ELeave)CMPXM3uPlaylistImporter(
+            aFs, aObserver, aTopCharacterSet, aAvailableCharacterSet, aStatus );
+    CleanupStack::PushL( self );
+    self->ConstructL( aPlaylistUri );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor. 
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CMPXM3uPlaylistImporter::~CMPXM3uPlaylistImporter()
+    {
+    Cancel();
+    Cleanup();
+    }
+
+// ----------------------------------------------------------------------------
+// Handles request completion event
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXM3uPlaylistImporter::RunL()
+    {
+    MPX_DEBUG1("CMPXM3uPlaylistImporter::RunL");
+    
+    if ( iMoreToDo && iStatus.Int() == KErrNone )
+        {
+        DoTaskStep();
+        SetActive();
+        }
+    else
+        {
+        User::RequestComplete( iCallerStatus, iStatus.Int() );        
+        NotifyClient(iStatus.Int());      
+        Cleanup();                    
+        }
+    }
+    
+// ----------------------------------------------------------------------------
+// Implements cancellation of an outstanding request.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXM3uPlaylistImporter::DoCancel()
+    {
+    MPX_DEBUG1("CMPXM3uPlaylistImporter::DoCancel");
+
+    TInt error( KErrCancel );
+    
+    // notify client that the request has been cancelled
+    NotifyClient(error);
+
+    Cleanup();
+    
+    if ( iCallerStatus )
+        {
+        User::RequestComplete( iCallerStatus, error );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Performs one step of the task
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXM3uPlaylistImporter::DoTaskStep()
+    {
+    MPX_DEBUG1("CMPXM3uPlaylistImporter::DoTaskStep()");
+    
+    TRequestStatus* status = &iStatus;
+    *status = KRequestPending;
+
+    TInt error( KErrNone );
+    
+    MPX_TRAP( error, DoTaskStepL() );
+
+    User::RequestComplete( status, error );
+    }
+        
+// ----------------------------------------------------------------------------
+// Performs one step of the task. Leaves when an error is encountered
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXM3uPlaylistImporter::DoTaskStepL()
+    {
+    MPX_DEBUG1("CMPXM3uPlaylistImporter::DoTaskStepL()");
+    
+    switch( iState )
+        {        
+        case EMPXM3UReadBufferWithAutoDetectEncoding:
+            {
+            ReadPlaylistFileToBufferL();
+            iState = EMPXM3UParseWithAutoDetectEncoding;
+            }
+            break;
+            
+        case EMPXM3UParseWithAutoDetectEncoding:
+            {
+            ParsePlaylistBufferL(
+                *iAutoEncodingPlaylistArray, iAutoEncodingInvalidItems );
+            
+            // If at the moment, we know that there is at least one error parsing
+            // with auto detect encoding, we don't need to proceed until end of
+            // file anymore, this playlist file is concluded to be corrupted
+            if ( iAutoEncodingInvalidItems > 0 )
+                {
+                delete iAutoEncodingPlaylistArray;
+                iAutoEncodingPlaylistArray = NULL;
+                
+                User::Leave(KErrCorrupt);
+                }
+
+            // we've finished parsing with auto detect encoding we will return
+            // the playlist parsed with auto encoding
+            else if ( iEndOfFile )
+                {               
+                iState = EMPXM3UComposePlaylistMedia;
+                }
+            }       
+            break;
+
+        case EMPXM3UComposePlaylistMedia:
+            {
+            ComposePlaylistL();
+            iMoreToDo = EFalse;
+            }
+            break;
+            
+        default:
+            {
+            User::Leave(KErrAbort);
+            }
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistImporter::ReadPlaylistFileToBufferL
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistImporter::ReadPlaylistFileToBufferL()
+    {
+    MPX_DEBUG2("Before reading playlist to buffer: heap size = %d", User::Heap().Size());    
+
+    delete iBuffer;
+    iBuffer = NULL;
+    iBufferPtr.Set(KNullDesC);    
+
+    //
+    // leave with KErrNotFound if the playlist file does not exist
+    //    
+    if (!BaflUtils::FileExists(*iFs, iPlaylistFilePath))
+        {
+        User::Leave(KErrNotFound);
+        }
+    
+    TEntry entry;
+    User::LeaveIfError(iFs->Entry(iPlaylistFilePath, entry));
+    
+    HBufC* buffer = HBufC::NewLC(entry.iSize);
+    TPtr ptr = buffer->Des();
+
+    HBufC8* buf8 = HBufC8::NewLC(entry.iSize);
+    TPtr8 ptr8 = buf8->Des();
+
+    // Read the first KPlaylistSampleLength bytes of the file
+    TInt sampleLength(KPlaylistSampleLength);
+    if (sampleLength > entry.iSize)
+        {
+        sampleLength = entry.iSize;
+        }
+    User::LeaveIfError(iFs->ReadFileSection(
+                            iPlaylistFilePath, 0, ptr8, sampleLength));
+
+    // auto detect character encoding
+    TUint charSetId(0);
+    TInt error = DetectCharacterSetL(*buf8, iTopCharacterSet, charSetId);
+    MPX_DEBUG3("encoding detected using top character set is 0x%x, error %d", charSetId, error);
+    
+    // when we fail to detect the encoding, use all available character set in the
+    // system to try again. If that also fails, abandon the operation.
+    if (error)
+        {
+        User::LeaveIfError(DetectCharacterSetL(*buf8, iAvailableCharacterSet, charSetId));
+        MPX_DEBUG2("encoding detected using available character set is 0x%x", charSetId);        
+        }
+
+    // read the whole file if the sample taken isn't the whole file
+    if (sampleLength != entry.iSize)
+        {
+        User::LeaveIfError(iFs->ReadFileSection(
+                                iPlaylistFilePath, 0, ptr8, entry.iSize));
+        }
+   
+    // perform character conversion using the selected encoding
+    TInt state(CCnvCharacterSetConverter::KStateDefault);
+    TInt numOfUnconvertibleChars(0);
+    CCnvCharacterSetConverter* charSetConv = CCnvCharacterSetConverter::NewLC();
+    charSetConv->PrepareToConvertToOrFromL(charSetId, iAvailableCharacterSet, *iFs);
+    TInt retVal = charSetConv->ConvertToUnicode(ptr, *buf8, state, numOfUnconvertibleChars);
+    User::LeaveIfError(retVal);
+
+    // try again if the character set wasn't detected using the whole file
+    if ((retVal > 0 || numOfUnconvertibleChars > 0) && (sampleLength != entry.iSize))
+        {
+        MPX_DEBUG4("retVal = %d, numOfUnconvertibleChars = %d, entry.iSize = %d",
+                    retVal, numOfUnconvertibleChars, entry.iSize);
+        numOfUnconvertibleChars = 0;
+        retVal = 0;
+        User::LeaveIfError(DetectCharacterSetL(*buf8, iAvailableCharacterSet, charSetId));
+        charSetConv->PrepareToConvertToOrFromL(charSetId, iAvailableCharacterSet, *iFs);
+        retVal = charSetConv->ConvertToUnicode(ptr, *buf8, state, numOfUnconvertibleChars);
+        }
+        
+    if (retVal > 0 || numOfUnconvertibleChars > 0)
+        {
+        MPX_DEBUG3("Unable to find character encoding for the playlist file. retVal = %d, numOfUnconvertibleChars = %d",
+                    retVal, numOfUnconvertibleChars);        
+        User::Leave(KErrNotSupported);
+        }
+    
+    // remove the byte order mark (BOM) character prepended at the beginning
+    // of the stream if encoded with unicode as per Unicode section 2.4
+    if ((charSetId == KCharacterSetIdentifierUnicodeLittle ||
+         charSetId == KCharacterSetIdentifierUnicodeBig) &&
+        ptr.Length() > 0 &&
+        ptr[0] == KUnicodeBOM)
+        {
+        ptr.Delete(0,1);
+        }
+        
+    iBuffer = buffer;
+    iBufferPtr.Set(*iBuffer);
+    
+    CleanupStack::PopAndDestroy(2, buf8); // charSetConv & buf8    
+    CleanupStack::Pop(buffer);
+        
+    // brand new buffer which hasn't been read, reset iCurrentLineNumber and
+    // iEndLineNumber, and iEndOfFile
+    iCurrentLineNumber = 0;
+    iEndLineNumber = KMPXM3UNumOfLinesToProcess;
+    iEndOfFile = EFalse;
+
+    MPX_DEBUG2("After reading playlist to buffer: heap size = %d", User::Heap().Size());        
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistImporter::DetectCharacterSetL
+// copied and revised based on CMetaDataParserID3v1::DetectCharacterSetL version 4
+// -----------------------------------------------------------------------------
+//
+TInt CMPXM3uPlaylistImporter::DetectCharacterSetL(
+            const TDesC8& aSample,
+            const CArrayFix<CCnvCharacterSetConverter::SCharacterSet>& aCharacterSet,
+            TUint& aCharSetId)
+	{
+	// CCnvCharacterSetConverter::ConvertibleToCharSetL hangs if sample is too big
+	if (aSample.Size() > KPlaylistMaxSampleLength)
+	    {
+	    User::Leave(KErrNotSupported);
+	    }
+	    
+	TInt confidence(0);
+	TInt highestConfidence(0);
+	TUint charSetId(0);
+	TUint highestConfidencecharSetId(0);
+
+	CCnvCharacterSetConverter* charSetConv = CCnvCharacterSetConverter::NewLC();
+	TInt count = aCharacterSet.Count();
+	for ( TInt i=0; i < count; i++)
+		{
+		charSetId = aCharacterSet.At(i).Identifier();
+		charSetConv->ConvertibleToCharSetL(confidence, charSetId, aCharacterSet, aSample);
+		if ( confidence > highestConfidence )
+			{
+			highestConfidence = confidence;
+			highestConfidencecharSetId = charSetId;
+			}
+		}
+	CleanupStack::PopAndDestroy(charSetConv);
+	MPX_DEBUG3("CMPXM3uPlaylistImporter::DetectCharacterSetL :-> Confidence[%d] CharSetId[0x%x]",
+   		confidence, aCharSetId);
+	if ( highestConfidence == 0 || highestConfidence < KMinimumConfidenceRequired )
+		{
+		return KErrNotFound;
+		}
+	else
+		{
+		aCharSetId = highestConfidencecharSetId;
+		return KErrNone;
+		}
+	}
+	
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistPlugin::ParsePlaylistBufferL
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistImporter::ParsePlaylistBufferL(
+            CMPXMediaArray& aPlaylist,
+            TInt& aInvalidItemCount)
+    {
+    // Read and process all the lines in the file
+    //
+    // the order of the following conditions is important. ReadNextLineL
+    // should be called last to avoid skipping one line
+    while (iCurrentLineNumber < iEndLineNumber &&
+           aPlaylist.Count() < KMPXM3UPlaylistMaxItemCount &&
+           ReadNextLineL())
+        {
+        ProcessLineL(aPlaylist, aInvalidItemCount);  
+        }
+
+    if ( aPlaylist.Count() == KMPXM3UPlaylistMaxItemCount )
+        {
+        User::Leave(KErrOverflow);
+        }
+
+    //
+    // haven't finished processing all lines in the file, but have processed
+    // KMPXM3UNumOfLinesToProcess number of lines. Set up iEndLineNumber for
+    // the next iteration
+    //        
+    if ( !iEndOfFile && iCurrentLineNumber == iEndLineNumber )
+        {
+        iEndLineNumber += KMPXM3UNumOfLinesToProcess;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistPlugin::ReadNextLineL
+// -----------------------------------------------------------------------------
+//
+TBool CMPXM3uPlaylistImporter::ReadNextLineL()
+    {
+    // iBuffer should exist when this function is called
+    __ASSERT_DEBUG(iBuffer, User::Leave(KErrBadDescriptor));
+
+    if (!iBufferPtr.Length())
+        {
+        // File end reached.
+        iEndOfFile = ETrue;
+        return EFalse;
+        }
+
+    delete iLine;
+    iLine = NULL;
+
+    // Try to find line change
+    TInt offset = iBufferPtr.FindF(KMPXM3ULineChange);
+  
+    if (offset == KErrNotFound)
+        {
+        // No line change was found --> last line had no line change
+        iLine = iBufferPtr.AllocL();
+        // Set iBufferPtr to the end of buffer
+        iBufferPtr.Set(iBufferPtr.Right(0)); //magic
+        }
+    else
+        {
+        // Found line change
+        TInt length(offset);
+        if ((offset > KMPXM3UNoOffset) && 
+            (iBufferPtr[length - 1] == KMPXM3UCarriageReturn)) // magic
+            {
+            --length;
+            }
+
+        iLine = iBufferPtr.Left(length).AllocL();
+
+        // Move past the line feed
+        iBufferPtr.Set(iBufferPtr.Mid(++offset));
+        }
+
+    // Remove leading and trailing space characters from iLine's data.
+    TPtr ptr = iLine->Des();
+    ptr.Trim();
+
+    iCurrentLineNumber++;
+    return ETrue;
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistImporter::ProcessLineL()
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistImporter::ProcessLineL(
+            CMPXMediaArray& aPlaylist,
+            TInt& aInvalidItemCount)
+    {
+    if ( iCurrentLineNumber == 1 ) // first line
+        {
+        // Check whether the file is in the extented format
+        TInt offset = iLine->Find(KMPXM3UTagExtm3u);
+        if (offset == KErrNotFound || offset != KMPXM3UNoOffset ||
+            iLine->Length() != KMPXM3UTagExtm3u().Length())
+            {
+            // The file is not in the extented format
+            iExtendedFormat = EFalse;
+            }
+        else
+            {
+            // The file is in the extented format
+            iExtendedFormat = ETrue;
+            return;
+            }        
+        }
+
+    if (!iItem)
+        {
+        iItem = CMPXMedia::NewL();
+        iItem->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem);
+        iItem->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXSong);
+        }
+    
+    // Parse line and then decide what to do with it
+    switch (ParseLineL(iItem, aInvalidItemCount))
+        {
+        case EMPXM3UPlaylistLineTypeExtinf:
+            // Continue to next round
+            break;
+            
+        case EMPXM3UPlaylistLineTypePath:
+            {
+            // Line was a path => add item to playlist
+            aPlaylist.AppendL(iItem);
+            iItem = NULL; // item now owned by aPlaylist
+            }
+            break; 
+                       
+        case EMPXM3UPlaylistLineTypeNotSupported:
+        case EMPXM3UPlaylistLineTypeCorrupted:
+        default:
+            {
+            // Line has unsupported extension tag or undefined has error
+            // occurred -> delete item
+            delete iItem;
+            iItem = NULL;
+            }
+            break;
+        }
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPXM3uPlaylistImporter::ParseLineL
+// -----------------------------------------------------------------------------
+//
+TInt CMPXM3uPlaylistImporter::ParseLineL(
+            CMPXMedia* aItem,
+            TInt& aInvalidItemCount)
+    {
+    // There should be always aItem & iLine when this function is called
+    __ASSERT_DEBUG(aItem && iLine, User::Leave(KErrAbort));
+
+    if (!iLine->Length())
+        {
+        // Empty line => line is invalid
+        return EMPXM3UPlaylistLineTypeNotSupported;
+        }
+
+    if (iExtendedFormat)
+        {
+        // File is in the extented format => check whether there is extented
+        // info in this line.
+        TInt offset = iLine->Find(KMPXM3UTagExtinf);
+        if (offset != KErrNotFound && offset == KMPXM3UNoOffset)
+            {
+            // Extented info found
+            aItem->SetTextValueL(KMPXMediaGeneralTitle, KNullDesC);
+
+            offset = iLine->Find(KMPXM3UPoint);
+
+            if(offset != KErrNotFound)
+                {
+
+                // Title and length found from extented info
+                // Parse length
+                TLex16 lex(iLine->Mid(KMPXM3UTagExtinf().Length(),
+                                offset - KMPXM3UTagExtinf().Length()));
+                TInt length;
+                if (lex.Val(length))
+                    {
+                    // Error has occurred => legth is set to be ignored
+                    length = KMPXM3UIgnoreTimeEntry;
+                    }
+
+                aItem->SetTObjectValueL(KMPXMediaGeneralDuration, length);
+                MPX_DEBUG2("    duration %d", length);
+
+                // Parse title
+                HBufC* title = iLine->Mid(offset + 1).AllocLC();
+                aItem->SetTextValueL(KMPXMediaGeneralTitle, *title);
+                MPX_DEBUG2("    title %S", title);
+                CleanupStack::PopAndDestroy( title );
+
+                return EMPXM3UPlaylistLineTypeExtinf; // line type extinf
+                }    
+            }
+        }
+
+    // File is not in the extented format or supported info not found from this
+    // line.
+    switch (iLine->Find(KMPXM3UTagExt))
+        {
+        case KMPXM3UNoOffset:
+            // Unsupported extended info tag found from this line
+            return EMPXM3UPlaylistLineTypeNotSupported;
+            
+        case KErrNotFound:
+        default:
+            // Extended info not found from the beginning of line => line is
+            // a path.
+            {
+            // Get absolute path
+            TInt error(KErrNone);
+            HBufC* uri = ParseAbsolutePathLC(*iLine, error);
+        
+            if (error)
+                {
+                if (error == KErrPathNotFound)
+                    {
+                    TUint flag(KMPXMediaGeneralFlagsSetOrUnsetBit | KMPXMediaGeneralFlagsIsInvalid);
+                    aItem->SetTObjectValueL(KMPXMediaGeneralFlags, flag);
+                    }
+                else
+                    {
+                    if( uri )
+                        {
+                        CleanupStack::PopAndDestroy( uri );
+                        }
+                    
+                    ++aInvalidItemCount;
+                                    
+                    // All other errors are considered to mean playlist is
+                    // corrupt.
+                    return EMPXM3UPlaylistLineTypeCorrupted;
+                    }
+                }
+
+            aItem->SetTextValueL(KMPXMediaGeneralUri, *uri);
+            MPX_DEBUG2("    uri %S", uri);
+                
+            // if title isn't supplied by the m3u file, extract file name from
+            // URI as the title
+            if (!aItem->IsSupported(KMPXMediaGeneralTitle))
+                {
+                TParsePtrC parser(*uri);
+                TPtrC title = parser.Name();
+                aItem->SetTextValueL(KMPXMediaGeneralTitle, title);
+                MPX_DEBUG2("    title %S", &title);
+                }
+
+            CleanupStack::PopAndDestroy( uri );
+            
+            return EMPXM3UPlaylistLineTypePath; // line type path
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPlayerM3UPlaylistParser::ParseAbsolutePathL
+// -----------------------------------------------------------------------------
+//
+HBufC* CMPXM3uPlaylistImporter::ParseAbsolutePathLC(
+            const TDesC& aPath,
+            TInt& aError)
+    {
+    HBufC* path = NULL;
+    
+    TBool isAbsolute( EFalse );
+    
+    if (aPath.Length() > KPathStartingChars && 
+        !aPath.Mid(1, 2).CompareF(KMPXM3UAbsPath)) // magic: the 2nd and 3rd chars
+                                               // are always ":\"
+                                               // for absolute paths
+        {
+        isAbsolute = ETrue;
+        }
+
+    if (aPath.Length() > KMaxFileName) // Test if path is too long
+        {
+        aError = KErrCorrupt;
+        }
+    else if ( isAbsolute )
+        {
+        aError = KErrNone;
+        aError = iFs->IsValidName(aPath) ? KErrNone : KErrBadName;
+        path = aPath.AllocLC();
+        }
+    else
+        {
+        // Given path could be relative => create absolute path and test it
+        // Playlist file path
+        TParse playlistPath;
+        playlistPath.Set(iPlaylistFilePath, NULL, NULL);
+        // Path to the folder, where playlist file is located to
+        TPtrC currentFolder = playlistPath.DriveAndPath();
+        // Create absolute path
+        path = HBufC::NewLC(currentFolder.Length() + aPath.Length());
+
+        TPtr tmpPtr(path->Des());
+        tmpPtr = currentFolder;
+        tmpPtr += aPath;
+
+        aError = iFs->IsValidName(*path) ? KErrNone : KErrBadName;
+        }
+    
+    // It is possible that a song exists in the filesystem but isn't added to
+    // the database because it's not a supported type. If such song is included
+    // in a playlist, it will be added to the database when the playlist is added.
+    // Because of this, we cannot rely on whether the song exists in the database
+    // to conclude whether the song is a broken link. We need to check for file
+    // existence here. For the unsupported songs included in the playlist, they
+    // will then be marked as corrupted when user initiates playback of those
+    // songs.
+    if (!aError &&
+        !BaflUtils::FileExists(*iFs, *path))
+        {
+        aError = KErrPathNotFound;
+        }
+
+    return path;
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPlayerM3UPlaylistParser::ComposePlaylistL
+// -----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistImporter::ComposePlaylistL()
+    {
+    //
+    // instantiate a CMPXMedia that represent the playlist which will
+    // contain the CMPXMediaArray
+    //
+    iPlaylist = CMPXMedia::NewL();
+    
+    // set playlist title
+    TParsePtrC parser(iPlaylistFilePath);
+    iPlaylist->SetTextValueL(KMPXMediaGeneralTitle, parser.Name());
+    
+    // set playlist URI
+    iPlaylist->SetTextValueL(KMPXMediaGeneralUri, iPlaylistFilePath);
+        
+    // set type
+    iPlaylist->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem);
+        
+    // set category
+    iPlaylist->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXPlaylist);        
+
+    // set playlist array
+    iPlaylist->SetCObjectValueL(KMPXMediaArrayContents, iAutoEncodingPlaylistArray);
+        
+    // set array acount
+    iPlaylist->SetTObjectValueL(KMPXMediaArrayCount, iAutoEncodingPlaylistArray->Count());
+        
+    // playlist makes a copy of the array, we can now free the medias
+    // array
+    delete iAutoEncodingPlaylistArray;
+    iAutoEncodingPlaylistArray = NULL;
+    }
+    
+// ----------------------------------------------------------------------------
+// Cleanup. 
+// ----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistImporter::Cleanup()
+    {
+    delete iBuffer;
+    iBuffer = NULL;
+    
+    delete iLine;
+    iLine = NULL;   
+
+    delete iItem;
+    iItem = NULL;
+   
+    delete iAutoEncodingPlaylistArray;
+    iAutoEncodingPlaylistArray = NULL;
+    
+    delete iPlaylist;
+    iPlaylist = NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// Handles notifications to the client
+// ----------------------------------------------------------------------------
+//
+void CMPXM3uPlaylistImporter::NotifyClient( TInt aError )
+    {
+    MPX_DEBUG3("CMPXM3uPlaylistImporter::NotifyClient - iAutoEncodingInvalidItems=%d error=%d",
+        iAutoEncodingInvalidItems, aError);
+        
+    if ( iObserver )
+        {
+        if (aError)
+            {
+            // we don't need the playlist media to be passed back to the client
+            // in case of an error, delete it now
+            delete iAutoEncodingPlaylistArray;
+            iAutoEncodingPlaylistArray = NULL;
+
+            // to-do: change HandlePlaylistL to HandlePlaylist
+            TRAP_IGNORE(iObserver->HandlePlaylistL( NULL, aError, ETrue ));
+            }
+        else
+            {
+            // notify client. return the playlist media
+            CMPXMedia* playlist = iPlaylist;
+            iPlaylist = NULL; // client takes over the ownership
+            
+            // to-do: change HandlePlaylistL to HandlePlaylist
+            TRAP_IGNORE(iObserver->HandlePlaylistL( playlist, aError, ETrue ));
+            }
+        }        
+    }
+        
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/m3uplaylistplugin/src/mpxm3uplaylistplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of m3u playlist plugin interface
+*
+*  CMPXM3uPlaylistPlugin delegates the responsibilities for m3u playlist file
+*  import and export to CMPXM3uPlaylistImporter and CMPXM3uPlaylistExporter
+*  respectively.
+*
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32cmn.h>
+#include <implementationproxy.h>
+#include <mpxlog.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxplaylistpluginobserver.h>
+#include "mpxm3uplaylistimporter.h"
+#include "mpxm3uplaylistexporter.h"
+#include "mpxm3uplaylistplugin.h"
+#include "mpxm3uplaylistdefs.h"
+#include "mpxm3uplaylistdefs.hrh"
+
+    
+// ============================ MEMBER FUNCTIONS ==============================
+// ----------------------------------------------------------------------------
+// Constructor. 
+// ----------------------------------------------------------------------------
+CMPXM3uPlaylistPlugin::CMPXM3uPlaylistPlugin()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// 2nd phase constructor
+// ----------------------------------------------------------------------------
+void CMPXM3uPlaylistPlugin::ConstructL()
+    {
+    iRequiredAttributes.AppendL(KMPXMediaGeneralUri);
+    
+    iOptionalAttributes.AppendL(KMPXMediaGeneralTitle);
+    iOptionalAttributes.AppendL(KMPXMediaGeneralDuration);
+    }
+    
+// ----------------------------------------------------------------------------
+// Two-phased constructor. 
+// ----------------------------------------------------------------------------
+CMPXM3uPlaylistPlugin* CMPXM3uPlaylistPlugin::NewL(TAny* /*aInitParams*/)
+    {
+    CMPXM3uPlaylistPlugin* self=new(ELeave)CMPXM3uPlaylistPlugin();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor. 
+// ----------------------------------------------------------------------------
+CMPXM3uPlaylistPlugin::~CMPXM3uPlaylistPlugin()
+    {
+    delete iImporter;
+    delete iExporter;
+    iRequiredAttributes.Close();
+    iOptionalAttributes.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// Internalize a playlist
+// ----------------------------------------------------------------------------
+void CMPXM3uPlaylistPlugin::InternalizePlaylistL(
+    TRequestStatus& aStatus,
+    const TDesC& aPlaylistUri)
+    {
+    MPX_DEBUG1("CMPXM3uPlaylistPlugin::InternalizePlaylist(aPlaylistUri)");
+
+    // instantiate a new CMPXM3uPlaylistImporter to handle this request.
+    delete iImporter;
+    iImporter = NULL;
+
+    // processing starts as soon as object is instantiated. When request completes,
+    // client is notified through MMPXPlaylistPlugibObserver interface        
+    iImporter =
+        CMPXM3uPlaylistImporter::NewL(
+            iFs, iObserver, aPlaylistUri, *iTopCharacterSet, *iAvailableCharacterSet, aStatus );
+    }
+
+// ----------------------------------------------------------------------------
+// Externalize a playlist
+// ----------------------------------------------------------------------------
+void CMPXM3uPlaylistPlugin::ExternalizePlaylistL(
+    TRequestStatus& aStatus,
+    const CMPXMedia& aPlaylist,
+    const TDesC& aFilePath)
+    {
+    MPX_DEBUG1("CMPXM3uPlaylistPlugin::ExternalizePlaylistL");    
+
+    // instantiate a new CMPXM3uPlaylistExporter to handle this request
+    delete iExporter;
+    iExporter = NULL;
+    
+    // processing starts as soon as object is instantiated. When request completes,
+    // client is notified through MMPXPlaylistPlugibObserver interface        
+    iExporter =
+        CMPXM3uPlaylistExporter::NewL(
+            iFs, iObserver, aPlaylist, aFilePath, aStatus );
+    }
+
+// ----------------------------------------------------------------------------
+// Required attributes for the medias in the playlist in order to
+// externalize them to a playlist.
+// ----------------------------------------------------------------------------
+const TArray<TMPXAttribute> CMPXM3uPlaylistPlugin::RequiredAttributes() const
+    {
+    return iRequiredAttributes.Array();    
+    }
+
+// ----------------------------------------------------------------------------
+// Optional attributes for the medias in the playlist for externalizing
+// them to a playlist
+// ----------------------------------------------------------------------------
+const TArray<TMPXAttribute> CMPXM3uPlaylistPlugin::OptionalAttributes() const
+    {
+    return iOptionalAttributes.Array();    
+    }
+
+// ----------------------------------------------------------------------------
+// Returns the file extension the plugin handles
+// ----------------------------------------------------------------------------
+const TDesC& CMPXM3uPlaylistPlugin::FileExtension() const
+    {
+    return KMPXM3UExtension();
+    }
+
+// ----------------------------------------------------------------------------
+// cancel a client request
+// ----------------------------------------------------------------------------
+void CMPXM3uPlaylistPlugin::Cancel()
+    {
+    if ( iImporter )
+        {
+        iImporter->Cancel();
+        }
+        
+    if ( iExporter )
+        {
+        iExporter->Cancel();
+        }
+    }
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// ----------------------------------------------------------------------------
+// The list of implementations
+// ----------------------------------------------------------------------------
+const TImplementationProxy ImplementationTable[] = 
+    { IMPLEMENTATION_PROXY_ENTRY(KMPXM3uPlaylistImplUid, CMPXM3uPlaylistPlugin::NewL) };
+
+// ----------------------------------------------------------------------------
+// The proxy of implementations
+// ----------------------------------------------------------------------------
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount=sizeof(ImplementationTable)/sizeof(TImplementationProxy);
+    return ImplementationTable;
+    }
+    
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/playlistplugins/rom/mpxm3uplaylistplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project m3uplaylistplugin
+*
+*/
+
+
+
+#ifndef MPXM3UPLAYLISTPLUGIN_IBY
+#define MPXM3UPLAYLISTPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+file=ABI_DIR\BUILD_DIR\mpxm3uplaylistparsers.dll       SHARED_LIB_DIR\mpxm3uplaylistparsers.dll
+ECOM_PLUGIN( mpxm3uplaylistplugin.dll, 101FFC22.rsc )
+
+#endif // MPXM3UPLAYLISTPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project Screen Saver plugins.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../mpxscreensaverplugin/group/bld.inf"
+
+PRJ_EXPORTS
+../rom/mpxscreensaverplugin.iby         CORE_APP_LAYER_IBY_EXPORT_PATH(mpxscreensaverplugin.iby)
+../rom/mpxscreensaverpluginrsc.iby      LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxscreensaverpluginrsc.iby)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/data/101ffc13.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxscreensaverplugin
+*
+*/
+
+
+//  INCLUDES
+#include <ecom/registryinfo.rh>
+#include <ScreensaverpluginIntDef.hrh>
+
+#include "mpxscreensaverpluginimplementationuid.hrh"
+#include "mpxscreensaverplugin.loc"
+
+
+//  RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+//   
+// theInfo
+// ECOM DLL interface & implementation description resource.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC13;
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KCScreensaverPluginInterfaceDefinitionUid;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid =KMPXScreenSaverPluginImplementationUID;
+                    version_no = 1;
+                    display_name = qtn_screensaver_now_playing;
+                    default_data = "";
+                    opaque_data = KScrPluginCapabilitiesSelectionNotificationStr;
+                    }
+                };
+            }
+        };
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/data/mpxscreensaverplugin.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,829 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxscreensaverplugin
+*
+*/
+
+
+//  RESOURCE IDENTIFIER
+
+NAME    MXSS // 4 letter ID
+
+#include <eikon.rh>
+#include <avkon.rh>
+#include <avkon.rsg>
+#include <avkon.loc>
+
+#include "mpxscreensaverplugin.rh"
+#include "mpxscreensaverplugin.hrh"
+#include <mpxscreensaverplugin.loc>
+
+
+// ---------------------------------------------------------
+//
+// Define the resource file signature
+// This resource should be empty.
+//
+// ---------------------------------------------------------
+//
+
+RESOURCE RSS_SIGNATURE
+    {
+    }
+
+RESOURCE TBUF
+    {
+    buf = "";
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_time_usual_without_ampm
+// time resource without AM/PM
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_screensaver_time_usual_without_ampm
+    {
+    buf = "%J%:1%T";
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm
+// AM/PM format
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_screensaver_ampm
+    {
+    buf = "%*A";
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_display_name
+// Display name
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_screensaver_display_name
+    {
+    buf = qtn_screensaver_now_playing;
+    }
+
+// LAYOUT
+
+// lowres portrait
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_background_height_lowres_portrait
+// background height.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MPXINT r_mpx_screensaver_background_height_lowres_portrait
+    {
+    mpxinteger = 87;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_pb_indi_layout_lowres_portrait
+// Image layout for playback indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_pb_indi_layout_lowres_portrait
+    {
+    l = 5; t = 45; W = 14; H = 13;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_indi_layout_lowres_portrait
+// Image layout for other indicators.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_indi_layout_lowres_portrait
+    {
+    l = 24; t = 63; W = 147; H = 9;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_title_layout_lowres_portrait
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_title_layout_lowres_portrait
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 24; r = 5; B = 52; W = 147; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_lowres_portrait
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_lowres_portrait
+    {
+    font = EAknLogicalFontDigitalFont; C = 215; l = 145; r = 5; B = 38; W = 26; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_lowres_portrait_arabic
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_lowres_portrait_arabic
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 145; r = 5; B = 38; W = 26; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm_layout_lowres_portrait
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_ampm_layout_lowres_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 159; r = 5; B = 24; W = 14; J = ELayoutAlignRight;
+    }
+
+
+// double portrait
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_background_height_double_portrait
+// background height.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MPXINT r_mpx_screensaver_background_height_double_portrait
+    {
+    mpxinteger = 177;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_pb_indi_layout_double_portrait
+// Image layout for playback indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_pb_indi_layout_double_portrait
+    {
+    l = 10; t = 90; W = 29; H = 28;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_indi_layout_double_portrait
+// Image layout for other indicators.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_indi_layout_double_portrait
+    {
+    l = 46; t = 128; W = 296; H = 19;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_title_layout_double_portrait
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_title_layout_double_portrait
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 44; r = 10; B = 108; W = 298; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_double_portrait
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_double_portrait
+    {
+    font = EAknLogicalFontDigitalFont; C = 215; l = 291; r = 10; B = 76; W = 56; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_double_portrait_arabic
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_double_portrait_arabic
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 291; r = 10; B = 76; W = 56; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm_layout_double_portrait
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_ampm_layout_double_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 311; r = 10; B = 48; W = 31; J = ELayoutAlignRight;
+    }
+
+
+// qvga portrait
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_background_height_qvga_portrait
+// background height.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MPXINT r_mpx_screensaver_background_height_qvga_portrait
+    {
+    mpxinteger = 135;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_pb_indi_layout_qvga_portrait
+// Image layout for playback indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_pb_indi_layout_qvga_portrait
+    {
+    l = 6; t = 70; W = 21; H = 20;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_indi_layout_qvga_portrait
+// Image layout for other indicators.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_indi_layout_qvga_portrait
+    {
+    l = 32; t = 98; W = 202; H = 14;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_qvga_portrait
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_qvga_portrait
+    {
+    font = EAknLogicalFontDigitalFont; C = 215; l = 197; r = 6; B = 59; W = 37; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_qvga_portrait_arabic
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_qvga_portrait_arabic
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 197; r = 6; B = 59; W = 37; J = ELayoutAlignRight;
+    }
+
+#if defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS) || defined(__JAPANESE)
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_title_layout_qvga_portrait
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_title_layout_qvga_portrait
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 32; r = 6; B = 91; W = 202; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm_layout_qvga_portrait
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_ampm_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 214; r = 6; B = 44; W = 20; J = ELayoutAlignRight;
+    }
+
+#else
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_title_layout_qvga_portrait
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_title_layout_qvga_portrait
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 32; r = 6; B = 83; W = 202; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm_layout_qvga_portrait
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_ampm_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 214; r = 6; B = 39; W = 20; J = ELayoutAlignRight;
+    }
+
+#endif // defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS)
+        
+
+// lowres landscape
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_background_height_lowres_landscape
+// background height.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MPXINT r_mpx_screensaver_background_height_lowres_landscape
+    {
+    mpxinteger = 87;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_pb_indi_layout_lowres_landscape
+// Image layout for playback indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_pb_indi_layout_lowres_landscape
+    {
+    l = 7; t = 44; W = 14; H = 13;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_indi_layout_lowres_landscape
+// Image layout for other indicators.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_indi_layout_lowres_landscape
+    {
+    l = 28; t = 63; W = 147; H = 9;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_title_layout_lowres_landscape
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_title_layout_lowres_landscape
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 28; r = 28; B = 52; W = 152; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_lowres_landscape
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_lowres_landscape
+    {
+    font = EAknLogicalFontDigitalFont; C = 215; l = 160; r = 22; B = 35; W = 26; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_lowres_landscape_arabic
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_lowres_landscape_arabic
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 160; r = 22; B = 35; W = 26; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm_layout_lowres_landscape
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_ampm_layout_lowres_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 190; r = 4; B = 35; W = 14; J = ELayoutAlignRight;
+    }
+
+
+// double landscape
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_background_height_double_landscape
+// background height.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MPXINT r_mpx_screensaver_background_height_double_landscape
+    {
+    mpxinteger = 174;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_pb_indi_layout_double_landscape
+// Image layout for playback indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_pb_indi_layout_double_landscape
+    {
+    l = 14; t = 89; W = 28; H = 26;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_indi_layout_double_landscape
+// Image layout for other indicators.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_indi_layout_double_landscape
+    {
+    l = 56; t = 126; W = 316; H = 18;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_title_layout_double_landscape
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_title_layout_double_landscape
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 56; r = 31; B = 106; W = 316; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_double_landscape
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_double_landscape
+    {
+    font = EAknLogicalFontDigitalFont; C = 215; l = 320; r = 44; B = 50; W = 52; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_double_landscape_arabic
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_double_landscape_arabic
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 320; r = 44; B = 50; W = 52; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm_layout_double_landscape
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_ampm_layout_double_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 380; r = 8; B = 50; W = 28; J = ELayoutAlignRight;
+    }
+
+
+// qvga landscape
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_background_height_qvga_landscape
+// background height.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MPXINT r_mpx_screensaver_background_height_qvga_landscape
+    {
+    mpxinteger = 120;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_pb_indi_layout_qvga_landscape
+// Image layout for playback indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_pb_indi_layout_qvga_landscape
+    {
+    l = 11; t = 60; W = 21; H = 20;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_indi_layout_qvga_landscape
+// Image layout for other indicators.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_indi_layout_qvga_landscape
+    {
+    l = 42; t = 86; W = 247; H = 13;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_title_layout_qvga_landscape
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_title_layout_qvga_landscape
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 42; r = 31; B = 73; W = 247; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_qvga_landscape
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_qvga_landscape
+    {
+    font = EAknLogicalFontDigitalFont; C = 215; l = 247; r = 31; B = 50; W = 43; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_qvga_landscape_arabic
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_qvga_landscape_arabic
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 247; r = 31; B = 50; W = 43; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm_layout_qvga_landscape
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_ampm_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 291; r = 7; B = 50; W = 19; J = ELayoutAlignRight;
+    }
+
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_background_height_qhd_portrait
+// background height.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MPXINT r_mpx_screensaver_background_height_qhd_portrait
+    {
+    mpxinteger = 176;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_pb_indi_layout_qhd_portrait
+// Image layout for playback indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_pb_indi_layout_qhd_portrait
+    {
+    l = 10; t = 90; W = 29; H = 28;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_indi_layout_qhd_portrait
+// Image layout for other indicators.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_indi_layout_qhd_portrait
+    {
+    l = 46; t = 128; W = 296; H = 19;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_title_layout_qhd_landscape
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_title_layout_qhd_portrait
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 44; r = 10; B = 118; W = 298; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm_layout_qhd_portrait
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_ampm_layout_qhd_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 311; r = 10; B = 48; W = 31; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_qhd_portrait
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_qhd_portrait
+    {
+    font = EAknLogicalFontDigitalFont; C = 215; l = 291; r = 10; B = 76; W = 56; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_qhd_portrait_arabic
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_qhd_portrait_arabic
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 291; r = 10; B = 76; W = 56; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_background_height_qhd_landscape
+// background height.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MPXINT r_mpx_screensaver_background_height_qhd_landscape
+    {
+    mpxinteger = 174;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_pb_indi_layout_qhd_landscape
+// Image layout for playback indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_pb_indi_layout_qhd_landscape
+    {
+    l = 14; t = 89; W = 28; H = 26;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_indi_layout_qhd_landscape
+// Image layout for other indicators.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_indi_layout_qhd_landscape
+    {
+    l = 46; t = 128; W = 296; H = 19;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_title_layout_qhd_landscape
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_title_layout_qhd_landscape
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 44; r = 10; B = 115; W = 298; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm_layout_qhd_landscape
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_ampm_layout_qhd_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 311; r = 10; B = 48; W = 31; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_qhd_landscape
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_qhd_landscape
+    {
+    font = EAknLogicalFontDigitalFont; C = 215; l = 291; r = 10; B = 76; W = 56; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_qhd_landscape_arabic
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_qhd_landscape_arabic
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 291; r = 10; B = 76; W = 56; J = ELayoutAlignRight;
+    }
+
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_background_height_vga_portrait
+// background height.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MPXINT r_mpx_screensaver_background_height_vga_portrait
+    {
+    mpxinteger = 135;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_pb_indi_layout_vga_portrait
+// Image layout for playback indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_pb_indi_layout_vga_portrait
+    {
+    l = 12; t = 90; W = 31; H = 28;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_indi_layout_vga_portrait
+// Image layout for other indicators.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_indi_layout_vga_portrait
+    {
+    l = 52; t = 125; W = 404; H = 22;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_title_layout_vga_portrait
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_title_layout_vga_portrait
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 52; r = 12; B = 109; W = 404; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm_layout_vga_portrait
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_ampm_layout_vga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 430; l = 428; r = 12; B = 42; W = 40; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_vga_portrait
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_vga_portrait
+    {
+    font = EAknLogicalFontDigitalFont; C = 430; l = 394; r = 12; B = 75; W = 74; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_vga_portrait_arabic
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_vga_portrait_arabic
+    {
+    font = EAknLogicalFontSecondaryFont; C = 430; l = 394; r = 12; B = 75; W = 74; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_background_height_vga_landscape
+// background height.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MPXINT r_mpx_screensaver_background_height_vga_landscape
+    {
+    mpxinteger = 174;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_pb_indi_layout_vga_landscape
+// Image layout for playback indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_pb_indi_layout_vga_landscape
+    {
+    l = 14; t = 89; W = 31; H = 28;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_indi_layout_vga_landscape
+// Image layout for other indicators.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_screensaver_indi_layout_vga_landscape
+    {
+    l = 64; t = 124; W = 296; H = 22;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_title_layout_vga_landscape
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_title_layout_vga_landscape
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 64; r = 10; B = 107; W = 298; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_ampm_layout_vga_landscape
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_ampm_layout_vga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 311; r = 10; B = 73; W = 31; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_vga_landscape
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_vga_landscape
+    {
+    font = EAknLogicalFontDigitalFont; C = 215; l = 291; r = 64; B = 73; W = 56; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_screensaver_clock_layout_vga_landscape_arabic
+// Label layout for clock.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_screensaver_clock_layout_vga_landscape_arabic
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 291; r = 64; B = 73; W = 56; J = ELayoutAlignRight;
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxscreensaverplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS 
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxscreensaverplugin.loc		APP_LAYER_LOC_EXPORT_PATH(mpxscreensaverplugin.loc)
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxscreensaverplugin.mif
+OPTION HEADERFILE mpxscreensaverplugin.mbg
+OPTION SOURCEFILE iconlist.txt
+END
+
+
+PRJ_MMPFILES
+
+
+mpxscreensaverplugin.mmp
+
+PRJ_TESTMMPFILES
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,12 @@
+-c8,8 qgn_graf_mup_npv_icon_pause
+-c8,8 qgn_graf_mup_npv_icon_play
+-c8,8 qgn_stat_im_uni
+-c8,8 qgn_stat_keyguard
+-c8,8 qgn_stat_message
+-c8,8 qgn_stat_message_mail
+-c8,8 qgn_stat_missed_calls_uni
+-c8,8 qgn_stat_vm0
+-c8,8 qgn_graf_mup_ss_bgnd_01
+-c8,8 qgn_graf_mup_ss_bgnd_02
+-c8,8 qgn_graf_mup_ss_bgnd_03
+-c8,8 qgn_graf_mup_ss_bgnd_04
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/group/mpxscreensaverplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxscreensaverplugin.
+*
+*/
+
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxscreensaverplugin.dll
+TARGETTYPE      PLUGIN 
+UID             0x10009D8D 0x101FFC13
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+START RESOURCE ../data/101ffc13.rss 
+TARGET      mpxscreensaverplugin.rsc
+END
+
+START RESOURCE  ../data/mpxscreensaverplugin.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END  // RESOURCE
+
+SOURCEPATH      ../src
+SOURCE          mpxscreensaverplugin.cpp
+SOURCE          mpxscreensaverpluginproxy.cpp
+SOURCE          mpxscreensaverplugincontainer.cpp
+
+USERINCLUDE     ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+LIBRARY         ecom.lib 
+LIBRARY         euser.lib
+LIBRARY         fbscli.lib 
+LIBRARY         cone.lib 
+LIBRARY         efsrv.lib 
+LIBRARY         bafl.lib
+LIBRARY         egul.lib 
+LIBRARY         aknskins.lib
+LIBRARY         aknicon.lib              // AknIconUtils 
+LIBRARY         aknlayout2scalable.lib   // Scalable UI
+LIBRARY         avkon.lib 
+LIBRARY         bitgdi.lib
+LIBRARY         gdi.lib
+LIBRARY         profileeng.lib
+LIBRARY         commonengine.lib         // string loader
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         eikcoctl.lib
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/group/mpxscreensaverpluginicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxscreensaverplugin
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxscreensaverplugin.mif
+HEADERFILENAME=$(HEADERDIR)/mpxscreensaverplugin.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/inc/mpxscreensaverplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Screen Saver Plugin implementation
+*
+*/
+
+
+#ifndef C_CMPXSCREENSAVERPLUGIN_H
+#define C_CMPXSCREENSAVERPLUGIN_H
+
+// INCLUDES
+#include <ScreensaverpluginIntDef.h>
+#include <screensaverplugin.h>
+#include <mpxplaybackobserver.h>
+
+// CLASS DECLARATION
+class CEikonEnv;
+class MMPXPlaybackUtility;
+class MAknsSkinInstance;
+class TAknsItemID;
+class CMPXScreenSaverPluginContainer;
+class MProfileEngine;
+class MProfile;
+    
+/**
+*  Screen saver plugin for music player now playing view
+*  @lib mpxscreensaverplugin.lib
+*  @since 3.0
+*/
+ 
+class CMPXScreenSaverPlugin: public CScreensaverPluginInterfaceDefinition,
+                             public MMPXPlaybackObserver,
+                             public MMPXPlaybackCallback
+{    
+public: 
+
+    /**
+    * Two-phased constructor.
+    * @since 3.1
+    */
+    static CMPXScreenSaverPlugin* NewL();
+    
+    /**
+    * Destructor.
+    */
+    virtual ~CMPXScreenSaverPlugin();     
+    
+public: // Functions From CScreensaverPluginInterfaceDefinition        
+    
+    /**
+    * From MScreensaverPlugin, Method called by ScreenSaver Application
+    * when an animation file is configured as a Screen Saver.
+    * @param aHost  Screen saver plugin host.
+    * @since 3.1
+    */
+    virtual TInt InitializeL( MScreensaverPluginHost *aHost );
+        
+    /**
+    * From MScreensaverPlugin, Method called by ScreenSaver Application
+    * when Screen Saver is activated.
+    * @since 3.1
+    */
+    virtual TInt Draw( CWindowGc& aGc );
+    
+    /**
+    * From MScreensaverPlugin, Method called by ScreenSaver Application
+    * before the InitializeL.
+    * @since 3.1
+    */
+    virtual const TDesC16& Name() const;
+    
+    /**
+    * From MScreensaverPlugin, Method called by ScreenSaver Application
+    * to get the capabilities of Screensaver plugin.
+    * @since 3.1
+    */
+    virtual TInt Capabilities();
+    
+    /**
+    * From MScreensaverPlugin, Method called by Psln Application
+    * when the user selects Animated ScreenSaver 
+    * @since 3.1
+    */
+    virtual TInt PluginFunction(
+            TScPluginCaps /*aFunction*/,
+            TAny* /*aParam*/ );
+
+    /**
+    * From MScreensaverPlugin, Method called by ScreenSaver Application
+    * when there are Screen Saver events.
+    * @since 3.1
+    */
+    virtual TInt HandleScreensaverEventL(
+            TScreensaverEvent aEvent,
+            TAny* aData );       
+    
+private:
+
+    /**
+    * Default Constructor
+    * @since 3.1
+    */  
+    CMPXScreenSaverPlugin();
+    
+    /**
+    * 2nd phase constructor
+    * @since 3.1
+    */
+    void ConstructL();
+
+// from base class MMPXPlaybackObserver
+
+    /**
+     * From MMPXPlaybackObserver
+     * Handle playback message
+     * 
+     * @param aMessage playback message
+     * @param aErr system error code.
+     */
+    void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+// from base class MMPXPlaybackCallback
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle playback property
+     *
+     * @param aProperty the property
+     * @param aValue the value of the property
+     * @param aError error code
+     */
+    void HandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue, 
+        TInt aError );
+    
+    /**
+     * 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
+     *
+     * @param aPlayer UID of the subplayer
+     * @param aSubPlayers a list of sub players
+     * @param aComplete ETrue no more sub players. EFalse more subplayer
+     *                  expected
+     * @param aError error code
+     */
+    void HandleSubPlayerNamesL(
+        TUid aPlayer, 
+        const MDesCArray* aSubPlayers,
+        TBool aComplete,
+        TInt aError );
+    
+    /**
+     * From MMPXPlaybackCallback
+     * Handle extended media properties
+     *
+     * @param aMedia media 
+     * @param aError error code    
+     */
+    void HandleMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );     
+    
+    /**
+     *  Handle playback message
+     *
+     *  @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL( 
+        const CMPXMessage& aMessage );
+    
+    /**
+     *  Handle media properties.
+     *  
+     *  @param aProperties media properties
+     *  @param aError error code    
+     */
+    void DoHandleMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     */
+    void DoHandleStateChangedL(
+        TMPXPlaybackState aState );       
+        
+    /**
+     *  Creates the container
+     */
+    void CreateContainerL();    
+           
+private:
+    // Pointer to the screen saver host
+    MScreensaverPluginHost*     iScreenSaverHost;        
+
+    CEikonEnv*                  iEikEnv;  
+    MMPXPlaybackUtility*        iPlaybackUtility;  // not own
+    CMPXScreenSaverPluginContainer*     iContainer;  
+    MProfileEngine*             iProfileEngine; // not own
+    
+    TMPXPlaybackState           iPlaybackState;
+    TInt                        iResourceOffset;          
+    TBool                       iTimerChanged;           
+    
+    HBufC*                      iDisplayName;
+};  
+
+#endif // C_CMPXSCREENSAVERPLUGIN_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/inc/mpxscreensaverplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxscreensaverplugin
+*
+*/
+
+
+#ifndef MPXSCREENSAVERPLUGIN_HRH
+#define MPXSCREENSAVERPLUGIN_HRH
+
+// Events sent to plugin by Screensaver 
+enum MPXScreenSaverPluginParam
+    {
+    MPXScreenSaverPluginParamMissedCall = 0,
+    MPXScreenSaverPluginParamNewMessage,
+    MPXScreenSaverPluginParamInstantMessage,
+    MPXScreenSaverPluginParamEmail,
+    MPXScreenSaverPluginParamVoiceMessage,
+    MPXScreenSaverPluginParamKeyguard,
+    MPXScreenSaverPluginParamIsSilent
+    };
+    
+enum MPXScreenSaverPluginControl
+    {
+    MPXScreenSaverPluginIndicatorPlaybackStatus,
+    MPXScreenSaverPluginIndicatorOther,
+    MPXScreenSaverPluginLabelTitle,
+    MPXScreenSaverPluginLabelClock,
+    MPXScreenSaverPluginLabelAmPm
+    };    
+
+#endif // MPXSCREENSAVERPLUGIN_HRH
+
+// End of file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/inc/mpxscreensaverplugin.rh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource header for project mpxscreensaverplugin
+*
+*/
+
+
+
+STRUCT MPXINT
+    {
+    WORD mpxinteger;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/inc/mpxscreensaverplugincontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Screen Saver Plugin container
+*
+*/
+
+
+#ifndef C_CMPXSCREENSAVERPLUGINCONTAINER_H
+#define C_CMPXSCREENSAVERPLUGINCONTAINER_H
+
+// INCLUDES
+#include "mpxscreensaverplugin.hrh"
+
+// CLASS DECLARATION
+class CEikonEnv;
+class MAknsSkinInstance;
+class TAknsItemID;
+class MScreensaverPluginHost;
+class CEikLabel;
+
+/**
+*  Screen saver plugin container for music player now playing view
+*  @lib mpxscreensaverplugin.lib
+*  @since 3.0
+*/
+
+class CMPXScreenSaverPluginContainer: public CBase
+{
+public:
+    /**
+    * Default Constructor
+    * @since 3.0
+    */
+    CMPXScreenSaverPluginContainer( MScreensaverPluginHost *aHost );
+
+    /**
+    * 2nd phase constructor
+    * @since 3.0
+    */
+    void ConstructL();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CMPXScreenSaverPluginContainer();
+
+public:
+    /**
+    * @param aGc window GC for drawing
+    * @param aPlaybackState current play state
+    * @since 3.0
+    */
+    virtual TInt DrawL( CWindowGc& aGc, TMPXPlaybackState aPlaybackState );
+
+    /**
+    * Sets song properties
+    * @since 3.0
+    */
+    void SetSongPropertiesL( const CMPXMedia& aMedia );
+
+    /**
+    * Set parameter
+    * @param aType parameter type
+    * @param aValue parameter value
+    */
+    void SetParam( MPXScreenSaverPluginParam aType, TInt aValue );
+
+    /**
+     * Set profile name
+     *
+     * @param aName profile name
+     * @param aDisplay ETrue to display the profile name, otherwise EFalse
+     */
+    void SetProfileNameL( const TDesC& aName, TBool aDisplay );
+
+    /**
+    * Called to get display info
+    * @since 3.0
+    */
+    void RefreshDisplayInfo();
+
+private:
+
+    /**
+     * Creates the icons.
+     *
+     * @since 3.0
+     * @return CGulIcon     Indicator graphic and mask. Ownership
+     *                      transferred to caller.
+     */
+    void CreateIconsL();
+
+    /**
+     * Create a color icon.
+     *
+     * @param aID       skin id of the icon
+     * @param aColorId  Item ID of the color table. if KAknsIIDNone is used, the icon
+     *                  created will use the original color specified in the file
+     * @param aColorIndex Index in the color table.
+     * @param aBitmapFilename Filename to be used to construct the item.
+     * @param aFileBitmapId ID of the bitmap in the file.
+     * @param aFileMaskId ID of the mask in the file.
+     * @param aIsIndicator ETrue if it's an indicator, it'll change the icon color
+     *                     to match other indicator's color. EFalse will not change
+     *                     icon color
+     */
+    CGulIcon* CreateIconL(
+        const TAknsItemID& aID,
+        const TAknsItemID& aColorId,
+        TInt aColorIndex,
+        const TDesC& aBitmapFilename,
+        TInt aFileBitmapId,
+        TInt aFileMaskId,
+        TBool aIsIndicator );
+
+    /**
+     * Load the backgrounds, and resize them to screen size
+     *
+     */
+    void LoadBackgroundsL();
+
+    /**
+     * Draws the clock
+     * @since 3.0
+     */
+    void DrawClockL( CBitmapContext& aGc );
+
+    /**
+     * Draws background
+     * @since 3.0
+     */
+    void DrawBackground( CBitmapContext& aGc, TInt aColorIndex );
+
+    /**
+     * Draws playback information (playback status, song title)
+     * @since 3.0
+     */
+    void DrawPlaybackStatusL( CBitmapContext& aGc, TMPXPlaybackState aPlaybackState );
+
+    /**
+     * Draws indicators
+     * @since 3.0
+     */
+    void DrawIndicatorsL( CBitmapContext& aGc );
+
+    /**
+     * Draws indicators on offscreenbitmap
+     * @since 3.0
+     */
+    void DoDrawIndicatorsL( CBitmapContext& aGc,
+        TInt aDisplayNumber, CGulIcon* aDisplayIcon,
+        CFont* aFont, TRect aRect, TSize aSize );
+
+    /**
+     * Get layout data for an graphical indicator.
+     *
+     * @since 3.0
+     * @param  aIndicator Enumeration value identifying the indicator
+     * @return Layout data
+     */
+    TRect IndicatorLayout(
+        MPXScreenSaverPluginControl aControl );
+
+    /*
+     * Get layout data for an label indicator.
+     *
+     * @since 3.0
+     * @param  aIndicator Enumeration value identifying the indicator
+     */
+    void LabelLayoutL(
+        MPXScreenSaverPluginControl aControl );
+
+    /*
+     * Get background height.
+     *
+     * @since 3.0
+     * @return background height for current resolution
+     */
+    TInt BackgroundHeightL();
+
+    /**
+     * Get draw position and background color index, draw position is stored
+     * in member variable iStartY
+     *
+     * @return background color index
+     */
+    TInt GetDrawPositionAndColorIndexL();
+
+    /**
+     * Resizes all the icons and rects to match current screen size
+     */
+    void UpdateLayoutL();
+
+private:
+    // Pointer to the screen saver host
+    MScreensaverPluginHost*     iScreenSaverHost;
+
+    CCoeControl*                iParentControl;
+    CEikonEnv*                  iEikEnv;
+    HBufC*                      iProfileName;
+    TInt                        iStartY;
+    TInt                        iStartX;
+    TInt                        iNewMessage;
+    TInt                        iMissedCall;
+    TInt                        iNewInstantMessage;
+    TInt                        iNewVoiceMessage;
+    TInt                        iNewEmail;
+    TInt                        iKeyguard;
+    TBool                       iIsSilent;
+
+    CGulIcon*                   iPlayIcon;  // owned
+    CGulIcon*                   iPauseIcon; // owned
+    CGulIcon*                   iMessageIcon;
+    CGulIcon*                   iMissedCallIcon;
+    CGulIcon*                   iNewInstantMessageIcon;
+    CGulIcon*                   iNewVoiceMessageIcon;
+    CGulIcon*                   iNewEmailIcon;
+    CGulIcon*                   iKeyguardIcon;
+    RPointerArray<CGulIcon>     iBackground;
+
+    CEikLabel*                  iTitleLabel;
+    CEikLabel*                  iClockLabel;
+    CEikLabel*                  iAmPmLabel;
+    CFont*                      iIndicatorFont;
+
+    CFbsBitmap*                 iOffScreenBitmap; // owned
+    CFbsBitGc*                  iOSBitmapContext; // owned
+    CFbsBitmapDevice*           iOSBitmapDevice;  // owned
+
+    TSize                       iScreenSize;
+    TRect                       iRectIndicators;
+    TRect                       iRectPlaybackStatus;
+};
+
+#endif // C_CMPXSCREENSAVERPLUGINCONTAINER_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/inc/mpxscreensaverpluginimplementationuid.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxscreensaverplugin
+*
+*/
+
+
+
+#ifndef MPXSCREENSAVERIMPLEMENTATIONUID_HRH
+#define MPXSCREENSAVERIMPLEMENTATIONUID_HRH
+
+#define KMPXScreenSaverPluginImplementationUID 0x101FFC14
+
+#endif // MPXSCREENSAVERIMPLEMENTATIONUID_HRH
+// End of File 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/loc/mpxscreensaverplugin.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxscreensaverplugin
+*
+*/
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+// LOCALISATION STRINGS
+
+// d:Display name in settings view.
+// l:list_set_graphic_pane_t1
+// r:3.1
+//
+#define qtn_screensaver_now_playing "Now Playing"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/src/mpxscreensaverplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,514 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Screen Saver Plugin
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <eikenv.h>
+#include <bautils.h>
+#include <AknUtils.h>
+#include <data_caging_path_literals.hrh>
+#include <MProfileEngine.h>
+#include <MProfile.h>
+#include <MProfileName.h>
+#include <Profile.hrh> // profile ID
+#include <StringLoader.h>
+
+#include <mpxscreensaverplugin.rsg>
+#include <mpxscreensaverplugin.mbg>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxmedia.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxlog.h>
+#include <mpxuser.h>
+
+#include "mpxscreensaverplugin.hrh"
+#include "mpxscreensaverplugincontainer.h"
+#include "mpxscreensaverplugin.h"
+
+// Constants
+const TInt KTimerInterval = 30000000; // 30 seconds
+const TInt KTimerForceNextUpdateInterval = 1000; // 1 milli second
+
+_LIT( KResourceFileName, "mpxscreensaverplugin.rsc" );
+
+// ---------------------------------------------------------------------------
+// CMPXScreenSaverPlugin::NewL
+// ---------------------------------------------------------------------------
+//
+CMPXScreenSaverPlugin* CMPXScreenSaverPlugin::NewL()
+    {
+    MPX_FUNC( "CMPXScreenSaverPlugin::NewL" );
+    CMPXScreenSaverPlugin* self = new ( ELeave ) CMPXScreenSaverPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXScreenSaverPlugin::~CMPXScreenSaverPlugin
+// ----------------------------------------------------------------------------
+//
+CMPXScreenSaverPlugin::~CMPXScreenSaverPlugin()
+    {
+    MPX_DEBUG1( "CMPXScreenSaverPlugin::~CMPXScreenSaverPlugin START" );
+    if ( iResourceOffset != 0 )
+        {
+        iEikEnv->DeleteResourceFile( iResourceOffset );
+        }
+    if ( iPlaybackUtility )
+        {
+        iPlaybackUtility->Close();
+        }
+
+    if ( iProfileEngine )
+        {
+        iProfileEngine->Release();
+        }
+
+    if ( iContainer )
+        {
+        delete iContainer;
+        }
+
+    delete iDisplayName;
+
+    MPX_DEBUG1( "CMPXScreenSaverPlugin::~CMPXScreenSaverPlugin END" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPlugin::InitializeL
+// -----------------------------------------------------------------------------
+//
+TInt CMPXScreenSaverPlugin::InitializeL( MScreensaverPluginHost *aHost )
+    {
+    MPX_FUNC( "CMPXScreenSaverPlugin::InitializeL" );
+    if ( !aHost )
+        {
+        return KErrCancel;
+        }
+    iScreenSaverHost = aHost;
+    iScreenSaverHost->OverrideStandardIndicators();
+    iScreenSaverHost->UseRefreshTimer( ETrue );
+    iScreenSaverHost->SetRefreshTimerValue( KTimerInterval );
+
+    CreateContainerL();
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPlugin::Draw
+// -----------------------------------------------------------------------------
+//
+TInt CMPXScreenSaverPlugin::Draw( CWindowGc& aGc )
+    {
+    MPX_FUNC( "CMPXScreenSaverPlugin::Draw" );
+
+    TInt status = KErrNone;
+    TIndicatorPayload result;
+
+    // EScreensaverEventStarting event should come before draw
+    // iContainer should be available
+    // Check for missed calls
+    status = iScreenSaverHost->GetIndicatorPayload(
+        EScreensaverIndicatorIndexNewMissedCalls, result );
+    MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
+    MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexNewMissedCalls iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
+    if ( KErrNone == status)
+        {
+        iContainer->SetParam( MPXScreenSaverPluginParamMissedCall,
+            result.iInteger );
+        }
+
+    // Check for new messages
+    status = iScreenSaverHost->GetIndicatorPayload(
+        EScreensaverIndicatorIndexNewMessages, result );
+    MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
+    MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexNewMessages iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
+    if ( KErrNone == status )
+        {
+        iContainer->SetParam( MPXScreenSaverPluginParamNewMessage,
+            result.iInteger );
+        }
+
+    // Check for new instant messages
+    status = iScreenSaverHost->GetIndicatorPayload(
+        EScreensaverIndicatorIndexChatMessage, result );
+    MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
+    MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexChatMessage iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
+    if ( KErrNone == status )
+        {
+        iContainer->SetParam( MPXScreenSaverPluginParamInstantMessage,
+            result.iIsDisplayed ? 1: 0 );
+        }
+
+    // Check for new email
+    status = iScreenSaverHost->GetIndicatorPayload(
+        EScreensaverIndicatorIndexEmail, result );
+    MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
+    MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexEmail iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
+    if ( KErrNone == status )
+        {
+        iContainer->SetParam( MPXScreenSaverPluginParamEmail,
+            result.iIsDisplayed ? 1: 0 );
+        }
+
+    // Check for new voice messages
+    status = iScreenSaverHost->GetIndicatorPayload(
+        EScreensaverIndicatorIndexVoicemail, result );
+    MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
+    MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexVoicemail iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
+    if ( KErrNone == status )
+        {
+        iContainer->SetParam( MPXScreenSaverPluginParamVoiceMessage,
+            result.iIsDisplayed ? 1: 0 );
+        }
+
+    // Check for keyguard
+    status = iScreenSaverHost->GetIndicatorPayload(
+        EScreensaverIndicatorIndexKeyGuardState, result );
+    MPX_DEBUG2( "CMPXScreenSaverPlugin::Draw status = %d", status );
+    MPX_DEBUG4( "CMPXScreenSaverPlugin::Draw EScreensaverIndicatorIndexKeyGuardState iType = %d, iInteger = %d, iIsDisplayed = %d", result.iType, result.iInteger, result.iIsDisplayed );
+    if ( KErrNone == status )
+        {
+        iContainer->SetParam( MPXScreenSaverPluginParamKeyguard,
+            result.iIsDisplayed ? 1: 0 );
+        }
+
+    TRAP_IGNORE( iContainer->DrawL( aGc, iPlaybackState ) );
+
+    if ( iTimerChanged )
+        {
+        MPX_DEBUG1( "CMPXScreenSaverPlugin::Draw Revert back to original timer" );
+        iScreenSaverHost->SetRefreshTimerValue( KTimerInterval );
+        iScreenSaverHost->UseRefreshTimer( ETrue );
+        iTimerChanged = EFalse;
+        }
+
+    return status;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPlugin::Name
+// -----------------------------------------------------------------------------
+//
+const TDesC16& CMPXScreenSaverPlugin::Name() const
+    {
+    MPX_FUNC( "CMPXScreenSaverPlugin::Name" );
+    if ( iDisplayName )
+        {
+        return *iDisplayName;
+        }
+    else
+        {
+        return KNullDesC;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPlugin::Capabilities
+// -----------------------------------------------------------------------------
+//
+TInt CMPXScreenSaverPlugin::Capabilities()
+    {
+    MPX_FUNC( "CMPXScreenSaverPlugin::Capabilities" );
+    return EScpCapsNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPlugin::PluginFunction
+// -----------------------------------------------------------------------------
+//
+TInt CMPXScreenSaverPlugin::PluginFunction(
+            TScPluginCaps /*aFunction*/,
+            TAny* /*aParam*/)
+    {
+    MPX_FUNC( "CMPXScreenSaverPlugin::PluginFunction" );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPlugin::HandleScreensaverEventL
+// -----------------------------------------------------------------------------
+//
+TInt CMPXScreenSaverPlugin::HandleScreensaverEventL(
+            TScreensaverEvent aEvent,
+            TAny* /*aData*/ )
+    {
+    MPX_DEBUG2( "-->CMPXScreenSaverPlugin::HandleScreensaverEventL event = %d", aEvent );
+
+    if ( aEvent == EScreensaverEventDisplayChanged )
+        {
+        if ( iContainer )
+            {
+            iContainer->RefreshDisplayInfo();
+            }
+        }
+    else if ( aEvent == EScreensaverEventStarting )
+        {
+        if ( !iContainer )
+            {
+            CreateContainerL();
+            }
+        MProfile* profile = iProfileEngine->ActiveProfileL();
+        if( profile )
+            {
+            if ( iProfileEngine->ActiveProfileId() != EProfileGeneralId )
+                {
+                // active profile is not general profile
+                const MProfileName& profileName = profile->ProfileName();
+                TRAP_IGNORE( iContainer->SetProfileNameL( profileName.Name(), ETrue ) );
+                }
+            else
+                {
+                TRAP_IGNORE( iContainer->SetProfileNameL( KNullDesC, EFalse ) );
+                }
+            iContainer->SetParam( MPXScreenSaverPluginParamIsSilent,
+                profile->IsSilent() );
+            profile->Release();
+            }
+        profile = NULL;
+        }
+    else if ( aEvent == EScreensaverEventStopping )
+        {
+        delete iContainer;
+        iContainer = NULL;
+        }
+    MPX_DEBUG1( "<--CMPXScreenSaverPlugin::HandleScreensaverEventL" );
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPlugin::CMPXScreenSaverPlugin
+// -----------------------------------------------------------------------------
+//
+CMPXScreenSaverPlugin::CMPXScreenSaverPlugin():
+    iPlaybackState( EPbStateNotInitialised )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPlugin::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPXScreenSaverPlugin::ConstructL()
+    {
+    MPX_FUNC( "CMPXScreenSaverPlugin::ConstructL" );
+    iEikEnv = CEikonEnv::Static();
+    TParse lParse;
+    lParse.Set( KResourceFileName, &KDC_APP_RESOURCE_DIR, NULL);
+    TFileName resourceFile( lParse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+
+    BaflUtils::NearestLanguageFile( iEikEnv->FsSession(), resourceFile );
+    iResourceOffset = iEikEnv->AddResourceFileL( resourceFile );
+
+    iPlaybackUtility = MMPXPlaybackUtility::NewL( KPbModeActivePlayer, this );
+    iProfileEngine = CreateProfileEngineL();
+    iDisplayName = StringLoader::LoadL( R_MPX_SCREENSAVER_DISPLAY_NAME );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXScreenSaverPlugin::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXScreenSaverPlugin::HandlePropertyL(
+    TMPXPlaybackProperty /* aProperty */,
+    TInt /* aValue */,
+    TInt /* aError */ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// 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 CMPXScreenSaverPlugin::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aProperties.
+// ---------------------------------------------------------------------------
+//
+void CMPXScreenSaverPlugin::HandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    TRAP_IGNORE( DoHandleMediaL( aMedia, aError ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXScreenSaverPlugin::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXScreenSaverPlugin::DoHandlePlaybackMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                MPX_DEBUG2( "CMPXScreenSaverPlugin::DoHandlePlaybackMessageL - EStateChanged(%d)", type );
+
+                TMPXPlaybackState state =
+                    static_cast<TMPXPlaybackState>( type );
+                DoHandleStateChangedL( state );
+                break;
+                }
+            case TMPXPlaybackMessage::EMediaChanged:
+                {
+                MPX_DEBUG2( "CMPXScreenSaverPlugin::DoHandlePlaybackMessageL - EMediaChanged(%d)", type );
+                MMPXSource* s( iPlaybackUtility->Source() );
+                if ( s )
+                    {
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL(attrs);
+                    attrs.Append( KMPXMediaGeneralTitle );
+                    s->MediaL( attrs.Array(), *this );
+                    CleanupStack::PopAndDestroy( &attrs );
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::EActivePlayerChanged:
+                {
+                MPX_DEBUG3( "CMPXScreenSaverPlugin::DoHandlePlaybackMessageL - Active player changed(%d, %d)", type, data );
+                if ( type && data )
+                    {
+                    // binded to active player, change state to active
+                    DoHandleStateChangedL( EPbStatePlaying );
+                    // refresh media property
+                    MMPXSource* s = iPlaybackUtility->Source();
+                    if ( s )
+                        {
+                        RArray<TMPXAttribute> attrs;
+                        CleanupClosePushL(attrs);
+                        attrs.Append( KMPXMediaGeneralTitle );
+                        s->MediaL( attrs.Array(), *this );
+                        CleanupStack::PopAndDestroy( &attrs );
+                        }
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aProperties.
+// ---------------------------------------------------------------------------
+//
+void CMPXScreenSaverPlugin::DoHandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXScreenSaverPlugin::DoHandleMediaL" );
+    if ( iContainer && KErrNone == aError)
+        {
+        iContainer->SetSongPropertiesL( aMedia );
+        // force a redraw after title update
+        iScreenSaverHost->SetRefreshTimerValue( KTimerForceNextUpdateInterval );
+        iScreenSaverHost->UseRefreshTimer( ETrue );
+        iTimerChanged = ETrue;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXScreenSaverPlugin::DoHandleStateChangedL(
+    TMPXPlaybackState aState )
+    {
+    MPX_FUNC( "CMPXScreenSaverPlugin::DoHandleStateChangedL" );
+    iPlaybackState = aState;
+
+    // force a redraw after play state change
+    iScreenSaverHost->SetRefreshTimerValue( KTimerForceNextUpdateInterval );
+    iScreenSaverHost->UseRefreshTimer( ETrue );
+    iTimerChanged = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// create container.
+// ---------------------------------------------------------------------------
+//
+void CMPXScreenSaverPlugin::CreateContainerL()
+    {
+    MPX_FUNC( "CMPXScreenSaverPlugin::CreateContainerL" );
+
+    iContainer = new ( ELeave )
+        CMPXScreenSaverPluginContainer( iScreenSaverHost );
+    iContainer->ConstructL();
+
+    iPlaybackState = iPlaybackUtility->StateL();
+
+    // get current playing song (if any)
+    MMPXSource* s = iPlaybackUtility->Source();
+    if ( s )
+        {
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        attrs.Append( KMPXMediaGeneralTitle );
+        s->MediaL( attrs.Array(), *this );
+        CleanupStack::PopAndDestroy( &attrs );
+        }
+    }
+
+// End Of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/src/mpxscreensaverplugincontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1599 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Screen Saver Plugin
+*
+*/
+
+
+// INCLUDE FILES
+
+#include <eikenv.h>
+#include <data_caging_path_literals.hrh>
+#include <screensaverplugin.h>
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <AknBidiTextUtils.h>
+#include <eiklabel.h>
+#include <aknlayoutscalable_avkon.cdl.h>
+#include <StringLoader.h>
+#include <bitmaptransforms.h>
+#include <e32math.h>
+
+#include <PUAcodes.hrh>
+#include <barsread.h>
+
+#include <mpxmedia.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxscreensaverplugin.rsg>
+#include <mpxscreensaverplugin.mbg>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxlog.h>
+#include <mpxuser.h>
+
+#include "mpxscreensaverplugincontainer.h"
+
+// Constants
+const TInt KMPXDurationDisplayResvLen = 10;
+const TInt KMPXNumBackgrounds = 4;
+#define KMPXIndicatorColor KRgbWhite
+
+_LIT( KIconFileName, "mpxscreensaverplugin.mbm" );
+_LIT( KMXPanicCategory, "CMPXScreenSaverPluginContainer" );
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::CMPXScreenSaverPluginContainer
+// -----------------------------------------------------------------------------
+//
+CMPXScreenSaverPluginContainer::CMPXScreenSaverPluginContainer(
+    MScreensaverPluginHost *aHost ):
+    iScreenSaverHost( aHost ),
+    iParentControl( NULL ),
+    iBackground( KMPXNumBackgrounds )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::ConstructL()
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::ConstructL" );
+
+    iEikEnv = CEikonEnv::Static();
+    iTitleLabel = new ( ELeave ) CEikLabel();
+    iClockLabel = new ( ELeave ) CEikLabel();
+    iAmPmLabel = new ( ELeave ) CEikLabel();
+
+    RefreshDisplayInfo();
+    CreateIconsL();
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainerContainer::~CMPXScreenSaverPluginContainerContainer
+// ----------------------------------------------------------------------------
+//
+CMPXScreenSaverPluginContainer::
+    ~CMPXScreenSaverPluginContainer()
+    {
+    MPX_DEBUG1( "CMPXScreenSaverPluginContainer::~CMPXScreenSaverPluginContainer START" );
+
+    delete iPlayIcon;
+    delete iPauseIcon;
+    delete iMessageIcon;
+    delete iMissedCallIcon;
+    delete iNewInstantMessageIcon;
+    delete iNewVoiceMessageIcon;
+    delete iNewEmailIcon;
+    delete iKeyguardIcon;
+
+    delete iTitleLabel;
+    delete iClockLabel;
+    delete iAmPmLabel;
+    delete iProfileName;
+
+    iBackground.ResetAndDestroy();
+    iBackground.Close();
+
+    if ( iIndicatorFont && iOSBitmapDevice )
+        {
+        iOSBitmapDevice->ReleaseFont( iIndicatorFont );
+        }
+
+    delete iOffScreenBitmap;
+    delete iOSBitmapContext;
+    delete iOSBitmapDevice;
+
+    MPX_DEBUG1( "CMPXScreenSaverPluginContainer::~CMPXScreenSaverPluginContainer END" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::Draw
+// -----------------------------------------------------------------------------
+//
+TInt CMPXScreenSaverPluginContainer::DrawL( CWindowGc& aGc,
+    TMPXPlaybackState aPlaybackState )
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawL" );
+
+    TInt colorIndex = GetDrawPositionAndColorIndexL();
+    if ( !iOffScreenBitmap )
+        {
+        TInt backgroundHeight = BackgroundHeightL();
+        // create an off-screen bitmap, device and context
+        iOffScreenBitmap = new ( ELeave ) CFbsBitmap();
+        User::LeaveIfError( iOffScreenBitmap->Create(
+            TSize( iScreenSize.iWidth, backgroundHeight),
+            aGc.Device()->DisplayMode() ) );
+        iOSBitmapDevice = CFbsBitmapDevice::NewL( iOffScreenBitmap );
+        User::LeaveIfError( iOSBitmapDevice->CreateContext( iOSBitmapContext ) );
+
+        iOSBitmapContext->SetPenColor( KMPXIndicatorColor );
+        // brush style has to be null in order for icon mask to work
+        iOSBitmapContext->SetBrushColor( KRgbBlack );
+        iOSBitmapContext->SetBrushStyle( CGraphicsContext::ENullBrush );
+        iOSBitmapContext->SetPenStyle( CGraphicsContext::ESolidPen );
+
+        // update the layouts
+        UpdateLayoutL();
+
+        if ( iIndicatorFont )
+            {
+            iOSBitmapDevice->ReleaseFont( iIndicatorFont );
+            }
+        const CFont* origFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
+        TFontSpec fontSpecTitle = origFont->FontSpecInTwips();
+        fontSpecTitle.iHeight = iRectIndicators.Height();  // Scale smaller
+        iOSBitmapDevice->GetNearestFontToDesignHeightInPixels( iIndicatorFont, fontSpecTitle );
+
+        // reload the backgrounds
+        LoadBackgroundsL();
+        }
+
+    iOSBitmapContext->Clear();
+
+    DrawBackground( *iOSBitmapContext, colorIndex );
+    DrawClockL( *iOSBitmapContext );
+    DrawPlaybackStatusL( *iOSBitmapContext, aPlaybackState );
+    DrawIndicatorsL( *iOSBitmapContext );
+
+    aGc.SetBrushColor( KRgbBlack );
+    aGc.Clear();
+    // activate partial mode
+    // partial mode is not supported in landscape orientation?
+    TScreensaverPartialMode partialMode;
+    TRect drawArea = TRect( TPoint(0, iStartY),
+        TPoint( iOffScreenBitmap->SizeInPixels().iWidth,
+        iOffScreenBitmap->SizeInPixels().iHeight + iStartY) );
+    partialMode.iBpp = 8;
+    partialMode.iType = EPartialModeTypeMostPowerSaving;
+    TInt status = iScreenSaverHost->SetActiveDisplayArea(
+        drawArea, partialMode );
+    MPX_DEBUG2( "CMPXScreenSaverPluginContainer::DrawL SetActiveDisplayArea status = %d", status );
+    aGc.BitBlt( TPoint(0, iStartY), iOffScreenBitmap );
+
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::SetSongPropertiesL
+// -----------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::SetSongPropertiesL(
+    const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::SetSongPropertiesL" );
+    iTitleLabel->SetTextL(
+        aMedia.ValueText( KMPXMediaGeneralTitle ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::SetNewVoiceMessage
+// -----------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::SetParam(
+    MPXScreenSaverPluginParam aType, TInt aValue )
+    {
+    MPX_DEBUG3( "-->CMPXScreenSaverPluginContainer::SetParam type = %d, value = %d", aType, aValue );
+
+    switch ( aType )
+        {
+        case MPXScreenSaverPluginParamMissedCall:
+            {
+            iMissedCall = aValue;
+            break;
+            }
+        case MPXScreenSaverPluginParamNewMessage:
+            {
+            iNewMessage = aValue;
+            break;
+            }
+        case MPXScreenSaverPluginParamInstantMessage:
+            {
+            iNewInstantMessage = aValue;
+            break;
+            }
+        case MPXScreenSaverPluginParamEmail:
+            {
+            iNewEmail = aValue;
+            break;
+            }
+        case MPXScreenSaverPluginParamVoiceMessage:
+            {
+            iNewVoiceMessage = aValue;
+            break;
+            }
+        case MPXScreenSaverPluginParamKeyguard:
+            {
+            iKeyguard = aValue;
+            break;
+            }
+        case MPXScreenSaverPluginParamIsSilent:
+            {
+            iIsSilent = aValue;
+            break;
+            }
+        default:
+            break;
+        }
+    MPX_DEBUG1( "<--CMPXScreenSaverPluginContainer::SetParam" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::SetProfileNameL
+// -----------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::SetProfileNameL(
+    const TDesC& aName, TBool aDisplay )
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::SetProfileNameL" );
+    delete iProfileName;
+    iProfileName = NULL;
+    if ( aDisplay )
+        {
+        iProfileName = aName.AllocL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::RefreshDisplayInfo
+// -----------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::RefreshDisplayInfo()
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::RefreshDisplayInfo" );
+
+    TScreensaverDisplayInfo displayInfo;
+    displayInfo.iSize = sizeof( TScreensaverDisplayInfo );
+    iScreenSaverHost->DisplayInfo( &displayInfo );
+    iParentControl = displayInfo.iParent;
+
+    // screen size from display info may not be full screen size
+    iScreenSize = CCoeEnv::Static()->ScreenDevice()->SizeInPixels();
+    MPX_DEBUG3( "CMPXScreenSaverPluginContainer::RefreshDisplayInfo Screen size: %d %d", iScreenSize.iWidth, iScreenSize.iHeight );
+
+    // delete them so that they will be recreated next time
+    delete iOffScreenBitmap;
+    iOffScreenBitmap = NULL;
+    delete iOSBitmapContext;
+    iOSBitmapContext = NULL;
+    delete iOSBitmapDevice;
+    iOSBitmapDevice = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// Create icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::CreateIconsL()
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::CreateIconsL" );
+
+    TParse parse;
+    parse.Set( KIconFileName, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    iPlayIcon = CreateIconL(
+        KAknsIIDQgnIndiMupPlay,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG1,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_play,
+        EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_play_mask,
+        ETrue );
+
+    iPauseIcon = CreateIconL(
+        KAknsIIDQgnIndiMupPause,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG1,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_pause,
+        EMbmMpxscreensaverpluginQgn_graf_mup_npv_icon_pause_mask,
+        ETrue );
+
+    iMessageIcon = CreateIconL(
+        KAknsIIDQgnStatMessage,
+        KAknsIIDQsnIconColors,
+        EAknsMinorDefault,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_stat_message,
+        EMbmMpxscreensaverpluginQgn_stat_message_mask,
+        ETrue );
+
+    iMissedCallIcon = CreateIconL(
+        KAknsIIDQgnStatMissedCallsUni,
+        KAknsIIDQsnIconColors,
+        EAknsMinorDefault,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_stat_missed_calls_uni,
+        EMbmMpxscreensaverpluginQgn_stat_missed_calls_uni_mask,
+        ETrue );
+
+    iNewInstantMessageIcon = CreateIconL(
+        KAknsIIDQgnStatImUni,
+        KAknsIIDQsnIconColors,
+        EAknsMinorDefault,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_stat_im_uni,
+        EMbmMpxscreensaverpluginQgn_stat_im_uni_mask,
+        ETrue );
+
+    iNewVoiceMessageIcon = CreateIconL(
+        KAknsIIDQgnStatVm0,
+        KAknsIIDQsnIconColors,
+        EAknsMinorDefault,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_stat_vm0,
+        EMbmMpxscreensaverpluginQgn_stat_vm0_mask,
+        ETrue );
+
+    iNewEmailIcon = CreateIconL(
+        KAknsIIDQgnStatMessageMail,
+        KAknsIIDQsnIconColors,
+        EAknsMinorDefault,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_stat_message_mail,
+        EMbmMpxscreensaverpluginQgn_stat_message_mail_mask,
+        ETrue );
+
+    iKeyguardIcon = CreateIconL(
+        KAknsIIDQgnStatKeyguard,
+        KAknsIIDQsnIconColors,
+        EAknsMinorDefault,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_stat_keyguard,
+        EMbmMpxscreensaverpluginQgn_stat_keyguard_mask,
+        ETrue );
+
+    LoadBackgroundsL();
+    }
+
+// ---------------------------------------------------------------------------
+// Create a color icon.
+// ---------------------------------------------------------------------------
+//
+CGulIcon* CMPXScreenSaverPluginContainer::CreateIconL(
+    const TAknsItemID& aID,
+    const TAknsItemID& aColorId,
+    TInt aColorIndex,
+    const TDesC& aBitmapFilename,
+    TInt aFileBitmapId,
+    TInt aFileMaskId,
+    TBool aIsIndicator
+    )
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::CreateIconL" );
+
+    MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
+
+    CFbsBitmap* icon( NULL );
+    CFbsBitmap* mask( NULL );
+
+    if ( aColorId == KAknsIIDNone )
+        {
+        // do not use theme color, use the default color from the file
+        AknsUtils::CreateIconLC( skin, aID,
+            icon, mask, aBitmapFilename, aFileBitmapId, aFileMaskId );
+        }
+    else
+        {
+        // use theme color
+        AknsUtils::CreateColorIconLC( skin, aID, aColorId, aColorIndex,
+            icon, mask, aBitmapFilename, aFileBitmapId, aFileMaskId, KRgbBlack );
+        }
+
+    if ( aIsIndicator )
+        {
+        // should not be theme colored since everything else is not?
+        AknIconUtils::SetIconColor( icon, KMPXIndicatorColor );
+        }
+
+    CGulIcon* res = CGulIcon::NewL( icon, mask );
+    res->SetBitmapsOwnedExternally( EFalse );
+    CleanupStack::Pop( 2 ); // mask, icon
+    return res;
+    }
+
+// ---------------------------------------------------------------------------
+// Load the backgrounds, and resize them to screen size
+// ---------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::LoadBackgroundsL()
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::LoadBackgroundsL" );
+
+    TParse parse;
+    parse.Set( KIconFileName, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile;
+    iconFile.Append( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    iBackground.ResetAndDestroy();
+
+    TInt width = iScreenSize.iWidth;
+    TInt height = BackgroundHeightL();
+
+    CGulIcon* icon = CreateIconL(
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_01,
+        EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_01_mask,
+        EFalse );
+    AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ),
+        EAspectRatioNotPreserved );
+    iBackground.Append( icon );
+    icon = NULL;
+
+    icon = CreateIconL(
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_02,
+        EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_02_mask,
+        EFalse );
+    AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ),
+        EAspectRatioNotPreserved );
+    iBackground.Append( icon );
+    icon = NULL;
+
+    icon = CreateIconL(
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_03,
+        EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_03_mask,
+        EFalse );
+    AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ),
+        EAspectRatioNotPreserved );
+    iBackground.Append( icon );
+    icon = NULL;
+
+    icon = CreateIconL(
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_04,
+        EMbmMpxscreensaverpluginQgn_graf_mup_ss_bgnd_04_mask,
+        EFalse );
+    AknIconUtils::SetSize( icon->Bitmap(), TSize( width, height ),
+        EAspectRatioNotPreserved );
+    iBackground.Append( icon );
+    icon = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::DrawClock
+// -----------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::DrawClockL( CBitmapContext& aGc )
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawClockL" );
+
+    // Draw clock display
+    TTime time;
+    time.HomeTime();
+    // R_QTN_TIME_USUAL_WITH_ZERO cannot be used because ZDigi does not have
+    // alphabets
+    HBufC* format = StringLoader::LoadLC(
+        R_MPX_SCREENSAVER_TIME_USUAL_WITHOUT_AMPM );
+    HBufC* clockTime = HBufC::NewLC(
+        format->Length() + KMPXDurationDisplayResvLen );
+    TPtr clockTimePtr = clockTime->Des();
+    MPX_TRAPD( err, time.FormatL( clockTimePtr, *format ) );
+    if (err != KErrNone)
+        {
+        clockTimePtr = KNullDesC;
+        }
+    // time digifont does not contain arabic / indic etc numbers.
+    // If clock font is changed, or digifont starts supporting language-
+    // specific numbers, the commented-out call below should be restored
+    /*
+    else
+        {
+        AknTextUtils::LanguageSpecificNumberConversion( clockTimePtr );
+        }
+    */
+
+    // AM/PM text
+    HBufC* ampmFormat = StringLoader::LoadLC( R_MPX_SCREENSAVER_AMPM );
+    HBufC* ampm = HBufC::NewLC( ampmFormat->Length() + KMPXDurationDisplayResvLen );
+    TPtr ampmPtr = ampm->Des();
+    MPX_TRAP( err, time.FormatL( ampmPtr, *ampmFormat ) );
+    if ( err != KErrNone )
+        {
+        ampmPtr = KNullDesC;
+        }
+
+    TRgb color( KMPXIndicatorColor );
+    aGc.UseFont( iClockLabel->Font() );
+    aGc.SetPenColor( color );
+    TInt width = iClockLabel->Font()->TextWidthInPixels( clockTimePtr );
+    // align right
+    aGc.DrawText( clockTimePtr,
+            TPoint( iClockLabel->Rect().iBr.iX - width, iClockLabel->Rect().iBr.iY ) );
+
+    // draw AM/PM if time format is 12-hour
+    TLocale locale;
+    if ( locale.TimeFormat() == ETime12 )
+        {
+        aGc.DiscardFont();
+        aGc.UseFont( iAmPmLabel->Font() );
+        width = iAmPmLabel->Font()->TextWidthInPixels( ampmPtr );
+        // align right
+        aGc.DrawText( ampmPtr,
+            TPoint( iAmPmLabel->Rect().iBr.iX - width, iAmPmLabel->Rect().iBr.iY ) );
+        }
+
+    aGc.DiscardFont();
+    CleanupStack::PopAndDestroy( ampm );
+    CleanupStack::PopAndDestroy( ampmFormat );
+    CleanupStack::PopAndDestroy( clockTime );
+    CleanupStack::PopAndDestroy( format );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::DrawBackground
+// -----------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::DrawBackground(
+    CBitmapContext& aGc, TInt aColorIndex )
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawBackground" );
+    aGc.BitBltMasked(
+        TPoint(),
+        iBackground[ aColorIndex ]->Bitmap(),
+        TRect( aGc.Device()->SizeInPixels() ),
+        iBackground[ aColorIndex ]->Mask(),
+        EFalse );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::DrawPlaybackStatus
+// -----------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::DrawPlaybackStatusL(
+    CBitmapContext& aGc, TMPXPlaybackState aPlaybackState )
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawPlaybackStatus" );
+
+    TBool showTitle = EFalse;
+
+    // Draw play status icon (if any)
+    CGulIcon* icon = NULL;
+    switch ( aPlaybackState )
+        {
+        case EPbStatePlaying:
+            {
+            icon = iPlayIcon;
+            showTitle = ETrue;
+            break;
+            }
+        case EPbStatePaused:
+            {
+            icon = iPauseIcon;
+            showTitle = ETrue;
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    if ( icon )
+        {
+        aGc.BitBltMasked(
+            iRectPlaybackStatus.iTl,
+            icon->Bitmap(),
+            TRect( iRectPlaybackStatus.Size() ),
+            icon->Mask(),
+            EFalse );
+        }
+
+    TRgb color( KMPXIndicatorColor );
+    aGc.UseFont( iTitleLabel->Font() );
+    aGc.SetPenColor( color );
+
+    if ( iTitleLabel->Text() && showTitle )
+        {
+        HBufC* buf = iTitleLabel->Text()->AllocL();
+        CleanupStack::PushL( buf );
+        TPtr ptr( buf->Des() );
+        AknBidiTextUtils::ConvertToVisualAndClipL(
+            ptr,
+            *iTitleLabel->Font(),
+            iTitleLabel->Rect().Width(),
+            iTitleLabel->Rect().Width() );
+        aGc.DrawText( ptr,
+            TPoint( iTitleLabel->Rect().iTl.iX, iTitleLabel->Rect().iBr.iY ) );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    else
+        {
+        TTime time;
+        time.HomeTime();
+        HBufC* format = StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO );
+        HBufC* clockTime = HBufC::NewLC( format->Length() + KMPXDurationDisplayResvLen );
+        TPtr clockTimePtr = clockTime->Des();
+        time.FormatL( clockTimePtr, *format );
+        AknTextUtils::LanguageSpecificNumberConversion( clockTimePtr );
+
+        aGc.DrawText( clockTimePtr,
+            TPoint( iTitleLabel->Rect().iTl.iX, iTitleLabel->Rect().iBr.iY ) );
+
+        CleanupStack::PopAndDestroy( clockTime );
+        CleanupStack::PopAndDestroy( format );
+        }
+    aGc.DiscardFont();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::DrawIndicatorsL
+// -----------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::DrawIndicatorsL(
+     CBitmapContext& aGc )
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::DrawIndicatorsL" );
+
+    TSize indicatorSize = TSize( iRectIndicators.Height(),
+        iRectIndicators.Height() );
+    MPX_DEBUG2( "CMPXScreenSaverPluginContainer::DrawIndicatorsL indicator height %d", iRectIndicators.Height() );
+    iStartX = iRectIndicators.iTl.iX;
+
+    TRgb color( KMPXIndicatorColor );
+    aGc.SetPenColor( color );
+    aGc.UseFont( iIndicatorFont );
+
+    if ( iKeyguard > 0 )
+        {
+        MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing keyguard %d %d", iStartX, iRectIndicators.iTl.iY );
+        DoDrawIndicatorsL( aGc, -1, iKeyguardIcon, iIndicatorFont,
+            iRectIndicators, indicatorSize);
+        }
+
+    if ( iMissedCall > 0 )
+        {
+        MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new miss call %d %d", iStartX, iRectIndicators.iTl.iY );
+        DoDrawIndicatorsL( aGc, iMissedCall, iMissedCallIcon, iIndicatorFont,
+            iRectIndicators, indicatorSize);
+        }
+
+    if ( iNewMessage > 0 )
+        {
+        MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new message %d %d", iStartX, iRectIndicators.iTl.iY );
+        DoDrawIndicatorsL( aGc, iNewMessage, iMessageIcon, iIndicatorFont,
+            iRectIndicators, indicatorSize);
+        }
+
+    if ( iNewInstantMessage > 0 )
+        {
+        MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new instant message %d %d", iStartX, iRectIndicators.iTl.iY );
+        DoDrawIndicatorsL( aGc, 0, iNewInstantMessageIcon, iIndicatorFont,
+            iRectIndicators, indicatorSize);
+        }
+
+    if ( iNewEmail > 0 )
+        {
+        MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new email %d %d", iStartX, iRectIndicators.iTl.iY );
+        DoDrawIndicatorsL( aGc, 0, iNewEmailIcon, iIndicatorFont,
+            iRectIndicators, indicatorSize);
+        }
+
+    if ( iNewVoiceMessage > 0 )
+        {
+        MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing new voice message %d %d", iStartX, iRectIndicators.iTl.iY );
+        DoDrawIndicatorsL( aGc, 0, iNewVoiceMessageIcon,
+            iIndicatorFont, iRectIndicators, indicatorSize);
+        }
+
+    if ( ( iProfileName ) || ( iIsSilent ) )
+        {
+        MPX_DEBUG3( "CMPXScreenSaverPluginContainer::DrawIndicatorsL drawing profile name %d %d", iStartX, iRectIndicators.iTl.iY );
+        // clip text to fit screen
+        HBufC* buf;
+        if ( iProfileName )
+            {
+            buf = HBufC::NewLC( iProfileName->Length() +
+                KMPXDurationDisplayResvLen );
+            }
+        else
+            {
+            buf = HBufC::NewLC( KMPXDurationDisplayResvLen );
+            }
+        TPtr ptr( buf->Des() );
+        if ( iIsSilent )
+            {
+            ptr.Append( KPuaCodeSilentSymbol );
+            }
+        if ( iProfileName )
+            {
+            ptr.Append( iProfileName->Des() );
+            AknBidiTextUtils::ConvertToVisualAndClipL(
+                ptr,
+                *iIndicatorFont,
+                iRectIndicators.iBr.iX - iStartX,
+                iRectIndicators.iBr.iX - iStartX );
+            }
+        aGc.DrawText(  *buf,
+            TPoint( iStartX, iRectIndicators.iTl.iY + indicatorSize.iHeight ) );
+        CleanupStack::PopAndDestroy( buf );
+        }
+
+    aGc.DiscardFont();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXScreenSaverPluginContainer::DrawIndicatorsL
+// -----------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::DoDrawIndicatorsL(
+     CBitmapContext& aGc, TInt aDisplayNumber, CGulIcon* aDisplayIcon,
+     CFont* aFont, TRect aRect, TSize aSize )
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::DoDrawIndicatorsL" );
+
+    if ( aDisplayNumber > 0 )
+        {
+        HBufC* stringBuf = HBufC::NewLC( 5 );
+        stringBuf->Des().AppendNum( aDisplayNumber );
+        aGc.DrawText( stringBuf->Des(),
+            TPoint( iStartX, aRect.iTl.iY + aSize.iHeight ) );
+        iStartX = iStartX + aFont->TextWidthInPixels( stringBuf->Des() );
+        CleanupStack::PopAndDestroy( stringBuf );
+        }
+    aGc.BitBltMasked(
+        TPoint( iStartX, aRect.iTl.iY ),
+        aDisplayIcon->Bitmap(),
+        TRect( aSize ),
+        aDisplayIcon->Mask(),
+        EFalse );
+    iStartX = iStartX + aSize.iWidth;
+    }
+
+// ---------------------------------------------------------------------------
+// Get layout data for an graphical indicator.
+// ---------------------------------------------------------------------------
+//
+TRect CMPXScreenSaverPluginContainer::IndicatorLayout(
+    MPXScreenSaverPluginControl aControl )
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::IndicatorLayout" );
+    TInt resId = 0;
+    if ( iScreenSize == TSize( 176, 208 ) )    //lowest portrait
+        {
+        switch ( aControl )
+            {
+            case MPXScreenSaverPluginIndicatorPlaybackStatus:
+                {
+                resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_LOWRES_PORTRAIT;
+                break;
+                }
+            case MPXScreenSaverPluginIndicatorOther:
+                {
+                resId = R_MPX_SCREENSAVER_INDI_LAYOUT_LOWRES_PORTRAIT;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 352, 416 ) ) //double portrait
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginIndicatorPlaybackStatus:
+                {
+                resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_DOUBLE_PORTRAIT;
+                break;
+                }
+            case MPXScreenSaverPluginIndicatorOther:
+                {
+                resId = R_MPX_SCREENSAVER_INDI_LAYOUT_DOUBLE_PORTRAIT;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 240, 320 ) ) //QVGA portrait
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginIndicatorPlaybackStatus:
+                {
+                resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QVGA_PORTRAIT;
+                break;
+                }
+            case MPXScreenSaverPluginIndicatorOther:
+                {
+                resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QVGA_PORTRAIT;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 208, 176 ) )    //lowest landscape
+        {
+        switch ( aControl )
+            {
+            case MPXScreenSaverPluginIndicatorPlaybackStatus:
+                {
+                resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_LOWRES_LANDSCAPE;
+                break;
+                }
+            case MPXScreenSaverPluginIndicatorOther:
+                {
+                resId = R_MPX_SCREENSAVER_INDI_LAYOUT_LOWRES_LANDSCAPE;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 416, 352 ) ) //double landscape
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginIndicatorPlaybackStatus:
+                {
+                resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_DOUBLE_LANDSCAPE;
+                break;
+                }
+            case MPXScreenSaverPluginIndicatorOther:
+                {
+                resId = R_MPX_SCREENSAVER_INDI_LAYOUT_DOUBLE_LANDSCAPE;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 320, 240 ) ) //QVGA landscape
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginIndicatorPlaybackStatus:
+                {
+                resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QVGA_LANDSCAPE;
+                break;
+                }
+            case MPXScreenSaverPluginIndicatorOther:
+                {
+                resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QVGA_LANDSCAPE;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 360, 640 ) ) // QHD portrait
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginIndicatorPlaybackStatus:
+                {
+                resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QHD_PORTRAIT;
+                break;
+                }
+            case MPXScreenSaverPluginIndicatorOther:
+                {
+                resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QHD_PORTRAIT;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 640, 360 ) ) // QHD landscape
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginIndicatorPlaybackStatus:
+                {
+                resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_QHD_LANDSCAPE;
+                break;
+                }
+            case MPXScreenSaverPluginIndicatorOther:
+                {
+                resId = R_MPX_SCREENSAVER_INDI_LAYOUT_QHD_LANDSCAPE;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 480, 640 ) ) // VGA portrait
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginIndicatorPlaybackStatus:
+                {
+                resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_VGA_PORTRAIT;
+                break;
+                }
+            case MPXScreenSaverPluginIndicatorOther:
+                {
+                resId = R_MPX_SCREENSAVER_INDI_LAYOUT_VGA_PORTRAIT;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 640, 480 ) ) // VGA landscape
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginIndicatorPlaybackStatus:
+                {
+                resId = R_MPX_SCREENSAVER_PB_INDI_LAYOUT_VGA_LANDSCAPE;
+                break;
+                }
+            case MPXScreenSaverPluginIndicatorOther:
+                {
+                resId = R_MPX_SCREENSAVER_INDI_LAYOUT_VGA_LANDSCAPE;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+	else
+        {
+        User::Panic( KMXPanicCategory, KErrNotSupported );
+        }
+    TAknLayoutRect res;
+    res.LayoutRect( TRect( TPoint( 0, 0),
+        TPoint( iOffScreenBitmap->SizeInPixels().iWidth,
+        iOffScreenBitmap->SizeInPixels().iHeight) ), resId );
+    return res.Rect();
+    }
+
+// ---------------------------------------------------------------------------
+// Get layout data for an graphical indicator.
+// ---------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::LabelLayoutL(
+    MPXScreenSaverPluginControl aControl )
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::LabelLayoutL" );
+    TInt resId = 0;
+    CEikLabel* label = NULL;
+    if ( iScreenSize == TSize( 176, 208 ) )    //lowest portrait
+        {
+        switch ( aControl )
+            {
+            case MPXScreenSaverPluginLabelTitle:
+                {
+                resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_LOWRES_PORTRAIT;
+                label = iTitleLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelClock:
+                {
+                TLanguage uiLanguage = User::Language();
+                if( uiLanguage == ELangArabic ||
+                    uiLanguage == ELangUrdu ||
+                    uiLanguage == ELangFarsi )
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_PORTRAIT_ARABIC;
+                    }
+                else
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_PORTRAIT;
+                    }
+                label = iClockLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelAmPm:
+                {
+                resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_LOWRES_PORTRAIT;
+                label = iAmPmLabel;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 352, 416 ) ) //double portrait
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginLabelTitle:
+                {
+                resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_DOUBLE_PORTRAIT;
+                label = iTitleLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelClock:
+                {
+                TLanguage uiLanguage = User::Language();
+                if( uiLanguage == ELangArabic ||
+                    uiLanguage == ELangUrdu ||
+                    uiLanguage == ELangFarsi )
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_PORTRAIT_ARABIC;
+                    }
+                else
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_PORTRAIT;
+                    }
+
+                label = iClockLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelAmPm:
+                {
+                resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_DOUBLE_PORTRAIT;
+                label = iAmPmLabel;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 240, 320 ) ) //QVGA portrait
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginLabelTitle:
+                {
+                resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QVGA_PORTRAIT;
+                label = iTitleLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelClock:
+                {
+                TLanguage uiLanguage = User::Language();
+                if( uiLanguage == ELangArabic ||
+                    uiLanguage == ELangUrdu ||
+                    uiLanguage == ELangFarsi )
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_PORTRAIT_ARABIC;
+                    }
+                else
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_PORTRAIT;
+                    }
+                label = iClockLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelAmPm:
+                {
+                resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QVGA_PORTRAIT;
+                label = iAmPmLabel;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 208, 176 ) )    //lowest landscape
+        {
+        switch ( aControl )
+            {
+            case MPXScreenSaverPluginLabelTitle:
+                {
+                resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_LOWRES_LANDSCAPE;
+                label = iTitleLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelClock:
+                {
+                TLanguage uiLanguage = User::Language();
+                if( uiLanguage == ELangArabic ||
+                    uiLanguage == ELangUrdu ||
+                    uiLanguage == ELangFarsi )
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_LANDSCAPE_ARABIC;
+                    }
+                else
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_LOWRES_LANDSCAPE;
+                    }
+
+                label = iClockLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelAmPm:
+                {
+                resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_LOWRES_LANDSCAPE;
+                label = iAmPmLabel;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 416, 352 ) ) //double landscape
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginLabelTitle:
+                {
+                resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_DOUBLE_LANDSCAPE;
+                label = iTitleLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelClock:
+                {
+                TLanguage uiLanguage = User::Language();
+                if( uiLanguage == ELangArabic ||
+                    uiLanguage == ELangUrdu ||
+                    uiLanguage == ELangFarsi )
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_LANDSCAPE_ARABIC;
+                    }
+                else
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_DOUBLE_LANDSCAPE;
+                    }
+                label = iClockLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelAmPm:
+                {
+                resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_DOUBLE_LANDSCAPE;
+                label = iAmPmLabel;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 320, 240 ) ) //QVGA landscape
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginLabelTitle:
+                {
+                resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QVGA_LANDSCAPE;
+                label = iTitleLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelClock:
+                {
+                TLanguage uiLanguage = User::Language();
+                if( uiLanguage == ELangArabic ||
+                    uiLanguage == ELangUrdu ||
+                    uiLanguage == ELangFarsi )
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_LANDSCAPE_ARABIC;
+                    }
+                else
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QVGA_LANDSCAPE;
+                    }
+
+                label = iClockLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelAmPm:
+                {
+                resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QVGA_LANDSCAPE;
+                label = iAmPmLabel;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 360, 640 ) ) // QHD portrait
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginLabelTitle:
+                {
+                resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QHD_PORTRAIT;
+                label = iTitleLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelClock:
+                {
+                TLanguage uiLanguage = User::Language();
+                if( uiLanguage == ELangArabic ||
+                    uiLanguage == ELangUrdu ||
+                    uiLanguage == ELangFarsi )
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_PORTRAIT_ARABIC;
+                    }
+                else
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_PORTRAIT;
+                    }
+
+                label = iClockLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelAmPm:
+                {
+                resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QHD_PORTRAIT;
+                label = iAmPmLabel;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 640, 360 ) ) // QHD landscape
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginLabelTitle:
+                {
+                resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_QHD_LANDSCAPE;
+                label = iTitleLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelClock:
+                {
+                TLanguage uiLanguage = User::Language();
+                if( uiLanguage == ELangArabic ||
+                    uiLanguage == ELangUrdu ||
+                    uiLanguage == ELangFarsi )
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_LANDSCAPE_ARABIC;
+                    }
+                else
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_QHD_LANDSCAPE;
+                    }
+
+                label = iClockLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelAmPm:
+                {
+                resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_QHD_LANDSCAPE;
+                label = iAmPmLabel;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 480, 640 ) ) // VGA portrait
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginLabelTitle:
+                {
+                resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_VGA_PORTRAIT;
+                label = iTitleLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelClock:
+                {
+                TLanguage uiLanguage = User::Language();
+                if( uiLanguage == ELangArabic ||
+                    uiLanguage == ELangUrdu ||
+                    uiLanguage == ELangFarsi )
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_PORTRAIT_ARABIC;
+                    }
+                else
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_PORTRAIT;
+                    }
+
+                label = iClockLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelAmPm:
+                {
+                resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_VGA_PORTRAIT;
+                label = iAmPmLabel;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+    else if ( iScreenSize == TSize( 640, 480 ) ) // VGA landscape
+        {
+        switch (aControl)
+            {
+            case MPXScreenSaverPluginLabelTitle:
+                {
+                resId = R_MPX_SCREENSAVER_TITLE_LAYOUT_VGA_LANDSCAPE;
+                label = iTitleLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelClock:
+                {
+                TLanguage uiLanguage = User::Language();
+                if( uiLanguage == ELangArabic ||
+                    uiLanguage == ELangUrdu ||
+                    uiLanguage == ELangFarsi )
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_LANDSCAPE_ARABIC;
+                    }
+                else
+                    {
+                    resId = R_MPX_SCREENSAVER_CLOCK_LAYOUT_VGA_LANDSCAPE;
+                    }
+
+                label = iClockLabel;
+                break;
+                }
+            case MPXScreenSaverPluginLabelAmPm:
+                {
+                resId = R_MPX_SCREENSAVER_AMPM_LAYOUT_VGA_LANDSCAPE;
+                label = iAmPmLabel;
+                break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                    User::Panic( KMXPanicCategory, KErrArgument ) );
+                break;
+                }
+            }
+        }
+	else
+        {
+        User::Panic( KMXPanicCategory, KErrNotSupported );
+        }
+    TResourceReader reader;
+    CCoeEnv::Static()->CreateResourceReaderLC( reader, resId );
+
+    // Read the layout from resource file
+    TAknTextComponentLayout textLayout;
+    textLayout.SetFont( reader.ReadInt16() );
+    textLayout.SetC( reader.ReadInt16() );
+    textLayout.Setl( reader.ReadInt16() );
+    textLayout.Setr( reader.ReadInt16() );
+    textLayout.Setb( reader.ReadInt16() );
+    textLayout.SetW( reader.ReadInt16() );
+    textLayout.SetJ( reader.ReadInt16() );
+    CleanupStack::PopAndDestroy();  // reader
+
+    AknLayoutUtils::LayoutLabel(
+        label, TRect( TPoint( 0, 0),
+        TPoint( iOffScreenBitmap->SizeInPixels().iWidth,
+        iOffScreenBitmap->SizeInPixels().iHeight) ),
+        textLayout.LayoutLine() );
+    }
+
+// ---------------------------------------------------------------------------
+// Get drawable background height.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXScreenSaverPluginContainer::BackgroundHeightL()
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::BackgroundHeightL" );
+    TInt resId = 0;
+    if ( iScreenSize == TSize( 176, 208 ) )    //lowest portrait
+        {
+        resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_LOWRES_PORTRAIT;
+        }
+    else if ( iScreenSize == TSize( 352, 416 ) ) //double portrait
+        {
+        resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_DOUBLE_PORTRAIT;
+        }
+    else if ( iScreenSize == TSize( 240, 320 ) ) //QVGA portrait
+        {
+        resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QVGA_PORTRAIT;
+        }
+    else if ( iScreenSize == TSize( 208, 176 ) )    //lowest landscape
+        {
+        resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_LOWRES_LANDSCAPE;
+        }
+    else if ( iScreenSize == TSize( 416, 352 ) ) //double landscape
+        {
+        resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_DOUBLE_LANDSCAPE;
+        }
+    else if ( iScreenSize == TSize( 320,240 ) ) // QVGA landscape
+        {
+        resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QVGA_LANDSCAPE;
+        }
+    else if ( iScreenSize == TSize( 360, 640 ) ) // QHD
+        {
+        resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_PORTRAIT;
+        }
+    else if ( iScreenSize == TSize( 640, 360 ) ) // QHD
+        {
+        resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_LANDSCAPE;
+        }
+    else if ( iScreenSize == TSize( 480, 640 ) ) // VGA portrait
+        {
+        resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_PORTRAIT;
+        }
+    else if ( iScreenSize == TSize( 640, 480 ) ) // VGA landscape
+        {
+        resId = R_MPX_SCREENSAVER_BACKGROUND_HEIGHT_QHD_LANDSCAPE;
+        }
+	else
+        {
+        User::Panic( KMXPanicCategory, KErrNotSupported );
+        }
+    TResourceReader reader;
+    CCoeEnv::Static()->CreateResourceReaderLC( reader, resId );
+    TInt res = reader.ReadInt16();
+    MPX_DEBUG2( "CMPXScreenSaverPluginContainer::BackgroundHeightL %d", res );
+    CleanupStack::PopAndDestroy();  // reader
+    return res;
+    }
+
+// ---------------------------------------------------------------------------
+// Get draw position and background color index, draw position is stored
+// in member variable iStartY
+// ---------------------------------------------------------------------------
+//
+TInt CMPXScreenSaverPluginContainer::GetDrawPositionAndColorIndexL()
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::GetDrawPositionAndColorIndexL" );
+    TTime time;
+    time.HomeTime();
+
+    TInt colorIndex = 0;
+    TInt64 currentTime = time.Int64();
+    colorIndex = currentTime / 10000000; // not a typo, to get it to the closest 10 seconds
+    colorIndex = colorIndex % KMPXNumBackgrounds;
+
+    TReal yReal = Math::FRand( currentTime );
+    TInt randomRangeY = iScreenSize.iHeight - BackgroundHeightL();
+    iStartY = ( TInt( yReal * randomRangeY ) );
+
+    MPX_DEBUG3( "CMPXScreenSaverPluginContainer::GetDrawPositionAndColorIndexL index = %d, height = %d", colorIndex, iStartY );
+
+    return colorIndex;
+    }
+
+// ---------------------------------------------------------------------------
+// Resizes all the icons and rects to match current screen size
+// ---------------------------------------------------------------------------
+//
+void CMPXScreenSaverPluginContainer::UpdateLayoutL()
+    {
+    MPX_FUNC( "CMPXScreenSaverPluginContainer::UpdateLayoutL" );
+
+    iRectIndicators = IndicatorLayout( MPXScreenSaverPluginIndicatorOther );
+    AknIconUtils::SetSize( iKeyguardIcon->Bitmap(),
+        TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
+        EAspectRatioNotPreserved );
+    AknIconUtils::SetSize( iMissedCallIcon->Bitmap(),
+        TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
+        EAspectRatioNotPreserved );
+    AknIconUtils::SetSize( iMessageIcon->Bitmap(),
+        TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
+        EAspectRatioNotPreserved );
+    AknIconUtils::SetSize( iNewInstantMessageIcon->Bitmap(),
+        TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
+        EAspectRatioNotPreserved );
+    AknIconUtils::SetSize( iNewVoiceMessageIcon->Bitmap(),
+        TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
+        EAspectRatioNotPreserved );
+    AknIconUtils::SetSize( iNewEmailIcon->Bitmap(),
+        TSize( iRectIndicators.Height(), iRectIndicators.Height() ),
+        EAspectRatioNotPreserved );
+
+    iRectPlaybackStatus =
+        IndicatorLayout( MPXScreenSaverPluginIndicatorPlaybackStatus );
+    AknIconUtils::SetSize( iPlayIcon->Bitmap(), iRectPlaybackStatus.Size(),
+        EAspectRatioNotPreserved );
+    AknIconUtils::SetSize( iPauseIcon->Bitmap(), iRectPlaybackStatus.Size(),
+        EAspectRatioNotPreserved );
+
+    LabelLayoutL( MPXScreenSaverPluginLabelTitle );
+    LabelLayoutL( MPXScreenSaverPluginLabelClock );
+    LabelLayoutL( MPXScreenSaverPluginLabelAmPm );
+    }
+
+
+// End Of file.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/mpxscreensaverplugin/src/mpxscreensaverpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+#include "mpxscreensaverpluginimplementationuid.hrh"
+#include "mpxscreensaverplugin.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXScreenSaverPluginImplementationUID, 
+        CMPXScreenSaverPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/rom/mpxscreensaverplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,32 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxscreensaverplugin
+*
+*/
+
+
+
+#ifndef MPXSCREENSAVERPLUGIN_IBY
+#define MPXSCREENSAVERPLUGIN_IBY
+
+//#ifdef __ENABLE_NOW_PLAYING_SCREENSAVER
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN(mpxscreensaverplugin.dll,101ffc13.rsc)
+SCALABLE_IMAGE( APP_RESOURCE_DIR, APP_RESOURCE_DIR, mpxscreensaverplugin )
+
+//#endif // __ENABLE_NOW_PLAYING_SCREENSAVER
+
+#endif // MPXSCREENSAVERPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/serviceplugins/screensaverplugins/rom/mpxscreensaverpluginrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxscreensaverplugin
+*
+*/
+
+
+
+#ifndef MPXSCREENSAVERPLUGINRSC_IBY
+#define MPXSCREENSAVERPLUGINRSC_IBY
+
+//#ifdef __ENABLE_NOW_PLAYING_SCREENSAVER
+
+#include <data_caging_paths_for_iby.hrh>
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxscreensaverplugin.rsc    APP_RESOURCE_DIR\mpxscreensaverplugin.rsc
+
+//#endif // __ENABLE_NOW_PLAYING_SCREENSAVER
+
+#endif // MPXSCREENSAVERPLUGINRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for MPX View Plugins.
+*
+*/
+
+
+#include "../plugins/group/bld.inf"
+#include "../views/group/bld.inf"
+
+PRJ_EXPORTS
+../icons/qgn_graf_mup_npv_defalbumart.svg	/epoc32/s60/icons/qgn_graf_mup_npv_defalbumart.svg
+../icons/qgn_graf_mup_podcast_art.svg		/epoc32/s60/icons/qgn_graf_mup_podcast_art.svg
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/icons/qgn_graf_mup_npv_defalbumart.svg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,240 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="tiny" height="120" viewBox="0 0 120 120" width="120">
+<switch>
+<foreignObject content="structured text" height="1" requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" width="1" x="0" y="0"/>
+<g>
+<g>
+<g>
+<rect fill="none" height="120" width="120"/>
+<g>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_22_" x1="0.02" x2="63.6703" y1="12.8188" y2="62.7265">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.236" style="stop-color:#EBEBEB"/>
+<stop offset="0.4122" style="stop-color:#E9E9E9"/>
+<stop offset="0.4756" style="stop-color:#E2E2E2"/>
+<stop offset="0.4775" style="stop-color:#E2E2E2"/>
+<stop offset="1" style="stop-color:#4D4D4D"/>
+</linearGradient>
+<path d="M96.343,18.026L96.343,18.026l0.005-0.007c0,0-3.718-1.891-8.414-1.934l-60.492,5.072         c0,0-3.891,0.218-5.824,1.574c-1.785,1.24-1.612,3.153-1.612,3.153l0.691,71.478c0,0-0.013,2.439,2.034,3.257         c0.032,0.008,0.077,0.017,0.1,0.032c0.3,0.138,0.889,0.634,1.475,1.174c0.873,0.803,1.747,1.706,1.687,1.685L96.343,18.026z" fill="url(#XMLID_22_)"/>
+<path d="M91.839,17.28c0,0,3.329,0.04,5.217,1.067c2.128,1.167,2.166,3.747,2.166,3.747l0.768,60.9         c0,0,0.218,2.344-1.324,3.996c-1.249,1.344-3.974,2.153-3.974,2.153l-62.696,14.491c0,0-3.812,0.705-6.004-0.124         c-2.196-0.829-2.183-3.322-2.183-3.322l-0.597-72.853c0,0-0.191-1.947,1.722-3.212c2.082-1.379,6.258-1.607,6.258-1.607         L91.839,17.28z" fill="#FFFFFF"/>
+<radialGradient cx="1828.2969" cy="572.7832" fx="1828.2969" fy="572.7832" gradientTransform="matrix(-0.5936 0 0 -0.3989 1114.9065 257.6711)" gradientUnits="userSpaceOnUse" id="XMLID_23_" r="173.4813">
+<stop offset="0" style="stop-color:#F3F3F3"/>
+<stop offset="1" style="stop-color:#9A9A9A"/>
+</radialGradient>
+<path d="M95.02,87.62c0,0,2.162-0.429,2.799-1.281c0.631-0.858,0.887-2.139,0.887-2.139         l-0.338-61.014c0,0,0-1.54-1.268-2.05c-1.276-0.515-3.727-0.339-3.727-0.339l-61.455,5.859c0,0-2.867,0.189-3.949,1.031         c-1.104,0.868-1.134,2.216-1.134,2.216l0.927,68.68c0,0-0.164,1.559,1.492,2.07c1.655,0.511,3.943,0.391,3.943,0.391         L95.02,87.62z" fill="url(#XMLID_23_)"/>
+<g>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_24_" x1="15.6846" x2="108.067" y1="66.9561" y2="43.0765">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M30.004,46.223l0.746-0.212l1.063-0.388l0.257-0.969l0.744-0.208          l1.423,0.058l0.411,1.233l1.067,1.185l0.539-0.036l0.715,0.898l0.297,1.083l0.728,4.108c0,0,0.25,1.457,0.79,1.946          c1.205,1.08,2.324,3.625,2.324,3.625l2.267,1.261l1.693,0.826l0.716,0.897l0.955,1.192l-0.149,0.959          c0,0-0.349-0.291,0.277,2.352c0.623,2.64,1.002,3.407,1.002,3.407s0.428-3.191,1.152,0.861          c0.723,4.057,0.716,0.899-0.04,2.532c-0.757,1.634,1.041,0.875,0.082,2.681c-0.96,1.803-0.156,2.378-0.156,2.378          l0.066,2.526l0.106,1.415l0.401,1.077l1.096,0.076l-0.094-1.257c0,0-0.093,0.164,0.247-1.124          c0.345-1.288,0.407-1.925,0.407-1.925l0.077-0.478l0.851-1.8l0.777-1.319l0.765-1.475l0.503-2.089          c0,0,0.706-0.839,1.005-1.174c0.304-0.34,0.278-2.233,0.278-2.233l0.646-1.625c0,0,0.41-0.346-0.772-1.688          c-1.184-1.336-1.951-1.438-1.951-1.438s-0.068-0.94-0.537-1.383c-0.465-0.445-0.303,0.336-1.052-1.03          c-0.75-1.369-0.521-1.228-1.507-1.313c-0.985-0.087-0.985-0.087-0.985-0.087l-1.841,0.132l-0.521,0.349          c0,0,0.202,1.248-0.409,0.348c-0.605-0.905-0.651-1.533-0.651-1.533s0.4-0.505,0.232-1.283          c-0.163-0.776-0.163-0.776-0.163-0.776l-0.769-0.104l-0.715,0.684l-0.245,1.122c0,0-0.756,0.054-0.812-0.731          c-0.059-0.787-0.059-0.787-0.059-0.787l0.67-1.312l1.138-0.87l0.845,1.202c0,0,0.695,0.582,0.629-0.358          c-0.069-0.944-0.069-0.944,0.114-1.431c0.183-0.487,0.54-0.034,0.993-1.331c0.451-1.297-0.982-0.24,0.451-1.297          c0.553-0.408,0.681-1.158,0.681-1.158c-0.506-0.488,0.322-1.073,0.322-1.073l0.544,0.488l0.584,0.065l-0.281-0.929          l-0.193-0.617l0.657,0.061l0.552,0.59c0,0,0.545-0.46,0.357-1.08c-0.191-0.616-0.891-1.305-0.891-1.305          s0.875,0.041,0.156-0.854c-0.715-0.897-1.009,0.073-1.264-0.435c-0.251-0.513,0.444-0.876-0.325-1.557          c-0.775-0.685-0.965-0.25-0.965-0.25s-0.295-0.082-0.045-0.628c0.253-0.547,0.453-0.77,0.453-0.77l0.439-0.979l-0.196-0.723          l-0.343-0.71l-0.977-1.514l-0.457-0.281l0.981-0.492c0,0,0.607,0.379,0.855,0.784c0.245,0.402,1.377,2.007,1.377,2.007          l0.221,1.036l1.099,1.185l0.901,0.463l0.35,0.818l0.751-1.633l0.913-1.433l1.135-0.398c0,0,0.253-0.542,0.459-0.666          c0.213-0.12-0.04,0.429,0.859-0.164c0.902-0.59,0.865-1.115,0.865-1.115l0.277-1.181c0,0-0.607-0.377-0.29-1.033          c0.317-0.652,0.527-0.772,0.527-0.772l0.394-0.552c0,0-0.266-0.721-1.063-0.665c-0.795,0.057-1.152,0.085-1.152,0.085          l-3.702-0.054l-2.008,0.353l-0.33,0.444l-0.688-0.475l-0.403,0.448l-0.795,0.051l-1.219,0.197l-0.691,0.471l-1.128,0.498          l-0.228,0.86c0,0,0.429-2.135-0.424-1.863c-0.851,0.273-0.964,0.699-0.964,0.699l-0.809-0.152l-0.263-0.614L42.018,35.1          l-0.734,0.896l0.399,0.499l-0.703,0.367l-0.075,0.95l0.047,0.63l0.107,0.52l-0.447-0.176l-0.335-0.611l-0.334-0.608          l-0.878-0.15l-0.5,0.141l-0.62,0.467l-0.405-0.604l-1.18,0.715c0,0,0.807,0.152-0.176,0.646          c-0.98,0.487-0.64,1.203-0.863,1.113c-0.222-0.088-1.255-0.331-1.473-0.315c-0.214,0.014-0.915,0.379-1.618-0.308          c-0.702-0.686-2.381,0.168-2.381,0.168l-1.001,1.233c0,0-0.492,0.246-0.359,1.081c0.133,0.828-0.359,1.073-0.016,1.789          c0.338,0.709,0.492,0.807,0.77,2.678c0.277,1.879,0.37,1.136,0.37,1.136l0.304-0.864L30.004,46.223z" fill="url(#XMLID_24_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_25_" x1="21.2002" x2="113.5832" y1="88.2881" y2="64.4084">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M89.434,65.322l-0.429,1.085L88.52,65.7l-0.891-0.249          c0,0-0.12,0.323-0.617,0.465c-0.499,0.143-1.11,0.708-1.11,0.708l-0.736,0.896l-0.653,0.996l-0.276,1.176l0.452,2.288          l0.442,2.18l1.031-0.812c0,0-0.204-0.828,1.238-0.932c1.446-0.102,0.472-0.562,1.472,0.321          c1.009,0.871,1.111,1.288,1.111,1.288l0.916,0.668l-0.121,0.329l-0.164,0.746c0,0,0.28,0.822,0.867-0.062          c0.589-0.882,0.398-1.503,0.226-1.912c-0.176-0.411,0.554-1.408,0.554-1.408l-0.048-1.684c0,0,0.213-1.064-0.186-1.563          c-0.397-0.498-1.25-1.276-1.25-1.276l-0.378-1.237l-0.291-1.036l-0.779-0.787L89.434,65.322z" fill="url(#XMLID_25_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_26_" x1="16.2236" x2="108.609" y1="69.042" y2="45.1617">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M62.973,43.091c0,0-0.318,0.657-0.716,0.156          c-0.399-0.5-0.399-0.5-0.399-0.5l-0.096-1.363c0,0,0.405,0.606,0.816-0.792c0.406-1.4,0.607-1.624,0.607-1.624l0.779-1.318          l0.514-0.88c0,0,0.834,0.47,0.939-0.068c0.108-0.535-0.479-0.598-1.135-0.657c-0.656-0.06-1.316-0.117-1.316-0.117          l-0.417-0.811l0.611-0.573l0.859-0.165l1.009-0.071l0.969,0.354c0,0,0.601,0.273,0.265,0.612          c-0.339,0.34-0.773,0.371-0.773,0.371l0.436,1.021c0,0,0.218-0.015,0.526,0.282c0.31,0.292-0.259,0.437,1.352,0.636          c1.611,0.205,1.611,0.205,1.611,0.205l0.803,0.045c0,0-0.428,0.135,0.646-0.045c1.075-0.182,1.971-0.879,1.971-0.879          l0.252-0.542l-1.187-0.336c0,0-0.534-0.384-0.49,0.243c0.048,0.629-0.538,0.566-0.538,0.566l-0.759-0.476l0.37-0.867          l0.978-0.593c0,0-0.53-0.281-1.396-0.221c-0.866,0.063-1.011,0.073-1.011,0.073l-0.697-0.685l2.235-0.16          c0,0,1.093-0.922,1.716-0.333c0.618,0.589,0.56,0.696,0.658,1.111c0.104,0.414,0.777,0.683,0.777,0.683          s-1.125,0.504,0.52,0.174c1.644-0.327,0.008,1.16,1.474,0.315c1.465-0.84,0.926-1.224,1.939-1.298          c1.009-0.069,1.009-0.069,1.009-0.069s-0.262-0.611-0.426-0.917c-0.167-0.304,0.031-0.526,0.031-0.526l0.955,0.139          l0.397,0.499l0.889,0.253c0,0,0.311,0.294,1.12,0.448c0.81,0.152,1.625,0.409,1.625,0.409l0.644-0.146          c0,0,0.401-1.506,0.683-0.58c0.284,0.929,0.646,0.905,0.646,0.905l0.743,0.261l0.519-0.88l0.763-0.475l0.389,0.394          l0.142,0.939l0.542-0.567l0.272-0.225c0,0,0.389-0.666,0.706-0.263c0.319,0.397,0.689,0.478,0.689,0.478l1.047,0.453          l0.405,0.601l0.722-0.054l0.392,0.397l0.716-0.156l0.914-0.382l0.873,0.045l0.174,0.408l0.251,1.455l-0.542,0.566          l-0.251,0.544l-0.663,0.891l-0.455,0.771l-0.782,0.16l-0.171,0.646l-0.799,0.054l0.197,0.721l-0.148,0.96l-0.425,1.189          l-0.929,0.174c0,0,0.338-0.338,0.286-1.075c-0.056-0.732-0.16-1.253-0.16-1.253l0.294-0.968l0.227-0.855l-0.894,0.694          c0,0-0.565,1.197-1.021,0.913c-0.457-0.284-0.457-0.284-0.457-0.284l0.111,1.574l0.074,1.046l-0.143,1.063l0.16,1.252          c0,0-0.839-0.573-1.371,0.097c-0.533,0.671-1.013,2.077-1.013,2.077l-0.063,1.159l0.722-1.105c0,0,0.982-0.49,0.958-0.803          c-0.023-0.313,0.235-0.754,0.235-0.754l0.927-0.279l-0.419,1.297l-0.636,2.255c0,0-0.406,0.45-0.237,0.756          c0.165,0.301,0.842,1.621,0.257,1.561c-0.584-0.065-0.758,0.578-1.036-0.244c-0.271-0.821-0.271-0.821-0.271-0.821          s-0.186,0.436-0.774,0.37c-0.583-0.064-0.352,1.181-0.583-0.064c-0.236-1.248-0.162-1.252-0.266-1.665          c-0.101-0.414-0.378-1.239-0.594-1.223c-0.217,0.015-0.461,0.664-0.461,0.664l0.371,1.132l0.449,1.234l0.134,1.887          l-0.36,1.076l-0.688-0.582c0,0,0.414-0.241-0.543,0.561c-0.958,0.808-0.958,0.808-0.958,0.808s-0.562,0.25-0.164,0.75          c0.396,0.498,0.476,0.597,0.231,1.248c-0.241,0.648-0.615,1.518-0.615,1.518l-0.504,1.088l0.074,1.051          c0,0,0.48,0.594,0.647,0.897c0.163,0.304,0.312,1.35,0.312,1.35l0.801-1.007l-0.454-1.231l0.614-0.568l0.525-0.775          l0.49-0.247l0.182,0.515l0.386,1.342l0.498-0.138l0.787-0.166l0.776-0.266l1.05,0.454l0.566,0.802l1.355-0.307          c0,0,1.713-0.439,1.745,0.087c0.039,0.522-0.145,0.011,0.039,0.522c0.182,0.515,0.731,1.106,0.731,1.106          s0.966,0.355,1.584,0.835c0.609,0.48,1.033,1.295,1.033,1.295s0.331,0.607,0.131,0.835c-0.2,0.225-0.669,0.785-0.669,0.785          s0.157,1.146,0.249,1.455c0.096,0.31,0.33,1.557,0.33,1.557l0.105,0.516l-0.746-0.261l-0.481-0.701l-0.035-1.576          l-0.056-0.734l-0.012-1.159c0,0,0.038-0.527-0.197-0.72c-0.23-0.194-0.563-0.805-0.563-0.805s-0.402,0.451-1.11-0.342          c-0.712-0.79-0.496-0.806-0.712-0.79c-0.215,0.016-0.701-0.689-0.701-0.689l-0.006,0.946l0.141,0.939l-0.831-0.466          l-0.397-0.499L88.92,64.2l-0.549-0.593c0,0-0.875-0.046-1.331-0.328c-0.456-0.28-0.766-0.575-0.766-0.575l-0.031-0.418          l-1.486,1.072c0,0,1.662,0.389,1.889,0.478c0.225,0.09,0.522,0.172,0.522,0.172l-0.254,0.543l-1.363,0.203          c0,0-0.253,0.548-0.469,0.564c-0.219,0.014-1.747-0.088-1.968-0.181c-0.227-0.088-1.479-1.365-1.479-1.365l-0.363-1.029          l-0.266-1.666c0,0-0.679-0.372-0.631-0.692c0.051-0.318,0.008-0.946,0.026-1.688c0.021-0.738,0-1.051,0-1.051l-0.327-0.505          l-0.437-1.024l-0.411-0.707l-0.348,0.24l-0.947,1.957l-0.121,1.381l-0.357,1.075c0,0-0.338,0.342-0.903-0.459          c-0.947-1.349-0.532-1.33-0.532-1.33l-0.767-1.633l-0.672-1.319l-0.602-0.276l-0.817-0.254l-0.096,1.69l-0.735,0.897          l-0.317,0.653l-0.394,0.554l1.018,1.087c0,0-0.493,1.192-0.723,2.05c-0.229,0.859-1.577,2.324-1.577,2.324l0.009,1.157          l0.748,1.317l-0.625,1.412l-0.601,2.785l-0.545,1.508l-0.7,2.368l-0.744,0.79c0,0-1.091-0.028-1.422-0.634          c-0.336-0.61-0.604-1.332-0.604-1.332l-1.087-3.078l-0.082-1.151c0,0-0.545-0.488-0.307-1.244          c0.237-0.754,0.237-0.754,0.237-0.754l-0.297-1.031l-0.15-1.148L63.828,64.3l-0.285-0.928c0,0,0.806-0.898,0.143-1.063          c-0.667-0.159-0.667-0.159-0.667-0.159l-0.54-0.492l-0.289,0.019l-1.256,0.722c0,0,1.058,0.557-0.604,0.679          c-1.66,0.115-1.274-1.597-1.274-1.597l-1.166-2.132l-0.395-2.496l0.649-0.991l0.021-1.792l-0.022-1.371l1.073-0.18          l1.025-0.914l1.366-1.152l1.771,0.401c0,0,0.218,1.036,1.05,1.503c0.83,0.467,0.83,0.467,0.83,0.467          s1.121-0.603,1.614-0.748c0.5-0.137,1.33-0.726,0.452-0.766c-0.87-0.045-1.124-0.552-1.124-0.552s-0.231-1.248-0.116-0.625          c0.116,0.625,0.023,1.369,0.023,1.369l-0.362,0.023c0,0-0.666-1.214-0.889-1.303c-0.225-0.09-1.021-1.09-1.021-1.09          s-0.87-1.464-0.436-0.311c0.293,0.782,0.697,0.925,0.697,0.925s0.218,0.08,0.063,0.857c-0.21,1.053-0.467-0.407-0.467-0.407          l-1.072-0.824l-1.009,0.13l-0.78,0.592l-0.269,0.334c0,0-0.216,1.25-0.678,0.861c-0.466-0.386-1.073-1.377-1.073-1.377          l0.162-0.752l0.69-0.574l0.803-0.975l-0.103-0.335c0,0-0.036-0.527-0.276-0.824c-0.24-0.299-0.174-0.407-0.605-0.379          c-0.434,0.033-0.728,0.052-0.685-0.474c0.032-0.533,0.578-0.995,0.578-0.995l0.099-1.694c0,0,0.943-1.011,1.23,0.021          c0.295,1.027,0.677,0.269,0.74,1.215c0.07,0.94,0.213,0.929,0.213,0.929s-0.093-0.305,1.063-0.389          c1.153-0.085,1.297-0.092,1.297-0.092s0.281-0.128,0.865-1.115c0.581-0.993,1.476-1.686,1.476-1.686          s-0.018-1.265-0.138-0.938c-0.123,0.324-0.744,0.788-0.744,0.788l-0.453-0.281l0.188-1.384l-0.956,0.806l0.052,0.732          c0,0,0.658,0.061,0.083,1.151c-0.578,1.094-0.578,1.094-0.578,1.094L62.973,43.091z" fill="url(#XMLID_26_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_27_" x1="19.8057" x2="112.2163" y1="82.96" y2="59.0731">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M71.926,66.986l-0.914,1.436l-0.141,1.064c0,0-0.518-1.12-0.256,0.544          c0.266,1.667,0.449,2.181,0.449,2.181l0.596-0.779l0.078-0.954l0.342-0.343l-0.145-0.936c0,0,0.399,0.5,0.362-0.025          C72.262,68.647,71.926,66.986,71.926,66.986z" fill="url(#XMLID_27_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_28_" x1="22.6855" x2="115.0264" y1="93.8945" y2="70.0257">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M95.86,73.079l0.12,0.622c0,0-0.217,1.068-0.415,1.295          c-0.202,0.224-0.647,1.099-0.647,1.099l0.386,1.344l0.379-0.768c0,0,0.199-0.223,0.503-1.089          c0.301-0.864,0.301-0.864,0.301-0.864s1.164,0.025,0.669-0.785c-0.493-0.806-0.493-0.806-0.493-0.806l-0.759-0.474          L95.86,73.079z" fill="url(#XMLID_28_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_29_" x1="17.7744" x2="110.2748" y1="75.3877" y2="51.4777">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M85.184,55.517l-0.498,0.14l-0.104,1.587l0.41,0.71l-0.184,0.431          c0.695,0.583,0.695,0.583,0.695,0.583s0.154,1.147,0.658,1.111c0.503-0.037,0.511,0.067,0.403-0.45          c-0.108-0.516-0.203-0.827-0.203-0.827l-0.328-0.509l-0.146-1.038c0,0-0.423,0.136-0.477-0.598          C85.356,55.923,85.184,55.517,85.184,55.517z" fill="url(#XMLID_29_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_30_" x1="15.1699" x2="107.3327" y1="64.6514" y2="40.8286">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M46.776,56.417c0,0-0.209,0.094,0.073,0.234          c0.279,0.137,0.336-0.219,0.336-0.219l-0.395-0.212" fill="url(#XMLID_30_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_31_" x1="15.3945" x2="107.8038" y1="65.8691" y2="41.9827">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M46.558,56.748l-0.185,0.091c0,0,0.058-0.357-0.133,0.051          c-0.131,0.284,0.008,0.08,0.015,0.589c0.015,0.51,0.211,0.262,0.211,0.262l0.123,0.227l0.15,0.967l0.16-0.047          c0,0,0.049-0.476,0.094-0.597c0.049-0.122,0.125,0.266,0.156-0.125c0.022-0.396,0.007-0.594,0.007-0.594l-0.099-0.266          L46.558,56.748z" fill="url(#XMLID_31_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_32_" x1="15.582" x2="108.0492" y1="66.6826" y2="42.7812">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M48.413,57.718c0,0-0.048,0.042-0.325-0.016          c-0.275-0.06-0.194-0.064-0.275-0.06c-0.078,0.009-0.114-0.107-0.154,0.091c-0.04,0.199-0.053-0.313-0.04,0.199          c0.009,0.513,0.009,0.513,0.009,0.513s-0.239,0.487-0.045,0.552c0.194,0.066,0.359,0.014,0.359,0.014l0.232-0.097          l0.053-0.435c0,0,0.104-0.047,0.348-0.063c0.244-0.018,0.132-0.405,0.244-0.018c0.108,0.381,0.108,0.381,0.108,0.381          l0.212-0.012l0.037-0.67l-0.496-0.085l-0.184-0.3L48.413,57.718z" fill="url(#XMLID_32_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_33_" x1="15.8721" x2="108.2587" y1="67.6885" y2="43.8079">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M50.174,58.814l-0.077-0.35c0,0-0.232-0.18-0.215,0.056          c0.016,0.236,0.031,0.433,0.031,0.433l0.104,0.306l0.456-0.029l0.089-0.283" fill="url(#XMLID_33_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_34_" x1="16.9404" x2="109.3327" y1="71.8242" y2="47.9421">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M43.595,64.672c0,0-0.216-0.417-0.282-0.176          c-0.064,0.239-0.147,0.242-0.147,0.242s-0.364-0.244-0.143,0.289c0.227,0.532,0.227,0.532,0.227,0.532l0.381-0.063          l0.205-0.49l-0.157-0.341" fill="url(#XMLID_34_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_35_" x1="14.543" x2="106.9325" y1="62.543" y2="38.6616">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M31.464,59.072l-0.632-1.218c0,0-0.486-0.758-0.557-0.121          c-0.061,0.636-0.061,0.636-0.061,0.636l0.716,0.9L31.464,59.072z" fill="url(#XMLID_35_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_36_" x1="11.8662" x2="104.3899" y1="52.4629" y2="28.5468">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<polygon fill="url(#XMLID_36_)" points="57.311,40.015 56.589,40.545 56.155,40.576 56.438,41.499           57.196,41.447 57.91,40.761 "/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_37_" x1="18.709" x2="111.0617" y1="78.5752" y2="54.7033">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M76.139,63.005c0,0-0.774,1.319-0.114,1.429          c0.659,0.112,0.484-0.825,0.484-0.825L76.139,63.005z" fill="url(#XMLID_37_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_38_" x1="19.1914" x2="111.468" y1="80.2451" y2="56.3929">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M77.042,64.995c0,0-0.898-0.412-0.759,0.05          c0.143,0.467,0.478,0.6,0.478,0.6s1.009,0.403,0.866-0.063C77.483,65.119,77.042,64.995,77.042,64.995z" fill="url(#XMLID_38_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_39_" x1="17.9805" x2="110.4226" y1="75.9893" y2="52.0943">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<polygon fill="url(#XMLID_39_)" points="76.362,59.986 76.255,61.573 76.808,61.693 "/>
+</g>
+<g>
+<path d="M41.044,32.042          c0,0,23.302-10.612,35.132,3.557c9.112,10.922,8.021,28.051,22.711,32.919" fill="none" stroke="#FFFFFF" stroke-width="0.3671"/>
+<path d="M36.957,33.544          c0,0,23.306-10.61,35.135,3.564c9.893,11.849,7.76,31.013,26.826,33.88" fill="none" stroke="#FFFFFF" stroke-width="0.3671"/>
+<path d="M32.87,35.05c0,0,23.31-10.612,35.138,3.561          C78.53,51.222,75.444,72.112,98.77,72.838" fill="none" stroke="#FFFFFF" stroke-width="0.3671"/>
+<path d="M28.787,36.557          c0,0,23.304-10.611,35.135,3.561c11.09,13.286,7.071,35.761,34.746,34.168" fill="none" stroke="#FFFFFF" stroke-width="0.3671"/>
+</g>
+<g>
+<path d="M45.734,56.435          c0,0,10.418,22.557,24.457,11.35c10.525-8.405,17.391-27.874,28.563-28.153" fill="none" stroke="#FFFFFF" stroke-width="0.4444"/>
+<path d="M43.752,52.896          c0,0,10.417,22.551,24.455,11.343c11.139-8.894,18.18-30.185,30.57-27.997" fill="none" stroke="#FFFFFF" stroke-width="0.4444"/>
+<path d="M41.771,49.354          c0,0,10.414,22.554,24.45,11.343c11.679-9.323,18.856-32.275,32.411-27.51" fill="none" stroke="#FFFFFF" stroke-width="0.4444"/>
+<path d="M39.784,45.812          c0,0,10.415,22.556,24.452,11.346c12.226-9.761,19.514-34.453,34.353-26.663" fill="none" stroke="#FFFFFF" stroke-width="0.4444"/>
+</g>
+<radialGradient cx="-141.1055" cy="-1265.2515" fx="-141.1055" fy="-1265.2515" gradientTransform="matrix(0.7142 -0.1476 0.0768 0.3717 259.1947 540.2367)" gradientUnits="userSpaceOnUse" id="XMLID_40_" r="8.4065">
+<stop offset="0" style="stop-color:#4C4C4C"/>
+<stop offset="1" style="stop-color:#A2A2A2"/>
+</radialGradient>
+<path d="M67.206,89.562c0.356,1.727-2.046,3.68-5.358,4.368         c-3.316,0.688-6.297-0.157-6.651-1.883c-0.356-1.729,2.043-3.681,5.359-4.365C63.871,86.994,66.849,87.835,67.206,89.562z" fill="url(#XMLID_40_)" fill-opacity="0.99" stroke-opacity="0.99"/>
+<radialGradient cx="-600.7441" cy="-2790.7881" fx="-600.7441" fy="-2790.7881" gradientTransform="matrix(0.5056 -0.1045 0.0438 0.2118 469.1777 616.3123)" gradientUnits="userSpaceOnUse" id="XMLID_41_" r="8.4045">
+<stop offset="0" style="stop-color:#4C4C4C"/>
+<stop offset="1" style="stop-color:#A2A2A2"/>
+</radialGradient>
+<path d="M47.519,87.185c0.202,0.983-1.537,2.175-3.884,2.66         c-2.346,0.485-4.416,0.081-4.618-0.902s1.534-2.174,3.883-2.656C45.249,85.798,47.315,86.201,47.519,87.185z" fill="url(#XMLID_41_)" fill-opacity="0.99" stroke-opacity="0.99"/>
+<radialGradient cx="-263.5996" cy="-2310.998" fx="-263.5996" fy="-2310.998" gradientTransform="matrix(0.6652 -0.1375 0.0518 0.2505 332.1746 622.6993)" gradientUnits="userSpaceOnUse" id="XMLID_42_" r="8.407">
+<stop offset="0" style="stop-color:#4C4C4C"/>
+<stop offset="1" style="stop-color:#A2A2A2"/>
+</radialGradient>
+<path d="M42.761,78.948c0.24,1.162-2.069,2.621-5.156,3.262         c-3.092,0.64-5.789,0.214-6.029-0.95c-0.242-1.163,2.069-2.623,5.157-3.261C39.821,77.36,42.52,77.784,42.761,78.948z" fill="url(#XMLID_42_)" fill-opacity="0.99" stroke-opacity="0.99"/>
+<g>
+<path d="M73.424,80.401          c0,0-3.217,14.413-17.103,10.106c-10.229-3.17-20.063-12.965-29.005-11.878" fill="none" stroke="#FFFFFF" stroke-width="0.3836"/>
+<path d="M74.208,78.088          c0,0-3.218,14.409-17.099,10.103C46.582,84.93,36.471,74.65,27.322,76.438" fill="none" stroke="#FFFFFF" stroke-width="0.3836"/>
+<path d="M74.993,75.767          c0,0-3.216,14.416-17.099,10.106c-10.686-3.313-20.939-13.849-30.197-11.664c-0.171,0.041-0.343,0.087-0.514,0.135" fill="none" stroke="#FFFFFF" stroke-width="0.3836"/>
+</g>
+<g>
+<polygon fill="#494949" points="61.887,76.905 61.37,84.749 61.958,85.341 62.063,83.927 62.513,77.098 "/>
+<polygon fill="#494949" points="62.337,77.046 61.712,86.425 62.129,85.807 62.707,76.918 "/>
+<path d="M61.887,76.905c0.048,0.066,0.247,0.13,0.445,0.145l0.375-0.132c-0.13-0.098-0.359-0.13-0.484-0.122          L61.887,76.905z" fill="#494949"/>
+<path d="M62.273,77.048l-0.184,3.284c0.078,0.018,0.167,0.039,0.301,0.089          c2.802,1.236,2.174,3.118,1.177,4.718l0.259,0.208c0.745-1.01,1.246-2.433,1.127-3.279          c-0.361-2.305-2.745-2.591-2.621-5.017L62.273,77.048z" fill="#494949"/>
+<path d="M61.871,86.339c-0.548,0.855-1.731,1.391-2.645,1.196c-0.908-0.194-1.201-1.048-0.655-1.9          c0.549-0.854,1.73-1.39,2.642-1.193C62.124,84.637,62.417,85.485,61.871,86.339z" fill="#494949"/>
+<path d="M61.775,84.705c0.139,0.351,0.08,0.79-0.202,1.236c-0.549,0.852-1.731,1.384-2.643,1.191          c-0.224-0.05-0.411-0.137-0.557-0.256c0.125,0.328,0.421,0.575,0.858,0.668c0.912,0.192,2.094-0.34,2.642-1.19          C62.286,85.706,62.221,85.066,61.775,84.705z" fill="#494949"/>
+<path d="M64.052,85.226c0.76-0.998,1.276-2.416,1.17-3.268c-0.336-2.305-2.714-2.62-2.529-4.983          l-0.323,0.137c-0.157,2.407,2.198,2.676,2.554,4.951c0.117,0.847-0.349,2.274-1.099,3.284L64.052,85.226z" fill="#494949"/>
+</g>
+<g>
+<g>
+<path d="M45.473,84.414c0.847-0.811,1.526-2.044,1.553-2.845c0.024-2.171-2.124-2.808-1.614-4.959           l-0.315,0.08c-0.496,2.197,1.637,2.783,1.64,4.934c-0.017,0.8-0.652,2.047-1.489,2.87L45.473,84.414z" fill="#494949"/>
+<polygon fill="#494949" points="44.677,76.43 43.067,83.587 43.526,84.22 43.827,82.932 45.228,76.695 "/>
+<polygon fill="#494949" points="45.071,76.626 43.145,85.183 43.616,84.672 45.433,76.559 "/>
+<path d="M44.677,76.43c0.037,0.066,0.21,0.16,0.391,0.199l0.365-0.07c-0.108-0.105-0.314-0.171-0.432-0.18           L44.677,76.43z" fill="#494949"/>
+<path d="M45.015,76.618l-0.644,3.003c0.07,0.028,0.148,0.059,0.263,0.125           c2.408,1.541,1.556,3.186,0.407,4.522l0.209,0.226c0.83-0.825,1.496-2.063,1.512-2.861           c-0.003-2.177-2.157-2.784-1.694-5.002L45.015,76.618z" fill="#494949"/>
+</g>
+<path d="M43.355,85.139c-0.631,0.709-1.795,1.035-2.607,0.72c-0.813-0.31-0.96-1.136-0.33-1.845          c0.629-0.712,1.795-1.031,2.608-0.721C43.835,83.605,43.984,84.431,43.355,85.139z" fill="#494949"/>
+<path d="M43.504,83.619c0.075,0.341-0.04,0.74-0.367,1.107c-0.626,0.707-1.792,1.031-2.604,0.719          c-0.2-0.074-0.358-0.184-0.477-0.313c0.069,0.318,0.304,0.588,0.697,0.739c0.81,0.309,1.978-0.013,2.605-0.719          C43.832,84.616,43.864,84.017,43.504,83.619z" fill="#494949"/>
+</g>
+<g>
+<g>
+<path d="M40.66,73.49c0.549-1.359,0.692-3.111,0.313-4.037c-1.088-2.489-3.86-2.112-4.382-4.827           l-0.32,0.254c0.563,2.758,3.295,2.333,4.397,4.784c0.391,0.918,0.308,2.665-0.226,4.032L40.66,73.49z" fill="#494949"/>
+<polygon fill="#494949" points="35.661,64.793 37.496,73.78 38.34,74.267 38.023,72.644 36.426,64.816 "/>
+<polygon fill="#494949" points="36.212,64.816 38.398,75.56 38.676,74.735 36.588,64.555 "/>
+<path d="M35.661,64.793c0.077,0.06,0.321,0.076,0.547,0.027l0.38-0.266           c-0.177-0.066-0.445-0.033-0.581,0.019L35.661,64.793z" fill="#494949"/>
+<path d="M36.141,64.836l0.808,3.754c0.092-0.004,0.197-0.009,0.361,0.008           c3.537,0.525,3.407,2.835,2.783,4.945l0.354,0.152c0.524-1.364,0.648-3.119,0.256-4.036           c-1.116-2.481-3.887-2.07-4.493-4.834L36.141,64.836z" fill="#494949"/>
+</g>
+<path d="M38.617,75.403c-0.355,1.131-1.519,2.097-2.604,2.155c-1.084,0.063-1.678-0.804-1.321-1.937          c0.352-1.131,1.519-2.094,2.602-2.157C38.379,73.405,38.971,74.272,38.617,75.403z" fill="#494949"/>
+<path d="M38.008,73.592c0.261,0.351,0.334,0.865,0.151,1.452c-0.354,1.13-1.519,2.095-2.604,2.155          c-0.269,0.016-0.504-0.027-0.706-0.115c0.245,0.329,0.649,0.516,1.172,0.486c1.085-0.063,2.251-1.028,2.604-2.153          C38.892,74.562,38.62,73.861,38.008,73.592z" fill="#494949"/>
+</g>
+</g>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/icons/qgn_graf_mup_podcast_art.svg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,324 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" baseProfile="tiny" height="120" viewBox="0 0 120 120" width="120">
+<switch>
+<foreignObject content="structured text" height="1" requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" width="1" x="0" y="0"/>
+<g>
+<g>
+<g>
+<g>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_29_" x1="0.0176" x2="63.6712" y1="12.8159" y2="62.7262">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.236" style="stop-color:#EBEBEB"/>
+<stop offset="0.4122" style="stop-color:#E9E9E9"/>
+<stop offset="0.4756" style="stop-color:#E2E2E2"/>
+<stop offset="0.4775" style="stop-color:#E2E2E2"/>
+<stop offset="1" style="stop-color:#4D4D4D"/>
+</linearGradient>
+<path d="M96.344,18.026L96.344,18.026l0.006-0.007c0,0-3.72-1.891-8.415-1.935l-60.491,5.074         c0,0-3.893,0.217-5.828,1.571c-1.782,1.243-1.61,3.155-1.61,3.155l0.691,71.479c0,0-0.012,2.439,2.035,3.257         c0.031,0.01,0.076,0.019,0.099,0.031c0.301,0.139,0.888,0.635,1.477,1.173c0.871,0.805,1.746,1.71,1.687,1.688L96.344,18.026         z" fill="url(#XMLID_29_)"/>
+<path d="M91.839,17.279c0,0,3.332,0.04,5.218,1.068c2.128,1.166,2.165,3.746,2.165,3.746l0.768,60.901         c0,0,0.218,2.344-1.323,3.996c-1.25,1.342-3.975,2.153-3.975,2.153l-62.695,14.491c0,0-3.812,0.705-6.003-0.122         c-2.197-0.829-2.183-3.323-2.183-3.323l-0.599-72.854c0,0-0.191-1.947,1.724-3.211c2.08-1.379,6.258-1.608,6.258-1.608         L91.839,17.279z" fill="#FFFFFF"/>
+<radialGradient cx="1841.3691" cy="493.0439" fx="1841.3691" fy="493.0439" gradientTransform="matrix(-0.5936 0 0 -0.3989 1122.666 225.1939)" gradientUnits="userSpaceOnUse" id="XMLID_30_" r="173.4796">
+<stop offset="0" style="stop-color:#F3F3F3"/>
+<stop offset="1" style="stop-color:#9A9A9A"/>
+</radialGradient>
+<path d="M95.02,86.956c0,0,2.163-0.431,2.802-1.282c0.631-0.86,0.887-2.141,0.887-2.141L98.37,22.518         c0,0,0-1.54-1.269-2.049c-1.276-0.514-3.729-0.339-3.729-0.339l-61.454,5.86c0,0-2.868,0.188-3.95,1.031         c-1.104,0.868-1.134,2.218-1.134,2.218l0.927,68.679c0,0-0.165,1.563,1.494,2.071c1.653,0.51,3.941,0.392,3.941,0.392         L95.02,86.956z" fill="url(#XMLID_30_)"/>
+<g>
+<g>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_31_" x1="20.4014" x2="94.4492" y1="42.7021" y2="68.0903">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M34.819,42.527l0.698-0.162l0.993-0.31l0.282-0.878l0.695-0.158           l1.304,0.118l0.324,1.154l0.928,1.14l0.496-0.009l0.617,0.857l0.223,1.01l0.481,3.815c0,0,0.165,1.35,0.638,1.825           c1.061,1.049,1.975,3.443,1.975,3.443l2.027,1.262l1.521,0.839l0.617,0.858l0.823,1.141L49.28,59.35           c0,0-0.305-0.284,0.148,2.174c0.454,2.46,0.767,3.182,0.767,3.182s0.537-2.916,1.019,0.846           c0.481,3.767,0.619,0.86-0.153,2.329c-0.77,1.467,0.919,0.851-0.045,2.469c-0.965,1.616-0.254,2.184-0.254,2.184           l-0.054,2.325l0.03,1.308l0.322,1.007l1.004,0.122l-0.026-1.161c0,0-0.096,0.149,0.279-1.021           c0.376-1.169,0.461-1.752,0.461-1.752l0.093-0.438l0.865-1.617l0.775-1.175l0.771-1.325l0.559-1.897           c0,0,0.687-0.742,0.98-1.036c0.295-0.298,0.356-2.043,0.356-2.043l0.67-1.465c0,0,0.394-0.298-0.635-1.586           c-1.027-1.285-1.729-1.415-1.729-1.415s-0.021-0.867-0.431-1.295c-0.408-0.431-0.294,0.293-0.92-0.996           c-0.628-1.294-0.426-1.153-1.326-1.278c-0.905-0.128-0.905-0.128-0.905-0.128l-1.699,0.039l-0.493,0.299           c0,0,0.126,1.157-0.394,0.299c-0.517-0.857-0.529-1.439-0.529-1.439s0.391-0.447,0.273-1.171           c-0.115-0.722-0.115-0.722-0.115-0.722l-0.704-0.13l-0.686,0.597l-0.279,1.02c0,0-0.698,0.018-0.714-0.707           c-0.017-0.728-0.017-0.728-0.017-0.728l0.675-1.177l1.086-0.748l0.724,1.144c0,0,0.611,0.568,0.595-0.3           c-0.019-0.872-0.019-0.872,0.17-1.311c0.192-0.439,0.501-0.008,0.976-1.182c0.477-1.171-0.893-0.263,0.477-1.171           c0.524-0.35,0.679-1.036,0.679-1.036c-0.444-0.471,0.344-0.972,0.344-0.972l0.478,0.476l0.534,0.086l-0.215-0.869           l-0.149-0.576l0.604,0.085l0.478,0.57c0,0,0.525-0.399,0.38-0.977c-0.146-0.575-0.761-1.243-0.761-1.243           s0.805,0.079,0.187-0.779c-0.62-0.857-0.935,0.024-1.147-0.458c-0.205-0.482,0.452-0.784-0.227-1.446           c-0.683-0.664-0.874-0.274-0.874-0.274s-0.269-0.088-0.013-0.579c0.255-0.492,0.452-0.688,0.452-0.688l0.447-0.883           l-0.148-0.671l-0.281-0.672l-0.827-1.438l-0.41-0.279l0.927-0.409c0,0,0.541,0.377,0.751,0.762           c0.205,0.381,1.176,1.91,1.176,1.91l0.153,0.963l0.957,1.14l0.809,0.468l0.283,0.77l0.768-1.467l0.904-1.278l1.065-0.314           c0,0,0.257-0.488,0.45-0.591c0.201-0.1-0.056,0.393,0.799-0.111c0.857-0.502,0.847-0.986,0.847-0.986l0.31-1.073           c0,0-0.541-0.375-0.219-0.964c0.319-0.586,0.52-0.686,0.52-0.686l0.388-0.493c0,0-0.212-0.673-0.947-0.66           c-0.733,0.017-1.065,0.027-1.065,0.027l-3.403-0.22l-1.864,0.23l-0.324,0.395L53.446,32.6l-0.392,0.393l-0.731,0.013           l-1.131,0.124l-0.659,0.401l-1.061,0.407l-0.247,0.779c0,0,0.49-1.946-0.304-1.734C48.125,33.197,48,33.585,48,33.585           l-0.737-0.179l-0.212-0.576l-0.667,0.013l-0.717,0.791l0.347,0.476l-0.663,0.308l-0.115,0.87l0.015,0.581l0.076,0.485           l-0.404-0.184l-0.28-0.579l-0.279-0.574l-0.803-0.178l-0.468,0.107L42.5,35.348l-0.346-0.576l-1.117,0.606           c0,0,0.736,0.176-0.19,0.586c-0.925,0.405-0.645,1.078-0.845,0.984c-0.199-0.091-1.139-0.362-1.34-0.358           c-0.199,0.004-0.86,0.309-1.475-0.357c-0.613-0.663-2.2,0.047-2.2,0.047l-0.976,1.086c0,0-0.465,0.205-0.38,0.98           c0.082,0.769-0.379,0.972-0.098,1.646c0.278,0.669,0.417,0.765,0.586,2.5c0.169,1.74,0.289,1.062,0.289,1.062l0.317-0.781           L34.819,42.527z" fill="url(#XMLID_31_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_32_" x1="19.9912" x2="94.0379" y1="43.9092" y2="69.2969">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M88.628,62.822l-0.444,0.979L87.77,63.13l-0.81-0.271           c0,0-0.125,0.292-0.589,0.399c-0.463,0.106-1.053,0.602-1.053,0.602l-0.718,0.788l-0.646,0.888l-0.311,1.069l0.312,2.124           l0.308,2.027l0.986-0.698c0,0-0.152-0.772,1.183-0.802c1.334-0.027,0.458-0.493,1.34,0.361           c0.887,0.851,0.961,1.236,0.961,1.236l0.815,0.658l-0.129,0.296l-0.183,0.678c0,0,0.216,0.771,0.799-0.015           c0.583-0.784,0.437-1.364,0.296-1.748c-0.142-0.387,0.569-1.271,0.569-1.271l0.036-1.549c0,0,0.246-0.972-0.098-1.449           c-0.343-0.478-1.094-1.232-1.094-1.232l-0.291-1.156L89.237,63.1l-0.683-0.759L88.628,62.822z" fill="url(#XMLID_32_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_33_" x1="23.5635" x2="97.6114" y1="33.4707" y2="58.8588">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M65.299,41.155c0,0-0.322,0.588-0.666,0.11           c-0.344-0.479-0.344-0.479-0.344-0.479l-0.026-1.258c0,0,0.347,0.575,0.788-0.692c0.438-1.269,0.633-1.466,0.633-1.466           l0.776-1.178l0.514-0.786c0,0,0.746,0.47,0.866-0.019c0.128-0.487-0.41-0.573-1.015-0.655           c-0.599-0.086-1.201-0.17-1.201-0.17l-0.35-0.764l0.589-0.498l0.798-0.115l0.934-0.018l0.876,0.369           c0,0,0.538,0.279,0.213,0.576c-0.327,0.296-0.728,0.305-0.728,0.305l0.353,0.959c0,0,0.202-0.003,0.474,0.284           c0.272,0.283-0.259,0.391,1.213,0.648c1.472,0.262,1.472,0.262,1.472,0.262l0.738,0.077c0,0-0.397,0.106,0.597-0.011           c0.998-0.117,1.854-0.719,1.854-0.719l0.255-0.487l-1.075-0.363c0,0-0.475-0.377-0.461,0.202           c0.011,0.58-0.522,0.495-0.522,0.495l-0.677-0.473l0.382-0.78l0.924-0.503c0,0-0.472-0.28-1.273-0.266           c-0.8,0.018-0.932,0.021-0.932,0.021l-0.612-0.663l2.066-0.043c0,0,1.049-0.799,1.592-0.229           c0.543,0.569,0.483,0.667,0.556,1.052c0.077,0.385,0.684,0.664,0.684,0.664s-1.058,0.41,0.472,0.183           c1.526-0.226-0.046,1.067,1.34,0.36c1.387-0.708,0.91-1.086,1.846-1.106c0.929-0.019,0.929-0.019,0.929-0.019           s-0.21-0.575-0.348-0.862c-0.14-0.289,0.052-0.484,0.052-0.484l0.873,0.172l0.342,0.477l0.808,0.274           c0,0,0.271,0.284,1.01,0.462c0.737,0.178,1.477,0.453,1.477,0.453l0.601-0.106c0,0,0.436-1.368,0.652-0.503           c0.221,0.868,0.554,0.864,0.554,0.864l0.671,0.274l0.52-0.786l0.725-0.403l0.338,0.38l0.085,0.871l0.525-0.497l0.262-0.197           c0,0,0.389-0.592,0.663-0.209c0.274,0.382,0.612,0.473,0.612,0.473l0.942,0.463l0.345,0.573l0.666-0.017l0.343,0.384           l0.665-0.11l0.857-0.311l0.803,0.081l0.142,0.384l0.163,1.351l-0.523,0.496l-0.256,0.488l-0.652,0.787l-0.452,0.689           l-0.73,0.11l-0.186,0.588l-0.736,0.013l0.149,0.672l-0.179,0.877l-0.446,1.074l-0.863,0.117c0,0,0.324-0.296,0.311-0.976           c-0.016-0.676-0.09-1.159-0.09-1.159l0.314-0.877l0.25-0.778l-0.854,0.598c0,0-0.577,1.075-0.981,0.794           c-0.407-0.282-0.407-0.282-0.407-0.282l0.029,1.454l0.019,0.965l-0.179,0.973l0.092,1.159c0,0-0.746-0.565-1.267,0.027           c-0.521,0.59-1.028,1.861-1.028,1.861l-0.108,1.067l0.711-0.984c0,0,0.928-0.406,0.919-0.694           c-0.006-0.292,0.253-0.686,0.253-0.686l0.863-0.213l-0.442,1.173l-0.689,2.046c0,0-0.395,0.395-0.253,0.685           c0.138,0.285,0.699,1.529,0.164,1.447c-0.535-0.085-0.724,0.496-0.942-0.271c-0.211-0.768-0.211-0.768-0.211-0.768           s-0.191,0.393-0.729,0.305c-0.536-0.087-0.379,1.069-0.536-0.087c-0.157-1.158-0.088-1.158-0.165-1.544           c-0.074-0.384-0.292-1.155-0.492-1.151c-0.2,0.003-0.454,0.592-0.454,0.592l0.29,1.058l0.357,1.154l0.034,1.741           l-0.377,0.976l-0.609-0.566c0,0,0.392-0.203-0.524,0.492c-0.919,0.699-0.919,0.699-0.919,0.699s-0.528,0.203-0.186,0.684           c0.342,0.476,0.41,0.569,0.154,1.155c-0.252,0.585-0.635,1.369-0.635,1.369l-0.513,0.979l0.021,0.969           c0,0,0.413,0.568,0.553,0.856c0.138,0.287,0.225,1.254,0.225,1.254l0.783-0.887l-0.363-1.155l0.592-0.496l0.521-0.688           l0.463-0.206l0.143,0.484l0.295,1.251l0.464-0.103l0.73-0.117l0.726-0.211l0.946,0.468l0.484,0.765l1.261-0.223           c0,0,1.597-0.323,1.604,0.16c0.012,0.484-0.136,0.004,0.012,0.484c0.142,0.479,0.622,1.052,0.622,1.052           s0.871,0.371,1.417,0.84c0.541,0.472,0.891,1.237,0.891,1.237s0.278,0.573,0.086,0.778           c-0.196,0.194-0.653,0.689-0.653,0.689s0.09,1.061,0.161,1.348c0.075,0.292,0.234,1.449,0.234,1.449l0.073,0.481           l-0.675-0.276l-0.411-0.666l0.038-1.452l-0.017-0.678l0.044-1.068c0,0,0.058-0.483-0.149-0.672           c-0.203-0.188-0.48-0.767-0.48-0.767s-0.392,0.396-1.006-0.365c-0.62-0.758-0.419-0.762-0.62-0.758           c-0.199,0.003-0.613-0.667-0.613-0.667l-0.051,0.871l0.089,0.871l-0.746-0.467l-0.341-0.479l-0.933,0.118l-0.477-0.573           c0,0-0.802-0.081-1.209-0.361c-0.407-0.278-0.68-0.563-0.68-0.563l-0.008-0.389l-1.418,0.919c0,0,1.512,0.434,1.715,0.527           c0.203,0.093,0.475,0.181,0.475,0.181l-0.26,0.489l-1.264,0.124c0,0-0.257,0.492-0.454,0.497           c-0.203,0.003-1.606-0.161-1.804-0.256c-0.207-0.091-1.301-1.324-1.301-1.324l-0.286-0.963l-0.167-1.545           c0,0-0.608-0.373-0.549-0.666c0.062-0.292,0.05-0.873,0.104-1.553c0.051-0.677,0.045-0.967,0.045-0.967l-0.278-0.479           l-0.353-0.961l-0.348-0.671l-0.329,0.204l-0.962,1.761l-0.176,1.263l-0.377,0.975c0,0-0.327,0.298-0.812-0.464           c-0.812-1.286-0.426-1.249-0.426-1.249l-0.632-1.539l-0.561-1.243l-0.54-0.283l-0.738-0.271l-0.168,1.553l-0.716,0.791           l-0.321,0.585l-0.389,0.493l0.888,1.047c0,0-0.512,1.074-0.759,1.854c-0.251,0.78-1.559,2.066-1.559,2.066l-0.045,1.063           l0.627,1.247l-0.639,1.27l-0.681,2.536l-0.57,1.363l-0.751,2.145l-0.722,0.694c0,0-1.002-0.075-1.281-0.649           c-0.279-0.576-0.492-1.249-0.492-1.249l-0.86-2.883l-0.024-1.066c0,0-0.477-0.475-0.224-1.157           c0.252-0.684,0.252-0.684,0.252-0.684l-0.225-0.962l-0.086-1.063l-0.281-0.672l-0.22-0.866c0,0,0.784-0.789,0.182-0.974           c-0.604-0.177-0.604-0.177-0.604-0.177l-0.477-0.478l-0.266,0.005l-1.189,0.607c0,0,0.946,0.559-0.587,0.594           c-1.532,0.032-1.099-1.526-1.099-1.526l-0.977-2.014l-0.248-2.314l0.646-0.884l0.099-1.646l0.041-1.263l0.996-0.116           l0.985-0.793l1.311-0.998l1.61,0.449c0,0,0.154,0.965,0.897,1.433s0.743,0.468,0.743,0.468s1.059-0.504,1.521-0.614           c0.465-0.104,1.255-0.608,0.451-0.685c-0.802-0.081-1.012-0.56-1.012-0.56s-0.157-1.159-0.077-0.58           c0.077,0.58-0.041,1.26-0.041,1.26l-0.333,0.005c0,0-0.558-1.146-0.761-1.239c-0.202-0.093-0.887-1.049-0.887-1.049           s-0.732-1.387-0.387-0.305c0.233,0.732,0.598,0.881,0.598,0.881s0.197,0.084,0.021,0.793           c-0.243,0.958-0.413-0.396-0.413-0.396L64.69,46.92l-0.937,0.075l-0.746,0.507l-0.26,0.296c0,0-0.256,1.14-0.664,0.761           c-0.41-0.377-0.924-1.317-0.924-1.317l0.184-0.682l0.658-0.497l0.786-0.86L62.71,44.89c0,0-0.012-0.487-0.216-0.773           c-0.208-0.284-0.144-0.381-0.541-0.375c-0.401,0.011-0.671,0.014-0.609-0.469c0.056-0.487,0.58-0.888,0.58-0.888           l0.168-1.552c0,0,0.912-0.89,1.132,0.073c0.224,0.96,0.606,0.278,0.625,1.152c0.02,0.868,0.153,0.865,0.153,0.865           s-0.072-0.287,0.996-0.31c1.063-0.024,1.195-0.027,1.195-0.027s0.267-0.104,0.848-0.986           c0.58-0.886,1.436-1.481,1.436-1.481s0.041-1.164-0.083-0.871c-0.129,0.294-0.721,0.693-0.721,0.693l-0.406-0.28           l0.239-1.264l-0.918,0.697l0.015,0.675c0,0,0.604,0.087,0.021,1.064c-0.579,0.978-0.579,0.978-0.579,0.978L65.299,41.155z" fill="url(#XMLID_33_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_34_" x1="18.627" x2="92.7656" y1="47.6621" y2="73.0814">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M72.441,63.553l-0.908,1.277l-0.176,0.975c0,0-0.425-1.058-0.261,0.487           c0.171,1.547,0.312,2.027,0.312,2.027l0.586-0.69l0.115-0.875l0.33-0.299l-0.089-0.866c0,0,0.345,0.478,0.334-0.005           C72.674,65.097,72.441,63.553,72.441,63.553z" fill="url(#XMLID_34_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_35_" x1="19.1514" x2="93.1728" y1="46.4375" y2="71.8166">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M94.186,70.254l0.085,0.576c0,0-0.25,0.975-0.444,1.175           c-0.196,0.197-0.647,0.98-0.647,0.98l0.296,1.253l0.383-0.686c0,0,0.194-0.197,0.515-0.979           c0.314-0.781,0.314-0.781,0.314-0.781s1.068,0.075,0.652-0.693c-0.417-0.764-0.417-0.764-0.417-0.764l-0.676-0.47           L94.186,70.254z" fill="url(#XMLID_35_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_36_" x1="23.2539" x2="97.2984" y1="34.3896" y2="59.7766">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M85.167,53.604l-0.466,0.108l-0.169,1.454l0.346,0.672l-0.19,0.389           c0.613,0.568,0.613,0.568,0.613,0.568s0.09,1.062,0.557,1.052c0.466-0.012,0.467,0.086,0.392-0.396           c-0.077-0.479-0.152-0.77-0.152-0.77L85.821,56.2l-0.087-0.962c0,0-0.396,0.105-0.41-0.571           C85.309,53.987,85.167,53.604,85.167,53.604z" fill="url(#XMLID_36_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_37_" x1="20.3477" x2="94.6031" y1="42.5908" y2="68.0501">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M49.787,52.676c0,0-0.198,0.076,0.055,0.219           c0.252,0.14,0.321-0.188,0.321-0.188l-0.354-0.213" fill="url(#XMLID_37_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_38_" x1="20.0352" x2="94.0284" y1="43.8418" y2="69.2112">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M49.57,52.968l-0.176,0.077c0,0,0.07-0.326-0.121,0.04           c-0.136,0.257,0,0.074-0.016,0.544c-0.011,0.469,0.184,0.25,0.184,0.25l0.104,0.213l0.091,0.899l0.151-0.037           c0,0,0.066-0.435,0.112-0.546c0.05-0.109,0.104,0.253,0.149-0.107c0.039-0.363,0.034-0.546,0.034-0.546l-0.077-0.249           L49.57,52.968z" fill="url(#XMLID_38_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_39_" x1="19.9678" x2="94.0471" y1="43.9238" y2="69.3227">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M51.233,53.946c0,0-0.045,0.037-0.298-0.028           c-0.252-0.067-0.176-0.067-0.252-0.067c-0.074,0.004-0.102-0.104-0.146,0.077c-0.048,0.179-0.034-0.292-0.048,0.179           c-0.016,0.475-0.016,0.475-0.016,0.475s-0.24,0.438-0.064,0.504c0.176,0.07,0.328,0.03,0.328,0.03l0.219-0.077l0.068-0.398           c0,0,0.099-0.037,0.324-0.043c0.225-0.005,0.14-0.367,0.225-0.005c0.083,0.356,0.083,0.356,0.083,0.356l0.197-0.002           l0.063-0.615l-0.452-0.102l-0.156-0.283H51.233z" fill="url(#XMLID_39_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_40_" x1="19.9209" x2="94.1592" y1="43.8242" y2="69.2777">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M52.803,55.035l-0.056-0.326c0,0-0.206-0.176-0.2,0.043           c0.006,0.216,0.009,0.399,0.009,0.399l0.081,0.285l0.424-0.007l0.096-0.257" fill="url(#XMLID_40_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_41_" x1="17.6709" x2="91.7529" y1="50.6191" y2="76.019">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M46.482,60.124c0,0-0.182-0.395-0.253-0.174           c-0.07,0.217-0.146,0.217-0.146,0.217s-0.325-0.244-0.146,0.258c0.188,0.501,0.188,0.501,0.188,0.501l0.347-0.041           l0.215-0.438l-0.129-0.325" fill="url(#XMLID_41_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_42_" x1="18.5381" x2="92.5908" y1="48.1309" y2="73.5206">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M35.573,54.415l-0.524-1.149c0,0-0.413-0.72-0.504-0.136           c-0.088,0.581-0.088,0.581-0.088,0.581l0.619,0.862L35.573,54.415z" fill="url(#XMLID_42_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_43_" x1="25.7979" x2="99.7708" y1="27.0723" y2="52.4347">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<polygon fill="url(#XMLID_43_)" points="60.231,38.066 59.54,38.52 59.143,38.527 59.359,39.391            60.059,39.377 60.746,38.779 "/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_44_" x1="20.7188" x2="94.8233" y1="41.6406" y2="67.0482">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M76.501,60.081c0,0-0.773,1.18-0.171,1.31           c0.603,0.133,0.485-0.736,0.485-0.736L76.501,60.081z" fill="url(#XMLID_44_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_45_" x1="20.4072" x2="94.4089" y1="42.8018" y2="68.174">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<path d="M77.241,61.951c0,0-0.81-0.416-0.7,0.016           c0.111,0.435,0.412,0.571,0.412,0.571s0.909,0.416,0.8-0.018C77.644,62.088,77.241,61.951,77.241,61.951z" fill="url(#XMLID_45_)"/>
+<linearGradient gradientUnits="userSpaceOnUse" id="XMLID_46_" x1="21.5547" x2="95.6934" y1="39.1152" y2="64.5345">
+<stop offset="0" style="stop-color:#A7A7A7"/>
+<stop offset="0.1461" style="stop-color:#A7A7A7"/>
+<stop offset="0.3382" style="stop-color:#A0A0A0"/>
+<stop offset="0.6135" style="stop-color:#8D8D8D"/>
+<stop offset="0.9045" style="stop-color:#727272"/>
+<stop offset="1" style="stop-color:#727272"/>
+</linearGradient>
+<polygon fill="url(#XMLID_46_)" points="76.842,57.316 76.675,58.77 77.177,58.905 "/>
+</g>
+<g>
+<circle cx="46.47" cy="33.955" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="46.469" cy="33.954" fill="none" r="3.966" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="46.47" cy="33.954" fill="none" r="2.379" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="46.47" cy="33.954" fill="none" r="0.952" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="91.313" cy="37.313" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="91.313" cy="37.313" fill="none" r="3.965" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="91.313" cy="37.313" fill="none" r="2.379" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="91.313" cy="37.313" fill="none" r="0.953" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="49.775" cy="59.927" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="49.774" cy="59.926" fill="none" r="3.966" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="49.776" cy="59.926" fill="none" r="2.379" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="49.775" cy="59.926" fill="none" r="0.951" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="63.032" cy="45.424" fill="none" r="5.178" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="63.031" cy="45.422" fill="none" r="3.966" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="63.032" cy="45.422" fill="none" r="2.378" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="63.033" cy="45.422" fill="none" r="0.952" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="40.84" cy="45.257" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="40.84" cy="45.257" fill="none" r="3.966" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="40.84" cy="45.257" fill="none" r="2.38" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="40.84" cy="45.257" fill="none" r="0.953" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="67.136" cy="32.996" fill="none" r="5.178" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="67.135" cy="32.996" fill="none" r="3.965" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="67.135" cy="32.996" fill="none" r="2.379" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="67.135" cy="32.996" fill="none" r="0.952" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="85.235" cy="48.85" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="85.234" cy="48.849" fill="none" r="3.965" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="85.234" cy="48.849" fill="none" r="2.379" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="85.235" cy="48.849" fill="none" r="0.952" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="80.667" cy="32.988" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="80.666" cy="32.988" fill="none" r="3.966" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="80.667" cy="32.988" fill="none" r="2.379" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="80.668" cy="32.988" fill="none" r="0.952" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="60.341" cy="56.659" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<path d="M64.308,56.659c0,2.188-1.776,3.963-3.968,3.963           c-2.189,0-3.966-1.774-3.966-3.963c0-2.191,1.776-3.968,3.966-3.968C62.531,52.691,64.308,54.468,64.308,56.659z" fill="none" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="60.341" cy="56.659" fill="none" r="2.379" stroke="#FFFFFF" stroke-width="0.0833"/>
+<path d="M61.293,56.659c0,0.524-0.426,0.948-0.953,0.948           c-0.522,0-0.95-0.424-0.95-0.948c0-0.527,0.428-0.952,0.95-0.952C60.867,55.707,61.293,56.132,61.293,56.659z" fill="none" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="52.479" cy="43.212" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="52.478" cy="43.211" fill="none" r="3.965" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="52.479" cy="43.211" fill="none" r="2.38" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="52.479" cy="43.211" fill="none" r="0.952" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="89.409" cy="72.876" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="89.408" cy="72.875" fill="none" r="3.965" stroke="#FFFFFF" stroke-width="0.1389"/>
+<path d="M91.786,72.875c0,1.316-1.063,2.379-2.376,2.379           c-1.316,0-2.381-1.063-2.381-2.379c0-1.313,1.064-2.38,2.381-2.38C90.723,70.495,91.786,71.563,91.786,72.875z" fill="none" stroke="#FFFFFF" stroke-width="0.0833"/>
+<path d="M90.36,72.875c0,0.525-0.426,0.954-0.95,0.954           c-0.527,0-0.953-0.429-0.953-0.954c0-0.523,0.426-0.95,0.953-0.95C89.935,71.925,90.36,72.352,90.36,72.875z" fill="none" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="50.94" cy="76.24" fill="none" r="5.178" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="50.94" cy="76.24" fill="none" r="3.966" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="50.941" cy="76.24" fill="none" r="2.379" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="50.941" cy="76.24" fill="none" r="0.952" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="81.746" cy="59.726" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="81.745" cy="59.726" fill="none" r="3.966" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="81.745" cy="59.726" fill="none" r="2.378" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="81.746" cy="59.726" fill="none" r="0.952" stroke="#FFFFFF" stroke-width="0.3556"/>
+<path d="M72.866,70.854c0,2.86-2.318,5.181-5.179,5.181           s-5.178-2.32-5.178-5.181c0-2.858,2.317-5.178,5.178-5.178S72.866,67.996,72.866,70.854z" fill="none" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="67.688" cy="70.854" fill="none" r="3.966" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="67.688" cy="70.854" fill="none" r="2.378" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="67.689" cy="70.854" fill="none" r="0.952" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="74.857" cy="43.911" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="74.858" cy="43.909" fill="none" r="3.965" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="74.859" cy="43.909" fill="none" r="2.379" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="74.857" cy="43.909" fill="none" r="0.951" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="69.601" cy="62.445" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<circle cx="69.6" cy="62.443" fill="none" r="3.965" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="69.6" cy="62.443" fill="none" r="2.378" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="69.6" cy="62.443" fill="none" r="0.951" stroke="#FFFFFF" stroke-width="0.3556"/>
+<circle cx="35.774" cy="54.348" fill="none" r="5.179" stroke="#FFFFFF" stroke-width="0.1813"/>
+<path d="M39.739,54.347c0,2.19-1.774,3.964-3.969,3.964           c-2.188,0-3.964-1.773-3.964-3.964c0-2.191,1.776-3.966,3.964-3.966C37.965,50.381,39.739,52.155,39.739,54.347z" fill="none" stroke="#FFFFFF" stroke-width="0.1389"/>
+<circle cx="35.774" cy="54.347" fill="none" r="2.379" stroke="#FFFFFF" stroke-width="0.0833"/>
+<circle cx="35.774" cy="54.347" fill="none" r="0.952" stroke="#FFFFFF" stroke-width="0.3556"/>
+</g>
+</g>
+<radialGradient cx="558.3994" cy="-905.1021" fx="558.3994" fy="-905.1021" gradientTransform="matrix(1.8047 -0.373 0.0867 0.4197 -880.9957 676.9406)" gradientUnits="userSpaceOnUse" id="XMLID_47_" r="8.408">
+<stop offset="0" style="stop-color:#4C4C4C"/>
+<stop offset="1" style="stop-color:#A2A2A2"/>
+</radialGradient>
+<path d="M63.399,85.663c0.402,1.949-6.066,4.933-14.446,6.665         c-8.381,1.733-15.499,1.557-15.902-0.394c-0.402-1.949,6.064-4.93,14.443-6.663C55.876,83.539,62.995,83.713,63.399,85.663z" fill="url(#XMLID_47_)" fill-opacity="0.99" stroke-opacity="0.99"/>
+<g>
+<polygon fill="#191E1C" points="42.536,91.387 44.373,90.469 44.318,88.334 42.468,88.848 "/>
+<linearGradient gradientTransform="matrix(1 0 0 -1 346.5 325.7461)" gradientUnits="userSpaceOnUse" id="XMLID_48_" x1="-300.1724" x2="-307.256" y1="233.5762" y2="236.8164">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.2458" style="stop-color:#FFFFFF"/>
+<stop offset="0.2682" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#333333"/>
+</linearGradient>
+<path d="M39.43,88.459l0.188,2.521c0.377,0.275,2.048,0.528,2.939,0.393l-0.052-2.845          C41.726,88.726,40.241,88.733,39.43,88.459z" fill="url(#XMLID_48_)"/>
+<linearGradient gradientTransform="matrix(1 0 0 -1 346.5 325.7461)" gradientUnits="userSpaceOnUse" id="XMLID_49_" x1="-307.4995" x2="-309.4137" y1="256.4258" y2="250.3085">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.2458" style="stop-color:#FFFFFF"/>
+<stop offset="0.2682" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#333333"/>
+</linearGradient>
+<path d="M36.966,74.271c0.08-0.725,0.557-1.31,1.059-1.305c0.457,0.005,0.782,0.497,0.771,1.135          c0.052-0.764-0.438-1.377-1.122-1.38c-0.707-0.011-1.356,0.641-1.447,1.446c-0.091,0.808,0.407,1.462,1.116,1.471          c0.119,0,0.235-0.02,0.352-0.054C37.21,75.556,36.887,74.98,36.966,74.271z" fill="url(#XMLID_49_)"/>
+<circle cx="37.893" cy="74.298" fill="#737373" r="0.998"/>
+<linearGradient gradientTransform="matrix(1 0 0 -1 346.5 325.7461)" gradientUnits="userSpaceOnUse" id="XMLID_50_" x1="-308.5513" x2="-300.4457" y1="259.2334" y2="254.6881">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.2458" style="stop-color:#FFFFFF"/>
+<stop offset="0.2682" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#333333"/>
+</linearGradient>
+<path d="M46.116,77.896l3.396-5.311c1.944-3.028,1.159-5.804-0.942-7.152          c-1.914-1.222-4.775-0.835-6.744,2.238l-3.795,5.932C40.101,73.635,44.805,75.863,46.116,77.896z" fill="url(#XMLID_50_)"/>
+<linearGradient gradientTransform="matrix(1 0 0 -1 346.5 325.7461)" gradientUnits="userSpaceOnUse" id="XMLID_51_" x1="-314.6938" x2="-303.481" y1="249.584" y2="242.1593">
+<stop offset="0" style="stop-color:#FFFFFF"/>
+<stop offset="0.0056" style="stop-color:#FFFFFF"/>
+<stop offset="0.24" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#4D4D4D"/>
+</linearGradient>
+<path d="M46.179,78.304l-3.622,5.824c-2.043,3.194-5.039,3.668-7.258,2.251          c-2.012-1.286-2.908-4.189-0.837-7.434l3.207-5.163C40.535,73.917,44.392,76.175,46.179,78.304z" fill="url(#XMLID_51_)"/>
+<linearGradient gradientTransform="matrix(1 0 0 -1 346.5 325.7461)" gradientUnits="userSpaceOnUse" id="XMLID_52_" x1="-310.6753" x2="-293.7201" y1="252.001" y2="246.5">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.2458" style="stop-color:#FFFFFF"/>
+<stop offset="0.2682" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#333333"/>
+</linearGradient>
+<path d="M37.672,73.776c2.762,0.389,6.542,2.003,8.417,4.817l0.419-0.732          c-1.368-1.971-4.808-4.339-8.312-4.546L37.672,73.776z" fill="url(#XMLID_52_)"/>
+<path d="M41.154,82.667c-1.94,3.031-4.632,3.784-6.804,2.87c0.272,0.313,0.58,0.584,0.926,0.806          c2.252,1.439,5.293,0.956,7.374-2.294l3.436-5.519c-0.589-0.646-0.973-1.156-1.383-1.473L41.154,82.667z" fill="#323232"/>
+<path d="M48.563,65.482L48.563,65.482c1.235,1.305,1.462,3.513-0.097,5.935l-3.478,5.323          c0.019,0.015,0.043,0.032,0.059,0.051c0.463,0.256,0.922,0.461,1.355,0.61l2.551-3.903l0.555-0.866          C51.446,69.603,50.669,66.825,48.563,65.482z" fill="#191E1C"/>
+<path d="M45.185,76.935l1.388-0.704c0,0,0,4.846,0,7.539c0,2.692-0.812,4.753-4.495,5.542          c2.49-1.03,3.068-3.268,3.009-5.776L45.185,76.935z" fill="#323232"/>
+<linearGradient gradientTransform="matrix(1.1364 0 0 1.1364 792.5027 2.309)" gradientUnits="userSpaceOnUse" id="XMLID_53_" x1="-660.4331" x2="-663.0818" y1="75.9775" y2="74.6041">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.2458" style="stop-color:#FFFFFF"/>
+<stop offset="0.2682" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#333333"/>
+</linearGradient>
+<path d="M37.342,87.125c1.766,2.302,4.355,1.952,6.336,1.012c-2.509,0.374-3.688-0.508-4.324-1.228          C39.049,86.976,38.196,87.109,37.342,87.125z" fill="url(#XMLID_53_)"/>
+<linearGradient gradientTransform="matrix(1 0 0 -1 346.5 325.7461)" gradientUnits="userSpaceOnUse" id="XMLID_54_" x1="-307.7334" x2="-297.7108" y1="235.6758" y2="250.2954">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.2458" style="stop-color:#FFFFFF"/>
+<stop offset="0.2682" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#333333"/>
+</linearGradient>
+<path d="M37.522,87.109c0.72,0.821,2.127,1.603,3.471,1.643c3.428,0.115,3.753-2.748,3.753-5.09          c0-2.343,0-6.837,0-6.837l0.438,0.107c0,0-0.019,3.409-0.019,6.693s-0.705,6.074-4.637,5.684          c-1.579-0.151-2.979-1.287-3.701-2.295C37.166,87.135,37.522,87.109,37.522,87.109z" fill="url(#XMLID_54_)"/>
+<linearGradient gradientTransform="matrix(1.1031 0.0083 -0.1333 1.1697 802.5345 -0.6846)" gradientUnits="userSpaceOnUse" id="XMLID_55_" x1="-677.3813" x2="-677.2162" y1="70.1094" y2="72.4395">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.2458" style="stop-color:#FFFFFF"/>
+<stop offset="0.2682" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#333333"/>
+</linearGradient>
+<path d="M45.266,77.289c0.093-0.889,0.65-1.604,1.24-1.599c0.539,0.006,0.916,0.608,0.903,1.389          c0.059-0.938-0.515-1.685-1.313-1.69c-0.83-0.009-1.592,0.786-1.697,1.775c-0.108,0.985,0.478,1.792,1.306,1.795          c0.141,0,0.28-0.023,0.413-0.062C45.55,78.86,45.17,78.152,45.266,77.289z" fill="url(#XMLID_55_)"/>
+<linearGradient gradientTransform="matrix(1 0 0 -1 346.5 325.7461)" gradientUnits="userSpaceOnUse" id="XMLID_56_" x1="-300.8662" x2="-299.826" y1="251.6963" y2="247.0371">
+<stop offset="0" style="stop-color:#999999"/>
+<stop offset="0.2458" style="stop-color:#FFFFFF"/>
+<stop offset="0.2682" style="stop-color:#FFFFFF"/>
+<stop offset="1" style="stop-color:#333333"/>
+</linearGradient>
+<path d="M46.349,75.608c0.618,0,1.119,0.738,1.119,1.652c0,0.907-0.501,1.646-1.119,1.646          s-1.117-0.739-1.117-1.646C45.229,76.347,45.73,75.608,46.349,75.608z" fill="url(#XMLID_56_)"/>
+</g>
+</g>
+<rect fill="none" height="120" width="120"/>
+</g>
+</g>
+</g>
+</switch>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxaddtracksdialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,392 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class declarations of CMPXAddTracksDialog
+*
+*/
+
+
+#ifndef C_CMPXADDTRACKSDIALOG_H
+#define C_CMPXADDTRACKSDIALOG_H
+
+// INCLUDES
+#include <aknselectionlist.h>
+#include <mpxcollectionobserver.h>
+#include <mpxcollectionpath.h> // TMPXItemId
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionuihelperobserver.h>
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CAknTitlePane;
+class CAknContextPane;
+class CEikImage;
+class CMPXLbxExtendedFeatures;
+class CMPXAddTracksListModel;
+class MMPXCollectionUtility;
+class CMPXMediaArray;
+class CMPXCommonUiHelper;
+
+// CLASS DECLARATION
+
+/**
+ *  CMPXAddTracksDialog class
+ *
+ *  Dialog class for Playlist Add Tracks Mode
+ */
+NONSHARABLE_CLASS( CMPXAddTracksDialog ) : public CAknSelectionListDialog,
+                                           public MMPXCollectionObserver,
+                                           public MMPXCollectionFindObserver,
+                                           public MMPXCHelperObserver
+    {
+public:
+
+    enum TMPXAddTracksListItems
+        {
+        EMPXAddTracksAddAllSongs = 0,
+        EMPXAddTracksAddArtistsBegin
+        };
+
+public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     * @return A pointer to a newly created object
+     */
+    IMPORT_C static CMPXAddTracksDialog* NewL();
+
+    /**
+     * Two-phased constructor.
+     * @return A pointer to a newly created object
+     */
+    IMPORT_C static CMPXAddTracksDialog* NewLC();
+
+    /**
+     * C++ default destructor.
+     */
+    IMPORT_C virtual ~CMPXAddTracksDialog();
+
+private:    // Constructors
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXAddTracksDialog();
+
+    /*
+     *  Two phased constructor
+     */
+    void ConstructL( TInt aResource );
+
+public: // From CAknSelectionListDialog
+
+	void ProcessCommandL( TInt aCommandId );
+
+private:     // New functions
+
+    /**
+     * Backup previous status pane to internal members.
+     */
+    void BackupPreviousStatusPaneL();
+
+    /**
+     * Restore previous status pane from internal members.
+     */
+    void RestorePreviousStatusPaneL();
+
+    /**
+     * Create context icon for add tracks dialog.
+     */
+    void CreateContextIconL();
+
+    /**
+     * Update softkey.
+     */
+    void UpdateSoftkeyL();
+
+    /**
+     * Update listbox content by category.
+     *
+     * @aMedia media array containing the categories
+     */
+    void UpdateListboxByCategoryL( const CMPXMedia& aMedia );
+
+	/**
+     * Update listbox content by category after find
+     * @param aFind if find is activated
+     * @param aSongNum found song number
+     */
+    void UpdateListboxByCategoryforFindL( TBool aFind, TInt aSongNum );
+
+    /**
+     * Gets current listbox item index.
+     * @return Current listbox item index
+     */
+    TInt CurrentLbxItemIndex() const;
+
+    /**
+     * Return number of listbox items shown in the current listbox.
+     * @return Visible items in the list box
+     */
+    TInt CurrentListItemCount() const;
+
+    /**
+     * When you change the list item array you should call this method.
+     */
+    void HandleItemArrayChangeL();
+
+    /**
+     * Highlight list item.
+     * @param aIndex The index to be highlighted
+     */
+    void HighlightListItem( TInt aIndex );
+
+    /**
+     * Expand current group.
+     */
+    void ExpandCurrentGroupL();
+
+    /**
+     * Goto the closest group.
+     */
+    void GotoClosestGroupL();
+
+    /**
+     * Collapse current group.
+     */
+    void CollapseCurrentGroupL();
+
+    /**
+     * Add current track to playlist.
+     */
+    void AddCurrentTrackToPlaylistL();
+
+    /**
+     * Find support in artist category and all songs category.
+     */
+    void DoFindL( void );
+
+    /**
+     * Animation execution
+     */
+    void DoAnimL( void );
+
+    /**
+     * Animation call back method
+     * @param aObject call back method
+     */
+    static TInt AnimExpireL( TAny* aObject );
+
+    /**
+     * Stop the Animation execution
+     */
+    void StopAnimL();
+
+    /**
+     * load resources.
+     */
+    void LoadResourceL();
+
+    /**
+     * Start find categories
+     */
+    void LoadCategoriesL();
+
+    /**
+     * Handle collection message
+     *
+     * @param aMessage collection message
+     */
+    void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+    
+     /**
+     * Function called by CIdle to close the dialog itself when collection view
+     * can not handle the closing of dialog due to waitnote displayed by
+     * CMPXCollectionViewImp::DoIncrementalOpenL
+     * 
+     * @param aPtr pointer to this dialog itself
+     */
+    static TInt DeferredExitCallback( TAny* aPtr );
+
+private:    // Functions from base classes
+
+    /**
+     * From MMPXCollectionObserver
+     * Handle collection message.
+     *
+     * @param aMessage Collection message
+     * @param aErr system error code.
+     */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d a folder
+     *
+     *  @param aEntries collection entries opened
+     *  @param aIndex focused entry
+     *  @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     *  @param aError error code
+     */
+    void HandleOpenL(
+        const CMPXMedia& aEntries,
+        TInt aIndex,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d an item. Client typically responds by
+     *  'playing' the item
+     *
+     *  @param aPlaylist collection path to item
+     *  @param aError error code
+     */
+    void HandleOpenL(
+        const CMPXCollectionPlaylist& aPlaylist,
+        TInt aError );
+
+    /**
+     *
+     *  From MMPXCollectionObserver
+     *  Handle media properties
+     *
+     *  @param aMedia media
+     *  @param aError error code
+     */
+    void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+    /**
+     *  From MMPXCollectionFindObserver
+     *  Handle callback for "find" operation
+     *
+     *  @param aEntries, CMPXMedia to be returned
+     *  @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     *  @param aError error code
+     */
+    void HandleFindAllL(
+        const CMPXMedia& aResults, TBool aComplete, TInt aError );
+
+    /**
+     * From MMPXCHelperObserver
+     * Handles the completion of any collection helper event.
+     *
+     * @param aOperation, operation completed
+     * @param aErr. the error code
+     * @param aArgument Argument returned from the operation
+     */
+    void HandleOperationCompleteL( TCHelperOperation aOperation,
+                                   TInt aError,
+                                   void* aArgument );
+
+    /**
+     * From CEikDialog
+     * Prepare for layout.
+     */
+    void PreLayoutDynInitL();
+
+    /**
+     * From CEikDialog
+     * Check if it's ok to exit.
+     * @param aButtonId Softkey Id
+     * @return ETrue if it's ok to exit, otherwise, EFalse.
+     */
+    TBool OkToExitL( TInt aButtonId );
+
+    /**
+     * From CCoeControl, handles key-events.
+     * @param aKeyEvent Key event.
+     * @param aType Type of key event(EEventKey, EEventKeyUp or
+     *              EEventKeyDown).
+     * @return If key-event is consumed, EKeyWasConsumed. Else
+     *         EKeyWasNotConsumed.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );
+
+    /**
+     * From MEikListBoxObserver
+     * Handles listbox events.
+     *
+     * @param aListBox Listbox where the event occurred.
+     * @param aEventType Event type.
+     */
+     void HandleListBoxEventL(
+        CEikListBox* aListBox,
+        TListBoxEvent aEventType );
+
+
+private:    // Data
+
+    MMPXCollectionUtility*                  iCollectionUtility;  // not own
+    MMPXCollectionUiHelper*                 iCollectionUiHelper;
+    CMPXCommonUiHelper*                     iCommonUiHelper;
+    CMPXMediaArray*                         iCategoryArray;
+    CMPXMediaArray*                         iAllSongsArray;
+
+    CAknNavigationControlContainer*         iNaviPane;       // Not owned
+    CAknNavigationDecorator*                iOrigNaviPane;   // Not owned
+    CAknContextPane*                        iContextPane;    // Not owned
+    CAknTitlePane*                          iTitlePane;      // Not owned
+    CEikTextListBox*                        iListBox;        // Not owned
+    CAknListBoxFilterItems*                 iLbxFilterItems; // Not owned
+    CAknNavigationDecorator*                iNaviLabelPane;  // New navi label pane
+    CAknNavigationDecorator*                iNaviDecorator;     // Navi decorator
+
+    CEikImage*                              iOrigIcon;       // Original context icon
+    CEikImage*                              iNewIcon;        // New context icon
+    CPeriodic*                              iPeriodic; 	 	    // Animation timer
+    CMPXLbxExtendedFeatures*                iLbxExtFeat;     // Speed scrolling
+    CMPXAddTracksListModel*                 iListModel;      // Tracks list model
+    HBufC*                                  iOrigTitle;      // Original title text
+    HBufC*                                  iLastFindTxt;    // Last find text
+    HBufC*                                  iNoSongText;
+    HBufC*                                  iNoMatchText;
+
+    RArray<TInt>                            iMatchedSongArray;
+    RArray<TInt>                            iMatchedGroupArray;
+    TMPXItemId                              iPlaylistId;
+    TInt                                    iAnimIconIndex;
+    TInt                                    iSelectIndex;
+    TInt                                    iResourceOffset;  // must be freed
+    TInt                                    iCurrentOp;
+    TInt                                    iCurrentGroupIndex;
+    TInt                                    iLastIndex;      // Not used but required by base class
+    TBool                                   iSongAllGroupExist;
+    TBool                                   iExpandAllSongs;
+    TBool                                   iDoFind;
+        
+    CIdle*                                  iIdle;  // used to close dialog itself
+    };
+
+#endif  // C_CMPXADDTRACKSDIALOG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxalbumarteditordialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,370 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player album art editor dialog declaration
+*
+*/
+
+
+#ifndef MPXALBUMARTEDITORDIALOG_H
+#define MPXALBUMARTEDITORDIALOG_H
+
+//  INCLUDES
+#include <AknDialog.h>
+#include <mpxcollectionobserver.h>
+#include <mpxcommonframeworkdefs.h>
+#include <AknProgressDialog.h>  // MProgressDialogCallback
+
+#include "mpxalbumarteventobserver.h"
+
+// FORWARD DECLARATIONS
+class CMPXAlbumArtEditorDialogCustomControl;
+class CAknTitlePane;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class MMPXCollectionUtility;
+class CMPXAlbumArtUtil;
+class CMPXMedia;
+class CMPXMediaArray;
+class CMPXCommonUiHelper;
+
+// CLASS DECLARATION
+
+/**
+ *  CMPXAlbumArtEditorDialog dialog class for Changing/Restoring
+ *  Album Art
+ */
+NONSHARABLE_CLASS( CMPXAlbumArtEditorDialog ) :  public CAknDialog,
+                                                 public MMPXCollectionObserver,
+                                                 public MProgressDialogCallback,
+                                                 public MMPXAlbumArtEventObserver,
+                                                 public MMPXCollectionFindObserver
+    {
+public:  // Constructors and destructor
+
+    /**
+     * Symbian OS two-phased constructor
+     * @return MP Album Art Dialog.
+     */
+    IMPORT_C static CMPXAlbumArtEditorDialog* NewL();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CMPXAlbumArtEditorDialog();
+
+    /**
+     * Parameter passed in from viewframework
+     *
+     * @param aParam Parameter pass in from viewframework.
+     */
+    IMPORT_C void SetParamL( const TDesC* aParam );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXAlbumArtEditorDialog();
+
+    void ConstructL( TInt aResource );
+
+private: // from base class MMPXCollectionObserver
+
+    /**
+     * Handle collection message.
+     *
+     * @param aMessage Collection message
+     * @param aErr system error code.
+     */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+    /**
+     * Handles the collection entries being opened. Typically called
+     * when client has Open()'d a folder
+     *
+     * @param aEntries collection entries opened
+     * @param aIndex focused entry
+     * @param aComplete ETrue no more entries. EFalse more entries
+     *                  expected
+     * @param aError error code
+     */
+    void HandleOpenL(
+        const CMPXMedia& aEntries,
+        TInt aIndex, TBool aComplete, TInt aError);
+
+    /**
+     * Handles the item being opened. Typically called
+     * when client has Open()'d an item. Client typically responds by
+     * 'playing' the item via the playlist
+     *
+     * @param aPlaylist collection playlist, owner ship is transfered
+     * @param aError error code
+     */
+    void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError );
+
+    /**
+     * Handle collection media
+     *
+     * @param aMedia media
+     * @param aError error code
+     */
+    void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError);
+
+    /**
+    * From MMPXCollectionObserver
+    */
+    void HandleCommandComplete(CMPXCommand* aCommandResult,
+                               TInt aError);
+private:    // New functions
+
+    /**
+     * Sends request to determine if it's album level
+     * or track level
+     */
+    void GetCurrentModeL();
+
+    /**
+     * Backs up Status Pane.
+     */
+    void BackupPreviousStatusPaneL();
+
+    /**
+     * Restores Previous Status Pane.
+     */
+    void RestorePreviousStatusPaneL();
+
+    /**
+     * Find the components custom control.
+     */
+    CMPXAlbumArtEditorDialogCustomControl *GetAlbumArtEditorDialogCustomControl() const;
+
+    /**
+     * loads album art information from database
+     * @param aShowWaitNote ETrue if the wait note is shown, EFalse otherwise
+     */
+    void LoadAlbumArtL( TBool aShowWaitNote );
+
+    /**
+     * extracts the album art
+     *
+     * @param aMedia media object containing album art info
+     * @param aDismissWaitNoteOnError ETrue to dismiss wait note if error occurs,
+     *                                EFalse otherwise
+     */
+    void ExtractAlbumArtL( const CMPXMedia& aMedia,
+        TBool aDismissWaitNoteOnError = ETrue );
+
+    /**
+     * control extract of multiple album art
+     */
+    void ExtractMultipleAlbumArtL();
+
+    /**
+     * Saves the updated media
+     *
+     * @param aFileName the file name for the album art
+     * @param aIsRestore ETrue if this is a restore operation,
+     *                   EFalse if this is a change operation
+     * @return NULL if media is broken, CMPXMedia* ownership if saving is required
+     */
+    CMPXMedia* SaveMediaLC( const TDesC& aFileName, TBool aIsRestore );
+
+    /**
+     * Saves multiple media
+     *
+     * @param aIsRestore ETrue if this is a restore operation,
+     *                   EFalse if this is a change operation
+     */
+    void SaveMultipleMediaL( TBool aIsRestore );
+
+    /**
+     * Handle save operation complete
+     *
+     * @param aError Error code, if any
+     */
+    void DoHandleOperationCompleteL( TInt aError );
+
+    /**
+     * Handle collection message
+     *
+     * @param aMessage collection message
+     */
+    void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+
+    /**
+     * Updates a media to the collection
+     * @param aMedia media to update
+     * @param aSync synchronous operation or not
+     */
+    void DoSetCollectionL( CMPXMedia* aMedia, TBool aSync );
+
+    /**
+     * Appends the common attributes to attributes array
+     *
+     * @param aAryAttribute Array to append to
+     */
+    void AppendCommonAttributes( RArray<TMPXAttribute>& aAryAttribute );
+
+private: // Functions from base classes
+
+    /**
+    * From MMPXAlbumArtEventObserver
+    * Handle album art events
+    *
+    * @param aEvent album art event
+    * @param aError error code
+    */
+    void HandleAlbumArtEventL( TMPXAlbumArtEvents aEvent, TInt aError );
+
+    /**
+    *  from MMPXCollectionFindObserver
+    *  Handle callback for "find" operation
+    *  @param aEntries, CMPXMedia to be returned
+    *  @param aComplete ETrue no more entries. EFalse more entries
+    *                   expected
+    *  @param aError error code
+    */
+    void HandleFindAllL(const CMPXMedia& aResults,
+                        TBool aComplete,TInt aError);
+
+    /**
+     * Process menu command
+     * @param aCommandId command ID
+     */
+	void ProcessCommandL( TInt aCommandId ) ;
+
+    /**
+     * Creates custom control for the dialog
+     * @param aControlType control type
+     */
+    SEikControlInfo CreateCustomControlL( TInt aControlType );
+
+    /**
+     * Initialises the dialog's controls before the dialog is sized and layed out.
+     */
+    void PreLayoutDynInitL();
+
+    /**
+     * This function ALWAYS returns ETrue.
+     * @param aButtonId button ID
+     */
+    TBool OkToExitL( TInt aButtonId );
+
+	/**
+	 * Called when key events happen
+	 */
+    TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                 TEventCode aType );
+
+    /**
+     * Dynamically initializes the menu pane.
+     * @param aResourceId resource identifier.
+     * @param aMenuPane menu pane
+     */
+    void DynInitMenuPaneL( TInt aResourceId,
+                           CEikMenuPane* aMenuPane );
+
+    /**
+     * Processes menu command.
+     * @param aCommandId menu command
+     */
+    void DoProcessCommandL( TInt aCommandId );
+
+    /**
+     * Returns the number of component controls.
+     */
+    TInt CountComponentControls() const;
+
+    /**
+     * Returns the component control.
+     * @param aIndex index of the component
+     */
+    CCoeControl* ComponentControl(TInt aIndex) const;
+
+    /**
+     * Updates the dialogs navipane.
+     */
+    void UpdateNaviPaneL(const TDesC& aText);
+
+    /**
+     * Required for help.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );
+
+    /**
+     * From MProgressDialogCallback
+     * Callback method
+     * Get's called when a dialog is dismissed.
+     */
+    void DialogDismissedL( TInt aButtonId );
+
+
+    /**
+     * Callback function
+     * Get called by iAsyncCallNext.
+     */
+    static TInt ExtractNextAlbumArtCallBackL(TAny* aPtr);
+
+    /**
+     * Extract next Album Art
+     * Get called by ExtractNextAlbumArtCallBackL.
+     */
+    void ExtractNextAlbumArtL();
+
+private:    // Data
+
+    HBufC*                                  iOrigTitle;             // Original title text
+    HBufC*                                  iParam;
+    HBufC*                                  iNewFileName;
+
+    CAknTitlePane*                          iTitlePane;             // Not owned
+    CAknNavigationControlContainer*         iNaviPane;              // Not owned
+    CAknNavigationDecorator*                iNaviLabelPane;         // New navi label pane
+
+    MMPXCollectionUtility*                  iCollectionUtility;  // not own
+    CMPXAlbumArtUtil*                       iMPXUtility;   // own
+    CMPXMedia*                              iMedia;
+    CMPXMedia*                              iAlbumInfo;
+    CMPXMediaArray*                         iMediaArray;
+    CMPXCommonUiHelper*                     iCommonUiHelper;
+
+    TRect                                   iModRect;
+    TInt                                    iResourceOffset; // must be freed
+    TInt                                    iCurrentMediaLOp;   // current mediaL operation
+    TInt                                    iCurrentFindAllLOp;   // current FindAllL operation
+    TInt                                    iAlbumArtMode;
+    TInt                                    iCurrentAlbumArtIndex;
+
+    TBool                                   iAlbumArtChanged;
+    TBool                                   iIsSaving;
+    TBool                                   iInvalidFileExist;
+    TBool                                   iOpCanceled;
+    CAsyncCallBack*                         iAsyncCallNext;
+    TBool                                   iFetchingPicture; // To indicate if picture fetching is ongoing
+    };
+
+#endif      // MPXALBUMARTEDITORDIALOG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxalbumarteventobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  album art events observer
+*
+*/
+
+ 
+
+#ifndef MMPXALBUMARTEVENTOBSERVER_H
+#define MMPXALBUMARTEVENTOBSERVER_H
+
+
+enum TMPXAlbumArtEvents
+    {
+    EMPXAlbumArtEventExtractCompleted
+    };
+
+/**
+*  Interface for getting event callbacks for album art events 
+*/
+NONSHARABLE_CLASS( MMPXAlbumArtEventObserver )
+    {
+public:
+    /**
+    * Handle album art events
+    *
+    * @param aEvent album art event
+    * @param aError error code
+    */
+    virtual void HandleAlbumArtEventL( 
+        TMPXAlbumArtEvents aEvent, TInt aError ) = 0;   
+    };    
+    
+#endif // MMPXALBUMARTEVENTOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxaudioeffectsview.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Audio effects view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXAUDIOEFFECTSVIEW_H
+#define C_CMPXAUDIOEFFECTSVIEW_H
+
+
+// INCLUDES
+#include <aknview.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Audio effects view.
+ *
+ *  @lib mpxaudioeffectsview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXAudioEffectsView ) : public CAknView
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXAudioEffectsView* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXAudioEffectsView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXAudioEffectsView();
+    };
+
+#endif  // C_CMPXAUDIOEFFECTSVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxcollectionview.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Collection view implementation
+*
+*/
+
+
+
+#ifndef CMPXCOLLECTIONVIEW_H
+#define CMPXCOLLECTIONVIEW_H
+
+
+// INCLUDES
+#include <aknview.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Collection view.
+ *
+ *  @lib mpxcollectionview.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXCollectionView ) : public CAknView
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.1
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXCollectionView* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.1
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXCollectionView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCollectionView();
+    };
+
+#endif  // CMPXCOLLECTIONVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxcollectionviewhg.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Collection viewhg implementation
+*
+*/
+
+
+
+#ifndef CMPXCOLLECTIONVIEWHG_H
+#define CMPXCOLLECTIONVIEWHG_H
+
+
+// INCLUDES
+#include <aknview.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Collection view.
+ *
+ *  @lib mpxcollectionviewhg.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXCollectionViewHg ) : public CAknView
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.1
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXCollectionViewHg* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.1
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXCollectionViewHg* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCollectionViewHg();
+    };
+
+#endif  // CMPXCOLLECTIONVIEWHG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxcommonplaybackviewimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,760 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX common playback view implementation
+*  Version     : %version: da1mmcf#41.1.6.1.1.1.8 % << Don't touch! Updated by Synergy at check-out.
+*
+*/
+
+
+
+#ifndef CMPXCOMMONPLAYBACKVIEWIMP_H
+#define CMPXCOMMONPLAYBACKVIEWIMP_H
+
+
+// INCLUDES
+#include <aknview.h>
+#include <AknServerApp.h>
+#include <AknProgressDialog.h>  // MProgressDialogCallback
+#include <mpxplaybackobserver.h>
+#include <mpxcollectionobserver.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionuihelperobserver.h>
+#include <mpxpskeyobserver.h>   // MMPXPSKeyObserver
+#include <mpxcenrepobserver.h>  // MMPXCenRepObserver
+#include <mpxviewactivationobserver.h>  // MMPXViewActivationObserver
+
+#include "mpxlayoutswitchobserver.h"
+#include "mpxplaybackframeworkdefs.h" // TMPXPlaybackPlayerType
+
+#include "../../../inc/musicplayerbldvariant.hrh"
+
+// FORWARD DECLARATIONS
+class CMPXCommonPlaybackViewContainer;
+class MMPXPlaybackUtility;
+class CMPXAlbumArtUtil;
+class CMPXCommonUiHelper;
+class MMPXViewUtility;
+class CMPXCollectionPlaylist;
+class CMPXCommonPlaybackViewLayout;
+class MMPXPlayerManager;
+class MMPXCollectionUtility;
+class CMPXPSKeyWatcher;
+class CMPXCenRepWatcher;
+#ifdef IAD_INCLUDE_BACKSTEPPING
+class MMPXBackSteppingUtility;
+#endif // IAD_INCLUDE_BACKSTEPPING
+class CAiwServiceHandler;
+class CMediaRecognizer;
+class CAiwGenericParamList;
+#ifdef IAD_INCLUDE_UPNP
+class CUpnpCopyCommand;
+#endif
+// CLASS DECLARATION
+
+/**
+ *  MPX playback view.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+class CMPXCommonPlaybackViewImp : public CAknView,
+                                  public MMPXPlaybackObserver,
+                                  public MMPXPlaybackCallback,
+                                  public MAknServerAppExitObserver,
+                                  public MMPXLayoutSwitchObserver,
+                                  public MCoeViewActivationObserver,
+                                  public MMPXCHelperObserver,
+                                  public MMPXPSKeyObserver,
+                                  public MMPXCenRepObserver,
+                                  public MProgressDialogCallback,
+                                  public MMPXViewActivationObserver,
+                                  public MMPXCollectionObserver
+    {
+public:
+    enum TCommandSender
+        {
+        ECsUnknown,
+        ECsMediaKey,
+        ECsRenderer
+        };
+public:
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CMPXCommonPlaybackViewImp();
+
+protected:
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    IMPORT_C virtual void ConstructL();
+
+    /**
+     * Updates playback view.
+     */
+    IMPORT_C virtual void UpdateViewL();
+
+    /**
+     * Updates track info field.
+     *
+     * @param aMedia Media's properties. If NULL, default info will
+     *                    be shown.
+     */
+    IMPORT_C virtual void UpdateTrackInfoL(
+        const CMPXMedia* aMedia );
+
+    /**
+     * Update current playback state.
+     *
+     * @param aPlaybackState Current playback state.
+     */
+    IMPORT_C virtual void UpdatePlaybackState(
+        TMPXPlaybackState aPlaybackState );
+
+    /**
+     * Updates track's playback position.
+     *
+     * @param  aPos, New playback postions in seconds
+     * @param  aDuration, Track duration in seconds
+     */
+    IMPORT_C virtual void UpdateTrackPlaybackPositionL(
+        TInt aPos,
+        TInt aDuration );
+
+    /**
+     * Updates track's album art.
+     *
+     * @param aMedia Media's properties. If NULL, default album art
+     *                    will be shown.
+     */
+    IMPORT_C virtual void UpdateAlbumArtL(
+        const CMPXMedia* aMedia );
+
+    /**
+     * Updates track position in playlist field.
+     */
+    IMPORT_C virtual void UpdateTrackPosInPlaylistL();
+
+    /**
+     * Updates download state label.
+     */
+    IMPORT_C virtual void UpdateDownloadStateLabelL();
+
+    /**
+     * Updates the title pane
+     */
+    IMPORT_C virtual void UpdateTitlePaneL();
+
+    /**
+     * Updates FM Transmitter Info
+     */
+    IMPORT_C virtual void UpdateFMTransmitterInfoL(
+        TBool aForceUpdate = EFalse );
+
+    /**
+     *  Handle playback message
+     *
+     *  @param aMsg playback message
+     */
+    IMPORT_C virtual void DoHandlePlaybackMessageL(
+        const CMPXMessage& aMessage );
+
+    /**
+     *  Handle playback property
+     *
+     *  @param aProperty the property
+     *  @param aValue the value of the property
+     *  @param aError error code
+     */
+    IMPORT_C virtual void DoHandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue,
+        TInt aError );
+
+    /**
+     *  Handle media properties.
+     *
+     *  @param aMedia media properties
+     *  @param aError error code
+     */
+    IMPORT_C virtual void DoHandleMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     *  @param aData Extra data parameter, used for any extra information
+     *               along with the state change message
+     */
+    IMPORT_C virtual void DoHandleStateChangedL(
+        TMPXPlaybackState aState,
+        TInt aData );
+
+    /**
+     * Get simple embedded mode.
+     *
+     * @return ETrue if the player is in the embedded mode (i.e. launched
+     *         from Browser or Message Centre).
+     */
+    IMPORT_C virtual TBool SimpleEmbeddedMode() const;
+
+    /**
+     * Get embedded status.
+     *
+     * @return ETrue if in embedded mode. Otherwise, EFalse.
+     */
+    IMPORT_C virtual TBool IsEmbedded() const;
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    IMPORT_C virtual void HandleErrorL( TInt aError );
+
+    /**
+     * Displays error note for when all tracks are invalid,
+     * and goes back to collection list view
+     */
+    IMPORT_C virtual void HandleAllTracksInvalidL();
+
+    /**
+     * Checks whether or not to skip to next track on an error
+     *
+     * @param aCurrentIndex Current index
+     */
+    IMPORT_C virtual void SkipOnErrorL( TInt aCurrentIndex, TInt aCount );
+
+    /**
+     * Function to display information notes
+     *
+     * @param aResourceId Resource ID of the text string.
+     */
+    IMPORT_C virtual void DisplayInfoNoteL( TInt aResourceId );
+
+    /**
+     * Function to display confirmation notes
+     *
+     * @param aResourceId Resource ID of the text string.
+     */
+    IMPORT_C virtual void DisplayConfirmionNoteL( TInt aResourceId );
+
+    /**
+     * Set process priority.
+     */
+    IMPORT_C virtual void SetProcessPriority();
+
+    /**
+     * Launch equalizer dialog.
+     */
+    IMPORT_C virtual void LaunchEqualizerL();
+
+    /**
+     * Launch Music Settings view.
+     */
+    IMPORT_C virtual void LaunchMusicSettingsL();
+
+    /**
+     * Launch FM Transmitter
+     */
+    IMPORT_C virtual void LaunchFMTransmitterL();
+
+    /**
+     * Request for the media object
+     * aDrm Flag whether or not to request all DRM info as well
+     */
+    IMPORT_C virtual void RequestMediaL( TBool aDrm=EFalse );
+
+    /**
+    * Prepare status pane for full-screen playback view.
+    */
+    void PrepareStatusPaneForPlaybackViewL();
+
+    /**
+    * Restore status pane to it's normal state.
+    */
+    void PrepareStatusPaneForExitingViewL();
+
+    /**
+     * Checks if UPnP AP is defined
+     */
+    IMPORT_C virtual TBool IsUpnpVisible();
+
+    /**
+     * Displays the available players in the Play via submenu
+     */
+    IMPORT_C virtual void AddPlayersNamesToMenuL( CEikMenuPane& aMenuPane );
+
+    /**
+     * Adds one player type to the Play via submenu
+     * @param aMenuPane Menu pane
+     * @param aCommandId Command id
+     * @param aPlayerManager Playback Utility manager
+     * @param aPlayerType Current player type (Local, Remote)
+     * @param aMenuText Text to be added to the menu
+     */
+    IMPORT_C virtual void AddPlayerNameToMenuL( CEikMenuPane& aMenuPane,
+                                TInt aCommandId,
+                                MMPXPlayerManager& aPlayerManager,
+                                TMPXPlaybackPlayerType& aPlayerType,
+                                const TDesC& aMenuText = KNullDesC );
+
+    /**
+     * Retrieves the current player name and type
+     */
+    IMPORT_C virtual void GetCurrentPlayerDetails();
+
+    /**
+     * Selects a new player for audio playback
+     */
+    IMPORT_C virtual void SelectNewPlayerL( TInt aCommand );
+
+    /**
+     * Adds current item to a saved playlist
+     */
+    IMPORT_C virtual void AddToSavedPlaylistL();
+
+    /**
+     * Adds current item to a new playlist
+     */
+    IMPORT_C virtual void AddToNewPlaylistL();
+
+    /**
+     * Prepares media for adding to a playlist
+     * @return Media object for adding to playlist.  Caller is
+     * responsible for deleting and popping off cleanupstack
+     */
+    IMPORT_C virtual CMPXMedia* PrepareMediaForPlaylistLC(
+        const CMPXMedia& aMedia );
+
+    /**
+     * Check if the command is supported by the remote player
+     * @return TBool whether the command is supported or not
+     */
+    IMPORT_C virtual TBool IsCommandSupportedL();
+
+// from base class MProgressDialogCallback
+    /**
+     * From MProgressDialogCallback
+     * Callback method
+     * Get's called when a dialog is dismissed.
+     */
+    IMPORT_C virtual void DialogDismissedL( TInt aButtonId );
+
+    /*
+     * From MMPXCHelperObserver
+     * Handles the completion of any collection helper event.
+     *
+     * @param aOperation, operation completed
+     * @param aErr. the error code
+     * @param aArgument Argument returned from the operation
+     */
+    IMPORT_C virtual void HandleOperationCompleteL( TCHelperOperation aOperation,
+                                                    TInt aError,
+                                                    void* aArgument );
+
+// from base class MMPXPlaybackObserver
+
+    /**
+     * From MMPXPlaybackObserver
+     * Handle playback message
+     *
+     * @since 3.1
+     * @param aMessage Playback Message
+     * @param aErr system error code.
+     */
+    IMPORT_C virtual void HandlePlaybackMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+// from base class MMPXPlaybackCallback
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle playback property
+     *
+     * @since 3.0
+     * @param aProperty the property
+     * @param aValue the value of the property
+     * @param aError error code
+     */
+    IMPORT_C virtual void HandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue,
+        TInt aError );
+
+    /**
+     * 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
+     *
+     * @since 3.0
+     * @param aPlayer UID of the subplayer
+     * @param aSubPlayers a list of sub players
+     * @param aComplete ETrue no more sub players. EFalse more subplayer
+     *                  expected
+     * @param aError error code
+     */
+    IMPORT_C virtual void HandleSubPlayerNamesL(
+        TUid aPlayer,
+        const MDesCArray* aSubPlayers,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle media properties
+     *
+     * @since 3.0
+     * @param aMedia media
+     * @param aError error code
+     */
+    IMPORT_C virtual void HandleMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+// from base class MMPXCollectionMediaObserver
+    /**
+    *  Handle extended media properties
+    *
+    *  @param aMedia media
+    *  @param aError error code
+    */
+    IMPORT_C virtual void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError);
+
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Command handling function.
+     *
+     * @since 3.0
+     * @param aCommand Command which is handled
+     */
+    IMPORT_C virtual void HandleCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Processes user commands.
+     *
+     * @since 3.0
+     * @param aCommand ID of the command to respond to.
+     */
+    IMPORT_C virtual void ProcessCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Event handler for status pane size changes.
+     *
+     * @since 3.0
+     */
+    virtual void HandleStatusPaneSizeChange();
+
+    /**
+     * From CAknView
+     * Handles a view activation.
+     *
+     * @param aPrevViewId Specifies the view previously active.
+     * @param aCustomMessageId Specifies the message type.
+     * @param aCustomMessage The activation message.
+     */
+    IMPORT_C virtual void DoActivateL(
+        const TVwsViewId& aPrevViewId,
+        TUid aCustomMessageId,
+        const TDesC8& aCustomMessage );
+
+    /**
+     * From CAknView
+     * View deactivation function.
+     */
+    IMPORT_C virtual void DoDeactivate();
+
+    /**
+     * From CAknView
+     * Foreground event handling function.
+     *
+     * @param aForeground Indicates the required focus state of the control.
+     */
+    IMPORT_C virtual void HandleForegroundEventL( TBool aForeground );
+
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    IMPORT_C void DynInitMenuPaneL(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+
+// from base class MMPXLayoutSwitchObserver
+
+    /**
+     * From MMPXLayoutSwitchObserver
+     * Callback function when layout is changed.
+     *
+     * @since S60 v3.0
+     */
+    IMPORT_C virtual void HandleLayoutChange();
+
+// from base class MCoeViewDeactivationObserver
+
+    /**
+     * From MCoeViewDeactivationObserver
+     * Handles the activation of the view aNewlyActivatedViewId before
+     * the old view aViewIdToBeDeactivated is to be deactivated
+     *
+     * @param aNewlyActivatedViewId View ID that is newly activated.
+     * @param aViewIdToBeDeactivated View ID to be deactivated.
+     */
+    IMPORT_C virtual void HandleViewActivation(
+        const TVwsViewId& aNewlyActivatedViewId,
+        const TVwsViewId& aViewIdToBeDeactivated );
+
+// from base class MMPXViewActivationObserver
+
+    /**
+     * From MMPXViewActivationObserver
+     * Handle view activation.
+     *
+     * @param aCurrentViewType Current view type Uid.
+     * @param aPreviousViewType Previous view type Uid.
+     */
+    IMPORT_C virtual void HandleViewActivation(
+        const TUid& aCurrentViewType,
+        const TUid& aPreviousViewType );
+
+    /**
+     * @see MMPXViewActivationObserver
+     */
+    IMPORT_C void HandleViewUpdate(
+        TUid aViewUid,
+        MMPXViewActivationObserver::TViewUpdateEvent aUpdateEvent,
+        TBool aLoaded,
+        TInt aData);
+
+// from base class MMPXPSKeyObserver
+
+    /**
+    * From MMPXPSKeyObserver
+    * Handle PS event
+    *
+    * @param aUid The UID that identifies the property category
+    * @param aKey The property sub-key
+    */
+    IMPORT_C virtual void HandlePSEvent(
+        TUid aUid,
+        TInt aKey );
+
+// from base class MMPXCenRepObserver
+
+    /**
+    * From MMPXCenRepObserver
+    * Handle a change in a setting value.
+    *
+    * @param aRepositoryUid Central repository UID containing the setting
+    * @param aSettingId Id of the setting
+    */
+    IMPORT_C virtual void HandleSettingChange(
+        const TUid& aRepositoryUid,
+        TUint32 aSettingId );
+
+// From base class MMPXCollectionObserver
+
+    /**
+    * From MMPXCollectionObserver
+    */
+    IMPORT_C virtual void HandleCollectionMessage(CMPXMessage* aMsg, TInt aErr);
+
+    /**
+    * From MMPXCollectionObserver
+    */
+    IMPORT_C virtual void HandleOpenL(const CMPXMedia& aEntries, TInt aIndex,
+                                      TBool aComplete, TInt aError);
+
+    /**
+    * From MMPXCollectionObserver
+    */
+    IMPORT_C virtual void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError);
+
+    /**
+    * From MMPXCollectionObserver
+    */
+    IMPORT_C virtual void HandleCommandComplete(CMPXCommand* aCommandResult,
+                                                TInt aError);
+
+    void FillAiwParametersL( CAiwGenericParamList& aParamList, TBool aSaved = EFalse );
+    /**
+     * Updates the middle softkey display to a label or icon depending on the playback state
+     * @param aMskId middle softkey command id
+     */
+    IMPORT_C void UpdateMiddleSoftKeyDisplayL();
+    /**
+     * Updates the middle (play/pause) toolbar control key icon based on playback state
+     */
+    IMPORT_C void UpdateToolbar();
+protected:
+    static TInt DeferredAlbumArtExtractCallback( TAny* aPtr );
+
+    /**
+    * Callback function for delayed view deactivation
+    * @param aPtr pointer to self
+    */
+    static TInt DelayedExit( TAny* aPtr);
+
+private:
+    /**
+     *  Handle playback error message
+     *
+     *  @param aErr system error code.
+     */
+    void DoHandleErrorPlaybackMessageL( TInt aError );
+
+    /**
+     *  Handle collection message
+     *
+     *  @param aMsg Message to handle.
+     *  @param aErr system error code.
+     */
+    void DoHandleCollectionMessageL( CMPXMessage* aMsg, TInt aErr );
+    
+    /**
+     * Callback function of timer to handle delayed error
+     * @param aPtr pointer to self
+     */
+    static TInt HandleDelayedError( TAny* aPtr );
+
+protected:    // Data
+
+    MMPXPlaybackUtility* iPlaybackUtility;  // not own
+    CMPXCommonPlaybackViewContainer* iContainer;  // own
+
+    CMPXAlbumArtUtil* iMPXUtility;   // own
+    CMPXMedia* iMedia;  // own
+
+    CMPXCommonUiHelper* iCommonUiHelper;    // own
+
+    CMPXPSKeyWatcher*   iPSKeyWatcher;      // own
+    CMPXCenRepWatcher*  iCRWatcher;         // own
+    TInt                iFMTxFreqKHz;
+
+    // View utility.
+    MMPXViewUtility* iViewUtility;
+
+    // Current playback states
+    TInt iDuration; // in seconds
+    TInt iPosition; // in seconds
+    TMPXPlaybackState iPlaybackState;
+    TInt iRandomMode;
+    TInt iRepeatMode;
+
+    TBool iEmbedded;
+    TBool iSwitchingView;
+    TBool iExitOptionHidden;
+
+    // Feature flag for set as ringtone
+    TBool iChangeRTForAllProfiles;
+
+    // Error code to be handled at a later time
+    TInt iDelayedError;
+
+    CMPXCommonPlaybackViewLayout* iLayout;  // owned
+
+//#ifdef __UPNP_FRAMEWORK_2_0_
+    RArray<TUid> iPlayersList;
+    TMPXPlaybackPlayerType iCurrentPlayerType;
+    HBufC* iSubPlayerName;
+//#endif //__UPNP_FRAMEWORK_2_0_
+
+    CAknProgressDialog* iWaitNote;
+
+    MMPXCollectionUtility* iCollectionUtility;
+    MMPXCollectionUiHelper* iCollectionUiHelper;
+
+    TInt iStartPlaybackIndex;
+    TInt iLastSkipDirection;
+    TBool iSkipping;
+    TInt iPreviousStatusPaneLayout;
+
+    // Flag whether or not this was the last playback view activated,
+    // used for error handling
+    TBool iLastPBViewActivated;
+
+    // Flag used for disable error msg pop up when usb event happens
+    TBool iIgnoredByUsbEvent;
+
+    // Flag that next view to be activated is a playback view type
+    TBool iPBViewToBeActivated;
+    
+    // Flag that indicates Camese SuperDistribution Support
+    TBool iCameseSuperDistSupport;
+
+    // Flag that indicates a new item has been opened from Collection View.
+    // Used for Camese Superdistribution error handling.
+    TBool iNewItemOpened;
+
+    CIdle* iIdle;
+
+    // Idle for delayed exit
+    CIdle* iDelayedExit;
+
+private:    // Data
+
+    TInt iResourceOffset;       // must be freed
+
+    TInt iFMTXResourceOffset;   // must be freed
+
+#ifdef IAD_INCLUDE_BACKSTEPPING
+    MMPXBackSteppingUtility* iBackSteppingUtility;
+#endif // BACKSTEPPING_INCLUDED
+
+    CMPXMedia* iUserPlaylists;  // owned
+    TBool iKeySoundDisabled;
+    TBool iDatabaseNotReady;
+    CAiwServiceHandler* iServiceHandler;
+    CMediaRecognizer* iMediaRecognizer;
+    TInt iErrorAttachAssignMenu;
+    TBool iSkipBtnPressed;
+
+//#ifdef __UPNP_FRAMEWORK_2_0_
+    TBool iUpnpFrameworkSupport;
+//#endif //__UPNP_FRAMEWORK_2_0_
+
+    TInt iLastDelayedErr;
+    TInt iErrIndex;
+    CPeriodic* iDelayedErrorTimer;
+    // Indicate FF button pressed or not
+    TBool iIsffButtonPressed;
+    TBool iBacking;
+#ifdef IAD_INCLUDE_UPNP    
+	CUpnpCopyCommand* iUpnpCopyCommand;
+#endif
+	TBool iUnsupportedNoteDisabled;
+    HBufC* iOldUri;
+	TInt iOldPosition; // in seconds
+	TBool iIsTapped;
+    TCommandSender iCommandSender;
+    };
+
+#endif  // CMPXCOMMONPLAYBACKVIEWIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxembeddedplaybackview.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX embedded playback view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXEMBEDDEDPLAYBACKVIEW_H
+#define C_CMPXEMBEDDEDPLAYBACKVIEW_H
+
+
+// INCLUDES
+#include "mpxcommonplaybackviewimp.h"
+
+// CLASS DECLARATION
+
+/**
+ *  MPX embedded playback view.
+ *
+ *  @lib mpxembeddedplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXEmbeddedPlaybackView ) : public CMPXCommonPlaybackViewImp
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXEmbeddedPlaybackView* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXEmbeddedPlaybackView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXEmbeddedPlaybackView();
+    };
+
+#endif  // C_CMPXEMBEDDEDPLAYBACKVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxequalizerview.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Equalizer view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXEQUALIZERVIEW_H
+#define C_CMPXEQUALIZERVIEW_H
+
+
+//  INCLUDES
+#include <e32base.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Equalizer view.
+ *
+ *  @lib mpxequalizerview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXEqualizerView ) : public CBase
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXEqualizerView* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXEqualizerView();
+
+    /**
+     * Launch equalizer dialog.
+     */
+    virtual void LaunchEqualizerL() = 0;
+    };
+
+#endif  // C_CMPXEQUALIZERVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxlayoutswitchobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition of layout switch observer class.
+*
+*/
+
+
+
+#ifndef M_MMPXLAYOUTSWITCHOBSERVER_H
+#define M_MMPXLAYOUTSWITCHOBSERVER_H
+
+
+/**
+ *  Observer class to receive events about layout switch events
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( MMPXLayoutSwitchObserver )
+    {
+public:
+
+    /**
+     * Callback function when layout is changed.
+     *
+     * @since S60 v3.0
+     */
+    virtual void HandleLayoutChange() = 0;
+    };
+
+#endif  // M_MMPXLAYOUTSWITCHOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxmainview.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX main view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXMAINVIEW_H
+#define C_CMPXMAINVIEW_H
+
+
+// INCLUDES
+#include <aknview.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX main view.
+ *
+ *  @lib mpxmainview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXMainView ) : public CAknView
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXMainView* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXMainView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXMainView();
+    };
+
+#endif  // C_CMPXMAINVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxmetadataeditordialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,604 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player metadata editor dialog implementation
+*
+*/
+
+
+#ifndef MPXMETADATAEDITORDIALOG_H
+#define MPXMETADATAEDITORDIALOG_H
+
+// INCLUDES
+#include <AknForm.h>
+#include <mpxcollectionobserver.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionuihelperobserver.h>
+#include <mpxattribute.h>
+#include <AknQueryDialog.h>
+#include <DRMHelper.h>
+
+// CONSTANTS
+const TInt KMPXMetadataTextFieldMaxLen = 255;
+
+// FORWARD DECLARATIONS
+class CAknTitlePane;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CAknQueryValueText;
+class CAknQueryValueTextArray;
+class MMPXCollectionUtility;
+class CMPXCommonUiHelper;
+class CMPXMedia;
+class MMPXCollectionUiHelper;
+class CAknPopupField;
+class CIdle;
+
+// CLASS DECLARATION
+/*
+* Provides query dialog for changing track's library.
+*/
+NONSHARABLE_CLASS( CMPXQueryDialog ) : public CAknQueryDialog
+    {
+public:
+    /**
+     * Two-phased constructor.
+     */
+    static CMPXQueryDialog* NewL();
+
+     /**
+     * From CAknDialog
+     * Handle key events. When a key event occurs,
+     * until one of them returns EKeyWasConsumed to indicate that it processed the key event.
+     * CONE calls this function for each control on the control stack,
+     * @param aKeyEvent  The key event.
+     * @param aType      The type of the event: EEventKey, EEventKeyUp or EEventKeyDown.
+     * @return           Indicates whether or not the key event was used by this control.
+     */
+    TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
+    };
+
+/*
+* Provides factory to create concrete document object.
+*/
+NONSHARABLE_CLASS( CMPXMetadataEditorDialog ) : public CAknForm,
+                                                public MMPXCollectionObserver,
+                                                public MMPXCollectionFindObserver,
+                                                public MMPXCHelperObserver
+    {
+public:
+    // File Details headings
+    enum TMPXSongsFileDetailsHeadings
+        {
+        EMPXSongsFileDetailsHeadingFilename = 0, // Start from index 0
+        EMPXSongsFileDetailsHeadingFormat,
+        EMPXSongsFileDetailsHeadingDuration,
+        EMPXSongsFileDetailsHeadingBitrate,
+        EMPXSongsFileDetailsHeadingSamplingRate,
+        EMPXSongsFileDetailsHeadingSize,
+        EMPXSongsFileDetailsHeadingModified,
+        EMPXSongsFileDetailsHeadingCopyright,
+        EMPXSongsFileDetailsHeadingUrl,
+        EMPXSongsFileDetailsHeadingCount
+        };
+
+    enum TMPXPodcastsFileDetailsHeadings
+        {
+        EMPXPodcastsFileDetailsHeadingFilename = 0, // Start from index 0
+        EMPXPodcastsFileDetailsHeadingFormat,
+        EMPXPodcastsFileDetailsHeadingDuration,
+        EMPXPodcastsFileDetailsHeadingBitrate,
+        EMPXPodcastsFileDetailsHeadingSamplingRate,
+        EMPXPodcastsFileDetailsHeadingSize,
+        EMPXPodcastsFileDetailsHeadingLastPlaybackPosition,
+        EMPXPodcastsFileDetailsHeadingPublished,
+        EMPXPodcastsFileDetailsHeadingModified,
+        EMPXPodcastsFileDetailsHeadingCopyright,
+        EMPXPodcastsFileDetailsHeadingUrl,
+        EMPXPodcastsFileDetailsHeadingCount
+        };
+
+public: // Constructor and destructor
+    /**
+     * Two-phased constructor.
+     */
+    IMPORT_C static CMPXMetadataEditorDialog* NewL();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CMPXMetadataEditorDialog();
+
+    /**
+     * Parameter passed in from viewframework
+     *
+     * @param aParam Parameter pass in from viewframework.
+     */
+    IMPORT_C void SetParamL( const TDesC* aParam );
+
+    /**
+     * From CAknDialog update member variables of CAknExEditorDialog.
+     * @param aButtonId The ID of the button that was activated.
+     * @return Should return ETrue if the dialog should exit,
+     *    and EFalse if it should not
+     */
+    TBool OkToExitL(TInt aButtonId);
+
+    /**
+     * From CAknDialog.
+     *
+     * @param aResourceId The resource ID of the dialog to load.
+     * @return Zero, unless it is a waiting dialog. For a waiting dialog,
+     *         the return value is the ID of the button that closed the
+     *         dialog, or zero if it was the cancel button
+     *         (@c EEikBidCancel).
+     */
+    TInt ExecuteLD( TInt aResourceId );
+
+    /**
+     * Display file details popup window
+     */
+    void ViewFileDetailsPopupL();
+
+private: // from base class MMPXCollectionObserver
+
+    /**
+     * Handle collection message.
+     *
+     * @param aMessage Collection message
+     * @param aErr system error code.
+     */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+    /**
+     * Handles the collection entries being opened. Typically called
+     * when client has Open()'d a folder
+     *
+     * @param aEntries collection entries opened
+     * @param aIndex focused entry
+     * @param aComplete ETrue no more entries. EFalse more entries
+     *                  expected
+     * @param aError error code
+     */
+    void HandleOpenL(
+        const CMPXMedia& aEntries,
+        TInt aIndex, TBool aComplete, TInt aError);
+
+    /**
+     * Handles the item being opened. Typically called
+     * when client has Open()'d an item. Client typically responds by
+     * 'playing' the item via the playlist
+     *
+     * @param aPlaylist collection playlist
+     * @param aError error code
+     */
+    void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError );
+
+    /**
+     * Handle media properties
+     *
+     * @param aMedia media
+     * @param aError error code
+     */
+    void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError);
+
+private:  // Constructor
+    /**
+     * Default constructor.
+     */
+    CMPXMetadataEditorDialog();
+
+    /**
+     * Second-phase constructor.
+     */
+    void ConstructL();
+
+private: // New functions
+
+    /**
+     * Clean up function for genre related members.
+     */
+    void CleanUpGenreText();
+
+    /**
+     * Populates genre popup with genre list for tracks.
+     */
+    void FetchGenreL();
+
+    /**
+     *  Handle media properties.
+     *
+     *  @param aMedia media properties
+     *  @param aError error code
+     */
+    void DoHandleMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+    /**
+     * Saves media back to collection engine
+     *
+     * @param aMedia media property to save back
+     */
+    void SaveMediaPropertiesL( CMPXMedia* aMedia );
+
+    /**
+     * Appends the value to the array, if the vaule has zero length,
+     * appends "unavailable"
+     *
+     * @param aArray array to append to
+     * @param aValue value to append
+     */
+    void AppendStringToArrayL( CDesCArrayFlat* aArray, const TDesC& aValue );
+
+    /**
+     * Sets control text
+     *
+     * @param aControlId The ID of the control
+     * @param aValue value to set
+     * @param aAlternateValue if aValue is zero length,
+     *                        this value will be used instead
+     *
+     */
+    void SetControlTextL( TInt aControlId, const TDesC& aValue,
+        const TDesC& aAlternateValue );
+
+    /**
+     * Sets control text
+     *
+     * @param aControlId The ID of the control
+     * @param aValue value to set
+     * @param aMinValue minimum value allowed for this control
+     * @param aMaxValue maximum value allowed for this control
+     *
+     */
+    void SetControlNumberL( TInt aControlId, const TDesC& aValue,
+        TInt aMinValue, TInt aMaxValue );
+
+    /**
+     * prompt user for library change
+     *
+     * @param aMoveToLibrary enum for library to move to
+     * @return ETrue if the user confirms the change, EFalse if cancel
+     */
+    TBool PromptForLibraryChangeL( TInt aMoveToLibrary );
+
+    /**
+     * Updates media object with current control text, this will also
+     * update iMedia
+     *
+     * @param aControlId the id of the control
+     * @param aMedia media object to update
+     * @param aAttribute attribute to save to
+     *
+     * @return EFalse if the control being checked has not been changed (equal)
+     *         ETrue if the control being checked has been changed
+     */
+    TBool UpdateMediaObjectWithControlL(
+        TInt aControlId, CMPXMedia* aMedia, TMPXAttribute aAttribute );
+
+    static TInt DeferredExitCallback( TAny* aPtr );
+
+    static TInt DeferredFileDetailsCallback( TAny* aPtr );
+
+#ifdef __ENABLE_MSK
+    /**
+     * Update softkey.
+     */
+    void UpdateSoftkeyL();
+#endif // __ENABLE_MSK
+
+private:  // Functions from base class
+
+#ifdef __ENABLE_MSK
+    /**
+     * From CAknForm, handles key-events.
+     * @param aKeyEvent Key event.
+     * @param aType Type of key event(EEventKey, EEventKeyUp or
+     *              EEventKeyDown).
+     * @return If key-event is consumed, EKeyWasConsumed. Else
+     *         EKeyWasNotConsumed.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+#endif // __ENABLE_MSK
+
+    /**
+     * From CAknForm
+     * Save the contents of the form.
+     */
+    TBool SaveFormDataL();
+
+    /**
+     * From CAknForm
+     * Does not save the contents of the form.
+     */
+    void DoNotSaveFormDataL();
+
+    /**
+     * Store the old title pane text and set the new one
+     */
+    void SetTitlePaneL();
+
+    /**
+     * Restore the old title pane text
+     */
+    void RestoreTitlePaneL();
+
+    /**
+     * Store the old title navi label and set the new one
+     */
+    void SetNaviLabelL();
+
+    /**
+     * Restore the old navi label text
+     */
+    void RestoreNaviLabelL();
+
+    /**
+     * From MEikMenuObserver.
+     * Dynamically initialises a menu pane. This function can be overridden
+     * by the derived class for its own purpose.
+     * @param aResourceId Resource ID identifying the menu pane to initialise.
+     * @param aMenuPane The in-memory representation of the menu pane.
+     */
+    void DynInitMenuPaneL( TInt aResourceId,
+                           CEikMenuPane* aMenuPane );
+
+    /**
+     * Act on the menu selection if menu is showing
+     */
+    void ProcessCommandL(TInt aCommandId);
+
+    /**
+     * Populates file details window for songs
+     * @param aHeadingsArray array of the headers
+     * @param aDataArray array to populate
+     */
+    void PopulateFileDetailsL(
+        CDesCArrayFlat* aHeadingsArray, CDesCArrayFlat* aDataArray );
+
+    /**
+     * Populates file details window for podcasts
+     * @param aHeadingsArray array of the headers
+     * @param aDataArray array to populate
+     */
+    void PopulatePodcastFileDetailsL(
+        CDesCArrayFlat* aHeadingsArray, CDesCArrayFlat* aDataArray );
+
+    /**
+     * Constructs DRM items.
+     * @param aHeadingsArray array of the headers
+     * @param aDataArray array to populate
+     */
+    void MakeDrmItemsL(
+        CDesCArrayFlat* aHeadingsArray, CDesCArrayFlat* aDataArray );
+
+    /**
+     * Constructs restricted drm items. E.g. count, interval
+     * @param aRights Drm right type "Play"
+     * @param aCurrentIndex current index of the listbox to insert into
+     * @param aHeadingsArray array of the headers
+     * @param aDataArray array to populate
+     */
+    void MakeRestrictedDrmItemsL(
+        HBufC* aRights, TInt& aCurrentIndex,
+        CDesCArrayFlat* aHeadingsArray, CDesCArrayFlat* aDataArray );
+
+    /**
+     * Add parts Of time.
+     * @param aIntYrs year information
+     * @param aIntMon month information
+     * @param aIntDay day information
+     * @param aIntHrs hour information
+     * @param aIntMin minute information
+     * @param aIntSec second information
+     * @return  Buffer where to add the elements
+     */
+    HBufC* AddPartsOfTimeLC( TInt aIntYrs, TInt aIntMon, TInt aIntDay, 
+                             TInt aIntHrs, TInt aIntMin, TInt aIntSec );
+    
+    /**
+     * Add a single element of time to the string array
+     * @param aNumOfElements         Number of elements of the interval
+     * @param aResourceIdSingle      Resource id to be used in case of
+     *                               single unit
+     * @param aResourceIdOneFinal    Resource id to be used in case of
+     *                               units ending with 1, from 21
+     *                               (requested by Slavic languages)
+     * @param aResourceIdTwoFour     Resource id to be used in case of
+     *                               units included from two to four, except
+     *                               12-14 (requested by Slavic languages)
+     * @param aResourceIdFiveZero    Resource id to be used in case of
+     *                               units ending from 5 to 9, plus range
+     *                               from 11 to 14 (requested by Slavic
+     *                               languages)
+     * @param aStrings               DesCArrayFlat where to add the element
+     */
+    
+    void AddSinglePartOfTimeL( TInt aNumOfElements,
+            TInt aResourceIdSingle,
+            TInt aResourceIdOneFinal, 
+            TInt aResourceIdTwoFour,
+            TInt aResourceIdFiveZero, 
+            CDesCArrayFlat* aStrings );
+     
+     /**
+     * Split TimeIntervalSeconds into  parts Of time.
+     * @param aIntYrs year information
+     * @param aIntMon month information
+     * @param aIntDay day information
+     * @param aIntHrs hour information
+     * @param aIntMin minute information
+     * @param aIntSec second information
+     * @return  void
+     */
+    void SplitTime( const TTimeIntervalSeconds& aInterval,
+            TInt& aIntYrs, TInt& aIntMon, TInt& aIntDay,
+            TInt& aIntHrs, TInt& aIntMin, TInt& aIntSec );
+    /**
+     * Add a single element of time to the string array
+     * @param aNumOfElements         Number of elements of the interval
+     * @param aResourceIdSingle      Resource id to be used in case of
+     *                               single unit
+     * @param aResourceIdOneFinal    Resource id to be used in case of
+     *                               units ending with 1, from 21
+     *                               (requested by Slavic languages)
+     * @param aResourceIdTwoFour     Resource id to be used in case of
+     *                               units included from two to four, except
+     *                               12-14 (requested by Slavic languages)
+     * @param aResourceIdFiveZero    Resource id to be used in case of
+     *                               units ending from 5 to 9, plus range
+     *                               from 11 to 14 (requested by Slavic
+     *                               languages)
+     * @param aStrings               Buffer where to add the element
+     */
+    void AddSinglePartOfTimeL( TInt   aNumOfElements,
+                               TInt   aResourceIdSingle,
+                               TInt   aResourceIdOneFinal,
+                               TInt   aResourceIdTwoFour,
+                               TInt   aResourceIdFiveZero,
+                               HBufC*& aStrings );
+
+    /**
+     * Converts between arabic-indic digits and european digits.
+     * @param aText numbers to be converted.
+     * @return void
+     */
+    void LanguageSpecificNumberConversion( TDes& aText ) const;
+
+    /**
+     * Converts the time value to localtime
+     * @param aTime contains the UTC time to be converted, and the converted value on exit
+     */
+    void ConvertToLocalTimeL(TTime& aTime );
+
+    /**
+     * Adds header and value to list.
+     * @param aHeading Heading
+     * @param aValue Value
+     * @param aItemArray Array where value and header are added.
+     * @return void
+     */
+    void AddItemToListBoxL( const TDesC& aHeading,
+                            const TDesC& aValue,
+                            CDesCArray* aItemArray );
+
+    /**
+     * This is used to decide when to save changes. If a leave occurs the
+     * framework generates a Symbian Leave code.
+     * @param aControlId. Control id.
+     */
+    void HandleControlStateChangeL( TInt aControlId );
+
+    /**
+     * Function from @c CEikDialog and thence from c@ MEikDialogPageObserver.
+     * Checks if either year or track control id's are empty, and if so set to 0.
+     */
+    void PrepareForFocusTransitionL();
+
+    /**
+     * Required for help.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+// from MMPXCollectionFindObserver
+
+    /**
+    *  Handle callback for "find" operation
+    *  @param aEntries, CMPXMedia to be returned
+    *  @param aComplete ETrue no more entries. EFalse more entries
+    *                   expected
+    *  @param aError error code
+    */
+    void HandleFindAllL( const CMPXMedia& aResults,
+        TBool aComplete,TInt aError );
+
+// from MMPXCHelperObserver
+
+    /**
+    *  Handle callback for the ui helper
+    *  @param aOperation operation performed
+    *  @param aErr error code
+    *  @param aArgument argument returned
+    */
+    void HandleOperationCompleteL( TCHelperOperation aOperation,
+                                   TInt aErr,
+                                   void* aArgument );
+
+private: // From CEikDialog
+    /**
+     * From CEikDialog, PreLayoutDynInitL.
+     * Initialises the dialog's controls before the dialog is sized
+     * and layed out.
+     */
+    void PreLayoutDynInitL();
+
+    /**
+     * From CEikDialog, PostLayoutDynInitL.
+     * Initialises the dialog's controls after the dialog has been sized
+     * but before it has been activated.
+     */
+    void PostLayoutDynInitL();
+
+private:
+    enum TMPXMetadataEditorCurrentMediaLOp
+        {
+        EMPXMetadataEditorIdle = 0,
+        EMPXMetadataEditorGetSongInfo,
+        EMPXMetadataEditorGetDrmInfo
+        };
+
+private:
+    CAknTitlePane*                          iTitlePane;
+    CAknNavigationControlContainer*         iNaviPane;
+    CAknNavigationDecorator*                iNaviDecorator; // Navi decorator
+    CAknNavigationDecorator*                iEmptyNaviDecorator; // Navi decorator
+    CAknPopupField*                         iPopup;
+    CAknQueryValueText*                     iTextValues;
+    CAknQueryValueTextArray*                iValueTextArray;
+    CDesCArray*                             iGenreArr;
+    CAknQueryValueText*                     iLibraryTextValues;
+    CAknQueryValueTextArray*                iLibraryValueTextArray;
+    CDesCArray*                             iLibraryArr;
+
+    HBufC*                                  iTitlePaneText;
+    HBufC*                                  iParam;
+
+    MMPXCollectionUiHelper*                 iCollectionUiHelper;
+    MMPXCollectionUtility*                  iCollectionUtility;
+    CMPXMedia*                              iMedia;  // own
+    CMPXMedia*                              iDrmInfo;
+    CMPXCommonUiHelper*                     iCommonUiHelper;    // own
+
+    TInt                                    iResourceOffset; // must be freed
+    TInt                                    iDrmResourceOffset; // must be freed
+    TInt                                    iCurrentLibrary;
+    TInt                                    iYear; // special handling needed for year
+    TInt                                    iCurrentMediaLOp;
+    TInt                                    iIsDrmProtected;
+
+    TBool                                   iUnknownGenre;
+    TBool                                   iDrmDetails; // Flags if DRMRightsManager.rsc was loaded
+    TBool                                   iDisablePodcasting;
+    CIdle*                                  iIdle;
+    TBool                                   iTryingExit;
+    };
+
+#endif  // MPXMETADATAEDITORDIALOG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxpdplaybackview.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Progressive Download playback view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXPDPLAYBACKVIEW_H
+#define C_CMPXPDPLAYBACKVIEW_H
+
+
+// INCLUDES
+#include "mpxcommonplaybackviewimp.h"
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Progressive Download playback view.
+ *
+ *  @lib mpxpdplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPdPlaybackView ) : public CMPXCommonPlaybackViewImp
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXPdPlaybackView* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXPdPlaybackView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPdPlaybackView();
+    };
+
+#endif  // C_CMPXPDPLAYBACKVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxpdsbplaybackview.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Progressive Download playback view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXPDSBPLAYBACKVIEW_H
+#define C_CMPXPDSBPLAYBACKVIEW_H
+
+
+// INCLUDES
+#include "mpxcommonplaybackviewimp.h"
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Progressive Download playback view.
+ *
+ *  @lib mpxpdsbplaybackview.lib
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CMPXPdSbPlaybackView ) : public CMPXCommonPlaybackViewImp
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXPdSbPlaybackView* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXPdSbPlaybackView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPdSbPlaybackView();
+    };
+
+#endif  // C_CMPXPDSBPLAYBACKVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxplaybackview.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX playback view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXPLAYBACKVIEW_H
+#define C_CMPXPLAYBACKVIEW_H
+
+
+// INCLUDES
+#include "mpxcommonplaybackviewimp.h"
+
+// CLASS DECLARATION
+
+/**
+ *  MPX playback view.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPlaybackView ) : public CMPXCommonPlaybackViewImp
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXPlaybackView* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXPlaybackView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPlaybackView();
+    };
+
+#endif  // C_CMPXPLAYBACKVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxpodcastcollectionview.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,64 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Podcast Collection view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXPODCASTCOLLECTIONVIEW_H
+#define C_CMPXPODCASTCOLLECTIONVIEW_H
+
+
+// INCLUDES
+#include <aknview.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Podcast Collection view.
+ *
+ *  @lib mpxpodcastcollectionview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPodcastCollectionView ) : public CAknView
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXPodcastCollectionView* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXPodcastCollectionView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPodcastCollectionView();
+    };
+
+#endif  // C_CMPXPODCASTCOLLECTIONVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxpodcastplaybackview.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX podcast playback view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXPODCASTPLAYBACKVIEW_H
+#define C_CMPXPODCASTPLAYBACKVIEW_H
+
+
+// INCLUDES
+#include "mpxcommonplaybackviewimp.h"
+
+// CLASS DECLARATION
+
+/**
+ *  MPX podcast playback view.
+ *
+ *  @lib mpxpodcastplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPodcastPlaybackView ) : public CMPXCommonPlaybackViewImp
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXPodcastPlaybackView* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXPodcastPlaybackView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPodcastPlaybackView();
+    };
+
+#endif  // C_CMPXPODCASTPLAYBACKVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxupnpbrowsedialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,232 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of UPnP players browse Dialog
+*
+*/
+
+
+#ifndef C_CMPXUPNPBROWSEDIALOG_H__
+#define C_CMPXUPNPBROWSEDIALOG_H__
+
+// INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <AknDialog.h>
+#include <mpxplaybackobserver.h>
+#include <AknsItemID.h>
+
+// FORWARD DECLARATIONS
+class MMPXPlaybackUtility;
+class CAknPopupList;
+class CAknSinglePopupMenuStyleListBox;
+class CMPXPlayerManagerStub;
+class CAknIconArray;
+class MAknsSkinInstance;
+class CMPXMedia;
+class MMPXViewUtility;
+
+/**
+* Device selection dialog class of Common UI library
+*/
+class CMPXUPnPBrowseDialog: public CAknDialog, public MMPXPlaybackCallback,
+                            public MMPXPlaybackObserver
+    {
+
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        IMPORT_C static CMPXUPnPBrowseDialog* NewL(TInt aPlayerUid);
+        
+        /**
+        * Destructor.
+        */
+        virtual ~CMPXUPnPBrowseDialog();
+
+    public: // Methods from MMPXPlaybackCallback
+
+        /**
+        *  Handle playback property
+        *
+        *  @param aProperty the property
+        *  @param aValue the value of the property
+        *  @param aError error code
+        */
+        void HandlePropertyL(TMPXPlaybackProperty aProperty,
+                                     TInt aValue, 
+                                     TInt aError);
+        
+        /**
+        *  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
+        *
+        *  @param aPlayer UID of the subplayer
+        *  @param aSubPlayers a list of sub players
+        *  @param aComplete ETrue no more sub players. EFalse more subplayer
+        *                   expected
+        *  @param aError error code
+        */
+        void HandleSubPlayerNamesL(TUid aPlayer, 
+                                           const MDesCArray* aSubPlayers,
+                                           TBool aComplete,
+                                           TInt aError);
+        
+        /**
+        *  Call back of media request
+        *  Notes: The client is responsible for delete the object of aProperties
+        *
+        *  @param aMedia media 
+        *  @param aError error code    
+        */
+        void HandleMediaL( const CMPXMedia& aProperties,
+                                               TInt aError);   
+                                               
+        /**
+         * From MMPXPlaybackObserver
+         * Handle playback message
+         * 
+         * @param aMessage playback message
+         * @param aErr system error code.
+         */
+        void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+    public: // New functions
+
+        /**
+         * Displays selection pop up
+         *
+         * @since Series 60 3.1
+         * @param aPlayerUid, selected player Uid
+         */
+        IMPORT_C TInt ExecuteLD(TInt aPlayerUid);
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CMPXUPnPBrowseDialog(TInt aPlayerUid);
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+
+    private:    // New Functions
+
+        /**
+        * Loads a possibly skinned icon and adds it to icon array
+        * @since Series 60 3.0
+        * @param CAknIconArray, array of icons
+        * @param MAknsSkinInstance, skin instance
+        * @param TDesC, reference to icon file
+        * @param TAknsItemID, skinned icon id
+        * @param TInt, bitmap id
+        * @param TInt, bitmap mask id
+        */
+        void AppendIconToArrayL(CAknIconArray* aArray,
+                                MAknsSkinInstance* aSkin,
+                                const TDesC& aMbmFile,
+                                const TAknsItemID& aID,
+                                TInt aBitmapId,
+                                TInt aMaskId);
+
+        /**
+        * Loads listbox items
+        * @since Series 60 3.0
+        */
+        void LoadListItemsL(void);
+        
+        /**
+        * Loads listbox items
+        * @since Series 60 3.0
+        */
+        void DisplaySubPlayersNamesL( const MDesCArray* aSubPlayers,
+                                      const TBool aComplete );
+
+        /**
+        * From CAknDialog, handles layout initialization
+        * @param const TDesC&, dialog title
+        */
+        void PreLayoutDynInitL();
+
+        /**
+         * Starts selection popup
+         *
+         * @since Series 60 3.1
+         * @param CUPnPDevice, selected device
+         */
+        TInt StartPopupL();
+
+        /**
+         * Creates a selection popup.
+         *
+         * @since Series 60 3.1
+         * @param const TDesC&, popup title
+         * @return None
+         */
+        void CreatePopupL();
+
+        /**
+         * Retrieves the name and other info of the currently
+         * used subplayer
+         */
+        void RetrieveCurrentlySelectSubplayerNameL();    
+
+        /**
+         * Display an error note after the selected player was not valid
+         * @param aResourceId ID of the text to be displayed on the error note
+         */
+        void DisplayErrorNoteL( TInt aResourceId );     
+        
+        /**
+         * Displays the waiting text during retrieval of subplayer names
+         */
+        void DisplayWaitingTextL();
+        
+        /**
+         *  Handle playback message
+         *
+         *  @param aMessage playback message
+         */
+        void DoHandlePlaybackMessageL( 
+            const CMPXMessage& aMessage );
+
+    private:
+
+        CAknPopupList*                   iPopup;
+        CAknSinglePopupMenuStyleListBox* iListBox;
+        TInt                             iPlayerUid;
+        MMPXPlaybackUtility* iPlaybackUtility;  // not owned
+        TInt                 iResourceOffset;
+        TInt                 iErrorResourceOffset;
+        CMPXPlayerManagerStub* iPlayerManagerStub;
+        HBufC* iCurrentlySelectedSubPlayerName;
+        TUid iCurrentlyUsedPlayer;
+        
+        CDesCArrayFlat* iSubPlayersCachedArray;
+        
+        // View utility.
+        MMPXViewUtility* iViewUtility;
+        
+        // ETrue if PlayerUnavailable event was received
+        TBool iPlayerUnavailableError;
+    };
+
+#endif // C_CMPXUPNPBROWSEDIALOG_H__
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxupnpplaybackdialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,566 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player upnpplayback dialog declaration
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKDIALOG_H
+#define MPXUPNPPLAYBACKDIALOG_H
+
+
+//  INCLUDES
+#include <akntoolbarobserver.h>
+#include <AknDialog.h>
+#include <mpxcommonframeworkdefs.h>
+#include <mpxplaybackobserver.h>  //MMPXPlaybackObserver, MMPXPlaybackCallback
+#include <mpxcollectionobserver.h>
+#include "mpxlayoutswitchobserver.h"
+#include "mpxplaybackframeworkdefs.h" // TMPXPlaybackPlayerType
+#include <mpxmediakeyhandlerobserver.h>
+
+// FORWARD DECLARATIONS
+class CMPXUPnPPlaybackDialogCustomControl;
+class MMPXPlaybackUtility;
+class CMPXAlbumArtUtil;
+class CMPXCommonUiHelper;
+class MMPXViewUtility;
+class CMPXCollectionPlaylist;
+class CMPXUPnPPlaybackDialogLayout;
+class MMPXPlayerManager;
+class MMPXCollectionUtility;
+class MMPXMediaKeyHandler;
+class CAknTitlePane;
+class CAknNavigationControlContainer;  // iNaviPane
+class CAknNavigationDecorator;         // iOrigNaviPane
+class CMPXMedia;
+class CMPXMediaArray;
+class CAknToolbar;
+class CAknButton;
+
+// CLASS DECLARATION
+
+/**
+ *  CMPXUpnpPlaybackEditorDialog dialog class for UPnP Remote ->Local
+ *  or Remote -> Remote playback
+ */
+NONSHARABLE_CLASS( CMPXUPnPPlaybackDialog ) :  public CAknDialog,
+                                               public MMPXPlaybackObserver,
+                                               public MMPXPlaybackCallback,
+                                               public MMPXLayoutSwitchObserver,
+                                               public MMPXCollectionMediaObserver,
+                                               public MMPXMediaKeyHandlerObserver,
+                                               public MAknToolbarObserver
+    {
+public:  // Constructors and destructor
+
+    /**
+     * Symbian OS two-phased constructor
+     * @return MP UpnpPlayback Dialog.
+     */
+    IMPORT_C static CMPXUPnPPlaybackDialog* NewL();
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CMPXUPnPPlaybackDialog();
+
+    /**
+     * Parameter passed in from viewframework
+     *
+     * @param aParam Parameter pass in from viewframework.
+     */
+    IMPORT_C void SetParamL( const TDesC* aParam );
+
+protected:
+
+    /**
+     * Updates playback view.
+     */
+    void UpdateViewL();
+
+    /**
+     * Updates track info field.
+     *
+     * @param aMedia Media's properties. If NULL, default info will
+     *                    be shown.
+     */
+    void UpdateTrackInfoL(
+        const CMPXMedia* aMedia );
+
+    /**
+     * Update current playback state.
+     *
+     * @param aPlaybackState Current playback state.
+     */
+    void UpdatePlaybackState(
+        TMPXPlaybackState aPlaybackState );
+
+    /**
+     * Updates track's playback position.
+     *
+     * @param  aPos, New playback postions in seconds
+     * @param  aDuration, Track duration in seconds
+     */
+    void UpdateTrackPlaybackPositionL(
+        TInt aPos,
+        TInt aDuration );
+
+    /**
+     * Updates track's album art.
+     *
+     * @param aMedia Media's properties. If NULL, default album art
+     *                    will be shown.
+     */
+    void UpdateAlbumArtL(
+        const CMPXMedia* aMedia );
+
+    /**
+     * Updates track position in playlist field.
+     */
+    void UpdateTrackPosInPlaylistL();
+
+    /**
+     * Updates download state label.
+     */
+    void UpdateDownloadStateLabelL();
+
+    /**
+     * Updates the title pane
+     */
+    void UpdateTitlePaneL();
+
+    /**
+     *  Handle playback message
+     *
+     *  @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL(
+        const CMPXMessage& aMessage );
+
+    /**
+     *  Handle playback property
+     *
+     *  @param aProperty the property
+     *  @param aValue the value of the property
+     *  @param aError error code
+     */
+    void DoHandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue,
+        TInt aError,
+        TBool aInit = EFalse);
+
+    /**
+     *  Handle media properties.
+     *
+     *  @param aMedia media properties
+     *  @param aError error code
+     */
+    void DoHandleMediaL( const CMPXMedia& aMedia,
+                         TInt aError );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     *  @param aData Extra data parameter, used for any extra information
+     *               along with the state change message
+     */
+    void DoHandleStateChangedL(
+        TMPXPlaybackState aState,
+        TInt aData );
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    void HandleErrorL( TInt aError );
+
+    /**
+     * Displays error note for when all tracks are invalid,
+     * and goes back to collection list view
+     */
+    void HandleAllTracksInvalidL();
+
+    /**
+     * Checks whether or not to skip to next track on an error
+     *
+     * @param aCurrentIndex Current index
+     */
+    void SkipOnErrorL( TInt aCurrentIndex, TInt aCount );
+
+
+    /**
+     * Request for the media object
+     * aDrm Flag whether or not to request all DRM info as well
+     */
+    void RequestMediaL( TBool aDrm=EFalse );
+
+    /**
+    * Prepare status pane for full-screen playback view.
+    */
+    void PrepareStatusPaneForPlaybackViewL();
+
+    /**
+    * Restore status pane to it's normal state.
+    */
+    void PrepareStatusPaneForExitingViewL();
+
+// from base class MMPXMediaKeyHandlerObserver
+
+    /**
+     * Handle media key commands.
+     *
+     * @since 5.0
+     * @param aCommand Command to be handled.
+     * @param aData data for the specific command
+     */
+    void HandleMediaKeyCommand(
+        const TMPXPlaybackCommand aCommand,
+        const TInt aData = KErrNotFound );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXUPnPPlaybackDialog();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL( TInt aResource );
+
+private:    // New functions
+
+    /**
+     * Find the components custom control.
+     */
+    CMPXUPnPPlaybackDialogCustomControl *GetUPnPPlaybackDialogCustomControl() const;
+
+    /**
+     * Handle media key commands.
+     *
+     * @param aCommand Media key commands. see mpxappui.hrh
+     */
+    void DoHandleMediaKeyCommandL( TMPXPlaybackCommand aCommand );
+
+    /**
+     * Control popup behaviour.
+     *
+     * @param aCommand Media key commands. see mpxappui.hrh
+     * @param aValue Parameter for aCommand
+     */
+    void HandlePopupL( TMPXPlaybackCommand aCommand );
+
+    /**
+     * Backs up Status Pane.
+     */
+    void BackupPreviousStatusPaneL();
+
+    /**
+     * Restores Previous Status Pane.
+     */
+    void RestorePreviousStatusPaneL();
+
+    /**
+     * Shows a Not supported error note
+     */
+    void CommandNotSupportedL();
+
+    /**
+     * Exits the dialog when callback from CIdle
+     */
+    static TInt DelayedExit( TAny* aPtr );
+
+
+private: // Functions from base classes
+
+    /**
+     * Creates custom control for the dialog
+     * @param aControlType control type
+     */
+    SEikControlInfo CreateCustomControlL( TInt aControlType );
+
+    /**
+     * Initialises the dialog's controls before the dialog is sized and layed out.
+     */
+    void PreLayoutDynInitL();
+
+    /**
+     * This function ALWAYS returns ETrue.
+     * @param aButtonId button ID
+     */
+    TBool OkToExitL( TInt aButtonId );
+
+    /**
+     * Returns the number of component controls.
+     */
+    TInt CountComponentControls() const;
+
+    /**
+     * Returns the component control.
+     * @param aIndex index of the component
+     */
+    CCoeControl* ComponentControl(TInt aIndex) const;
+
+// from base class MMPXPlaybackObserver
+
+    /**
+     * From MMPXPlaybackObserver
+     * Handle playback message
+     *
+     * @param aMessage playback message
+     * @param aErr system error code.
+     */
+    void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+// from base class MMPXPlaybackCallback
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle playback property
+     *
+     * @since 3.0
+     * @param aProperty the property
+     * @param aValue the value of the property
+     * @param aError error code
+     */
+    void HandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue,
+        TInt aError );
+
+    /**
+     * 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
+     *
+     * @since 3.0
+     * @param aPlayer UID of the subplayer
+     * @param aSubPlayers a list of sub players
+     * @param aComplete ETrue no more sub players. EFalse more subplayer
+     *                  expected
+     * @param aError error code
+     */
+    void HandleSubPlayerNamesL(
+        TUid aPlayer,
+        const MDesCArray* aSubPlayers,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle media properties
+     *
+     * @since 3.0
+     * @param aMedia media
+     * @param aError error code
+     */
+    void HandleMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+// from base class MMPXCollectionMediaObserver
+    /**
+    *  Handle extended media properties
+    *
+    *  @param aMedia media
+    *  @param aError error code
+    */
+    void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError);
+
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Command handling function.
+     *
+     * @since 3.0
+     * @param aCommand Command which is handled
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Processes user commands.
+     *
+     * @since 3.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void ProcessCommandL( TInt aCommandId ) ;
+
+    /**
+     * From CAknView
+     * Event handler for status pane size changes.
+     *
+     * @since 3.0
+     */
+    void HandleStatusPaneSizeChange();
+
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    void DynInitMenuPaneL(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+
+// from base class CoeControl
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );
+
+// from base class MMPXLayoutSwitchObserver
+
+    /**
+     * From MMPXLayoutSwitchObserver
+     * Callback function when layout is changed.
+     *
+     * @since S60 v3.0
+     */
+    void HandleLayoutChange();
+
+
+    TKeyResponse OfferKeyEventL(
+            const TKeyEvent& aKeyEvent,
+            TEventCode aType );
+
+private:
+
+    /**
+     *  Sets the playback volume.
+     *
+     *  @param aVolume volume value.
+     */
+    void SetVolume( const TInt aVolume );
+
+    /**
+     *  Mutes the playback volume.
+     */
+    void MuteVolume();
+
+    /**
+     *  Unmutes the playback volume.
+     */
+    void UnMuteVolume();
+    /**
+     *  Update toolbar.
+     */
+    void UpdateToolbar();
+    /**
+     * From MAknToolbarObserver
+     * Processes user commands.
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void OfferToolbarEventL( TInt aCommandId );
+      
+    /**
+     * From MAknToolbarObserver
+     * Used to change toolbar settings before it is made visible
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolBar );
+
+private:    // Data
+
+    MMPXPlaybackUtility* iPlaybackUtility;  // not own
+    CMPXAlbumArtUtil* iMPXUtility;   // own
+    CMPXMedia* iMedia;  // own
+
+    CMPXCommonUiHelper* iCommonUiHelper;    // own
+
+    // View utility.
+    MMPXViewUtility* iViewUtility;
+
+    // Current playback states
+    TInt iDuration; // in seconds
+    TInt iPosition; // in seconds
+    TMPXPlaybackState iPlaybackState;
+    TInt iRandomMode;
+    TInt iRepeatMode;
+
+    TBool iEmbedded;
+    TBool iSwitchingView;
+    // Feature flag for set as ringtone
+    TBool iChangeRTForAllProfiles;
+
+    // Error code to be handled at a later time
+    TInt iDelayedError;
+
+    CMPXUPnPPlaybackDialogLayout* iPlaybackDialogLayout;    // owned
+
+    RArray<TUid> iPlayersList;
+    TMPXPlaybackPlayerType iCurrentPlayerType;
+    MMPXCollectionUtility* iCollectionUtility;
+
+    TInt iStartPlaybackIndex;
+    TInt iLastSkipDirection;
+    TBool iSkipping;
+
+    // RemCon target for receiving media key events
+    MMPXMediaKeyHandler* iMediaKeyHandler;  // owned
+    TInt iResourceOffset;       // must be freed
+    TInt iCommonPlaybackResourceOffset; // must be freed
+    TInt iUpnpResourceOffset; // must be freed
+    TRect iModRect; // MainPane rectangle
+
+    // Backup and restore previous view title and navi pane
+    TInt iPreviousLayoutId;
+    CAknTitlePane* iTitlePane;             // Not owned
+    HBufC* iOrigTitle;             // Original title text, owned
+    CAknNavigationControlContainer* iNaviPane;              // Not owned
+
+    TKeyEvent iLastKeyEvent;
+    TEventCode iLastKeyType;
+    HBufC* iSubPlayerName;
+
+    CIdle* iDelayedEventExit; // Owned
+
+    TBool iKeySoundDisabled;
+
+    TInt iCurrentVolume;
+
+    TInt iFMTXResourceOffset;   // must be freed
+    CAknToolbar* iToolbar; // not owned
+    
+    CAknButton* iBtnPreviousItem; // not owned
+    CAknButton* iBtnNextItem; // not owned
+    CAknButton* iBtnPlayPause; // not owned
+    TBool iSeekForward;
+    };
+
+#endif      // MPXUPNPPLAYBACKDIALOG_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxupnpplaybackview.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Upnp playback view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXUPNPPLAYBACKVIEW_H
+#define C_CMPXUPNPPLAYBACKVIEW_H
+
+
+// INCLUDES
+#include "mpxcommonplaybackviewimp.h"
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Upnp playback view.
+ *
+ *  @lib mpxupnpplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXUPnPPlaybackView ) : public CMPXCommonPlaybackViewImp
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXUPnPPlaybackView* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static CMPXUPnPPlaybackView* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXUPnPPlaybackView();
+    };
+
+#endif  // C_CMPXUPNPPLAYBACKVIEW_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxviewprivatepskeys.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX View PS Keys
+*
+*/
+
+
+
+#ifndef MMPXVIEWPRIVATEPSKEYS_H
+#define MMPXVIEWPRIVATEPSKEYS_H
+
+const TUid KMPXViewPSUid = {0x10207C5C};    // MPXView PS Category UID
+const TInt KMPXUSBUnblockingPSStatus = 1;   // MPXView PS Key ID
+ 
+enum TMPXUSBAndNotMTPPSStatus
+    {
+    EMPXUSBUnblockingPSStatusUninitialized = 0, 
+    EMPXUSBUnblockingPSStatusActive
+    };
+
+#endif  // MMPXVIEWPRIVATEPSKEYS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxwaitnoteconstructor.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait Note constructor
+*
+*/
+
+
+#ifndef MPX_WAITNOTE_CONSTRUCTOR
+#define MPX_WAITNOTE_CONSTRUCTOR
+
+class CMPXWaitNoteDialog;
+class MMPXWaitNoteObserver;
+/**
+* Construct a wait note according to aArg
+* @param aArg, TPckgBuf<TInt> argument containing enum of the type
+*
+* @Since S60, 3.1
+*/
+class CMPXWaitNoteConstructor : public CBase
+    {
+public:
+    IMPORT_C static CMPXWaitNoteDialog* ConstructWaitNoteL(const TDesC& aArg,
+                                                           MMPXWaitNoteObserver* aObs );
+    };
+
+#endif // MPX_WAITNOTE_CONSTRUCTOR
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxwaitnotedefs.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxwaitnotedialog
+*
+*/
+
+
+#ifndef MPXWAITNOTEDIALOGDEFS_H
+#define MPXWAITNOTEDIALOGDEFS_H
+
+// Enumerations
+enum TWaitNoteType
+    {
+    EMPXScanningNote,
+    EMPXRefreshingNote,
+    EMPXMTPEventNote,
+    EMPXUsbEventNote,
+    EMPXOpeningNote,
+    EMPXMediaNotAvailableNote,
+    EMPXCorruptScanningNote,
+    EMPXFormatScanningNote,
+    EMPXImmediatelyOpeningNote,
+    EMPXNoteNotDefined
+    };
+
+
+#endif // MPXWAITNOTEDIALOGDEFS_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxwaitnotedialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,219 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Base class for all wait notes
+*
+*/
+
+
+#ifndef C_MPXWAITNOTEDIALOG_H
+#define C_MPXWAITNOTEDIALOG_H
+
+#include <AknWaitDialog.h>
+#include <AknProgressDialog.h>
+#include <mpxcollectionobserver.h>
+#include "mpxwaitnoteobserver.h"
+#include "mpxwaitnotedefs.h"
+
+// FOWARD DECLARATIONS
+class MMPXCollectionUtility;
+class CAknQueryDialog;
+class CAknNoteDialog;
+/*
+* Simple structure to hold icon info
+*/
+class TNoteIconInfo
+    {
+public:
+    TInt bitmapId;
+    TInt maskId;
+    TFileName bmpfile;
+    
+    inline TNoteIconInfo( TInt b, TInt m, TFileName f ) 
+        {
+        bitmapId=b; 
+        maskId=m; 
+        bmpfile=f;
+        }
+    };
+ 
+/**
+ *  MPXWaitNoteDialog
+ *
+ *  Base class for all wait dialogs in MPX
+ *
+ *  @lib mpxwaitnotedialog.lib
+ *  @since S60 3.1
+ */
+class CMPXWaitNoteDialog : public CBase,
+                           public MMPXCollectionObserver,
+                           public MProgressDialogCallback
+    {
+
+public:
+
+    /**
+    * Virtual destructor
+    */
+    virtual ~CMPXWaitNoteDialog();
+
+public: // New Functions
+    
+    /**
+    * Execute the dialog
+    */
+    virtual void ExecuteLD();
+
+    /**
+    * Cancel the wait note
+    */
+    virtual void CancelNoteL();
+    
+    /**
+    * Check the dialog destruction status
+    */
+    virtual TBool ReadyToDestroy();
+    
+protected: // New functions
+    
+    /**
+    * Initialize the note before executing
+    * The inherited class should set CBA, text, icons etc here
+    */
+    virtual void PreNoteDisplayHandleL() = 0;
+    
+    /**
+    * Post note dissmissal handling
+    * @arg aButtonId, button ID that the note was cancelled with
+    */
+    virtual void PostNoteHandleL( TInt aButtonId );
+    
+    /**
+    * Set the CBA for the waitnote
+    * @arg aCBAId, button group ID
+    */
+    void SetCBAL( TInt aCBAId );
+    
+    /**
+    * Set the Text in the wait note
+    * @arg aText, text to display
+    */
+    void SetTextL( const TDesC& aText );
+    
+    /**
+    * Set the icon in the wait note 
+    */
+    void SetIconL( TNoteIconInfo& aIconInfo );
+    
+protected: // From Base classes
+
+    /**
+    * From MMPXCollectionObserver
+    */
+    void HandleCollectionMediaL(const CMPXMedia& aMedia, 
+                                TInt aError);
+    
+    /**
+    * From MMPXCollectionObserver
+    */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+    
+    /**
+    * From MMPXCollectionObserver
+    */
+    void HandleOpenL(const CMPXMedia& aEntries,
+                             TInt aIndex,TBool aComplete,TInt aError);
+    
+    /**
+    * From MMPXCollectionObserver
+    */                       
+    void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,TInt aError);                                    
+
+    /**
+    * Callback method when a dialog is dismissed.
+    * @param aButtonId Button ID.
+    */
+    void DialogDismissedL( TInt aButtonId );
+    
+    /**
+    * Display a confirmation dialog
+    * @param aLabel, label for the popup note
+    */
+    void DisplayConfirmationNoteL( const TDesC& aLabel );
+    
+    /**
+    * Display an information dialog
+    * @param aLabel, label for the popup note
+    */
+    void DisplayInformationNoteL( const TDesC& aLabel );
+    
+    /**
+    * Display a query dialog
+    * @param aLabel, label for the query
+    * @return button that was selected
+    */
+    TInt DisplayQueryNoteL( const TDesC& aQuery );
+    
+    /**
+    * Dismiss the current query note, if any
+    */
+    void DismissQueryNoteL();
+    
+    /**
+    * Display a generic CAknNoteDialog
+    * @param aDlgRsc, dialog resource
+    * @param aLabel, text 
+    */
+    void DisplayNoteDialogL( TInt aDlgRsc, const TDesC& aLabel, 
+                             CAknNoteDialog::TTone aTone = CAknNoteDialog::ENoTone );
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+    /**
+    * Display a generic CAknNoteDialog
+    * @param aDlgRsc, dialog resource
+    * @param aLabel, text 
+    */
+    void DisplayNoteDialogL( TInt aDlgRsc, TInt aTextRsc, 
+                             TInt aItemsAdded, const TDesC& aLabel, 
+                             CAknNoteDialog::TTone aTone = CAknNoteDialog::ENoTone );
+//#endif // __COVER_DISPLAY    
+// Cover UI end
+
+protected:
+
+    /**
+    * Constructor
+    */
+    CMPXWaitNoteDialog( MMPXWaitNoteObserver* aObs, 
+                        TWaitNoteType aType, 
+                        TBool aVisibilityDelayOff = ETrue );
+
+    /**
+    * Two-phased constructor
+    */
+    void BaseConstructL();
+
+protected: // data
+    MMPXCollectionUtility* iCollection;
+    
+    MMPXWaitNoteObserver*  iObserver;
+    TWaitNoteType          iWaitNoteType;
+    TBool                  iVisDelayOff;    // VisibilityDelayOff
+    CAknWaitDialog*        iWaitDialog;
+    TInt                   iResourceOffset;
+    CAknQueryDialog*       iQueryDialog; // Not Owned
+    CAknNoteDialog* 	   iNoteDialog;  // Not Owned
+    };
+
+#endif // C_MPXWAITNOTEDIALOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/inc/mpxwaitnoteobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note observer
+*
+*/
+
+
+
+#ifndef M_MPXWAITNOTEOBSERVER_H
+#define M_MPXWAITNOTEOBSERVER_H
+
+#include <aknnotedialog.h>
+/**
+ *  MMPXWaitNoteObserver
+ *
+ *  Wait Note Observer
+ *
+ *  @lib mpxwaitnotedialog.lib
+ *  @since S60 3.1
+ */
+NONSHARABLE_CLASS( MMPXWaitNoteObserver )
+    {
+
+public:
+    /**
+    * Handles that a wait note has been dismissed
+    * This function should call view utility mark view as closed
+    */
+    virtual void HandleWaitNoteDismissedL() = 0;
+    /**
+     * Get pointer to the note dialog 
+     * 
+     * @param aNoteDialog Referrence of Pointer to the note dialog.
+     * @param aDlgRsc The resource ID.
+     * @param aTone Tone of the note dialog.
+     */
+    virtual void NoteDialogL( CAknNoteDialog*& aNoteDialog, 
+    		                   TInt aDlgRsc, 
+    		                   CAknNoteDialog::TTone aTone ) = 0;
+    };
+
+
+#endif // M_MPXWAITNOTEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/addtracksdialogplugin/data/101ffc8d.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxaddtracksdialogplugin
+*
+*/
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxaddtracksdialogplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC8D;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXAddTracksDialogImplementationId;
+                    version_no = 1;
+                    display_name = "Add Tracks dialog";
+                    default_data = "";
+                    opaque_data = "<t>0x101FFCA7</t>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/addtracksdialogplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxaddtracksdialogplugin
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxaddtracksdialogplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/addtracksdialogplugin/group/mpxaddtracksdialogplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxaddtracksdialogplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxaddtracksdialogplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC8D
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxaddtracksdialogpluginproxy.cpp
+SOURCE          mpxaddtracksdialogplugin.cpp
+
+START RESOURCE  ../data/101ffc8d.rss
+TARGET          mpxaddtracksdialogplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxaddtracksdialog.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/addtracksdialogplugin/inc/mpxaddtracksdialogplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Add tracls dialog plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXADDTRACKSDIALOGPLUGIN_H
+#define C_CMPXADDTRACKSDIALOGPLUGIN_H
+
+
+// INCLUDES
+#include <mpxakndialogplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Add tracks dialog plugin definition.
+ *
+ *  @lib mpxaddtracksdialogplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXAddTracksDialogPlugin ) : public CMPXAknDialogPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXAddTracksDialogPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXAddTracksDialogPlugin();
+
+private:
+
+    /**
+     * From CMPXAknDialogPlugin
+     * Construct Avkon dialog.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon dialog.
+     */
+    CAknDialog* ConstructDialogL();
+    
+    /**
+     * From CMPXAknDialogPlugin
+     * Resource Id of the dialog
+     *
+     * @since S60 v3.0
+     * @return Dialog resource ID
+     */
+    TInt ResourceId();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXAddTracksDialogPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXADDTRACKSDIALOGPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/addtracksdialogplugin/inc/mpxaddtracksdialogplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxaddtracksdialogplugin
+*
+*/
+
+
+
+#ifndef MPXADDTRACKSDIALOGPLUGIN_HRH
+#define MPXADDTRACKSDIALOGPLUGIN_HRH
+
+// CONSTANTS
+
+/** Add tracks dialog implementation ID */
+#define KMPXAddTracksDialogImplementationId    0x101FFC8C
+
+#endif  // MPXADDTRACKSDIALOGPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/addtracksdialogplugin/src/mpxaddtracksdialogplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Add tracks dialog plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <mpxaddtracksdialog.rsg>
+
+#include "mpxaddtracksdialog.h"
+#include "mpxaddtracksdialogplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXAddTracksDialogPlugin::CMPXAddTracksDialogPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXAddTracksDialogPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXAddTracksDialogPlugin* CMPXAddTracksDialogPlugin::NewL()
+    {
+    CMPXAddTracksDialogPlugin* self = 
+        new ( ELeave ) CMPXAddTracksDialogPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXAddTracksDialogPlugin::~CMPXAddTracksDialogPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXViewPlugin
+// Construct Avkon dialog.
+// ---------------------------------------------------------------------------
+//
+CAknDialog* CMPXAddTracksDialogPlugin::ConstructDialogL()
+    {
+    return CMPXAddTracksDialog::NewL();
+    }
+    
+// ---------------------------------------------------------------------------
+// From CMPXAknDialogPlugin
+// Resource ID.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXAddTracksDialogPlugin::ResourceId()
+    {
+    return R_MPX_CUI_ADDTRACKS_DIALOG;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/addtracksdialogplugin/src/mpxaddtracksdialogpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxaddtracksdialogplugin.hrh"
+#include "mpxaddtracksdialogplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXAddTracksDialogImplementationId, 
+        CMPXAddTracksDialogPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/albumarteditordialogplugin/data/101ffc87.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxalbumarteditorplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxalbumarteditordialogplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC87;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXAlbumArtEditorDialogImplementationId;
+                    version_no = 1;
+                    display_name = "Album Art Editor Dialog";
+                    default_data = "";
+                    opaque_data = "<t>0x101FFCA5</t>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/albumarteditordialogplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxalbumarteditordialogplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxalbumarteditordialogplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/albumarteditordialogplugin/group/mpxalbumarteditordialogplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxalbumarteditordialogplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxalbumarteditordialogplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC87
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxalbumarteditordialogpluginproxy.cpp
+SOURCE          mpxalbumarteditordialogplugin.cpp
+
+START RESOURCE  ../data/101ffc87.rss
+TARGET          mpxalbumarteditordialogplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxalbumarteditordialog.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/albumarteditordialogplugin/inc/mpxalbumarteditordialogplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Album art editor dialog plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXALBUMARTEDITORDIALOGPLUGIN_H
+#define C_CMPXALBUMARTEDITORDIALOGPLUGIN_H
+
+
+// INCLUDES
+#include <mpxakndialogplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX album art editor dialog plugin definition.
+ *
+ *  @lib mpxalbumarteditordialogplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXAlbumArtEditorDialogPlugin ) : public CMPXAknDialogPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXAlbumArtEditorDialogPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXAlbumArtEditorDialogPlugin();
+
+private:
+
+    /**
+     * From CMPXAknDialogPlugin
+     * Construct Avkon dialog.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon dialog.
+     */
+    CAknDialog* ConstructDialogL();
+    
+    /**
+     * From CMPXAknDialogPlugin
+     * Resource Id of the dialog
+     *
+     * @since S60 v3.0
+     * @return Dialog resource ID
+     */
+    TInt ResourceId();
+    
+    /**
+     * From CMPXViewPlugin
+     * Interface method to activate view.
+     *
+     * @since S60 v3.0
+     * @param aParam Parameter required to activate the view.
+     */
+    void ActivateViewL( const TDesC* aParam = NULL );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXAlbumArtEditorDialogPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXALBUMARTEDITORDIALOGPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/albumarteditordialogplugin/inc/mpxalbumarteditordialogplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxalbumarteditordialogplugin
+*
+*/
+
+
+
+#ifndef MPXALBUMARTEDITORDIALOGPLUGIN_HRH
+#define MPXALBUMARTEDITORDIALOGPLUGIN_HRH
+
+// CONSTANTS
+
+/** Album art editor dialog implementation ID */
+#define KMPXAlbumArtEditorDialogImplementationId    0x101FFC86
+
+#endif  // MPXALBUMARTEDITORDIALOGPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/albumarteditordialogplugin/src/mpxalbumarteditordialogplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of albumart editor dialog plugin
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxalbumarteditordialog.rsg>
+#include <mpxcustomcommandobserver.h>
+#include <mpxviewutilitycommanddef.h>
+
+#include "mpxalbumarteditordialog.h"
+#include "mpxalbumarteditordialogplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXAlbumArtEditorDialogPlugin::CMPXAlbumArtEditorDialogPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialogPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXAlbumArtEditorDialogPlugin* CMPXAlbumArtEditorDialogPlugin::NewL()
+    {
+    CMPXAlbumArtEditorDialogPlugin* self = 
+        new ( ELeave ) CMPXAlbumArtEditorDialogPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXAlbumArtEditorDialogPlugin::~CMPXAlbumArtEditorDialogPlugin()
+    {
+    // Do nothing
+    }
+    
+// ---------------------------------------------------------------------------
+// From CMPXViewPlugin
+// Interface method to activate view.
+// ---------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialogPlugin::ActivateViewL( const TDesC* aParam )
+    {
+    if ( !iDialog )
+        {
+        CreateViewL();        
+        }
+    
+    if ( aParam )
+        {
+        CMPXAlbumArtEditorDialog* pDialog = 
+            static_cast<CMPXAlbumArtEditorDialog*>( iDialog );
+        pDialog->SetParamL( aParam );
+        }
+    
+    iDialog->ExecuteLD( ResourceId() );
+    if ( iCommandObserver )
+        {
+        TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );    
+        iCommandObserver->HandleCustomCommand( 
+            TUid::Uid( KMPXViewUtilityCustomCommand ), 
+            EMPXViewUtilCmdViewDeActivated,
+            selfPtr );
+        }
+    iDialog = NULL;
+    }    
+
+// ---------------------------------------------------------------------------
+// From CMPXAknDialogPlugin
+// Construct Avkon dialog.
+// ---------------------------------------------------------------------------
+//
+CAknDialog* CMPXAlbumArtEditorDialogPlugin::ConstructDialogL()
+    {
+    return CMPXAlbumArtEditorDialog::NewL();
+    }
+    
+// ---------------------------------------------------------------------------
+// From CMPXAknDialogPlugin
+// Resource ID.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXAlbumArtEditorDialogPlugin::ResourceId()
+    {
+    return R_MPX_CUI_ALBUM_ART_DIALOG;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/albumarteditordialogplugin/src/mpxalbumarteditordialogpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxalbumarteditordialogplugin.hrh"
+#include "mpxalbumarteditordialogplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXAlbumArtEditorDialogImplementationId, 
+        CMPXAlbumArtEditorDialogPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/audioeffectsviewplugin/data/101ffc75.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxaudioeffectsviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxaudioeffectsviewplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC75;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXAudioEffectsViewImplementationId;
+                    version_no = 1;
+                    display_name = "Audio Effects view";
+                    default_data = "";
+                    opaque_data = "<t>0x101FFCA2</t>"
+                                  "<i>"EMPXViewPluginPriorityLowest"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/audioeffectsviewplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxaudioeffectsviewplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxaudioeffectsviewplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/audioeffectsviewplugin/group/mpxaudioeffectsviewplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This is the project specification file for mpxaudioeffectsviewplugin.
+*
+*/
+
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxaudioeffectsviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC75
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxaudioeffectsviewpluginproxy.cpp
+SOURCE          mpxaudioeffectsviewplugin.cpp
+
+START RESOURCE  ../data/101ffc75.rss
+TARGET          mpxaudioeffectsviewplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxaudioeffectsview.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/audioeffectsviewplugin/inc/mpxaudioeffectsviewplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Audio effects view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXAUDIOEFFECTSVIEWPLUGIN_H
+#define C_CMPXAUDIOEFFECTSVIEWPLUGIN_H
+
+
+// INCLUDES
+#include <mpxaknviewplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Audio effects view plugin definition.
+ *
+ *  @lib mpxaudioeffectsviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXAudioEffectsViewPlugin ) : public CMPXAknViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXAudioEffectsViewPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXAudioEffectsViewPlugin();
+
+private:
+
+    /**
+     * From CMPXAknViewPlugin
+     * Construct Avkon view.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon view.
+     */
+    CAknView* ConstructViewLC();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXAudioEffectsViewPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXAUDIOEFFECTSVIEWPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/audioeffectsviewplugin/inc/mpxaudioeffectsviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxaudioeffectsviewplugin
+*
+*/
+
+
+
+#ifndef MPXAUDIOEFFECTSVIEWPLUGIN_HRH
+#define MPXAUDIOEFFECTSVIEWPLUGIN_HRH
+
+// CONSTANTS
+
+/** Audio effects view implementation ID */
+#define KMPXAudioEffectsViewImplementationId    0x101FFC74
+
+#endif  // MPXAUDIOEFFECTSVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/audioeffectsviewplugin/src/mpxaudioeffectsviewplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Audio effects view plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxaudioeffectsview.h"
+#include "mpxaudioeffectsviewplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXAudioEffectsViewPlugin::CMPXAudioEffectsViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXAudioEffectsViewPlugin* CMPXAudioEffectsViewPlugin::NewL()
+    {
+    CMPXAudioEffectsViewPlugin* self = 
+        new ( ELeave ) CMPXAudioEffectsViewPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXAudioEffectsViewPlugin::~CMPXAudioEffectsViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknViewPlugin
+// Construct Avkon view.
+// ---------------------------------------------------------------------------
+//
+CAknView* CMPXAudioEffectsViewPlugin::ConstructViewLC()
+    {
+    return CMPXAudioEffectsView::NewLC();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/audioeffectsviewplugin/src/mpxaudioeffectsviewpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxaudioeffectsviewplugin.hrh"
+#include "mpxaudioeffectsviewplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXAudioEffectsViewImplementationId, 
+        CMPXAudioEffectsViewPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewhgplugin/data/10207C82.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxcollectionviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxcollectionviewhgplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x10207C82;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXCollectionViewHgImplementationId;
+                    version_no = 1;
+                    display_name = "Collection view";
+                    default_data = "";
+                    opaque_data = "<t>0x101FFCA1</t>"
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU                    
+                                  "<p>0x101FFC3A;0x101FFCA9;0x10282960</p>"
+#else
+                                  "<p>0x101FFC3A;0x10282960</p>"
+#endif                                  
+                                  "<f>0x0002</f>"
+                                  "<i>"EMPXPluginPriorityHighest"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewhgplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxcollectionviewhgplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxcollectionviewhgplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewhgplugin/group/mpxcollectionviewhgplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxcollectionviewhgplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxcollectionviewhgplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x10207C82
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+#define __ENABLE_PODCAST_IN_MUSIC_MENU
+
+SOURCEPATH      ../src
+SOURCE          mpxcollectionviewhgpluginproxy.cpp
+SOURCE          mpxcollectionviewhgplugin.cpp
+
+START RESOURCE  ../data/10207C82.rss
+TARGET          mpxcollectionviewhgplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxcollectionviewhg.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewhgplugin/inc/mpxcollectionviewhgplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Collection view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXCOLLECTIONVIEWHGPLUGIN_H
+#define C_CMPXCOLLECTIONVIEWHGPLUGIN_H
+
+
+// INCLUDES
+#include <mpxaknviewplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Collection view plugin definition.
+ *
+ *  @lib mpxcollectionviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXCollectionViewHgPlugin ) : public CMPXAknViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXCollectionViewHgPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCollectionViewHgPlugin();
+
+private:
+
+    /**
+     * From CMPXAknViewPlugin
+     * Construct Avkon view.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon view.
+     */
+    CAknView* ConstructViewLC();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXCollectionViewHgPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXCOLLECTIONVIEWHGPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewhgplugin/inc/mpxcollectionviewhgplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxcollectionviewplugin
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONVIEWHGPLUGIN_HRH
+#define MPXCOLLECTIONVIEWHGPLUGIN_HRH
+
+// CONSTANTS
+
+/** Collection view implementation ID */
+#define KMPXCollectionViewHgImplementationId  0x10207C83
+
+#endif  // MPXCOLLECTIONVIEWHGPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewhgplugin/src/mpxcollectionviewhgplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Collection view plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxcollectionviewhg.h"
+#include "mpxcollectionviewhgplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewHgPlugin::CMPXCollectionViewHgPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewHgPlugin* CMPXCollectionViewHgPlugin::NewL()
+    {
+    CMPXCollectionViewHgPlugin* self =
+        new ( ELeave ) CMPXCollectionViewHgPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewHgPlugin::~CMPXCollectionViewHgPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknViewPlugin
+// Construct Avkon view.
+// ---------------------------------------------------------------------------
+//
+CAknView* CMPXCollectionViewHgPlugin::ConstructViewLC()
+    {
+    return CMPXCollectionViewHg::NewLC();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewhgplugin/src/mpxcollectionviewhgpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxcollectionviewhgplugin.hrh"
+#include "mpxcollectionviewhgplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY(
+        KMPXCollectionViewHgImplementationId,
+        CMPXCollectionViewHgPlugin::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount =
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewplugin/data/101ffc80.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxcollectionviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxcollectionviewplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC80;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXCollectionViewImplementationId;
+                    version_no = 1;
+                    display_name = "Collection view";
+                    default_data = "";
+                    opaque_data = "<t>0x101FFCA1</t>"
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU                    
+                                  "<p>0x101FFC3A;0x101FFCA9;0x10282960</p>"
+#else
+                                  "<p>0x101FFC3A;0x10282960</p>"
+#endif                                  
+                                  "<f>0x0002</f>"
+                                  "<i>"EMPXViewPluginPriorityLowest"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxcollectionviewplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxcollectionviewplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewplugin/group/mpxcollectionviewplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxcollectionviewplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxcollectionviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC80
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+#define __ENABLE_PODCAST_IN_MUSIC_MENU
+
+SOURCEPATH      ../src
+SOURCE          mpxcollectionviewpluginproxy.cpp
+SOURCE          mpxcollectionviewplugin.cpp
+
+START RESOURCE  ../data/101ffc80.rss
+TARGET          mpxcollectionviewplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxcollectionview.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewplugin/inc/mpxcollectionviewplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Collection view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXCOLLECTIONVIEWPLUGIN_H
+#define C_CMPXCOLLECTIONVIEWPLUGIN_H
+
+
+// INCLUDES
+#include <mpxaknviewplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Collection view plugin definition.
+ *
+ *  @lib mpxcollectionviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXCollectionViewPlugin ) : public CMPXAknViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXCollectionViewPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCollectionViewPlugin();
+
+private:
+
+    /**
+     * From CMPXAknViewPlugin
+     * Construct Avkon view.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon view.
+     */
+    CAknView* ConstructViewLC();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXCollectionViewPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXCOLLECTIONVIEWPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewplugin/inc/mpxcollectionviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxcollectionviewplugin
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONVIEWPLUGIN_HRH
+#define MPXCOLLECTIONVIEWPLUGIN_HRH
+
+// CONSTANTS
+
+/** Collection view implementation ID */
+#define KMPXCollectionViewImplementationId  0x101FFC81
+
+#endif  // MPXCOLLECTIONVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewplugin/src/mpxcollectionviewplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Collection view plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxcollectionview.h"
+#include "mpxcollectionviewplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewPlugin::CMPXCollectionViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewPlugin* CMPXCollectionViewPlugin::NewL()
+    {
+    CMPXCollectionViewPlugin* self = 
+        new ( ELeave ) CMPXCollectionViewPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewPlugin::~CMPXCollectionViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknViewPlugin
+// Construct Avkon view.
+// ---------------------------------------------------------------------------
+//
+CAknView* CMPXCollectionViewPlugin::ConstructViewLC()
+    {
+    return CMPXCollectionView::NewLC();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/collectionviewplugin/src/mpxcollectionviewpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxcollectionviewplugin.hrh"
+#include "mpxcollectionviewplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXCollectionViewImplementationId, 
+        CMPXCollectionViewPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/data/101ffc7B.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxembeddedplaybackviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxembeddedplaybackviewplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC7B;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXEmbeddedPlaybackViewImplementationId;
+                    version_no = 1;
+                    display_name = "Embedded Playback view";
+                    default_data = "";
+                    opaque_data = "<p>0x101FFC06;0x101FFC3A;0x101FFCD8</p>"
+                                  "<t>0x1011FCAF</t>"
+                                  "<i>"EMPXViewPluginPriorityLowest"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxembeddedplaybackviewplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxembeddedplaybackviewplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/group/mpxembeddedplaybackviewplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxembeddedplaybackviewplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxembeddedplaybackviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC7B
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxembeddedplaybackviewpluginproxy.cpp
+SOURCE          mpxembeddedplaybackviewplugin.cpp
+
+START RESOURCE  ../data/101ffc7B.rss
+TARGET          mpxembeddedplaybackviewplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxembeddedplaybackview.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/inc/mpxembeddedplaybackviewplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Embedded Playback view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXEMBEDDEDPLAYBACKVIEWPLUGIN_H
+#define C_CMPXEMBEDDEDPLAYBACKVIEWPLUGIN_H
+
+
+// INCLUDES
+#include <mpxaknviewplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Playback view plugin definition.
+ *
+ *  @lib mpxplaybackviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXEmbeddedPlaybackViewPlugin ) : public CMPXAknViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXEmbeddedPlaybackViewPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXEmbeddedPlaybackViewPlugin();
+
+private:
+
+    /**
+     * From CMPXAknViewPlugin
+     * Construct Avkon view.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon view.
+     */
+    CAknView* ConstructViewLC();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXEmbeddedPlaybackViewPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXEMBEDDEDPLAYBACKVIEWPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/inc/mpxembeddedplaybackviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxembeddedplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXEMBEDDEDPLAYBACKVIEWPLUGIN_HRH
+#define MPXEMBEDDEDPLAYBACKVIEWPLUGIN_HRH
+
+// CONSTANTS
+
+/** Playback view implementation ID */
+#define KMPXEmbeddedPlaybackViewImplementationId    0x101FFC7A
+
+#endif  // MPXEMBEDDEDPLAYBACKVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/src/mpxembeddedplaybackviewplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Embedded Playback view plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxembeddedplaybackview.h"
+#include "mpxembeddedplaybackviewplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewPlugin::CMPXEmbeddedPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewPlugin* CMPXEmbeddedPlaybackViewPlugin::NewL()
+    {
+    CMPXEmbeddedPlaybackViewPlugin* self = new ( ELeave ) CMPXEmbeddedPlaybackViewPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewPlugin::~CMPXEmbeddedPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknViewPlugin
+// Construct Avkon view.
+// ---------------------------------------------------------------------------
+//
+CAknView* CMPXEmbeddedPlaybackViewPlugin::ConstructViewLC()
+    {
+    return CMPXEmbeddedPlaybackView::NewLC();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/embeddedplaybackviewplugin/src/mpxembeddedplaybackviewpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxembeddedplaybackviewplugin.hrh"
+#include "mpxembeddedplaybackviewplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXEmbeddedPlaybackViewImplementationId, 
+        CMPXEmbeddedPlaybackViewPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/equalizerviewplugin/data/101ffc78.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxequalizerviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxequalizerviewplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC78;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXEqualizerViewImplementationId;
+                    version_no = 1;
+                    display_name = "Equalizer view";
+                    default_data = "";
+                    opaque_data = "<t>0x101FFCA3</t>"
+                                  "<i>"EMPXViewPluginPriorityLowest"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/equalizerviewplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxequalizerviewplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxequalizerviewplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/equalizerviewplugin/group/mpxequalizerviewplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxequalizerviewplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxequalizerviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC78
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxequalizerviewpluginproxy.cpp
+SOURCE          mpxequalizerviewplugin.cpp
+
+START RESOURCE  ../data/101ffc78.rss
+TARGET          mpxequalizerviewplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxequalizerview.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/equalizerviewplugin/inc/mpxequalizerviewplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Equalizer view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXEQUALIZERVIEWPLUGIN_H
+#define C_CMPXEQUALIZERVIEWPLUGIN_H
+
+
+// INCLUDES
+#include <mpxviewplugin.h>
+
+
+// FORWARD DECLARATIONS
+class CMPXEqualizerView;
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Equalizer view plugin definition.
+ *
+ *  @lib mpxequalizerviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXEqualizerViewPlugin ) : public CMPXViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXEqualizerViewPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXEqualizerViewPlugin();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXEqualizerViewPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+// from base class CMPXViewPlugin
+
+    /**
+     * From CMPXViewPlugin
+     * Interface method to create view.
+     *
+     * @since S60 v3.0
+     */
+    void CreateViewL();
+
+    /**
+     * From CMPXViewPlugin
+     * Interface method to destroy view.
+     *
+     * @since S60 v3.0
+     */
+    void DestroyView();
+
+    /**
+     * From CMPXViewPlugin
+     * Interface method to activate view.
+     *
+     * @since S60 v3.0
+     * @param aParam Parameter required to activate the view.
+     */
+    void ActivateViewL( const TDesC* aParam = NULL );
+    
+    /**
+     * From CMPXViewPlugin
+     * Interface method to activate as default view, will not
+     * bring to foreground.
+     *
+     * @since S60 v3.0
+     */
+    void SetAsDefaultViewL();
+
+    /**
+     * From CMPXViewPlugin
+     * Interface method to deactivate view.
+     *
+     * @since S60 v3.0
+     */
+    void DeactivateView();
+
+private:    // data
+
+    CMPXEqualizerView* iView;
+    };
+
+#endif  // C_CMPXEQUALIZERVIEWPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/equalizerviewplugin/inc/mpxequalizerviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxequalizerviewplugin
+*
+*/
+
+
+
+#ifndef MPXEQUALIZERVIEWPLUGIN_HRH
+#define MPXEQUALIZERVIEWPLUGIN_HRH
+
+// CONSTANTS
+
+/** Equalizer view implementation ID */
+#define KMPXEqualizerViewImplementationId    0x101FFC77
+
+#endif  // MPXEQUALIZERVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/equalizerviewplugin/src/mpxequalizerviewplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Equalizer view plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <mpxcustomcommandobserver.h>
+#include <mpxviewutilitycommanddef.h>
+#include "mpxequalizerview.h"
+#include "mpxequalizerviewplugin.h"
+#include "mpxlog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXEqualizerViewPlugin::CMPXEqualizerViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerViewPlugin::ConstructL()
+    {
+    MPX_FUNC("CMPXEqualizerViewPlugin::ConstructL");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXEqualizerViewPlugin* CMPXEqualizerViewPlugin::NewL()
+    {
+    MPX_FUNC("CMPXEqualizerViewPlugin::NewL");
+    CMPXEqualizerViewPlugin* self = new ( ELeave ) CMPXEqualizerViewPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXEqualizerViewPlugin::~CMPXEqualizerViewPlugin()
+    {
+    delete iView;
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXViewPlugin
+// Interface method to create view.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerViewPlugin::CreateViewL()
+    {
+    MPX_FUNC("CMPXEqualizerViewPlugin::CreateViewL");
+    if ( !iView )
+        {
+        iView = CMPXEqualizerView::NewL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXViewPlugin
+// Interface method to destroy view.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerViewPlugin::DestroyView()
+    {
+    MPX_FUNC("CMPXEqualizerViewPlugin::DestroyView");
+    delete iView;
+    iView = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXViewPlugin
+// Interface method to activate view.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerViewPlugin::ActivateViewL(
+    const TDesC* /* aParam */ )
+    {
+    MPX_FUNC("CMPXEqualizerViewPlugin::ActivateViewL");
+    if ( !iView )
+        {
+        CreateViewL();
+        }
+
+    iView->LaunchEqualizerL();
+
+    if ( iCommandObserver )
+        {
+        TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );    
+        iCommandObserver->HandleCustomCommand( 
+            TUid::Uid( KMPXViewUtilityCustomCommand ), 
+            EMPXViewUtilCmdViewDeActivated,
+            selfPtr );
+        }    
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXViewPlugin
+// Interface method to activate as default view, will not bring to foreground
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerViewPlugin::SetAsDefaultViewL()
+    {
+    MPX_FUNC("CMPXEqualizerViewPlugin::SetAsDefaultViewL");
+    User::Leave( KErrNotSupported );
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXViewPlugin
+// Interface method to deactivate view.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerViewPlugin::DeactivateView()
+    {
+    MPX_FUNC("CMPXEqualizerViewPlugin::DeactivateView");
+    if ( iCommandObserver )
+        {
+        TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );    
+        iCommandObserver->HandleCustomCommand( 
+            TUid::Uid( KMPXViewUtilityCustomCommand ), 
+            EMPXViewUtilCmdViewDeActivated,
+            selfPtr );
+        }    
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/equalizerviewplugin/src/mpxequalizerviewpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxequalizerviewplugin.hrh"
+#include "mpxequalizerviewplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXEqualizerViewImplementationId, 
+        CMPXEqualizerViewPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for View plugins.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../../../../inc/musicplayerbldvariant.hrh"
+
+#include "../mainviewplugin/group/bld.inf"
+#include "../playbackviewplugin/group/bld.inf"
+#include "../embeddedplaybackviewplugin/group/bld.inf"
+#include "../pdplaybackviewplugin/group/bld.inf"
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+#include "../pdsbplaybackviewplugin/group/bld.inf"
+#endif
+
+#include "../collectionviewplugin/group/bld.inf"
+#include "../collectionviewhgplugin/group/bld.inf"
+#include "../equalizerviewplugin/group/bld.inf"
+#include "../audioeffectsviewplugin/group/bld.inf"
+#include "../metadataeditordialogplugin/group/bld.inf"
+#include "../albumarteditordialogplugin/group/bld.inf"
+#include "../addtracksdialogplugin/group/bld.inf"
+#include "../waitnotedialogplugin/group/bld.inf"
+
+
+
+#ifdef IAD_INCLUDE_UPNP
+#include "../upnpplaybackviewplugin/group/bld.inf"
+#include "../upnpbrowsedialogplugin/group/bld.inf"
+#include "../upnpplaybackdialogplugin/group/bld.inf"
+#endif
+
+
+#include "../podcastviewplugin/group/bld.inf"
+#include "../podcastplaybackviewplugin/group/bld.inf"
+
+PRJ_EXPORTS
+../rom/mpxmainviewplugin.iby                CORE_APP_LAYER_IBY_EXPORT_PATH(mpxmainviewplugin.iby)
+../rom/mpxplaybackviewplugin.iby            CORE_APP_LAYER_IBY_EXPORT_PATH(mpxplaybackviewplugin.iby)
+../rom/mpxembeddedplaybackviewplugin.iby    CORE_APP_LAYER_IBY_EXPORT_PATH(mpxembeddedplaybackviewplugin.iby)
+../rom/mpxpdplaybackviewplugin.iby          CORE_APP_LAYER_IBY_EXPORT_PATH(mpxpdplaybackviewplugin.iby)
+../rom/mpxpdsbplaybackviewplugin.iby        CORE_APP_LAYER_IBY_EXPORT_PATH(mpxpdsbplaybackviewplugin.iby)
+../rom/mpxcollectionviewplugin.iby          CORE_APP_LAYER_IBY_EXPORT_PATH(mpxcollectionviewplugin.iby)
+../rom/mpxcollectionviewhgplugin.iby        CORE_APP_LAYER_IBY_EXPORT_PATH(mpxcollectionviewhgplugin.iby)
+../rom/mpxequalizerviewplugin.iby           CORE_APP_LAYER_IBY_EXPORT_PATH(mpxequalizerviewplugin.iby)
+../rom/mpxaudioeffectsviewplugin.iby        CORE_APP_LAYER_IBY_EXPORT_PATH(mpxaudioeffectsviewplugin.iby)
+../rom/mpxwaitnotedialogplugin.iby          CORE_APP_LAYER_IBY_EXPORT_PATH(mpxwaitnotedialogplugin.iby)
+../rom/mpxmetadataeditordialogplugin.iby    CORE_APP_LAYER_IBY_EXPORT_PATH(mpxmetadataeditordialogplugin.iby)
+../rom/mpxalbumarteditordialogplugin.iby    CORE_APP_LAYER_IBY_EXPORT_PATH(mpxalbumarteditordialogplugin.iby)
+../rom/mpxaddtracksdialogplugin.iby         CORE_APP_LAYER_IBY_EXPORT_PATH(mpxaddtracksdialogplugin.iby)
+../rom/mpxpodcastviewplugin.iby             CORE_APP_LAYER_IBY_EXPORT_PATH(mpxpodcastviewplugin.iby)
+../rom/mpxpodcastplaybackviewplugin.iby     CORE_APP_LAYER_IBY_EXPORT_PATH(mpxpodcastplaybackviewplugin.iby)
+#ifdef IAD_INCLUDE_UPNP
+../rom/mpxupnpplaybackviewplugin.iby        CORE_APP_LAYER_IBY_EXPORT_PATH(mpxupnpplaybackviewplugin.iby)
+../rom/mpxupnpbrowsedialogplugin.iby        CORE_APP_LAYER_IBY_EXPORT_PATH(mpxupnpbrowsedialogplugin.iby)
+../rom/mpxupnpplaybackdialogplugin.iby      CORE_APP_LAYER_IBY_EXPORT_PATH(mpxupnpplaybackdialogplugin.iby)
+#endif	// IAD_INCLUDE_UPNP
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/mainviewplugin/data/101ffc7d.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxmainviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxmainviewplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC7D;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXMainViewImplementationId;
+                    version_no = 1;
+                    display_name = "Main view";
+                    default_data = "";
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU                    
+                    opaque_data = "<t>0x101FFCA9</t>";
+#endif                  
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/mainviewplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxmainviewplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxmainviewplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/mainviewplugin/group/mpxmainviewplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxmainviewplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxmainviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC7D
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+#define __ENABLE_PODCAST_IN_MUSIC_MENU
+
+SOURCEPATH      ../src
+SOURCE          mpxmainviewpluginproxy.cpp
+SOURCE          mpxmainviewplugin.cpp
+
+START RESOURCE  ../data/101ffc7d.rss
+TARGET          mpxmainviewplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxmainview.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/mainviewplugin/inc/mpxmainviewplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX main view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXMAINVIEWPLUGIN_H
+#define C_CMPXMAINVIEWPLUGIN_H
+
+
+// INCLUDES
+#include <mpxaknviewplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX main view plugin definition.
+ *
+ *  @lib mpxmainviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXMainViewPlugin ) : public CMPXAknViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXMainViewPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXMainViewPlugin();
+
+private:
+
+    /**
+     * From CMPXAknViewPlugin
+     * Construct Avkon view.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon view.
+     */
+    CAknView* ConstructViewLC();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXMainViewPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXMAINVIEWPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/mainviewplugin/inc/mpxmainviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxmainviewplugin
+*
+*/
+
+
+
+#ifndef MPXMAINVIEWPLUGIN_HRH
+#define MPXMAINVIEWPLUGIN_HRH
+
+// CONSTANTS
+
+/** Main view implementation ID */
+#define KMPXMainViewImplementationId  0x101FFC7E
+
+#endif  // MPXMAINVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/mainviewplugin/src/mpxmainviewplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of main view plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxmainview.h"
+#include "mpxmainviewplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXMainViewPlugin::CMPXMainViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXMainViewPlugin* CMPXMainViewPlugin::NewL()
+    {
+    CMPXMainViewPlugin* self = new ( ELeave ) CMPXMainViewPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXMainViewPlugin::~CMPXMainViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknViewPlugin
+// Construct Avkon view.
+// ---------------------------------------------------------------------------
+//
+CAknView* CMPXMainViewPlugin::ConstructViewLC()
+    {
+    return CMPXMainView::NewLC();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/mainviewplugin/src/mpxmainviewpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxmainviewplugin.hrh"
+#include "mpxmainviewplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXMainViewImplementationId, 
+        CMPXMainViewPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/metadataeditordialogplugin/data/101ffc84.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,77 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxmetadataeditorplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxmetadataeditordialogplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC84;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXMetadataEditorDialogImplementationId;
+                    version_no = 1;
+                    display_name = "Metadata Editor Dialog";
+                    default_data = "";
+                    opaque_data = "<t>0x101FFCA4</t>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/metadataeditordialogplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxmetadataeditordialogplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxmetadataeditordialogplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/metadataeditordialogplugin/group/mpxmetadataeditordialogplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxmetadataeditordialogplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxmetadataeditordialogplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC84
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxmetadataeditordialogpluginproxy.cpp
+SOURCE          mpxmetadataeditordialogplugin.cpp
+
+START RESOURCE  ../data/101ffc84.rss
+TARGET          mpxmetadataeditordialogplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxmetadataeditordialog.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/metadataeditordialogplugin/inc/mpxmetadataeditordialogplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Metadata editor dialog plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXMETADATAEDITORDIALOGPLUGIN_H
+#define C_CMPXMETADATAEDITORDIALOGPLUGIN_H
+
+
+// INCLUDES
+#include <mpxakndialogplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Metadata editor dialog plugin definition.
+ *
+ *  @lib mpxmetadataeditordialogplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXMetadataEditorDialogPlugin ) : public CMPXAknDialogPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXMetadataEditorDialogPlugin* NewL();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXMetadataEditorDialogPlugin();        
+    
+private:
+
+    /**
+     * From CMPXAknDialogPlugin
+     * Construct Avkon dialog.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon dialog.
+     */
+    CAknDialog* ConstructDialogL();
+    
+    /**
+     * From CMPXAknDialogPlugin
+     * Resource Id of the dialog
+     *
+     * @since S60 v3.0
+     * @return Dialog resource ID
+     */
+    TInt ResourceId();
+    
+    /**
+     * From CMPXViewPlugin
+     * Interface method to activate view.
+     *
+     * @since S60 v3.0
+     * @param aParam Parameter required to activate the view.
+     */
+    void ActivateViewL( const TDesC* aParam = NULL );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXMetadataEditorDialogPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXMETADATAEDITORDIALOGPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/metadataeditordialogplugin/inc/mpxmetadataeditordialogplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxmetadataeditordialogplugin
+*
+*/
+
+
+
+#ifndef MPXMETADATAEDITORDIALOGPLUGIN_HRH
+#define MPXMETADATAEDITORDIALOGPLUGIN_HRH
+
+// CONSTANTS
+
+/** Metadata editor dialog implementation ID */
+#define KMPXMetadataEditorDialogImplementationId    0x101FFC83
+
+#endif  // MPXMETADATAEDITORDIALOGPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/metadataeditordialogplugin/src/mpxmetadataeditordialogplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Metadata editor dialog plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <mpxmetadataeditordialog.rsg>
+#include <mpxcustomcommandobserver.h>
+#include <mpxviewutilitycommanddef.h>
+
+#include "mpxmetadataeditordialog.h"
+#include "mpxmetadataeditordialogplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXMetadataEditorDialogPlugin::CMPXMetadataEditorDialogPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialogPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXMetadataEditorDialogPlugin* CMPXMetadataEditorDialogPlugin::NewL()
+    {
+    CMPXMetadataEditorDialogPlugin* self = 
+        new ( ELeave ) CMPXMetadataEditorDialogPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXMetadataEditorDialogPlugin::~CMPXMetadataEditorDialogPlugin()
+    {
+    // Do nothing
+    }
+    
+// ---------------------------------------------------------------------------
+// From CMPXViewPlugin
+// Interface method to activate view.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialogPlugin::ActivateViewL( const TDesC* aParam )
+    {
+    if ( !iDialog )
+        {
+        CreateViewL();
+        }
+    
+    if ( aParam )
+        {
+        CMPXMetadataEditorDialog* pDialog = 
+            static_cast<CMPXMetadataEditorDialog*>( iDialog );
+        pDialog->SetParamL( aParam );
+        }
+    
+    iDialog->ExecuteLD( ResourceId() );
+    if ( iCommandObserver )
+        {
+        TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );    
+        iCommandObserver->HandleCustomCommand( 
+            TUid::Uid( KMPXViewUtilityCustomCommand ), 
+            EMPXViewUtilCmdViewDeActivated,
+            selfPtr );
+        }
+    iDialog = NULL;
+    }    
+
+// ---------------------------------------------------------------------------
+// From CMPXAknDialogPlugin
+// Construct Avkon dialog.
+// ---------------------------------------------------------------------------
+//
+CAknDialog* CMPXMetadataEditorDialogPlugin::ConstructDialogL()
+    {
+    return CMPXMetadataEditorDialog::NewL();
+    }
+    
+// ---------------------------------------------------------------------------
+// From CMPXAknDialogPlugin
+// Resource ID.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXMetadataEditorDialogPlugin::ResourceId()
+    {
+    return R_MPX_CUI_SONG_DETAILS_DIALOG;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/metadataeditordialogplugin/src/mpxmetadataeditordialogpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxmetadataeditordialogplugin.hrh"
+#include "mpxmetadataeditordialogplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXMetadataEditorDialogImplementationId, 
+        CMPXMetadataEditorDialogPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdplaybackviewplugin/data/101ffc9f.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxpdplaybackviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxpdplaybackviewplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC9F;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXPdPlaybackViewImplementationId;
+                    version_no = 1;
+                    display_name = "Progressive Download Playback view";
+                    default_data = "";
+                    opaque_data = "<p>0x101FFC09</p>"
+                                  "<t>0x101FFCA0</t>"
+                                  "<i>"EMPXViewPluginPriorityLowest"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdplaybackviewplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxpdplaybackviewplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxpdplaybackviewplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdplaybackviewplugin/group/mpxpdplaybackviewplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxpdplaybackviewplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxpdplaybackviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC9F
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxpdplaybackviewpluginproxy.cpp
+SOURCE          mpxpdplaybackviewplugin.cpp
+
+START RESOURCE  ../data/101ffc9f.rss
+TARGET          mpxpdplaybackviewplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxpdplaybackview.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdplaybackviewplugin/inc/mpxpdplaybackviewplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Progressive Download Playback view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXPDPLAYBACKVIEWPLUGIN_H
+#define C_CMPXPDPLAYBACKVIEWPLUGIN_H
+
+
+// INCLUDES
+#include <mpxaknviewplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Progressive Download Playback view plugin definition.
+ *
+ *  @lib mpxpdplaybackviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPdPlaybackViewPlugin ) : public CMPXAknViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPdPlaybackViewPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPdPlaybackViewPlugin();
+
+private:
+
+    /**
+     * From CMPXAknViewPlugin
+     * Construct Avkon view.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon view.
+     */
+    CAknView* ConstructViewLC();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPdPlaybackViewPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXPDPLAYBACKVIEWPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdplaybackviewplugin/inc/mpxpdplaybackviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxpdplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXPDPLAYBACKVIEWPLUGIN_HRH
+#define MPXPDPLAYBACKVIEWPLUGIN_HRH
+
+// CONSTANTS
+
+/** Playback view implementation ID */
+#define KMPXPdPlaybackViewImplementationId    0x101FFC9E
+
+#endif  // MPXPDPLAYBACKVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdplaybackviewplugin/src/mpxpdplaybackviewplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Progressive Download Playback view plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxpdplaybackview.h"
+#include "mpxpdplaybackviewplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewPlugin::CMPXPdPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewPlugin* CMPXPdPlaybackViewPlugin::NewL()
+    {
+    CMPXPdPlaybackViewPlugin* self = new ( ELeave ) CMPXPdPlaybackViewPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewPlugin::~CMPXPdPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknViewPlugin
+// Construct Avkon view.
+// ---------------------------------------------------------------------------
+//
+CAknView* CMPXPdPlaybackViewPlugin::ConstructViewLC()
+    {
+    return CMPXPdPlaybackView::NewLC();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdplaybackviewplugin/src/mpxpdplaybackviewpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxpdplaybackviewplugin.hrh"
+#include "mpxpdplaybackviewplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXPdPlaybackViewImplementationId, 
+        CMPXPdPlaybackViewPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/data/10207bce.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxpdplaybackviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxpdsbplaybackviewplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x10207BCE;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXPdSbPlaybackViewImplementationId;
+                    version_no = 1;
+                    display_name = "Progressive Download from Stand-alone Browser Playback View";
+                    default_data = "";
+                    opaque_data = "<p>0x10207BCD</p>"
+                                  "<t>0x101FFCA0</t>"
+                                  "<i>"EMPXViewPluginPriorityLowest"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxpdplaybackviewplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxpdsbplaybackviewplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/group/mpxpdsbplaybackviewplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxpdsbplaybackviewplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxpdsbplaybackviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x10207BCE
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxpdsbplaybackviewpluginproxy.cpp
+SOURCE          mpxpdsbplaybackviewplugin.cpp
+
+START RESOURCE  ../data/10207bce.rss
+TARGET          mpxpdsbplaybackviewplugin.rsc
+HEADER
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxpdsbplaybackview.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/inc/mpxpdsbplaybackviewplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Progressive Download Playback view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXPDSBPLAYBACKVIEWPLUGIN_H
+#define C_CMPXPDSBPLAYBACKVIEWPLUGIN_H
+
+
+// INCLUDES
+#include <mpxaknviewplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Progressive Download Playback view plugin definition.
+ *
+ *  @lib mpxpdsbplaybackviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPdSbPlaybackViewPlugin ) : public CMPXAknViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPdSbPlaybackViewPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPdSbPlaybackViewPlugin();
+
+private:
+
+    /**
+     * From CMPXAknViewPlugin
+     * Construct Avkon view.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon view.
+     */
+    CAknView* ConstructViewLC();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPdSbPlaybackViewPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXPDSBPLAYBACKVIEWPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/inc/mpxpdsbplaybackviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxpdplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXPDSBPLAYBACKVIEWPLUGIN_HRH
+#define MPXPDSBPLAYBACKVIEWPLUGIN_HRH
+
+// CONSTANTS
+
+/** Playback view implementation ID */
+#define KMPXPdSbPlaybackViewImplementationId    0x10207BD0
+
+#endif  // MPXPDSBPLAYBACKVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/src/mpxpdsbplaybackviewplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Progressive Download Playback view plugin
+*                for PDL init from stand-alone browser
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxpdsbplaybackview.h"
+#include "mpxpdsbplaybackviewplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewPlugin::CMPXPdSbPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewPlugin* CMPXPdSbPlaybackViewPlugin::NewL()
+    {
+    CMPXPdSbPlaybackViewPlugin* self = new ( ELeave ) CMPXPdSbPlaybackViewPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewPlugin::~CMPXPdSbPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknViewPlugin
+// Construct Avkon view.
+// ---------------------------------------------------------------------------
+//
+CAknView* CMPXPdSbPlaybackViewPlugin::ConstructViewLC()
+    {
+    return CMPXPdSbPlaybackView::NewLC();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/pdsbplaybackviewplugin/src/mpxpdsbplaybackviewpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxpdsbplaybackviewplugin.hrh"
+#include "mpxpdsbplaybackviewplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY(
+        KMPXPdSbPlaybackViewImplementationId,
+        CMPXPdSbPlaybackViewPlugin::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount =
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/playbackviewplugin/data/101ffc72.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxplaybackviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxplaybackviewplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC72;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXPlaybackViewImplementationId;
+                    version_no = 1;
+                    display_name = "Playback view";
+                    default_data = "";
+                    opaque_data = "<p>0x101FFC06;0x101FFC3A</p>"
+                                  "<t>0x101FFCA0</t>"
+                                  "<a>0x102072C3</a>"
+                                  "<f>0x0003</f>"
+                                  "<i>"EMPXViewPluginPriorityLow"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/playbackviewplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxplaybackviewplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxplaybackviewplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/playbackviewplugin/group/mpxplaybackviewplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxplaybackviewplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxplaybackviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC72
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxplaybackviewpluginproxy.cpp
+SOURCE          mpxplaybackviewplugin.cpp
+
+START RESOURCE  ../data/101ffc72.rss
+TARGET          mpxplaybackviewplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxplaybackview.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/playbackviewplugin/inc/mpxplaybackviewplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Playback view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXPLAYBACKVIEWPLUGIN_H
+#define C_CMPXPLAYBACKVIEWPLUGIN_H
+
+
+// INCLUDES
+#include <mpxaknviewplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Playback view plugin definition.
+ *
+ *  @lib mpxplaybackviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPlaybackViewPlugin ) : public CMPXAknViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPlaybackViewPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPlaybackViewPlugin();
+
+private:
+
+    /**
+     * From CMPXAknViewPlugin
+     * Construct Avkon view.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon view.
+     */
+    CAknView* ConstructViewLC();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPlaybackViewPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXPLAYBACKVIEWPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/playbackviewplugin/inc/mpxplaybackviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXPLAYBACKVIEWPLUGIN_HRH
+#define MPXPLAYBACKVIEWPLUGIN_HRH
+
+// CONSTANTS
+
+/** Playback view implementation ID */
+#define KMPXPlaybackViewImplementationId    0x101FFC71
+
+#endif  // MPXPLAYBACKVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/playbackviewplugin/src/mpxplaybackviewplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Playback view plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxplaybackview.h"
+#include "mpxplaybackviewplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewPlugin::CMPXPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewPlugin* CMPXPlaybackViewPlugin::NewL()
+    {
+    CMPXPlaybackViewPlugin* self = new ( ELeave ) CMPXPlaybackViewPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewPlugin::~CMPXPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknViewPlugin
+// Construct Avkon view.
+// ---------------------------------------------------------------------------
+//
+CAknView* CMPXPlaybackViewPlugin::ConstructViewLC()
+    {
+    return CMPXPlaybackView::NewLC();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/playbackviewplugin/src/mpxplaybackviewpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxplaybackviewplugin.hrh"
+#include "mpxplaybackviewplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXPlaybackViewImplementationId, 
+        CMPXPlaybackViewPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/data/101ffcb9.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxpodcastplaybackviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxpodcastplaybackviewplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFCB9;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXPodcastPlaybackViewImplementationId;
+                    version_no = 1;
+                    display_name = "Podcast Playback view";
+                    default_data = "";
+                    opaque_data = "<p>0x101FFC06;0x101FFC3C</p>"
+                                  "<t>0x101FFCA0;</t>"
+                                  "<a>0x102072C3;</a>"
+                                  "<f>0x0003</f>"
+                                  "<i>"EMPXViewPluginPriorityLowest"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxpodcastplaybackviewplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxpodcastplaybackviewplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/group/mpxpodcastplaybackviewplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxpodcastplaybackviewplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxpodcastplaybackviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFCB9
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxpodcastplaybackviewpluginproxy.cpp
+SOURCE          mpxpodcastplaybackviewplugin.cpp
+
+START RESOURCE  ../data/101ffcb9.rss
+TARGET          mpxpodcastplaybackviewplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxpodcastplaybackview.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/inc/mpxpodcastplaybackviewplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Podcast Playback view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXPODCASTPLAYBACKVIEWPLUGIN_H
+#define C_CMPXPODCASTPLAYBACKVIEWPLUGIN_H
+
+
+// INCLUDES
+#include <mpxaknviewplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Podcast Playback view plugin definition.
+ *
+ *  @lib mpxpodcastplaybackviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPodcastPlaybackViewPlugin ) : public CMPXAknViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPodcastPlaybackViewPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPodcastPlaybackViewPlugin();
+
+private:
+
+    /**
+     * From CMPXAknViewPlugin
+     * Construct Avkon view.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon view.
+     */
+    CAknView* ConstructViewLC();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPodcastPlaybackViewPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXPODCASTPLAYBACKVIEWPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/inc/mpxpodcastplaybackviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxpodcastplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXPODCASTPLAYBACKVIEWPLUGIN_HRH
+#define MPXPODCASTPLAYBACKVIEWPLUGIN_HRH
+
+// CONSTANTS
+
+/** Playback view implementation ID */
+#define KMPXPodcastPlaybackViewImplementationId    0x101FFCBA
+
+#endif  // MPXPODCASTPLAYBACKVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/src/mpxpodcastplaybackviewplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Podcast Playback view plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxpodcastplaybackview.h"
+#include "mpxpodcastplaybackviewplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewPlugin::CMPXPodcastPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewPlugin* CMPXPodcastPlaybackViewPlugin::NewL()
+    {
+    CMPXPodcastPlaybackViewPlugin* self = new ( ELeave ) CMPXPodcastPlaybackViewPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewPlugin::~CMPXPodcastPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknViewPlugin
+// Construct Avkon view.
+// ---------------------------------------------------------------------------
+//
+CAknView* CMPXPodcastPlaybackViewPlugin::ConstructViewLC()
+    {
+    return CMPXPodcastPlaybackView::NewLC();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastplaybackviewplugin/src/mpxpodcastplaybackviewpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxpodcastplaybackviewplugin.hrh"
+#include "mpxpodcastplaybackviewplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXPodcastPlaybackViewImplementationId, 
+        CMPXPodcastPlaybackViewPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastviewplugin/data/101ffc9b.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxpodcastcollectionviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+#include "mpxpodcastcollectionviewplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC9B;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXPodcastCollectionViewImplementationId;
+                    version_no = 1;
+                    display_name = "Podcast Collection view";
+                    default_data = "";
+                    opaque_data = "<p>0x101FFC3E;0x101FFC3C</p>"
+                                  "<t>0x101FFCA1</t>"
+                                  "<i>"EMPXViewPluginPriorityLowest"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastviewplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxpodcastcollectionviewplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxpodcastcollectionviewplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastviewplugin/group/mpxpodcastcollectionviewplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxpodcastcollectionviewplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxpodcastcollectionviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC9B
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxpodcastcollectionviewpluginproxy.cpp
+SOURCE          mpxpodcastcollectionviewplugin.cpp
+
+START RESOURCE  ../data/101ffc9b.rss
+TARGET          mpxpodcastcollectionviewplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxpodcastcollectionview.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastviewplugin/inc/mpxpodcastcollectionviewplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Podcast Collection view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXPODCASTCOLLECTIONVIEWPLUGIN_H
+#define C_CMPXPODCASTCOLLECTIONVIEWPLUGIN_H
+
+
+// INCLUDES
+#include <mpxaknviewplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Podcast Collection view plugin definition.
+ *
+ *  @lib mpxpodcastcollectionviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPodcastCollectionViewPlugin ) : public CMPXAknViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPodcastCollectionViewPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPodcastCollectionViewPlugin();
+
+private:
+
+    /**
+     * From CMPXAknViewPlugin
+     * Construct Avkon view.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon view.
+     */
+    CAknView* ConstructViewLC();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPodcastCollectionViewPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXPODCASTCOLLECTIONVIEWPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastviewplugin/inc/mpxpodcastcollectionviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxpodcastcollectionviewplugin
+*
+*/
+
+
+
+#ifndef MPXPODCASTCOLLECTIONVIEWPLUGIN_HRH
+#define MPXPODCASTCOLLECTIONVIEWPLUGIN_HRH
+
+// CONSTANTS
+
+/** Podcast Collection view implementation ID */
+#define KMPXPodcastCollectionViewImplementationId  0x101FFC9C
+
+#endif  // MPXPODCASTCOLLECTIONVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastviewplugin/src/mpxpodcastcollectionviewplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Podcast Collection view plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxpodcastcollectionview.h"
+#include "mpxpodcastcollectionviewplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewPlugin::CMPXPodcastCollectionViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewPlugin* CMPXPodcastCollectionViewPlugin::NewL()
+    {
+    CMPXPodcastCollectionViewPlugin* self = 
+        new ( ELeave ) CMPXPodcastCollectionViewPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewPlugin::~CMPXPodcastCollectionViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknViewPlugin
+// Construct Avkon view.
+// ---------------------------------------------------------------------------
+//
+CAknView* CMPXPodcastCollectionViewPlugin::ConstructViewLC()
+    {
+    return CMPXPodcastCollectionView::NewLC();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/podcastviewplugin/src/mpxpodcastcollectionviewpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+#include "mpxpodcastcollectionviewplugin.hrh"
+#include "mpxpodcastcollectionviewplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXPodcastCollectionViewImplementationId, 
+        CMPXPodcastCollectionViewPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxaddtracksdialogplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxaddtracksdialogplugin
+*
+*/
+
+
+
+#ifndef MPXADDTRACKSDIALOGPLUGIN_IBY
+#define MPXADDTRACKSDIALOGPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxaddtracksdialogplugin.dll, 101ffc8d.rsc )
+
+#endif // MPXADDTRACKSDIALOGPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxalbumarteditordialogplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxalbumarteditordialogplugin
+*
+*/
+
+
+
+#ifndef MPXALBUMARTEDITORDIALOGPLUGIN_IBY
+#define MPXALBUMARTEDITORDIALOGPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxalbumarteditordialogplugin.dll, 101ffc87.rsc )
+
+#endif // MPXALBUMARTEDITORDIALOGPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxaudioeffectsviewplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxaudioeffectsviewplugin
+*
+*/
+
+
+
+#ifndef MPXAUDIOEFFECTSVIEWPLUGIN_IBY
+#define MPXAUDIOEFFECTSVIEWPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxaudioeffectsviewplugin.dll, 101ffc75.rsc )
+
+#endif // MPXAUDIOEFFECTSVIEWPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxcollectionviewhgplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxcollectionviewplugin
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONVIEWHGPLUGIN_IBY
+#define MPXCOLLECTIONVIEWHGPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxcollectionviewhgplugin.dll, 10207C82.rsc )
+
+#endif  // MPXCOLLECTIONVIEWHGPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxcollectionviewplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxcollectionviewplugin
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONVIEWPLUGIN_IBY
+#define MPXCOLLECTIONVIEWPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxcollectionviewplugin.dll, 101ffc80.rsc )
+
+#endif  // MPXCOLLECTIONVIEWPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxembeddedplaybackviewplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxembeddedplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXEMBEDDEDPLAYBACKVIEWPLUGIN_IBY
+#define MPXEMBEDDEDPLAYBACKVIEWPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxembeddedplaybackviewplugin.dll, 101ffc7b.rsc )
+
+#endif // MPXEMBEDDEDPLAYBACKVIEWPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxequalizerviewplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxequalizerviewplugin
+*
+*/
+
+
+
+#ifndef MPXEQUALIZERVIEWPLUGIN_IBY
+#define MPXEQUALIZERVIEWPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxequalizerviewplugin.dll, 101ffc78.rsc )
+
+#endif  // MPXEQUALIZERVIEWPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxmainviewplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxmainviewplugin
+*
+*/
+
+
+
+#ifndef MPXMAINVIEWPLUGIN_IBY
+#define MPXMAINVIEWPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxmainviewplugin.dll, 101ffc7d.rsc )
+
+// Include stub sis file in ROM
+data=\epoc32\data\z\system\install\mpxplugins_stub.sis   system\install\mpxplugins_stub.sis
+
+#endif  // MPXMAINVIEWPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxmetadataeditordialogplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxmetadataeditordialogplugin
+*
+*/
+
+
+
+#ifndef MPXMETADATAEDITORDIALOGPLUGIN_IBY
+#define MPXMETADATAEDITORDIALOGPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxmetadataeditordialogplugin.dll, 101ffc84.rsc )
+
+#endif // MPXMETADATAEDITORDIALOGPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxpdplaybackviewplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpdplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXPDPLAYBACKVIEWPLUGIN_IBY
+#define MPXPDPLAYBACKVIEWPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxpdplaybackviewplugin.dll, 101ffc9f.rsc )
+
+#endif // MPXPDPLAYBACKVIEWPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxpdsbplaybackviewplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpdsbplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXPDSBPLAYBACKVIEWPLUGIN_IBY
+#define MPXPDSBPLAYBACKVIEWPLUGIN_IBY
+
+#include <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+ECOM_PLUGIN( mpxpdsbplaybackviewplugin.dll, 10207bce.rsc )
+#endif
+
+#endif // MPXPDSBPLAYBACKVIEWPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxplaybackviewplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXPLAYBACKVIEWPLUGIN_IBY
+#define MPXPLAYBACKVIEWPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxplaybackviewplugin.dll, 101ffc72.rsc )
+
+#endif // MPXPLAYBACKVIEWPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxpodcastplaybackviewplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpodcastplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXPODCASTPLAYBACKVIEWPLUGIN_IBY
+#define MPXPODCASTPLAYBACKVIEWPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxpodcastplaybackviewplugin.dll, 101ffcb9.rsc )
+
+#endif  // MPXPODCASTPLAYBACKVIEWPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxpodcastviewplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpodcastviewplugin
+*
+*/
+
+
+
+#ifndef MPXPODCASTVIEWPLUGIN_IBY
+#define MPXPODCASTVIEWPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxpodcastcollectionviewplugin.dll, 101ffc9b.rsc )
+
+#endif  // MPXPODCASTVIEWPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxupnpbrowsedialogplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxupnpbrowsedialogplugin
+*
+*/
+
+
+
+#ifndef MPXUPNPBROWSEDIALOGPLUGIN_IBY
+#define MPXUPNPBROWSEDIALOGPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxupnpbrowsedialogplugin.dll, 101ffc95.rsc )
+
+#endif // MPXUPNPBROWSEDIALOGPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxupnpplaybackdialogplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxupnpplaybackdialogplugin
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKDIALOGPLUGIN_IBY
+#define MPXUPNPPLAYBACKDIALOGPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxupnpplaybackdialogplugin.dll, 101ffcbc.rsc )
+
+#endif // MPXUPNPPLAYBACKDIALOGPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxupnpplaybackviewplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxupnpplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKVIEWPLUGIN_IBY
+#define MPXUPNPPLAYBACKVIEWPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxupnpplaybackviewplugin.dll, 101ffc98.rsc )
+
+#endif // MPXUPNPPLAYBACKVIEWPLUGIN_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/rom/mpxwaitnotedialogplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxwaitnotedialogplugin
+*
+*/
+
+
+
+#ifndef MPXWAITNOTEPLUGIN_IBY
+#define MPXWAITNOTEPLUGIN_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+ECOM_PLUGIN( mpxwaitnotedialogplugin.dll, 101ffc6d.rsc )
+
+#endif  // MPXWAITNOTEPLUGIN_IBY
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/data/101FFC95.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxupnpbrowsedialogplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+#include "mpxupnpbrowsedialogplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC95;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXUPnPBrowseDialogImplementationId;
+                    version_no = 1;
+                    display_name = "UPnP Browse Dialog";
+                    default_data = "";
+                    opaque_data = "<t>0x101FFCAD</t>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxupnpbrowsedialogplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxupnpbrowsedialogplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/group/mpxupnpbrowsedialogplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxupnpbrowsedialogplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxupnpbrowsedialogplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC95
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxupnpbrowsedialogpluginproxy.cpp
+SOURCE          mpxupnpbrowsedialogplugin.cpp
+
+START RESOURCE  ../data/101FFC95.rss
+TARGET          mpxupnpbrowsedialogplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxupnpbrowsedialog.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/inc/mpxupnpbrowsedialogplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX UPnP browse dialog plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXUPNPBROWSEDIALOGPLUGIN_H
+#define C_CMPXUPNPBROWSEDIALOGPLUGIN_H
+
+
+// INCLUDES
+#include <mpxakndialogplugin.h>
+
+// FORWARD DECLARATIONS
+class MMPXViewUtility;
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Visualization menu dialog plugin definition.
+ *
+ *  @lib mpxvisualizationmenudialogplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXUPnPBrowseDialogPlugin ) : public CMPXAknDialogPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXUPnPBrowseDialogPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXUPnPBrowseDialogPlugin();
+    
+private:  // Functions from base class
+
+    /**
+     * From CMPXAknDialogPlugin
+     * Construct Avkon dialog.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon dialog.
+     */
+    CAknDialog* ConstructDialogL();
+    
+    /**
+     * From CMPXAknDialogPlugin
+     * Resource Id of the dialog
+     *
+     * @since S60 v3.0
+     * @return Dialog resource ID
+     */
+    TInt ResourceId();    
+
+    /**
+     * From CMPXViewPlugin
+     * Interface method to activate view.
+     *
+     * @since S60 v3.0
+     * @param aParam Parameter required to activate the view.
+     */
+    void ActivateViewL( const TDesC* aParam = NULL );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXUPnPBrowseDialogPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    
+private: //data
+     MMPXViewUtility* iViewUtility;
+     TInt iPlayerUid;
+    };
+
+#endif  // C_CMPXUPNPBROWSEDIALOGPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/inc/mpxupnpbrowsedialogplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxupnpbrowsedialogplugin
+*
+*/
+
+
+
+#ifndef MPXUPNPBROWSEDIALOGPLUGIN_HRH
+#define MPXUPNPBROWSEDIALOGPLUGIN_HRH
+
+// CONSTANTS
+
+/** UPnP Browse dialog implementation ID */
+#define KMPXUPnPBrowseDialogImplementationId    0x101FFC96
+
+#endif  // MPXUPNPBROWSEDIALOGPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/src/mpxupnpbrowsedialogplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of UPnP browse dialog plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include "mpxupnpbrowsedialog.h"
+#include <mpxcustomcommandobserver.h>
+#include <mpxviewutilitycommanddef.h>
+#include <mpxmusicplayerviewplugin.hrh>
+
+#include "mpxupnpbrowsedialogplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPBrowseDialogPlugin::CMPXUPnPBrowseDialogPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPBrowseDialogPlugin::ConstructL()
+    {
+        // Get an instance of view utility
+    iPlayerUid = 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPBrowseDialogPlugin* CMPXUPnPBrowseDialogPlugin::NewL()
+    {
+    CMPXUPnPBrowseDialogPlugin* self = 
+        new ( ELeave ) CMPXUPnPBrowseDialogPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPBrowseDialogPlugin::~CMPXUPnPBrowseDialogPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknDialogPlugin
+// Construct Avkon dialog.
+// ---------------------------------------------------------------------------
+//
+CAknDialog* CMPXUPnPBrowseDialogPlugin::ConstructDialogL()
+    {
+    return CMPXUPnPBrowseDialog::NewL(0);
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXViewPlugin
+// Interface method to activate view.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPBrowseDialogPlugin::ActivateViewL(
+    const TDesC* aParam )
+    {
+    if ( !iDialog )
+        {
+        CreateViewL();
+        }
+
+    // Translate the desc param into a Uid int
+    HBufC* buf = HBufC::NewLC(aParam->Length());
+    (buf->Des()).Copy(*aParam);
+
+    TLex resDT( *buf );
+    resDT.Val( iPlayerUid );
+    CleanupStack::PopAndDestroy(buf);
+    
+    // Launch the dialog
+    TInt selectedSubPlayer = iDialog->ExecuteLD(iPlayerUid);
+    if ( iCommandObserver )
+        {
+        TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );    
+        iCommandObserver->HandleCustomCommand( 
+            TUid::Uid( KMPXViewUtilityCustomCommand ), 
+            EMPXViewUtilCmdViewDeActivated,
+            selfPtr );
+        }
+    delete iDialog;
+    iDialog = NULL;
+
+    // if selectedSubPlayer is KErrCancel, dialog was cancelled
+    if ( selectedSubPlayer >= 0 )
+        {
+        HBufC* buf = HBufC::NewLC( 20 ); // magic number
+        buf->Des().AppendNum( selectedSubPlayer );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    else
+        {
+        User::LeaveIfError(selectedSubPlayer);
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// From CMPXAknDialogPlugin
+// Resource ID.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXUPnPBrowseDialogPlugin::ResourceId()
+    {
+    return 0;
+    }    
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpbrowsedialogplugin/src/mpxupnpbrowsedialogpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+#include "mpxupnpbrowsedialogplugin.hrh"
+#include "mpxupnpbrowsedialogplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXUPnPBrowseDialogImplementationId, 
+        CMPXUPnPBrowseDialogPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/data/101ffcbc.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxupnpplaybackplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxupnpplaybackdialogplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFCBC;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXUPnPPlaybackDialogImplementationId;
+                    version_no = 1;
+                    display_name = "UPnP Playback Dialog";
+                    default_data = "";
+                    opaque_data = "<p>0x200075D8</p>"
+                                  "<t>0x101FFCA0</t>"
+                                  "<i>"EMPXViewPluginPriorityLowest"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxupnpplaybackdialogplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxupnpplaybackdialogplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/group/mpxupnpplaybackdialogplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxupnpplaybackdialogplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxupnpplaybackdialogplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFCBC
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxupnpplaybackdialogpluginproxy.cpp
+SOURCE          mpxupnpplaybackdialogplugin.cpp
+
+START RESOURCE  ../data/101ffcbc.rss
+TARGET          mpxupnpplaybackdialogplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxupnpplaybackdialog.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/inc/mpxupnpplaybackdialogplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX upnp playback dialog plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXUPNPPLAYBACKDIALOGPLUGIN_H
+#define C_CMPXUPNPPLAYBACKDIALOGPLUGIN_H
+
+
+// INCLUDES
+#include <mpxakndialogplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX upnp playback dialog plugin definition.
+ *
+ *  @lib mpxupnpplaybackdialogplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXUPnPPlaybackDialogPlugin ) : public CMPXAknDialogPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXUPnPPlaybackDialogPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXUPnPPlaybackDialogPlugin();
+
+private:
+
+    /**
+     * From CMPXAknDialogPlugin
+     * Construct Avkon dialog.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon dialog.
+     */
+    CAknDialog* ConstructDialogL();
+    
+    /**
+     * From CMPXAknDialogPlugin
+     * Resource Id of the dialog
+     *
+     * @since S60 v3.0
+     * @return Dialog resource ID
+     */
+    TInt ResourceId();
+    
+    /**
+     * From CMPXViewPlugin
+     * Interface method to activate view.
+     *
+     * @since S60 v3.0
+     * @param aParam Parameter required to activate the view.
+     */
+    void ActivateViewL( const TDesC* aParam = NULL );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXUPnPPlaybackDialogPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXUPNPPLAYBACKDIALOGPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/inc/mpxupnpplaybackdialogplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxupnpplaybackdialogplugin
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKDIALOGPLUGIN_HRH
+#define MPXUPNPPLAYBACKDIALOGPLUGIN_HRH
+
+// CONSTANTS
+
+/** UPnP Playback dialog implementation ID */
+#define KMPXUPnPPlaybackDialogImplementationId    0x101FFCBD
+
+#endif  // MPXUPNPPLAYBACKDIALOGPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/src/mpxupnpplaybackdialogplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of upnpplayback dialog plugin
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxupnpplaybackdialog.rsg>
+#include <mpxcustomcommandobserver.h>
+#include <mpxviewutilitycommanddef.h>
+
+#include "mpxupnpplaybackdialog.h"
+#include "mpxupnpplaybackdialogplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialogPlugin::CMPXUPnPPlaybackDialogPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialogPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialogPlugin* CMPXUPnPPlaybackDialogPlugin::NewL()
+    {
+    CMPXUPnPPlaybackDialogPlugin* self = 
+        new ( ELeave ) CMPXUPnPPlaybackDialogPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialogPlugin::~CMPXUPnPPlaybackDialogPlugin()
+    {
+    // Do nothing
+    }
+    
+// ---------------------------------------------------------------------------
+// From CMPXViewPlugin
+// Interface method to activate view.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialogPlugin::ActivateViewL( const TDesC* aParam )
+    {
+    if ( !iDialog )
+        {
+        CreateViewL();        
+        }
+    
+    if ( aParam )
+        {
+        CMPXUPnPPlaybackDialog* pDialog = 
+            static_cast<CMPXUPnPPlaybackDialog*>( iDialog );
+        pDialog->SetParamL( aParam );
+        }
+    
+    iDialog->ExecuteLD( ResourceId() );
+    if ( iCommandObserver )
+        {
+        TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );    
+        iCommandObserver->HandleCustomCommand( 
+            TUid::Uid( KMPXViewUtilityCustomCommand ), 
+            EMPXViewUtilCmdViewDeActivated,
+            selfPtr );
+        }    
+    iDialog = NULL;
+    }    
+
+// ---------------------------------------------------------------------------
+// From CMPXAknDialogPlugin
+// Construct Avkon dialog.
+// ---------------------------------------------------------------------------
+//
+CAknDialog* CMPXUPnPPlaybackDialogPlugin::ConstructDialogL()
+    {
+    return CMPXUPnPPlaybackDialog::NewL();
+    }
+    
+// ---------------------------------------------------------------------------
+// From CMPXAknDialogPlugin
+// Resource ID.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXUPnPPlaybackDialogPlugin::ResourceId()
+    {
+    return R_MPX_CUI_UPNP_PLAYBACK_DIALOG;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackdialogplugin/src/mpxupnpplaybackdialogpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxupnpplaybackdialogplugin.hrh"
+#include "mpxupnpplaybackdialogplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXUPnPPlaybackDialogImplementationId, 
+        CMPXUPnPPlaybackDialogPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/data/101ffc98.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxupnpplaybackviewplugin
+*
+*/
+
+
+
+// INCLUDES
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxupnpplaybackviewplugin.hrh"
+
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC98;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXUPnPPlaybackViewImplementationId;
+                    version_no = 1;
+                    display_name = "UPnP Playback view";
+                    default_data = "";
+                    opaque_data = "<p>0x200075D8;0x101FFC3A;0x101FFC3C</p>"
+                                  "<t>0x101FFCA0</t>"
+                                  "<i>"EMPXViewPluginPriorityLowest"</i>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxupnpplaybackviewplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxupnpplaybackviewplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/group/mpxupnpplaybackviewplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxupnpplaybackviewplugin.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxupnpplaybackviewplugin.dll
+TARGETTYPE      PLUGIN
+UID             0x10009D8D 0x101FFC98
+
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxupnpplaybackviewpluginproxy.cpp
+SOURCE          mpxupnpplaybackviewplugin.cpp
+
+START RESOURCE  ../data/101ffc98.rss
+TARGET          mpxupnpplaybackviewplugin.rsc
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxupnpplaybackview.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/inc/mpxupnpplaybackviewplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX upnp Playback view plugin definition.
+*
+*/
+
+
+
+#ifndef C_CMPXUPNPPLAYBACKVIEWPLUGIN_H
+#define C_CMPXUPNPPLAYBACKVIEWPLUGIN_H
+
+
+// INCLUDES
+#include <mpxaknviewplugin.h>
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX UPnP Playback view plugin definition.
+ *
+ *  @lib mpxupnpplaybackviewplugin.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXUPnPPlaybackViewPlugin ) : public CMPXAknViewPlugin
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXUPnPPlaybackViewPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXUPnPPlaybackViewPlugin();
+
+private:
+
+    /**
+     * From CMPXAknViewPlugin
+     * Construct Avkon view.
+     *
+     * @since S60 v3.0
+     * @return Pointer to a newly created Avkon view.
+     */
+    CAknView* ConstructViewLC();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXUPnPPlaybackViewPlugin();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXUPNPPLAYBACKVIEWPLUGIN_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/inc/mpxupnpplaybackviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxupnpplaybackviewplugin
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKVIEWPLUGIN_HRH
+#define MPXUPNPPLAYBACKVIEWPLUGIN_HRH
+
+// CONSTANTS
+
+/** Playback view implementation ID */
+#define KMPXUPnPPlaybackViewImplementationId    0x101FFC99
+
+#endif  // MPXUPNPPLAYBACKVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/src/mpxupnpplaybackviewplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of upnp Playback view plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxupnpplaybackview.h"
+#include "mpxupnpplaybackviewplugin.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewPlugin::CMPXUPnPPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewPlugin::ConstructL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewPlugin* CMPXUPnPPlaybackViewPlugin::NewL()
+    {
+    CMPXUPnPPlaybackViewPlugin* self = new ( ELeave ) CMPXUPnPPlaybackViewPlugin();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewPlugin::~CMPXUPnPPlaybackViewPlugin()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXAknViewPlugin
+// Construct Avkon view.
+// ---------------------------------------------------------------------------
+//
+CAknView* CMPXUPnPPlaybackViewPlugin::ConstructViewLC()
+    {
+    return CMPXUPnPPlaybackView::NewLC();
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/upnpplaybackviewplugin/src/mpxupnpplaybackviewpluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Standard proxy of the ECOM plugin
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxupnpplaybackviewplugin.hrh"
+#include "mpxupnpplaybackviewplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXUPnPPlaybackViewImplementationId, 
+        CMPXUPnPPlaybackViewPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/waitnotedialogplugin/data/101FFC6D.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project ?myapp
+*
+*/
+
+
+NAME MPWP
+
+#include <ecom/registryinfo.rh>
+#include <mpxviewplugin.hrh>
+
+#include "mpxwaitnoteplugin.hrh"
+
+// RESOURCE DEFINITIONS 
+
+/**
+ * The opaque_data syntax is made up of three parts: 
+ * a list of Uids for resolving the view plugin, feature flags, priority.
+ * 
+ * <p>uid1;uid2;uid3</p>
+ *  uid*: uid of the supported Playback/Collection plugin.
+ *  E.g. if the view plugin supports Local Playback plugin, the list of
+ *  uids will be: 0x101FFC06
+ *
+ * <t>uid</t>
+ *  uid: plugin type uid.
+ *  E.g. if the view plugin supports playback type, uid will be: 0x101FFCA0
+ *
+ * <f>flags</f> [optional]
+ *  flags: sum of the required feature flags that listed in mpxviewplugin.hrh. 
+ *  E.g. if the view plugin needs to be pre-loaded and it's user-selectable,
+ *  then flags = KMPXVpFeaturePreLoaded + KMPXVpFeatureUserSelectable = 0x0003.
+ *
+ * <i>priority</i> [optional]
+ *  priority: a value of type TMPXViewPluginPriorities. This value determines
+ *  which view plugin will be resolved when several plugins can support the 
+ *  same set of Uids. 
+ *  Default value of this field is EMPXViewPluginPriorityNormal.
+ */
+RESOURCE REGISTRY_INFO theInfo
+    {
+    dll_uid = 0x101FFC6D;
+
+    interfaces = 
+        {
+        INTERFACE_INFO
+            {
+            interface_uid = KMPXViewPluginInterfaceUid;
+            implementations = 
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMPXWaitNoteDialogImplementationId;
+                    version_no = 1;
+                    display_name = "Wait Note Dialogs";
+                    default_data = "";
+                    opaque_data = "<t>0x101FFC6E</t>";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/waitnotedialogplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxwaitnoteplugin.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxwaitnoteplugin.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/waitnotedialogplugin/group/mpxwaitnoteplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxwaitnoteplugin
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET                  mpxwaitnotedialogplugin.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D 0x101FFC6D
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH              ../src
+SOURCE                  mpxwaitnoteplugin.cpp
+SOURCE                  mpxwaitnotepluginproxy.cpp
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+START RESOURCE          ../data/101FFC6D.rss
+TARGET                  mpxwaitnotedialogplugin.rsc
+END // RESOURCE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         ecom.lib
+LIBRARY         mpxviewplugin.lib
+LIBRARY         mpxmainview.lib
+LIBRARY         mpxwaitnotedialog.lib
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/waitnotedialogplugin/inc/mpxwaitnoteplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note view class
+*
+*/
+
+
+#ifndef C_CMPXWAITNOTEPLUGIN_H
+#define C_CMPXWAITNOTEPLUGIN_H
+
+// Includes
+#include <aknnotedialog.h>
+#include <mpxviewplugin.h>
+#include "mpxwaitnoteobserver.h"
+
+// FOWARD DECLARATIONS
+class CMPXWaitNoteDialog;
+/**
+ *  Wait note plugin
+ *
+ *  @lib mpxwaitnoteplugin.lib
+ *  @since S60 3.1
+ */
+NONSHARABLE_CLASS( CMPXWaitNoteDialogPlugin ) : public CMPXViewPlugin,
+                                                public MMPXWaitNoteObserver
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXWaitNoteDialogPlugin* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXWaitNoteDialogPlugin();
+
+protected:
+    
+     /**
+     * From CMPXViewPlugin
+     * Interface method to create view.
+     *
+     * @since S60 v3.0
+     */
+    void CreateViewL();
+
+    /**
+     * From CMPXViewPlugin
+     * Interface method to destroy view.
+     *
+     * @since S60 v3.0
+     */
+    void DestroyView();
+
+    /**
+     * From CMPXViewPlugin
+     * Interface method to activate view.
+     *
+     * @since S60 v3.0
+     * @param aParam Parameter required to activate the view.
+     */
+    void ActivateViewL( const TDesC* aParam = NULL );
+    
+    /**
+     * From CMPXViewPlugin
+     * Interface method to activate as default view, will not
+     * bring to foreground.
+     *
+     * @since S60 v3.0
+     */
+    void SetAsDefaultViewL();
+
+    /**
+     * From CMPXViewPlugin
+     * Interface method to deactivate view.
+     *
+     * @since S60 v3.0
+     */
+    void DeactivateView();
+
+protected:
+    
+    /**
+    * From MMPXWaitNoteObserver
+    */
+    void HandleWaitNoteDismissedL();
+    
+    /**
+     * From MMPXWaitNoteOberserver
+     * Get pointer to the note dialog. 
+     * 
+     * @param aNoteDialog Referrence of Pointer to the note dialog.
+     * @param aDlgRsc The resource ID.
+     * @param aTone Tone of the note dialog.
+     */
+    void NoteDialogL( CAknNoteDialog*& aNoteDialog,
+            TInt aDlgRsc, CAknNoteDialog::TTone aTone );
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXWaitNoteDialogPlugin();
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    
+    /**
+     * Destroy the previous activated wait note when it is 
+     * ready to destroy
+     */
+    static TInt DestroyOldWaiteNote( TAny* aPtr );
+    
+private: // data
+	CAknNoteDialog*		  iNoteDialog; // not Owned
+    CMPXWaitNoteDialog*   iWaitNote;
+    CMPXWaitNoteDialog*   iOldWaitNote; // Previous activated wait note
+    CIdle*                iIdle;
+    };
+
+#endif // C_CMPXWAITNOTEPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/waitnotedialogplugin/inc/mpxwaitnoteplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxwaitnotedialog
+*
+*/
+
+
+#ifndef MPXWAITNOTEDIALOGPLUGIN_HRH
+#define MPXWAITNOTEDIALOGPLUGIN_HRH
+
+#define KMPXWaitNoteDialogImplementationId 0x101FFC6C
+
+#endif // MPXWAITNOTEDIALOGPLUGIN_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/waitnotedialogplugin/src/mpxwaitnoteplugin.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,243 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait Note Plugin
+*
+*/
+
+#include <eikdialg.h>
+#include <aknnotedialog.h>
+#include <mpxcustomcommandobserver.h>
+#include <mpxviewutilitycommanddef.h>
+#include <mpxlog.h>
+#include "mpxwaitnotedialog.h"
+#include "mpxwaitnoteconstructor.h"
+#include "mpxwaitnoteplugin.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Default Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXWaitNoteDialogPlugin::CMPXWaitNoteDialogPlugin()
+    {
+    iWaitNote = NULL;
+    iOldWaitNote = NULL;
+    iNoteDialog = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// Virtual destructor
+// ---------------------------------------------------------------------------
+//
+CMPXWaitNoteDialogPlugin::~CMPXWaitNoteDialogPlugin()
+    {
+    if (iIdle)
+        {
+        iIdle->Cancel();
+        delete iIdle;
+        iIdle = NULL;
+        }
+    if( iOldWaitNote )
+        {
+        delete iOldWaitNote;
+        iOldWaitNote = NULL;
+        }
+    if( iWaitNote )
+        {
+        delete iWaitNote;
+        iWaitNote = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Second Phased Constructor
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialogPlugin::ConstructL()
+    {
+    iIdle = CIdle::NewL(CActive::EPriorityIdle);
+    }
+
+// ---------------------------------------------------------------------------
+// Destroy previous wait note when callback from CIdle
+// ---------------------------------------------------------------------------
+//
+TInt CMPXWaitNoteDialogPlugin::DestroyOldWaiteNote( TAny* aPtr )
+    {
+    MPX_DEBUG1("CMPXWaitNoteDialogPlugin::DestroyOldWaiteNote()");
+    TBool cont = EFalse;
+
+    CMPXWaitNoteDialogPlugin* waitNotePlugin =
+            static_cast<CMPXWaitNoteDialogPlugin*>(aPtr);
+
+    if( waitNotePlugin->iOldWaitNote->ReadyToDestroy() )
+        {
+        TRAP_IGNORE( waitNotePlugin->iOldWaitNote->CancelNoteL() );
+        delete waitNotePlugin->iOldWaitNote;
+        waitNotePlugin->iOldWaitNote = NULL;
+        cont = EFalse;
+        }
+    else
+        {
+        cont = ETrue;
+        }
+    return cont;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-Phased Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXWaitNoteDialogPlugin* CMPXWaitNoteDialogPlugin::NewL()
+    {
+    CMPXWaitNoteDialogPlugin* self = new( ELeave ) CMPXWaitNoteDialogPlugin;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+// ---------------------------------------------------------------------------
+// Get NoteDialog resource
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialogPlugin::NoteDialogL( CAknNoteDialog*& aNoteDialog,
+                             TInt aDlgRsc, CAknNoteDialog::TTone aTone  )
+    {
+    MPX_DEBUG1("CMPXWaitNoteDialogPlugin::NoteDialogL()");
+
+    if ( !iNoteDialog )
+        {
+        iNoteDialog = new ( ELeave ) CAknNoteDialog(
+                (CEikDialog**)( &iNoteDialog ),
+                CAknNoteDialog::ENoTone,
+                CAknNoteDialog::ENoTimeout );
+        iNoteDialog->PrepareLC( aDlgRsc );
+        iNoteDialog->SetTone( aTone );
+        iNoteDialog->RunLD();
+        }
+    aNoteDialog = iNoteDialog;
+    }
+
+// ---------------------------------------------------------------------------
+// Create the view
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialogPlugin::CreateViewL()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Destroy the view
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialogPlugin::DestroyView()
+    {
+    MPX_DEBUG1("CMPXWaitNoteDialogPlugin::DestroyView()");
+    if( iWaitNote )
+        {
+        TRAP_IGNORE( iWaitNote->CancelNoteL() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Activate the view
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialogPlugin::ActivateViewL( const TDesC* aParam )
+    {
+    MPX_DEBUG1("CMPXWaitNoteDialogPlugin::ActivateViewL()");
+    // Delete old instance
+    if( iWaitNote )
+        {
+        // delete old will callback and destroy second time, need to use a
+        // old variable, and avoid using old address
+        MPX_DEBUG1("CMPXWaitNoteDialogPlugin::ActivateViewL()");
+        if( iOldWaitNote )
+	        {
+			TRAP_IGNORE( iOldWaitNote->CancelNoteL() );
+			delete iOldWaitNote;
+			iOldWaitNote = NULL;
+	        }
+        iOldWaitNote = iWaitNote;
+        iWaitNote = NULL;
+        }
+
+    // Start the note
+    iWaitNote = CMPXWaitNoteConstructor::ConstructWaitNoteL( *aParam, this );
+    iWaitNote->ExecuteLD();
+    if( iOldWaitNote )
+        {
+		iOldWaitNote->CancelNoteL();
+        TCallBack callBack( CMPXWaitNoteDialogPlugin::DestroyOldWaiteNote,
+                            this );
+        if( iIdle->IsActive() )
+            {
+            iIdle->Cancel();
+            }
+        iIdle->Start(callBack);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXViewPlugin
+// Interface method to activate as default view, will not bring to foreground
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialogPlugin::SetAsDefaultViewL()
+    {
+    User::Leave( KErrNotSupported );
+    }
+
+// ---------------------------------------------------------------------------
+// Deactivate the view
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialogPlugin::DeactivateView()
+    {
+    // Cancel the note if we deactivate the view.
+    if (iWaitNote)  // Fix for ESLU-7CFEPF
+        {
+        TRAP_IGNORE( iWaitNote->CancelNoteL() );
+        }
+
+    if ( iCommandObserver )
+        {
+        TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );
+        iCommandObserver->HandleCustomCommand(
+            TUid::Uid( KMPXViewUtilityCustomCommand ),
+            EMPXViewUtilCmdViewDeActivated,
+            selfPtr );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handling when the wait note is dismissed
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialogPlugin::HandleWaitNoteDismissedL()
+    {
+    // Tell view framework that progress note has been dismissed
+    //
+    MPX_DEBUG1("CMPXWaitNoteDialogPlugin::HandleWaitNoteDismissedL()");
+    if ( iCommandObserver )
+        {
+        TPckgC<TInt> selfPtr( reinterpret_cast<TInt>( this ) );
+        iCommandObserver->HandleCustomCommand(
+            TUid::Uid( KMPXViewUtilityCustomCommand ),
+            EMPXViewUtilCmdViewDeActivated,
+            selfPtr );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/plugins/waitnotedialogplugin/src/mpxwaitnotepluginproxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  wait note plugin proxy
+*
+*/
+
+
+// INCLUDE FILES
+#include <ecom/implementationproxy.h>
+
+#include "mpxwaitnoteplugin.hrh"
+#include "mpxwaitnoteplugin.h"
+
+#if ( !defined IMPLEMENTATION_PROXY_ENTRY )
+typedef TAny* TProxyNewLPtr;
+#define IMPLEMENTATION_PROXY_ENTRY( aUid,aFuncPtr ) { { aUid }, ( TProxyNewLPtr )( aFuncPtr ) }
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// The list of implementations
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] = 
+    { 
+    IMPLEMENTATION_PROXY_ENTRY( 
+        KMPXWaitNoteDialogImplementationId, 
+        CMPXWaitNoteDialogPlugin::NewL ) 
+    };
+
+// ---------------------------------------------------------------------------
+// The proxy of implementations
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+    TInt& aTableCount )
+    {
+    aTableCount = 
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+    return ImplementationTable;
+    }
+
+// End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/bwinscw/mpxaddtracksdialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	??1CMPXAddTracksDialog@@UAE@XZ @ 1 NONAME ; CMPXAddTracksDialog::~CMPXAddTracksDialog(void)
+	?NewL@CMPXAddTracksDialog@@SAPAV1@XZ @ 2 NONAME ; class CMPXAddTracksDialog * CMPXAddTracksDialog::NewL(void)
+	?NewLC@CMPXAddTracksDialog@@SAPAV1@XZ @ 3 NONAME ; class CMPXAddTracksDialog * CMPXAddTracksDialog::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/data/mpxaddtracksdialog.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,313 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxaddtracksdialog
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MXTV // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+#include <mpxaddtracksdialog.mbg>
+
+#include <mpxaddtracksdialog.loc>
+#include "mpxaddtracksdialog.hrh"
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addtracks_dialog
+//-----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_cui_addtracks_dialog
+    {
+    flags = EAknDialogSelectionList;
+    items = 
+        {
+        DLG_LINE
+            {
+            type = EAknCtSingleGraphicListBox;
+            id = ESelectionListControl;
+            control = LISTBOX
+                {
+                flags = EAknListBoxSelectionList;
+                };
+            }, 
+        DLG_LINE 
+            { 
+            itemflags = EEikDlgItemNonFocusing; 
+            id = EFindControl; 
+            type = EAknCtSelectionListPopupFind; 
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addtracks_softkeys_empty_done
+//-----------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_cui_addtracks_softkeys_empty_done
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksDone;
+            txt = text_softkey_done;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addtracks_softkeys_expand_done
+//-----------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_cui_addtracks_softkeys_expand_done
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksExpand;
+            txt = qtn_nmp_softkey_expand;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksDone;
+            txt = text_softkey_done;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addtracks_softkeys_collapse_done
+//-----------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_cui_addtracks_softkeys_collapse_done
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksCollapse;
+            txt = qtn_nmp_softkey_collapse;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksDone;
+            txt = text_softkey_done;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addtracks_softkeys_add_done
+//-----------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_cui_addtracks_softkeys_add_done
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksAdd;
+            txt = qtn_nmp_softkey_add;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksDone;
+            txt = text_softkey_done;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addtracks_softkeys_empty_cancel
+//-----------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_cui_addtracks_softkeys_empty_cancel
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksFindCancel;
+            txt = text_softkey_cancel;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addtracks_softkeys_expand_cancel
+//-----------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_cui_addtracks_softkeys_expand_cancel
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksExpand;
+            txt = qtn_nmp_softkey_expand;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksFindCancel;
+            txt = text_softkey_cancel;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addtracks_softkeys_collapse_cancel
+//-----------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_cui_addtracks_softkeys_collapse_cancel
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksCollapse;
+            txt = qtn_nmp_softkey_collapse;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksFindCancel;
+            txt = text_softkey_cancel;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addtracks_softkeys_add_cancel
+//-----------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_cui_addtracks_softkeys_add_cancel
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksAdd;
+            txt = qtn_nmp_softkey_add;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdAddTracksFindCancel;
+            txt = text_softkey_cancel;
+            }
+        };
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addsongs_add_allsongs_txt
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_addsongs_add_allsongs_txt
+    {
+    buf = qtn_nmp_addsongs_allsongs;
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addsongs_add_songs_num_txt
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_addsongs_add_songs_num_txt
+    {
+    buf = qtn_nmp_addsongs_num_songs;
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addsongs_title
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_addsongs_title
+    {
+    buf = qtn_nmp_title_add_songs;
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_category_addsongview_lbx_emptytext
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_category_addsongview_lbx_emptytext
+    {
+    buf = qtn_nmp_no_addsongsview_editor;
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_addsongs_song_added
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_addsongs_song_added
+    {
+    buf = qtn_nmp_addsongs_song_added;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_mp_unknown
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_mp_unknown
+    {
+    buf = qtn_mp_list_unknown;
+    }   
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_note_opening
+// text for opening wait note.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_note_opening
+    {
+    buf = qtn_nmp_note_opening;
+    }
+
+//-----------------------------------------------------------------------------
+// r_mpx_cui_category_addsongview_lbx_nosongtext
+//-----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_category_addsongview_lbx_nosongtext
+    {
+    buf = qtn_nmp_no_songs_editor;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/eabi/mpxaddtracksdialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+	_ZN19CMPXAddTracksDialog4NewLEv @ 1 NONAME
+	_ZN19CMPXAddTracksDialog5NewLCEv @ 2 NONAME
+	_ZN19CMPXAddTracksDialogD0Ev @ 3 NONAME
+	_ZN19CMPXAddTracksDialogD1Ev @ 4 NONAME
+	_ZN19CMPXAddTracksDialogD2Ev @ 5 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxaddtracksdialog.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxaddtracksdialog.loc	APP_LAYER_LOC_EXPORT_PATH(mpxaddtracksdialog.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxaddtracksdialog.mif
+OPTION HEADERFILE mpxaddtracksdialog.mbg
+OPTION SOURCEFILE iconlist.txt
+END
+
+PRJ_MMPFILES
+mpxaddtracksdialog.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,12 @@
+/c8,8 qgn_graf_mup_adtl_chmrk_fr01
+/c8,8 qgn_graf_mup_adtl_chmrk_fr02
+/c8,8 qgn_graf_mup_adtl_chmrk_fr03
+/c8,8 qgn_graf_mup_adtl_chmrk_fr04
+/c8,8 qgn_graf_mup_lst_colpsd_artist
+/c8,8 qgn_graf_mup_lst_colpsd_track
+/c8,8 qgn_graf_mup_lst_empty
+/c8,8 qgn_graf_mup_lst_expd_artist
+/c8,8 qgn_graf_mup_lst_expd_track
+/c8,8 qgn_indi_mmc_add
+/c8,8 qgn_graf_mup_ctx_addsong
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/group/mpxaddtracksdialog.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxaddtracksdialog.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../../../inc/musicplayerbldvariant.hrh"
+
+TARGET          mpxaddtracksdialog.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC8B
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+#ifdef IAD_INCLUDE_SINGLE_CLICK 
+MACRO SINGLE_CLICK_INCLUDED
+#endif
+
+SOURCEPATH      ../src
+SOURCE          mpxaddtracksdialog.cpp
+SOURCE          mpxaddtrackslbxarray.cpp
+SOURCE          mpxaddtrackslistmodel.cpp
+
+START RESOURCE  ../data/mpxaddtracksdialog.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         egul.lib
+LIBRARY         eikctl.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         commonengine.lib
+LIBRARY         eikdlg.lib
+LIBRARY         aknicon.lib
+LIBRARY         estor.lib
+LIBRARY         platformenv.lib // pathinfo
+LIBRARY         aknskins.lib
+
+LIBRARY         mpxcollectionhelper.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxcommon.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/group/mpxaddtracksdialogicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxaddtracksdialog
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxaddtracksdialog.mif
+HEADERFILENAME=$(HEADERDIR)/mpxaddtracksdialog.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/inc/mpxaddtracksdialog.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxaddtracksdialog
+*
+*/
+
+
+
+#ifndef MPXADDTRACKSDIALOG_HLP_HRH
+#define MPXADDTRACKSDIALOG_HLP_HRH
+
+_LIT( KMUS_HLP_ADDTRACKS_DIALOG, "MUS_HLP_ADDTRACKS_DIALOG" );
+
+#endif  // MPXADDTRACKSDIALOG_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/inc/mpxaddtracksdialog.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxaddtracksdialog
+*
+*/
+
+
+
+#ifndef MPXADDTRACKSDIALOG_HRH
+#define MPXADDTRACKSDIALOG_HRH
+
+// ENUMS
+enum TMPXAddTracksDialogCommandIds
+    {
+    EMPXCmdAddTracksExpand = 0x5000,
+    EMPXCmdAddTracksCollapse,
+    EMPXCmdAddTracksAdd,
+    EMPXCmdAddTracksDone,
+    EMPXCmdAddTracksFindCancel
+    };
+
+enum TMPXAddTracksDialogCurrentOp
+    {
+    EMPXOpIdle,
+    EMPXOpGetCategory,
+    EMPXOpGetAllSongs,
+    EMPXOpGetSongs
+    };
+
+#endif  // MPXADDTRACKSDIALOG_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/inc/mpxaddtracksdialogcommon.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common defines and data types for add tracks dialog
+*
+*/
+
+
+#ifndef MPXADDTRACKSDIALOGCOMMON_H
+#define MPXADDTRACKSDIALOGCOMMON_H
+
+_LIT( KMPXAddTracksBmpFile, "mpxaddtracksdialog.mbm" );
+
+#endif  // MPXADDTRACKSDIALOGCOMMON_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/inc/mpxaddtrackslbxarray.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listbox array for add tracks dialog.
+*
+*/
+
+
+#ifndef C_CMPXADDTRACKSLBXARRAY_H
+#define C_CMPXADDTRACKSLBXARRAY_H
+
+// FORWARD DECLARATIONS
+class CGulIcon;
+class CAknIconArray;
+class CMPXAddTracksListModel;
+
+// CLASS DECLARATION
+
+/**
+*  Listbox array for add tracks dialog.
+*  Creates item text descriptors according to the list model.
+*/
+NONSHARABLE_CLASS( CMPXAddTracksLbxArray ) : public CBase,
+                                             public MDesCArray
+    {
+public:
+
+    // Listbox icons
+    enum TMPXATLbxIcons
+        {
+        EMPXATLbxIconTrackExpand = 0,
+        EMPXATLbxIconTrackCollapse,
+        EMPXATLbxIconArtistExpand,
+        EMPXATLbxIconArtistCollapse,
+        EMPXATLbxIconEmpty,
+        EMPXATLbxIconSongAddedAnim1,
+        EMPXATLbxIconSongAddedAnim2,
+        EMPXATLbxIconSongAddedAnim3,
+        EMPXATLbxIconSongAddedAnim4,
+        EMPXATLbxIconMMC,
+        EMPXATLbxIconsCount
+        };
+
+public:  // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     * @param aModel List model of Add tracks dialog.
+     * @return A pointer to a newly created object
+     */
+    static CMPXAddTracksLbxArray* NewL(
+        CMPXAddTracksListModel* aModel );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXAddTracksLbxArray();
+
+public: // New functions
+
+    /**
+     * Creates new icon array. Ownership is transferred to caller.
+     * @return New icon array.
+     */
+    CArrayPtr<CGulIcon>* CreateIconArrayL();
+
+public: // Functions from base classes
+
+    /**
+     * From MDesCArray, returns the number of descriptor elements
+     * in a descriptor
+     * @return The number of descriptor elements in a descriptor array.
+     */
+    TInt MdcaCount() const;
+
+    /**
+     * From MDesCArray, indexes into a descriptor array.
+     * @param aIndex The position of the descriptor element within a descriptor array.
+     * @return Descriptor element located at position aIndex within a descriptor array
+     */
+    TPtrC MdcaPoint( TInt aIndex ) const;
+
+private: // Constructors
+
+    /**
+     * C++ default constructor.
+     * @param aModel List model of Add tracks dialog.
+     */
+    CMPXAddTracksLbxArray(
+        CMPXAddTracksListModel* aModel );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private: // New functions
+
+    /**
+     * Load an icon and append it to an icon array.
+     * @param aArray    pointer to the icon array
+     * @param aID       skin id of the icon
+     * @param aColorId  Item ID of the color table.
+     * @param aColorIndex Index in the color table.
+     * @param aMbmFile  path to the mbm/mif file containing the icon
+     * @param aBitmapId mbm id of the bitmap
+     * @param aMaskId   mbm id of the mask
+     */
+    void AppendColorIconToArrayL(
+        CAknIconArray* aArray,
+        const TAknsItemID& aID,
+        const TAknsItemID& aColorId,
+        TInt aColorIndex,
+        const TDesC& aMbmFile,
+        TInt aBitmapId,
+        TInt aMaskId );
+
+private:    // Data
+
+    CMPXAddTracksListModel*  iModel; // Not owned
+    HBufC* iItem;
+    };
+
+#endif  // C_CMPXADDTRACKSLBXARRAY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/inc/mpxaddtrackslistmodel.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,233 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  A list model for add tracks dialog
+*
+*/
+
+
+#ifndef C_CMPXADDTRACKSLISTMODEL_H
+#define C_CMPXADDTRACKSLISTMODEL_H
+
+// INCLUDES
+#include <mpxcollectionpath.h>  // TMPXItemId
+
+// CLASS DECLARATION
+class MDesCArray;
+class CMPXMedia;
+class CMPXMediaArray;
+
+/**
+*  List model for add tracks dialog.
+*  Keep track of list item .
+*/
+NONSHARABLE_CLASS( CMPXAddTracksListModel ) : public CBase
+    {
+public:  // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     * @return A pointer to a newly created object
+     */
+    static CMPXAddTracksListModel* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXAddTracksListModel();
+
+public: // New functions
+
+    /**
+     * Reset tracks list.
+     */
+    void ResetTracksList();
+
+    /**
+     * Return track name.
+     * @param aIndex Track's index.
+     * @return Track name.
+     */
+    const TDesC& TrackName( TInt aIndex ) const;
+
+    /**
+     * Return track type.
+     * @param aIndex Track's index.
+     * @return Track type.
+     */
+    TInt TrackTypeL( TInt aIndex ) const;
+
+    /**
+     * Return track Category.
+     * @param aIndex Track's index.
+     * @return Track category.
+     */
+    TInt TrackCategoryL( TInt aIndex ) const;
+
+    /**
+     * Return track id.
+     * @param aIndex Track's index.
+     * @return Track id.
+     */
+    TMPXItemId TrackIdL( TInt aIndex ) const;
+
+    /**
+     * Return media at a given index
+     *
+     * @param aIndex index to get
+     */
+    const CMPXMedia& MediaL( TInt aIndex ) const;
+
+    /**
+     * Return number of tracks stored in the list.
+     * @return Number of tracks stored in the list.
+     */
+    TInt TracksListCount() const;
+
+    /**
+     * Insert groups at aPos of the tracks list.
+     * @param aMedia media array containing the track info.
+     * @param aPos Index for the groups to be added to. Ignore this field
+     *             if groups are appended to the end of the list.
+     * @param aCategory category of the group could be either EMPXSong or EMPXArtist
+     */
+    void InsertGroupsL( CMPXMediaArray& aMedia, TInt aPos = -1 , TInt aCategory = EMPXArtist);
+
+    /**
+     * Insert tracks under the current group.
+     * @param aTrack track with song ids.
+     * @param aIndex Index to insert.
+     */
+    void InsertTrackL( CMPXMedia& aTrack, TInt aIndex );
+
+    /**
+     * Insert tracks under the current group. Update the expanded array too.
+     * @param aTracks List of tracks with song ids.
+     * @param aIndex Index of the group.
+     */
+    void InsertTracksUnderGroupL(
+        CMPXMediaArray& aTracks,
+        TInt aIndex );
+
+    /**
+     * Remove all tracks under group.
+     * @param aIndex Index of the group which tracks will be removed.
+     * @return Number of tracks removed.
+     */
+    TInt RemoveAllTracksFromGroupL( TInt aIndex );
+
+    /**
+     * Remove tracks .
+     * @param aIndex Index of the track which will be removed.
+     */
+    void RemoveTracks( TInt aIndex );
+
+    /**
+     * Return expanded groups count.
+     * @return Expanded groups count.
+     */
+    TInt ExpandedGroupsCount() const;
+
+    /**
+     * Check if the index is expanded or not.
+     * @param aIndex Listbox index.
+     * @return ETrue if aIndex is expanded. Otherwise, EFalse.
+     */
+    TBool IsExpandedIndex( TInt aIndex ) const;
+
+    /**
+     * Mark the current index as expanded.
+     * @param aIndex Index to be marked as expanded.
+     * @param aCount Number of tracks added.
+     */
+    void MarkExpandedL( TInt aIndex, TInt aCount );
+
+    /**
+     * Clear the current index as collapsed.
+     * @param aIndex Index to be removed from the expanded array.
+     * @param aCount Number of tracks removed.
+     */
+    void UnMarkExpanded( TInt aIndex, TInt aCount );
+
+    /**
+     * Return the oldest expanded group index.
+     * @return The oldest expanded group index.
+     */
+    TInt OldestExpandedGroupIndex();
+
+    /**
+     * Return the closest expanded group index.
+     * @param aIndex Current index
+     * @return Closest expanded group index if found. Otherwise, KErrNotFound.
+     */
+    TInt ClosestExpandedGroupIdx( TInt aIndex );
+
+    /**
+     * Return animation icon index for highlight item.
+     * @param aIndex current highlight index number.
+     * @return highlight item's aniamtion icon's index, KErrNotFound.
+     */
+    TInt AnimationIconNum( TInt aIndex );
+
+    /**
+     * Set animation icon index number.
+     * @param aIndex current highlight index number
+     * @param aAnimIconNum current animation icon index
+     */
+    void SetAnimationIconNum( TInt aIndex, TInt aAnimIconNum );
+
+    /**
+     * There are mathed songs, it means Songs(All) node is shown.
+     * @return ETrue if there are matched songs,
+     *         EFalse if there is not.
+     */
+    TBool FindSongs();
+
+    /**
+     * Set flag to indicate if there are mathed songs.
+     * @param aFindSongs if there are songs matched
+     */
+    void SetFindSongsFlag( TBool aFindSongs );
+
+    /**
+     * determines if the current item is on removable drive
+     *
+     * @param aIndex current highlight index number
+     * @return ETrue if on removable drive, EFalse otherwise
+     */
+    TBool IsOnRemovableDrive( TInt aIndex );
+
+private: // Constructors
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXAddTracksListModel();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private:    // Data
+    CMPXMediaArray*                     iTracksList;
+    RArray<TInt>                        iExpandedIndices;
+    TInt                                iCurrentHighlightIndex; // Current highlite item
+    TInt                                iAnimIconNum;           // animation icon number
+    TBool                               iFindSongs;             // Find songs flag
+    TInt iMMCDrive;
+    };
+
+#endif  // C_CMPXADDTRACKSLISTMODEL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/loc/mpxaddtracksdialog.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxaddtracksdialog
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+// LOCALISATION STRINGS
+
+// d:Title for Add songs view
+// l:title_pane_t2/opt9
+// r:3.1
+//
+#define qtn_nmp_title_add_songs     "Add Songs"
+
+// d:Text shown in Add song view when there are no songs to display.
+// l:main_list_empty_pane
+// r:3.1
+//
+#define qtn_nmp_no_addsongsview_editor   "(no matches)"
+
+// d:List item for adding all songs in add songs view.
+// l:list_single_graphic_pane_t1_cp2
+// r:3.1
+//
+#define qtn_nmp_addsongs_allsongs   "Songs (all)"
+
+// d:Command text associated to the left softkey in the control pane.
+// d:Show a list of tracks that belong to the active category.
+// l:control_pane_t1/opt7
+// r:3.1
+//
+#define qtn_nmp_softkey_expand  "Expand"
+
+// d:Command text associated to the left softkey in the control pane.
+// d:Hide the list of tracks that belong to the active category.
+// l:control_pane_t1/opt7
+// r:3.1
+//
+#define qtn_nmp_softkey_collapse  "Collapse"
+
+// d:Command text associated to the left softkey in the control pane.
+// d:Add the highlighted track to the playlist.
+// l:control_pane_t1/opt7
+// r:3.1
+//
+#define qtn_nmp_softkey_add   "Add"
+
+// d:Text in navi pane.
+// d:Displayed when a track is added in the add songs view.
+// l:navi_text_pane_t1
+// r:3.1
+//
+#define qtn_nmp_addsongs_song_added     "Song added"
+
+// d:List item for adding found songs in add songs view.
+// l:list_single_graphic_pane_t1_cp2
+// r:3.1
+//
+#define qtn_nmp_addsongs_num_songs  "Songs (%N)"
+
+// d:Unknown in listbox.
+// l:list_single_graphic_pane_t1
+// r:3.1
+//
+#define qtn_mp_list_unknown "Unknown"
+
+// d:Text for wait note for opening
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_nmp_note_opening "Opening"
+
+// d:Text shown in Category view when there are no songs to display.
+// l:main_list_empty_pane
+// r:3.1
+//
+#define qtn_nmp_no_songs_editor   "(no songs)"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/src/mpxaddtracksdialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1795 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of mpxaddtracksdialogimp
+*
+*/
+
+
+// INCLUDE FILES
+#include <eikclb.h>
+#include <eikclbd.h>
+#include <eikimage.h>
+#include <eiktxlbx.h>
+#include <aknappui.h>
+#include <aknnavi.h>
+#include <aknnavide.h>
+#include <akntitle.h>
+#include <akncontext.h>
+#include <aknlists.h>
+#include <aknsfld.h>
+#include <gulicon.h>
+#include <AknIconArray.h>
+#include <AknIconUtils.h>
+#include <StringLoader.h>
+#include <aknnotewrappers.h>
+#include <e32base.h>
+#include <barsread.h>
+#include <bautils.h>
+#include <aknnavilabel.h>
+#include <data_caging_path_literals.hrh>
+#include <textresolver.h>
+
+#include <mpxlog.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxaddtracksdialog.rsg>
+#include <mpxaddtracksdialog.mbg>
+
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmedia.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaarray.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxuser.h>
+
+#include "mpxcommonuihelper.h"
+#include "mpxaddtracksdialogcommon.h"
+#include "mpxaddtracksdialog.hrh"
+#include "mpxaddtracksdialog.h"
+#include "mpxaddtrackslistmodel.h"
+#include "mpxaddtrackslbxarray.h"
+#include <mpxlbxextendedfeatures.h>
+
+// CONSTANTS
+const TInt KMPXATMaxExpandedGroupNum = 1;
+
+// Animation timer defined in UI spec
+const TInt KAnimationFrame1Timer = 50000;
+const TInt KAnimationFrame2Timer = 100000;
+const TInt KAnimationFrame3Timer = 100000;
+const TInt KAnimationFrame4Timer = 500000;
+const TInt KAnimationFrameTimerInterval = 1;
+
+const TInt KMaxTitleLength = 261;  // 255 + 6 for tab
+
+_LIT( KMPXAddTracksDialogRscPath, "mpxaddtracksdialog.rsc" );
+_LIT(KMPXSpace," ");
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXAddTracksDialog* CMPXAddTracksDialog::NewL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::NewL" );
+    CMPXAddTracksDialog* self = CMPXAddTracksDialog::NewLC();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXAddTracksDialog* CMPXAddTracksDialog::NewLC()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::NewLC" );
+    CMPXAddTracksDialog* self = new ( ELeave ) CMPXAddTracksDialog();
+    CleanupStack::PushL( self );
+    self->LoadResourceL();
+    self->ConstructL( R_AVKON_SOFTKEYS_EMPTY );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXAddTracksDialog::~CMPXAddTracksDialog()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::~CMPXAddTracksDialog" );
+
+    TRAP_IGNORE( RestorePreviousStatusPaneL() );
+
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+    if ( iCollectionUiHelper )
+        {
+        iCollectionUiHelper->Close();
+        }
+    if ( iOrigIcon )
+        {
+        delete iOrigIcon;
+        }
+    if ( iNewIcon )
+        {
+        delete iNewIcon;
+        }
+    if ( iLastFindTxt )
+        {
+        delete iLastFindTxt;
+        }
+    iMatchedSongArray.Reset();
+    iMatchedGroupArray.Reset();
+
+    delete iNaviDecorator;
+    delete iOrigTitle;
+    delete iNaviLabelPane;
+    delete iListModel;
+    delete iNoSongText;
+    delete iNoMatchText;
+
+    if( iPeriodic )
+        {
+        delete iPeriodic;
+        }
+    delete iLbxExtFeat;
+
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+
+    if ( iCategoryArray )
+        {
+        iCategoryArray->Reset();
+        delete iCategoryArray;
+        }
+
+    if ( iAllSongsArray )
+        {
+        iAllSongsArray->Reset();
+        delete iAllSongsArray;
+        }
+
+    delete iCommonUiHelper;
+    delete iIdle;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::CMPXAddTracksDialog
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXAddTracksDialog::CMPXAddTracksDialog():
+    CAknSelectionListDialog( iLastIndex, NULL, 0 ),
+    iAnimIconIndex( 0 ),
+    iSongAllGroupExist( ETrue )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::ConstructL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::ConstructL( TInt aResource )
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::ConstructL" );
+    CAknSelectionListDialog::ConstructL( aResource );
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
+    iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+    iCommonUiHelper = CMPXCommonUiHelper::NewL();
+    iNoSongText = StringLoader::LoadL( R_MPX_CUI_CATEGORY_ADDSONGVIEW_LBX_NOSONGTEXT );
+    iNoMatchText = StringLoader::LoadL( R_MPX_CUI_CATEGORY_ADDSONGVIEW_LBX_EMPTYTEXT );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::BackupPreviousStatusPaneL()
+// Backup previous status pane to internal members.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::BackupPreviousStatusPaneL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::BackupPreviousStatusPaneL" );
+    CEikStatusPane* sp = iAvkonAppUi->StatusPane();
+
+    // Backup navi pane
+    iNaviPane = static_cast<CAknNavigationControlContainer*>
+        ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
+    iOrigNaviPane = iNaviPane->Top();
+
+    iNaviPane->PushDefaultL();
+
+    // Backup title pane
+    iTitlePane = static_cast<CAknTitlePane*>
+        ( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+    iOrigTitle = iTitlePane->Text()->AllocL();
+
+    // Backup context pane only if new context icon is created
+    if ( iNewIcon )
+        {
+        iContextPane = static_cast<CAknContextPane*>
+            ( sp->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ) );
+        iOrigIcon = iContextPane->SwapPicture( iNewIcon );
+        iNewIcon = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::RestorePreviousStatusPaneL()
+// Restore previous status pane from internal members.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::RestorePreviousStatusPaneL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::RestorePreviousStatusPaneL" );
+    if ( iOrigTitle )
+        {
+        // Set original title pane
+        iTitlePane->SetTextL( *iOrigTitle );
+        }
+
+    // Set original navi pane
+    iNaviPane->Pop( iNaviLabelPane );
+    if ( iOrigNaviPane )
+        {
+        iNaviPane->PushL( *iOrigNaviPane );
+        }
+    else
+        {
+        iNaviPane->PushDefaultL();
+        }
+
+    // Restore original context icon
+    if ( iOrigIcon )
+        {
+        iNewIcon = iContextPane->SwapPicture( iOrigIcon );
+        iOrigIcon = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::CreateContextIconL()
+// Create context icon for add tracks dialog.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::CreateContextIconL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::CreateContextIconL" );
+    TParse parse;
+    parse.Set( KMPXAddTracksBmpFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC(
+            skin,
+            KAknsIIDNone,
+            bitmap,
+            mask,
+            iconFile,
+            EMbmMpxaddtracksdialogQgn_graf_mup_ctx_addsong,
+            EMbmMpxaddtracksdialogQgn_graf_mup_ctx_addsong_mask );
+
+    iNewIcon = new ( ELeave ) CEikImage();
+    iNewIcon->SetPicture( bitmap, mask );
+    iNewIcon->SetPictureOwnedExternally( EFalse );
+
+    CleanupStack::Pop( 2 ); // bitmap, mask
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::UpdateSoftkeyL()
+// Update softkey.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::UpdateSoftkeyL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::UpdateSoftkeyL" );
+    TInt resId( 0 );
+    TInt index = CurrentLbxItemIndex();
+    CAknSearchField* findBox = FindBox();
+    TBool findBoxVisible = ( findBox->IsVisible() ) && ( findBox->IsFocused() );
+
+    MPX_DEBUG2( "CMPXAddTracksDialog::UpdateSoftkeyL index = %d", index);
+
+    iListBox->View()->SetListEmptyTextL(
+        findBoxVisible? *iNoMatchText : *iNoSongText );
+    if ( iListBox->Model()->NumberOfItems() == 0 )
+        {
+        // redraw empty text
+        iListBox->DrawDeferred();
+        }
+
+    if ( index == KErrNotFound )
+        {
+        resId = R_MPX_CUI_ADDTRACKS_SOFTKEYS_EMPTY_DONE;
+        if ( findBoxVisible )
+            {
+            resId = R_MPX_CUI_ADDTRACKS_SOFTKEYS_EMPTY_CANCEL;
+            }
+        }
+    else
+        {
+        TInt id = iListModel->TrackTypeL( index );
+        if ( id == EMPXGroup )
+            {
+            resId = R_MPX_CUI_ADDTRACKS_SOFTKEYS_EXPAND_DONE;
+            if ( findBoxVisible )
+                {
+                resId = R_MPX_CUI_ADDTRACKS_SOFTKEYS_EXPAND_CANCEL;
+                }
+            if ( iListModel->IsExpandedIndex( index ) )
+                {
+                resId = R_MPX_CUI_ADDTRACKS_SOFTKEYS_COLLAPSE_DONE;
+                if ( findBoxVisible )
+                    {
+                    resId = R_MPX_CUI_ADDTRACKS_SOFTKEYS_COLLAPSE_CANCEL;
+                    }
+                }
+            }
+        else
+            {
+            resId = R_MPX_CUI_ADDTRACKS_SOFTKEYS_ADD_DONE;
+            if ( findBoxVisible )
+                {
+                resId = R_MPX_CUI_ADDTRACKS_SOFTKEYS_ADD_CANCEL;
+                }
+            }
+        }
+    ButtonGroupContainer().SetCommandSetL( resId );
+    
+    // A temporary RSK command observer is registered so that FindBox 
+    // cannot register its own RSK command observer. This way it will
+    // not handle the RSK but the ProcessCommandL method in this dialog
+    // will do it. The observer must not be removed, because if there 
+    // is no observer registered when the find box is closed, then 
+    // the execution of CAknSearchField::RestorePopupCBA will raise a
+    // panic.
+   	if( !ButtonGroupContainer().UpdatedCommandObserverExists( 
+		CEikButtonGroupContainer::ERightSoftkeyPosition ) )
+   		{
+   		MPX_DEBUG1( "CMPXAddTracksDialog::UpdateSoftkeyL: Adding RSK observer" );
+   		ButtonGroupContainer().UpdateCommandObserverL( 2, *this );
+   		}
+    ButtonGroupContainer().DrawDeferred();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::UpdateListboxByCategoryL()
+// Update listbox content by category.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::UpdateListboxByCategoryL( const CMPXMedia& aMedia  )
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::UpdateListboxByCategoryL" );
+    // Reset tracks list
+    iListModel->ResetTracksList();
+
+    // Insert "Songs (all)" to model
+    CMPXMediaArray* media =
+        const_cast<CMPXMediaArray*>(aMedia.Value<CMPXMediaArray>(
+        KMPXMediaArrayContents ) );
+    User::LeaveIfNull( media );
+
+    delete iCategoryArray;
+    iCategoryArray = NULL;
+    iCategoryArray = CMPXMediaArray::NewL();
+    TInt count = media->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        CMPXMedia* orig( media->AtL( i ) );
+        User::LeaveIfNull( orig );
+        CMPXMedia* copy( CMPXMedia::NewL( *orig ) );
+        CleanupStack::PushL( copy );
+        iCategoryArray->AppendL( copy );
+        CleanupStack::Pop( copy );
+        }
+    if ( count > 0 )
+        {
+        // change display text to unknown if the last entry is null
+        CMPXMedia* aryMedia( media->AtL( count - 1 ) );
+        User::LeaveIfNull( aryMedia );
+        if ( aryMedia->ValueText( KMPXMediaGeneralTitle ).Length() == 0 )
+            {
+            HBufC* text = StringLoader::LoadLC(
+                R_MPX_QTN_MP_UNKNOWN );
+            CMPXMedia* catMedia( iCategoryArray->AtL( count - 1 ) );
+            User::LeaveIfNull( catMedia );
+            catMedia->SetTextValueL( KMPXMediaGeneralTitle, *text );
+            aryMedia->SetTextValueL( KMPXMediaGeneralTitle, *text );
+            CleanupStack::PopAndDestroy( text );
+            }
+        CMPXMedia* entry = CMPXMedia::NewL();
+        CleanupStack::PushL( entry );
+        HBufC* string =
+            StringLoader::LoadLC( R_MPX_CUI_ADDSONGS_ADD_ALLSONGS_TXT );
+        entry->SetTextValueL(
+            KMPXMediaGeneralTitle, *string );
+        media->Insert( entry, 0 );
+        CleanupStack::PopAndDestroy( string );
+        CleanupStack::Pop( entry );
+        // Insert artists to model
+        iListModel->InsertGroupsL( *media, -1, EMPXSong );
+        HandleItemArrayChangeL();
+        iSongAllGroupExist = ETrue;
+        }
+    else
+        {
+        MPX_DEBUG1( "CMPXAddTracksDialog::UpdateListboxByCategoryL no song" );
+        // no song
+        iSongAllGroupExist = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::UpdateListboxByCategoryforFindL()
+// Update listbox content by category after find.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::UpdateListboxByCategoryforFindL(
+    TBool aFind, TInt aSongNum)
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::UpdateListboxByCategoryforFindL" );
+    if( aFind )
+        {
+        if( aSongNum != 0 )
+            {
+            // Insert "Songs (%N)" to list box model, change "%N" to matched songs' number
+            CMPXMediaArray* media = CMPXMediaArray::NewL();
+            CleanupStack::PushL( media );
+            CMPXMedia* entry = CMPXMedia::NewL();
+            CleanupStack::PushL( entry );
+            HBufC* string = string = StringLoader::LoadLC(
+                            R_MPX_CUI_ADDSONGS_ADD_SONGS_NUM_TXT, aSongNum );
+            entry->SetTextValueL( KMPXMediaGeneralTitle, *string );
+            media->AppendL( entry );
+            iListModel->InsertGroupsL( *media, 0, EMPXSong );
+            CleanupStack::PopAndDestroy( string );
+            CleanupStack::Pop( entry );
+            CleanupStack::PopAndDestroy( media );
+            iSongAllGroupExist = ETrue;
+            }
+        else
+            {
+            iSongAllGroupExist = EFalse;
+            }
+
+        // Insert found groups
+        TInt matchedGroupCount = iMatchedGroupArray.Count();
+        if( matchedGroupCount > 0 )
+            {
+            CMPXMediaArray* media = CMPXMediaArray::NewL();
+            CleanupStack::PushL( media );
+            for ( TInt i = 0; i < matchedGroupCount; i++ )
+                {
+                TInt catIndex = iMatchedGroupArray[ i ];
+                CMPXMedia* catMedia( iCategoryArray->AtL( catIndex ) );
+                User::LeaveIfNull( catMedia );
+                CMPXMedia* entry = CMPXMedia::NewL( *catMedia  );
+                CleanupStack::PushL( entry );
+                media->AppendL( entry );
+                CleanupStack::Pop( entry );
+                }
+            if( !iSongAllGroupExist )
+                {
+                iListModel->InsertGroupsL( *media, 0 );
+                }
+            else
+                {
+                iListModel->InsertGroupsL( *media, 1 );
+                }
+            CleanupStack::PopAndDestroy( media );
+            }
+        }
+    else
+        {
+        iListModel->ResetTracksList();
+        }
+
+    HandleItemArrayChangeL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::CurrentLbxItemIndex
+// Gets current listbox item index.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksDialog::CurrentLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::CurrentLbxItemIndex" );
+    CTextListBoxModel* lbxModel = iListBox->Model();
+    CAknSearchField* findBox = FindBox();
+    TInt currentItem = iListBox->CurrentItemIndex();
+    TInt count = lbxModel->NumberOfItems();
+
+    // Make sure there's at least one item in the listbox
+    if ( findBox && count )
+        {
+        CAknFilteredTextListBoxModel* filteredLbxModel =
+            static_cast<CAknFilteredTextListBoxModel*>( lbxModel );
+        CAknListBoxFilterItems* filterItems = filteredLbxModel->Filter();
+
+        // Get the real listbox index
+        currentItem = filterItems->FilteredItemIndex( currentItem );
+        }
+    return currentItem;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::CurrentListItemCount
+// Return number of listbox items shown in the current listbox.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksDialog::CurrentListItemCount() const
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::CurrentListItemCount" );
+    CTextListBoxModel* lbxModel = iListBox->Model();
+    TInt count = lbxModel->NumberOfItems();
+    CAknSearchField* findBox = FindBox();
+
+    if ( findBox && count )
+        {
+        CAknFilteredTextListBoxModel* filteredLbxModel =
+            static_cast<CAknFilteredTextListBoxModel*>( lbxModel );
+        CAknListBoxFilterItems* filterItems = filteredLbxModel->Filter();
+
+        count = filterItems->FilteredNumberOfItems();
+        }
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::HandleItemArrayChangeL
+// When you change the list item array you should call this method.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::HandleItemArrayChangeL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::HandleItemArrayChangeL" );
+    TInt currentIdx = iListBox->CurrentItemIndex();
+    TInt topIdx = iListBox->TopItemIndex();
+    CListBoxView* lbxView = iListBox->View();
+    TInt offset =
+        lbxView->NumberOfItemsThatFitInRect( lbxView->ViewRect() ) - 1;
+
+    CAknFilteredTextListBoxModel* lbxModel =
+        static_cast<CAknFilteredTextListBoxModel*>( iListBox->Model() );
+    CAknSearchField* tempSearchField =
+        static_cast<CAknSearchField*>( lbxModel->Filter()->FindBox() );
+    lbxModel->Filter()->SetSearchField( NULL );//for find the items
+    // Update item array
+    iLbxFilterItems->HandleItemArrayChangeL();
+    lbxModel->Filter()->SetSearchField( tempSearchField );// for laylout of list
+
+    TInt itemCount = CurrentListItemCount();
+    if ( itemCount )
+        {
+        TInt lastItemIdx = itemCount - 1;
+        if ( topIdx + offset > lastItemIdx )
+            {
+            topIdx = lastItemIdx - offset;
+            }
+        if ( topIdx < 0 )
+            {
+            topIdx = 0;
+            }
+        if ( currentIdx < 0 )
+            {
+            currentIdx = 0;
+            }
+        if ( currentIdx > lastItemIdx )
+            {
+            currentIdx = lastItemIdx;
+            }
+
+        iListBox->SetTopItemIndex( topIdx );
+        iListBox->SetCurrentItemIndexAndDraw( currentIdx );
+        iListBox->DrawDeferred();
+        }
+    UpdateSoftkeyL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::HighlightListItem
+// Highlight list item.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::HighlightListItem( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::HighlightListItem" );
+    const TInt KMPItemOffset = 1;
+    TInt itemCount = CurrentListItemCount();
+
+    if ( itemCount )
+        {
+        TInt bottomIdx = iListBox->BottomItemIndex();
+        TInt topIdx = iListBox->TopItemIndex();
+
+        // Rearrange the index if aIndex is the bottom item
+        if ( aIndex == bottomIdx )
+            {
+            TInt lastItemIdx = itemCount - 1;
+            if ( aIndex != lastItemIdx )
+                {
+                topIdx += KMPItemOffset;
+                if ( topIdx > lastItemIdx )
+                    {
+                    topIdx = lastItemIdx;
+                    }
+                }
+            }
+
+        if ( topIdx < 0 )
+            {
+            topIdx = 0;
+            }
+
+        iListBox->SetTopItemIndex( topIdx );
+        iListBox->SetCurrentItemIndexAndDraw( aIndex );
+        iListBox->DrawDeferred();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::ExpandCurrentGroupL()
+// Expand current group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::ExpandCurrentGroupL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::ExpandCurrentGroupL" );
+    TInt index = -1;
+    if ( iExpandAllSongs )
+        {
+        index = EMPXAddTracksAddAllSongs;
+        }
+    else
+        {
+        index = CurrentLbxItemIndex();
+        }
+    TInt oldIndex = index;
+
+    // Make sure current item is expandable
+    if ( ( index != KErrNotFound ) &&
+        ( iListModel->TrackTypeL( index ) == EMPXGroup ) &&
+        ( !iListModel->IsExpandedIndex( index ) ) )
+        {
+        // Make sure the expanded group count is
+        // under KMPXATMaxExpandedGroupNum.
+        while ( iListModel->ExpandedGroupsCount() >=
+                KMPXATMaxExpandedGroupNum )
+            {
+            // Remove all tracks from the oldest expanded group
+            oldIndex = iListModel->OldestExpandedGroupIndex();
+            TInt count = iListModel->RemoveAllTracksFromGroupL( oldIndex );
+            // Update the index accordingly
+            if ( index > oldIndex )
+                {
+                index -= count;
+                }
+            }
+
+        if ( index == EMPXAddTracksAddAllSongs && iSongAllGroupExist )
+            {
+            if ( iAllSongsArray )
+                {
+                // Insert tracks for all songs
+                iExpandAllSongs = EFalse;
+                TInt matchedSongCount = iMatchedSongArray.Count();
+                if ( matchedSongCount == 0 )
+                    {
+                    iListModel->InsertTracksUnderGroupL( *iAllSongsArray, index );
+                    TInt diff = oldIndex - index;
+                    TInt newCurrentIdx = iListBox->CurrentItemIndex() - diff;
+                    if ( newCurrentIdx < 0 )
+                        {
+                        newCurrentIdx = 0;
+                        }
+                    TInt newTopIdx = iListBox->TopItemIndex() - diff;
+                    if ( newTopIdx < 0 )
+                        {
+                        newTopIdx = 0;
+                        }
+                    iListBox->SetTopItemIndex( newTopIdx );
+                    iListBox->SetCurrentItemIndex( newCurrentIdx );
+                    }
+                else
+                    {
+                    TInt matchedSongCount = iMatchedSongArray.Count();
+                    for ( TInt i = 0; i < matchedSongCount; i++ )
+                        {
+                        TInt songIndex = iMatchedSongArray[ i ];
+                        CMPXMedia* origMedia( iAllSongsArray->AtL( songIndex ) );
+                        User::LeaveIfNull( origMedia );
+                        iListModel->InsertTrackL( *origMedia, index + 1 + i );
+                        }
+                    iListModel->MarkExpandedL( index, matchedSongCount );
+                    }
+                HandleItemArrayChangeL();
+                HighlightListItem( index );
+                UpdateSoftkeyL();
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXAddTracksDialog::ExpandCurrentGroupL all songs NOT READY" );
+                iExpandAllSongs = ETrue;
+                HBufC* string = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_NOTE_OPENING );
+                iCommonUiHelper->ShowWaitNoteL( *string,
+                    R_AVKON_SOFTKEYS_EMPTY, EFalse, NULL );
+                CleanupStack::PopAndDestroy( string );
+                }
+            }
+        else
+            {
+            if ( iCurrentOp == EMPXOpIdle )
+                {
+                HandleItemArrayChangeL();
+                HBufC* string = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_NOTE_OPENING );
+                iCommonUiHelper->ShowWaitNoteL( *string,
+                    R_AVKON_SOFTKEYS_EMPTY, EFalse, NULL );
+                CleanupStack::PopAndDestroy( string );
+                CMPXMedia* media = CMPXMedia::NewL();
+                CleanupStack::PushL( media );
+                media->SetTObjectValueL<TMPXGeneralType>(
+                    KMPXMediaGeneralType, EMPXGroup );
+                media->SetTObjectValueL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory, EMPXSong );
+                media->SetTObjectValueL<TMPXItemId>(
+                    KMPXMediaGeneralId, iListModel->TrackIdL( index ) );
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL( attrs );
+                attrs.Append(
+                    TMPXAttribute( KMPXMediaIdGeneral,
+                        EMPXMediaGeneralTitle | EMPXMediaGeneralId
+                        | EMPXMediaGeneralType |  EMPXMediaGeneralCategory |
+                        EMPXMediaGeneralFlags ) );
+                iCurrentOp = EMPXOpGetSongs;
+                iCurrentGroupIndex = index;
+                iCollectionUtility->Collection().FindAllL( *media, attrs.Array(), *this );
+                CleanupStack::PopAndDestroy( &attrs );
+                CleanupStack::PopAndDestroy( media );
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXAddTracksDialog::ExpandCurrentGroupL find all busy, ignoring" );
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::GotoClosestGroupL()
+// Goto the closest group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::GotoClosestGroupL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::GotoClosestGroupL" );
+    // Get the closest expanded index
+    TInt origIndex = CurrentLbxItemIndex();
+    if ( origIndex != KErrNotFound )
+        {
+        TInt index = iListModel->ClosestExpandedGroupIdx( origIndex );
+        if ( index != KErrNotFound )
+            {
+            // Highlight on the group
+            HighlightListItem( index );
+
+            UpdateSoftkeyL();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::CollapseCurrentGroupL()
+// Collapse current group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::CollapseCurrentGroupL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::CollapseCurrentGroupL" );
+    TInt index = CurrentLbxItemIndex();
+
+    if ( ( index != KErrNotFound ) &&
+        ( iListModel->IsExpandedIndex( index ) ) )
+        {
+        // Remove all tracks from this group
+        iListModel->RemoveAllTracksFromGroupL( index );
+
+        // Update listbox and softkey
+        HandleItemArrayChangeL();
+        HighlightListItem( index );
+        UpdateSoftkeyL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::AddCurrentTrackToPlaylistL()
+// Add current track to playlist.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::AddCurrentTrackToPlaylistL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::AddCurrentTrackToPlaylistL" );
+    TInt index = CurrentLbxItemIndex();
+    iSelectIndex = index;
+
+    if ( index != KErrNotFound && iPlaylistId != 0 )
+        {
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL( media );
+        media->SetTObjectValueL<TMPXItemId>(
+            KMPXMediaGeneralId, iPlaylistId );
+        media->SetTObjectValueL<TMPXGeneralType>(
+            KMPXMediaGeneralType, EMPXItem );
+        media->SetTObjectValueL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory, EMPXPlaylist );
+
+        CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
+        CleanupStack::PushL( mediaArray );
+        CMPXMedia* song = CMPXMedia::NewL( iListModel->MediaL( index ) );
+        CleanupStack::PushL( song );
+        mediaArray->AppendL( song );
+        CleanupStack::Pop( song );
+        media->SetCObjectValueL( KMPXMediaArrayContents, mediaArray );
+        media->SetTObjectValueL( KMPXMediaArrayCount, 1 );
+        iCollectionUiHelper->AddL( *media, this );
+        CleanupStack::PopAndDestroy( 2, media );
+
+        // Enable animation
+        // Animation icon index is 3 -> 5
+        iAnimIconIndex = CMPXAddTracksLbxArray::EMPXATLbxIconSongAddedAnim1;
+        iListModel->SetAnimationIconNum( iSelectIndex, iAnimIconIndex );
+        HighlightListItem( iSelectIndex );
+
+        // first icon animation
+        if ( iPeriodic->IsActive() )
+            {
+            iPeriodic->Cancel();
+            }
+        iPeriodic->Start( TTimeIntervalMicroSeconds32(KAnimationFrame1Timer),
+                            TTimeIntervalMicroSeconds32(KAnimationFrameTimerInterval),
+                            TCallBack( AnimExpireL, this ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::DoFindL
+// Execute find for group and songs.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::DoFindL( void )
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::DoFindL" );
+
+    if ( !iAllSongsArray )
+        {
+        iDoFind = ETrue;
+        HBufC* string = StringLoader::LoadLC(
+            R_MPX_QTN_NMP_NOTE_OPENING );
+        iCommonUiHelper->ShowWaitNoteL( *string,
+            R_AVKON_SOFTKEYS_EMPTY, EFalse, NULL );
+        CleanupStack::PopAndDestroy( string );
+        return;
+        }
+
+    // reset all group to default state
+    iListModel->ResetTracksList();
+
+    iMatchedSongArray.Reset();
+    iMatchedGroupArray.Reset();
+
+    // start find
+    TInt searchTextNum = iLastFindTxt->Length();
+    TInt songAllMatchedNum = 0;
+
+    TBufC<KMaxTitleLength> bufSearchText;
+    TPtr searchText = bufSearchText.Des();
+    TBufC<KMaxTitleLength> bufSearchTextwithSpace;
+    TPtr searchTextwithSpace = bufSearchTextwithSpace.Des();
+    TBool find = EFalse;
+
+
+    // Reset find result
+    iListModel->SetFindSongsFlag( EFalse );
+    // current searching is to compare the text string with list box text
+    // if they are match, means found;otherwise, not found
+    // searching way can be changed if needed
+    if( searchTextNum != 0 )
+        {
+        TInt listCount = iCategoryArray->Count();
+        for( TInt i = 0; i < listCount; i ++ )
+            {
+            CMPXMedia* media( iCategoryArray->AtL( i ) );
+            User::LeaveIfNull( media );
+            const TDesC& constTitle = media->ValueText(
+                KMPXMediaGeneralTitle );
+            TBufC<KMaxTitleLength> titleBuf( constTitle );
+            TPtr title = titleBuf.Des();
+            searchText = iLastFindTxt->Left( searchTextNum );
+
+            title.LowerCase();
+            searchText.LowerCase();
+
+            if( title.Find( KMPXSpace ) != KErrNotFound )
+                {
+                searchTextwithSpace = searchText;
+                // insert space if there is not, to make every search same
+                searchTextwithSpace.Insert( 0, KMPXSpace );
+                }
+
+            // find way: match first several characters, if there is space in the
+            // middle of the track name, match the string also after the space
+            if ( ( ( searchTextwithSpace.Length() > 0 ) &&
+                ( title.Find( searchTextwithSpace ) != KErrNotFound ) ) ||
+                ( title.Left( searchTextNum ) == searchText ) )
+                {
+                iMatchedGroupArray.Append( i );
+                find = ETrue;
+                }
+            }
+
+        TInt songCount = iAllSongsArray->Count();
+        for ( TInt i = 0; i < songCount; i++ )
+            {
+            CMPXMedia* media( iAllSongsArray->AtL( i ) );
+            User::LeaveIfNull( media );
+            const TDesC& constTitle = media->ValueText(
+                KMPXMediaGeneralTitle );
+            TBufC<KMaxTitleLength> titleBuf( constTitle );
+            TPtr title = titleBuf.Des();
+            searchText = iLastFindTxt->Left( searchTextNum );
+
+            title.LowerCase();
+            searchText.LowerCase();
+
+            if( title.Find( KMPXSpace ) != KErrNotFound )
+                {
+                searchTextwithSpace = searchText;
+                // insert space if there is not, to make every search same
+                searchTextwithSpace.Insert( 0, KMPXSpace );
+                }
+
+            // find way: match first several characters, if there is space in the
+            // middle of the track name, match the string also after the space
+            if ( ( ( searchTextwithSpace.Length() > 0 ) &&
+                ( title.Find( searchTextwithSpace ) != KErrNotFound ) ) ||
+                ( title.Left( searchTextNum ) == searchText ) )
+                {
+                // matched songs
+                songAllMatchedNum ++;
+                iMatchedSongArray.Append( i );
+                find = ETrue;
+                iListModel->SetFindSongsFlag( ETrue );
+                }
+            }
+        // update according to searching result
+        UpdateListboxByCategoryforFindL( find, songAllMatchedNum );
+        }
+    else if ( iAllSongsArray->Count() > 0 )
+        {
+        // Songs(All) node is shown
+        iListModel->SetFindSongsFlag( ETrue );
+        CMPXMediaArray* media = CMPXMediaArray::NewL();
+        CleanupStack::PushL( media );
+        CMPXMedia* entry = CMPXMedia::NewL();
+        CleanupStack::PushL( entry );
+        HBufC* string =
+            StringLoader::LoadLC( R_MPX_CUI_ADDSONGS_ADD_ALLSONGS_TXT );
+        entry->SetTextValueL( KMPXMediaGeneralTitle, *string );
+        media->Insert( entry, 0 );
+        CleanupStack::PopAndDestroy( string );
+        CleanupStack::Pop( entry );
+        iListModel->InsertGroupsL( *media, 0, EMPXSong );
+        iListModel->InsertGroupsL( *iCategoryArray, 1 );
+        CleanupStack::PopAndDestroy( media );
+        iSongAllGroupExist = ETrue;
+        HandleItemArrayChangeL();
+        }
+
+    // Always highlight the first item
+    HighlightListItem( 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::DoAnimL
+// Execute animation.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::DoAnimL(void)
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::DoAnimL" );
+    iPeriodic->Cancel();
+
+    // remove animation icon
+    if( iAnimIconIndex ==
+            CMPXAddTracksLbxArray::EMPXATLbxIconSongAddedAnim4 )
+        {
+        return;
+        }
+    iAnimIconIndex ++;
+    iListModel->SetAnimationIconNum( iSelectIndex, iAnimIconIndex );
+    HighlightListItem(iSelectIndex);
+
+    TTimeIntervalMicroSeconds32 interval = 0;
+    if( iAnimIconIndex ==
+                CMPXAddTracksLbxArray::EMPXATLbxIconSongAddedAnim2 )
+        {
+        interval = KAnimationFrame2Timer;
+        }
+    else if(iAnimIconIndex ==
+                CMPXAddTracksLbxArray::EMPXATLbxIconSongAddedAnim3 )
+        {
+        interval = KAnimationFrame3Timer;
+        }
+    else if(iAnimIconIndex ==
+                CMPXAddTracksLbxArray::EMPXATLbxIconSongAddedAnim4 )
+        {
+        interval = KAnimationFrame4Timer;
+        }
+    iPeriodic->Start( interval,
+                    TTimeIntervalMicroSeconds32(KAnimationFrameTimerInterval ),
+                    TCallBack( AnimExpireL, this ) );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::AnimExpireL
+// Animation call back method.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksDialog::AnimExpireL( TAny* aObject )
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::AnimExpireL" );
+    ( ( CMPXAddTracksDialog* )( aObject ) )->DoAnimL();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::StopAnimL
+// Stop animation.
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::StopAnimL()
+    {
+    if( ( iPeriodic->IsActive() ||
+        iAnimIconIndex ==
+            CMPXAddTracksLbxArray::EMPXATLbxIconSongAddedAnim4 ) )
+        {
+        iAnimIconIndex = 0;
+        iPeriodic->Cancel();
+        iListModel->SetAnimationIconNum( iSelectIndex, 0 );
+        HighlightListItem( iSelectIndex );
+        // restore origional navi pane text
+        iNaviPane->Pop( iNaviLabelPane );
+        iNaviPane->PushDefaultL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// load resources
+// ---------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::LoadResourceL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::LoadResourceL" );
+    CCoeEnv* coeEnv = iEikonEnv;
+    TParse parse;
+    parse.Set( KMPXAddTracksDialogRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+    }
+
+// ---------------------------------------------------------------------------
+// start find categories
+// ---------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::LoadCategoriesL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::LoadCategoriesL" );
+    CMPXMedia* media = CMPXMedia::NewL();
+    CleanupStack::PushL( media );
+    media->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXGroup );
+    media->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, EMPXArtist );
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    attrs.Append(
+        TMPXAttribute( KMPXMediaIdGeneral,
+            EMPXMediaGeneralTitle | EMPXMediaGeneralId
+            | EMPXMediaGeneralType |  EMPXMediaGeneralCategory |
+            EMPXMediaGeneralFlags ) );
+    iCurrentOp = EMPXOpGetCategory;
+    iCollectionUtility->Collection().FindAllL( *media, attrs.Array(), *this );
+    CleanupStack::PopAndDestroy( &attrs );
+    CleanupStack::PopAndDestroy( media );
+    }
+
+// -----------------------------------------------------------------------------
+// Handle collection message
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::DoHandleCollectionMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::DoHandleCollectionMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        if( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) ==
+            TMPXCollectionMessage::EBroadcastEvent )
+            {
+            TInt op( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+            if ( op == EMcMsgUSBMTPEnd || op == EMcMsgRefreshEnd || op == EMcMsgUSBMassStorageEnd )
+                {
+                MPX_DEBUG1( "CMPXAddTracksDialog::DoHandleCollectionMessageL Library updated, reloading" );
+                // library updated, reload
+                LoadCategoriesL();
+                }
+            else if ( op == EMcMsgDiskRemoved )
+                {
+                // since collection view can't close this dialog due to CMPXCollectionViewImp::DoIncrementalOpenL
+                // later, schedule the dialog to be closed by itself
+                iIdle = CIdle::NewL( CActive::EPriorityStandard );
+                iIdle->Start( TCallBack( CMPXAddTracksDialog::DeferredExitCallback, this ) );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection message
+// ---------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::HandleCollectionMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d a folder
+// ---------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::HandleOpenL(
+    const CMPXMedia& /*aEntries*/,
+    TInt /*aIndex*/,
+    TBool /*aComplete*/,
+    TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d an item. Client typically responds by
+// 'playing' the item
+// ---------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::HandleOpenL(
+    const CMPXCollectionPlaylist& /*aPlaylist*/,
+    TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection media
+// ---------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::HandleCollectionMediaL(
+    const CMPXMedia& aMedia, TInt aError)
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::HandleCollectionMediaL" );
+
+    if ( aError == KErrNone )
+        {
+        iPlaylistId = aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+        MPX_DEBUG2( "CMPXAddTracksDialog::HandleCollectionMediaL playlist ID = 0x%x", iPlaylistId.iId1 );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionFindObserver
+// Handle callback for "find" operation
+// ---------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::HandleFindAllL(
+    const CMPXMedia& aResults, TBool /*aComplete*/, TInt aError )
+    {
+    MPX_DEBUG2( "-->CMPXAddTracksDialog::HandleFindAllL aError = %d", aError );
+
+    if ( aError == KErrNone )
+        {
+        switch ( iCurrentOp )
+            {
+            case EMPXOpGetCategory:
+                {
+                UpdateListboxByCategoryL( aResults );
+                CMPXMedia* media = CMPXMedia::NewL();
+                CleanupStack::PushL( media );
+                media->SetTObjectValueL<TMPXGeneralType>(
+                    KMPXMediaGeneralType, EMPXGroup );
+                media->SetTObjectValueL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory, EMPXSong );
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL( attrs );
+                attrs.Append(
+                    TMPXAttribute( KMPXMediaIdGeneral,
+                        EMPXMediaGeneralTitle | EMPXMediaGeneralId
+                        | EMPXMediaGeneralType |  EMPXMediaGeneralCategory
+                        | EMPXMediaGeneralFlags ) );
+                iCurrentOp = EMPXOpGetAllSongs;
+                iCollectionUtility->Collection().FindAllL( *media, attrs.Array(), *this );
+                CleanupStack::PopAndDestroy( &attrs );
+                CleanupStack::PopAndDestroy( media );
+                break;
+                }
+            case EMPXOpGetAllSongs:
+                {
+                delete iAllSongsArray;
+                iAllSongsArray = NULL;
+                CMPXMediaArray* mediaAry(
+                    const_cast<CMPXMediaArray*>( aResults.Value<CMPXMediaArray>(
+                        KMPXMediaArrayContents ) ) );
+                User::LeaveIfNull( mediaAry );
+                iAllSongsArray = CMPXMediaArray::NewL( *mediaAry );
+                iCurrentOp = EMPXOpIdle;
+                if ( iExpandAllSongs )
+                    {
+                    iCommonUiHelper->DismissWaitNoteL();
+                    iDoFind = EFalse;
+                    ExpandCurrentGroupL();
+                    }
+                else if ( iDoFind )
+                    {
+                    iCommonUiHelper->DismissWaitNoteL();
+                    iDoFind = EFalse;
+                    DoFindL();
+                    }
+                break;
+                }
+            case EMPXOpGetSongs:
+                {
+                CMPXMediaArray* media =
+                    const_cast<CMPXMediaArray*>(aResults.Value<CMPXMediaArray>(
+                        KMPXMediaArrayContents ) );
+                User::LeaveIfNull( media );
+                iListModel->InsertTracksUnderGroupL( *media, iCurrentGroupIndex );
+
+                TInt diff = iListModel->OldestExpandedGroupIndex() - iCurrentGroupIndex;
+                TInt newCurrentIdx = iListBox->CurrentItemIndex() - diff;
+                if ( newCurrentIdx < 0 )
+                    {
+                    newCurrentIdx = 0;
+                    }
+                TInt newTopIdx = iListBox->TopItemIndex() - diff;
+                if ( newTopIdx < 0 )
+                    {
+                    newTopIdx = 0;
+                    }
+                iListBox->SetTopItemIndex( newTopIdx );
+                iListBox->SetCurrentItemIndex( newCurrentIdx );
+                HandleItemArrayChangeL();
+                HighlightListItem( iCurrentGroupIndex );
+                UpdateSoftkeyL();
+                iCurrentOp = EMPXOpIdle;
+                iCommonUiHelper->DismissWaitNoteL();
+                break;
+                }
+            default:
+                {
+                iCurrentOp = EMPXOpIdle;
+                break;
+                }
+            }
+        }
+    MPX_DEBUG1( "<--CMPXAddTracksDialog::HandleFindAllL" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCHelperObserver
+// Handles the completion of adding a playlist event
+// ---------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::HandleOperationCompleteL( TCHelperOperation /*aOperation*/,
+                                                    TInt aError,
+                                                    void* aArgument )
+    {
+    MPX_DEBUG2("-->CMPXAddTracksDialog::HandleOperationCompleteL error = %d", aError);
+    if ( aError != KErrNone )
+        {
+        StopAnimL();
+        // Fix for err EJKG-7CFD89 & EJKG-7DZGGL 
+        if (aError != KErrNotReady && aError != KErrArgument )
+            {
+            iCommonUiHelper->HandleErrorL( aError );
+            }
+        }
+    else
+        {
+        // Song added text display in navi pane
+        iNaviPane->PushL( *iNaviDecorator );
+        }
+    CMPXMedia* media = (CMPXMedia*) aArgument;
+    delete media;
+    MPX_DEBUG1("<--CMPXAddTracksDialog::HandleOperationCompleteL");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::PreLayoutDynInitL()
+// Prepare for layout.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::PreLayoutDynInitL()
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::PreLayoutDynInitL" );
+    // Create context icon
+    CreateContextIconL();
+
+    // Backup previous status pane
+    BackupPreviousStatusPaneL();
+
+    // Set new title pane
+    HBufC* title = StringLoader::LoadLC( R_MPX_CUI_ADDSONGS_TITLE );
+    iTitlePane->SetTextL( *title );
+    CleanupStack::PopAndDestroy( title );
+
+    // Set find type
+    CAknSelectionListDialog::PreLayoutDynInitL();
+
+    // Setup listbox content
+    iListBox = static_cast<CEikTextListBox*>( Control( ESelectionListControl ) );
+    CAknFilteredTextListBoxModel*
+    lbxModel = static_cast<CAknFilteredTextListBoxModel*>( iListBox->Model() );
+    iLbxFilterItems = lbxModel->Filter();
+
+    // Initialize last find text
+    iLastFindTxt = HBufC::NewL( 0 );
+
+    // Create tracks list model & listbox array
+    iListModel = CMPXAddTracksListModel::NewL();
+    CMPXAddTracksLbxArray* lbxArray = CMPXAddTracksLbxArray::NewL( iListModel );
+
+    // Set item array to listbox model, transfer ownership
+    CTextListBoxModel* listboxModel = iListBox->Model();
+    listboxModel->SetItemTextArray( lbxArray );
+    listboxModel->SetOwnershipType( ELbmOwnsItemArray );
+
+    // Create and set icon array. Ownership transferred.
+    CArrayPtr<CGulIcon>* icons = lbxArray->CreateIconArrayL();
+    SetIconArrayL( icons );
+
+    // Set scrollbar
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
+                                                        CEikScrollBarFrame::EAuto );
+
+    // Enable Marquee
+    static_cast<CEikColumnListBox*>( iListBox )->EnableExtendedDrawingL();
+    static_cast<CEikColumnListBox*>( iListBox )->ItemDrawer()->
+                                                ColumnData()->EnableMarqueeL( ETrue );
+
+    // Enable speed scrolling
+    iLbxExtFeat = CMPXLbxExtendedFeatures::NewL( iListBox, EFalse );
+    iLbxExtFeat->EnableSpeedScrollL( ETrue );
+
+    CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
+    iNaviPane = static_cast<CAknNavigationControlContainer*>
+                ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
+    // read the navigation pane text resource
+    HBufC* text = StringLoader::LoadLC( R_MPX_CUI_ADDSONGS_SONG_ADDED );
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL( *text );
+    CleanupStack::PopAndDestroy( text );
+
+    // Animation icon timer
+    iPeriodic = CPeriodic::NewL( CActive::EPriorityIdle );
+
+    // Set empty text
+    iListBox->View()->SetListEmptyTextL( *iNoSongText );
+    iListModel->SetFindSongsFlag( ETrue );
+
+    // get current playlist ID
+    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL( cpath );
+    cpath->Back();
+    MPX_DEBUG_PATH( *cpath );
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL(attrs);
+    attrs.Append( KMPXMediaGeneralId );
+    iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+    CleanupStack::PopAndDestroy( &attrs );
+    CleanupStack::PopAndDestroy( cpath );
+
+    // Update listbox
+    LoadCategoriesL();
+
+    // Update softkey
+    UpdateSoftkeyL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::OkToExitL
+// Check if it's ok to exit.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAddTracksDialog::OkToExitL( TInt aButtonId )
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::OkToExitL" );
+    MPX_DEBUG2( "CMPXAddTracksDialog::OkToExitL aButtonId = 0x%x", aButtonId );
+    TBool retVal = EFalse;
+
+    switch (aButtonId)
+        {
+        case EMPXCmdAddTracksExpand:
+            {
+            ExpandCurrentGroupL();
+            break;
+            }
+        case EMPXCmdAddTracksCollapse:
+            {
+            CollapseCurrentGroupL();
+            break;
+            }
+        case EMPXCmdAddTracksAdd:
+            {
+            // Add track to the playlist
+            AddCurrentTrackToPlaylistL();
+            break;
+            }
+        case EMPXCmdAddTracksDone:
+            {
+            retVal = ETrue;
+            break;
+            }
+        case EMPXCmdAddTracksFindCancel:
+            {
+            CAknSearchField* findBox = FindBox();
+            findBox->MakeVisible( EFalse );
+            findBox->SetFocus( EFalse );
+            TRAP_IGNORE( findBox->ResetL() );
+            iListBox->SetFocus( ETrue );
+            
+            TRect mainPane;
+            AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
+            SetSizeAndPosition( mainPane.Size() );
+            break;
+            }
+        default:
+            {
+            retVal = CAknSelectionListDialog::OkToExitL( aButtonId );
+            break;
+            }
+        }
+
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::OfferKeyEventL
+// Handles key-events.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CMPXAddTracksDialog::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::OfferKeyEventL" );
+    TKeyResponse res = EKeyWasNotConsumed;
+    TBool updateCBA = EFalse;
+    CAknSearchField* findbox = FindBox();
+
+    if ( aType == EEventKey )
+        {
+        StopAnimL();
+
+        switch ( aKeyEvent.iCode )
+            {
+            case EKeyUpArrow:
+            case EKeyDownArrow:
+                {
+                updateCBA = ETrue;
+                break;
+                }
+            case EKeyLeftArrow:
+                {
+                TInt index = CurrentLbxItemIndex();
+                if ( index != KErrNotFound )
+                    {
+                    if ( iListModel->TrackTypeL( index ) != EMPXGroup )
+                        {
+                        GotoClosestGroupL();
+                        }
+                    else
+                        {
+                        CollapseCurrentGroupL();
+                        }
+                    }
+                res = EKeyWasConsumed;
+                break;
+                }
+            case EKeyRightArrow:
+                {
+                ExpandCurrentGroupL();
+                res = EKeyWasConsumed;
+                break;
+                }
+            case EKeyOK:
+            case EKeyEnter:
+                {
+                // Do the right thing on right item
+                TInt index = CurrentLbxItemIndex();
+                if ( index != KErrNotFound )
+                    {
+                    if ( iListModel->TrackTypeL( index ) == EMPXGroup )
+                        {
+                        if ( iListModel->IsExpandedIndex( index ) )
+                            {
+                            CollapseCurrentGroupL();
+                            }
+                        else
+                            {
+                            ExpandCurrentGroupL();
+                            }
+                        }
+                    else
+                        {
+                        AddCurrentTrackToPlaylistL();
+                        }
+                    }
+                res = EKeyWasConsumed;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    TBool offerEventToBaseClass( EFalse );
+
+    if ( res == EKeyWasNotConsumed )
+        {
+        if ( ( aKeyEvent.iCode == EKeyUpArrow ) ||
+            ( aKeyEvent.iScanCode == EStdKeyUpArrow ) ||
+            ( aKeyEvent.iCode == EKeyDownArrow ) ||
+            ( aKeyEvent.iScanCode == EStdKeyDownArrow ) )
+            {
+            res = iLbxExtFeat->HandleLbxKeyEventL( aKeyEvent, aType );
+            }
+        // handle right soft key
+        else if( findbox->IsVisible() &&
+            ( aKeyEvent.iCode == EKeyDevice1 ||
+              aKeyEvent.iScanCode == EStdKeyDevice1 ) )
+            {
+            StopAnimL();
+            res = EKeyWasConsumed;
+            }
+        else
+            {
+            if ( findbox )
+                {
+                TName text;
+                findbox->GetSearchText( text );
+                updateCBA = ETrue;
+                if ( *iLastFindTxt != text )
+                    {
+                    // Update CBA if find text is changed
+                    delete iLastFindTxt;
+                    iLastFindTxt = NULL;
+                    iLastFindTxt = text.AllocL();
+                    DoFindL();
+                    }
+                if ( iLastFindTxt->Length() == 0 && aKeyEvent.iCode == EKeyBackspace )
+                    {
+                    CAknSearchField* findBox = FindBox();
+                    findBox->MakeVisible( EFalse );
+                    findBox->SetFocus( EFalse );
+                    TRAP_IGNORE( findBox->ResetL() );
+                    iListBox->SetFocus( ETrue );
+                    
+                    TRect mainPane;
+                    AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, mainPane );
+                    SetSizeAndPosition( mainPane.Size() );
+                    res = EKeyWasConsumed;
+                    }
+                else
+                    {
+                    offerEventToBaseClass = ETrue;
+                    }
+                }
+            else
+                {
+                offerEventToBaseClass = ETrue;
+                }
+            }
+        }
+    if ( updateCBA )
+        {
+        UpdateSoftkeyL();
+        }
+    if ( offerEventToBaseClass )
+        {
+        // this has to be done after cba is updated
+        res = CAknSelectionListDialog::OfferKeyEventL( aKeyEvent, aType );
+        }
+    return res;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::HandleResourceChange( TInt aType )
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::HandleResourceChange" );
+    CAknSelectionListDialog::HandleResourceChange( aType );
+
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        TRect rect;
+        AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, rect );
+        SetRect( rect );
+        }
+
+    if ( aType == KAknsMessageSkinChange )
+        {
+        // Create and set icon array. Ownership transferred.
+        CTextListBoxModel* listboxModel = iListBox->Model();
+        MDesCArray* lbxArray = listboxModel->ItemTextArray();
+        CMPXAddTracksLbxArray* addtracksLbxArray =
+            static_cast<CMPXAddTracksLbxArray*>( lbxArray );
+        TRAP_IGNORE(
+            CArrayPtr<CGulIcon>* icons = addtracksLbxArray->CreateIconArrayL();
+            SetIconArrayL( icons );
+            );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikListBoxObserver
+// Handles listbox events.
+// ---------------------------------------------------------------------------
+//
+void CMPXAddTracksDialog::HandleListBoxEventL(
+    CEikListBox* /*aListBox*/,
+    TListBoxEvent aEventType)
+    {
+    MPX_FUNC( "CMPXAddTracksDialog::HandleListBoxEventL" );
+    StopAnimL();
+    if ( aEventType == EEventEnterKeyPressed || aEventType == EEventItemDoubleClicked
+#ifdef SINGLE_CLICK_INCLUDED
+         || aEventType == EEventItemSingleClicked
+#endif
+        )
+        {
+		// Do the right thing on right item
+		TInt index = CurrentLbxItemIndex();
+		if ( index != KErrNotFound )
+			{
+			if ( iListModel->TrackTypeL( index ) == EMPXGroup )
+				{
+				if ( iListModel->IsExpandedIndex( index ) )
+					{
+					CollapseCurrentGroupL();
+					}
+				else
+					{
+					ExpandCurrentGroupL();
+					}
+				}
+			else
+				{
+				AddCurrentTrackToPlaylistL();
+				}
+			}
+        }
+    else
+	    {
+	    iNaviPane->PushDefaultL();
+        UpdateSoftkeyL();
+	    }
+    }
+
+// ---------------------------------------------------------------------------
+// Function called by CIdle to close the dialog itself when collection view
+// can not handle the closing of dialog due to waitnote displayed by
+// CMPXCollectionViewImp::DoIncrementalOpenL
+// ---------------------------------------------------------------------------
+//
+TInt CMPXAddTracksDialog::DeferredExitCallback( TAny* aPtr )
+    { 
+    MPX_DEBUG1( "CMPXAddTracksDialog::DeferredExitCallback" );  
+    CMPXAddTracksDialog* self = 
+        static_cast<CMPXAddTracksDialog*>( aPtr );
+    TRAP_IGNORE( self->TryExitL( EMPXCmdAddTracksDone ) );
+    return KErrNone;
+    }
+
+// ProcessCommandL has been implemented here for the sole
+// of handling RSK command when findbox is shown. For other
+// cases it goes along the same path that is used by hardware
+// keys, e.g. by call to TryToExitL.
+void CMPXAddTracksDialog::ProcessCommandL( TInt aCommandId )
+	{
+	CAknSelectionListDialog::ProcessCommandL( aCommandId );
+	TryExitL( aCommandId );
+	
+	// Check that the dialog is not being closed
+	if( aCommandId != EMPXCmdAddTracksDone )
+		{
+		// Reset view so that all songs are shown
+		TName text;
+		CAknSearchField* findbox = FindBox();
+		if( findbox )
+			{
+			findbox->GetSearchText( text );
+			delete iLastFindTxt;
+			iLastFindTxt = NULL;
+			iLastFindTxt = text.AllocL();
+			DoFindL();
+			HandleItemArrayChangeL();
+			}
+		}
+	}
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/src/mpxaddtrackslbxarray.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,356 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listbox array for add tracks dialog
+*
+*/
+
+
+// INCLUDE FILES
+#include <AknsSkinInstance.h>
+#include <gulicon.h>
+#include <AknIconArray.h>
+#include <AknUtils.h>
+#include <AknsUtils.h>
+
+#include <data_caging_path_literals.hrh>
+#include <mpxaddtracksdialog.mbg>
+#include <mpxlog.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxuser.h>
+
+#include "mpxaddtracksdialog.hrh"
+#include "mpxaddtracksdialogcommon.h"
+#include "mpxaddtrackslistmodel.h"
+#include "mpxaddtrackslbxarray.h"
+
+// CONSTANTS
+const TInt KMPXLbxIconsCount =
+    CMPXAddTracksLbxArray::EMPXATLbxIconsCount;
+
+const TInt KMaxTitleLength = 261;  // 255 + 6 for tab
+_LIT( KMPXTab, "\t" );
+_LIT( KMPXIndent, "  " );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksLbxArray::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMPXAddTracksLbxArray* CMPXAddTracksLbxArray::NewL(
+    CMPXAddTracksListModel* aModel )
+    {
+    MPX_FUNC( "CMPXAddTracksLbxArray::NewL" );
+    CMPXAddTracksLbxArray* self =
+        new (ELeave) CMPXAddTracksLbxArray( aModel );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CMPXAddTracksLbxArray::~CMPXAddTracksLbxArray()
+    {
+    MPX_DEBUG1( "CMPXAddTracksLbxArray::~CMPXAddTracksLbxArray START" );
+    delete iItem;
+    MPX_DEBUG1( "CMPXAddTracksLbxArray::~CMPXAddTracksLbxArray END" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksLbxArray::CreateIconArrayL
+// Create listbox icons array.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CArrayPtr<CGulIcon>* CMPXAddTracksLbxArray::CreateIconArrayL()
+    {
+    MPX_FUNC( "CMPXAddTracksLbxArray::CreateIconArrayL" );
+    TParse parse;
+    parse.Set( KMPXAddTracksBmpFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    CAknIconArray* icons = new ( ELeave ) CAknIconArray( KMPXLbxIconsCount );
+    CleanupStack::PushL(icons);
+
+    // Create expand icon
+    AppendColorIconToArrayL(
+        icons,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxaddtracksdialogQgn_graf_mup_lst_expd_track,
+        EMbmMpxaddtracksdialogQgn_graf_mup_lst_expd_track_mask );
+
+    // Create collapse icon
+    AppendColorIconToArrayL(
+        icons,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxaddtracksdialogQgn_graf_mup_lst_colpsd_track,
+        EMbmMpxaddtracksdialogQgn_graf_mup_lst_colpsd_track_mask );
+
+    // Create expand icon
+    AppendColorIconToArrayL(
+        icons,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxaddtracksdialogQgn_graf_mup_lst_expd_artist,
+        EMbmMpxaddtracksdialogQgn_graf_mup_lst_expd_artist_mask );
+
+    // Create collapse icon
+    AppendColorIconToArrayL(
+        icons,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxaddtracksdialogQgn_graf_mup_lst_colpsd_artist,
+        EMbmMpxaddtracksdialogQgn_graf_mup_lst_colpsd_artist_mask );
+
+    // Create empty icon
+    AppendColorIconToArrayL(
+        icons,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxaddtracksdialogQgn_graf_mup_lst_empty,
+        EMbmMpxaddtracksdialogQgn_graf_mup_lst_empty_mask );
+
+    // Create selection confirm animation icon 1
+    AppendColorIconToArrayL(
+        icons,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG13,
+        iconFile,
+        EMbmMpxaddtracksdialogQgn_graf_mup_adtl_chmrk_fr01,
+        EMbmMpxaddtracksdialogQgn_graf_mup_adtl_chmrk_fr01_mask );
+
+    // Create selection confirm animation icon 2
+    AppendColorIconToArrayL(
+        icons,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG13,
+        iconFile,
+        EMbmMpxaddtracksdialogQgn_graf_mup_adtl_chmrk_fr02,
+        EMbmMpxaddtracksdialogQgn_graf_mup_adtl_chmrk_fr02_mask );
+
+    // Create selection confirm animation icon 3
+    AppendColorIconToArrayL(
+        icons,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG13,
+        iconFile,
+        EMbmMpxaddtracksdialogQgn_graf_mup_adtl_chmrk_fr03,
+        EMbmMpxaddtracksdialogQgn_graf_mup_adtl_chmrk_fr03_mask );
+
+    // Create selection confirm animation icon 4
+    AppendColorIconToArrayL(
+        icons,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG13,
+        iconFile,
+        EMbmMpxaddtracksdialogQgn_graf_mup_adtl_chmrk_fr04,
+        EMbmMpxaddtracksdialogQgn_graf_mup_adtl_chmrk_fr04_mask );
+
+    // Create icon for MMC
+    AppendColorIconToArrayL(
+        icons,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG13,
+        iconFile,
+        EMbmMpxaddtracksdialogQgn_indi_mmc_add,
+        EMbmMpxaddtracksdialogQgn_indi_mmc_add_mask );
+
+    CleanupStack::Pop( icons );
+
+    return icons;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksLbxArray::MdcaCount
+// Returns the number of descriptor elements in a descriptor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksLbxArray::MdcaCount() const
+    {
+    MPX_FUNC( "CMPXAddTracksLbxArray::MdcaCount" );
+    return iModel->TracksListCount();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksLbxArray::MdcaPoint
+// Indexes into a descriptor array.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TPtrC CMPXAddTracksLbxArray::MdcaPoint( TInt aIndex ) const
+    {
+    //MPX_FUNC( "CMPXAddTracksLbxArray::MdcaPoint" );
+    TPtrC item;
+
+    TPtr ptr = iItem->Des();
+    ptr.Zero();
+
+    TInt iconIndex;
+    TBool indent = EFalse;
+    TInt trackType = EMPXNoType;
+    MPX_TRAPD( error, trackType = iModel->TrackTypeL( aIndex ) );
+
+    if ( error == KErrNone && trackType == EMPXGroup )
+        {
+        TInt category = EMPXSong;
+        TRAP_IGNORE( category = iModel->TrackCategoryL(aIndex));
+        if ( aIndex == 0 && category != EMPXArtist)
+            {
+            iconIndex = EMPXATLbxIconTrackExpand;
+            if ( iModel->IsExpandedIndex( aIndex ) )
+                {
+                iconIndex = EMPXATLbxIconTrackCollapse;
+                }
+            }
+        else
+            {
+            iconIndex = EMPXATLbxIconArtistExpand;
+            if ( iModel->IsExpandedIndex( aIndex ) )
+                {
+                iconIndex = EMPXATLbxIconArtistCollapse;
+                }
+            }
+        }
+    else
+        {
+        // Indent if tracks
+        iconIndex = EMPXATLbxIconEmpty;
+        indent = ETrue;
+        }
+
+    ptr.AppendNum( iconIndex );
+    ptr.Append( KMPXTab );
+    if ( indent )
+        {
+        ptr.Append( KMPXIndent );
+        }
+    ptr.Append( iModel->TrackName( aIndex ) );
+
+    TInt animIconIndex = iModel->AnimationIconNum( aIndex );
+    if(animIconIndex != 0)
+        {
+        ptr.Append( KMPXTab );
+        ptr.AppendNum( animIconIndex );
+        }
+
+    TBool isRemovable( EFalse );
+    isRemovable = iModel->IsOnRemovableDrive( aIndex );
+    if ( isRemovable )
+        {
+        ptr.Append( KMPXTab );
+        ptr.AppendNum( EMPXATLbxIconMMC );
+        }
+
+    item.Set( *iItem );
+    return item;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksLbxArray::CMPXAddTracksLbxArray
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXAddTracksLbxArray::CMPXAddTracksLbxArray(
+    CMPXAddTracksListModel* aModel ) :
+    iModel( aModel )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksLbxArray::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksLbxArray::ConstructL()
+    {
+    MPX_FUNC( "CMPXAddTracksLbxArray::ConstructL" );
+    // iItem length cannot be defined dynamically as MdcaPoint is const function
+    iItem = HBufC::NewL( KMaxTitleLength ) ;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksLbxArray::AppendIconToArrayL
+// Load icon (with mask) and append it to an icon array.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksLbxArray::AppendColorIconToArrayL(
+    CAknIconArray* aArray,
+    const TAknsItemID& aID,
+    const TAknsItemID& aColorId,
+    TInt aColorIndex,
+    const TDesC& aMbmFile,
+    TInt aBitmapId,
+    TInt aMaskId )
+    {
+    MPX_FUNC( "CMPXAddTracksLbxArray::AppendColorIconToArrayL" );
+    __ASSERT_DEBUG( aArray != NULL,
+        User::Panic( _L( "AppendColorIconToArrayL" ), KErrArgument ) );
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    if ( aColorId == KAknsIIDNone )
+        {
+        // do not use theme color, use the default color from the file
+        AknsUtils::CreateIconLC( skin, aID,
+            bitmap, mask, aMbmFile, aBitmapId, aMaskId );
+        }
+    else
+        {
+        // use theme color
+        AknsUtils::CreateColorIconLC( skin, aID, aColorId, aColorIndex,
+            bitmap, mask, aMbmFile, aBitmapId, aMaskId, KRgbBlack );
+        }
+
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+    icon->SetBitmapsOwnedExternally(EFalse);
+    CleanupStack::Pop( 2 ); // bitmap, mask
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL( icon );
+    aArray->AppendL( icon );
+    CleanupStack::Pop( icon );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/addtracksdialog/src/mpxaddtrackslistmodel.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,545 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  A list model for add tracks dialog
+*
+*/
+
+
+// INCLUDE FILES
+#include <bamdesca.h>
+#include <badesca.h>
+#include <f32file.h>
+
+#include <mpxlog.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxcommonuihelper.h>
+
+#include "mpxaddtracksdialog.hrh"
+#include "mpxaddtrackslistmodel.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMPXAddTracksListModel* CMPXAddTracksListModel::NewL()
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::NewL" );
+    CMPXAddTracksListModel* self =
+        new (ELeave) CMPXAddTracksListModel();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::CMPXAddTracksListModel
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXAddTracksListModel::CMPXAddTracksListModel()
+    :iCurrentHighlightIndex(0),
+    iFindSongs( EFalse )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksListModel::ConstructL()
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::ConstructL" );
+    iTracksList = CMPXMediaArray::NewL();
+    iMMCDrive = CMPXCommonUiHelper::MMCDriveNumber();
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CMPXAddTracksListModel::~CMPXAddTracksListModel()
+    {
+    MPX_DEBUG1( "CMPXAddTracksListModel::~CMPXAddTracksListModel START" );
+    if ( iTracksList )
+        {
+        iTracksList->Reset();
+        delete iTracksList;
+        }
+    iExpandedIndices.Reset();
+    iExpandedIndices.Close();
+    MPX_DEBUG1( "CMPXAddTracksListModel::~CMPXAddTracksListModel END" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::ResetTracksList
+// Reset tracks list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksListModel::ResetTracksList()
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::ResetTracksList" );
+    iTracksList->Reset();
+    iExpandedIndices.Reset();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::TrackName
+// Return track name.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const TDesC& CMPXAddTracksListModel::TrackName( TInt aIndex ) const
+    {
+    //MPX_FUNC( "CMPXAddTracksListModel::TrackName" );
+    CMPXMedia* item( NULL );
+    TInt count( iTracksList->Count() );
+    if ( count > 0 && aIndex < count )
+        {
+        TRAP_IGNORE( item = iTracksList->AtL( aIndex ) );
+        }
+    return item ? item->ValueText( KMPXMediaGeneralTitle ) : KNullDesC;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::TrackTypeL
+// Return track type.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksListModel::TrackTypeL( TInt aIndex ) const
+    {
+    //MPX_FUNC( "CMPXAddTracksListModel::TrackTypeL" );
+    CMPXMedia* item( NULL );
+    TInt count( iTracksList->Count() );
+    if ( count > 0 && aIndex < count )
+        {
+        item = iTracksList->AtL( aIndex );
+        User::LeaveIfNull( item );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    return *item->Value<TMPXGeneralType>( KMPXMediaGeneralType );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::TrackCategoryL
+// Return track Category.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksListModel::TrackCategoryL( TInt aIndex ) const
+    {
+    //MPX_FUNC( "CMPXAddTracksListModel::TrackCategoryL" );
+    CMPXMedia* item( NULL );
+    TInt count( iTracksList->Count() );
+    if ( count > 0 && aIndex < count )
+        {
+        item = iTracksList->AtL( aIndex );
+        User::LeaveIfNull( item );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    return *item->Value<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::TrackIdL
+// Return track id.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TMPXItemId CMPXAddTracksListModel::TrackIdL( TInt aIndex ) const
+    {
+    //MPX_FUNC( "CMPXAddTracksListModel::TrackIdL" );
+    CMPXMedia* item( NULL );
+    TInt count( iTracksList->Count() );
+    if ( count > 0 && aIndex < count )
+        {
+        item = iTracksList->AtL( aIndex );
+        User::LeaveIfNull( item );
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    return *item->Value<TMPXItemId>( KMPXMediaGeneralId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::MediaL
+// Return track media.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+const CMPXMedia& CMPXAddTracksListModel::MediaL( TInt aIndex ) const
+    {
+    //MPX_FUNC( "CMPXAddTracksListModel::MediaL" );
+    TInt entriesCount( iTracksList->Count() );
+    if ( ( entriesCount < aIndex + 1 ) || ( aIndex < 0 ) )
+        {
+        User::Leave( KErrArgument );
+        }
+    CMPXMedia* item( iTracksList->AtL( aIndex ) );
+    User::LeaveIfNull( item );
+    return *item;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::TracksListCount
+// Return number of tracks stored in the list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksListModel::TracksListCount() const
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::TracksListCount" );
+    return iTracksList->Count();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::InsertGroupsL
+// Insert groups at aPos of the tracks list.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksListModel::InsertGroupsL(
+    CMPXMediaArray& aMedia, TInt aPos , TInt aCategory)
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::InsertGroupsL" );
+    TInt count = aMedia.Count();
+    MPX_DEBUG2( "CMPXAddTracksListModel::InsertGroupsL MdcaCount = %d", count );
+    for ( TInt index = 0; index < count; index++ )
+        {
+        MPX_DEBUG2( "CMPXAddTracksListModel::InsertGroupsL index = %d", index );
+        CMPXMedia* origItem( aMedia.AtL( index ) );
+        User::LeaveIfNull( origItem );
+        CMPXMedia* item( CMPXMedia::NewL( *origItem ) );
+        item->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup );
+        item->SetTObjectValueL( KMPXMediaGeneralCategory, aCategory );
+        if ( aPos == -1 )
+            {
+            iTracksList->AppendL( item );
+            }
+        else
+            {
+            iTracksList->InsertL( item, aPos + index );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::InsertTrackL
+// Insert track at position.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksListModel::InsertTrackL(
+    CMPXMedia& aTrack, TInt aIndex )
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::InsertTrackL" );
+    CMPXMedia* media = CMPXMedia::NewL( aTrack );
+    iTracksList->Insert( media, aIndex );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::InsertTracksUnderGroupL
+// Insert tracks under the current group. Update the expanded array too.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksListModel::InsertTracksUnderGroupL(
+    CMPXMediaArray& aTracks, TInt aIndex )
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::InsertTracksUnderGroupL" );
+    // Make sure the current index is a group
+    if ( TrackTypeL( aIndex ) == EMPXGroup )
+        {
+        TInt count = aTracks.Count();
+        for ( TInt i = 0; i < count; i++ )
+            {
+            CMPXMedia* origItem( aTracks.AtL( i ) );
+            User::LeaveIfNull( origItem );
+            CMPXMedia* media = CMPXMedia::NewL( *origItem );
+            iTracksList->Insert( media, aIndex + 1 + i );
+            }
+        // Mark as expanded
+        MarkExpandedL( aIndex, count );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::RemoveAllTracksFromGroupL
+// Remove all tracks under group.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksListModel::RemoveAllTracksFromGroupL( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::RemoveAllTracksFromGroupL" );
+    TInt count = 0;
+    if ( TrackTypeL( aIndex ) == EMPXGroup )
+        {
+        TInt pos = aIndex + 1;
+        while ( ( pos < TracksListCount() ) &&
+            ( TrackTypeL( pos ) != EMPXGroup ) )
+            {
+            // Remove the track from the list
+            iTracksList->Remove( pos );
+            count++;
+            }
+        // Mark as collapsed
+        UnMarkExpanded( aIndex, count );
+        }
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::RemoveTracks
+// Remove tracks.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksListModel::RemoveTracks( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::RemoveTracks" );
+    iTracksList->Remove( aIndex );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::ExpandedGroupsCount
+// Return expanded groups count.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksListModel::ExpandedGroupsCount() const
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::ExpandedGroupsCount" );
+    return iExpandedIndices.Count();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::IsExpandedIndex
+// Check if the index is expanded or not.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAddTracksListModel::IsExpandedIndex( TInt aIndex ) const
+    {
+    //MPX_FUNC( "CMPXAddTracksListModel::IsExpandedIndex" );
+    TBool result = EFalse;
+    if ( iExpandedIndices.Find( aIndex ) != KErrNotFound )
+        {
+        result = ETrue;
+        }
+
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::MarkExpandedL
+// Mark the current index as expanded.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksListModel::MarkExpandedL( TInt aIndex, TInt aCount )
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::MarkExpandedL" );
+    // Update the expanded array accordingly.
+    TInt count = iExpandedIndices.Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TInt& temp = iExpandedIndices[ i ];
+        if ( temp > aIndex )
+            {
+            temp += aCount;
+            }
+        }
+
+    iExpandedIndices.Append( aIndex );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::UnMarkExpanded
+// Clear the current index as collapsed.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksListModel::UnMarkExpanded( TInt aIndex, TInt aCount )
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::UnMarkExpanded" );
+    TInt pos = iExpandedIndices.Find( aIndex );
+    if ( pos != KErrNotFound )
+        {
+        iExpandedIndices.Remove( pos );
+
+        // Update the expanded array accordingly.
+        TInt count = iExpandedIndices.Count();
+        for ( TInt i = 0; i < count; i++ )
+            {
+            TInt& temp = iExpandedIndices[ i ];
+            if ( temp > aIndex )
+                {
+                temp -= aCount;
+                }
+            }
+
+        iExpandedIndices.Compress();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::OldestExpandedGroupIndex
+// Return the oldest expanded group index.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksListModel::OldestExpandedGroupIndex()
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::OldestExpandedGroupIndex" );
+    // Oldest item is always located at the top of the list
+    return iExpandedIndices[ 0 ];
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::ClosestExpandedGroupIdx
+// Return the closest expanded group index.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksListModel::ClosestExpandedGroupIdx( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::ClosestExpandedGroupIdx" );
+    TInt count = iExpandedIndices.Count();
+    TInt result = KErrNotFound;
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        TInt temp = iExpandedIndices[ i ];
+        if ( ( temp <= aIndex ) &&
+            ( temp > result ) )
+            {
+            result = temp;
+            }
+        }
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::AnimationIconNum
+// Return animation icon index for highlight item.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAddTracksListModel::AnimationIconNum( TInt aIndex )
+    {
+    //MPX_FUNC( "CMPXAddTracksListModel::AnimationIconNum" );
+    TInt trackType = EMPXNoType;
+    MPX_TRAPD( error, trackType = TrackTypeL( aIndex ) );
+
+    if( ( aIndex == iCurrentHighlightIndex )
+        && ( trackType != EMPXGroup )
+        && ( error == KErrNone ) )
+        {
+        return iAnimIconNum;
+        }
+    else
+        {
+        return 0;   // no animation icon
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::SetAnimationIconNum
+// Set animation icon index number.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksListModel::SetAnimationIconNum(
+    TInt aIndex,
+    TInt aAnimIconNum )
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::SetAnimationIconNum" );
+    iCurrentHighlightIndex = aIndex;
+    iAnimIconNum = aAnimIconNum;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::FindSongs
+// Provide info if there is matched songs.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAddTracksListModel::FindSongs()
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::FindSongs" );
+    return iFindSongs;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::SetFindSongsFlag
+// Set flag to indicate if there are mathed songs.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAddTracksListModel::SetFindSongsFlag( TBool aFindSongs )
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::SetFindSongsFlag" );
+    iFindSongs = aFindSongs;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAddTracksListModel::FindSongs
+// determines if the current item is on removable drive
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAddTracksListModel::IsOnRemovableDrive( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXAddTracksListModel::IsOnRemovableDrive" );
+    CMPXMedia* entry( NULL );
+    TInt count( iTracksList->Count() );
+    if ( count > 0 && aIndex < count )
+        {
+        TRAP_IGNORE( entry = iTracksList->AtL( aIndex ) ) ;
+        }
+
+    TUint flags(0);
+    if ( entry )
+        {
+        if( entry->IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            TRAP_IGNORE( flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) );
+            }
+        }
+
+    TInt driveNum( ( flags ) & ( KMPXMediaGeneralFlagsDriveInfo ) );
+    return ( driveNum == iMMCDrive );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/bwinscw/mpxalbumarteditordialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	??1CMPXAlbumArtEditorDialog@@UAE@XZ @ 1 NONAME ; CMPXAlbumArtEditorDialog::~CMPXAlbumArtEditorDialog(void)
+	?NewL@CMPXAlbumArtEditorDialog@@SAPAV1@XZ @ 2 NONAME ; class CMPXAlbumArtEditorDialog * CMPXAlbumArtEditorDialog::NewL(void)
+	?SetParamL@CMPXAlbumArtEditorDialog@@QAEXPBVTDesC16@@@Z @ 3 NONAME ; void CMPXAlbumArtEditorDialog::SetParamL(class TDesC16 const *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/data/mpxalbumarteditordialog.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,291 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project albumart editor dialog
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MXAP // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+
+#include <mpxalbumarteditordialog.loc>
+#include "mpxalbumarteditordialog.hrh"
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_collection_album_art_dialog_title
+// Album art dialog title.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_collection_album_art_dialog_title
+    {
+    buf = qtn_nmp_title_album_art;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_album_art_dlg_title
+// Text used for Album art selection dialog title.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_album_art_dlg_title
+    {
+    buf = qtn_mus_title_select_album_art;
+    }
+
+// -----------------------------------------------------------------------------
+// r_musicplayer_cui_album_art_dialog_menubar
+// Album art dialog menu bar.
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_cui_album_art_dialog_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            { 
+            menu_pane = r_mpx_cui_album_art_dialog_menu;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_album_art_dialog_menu
+// Album Art dialog menu.
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_cui_album_art_dialog_menu
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdAlbumArtEditorDlgChange;
+            txt = qtn_options_change;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdAlbumArtEditorDlgRestore;
+            txt = qtn_options_restore_original;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdAlbumArtEditorDlgHelp;
+            txt = qtn_options_help;
+            },
+	MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_change_album_art_confirmation
+// Change album art confirmation.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_change_album_art_confirmation
+   { 
+   buf = qtn_nmp_query_add_art_to_album;
+   }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_restore_album_art_confirmation
+// Restore album art confirmation.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_restore_album_art_confirmation
+   { 
+   buf = qtn_nmp_query_restore_art_to_album;
+   }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_restore_album_art_confirmation_query
+// Restore album art confirmation query.
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_cui_restore_album_art_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_album_art_dialog
+// Album art dialog.
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_cui_album_art_dialog
+    {
+    title="";
+    buttons = r_mpx_cui_album_art_softkeys_options_change_back  ;
+    flags = EAknDialogGenericFullScreen;
+    items = 
+        {
+        DLG_LINE
+            {
+            id=EMPXAlbumArtEditorDlgCtrlId;
+            type=EMPXAlbumArtEditorDlg;
+            } //Image DLG_LINE
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_album_art_layout
+// Album art dialog layout.
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_cui_album_art_layout
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 17; r = 17; B = 100; W = 50; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_album_art_no_art_text
+// No album art text.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_album_art_no_art_text
+    {
+    buf = qtn_nmp_empty_album_art;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_note_opening
+// text for opening wait note.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_note_opening
+    {
+    buf = qtn_nmp_note_opening;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_note_restoring_album_art
+// text for restoring album art wait note.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_note_restoring_album_art
+    {
+    buf = qtn_nmp_note_restoring_album_art;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_note_adding_album_art
+// text for changing album art wait note.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_note_adding_album_art
+    {
+    buf = qtn_nmp_note_adding_album_art;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_note_art_restored
+// confirmation text for restoring album art.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_note_art_restored
+    {
+    buf = qtn_nmp_note_art_restored;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_note_art_changed
+// confirmation text for changing album art.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_note_art_changed
+    {
+    buf = qtn_nmp_note_art_changed;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_note_change_with_invalid
+// information text for change album art with invalid entries.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_note_change_with_invalid
+    {
+    buf = qtn_nmp_note_change_with_invalid;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_note_restore_with_invalid
+// information text for restore album art with invalid entries.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_note_restore_with_invalid
+    {
+    buf = qtn_nmp_note_restore_with_invalid;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_mp_drm_not_allowed
+// information text to specify drm not allowed.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mp_drm_not_allowed
+    {
+    buf = qtn_mp_drm_not_allowed;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_cui_song_details_softkeys_options_change_done
+// CBA for Song Details view.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_cui_album_art_softkeys_options_change_back
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt=text_softkey_back; },
+        CBA_BUTTON {id=EAknSoftkeyChange; txt=qtn_options_change; }
+        };
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/eabi/mpxalbumarteditordialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,9 @@
+EXPORTS
+	_ZN24CMPXAlbumArtEditorDialog4NewLEv @ 1 NONAME
+	_ZN24CMPXAlbumArtEditorDialog9SetParamLEPK7TDesC16 @ 2 NONAME
+	_ZN24CMPXAlbumArtEditorDialogD0Ev @ 3 NONAME
+	_ZN24CMPXAlbumArtEditorDialogD1Ev @ 4 NONAME
+	_ZN24CMPXAlbumArtEditorDialogD2Ev @ 5 NONAME
+	_ZTI42CMPXAlbumArtEditorDialogImageThumbnailUtil @ 6 NONAME ; #<TI>#
+	_ZTV42CMPXAlbumArtEditorDialogImageThumbnailUtil @ 7 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxalbumarteditordialog.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxalbumarteditordialog.loc	APP_LAYER_LOC_EXPORT_PATH(mpxalbumarteditordialog.loc)
+
+PRJ_MMPFILES
+mpxalbumarteditordialog.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/group/mpxalbumarteditordialog.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxalbumarteditordialog.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxalbumarteditordialog.dll
+TARGETTYPE      dll
+UID             0x10009D8D 0x101FFC85
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+MACRO __S60_MPX_UI_SPEC_COMPLIANCE
+MACRO __S60_MPX_ALBUM_ART_EDITOR_MSK
+MACRO RD_MPX_TNM_INTEGRATION
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+SOURCEPATH      ../src
+SOURCE          mpxalbumarteditordialog.cpp
+SOURCE          mpxalbumarteditordialogcustomcontrol.cpp
+SOURCE          mpxalbumarteditorcustomcontrolcontainer.cpp
+SOURCE          mpxalbumarteditordialogimagethumbnailutil.cpp
+
+START RESOURCE  ../data/mpxalbumarteditordialog.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         eikdlg.lib
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         fbscli.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         commonengine.lib
+LIBRARY         mgfetch.lib
+LIBRARY         estor.lib
+LIBRARY         aknskins.lib
+
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxcommonui.lib
+
+// for RD_MPX_TNM_INTEGRATION
+LIBRARY                 SysUtil.lib
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/inc/mpxalbumarteditorcustomcontrolcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player album art editor dialog declaration
+*
+*/
+
+
+#ifndef MPXALBUMARTEDITORCUSTOMCONTROLCONTAINER_H
+#define MPXALBUMARTEDITORCUSTOMCONTROLCONTAINER_H
+
+// INCLUDE FILES
+#include <coecntrl.h>
+
+// FORWARD DECLARATIONS
+class CMPXAlbumArtEditorDialogCustomControl;
+
+// CLASS DECLARATION
+
+/**
+ *  The container for the custom control in Album Art
+ */
+NONSHARABLE_CLASS(CMPXAlbumArtEditorCustomControlContainer) : public CCoeControl 
+    {
+public:  // Constructors and destructor
+    
+    /**
+     * Destructor.
+     */
+    ~CMPXAlbumArtEditorCustomControlContainer(); 
+
+public: // New functions
+    
+    /**
+     * Draw function removes flicker from CEikDialog's Draw()..
+     * @param TRect The container's extent
+     */
+    void Draw( const TRect & ) const;
+    
+public: // from base classes
+    
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );     
+
+public:     // Data
+
+    CMPXAlbumArtEditorDialogCustomControl *iDialogCustomControl; // Custom Control
+    
+    };
+
+#endif      // MPXALBUMARTEDITORCUSTOMCONTROLCONTAINER_H 
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/inc/mpxalbumarteditordialog.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxalbumarteditordialogplugin
+*
+*/
+
+
+
+#ifndef MPXALBUMARTEDITORDIALOG_HLP_HRH
+#define MPXALBUMARTEDITORDIALOG_HLP_HRH
+
+_LIT( KMUS_HLP_ALBUM_ART_EDITING, "MUS_HLP_ALBUM_ART_EDITING" );  
+
+#endif  // MPXALBUMARTEDITORDIALOG_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/inc/mpxalbumarteditordialog.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxalbumarteditordialog
+*
+*/
+
+
+
+#ifndef MPXALBUMARTEDITORDIALOG_HRH
+#define MPXALBUMARTEDITORDIALOG_HRH
+
+// ENUMS
+
+enum TMPXAlbumArtEditorDialogCommandIds
+    {
+    EMPXCmdAlbumArtEditorDlgChange = 0x5000,
+    EMPXCmdAlbumArtEditorDlgRestore,
+    EMPXCmdAlbumArtEditorDlgHelp
+    }; 
+
+enum TMPXAlbumArtEditorDlgCtrlIds
+    {
+    EMPXAlbumArtEditorDlgCtrlId = 1
+    };
+
+// Ablum art dialog custom controls
+enum TMPXAlbumArtEditorDlgCustomControls
+    {
+    EMPXAlbumArtEditorDlg = 0x800 
+    };
+    
+enum TMPXAlbumArtEditorCurrentMediaLOp
+    {
+    EMPXOpMediaLIdle,
+    EMPXOpMediaLGetCurrentMode,
+    EMPXOpMediaLGetContainerId,
+    EMPXOpMediaLGetAlbumArtInfo
+    };
+
+enum TMPXAlbumArtEditorCurrentFindAllLOp
+    {
+    EMPXOpFindAllLIdle,
+    EMPXOpFindAllLGetAlbumArtInfo,
+    EMPXOpFindAllLGetTrackArtInfo
+    };
+    
+enum TMPXAlbumArtEditorMode
+    {
+    EMPXModeTracksView,
+    EMPXModeAlbumView,
+    EMPXModeArtistAlbumView
+    };    
+
+    
+#endif  // MPXALBUMARTEDITORDIALOG_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/inc/mpxalbumarteditordialogcustomcontrol.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player album art editor dialog declaration
+*
+*/
+
+
+#ifndef MPXALBUMARTEDITORDIALOGCUSTOMCONTROL_H
+#define MPXALBUMARTEDITORDIALOGCUSTOMCONTROL_H
+
+//  INCLUDES
+#include <coecntrl.h>
+#include "mpxalbumartutilobserver.h"
+
+// FORWARD DECLARATIONS
+class CEikImage;
+class CEikLabel;
+class CMPXAlbumArtEditorDialog;
+class MMPXAlbumArtEventObserver;
+class CAknsBasicBackgroundControlContext;
+
+// CLASS DECLARATION
+
+/**
+ * The custom control for Album Art Dialog.
+ */
+NONSHARABLE_CLASS( CMPXAlbumArtEditorDialogCustomControl ) : public CCoeControl,
+                                                             public MMPXAlbumArtUtilObserver
+    {
+public:           
+    // States for category rename operations
+    enum TMPXAlbumArtEditorDialogMode
+        {
+        EMPXAlbumArtEditorDialogBlank = 0,
+        EMPXAlbumArtEditorDialogAlbumArt,
+        EMPXAlbumArtEditorDialogNoAlbumArt
+        };
+
+public:  // Constructors and destructor
+
+    /**
+     * Two-phased constructor. Leaves on failure. Places the instance on the
+     * cleanup stack.
+     * @param aParent Parent control.
+     * @param aRect The control's extent.
+     * @param aObserver observer for album art events
+     * @return The constructed item.
+     */
+    static CMPXAlbumArtEditorDialogCustomControl* NewLC( const CCoeControl& aParent, 
+                                                       const TRect& aRect,
+                                                       MMPXAlbumArtEventObserver* aObserver );
+
+    /**
+     * Two-phased constructor. Leaves on failure.
+     * @param aParent Parent control.
+     * @param aRect The control's extent.
+     * @param aObserver observer for album art events
+     * @return The constructed item.
+     */
+    static CMPXAlbumArtEditorDialogCustomControl* NewL( const CCoeControl& aParent, 
+                                                      const TRect& aRect,
+                                                      MMPXAlbumArtEventObserver* aObserver );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXAlbumArtEditorDialogCustomControl();       
+    
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXAlbumArtEditorDialogCustomControl();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     * @param aParent Parent control.
+     * @param aRect The control's extent.
+     * @param aObserver observer for album art events
+     */
+    void ConstructL( const CCoeControl& aParent, 
+                     const TRect &aRect,
+                     MMPXAlbumArtEventObserver* aObserver );
+
+public: // New functions
+    
+    /**
+     * Updates and displays the new album art.
+     * @param aMode album art mode.
+     * @param aNewAlbumArt The new bitmap album art.
+     */
+    void UpdateAlbumArt( TMPXAlbumArtEditorDialogMode aMode, 
+                         CFbsBitmap* aNewAlbumArt = NULL );
+
+    /**
+     * Displays image in a specific mode, 
+     * either Album Art/No Album Art or Various
+     * @param aMode album art mode.
+     */      
+    void SetModeL( TMPXAlbumArtEditorDialogMode aMode );
+    
+    /**
+     * updates skin color
+     */
+    void HandleSkinChangedL();
+
+private: // from base class MMPXAlbumArtUtilObserver
+
+    /**
+     * From MMPXAlbumArtUtilObserver.
+     * Notify that extraction of album art started.
+     */
+    void ExtractAlbumArtStarted();
+
+    /**
+     * From MMPXAlbumArtUtilObserver.
+     * Album art is extracted from file and ready to use.
+     *
+     * @param aBitmap a converted image. Ownership is transferred.
+     * @param aErr error code
+     */
+    void ExtractAlbumArtCompleted(
+        CFbsBitmap* aBitmap, 
+        TInt aErr );    
+    
+private: // Functions from base classes
+    	   
+    /**
+     * Draws to screen.
+     * @param aRect The control's extent
+     */
+    void Draw( const TRect& aRect ) const;
+
+    /**
+     * Determines the number of components.
+     */
+    TInt CountComponentControls() const;
+
+    /**
+     * Passes control of indexed component.
+     * @param aIndex The desired control index.
+     * @return The components control.
+     */
+    CCoeControl* ComponentControl( TInt aIndex ) const;
+
+    /**
+     * Resizes controls.
+     */
+    void SizeChanged();
+    
+ private:    // Data
+   
+    CEikImage*                   iImage; // image to display Album Art
+    CEikLabel*                   iLabel; // Labe to display either "(various)" or "(no album art)"       
+    TMPXAlbumArtEditorDialogMode iMode;  // mode of either Album Art, Various or No Album Art
+    MMPXAlbumArtEventObserver*   iObserver;
+    CAknsBasicBackgroundControlContext* iBackground;
+    TRect                        iBorder;
+    };
+
+#endif      // MPXALBUMARTEDITORDIALOGCUSTOMCONTROL_H 
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/inc/mpxalbumarteditordialogimagethumbnailutil.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player album art editor dialog declaration
+*
+*/
+
+
+#ifndef MPXALBUMARTEDITORDIALOGIMAGETHUMBNAILUTIL_H
+#define MPXALBUMARTEDITORDIALOGIMAGETHUMBNAILUTIL_H
+
+//  INCLUDES
+#include <badesca.h>
+#include <MMGFetchVerifier.h>
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+ * Thumbnail command event handling class.
+ */
+class CMPXAlbumArtEditorDialogImageThumbnailUtil :  public CBase,
+                                                    private MMGFetchVerifier
+    {
+public:  // Constructors and destructor
+
+    /**
+     * Creates a new instance of this class.
+     * @param aEngine           Phonebook contact engine.
+     * @param aThumbnailPopup   the UI control that will display the 
+     *                          thumbnail.
+     * @return a new instance of this class.
+     */
+    static CMPXAlbumArtEditorDialogImageThumbnailUtil* NewL();
+    
+    /**
+     * Destructor.
+     */
+    ~CMPXAlbumArtEditorDialogImageThumbnailUtil();
+
+public: // New functions
+
+    /**
+     * Fetch a thumbnail from the photo album, attach it to a contact and
+     * display the thumbnail.
+     *
+     * @param aContactItem contact to attach the thumbnail to.
+     * @return result of MGFetch::RunL
+     */
+    TBool FetchThumbnailL( CDesCArray& aFilesArray );
+    
+private:  // Implementation
+          
+    /**
+    * Default constructor.
+    */
+    CMPXAlbumArtEditorDialogImageThumbnailUtil();
+
+    /**
+    * Second-phase constructor.
+    */
+    void ConstructL();        
+
+private: // from MMGFetchVerifier
+
+    /**
+    * Verify image selection.
+    * @param aSelectedFiles is the pathname of the selected file.
+    */
+    TBool VerifySelectionL( const MDesCArray* aSelectedFiles );
+
+private:    // Data
+    };
+
+#endif // MPXALBUMARTEDITORDIALOGIMAGETHUMBNAILUTIL_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/loc/mpxalbumarteditordialog.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxalbumarteditordialog
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Album art details popup.
+// d:Title for album art popup.
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_mus_title_select_album_art "Select album art:"
+
+// d:album art editor title
+// l:title_pane_t2/opt9
+// r:3.1
+//
+#define qtn_nmp_title_album_art "Album art"
+
+// d:Meta data editing softkey Option
+// d:Restores album art to image contained in meta data
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_options_restore_original "Restore original" 
+
+// d:Meta data editing Query
+// d:Confirmation yes or no, for adding all album art
+// l:popup_note_window/opt1
+// r:3.1
+//
+#define qtn_nmp_query_add_art_to_album "Album art for all songs in album will be changed. Continue?"
+
+// d:Meta data editing Query
+// d:Confirmation yes or no, for restoring all album art
+// l:popup_note_window/opt1
+// r:3.1
+//
+#define qtn_nmp_query_restore_art_to_album "Original art for all songs in album will be restored. Continue?"
+
+// d:Meta data editing Album art status
+// d:Displayed in Album art's position
+// d:when there is no album art to display
+// l:main_pane_empty_t1/opt2
+// r:3.1
+//
+#define qtn_nmp_empty_album_art "(no album art selected)"
+
+// d:Text for wait note for opening album art
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_nmp_note_opening "Opening"
+
+// d:Text for wait note for restoring album art
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_nmp_note_restoring_album_art "Restoring album art"
+
+// d:Text for wait note for changing album art
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_nmp_note_adding_album_art "Changing album art"
+
+// d:Confirmation text for restoring album art
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_art_restored "Original album art restored"
+
+// d:Confirmation text for changing album art
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_art_changed "Album art changed"
+
+// d:information text for changing album art with invalid files
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_change_with_invalid "Album art for some songs could not be changed"
+
+// d:information text for restoring album art with invalid files
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_restore_with_invalid "Album art for some songs could not be restored"
+
+// d:Confirmation note text.
+// d:Notify for unable to select the item because it's DRM protected.
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_mp_drm_not_allowed  "Unable to select a copyright protected item."
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/src/mpxalbumarteditorcustomcontrolcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player album art editor dialog implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "mpxalbumarteditorcustomcontrolcontainer.h"
+#include "mpxalbumarteditordialogcustomcontrol.h"
+
+// Destructor
+CMPXAlbumArtEditorCustomControlContainer::~CMPXAlbumArtEditorCustomControlContainer() 
+    { 
+    delete iDialogCustomControl; 
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorCustomControlContainer::Draw
+// Removes flicker from CEikDialog's Draw().
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorCustomControlContainer::Draw( const TRect & ) const
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//    
+void CMPXAlbumArtEditorCustomControlContainer::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType );    
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/src/mpxalbumarteditordialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1656 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player album art editor dialog implementation
+*
+*/
+
+// INCLUDE FILES
+#include <akntitle.h>
+#include <aknnavide.h>
+#include <StringLoader.h>
+#include <aknnotewrappers.h>
+#include <aknViewAppUi.h>
+#include <aknnavilabel.h>
+#include <coeutils.h>
+#include <hlplch.h>
+#include <data_caging_path_literals.hrh>
+#include <bautils.h>
+
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionutility.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxcollectionpath.h>
+#include <mpxalbumarteditordialog.rsg>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxconstants.h>
+#include <mpxlog.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxuser.h>
+
+#include "mpxalbumartutil.h"
+#include "mpxcommonuihelper.h"
+#include "mpxalbumarteditordialog.hlp.hrh"
+#include "mpxalbumarteditordialog.hrh"
+#include "mpxalbumarteditordialogcustomcontrol.h"
+#include "mpxalbumarteditorcustomcontrolcontainer.h"
+#include "mpxalbumarteditordialogimagethumbnailutil.h"
+#include "mpxalbumarteditordialog.h"
+#include "mpxviewprivatepskeys.h"
+
+// CONSTANTS
+const TInt KMPXAlbumArtBorder = 24;
+
+_LIT( KMPXAlubmArtEditorRscPath, "mpxalbumarteditordialog.rsc" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXAlbumArtEditorDialog* CMPXAlbumArtEditorDialog::NewL()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::NewL" );
+    CMPXAlbumArtEditorDialog* self =
+        new ( ELeave ) CMPXAlbumArtEditorDialog();
+    CleanupStack::PushL( self );
+    self->ConstructL( R_MPX_CUI_ALBUM_ART_DIALOG_MENUBAR );
+    CleanupStack::Pop( self );  // this, it will be PushL-d by executeLD...
+    return self;
+    }
+
+// Destructor
+EXPORT_C CMPXAlbumArtEditorDialog::~CMPXAlbumArtEditorDialog()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::~CMPXAlbumArtEditorDialog" );
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+
+    delete iCommonUiHelper;
+    delete iOrigTitle;
+    delete iNaviLabelPane;
+    delete iMPXUtility;
+    delete iParam;
+    delete iMedia;
+    delete iAlbumInfo;
+    delete iMediaArray;
+    delete iNewFileName;
+    delete iAsyncCallNext;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::OfferKeyEventL
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CMPXAlbumArtEditorDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent,
+                                         TEventCode aType)
+	{
+	if( iFetchingPicture )
+		{
+        // fix for ou1cimx1#176793
+	    if ( aKeyEvent.iScanCode == EStdKeyEnter || aKeyEvent.iCode == EKeyEnter )
+	        {
+	        return EKeyWasConsumed;
+	        }
+		// When the fetcher is open ignore all key presses.
+		// Needed to avoid closing of the dialog before the fetcher is closed.
+		return EKeyWasNotConsumed;
+        }
+
+    //response enter key as select key
+    if( aKeyEvent.iScanCode == EStdKeyEnter || aKeyEvent.iScanCode == EKeyEnter )
+        {
+        if( aType == EEventKeyUp )
+            {
+            DoProcessCommandL( EMPXCmdAlbumArtEditorDlgChange );
+            }
+
+        return EKeyWasConsumed;
+        }
+
+    return CAknDialog::OfferKeyEventL(aKeyEvent,aType);
+	}
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::CMPXAlbumArtEditorDialog
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXAlbumArtEditorDialog::CMPXAlbumArtEditorDialog() :
+    iNewFileName( NULL )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::SetParamL
+// parameter passed in from viewframework
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXAlbumArtEditorDialog::SetParamL( const TDesC* aParam )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::SetParamL" );
+    delete iParam;
+    iParam = NULL;
+    iParam = aParam->AllocL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::ConstructL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::ConstructL( TInt aResource )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::ConstructL" );
+    CCoeEnv* coeEnv = iEikonEnv;
+    TParse parse;
+    parse.Set( KMPXAlubmArtEditorRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
+    iMPXUtility = CMPXAlbumArtUtil::NewL();
+
+    iCommonUiHelper = CMPXCommonUiHelper::NewL();
+
+    CAknDialog::ConstructL( aResource );
+
+    iAsyncCallNext = new ( ELeave ) CAsyncCallBack(
+        TCallBack( CMPXAlbumArtEditorDialog::ExtractNextAlbumArtCallBackL, this ),
+        CActive::EPriorityStandard );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection message.
+// ---------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::HandleCollectionMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d a folder
+// ---------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::HandleOpenL(
+        const CMPXMedia& /*aEntries*/,
+        TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the item being opened. Typically called
+// when client has Open()'d an item. Client typically responds by
+// 'playing' the item via the playlist
+// ---------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::HandleOpenL(
+        const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection media.
+// Notes: The client is responsible for delete the object of aMedia.
+// ---------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::HandleCollectionMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::HandleCollectionMediaL" );
+    if ( KErrNone == aError )
+        {
+        switch ( iCurrentMediaLOp )
+            {
+            case EMPXOpMediaLGetCurrentMode:
+                {
+                TMPXGeneralType type( aMedia.ValueTObjectL<TMPXGeneralType>(
+                    KMPXMediaGeneralType ) );
+                TMPXGeneralCategory category(
+                    aMedia.ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory ) );
+
+                if ( type != EMPXItem || category != EMPXSong )
+                    {
+                    delete iMedia;
+                    iMedia = NULL;
+                    iMedia = CMPXMedia::NewL();
+                    TMPXItemId albumId( aMedia.ValueTObjectL<TMPXItemId>(
+                        KMPXMediaGeneralId ) );
+                    iMedia->SetTObjectValueL<TMPXItemId>(
+                        KMPXMediaGeneralId,
+                        albumId );
+                    // not on tracks level, get container ID
+                    iCurrentMediaLOp = EMPXOpMediaLGetContainerId;
+                    CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
+                    CleanupStack::PushL( path );
+                    path->Back();
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL( attrs );
+                    // get attributes as if it's tracks level so that we don't need to
+                    // make another async call if that's the case.  if it's album level, those
+                    // attributes are ignored
+                    attrs.Append(
+                        TMPXAttribute( KMPXMediaIdGeneral,
+                        EMPXMediaGeneralId | EMPXMediaGeneralCategory ) );
+                    iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+                    CleanupStack::PopAndDestroy( &attrs );
+                    CleanupStack::PopAndDestroy( path );
+                    }
+                else
+                    {
+                    delete iMedia;
+                    iMedia = NULL;
+                    iMedia = CMPXMedia::NewL( aMedia );
+                    delete iAlbumInfo;
+                    iAlbumInfo = NULL;
+                    iAlbumInfo = CMPXMedia::NewL( aMedia );
+                    const TDesC& albumArtFileName =
+                        aMedia.ValueText( KMPXMediaMusicAlbumArtFileName );
+                    MPX_DEBUG2( "CMPXAlbumArtEditorDialog::HandleCollectionMediaL album art file name = %S", &albumArtFileName );
+                    const TDesC& origAlbumArtFileName =
+                        aMedia.ValueText( KMPXMediaMusicOriginalAlbumArtFileName );
+                    MPX_DEBUG2( "CMPXAlbumArtEditorDialog::HandleCollectionMediaL original album art file name = %S", &origAlbumArtFileName );
+                    if ( albumArtFileName.Length() > 0 )
+                        {
+                        if ( albumArtFileName.Compare( origAlbumArtFileName ) == 0 )
+                            {
+                            iAlbumArtChanged = EFalse;
+                            }
+                        else
+                            {
+                            iAlbumArtChanged = ETrue;
+                            }
+                        }
+                    ExtractAlbumArtL( aMedia );
+                    iCurrentMediaLOp = EMPXOpMediaLIdle;
+                    }
+                // Navipane title should be the title of the artist/album/genre/composer or song/item
+                //
+                UpdateNaviPaneL(aMedia.ValueText(KMPXMediaGeneralTitle ));
+                break;
+                }
+            case EMPXOpMediaLGetContainerId:
+                {
+                delete iAlbumInfo;
+                iAlbumInfo = NULL;
+                iAlbumInfo = CMPXMedia::NewL();
+                TMPXGeneralCategory category(
+                    aMedia.ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory ) );
+                TMPXItemId albumId(
+                    iMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                iAlbumInfo->SetTObjectValueL<TMPXItemId>(
+                    KMPXMediaGeneralId, albumId );
+                MPX_DEBUG2( "CMPXAlbumArtEditorDialog::HandleCollectionMediaL album id = 0x%x", albumId.iId1 );
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL( attrs );
+                AppendCommonAttributes( attrs );
+                CMPXMedia* criteria = CMPXMedia::NewL();
+                CleanupStack::PushL( criteria );
+                criteria->SetTObjectValueL<TMPXGeneralType>(
+                    KMPXMediaGeneralType, EMPXGroup );
+                criteria->SetTObjectValueL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory, EMPXSong );
+                criteria->SetTObjectValueL<TMPXItemId>(
+                    KMPXMediaGeneralId, albumId );
+                if ( category == EMPXAlbum )
+                    {
+                    // in albums view
+                    iAlbumArtMode = EMPXModeAlbumView;
+                    }
+                else
+                    {
+                    // in artist/albums view
+                    iAlbumArtMode = EMPXModeArtistAlbumView;
+                    TMPXItemId containerId( aMedia.ValueTObjectL<TMPXItemId>(
+                        KMPXMediaGeneralId ) );
+                    iAlbumInfo->SetTObjectValueL<TMPXItemId>(
+                        KMPXMediaGeneralContainerId, containerId );
+                    MPX_DEBUG2( "CMPXAlbumArtEditorDialog::HandleCollectionMediaL container id = 0x%x", containerId.iId1 );
+                    criteria->SetTObjectValueL<TMPXItemId>(
+                        KMPXMediaGeneralContainerId, containerId );
+                    }
+                iCurrentFindAllLOp = EMPXOpFindAllLGetAlbumArtInfo;
+                iCollectionUtility->Collection().FindAllL( *criteria, attrs.Array(), *this );
+                CleanupStack::PopAndDestroy( criteria );
+                CleanupStack::PopAndDestroy( &attrs );
+                iCurrentMediaLOp = EMPXOpMediaLIdle;
+                break;
+                }
+            case EMPXOpMediaLGetAlbumArtInfo:
+                {
+                delete iMedia;
+                iMedia = NULL;
+                iMedia = CMPXMedia::NewL( aMedia );
+                const TDesC& albumArtFileName =
+                    aMedia.ValueText( KMPXMediaMusicAlbumArtFileName );
+                if ( albumArtFileName.Length() > 0 )
+                    {
+                    if ( albumArtFileName.Compare(
+                        aMedia.ValueText( KMPXMediaMusicOriginalAlbumArtFileName ) ) == 0 )
+                        {
+                        iAlbumArtChanged = EFalse;
+                        }
+                    else
+                        {
+                        iAlbumArtChanged = ETrue;
+                        }
+                    }
+                ExtractAlbumArtL( aMedia );
+                iCurrentMediaLOp = EMPXOpMediaLIdle;
+                break;
+                }
+            default:
+                {
+                iCurrentMediaLOp = EMPXOpMediaLIdle;
+                break;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::HandleCommandComplete
+// Handle completion of async commands
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::HandleCommandComplete(CMPXCommand* /*aCommandResult*/,
+                                                     TInt aError )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::HandleCommandComplete" );
+    MPX_DEBUG2( "CMPXAlbumArtEditorDialog::HandleCommandComplete aError = %d", aError );
+    MPX_DEBUG1( "CMPXAlbumArtEditorDialog::HandleCommandComplete dismiss wait note" );
+    if( !iInvalidFileExist )
+        {
+        TRAP_IGNORE( DoHandleOperationCompleteL( aError ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::GetCurrentModeL
+// Sends request to determine if it's album level or track level
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::GetCurrentModeL()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::GetCurrentModeL" );
+    iCurrentMediaLOp = EMPXOpMediaLGetCurrentMode;
+    CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL( path );
+    if ( iParam )
+        {
+        TLex indexLex( iParam->Des() );
+        TInt lexToInt = NULL;
+        if ( indexLex.Val( lexToInt ) == KErrNone )
+            {
+            path->Set( lexToInt );
+            }
+        }
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    // get attributes as if it's tracks level so that we don't need to
+    // make another async call if that's the case.  if it's album level, those
+    // attributes are ignored
+    AppendCommonAttributes( attrs );
+    attrs.Append( KMPXMediaGeneralTitle );
+    iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+    CleanupStack::PopAndDestroy( &attrs );
+    CleanupStack::PopAndDestroy( path );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::BackupPreviousStatusPaneL
+// Backs up Status Pane information.
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::BackupPreviousStatusPaneL()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::BackupPreviousStatusPaneL" );
+    CEikStatusPane* sp = iAvkonAppUi->StatusPane();
+    // Create and Push navi lable
+    iNaviPane = static_cast< CAknNavigationControlContainer* >
+        ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
+    iNaviLabelPane = iNaviPane->CreateNavigationLabelL();
+    iNaviPane->PushL( *iNaviLabelPane );
+    // Backup title pane
+    iTitlePane = static_cast< CAknTitlePane* >
+        ( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+    iOrigTitle = iTitlePane->Text()->AllocL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::RestorePreviousStatusPaneL()
+// Restores previous status pane.
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::RestorePreviousStatusPaneL()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::RestorePreviousStatusPaneL" );
+    if ( iOrigTitle )
+        {
+        // Set original title pane
+        iTitlePane->SetTextL( *iOrigTitle );
+        }
+    // Restore original navi pane
+    iNaviPane->Pop( iNaviLabelPane );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::FindCustomControlContainer
+// Returns the Custom Control Container.
+// -----------------------------------------------------------------------------
+//
+CMPXAlbumArtEditorDialogCustomControl *CMPXAlbumArtEditorDialog::
+    GetAlbumArtEditorDialogCustomControl() const
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::GetAlbumArtEditorDialogCustomControl" );
+    CMPXAlbumArtEditorCustomControlContainer *control =
+        ( CMPXAlbumArtEditorCustomControlContainer* )
+        ControlOrNull ( EMPXAlbumArtEditorDlgCtrlId );
+    if ( control )
+        {
+        return control->iDialogCustomControl;
+        }
+    return NULL;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::LoadAlbumArtL
+// loads album art information from the database
+// ----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::LoadAlbumArtL( TBool aShowWaitNote )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::LoadAlbumArtL" );
+    HBufC* string = StringLoader::LoadLC( R_MPX_QTN_NMP_NOTE_OPENING );
+
+    if( aShowWaitNote ) // show wait note only when needed
+		{
+		iCommonUiHelper->ShowWaitNoteL( *string, R_AVKON_SOFTKEYS_EMPTY, EFalse, this );
+		}
+
+    CleanupStack::PopAndDestroy( string );
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    if ( !iAlbumInfo )
+        {
+        if ( iCurrentMediaLOp == EMPXOpMediaLIdle )
+            {
+            MPX_DEBUG1( "CMPXAlbumArtEditorDialog::LoadAlbumArtL Using MediaL" );
+            if ( iAlbumArtMode == EMPXModeTracksView )
+                {
+                iCurrentMediaLOp = EMPXOpMediaLGetAlbumArtInfo;
+                AppendCommonAttributes( attrs );
+                }
+            else
+                {
+                iCurrentMediaLOp = EMPXOpMediaLGetCurrentMode;
+                // get attributes as if it's tracks level so that we don't need to
+                // make another async call if that's the case.  if it's album level, those
+                // attributes are ignored
+                attrs.Append(
+                    TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralType |
+                    EMPXMediaGeneralCategory | EMPXMediaGeneralId | EMPXMediaGeneralTitle ) );
+                }
+
+            CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( cpath );
+            if ( iParam )
+                {
+                TLex indexLex( iParam->Des() );
+                TInt lexToInt = NULL;
+                if ( indexLex.Val( lexToInt ) == KErrNone )
+                    {
+                    cpath->Set( lexToInt );
+                    }
+                }
+            iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+            CleanupStack::PopAndDestroy( cpath );
+            }
+        else
+            {
+            MPX_DEBUG1( "CMPXAlbumArtEditorDialog::LoadAlbumArtL is busy, not loading again" );
+            }
+        }
+    else
+        {
+        if ( iCurrentFindAllLOp == EMPXOpFindAllLIdle )
+            {
+            MPX_DEBUG1( "CMPXAlbumArtEditorDialog::LoadAlbumArtL Using FindAllL" );
+            // iAlbumInfo is valid, something has been fetched before
+            CMPXMedia* criteria = CMPXMedia::NewL();
+            CleanupStack::PushL( criteria );
+            criteria->SetTObjectValueL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory, EMPXSong );
+            TMPXItemId itemId(
+                iAlbumInfo->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+            criteria->SetTObjectValueL<TMPXItemId>(
+                KMPXMediaGeneralId, itemId );
+            AppendCommonAttributes( attrs );
+            switch ( iAlbumArtMode )
+                {
+                case EMPXModeTracksView:
+                    {
+                    MPX_DEBUG1( "CMPXAlbumArtEditorDialog::LoadAlbumArtL EMPXModeTracksView" );
+                    criteria->SetTObjectValueL<TMPXGeneralType>(
+                        KMPXMediaGeneralType, EMPXItem );
+                    iCurrentFindAllLOp = EMPXOpFindAllLGetTrackArtInfo;
+                    break;
+                    }
+                case EMPXModeArtistAlbumView:
+                    {
+                    MPX_DEBUG1( "CMPXAlbumArtEditorDialog::LoadAlbumArtL EMPXModeArtistAlbumView" );
+                    TMPXItemId containerId(
+                        iAlbumInfo->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralContainerId ) );
+                    criteria->SetTObjectValueL<TMPXItemId>(
+                        KMPXMediaGeneralContainerId, containerId );
+                    } // fall through on purpose
+                case EMPXModeAlbumView:
+                    {
+                    MPX_DEBUG1( "CMPXAlbumArtEditorDialog::LoadAlbumArtL EMPXModeAlbumView" );
+                    criteria->SetTObjectValueL<TMPXGeneralType>(
+                        KMPXMediaGeneralType, EMPXGroup );
+                    iCurrentFindAllLOp = EMPXOpFindAllLGetAlbumArtInfo;
+                    break;
+                    }
+                }
+            iCollectionUtility->Collection().FindAllL( *criteria, attrs.Array(), *this );
+            CleanupStack::PopAndDestroy( criteria );
+            }
+        else
+            {
+            MPX_DEBUG1( "CMPXAlbumArtEditorDialog::LoadAlbumArtL is busy, not loading again" );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &attrs );
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::ExtractAlbumArtL
+// extracts the album art
+// ----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::ExtractAlbumArtL(
+    const CMPXMedia& aMedia, TBool aDismissWaitNoteOnError )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::ExtractAlbumArtL" );
+    TInt err( KErrNone );
+
+    CMPXAlbumArtEditorDialogCustomControl* control =
+        GetAlbumArtEditorDialogCustomControl();
+    MPX_DEBUG2( "CMPXAlbumArtEditorDialog::ExtractAlbumArtL filename length = %d", aMedia.ValueText( KMPXMediaMusicAlbumArtFileName ).Length() );
+    MPX_TRAP( err,
+        iMPXUtility->ExtractAlbumArtL(
+            aMedia,
+            *control,
+            iModRect.Size() ) );
+    MPX_DEBUG2( "CMPXAlbumArtEditorDialog::ExtractAlbumArtL err = %d", err );
+    if ( KErrNone != err )
+        {
+        if ( aDismissWaitNoteOnError )
+            {
+            // If error, show default album art
+            GetAlbumArtEditorDialogCustomControl()->SetModeL(
+                CMPXAlbumArtEditorDialogCustomControl::
+                EMPXAlbumArtEditorDialogNoAlbumArt );
+            MPX_DEBUG1( "CMPXAlbumArtEditorDialog::ExtractAlbumArtL show default album art" );
+            iCommonUiHelper->DismissWaitNoteL();
+            DrawDeferred();
+            }
+        else
+            {
+            User::Leave( err );
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::ExtractMultipleAlbumArtL
+// control extract of multiple album art
+// ----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::ExtractMultipleAlbumArtL()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::ExtractMultipleAlbumArtL" );
+    if ( iMediaArray )
+        {
+        if ( !iAsyncCallNext->IsActive() )
+            {
+            iAsyncCallNext->Call();
+            }
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::SaveMediaL
+// Saves the updated media.
+// -----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXAlbumArtEditorDialog::SaveMediaLC(
+    const TDesC& aFileName, TBool aIsRestore )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::SaveMediaL" );
+    CMPXMedia* media = CMPXMedia::NewL();
+    CleanupStack::PushL( media );
+    TBool ret( ETrue );
+
+    if ( iMedia->IsSupported( KMPXMediaGeneralUri ) )
+        {
+        const TDesC& uri = iMedia->ValueText( KMPXMediaGeneralUri );
+        TBool isCorrupted( EFalse );
+        if ( iMedia->IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            TUint flags = iMedia->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+            isCorrupted = ( ( flags ) & ( KMPXMediaGeneralFlagsIsCorrupted ) );
+            }
+        if ( ConeUtils::FileExists( uri ) && !isCorrupted )
+            {
+            media->SetTextValueL( KMPXMediaGeneralUri, uri );
+            }
+        else
+            {
+            iInvalidFileExist = ETrue;
+            ret = EFalse;
+            if ( !isCorrupted )
+                {
+                // set invalid flag in database if it's invalid
+                TUint flags( KMPXMediaGeneralFlagsSetOrUnsetBit );
+                flags |= KMPXMediaGeneralFlagsIsInvalid;
+                CMPXMedia* entry = CMPXMedia::NewL();
+                CleanupStack::PushL( entry );
+                TMPXItemId id( iMedia->ValueTObjectL<TMPXItemId>(
+                    KMPXMediaGeneralId ) );
+                TMPXGeneralType type(
+                    iMedia->ValueTObjectL<TMPXGeneralType>(
+                        KMPXMediaGeneralType ) );
+                TMPXGeneralCategory category(
+                    iMedia->ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory ) );
+                TUid collectionId( iMedia->ValueTObjectL<TUid>(
+                    KMPXMediaGeneralCollectionId ) );
+                entry->SetTObjectValueL<TMPXItemId>(
+                    KMPXMediaGeneralId, id );
+                entry->SetTObjectValueL<TMPXGeneralType>(
+                    KMPXMediaGeneralType, type );
+                entry->SetTObjectValueL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory, category );
+                entry->SetTObjectValueL<TUid>(
+                    KMPXMediaGeneralCollectionId, collectionId );
+                entry->SetTObjectValueL<TUint>(
+                    KMPXMediaGeneralFlags, flags );
+
+                DoSetCollectionL( entry, ETrue );
+                CleanupStack::PopAndDestroy( entry );
+                }
+            }
+        }
+    if ( ret )
+        {
+        if ( iMedia->IsSupported( KMPXMediaGeneralType ) )
+            {
+            media->SetTObjectValueL<TInt>(
+                KMPXMediaGeneralType,
+                *iMedia->Value<TInt>( KMPXMediaGeneralType ) );
+            }
+
+        if ( iMedia->IsSupported( KMPXMediaGeneralCategory ) )
+            {
+            media->SetTObjectValueL<TInt>(
+                KMPXMediaGeneralCategory,
+                *iMedia->Value<TInt>( KMPXMediaGeneralCategory ) );
+            }
+
+        if ( iMedia->IsSupported( KMPXMediaGeneralId ) )
+            {
+            TMPXItemId id( iMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+            media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+            }
+
+        if ( iMedia->IsSupported( KMPXMediaGeneralCollectionId ) )
+            {
+            media->SetTObjectValueL<TUid>(
+                KMPXMediaGeneralCollectionId,
+                *iMedia->Value<TUid>( KMPXMediaGeneralCollectionId ) );
+            }
+
+        media->SetTextValueL(
+            KMPXMediaMusicAlbumArtFileName, aFileName );
+
+        }
+    else // Broken link, cannot ben saved
+        {
+        CleanupStack::PopAndDestroy( media );
+        media = NULL;
+        }
+
+    iAlbumArtChanged = !aIsRestore;
+    return media; // ownership transferred
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::SaveMultipleMediaL
+// Saves multiple media.
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::SaveMultipleMediaL( TBool aIsRestore )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::SaveMultipleMediaL" );
+    TInt currentAlbumArtIndex = iMediaArray->Count();
+
+    CMPXMediaArray* setArray( CMPXMediaArray::NewL() );
+    CleanupStack::PushL( setArray );
+    for ( TInt i = 0; i < currentAlbumArtIndex && iIsSaving; i++ )
+        {
+        delete iMedia;
+        iMedia = NULL;
+        CMPXMedia* origMedia( iMediaArray->AtL( i ) );
+        iMedia = CMPXMedia::NewL( *origMedia );
+        if ( iNewFileName )
+            {
+            MPX_DEBUG2( "CMPXAlbumArtEditorDialog::SaveMultipleMediaL setting %d", i );
+            CMPXMedia* media = SaveMediaLC( *iNewFileName, aIsRestore );
+            if( media )
+                {
+                setArray->AppendL( *media );
+                CleanupStack::PopAndDestroy();
+                }
+            }
+        else
+            {
+            const TDesC& originalAlbumArtFileName =
+                iMedia->ValueText( KMPXMediaMusicOriginalAlbumArtFileName );
+            MPX_DEBUG2( "CMPXAlbumArtEditorDialog::SaveMultipleMediaL restoring %d", i );
+            CMPXMedia* media = SaveMediaLC( originalAlbumArtFileName, aIsRestore );
+            if( media )
+                {
+                setArray->AppendL( *media );
+                CleanupStack::PopAndDestroy();
+                }
+            }
+            }
+    // Save the list of changes
+    //
+    if( setArray->Count() > 0 )
+        {
+        CMPXMedia* groupMedia( CMPXMedia::NewL() );
+        CleanupStack::PushL( groupMedia );
+        groupMedia->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup);
+        groupMedia->SetCObjectValueL<CMPXMediaArray>(KMPXMediaArrayContents, setArray );
+        CMPXMedia* first( setArray->AtL( 0 ) );
+        TUid colId( first->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId) );
+        groupMedia->SetTObjectValueL<TUid>( KMPXMediaGeneralCollectionId, colId );
+        DoSetCollectionL( groupMedia, EFalse );
+        CleanupStack::PopAndDestroy( groupMedia );
+        }
+    CleanupStack::PopAndDestroy( setArray );
+
+    if ( iInvalidFileExist )
+        {
+        if ( !aIsRestore )
+            {
+            // if it's a change operation and nothing is changed
+            iAlbumArtChanged = EFalse;
+            }
+        // all songs are invalid, show note right now instead
+        // there will be no callback from collection
+        MPX_DEBUG1("CMPXAlbumArtEditorDialog::SaveMultipleMediaL DoHandleOperationCompleteL");
+        DoHandleOperationCompleteL( KErrNone );
+        }
+    MPX_DEBUG2( "CMPXAlbumArtEditorDialog::SaveMultipleMediaL valid count = %d", currentAlbumArtIndex  );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::DoHandleOperationCompleteL
+// Handle save operation complete.
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::DoHandleOperationCompleteL( TInt aError )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::DoHandleOperationCompleteL" );
+    iCurrentAlbumArtIndex = KErrNotFound;
+    iIsSaving = EFalse;
+    iCommonUiHelper->DismissWaitNoteL();
+    if (( aError == KErrNone ) && (!iInvalidFileExist ))
+        {
+        if (iAlbumArtMode == EMPXModeTracksView )
+            {
+            if (iMedia )
+                {
+                if (iNewFileName )
+                    {
+                    iMedia->SetTextValueL (KMPXMediaMusicAlbumArtFileName,
+                            *iNewFileName );
+                    }
+                else
+                    {
+                    const TDesC& originalAlbumArtFileName =
+                     iMedia->ValueText ( KMPXMediaMusicOriginalAlbumArtFileName );
+                    iMedia->SetTextValueL (KMPXMediaMusicAlbumArtFileName,
+                            originalAlbumArtFileName );
+                    }
+                }
+            }
+        else
+            {
+            if (iMediaArray )
+                {
+                TInt currentAlbumArtIndex = iMediaArray->Count ( );
+
+                for (TInt i = 0; i < currentAlbumArtIndex && iIsSaving; i++ )
+                    {
+                    delete iMedia;
+                    iMedia = NULL;
+                    CMPXMedia* origMedia( iMediaArray->AtL ( i ));
+                    iMedia = CMPXMedia::NewL ( *origMedia );
+                    if ( iNewFileName )
+                        {
+                        iMedia->SetTextValueL (KMPXMediaMusicAlbumArtFileName,
+                                *iNewFileName );
+                        }
+                    else
+                        {
+                        const TDesC& originalAlbumArtFileName =
+                         iMedia->ValueText ( KMPXMediaMusicOriginalAlbumArtFileName );
+                        iMedia->SetTextValueL (KMPXMediaMusicAlbumArtFileName,
+                                originalAlbumArtFileName );
+                        }
+                    }
+                }
+            }
+        }
+    MPX_DEBUG2( "CMPXAlbumArtEditorDialog::DoHandleOperationCompleteL iOpCanceled = %d", iOpCanceled );
+    if ( aError == KErrNone )
+        {
+        if ( !iOpCanceled )
+            {
+            HBufC* string = NULL;
+            if ( iInvalidFileExist )
+                {
+                if ( iNewFileName )
+                    {
+                    // new filename is defined, albumart change
+                    // invalid file exist
+                    string = StringLoader::LoadLC(
+                        R_MPX_QTN_NMP_NOTE_CHANGE_WITH_INVALID );
+                    }
+                else
+                    {
+                    // new file name not defined, albumart restore
+                    // invalid file exist
+                    string = StringLoader::LoadLC(
+                        R_MPX_QTN_NMP_NOTE_RESTORE_WITH_INVALID );
+                    }
+                iCommonUiHelper->DisplayInfoNoteL( *string );
+                }
+            else
+                {
+                if ( iNewFileName )
+                    {
+                    // new filename is defined, albumart change
+                    string = StringLoader::LoadLC(
+                        R_MPX_QTN_NMP_NOTE_ART_CHANGED );
+                    }
+                else
+                    {
+                    // new file name not defined, albumart restore
+                    string = StringLoader::LoadLC(
+                        R_MPX_QTN_NMP_NOTE_ART_RESTORED );
+                    }
+                iCommonUiHelper->DisplayConfirmNoteL( *string );
+                }
+            CleanupStack::PopAndDestroy( string );
+            }
+        }
+    else
+        {
+        iCommonUiHelper->HandleErrorL( aError );
+        }
+    iOpCanceled = EFalse;
+    iCurrentFindAllLOp = EMPXOpFindAllLIdle;
+    LoadAlbumArtL( ETrue );
+    }
+
+// -----------------------------------------------------------------------------
+// Handle collection message
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::DoHandleCollectionMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::DoHandleCollectionMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        MPX_DEBUG2( "CMPXAlbumArtEditorDialog::DoHandleCollectionMessageL Event = %d", event );
+        if ( event == TMPXCollectionMessage::EItemChanged )
+            {
+            if ( iOpCanceled )
+                {
+                DoHandleOperationCompleteL( KErrNone );
+                }
+            }
+        else if ( KMPXMessageIdItemChanged == id )
+            {
+            if ( !iIsSaving )
+                {
+                // ignore all the item change events when saving
+                LoadAlbumArtL( ETrue );
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::DoSetCollectionL
+// Perform a set operation
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::DoSetCollectionL( CMPXMedia* aMedia, TBool aSync )
+    {
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+
+    cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet );
+    cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, aSync );
+    TUid colId( aMedia->ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId ) );
+    cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid );
+    cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColSetMedia, aMedia );
+
+    iCollectionUtility->Collection().CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::AppendCommonAttributes
+// Appends the common attributes to attributes array
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::AppendCommonAttributes(
+    RArray<TMPXAttribute>& aAryAttribute )
+    {
+    aAryAttribute.Append(
+        TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri
+        | EMPXMediaGeneralType | EMPXMediaGeneralCategory
+        | EMPXMediaGeneralId | EMPXMediaGeneralCollectionId
+        | EMPXMediaGeneralFlags ) );
+    aAryAttribute.Append( TMPXAttribute( KMPXMediaIdMusic,
+        EMPXMediaMusicAlbumArtFileName |
+        EMPXMediaMusicOriginalAlbumArtFileName ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::HandleAlbumArtEventL
+// Handle album art events
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::HandleAlbumArtEventL(
+    TMPXAlbumArtEvents /*aEvent*/, TInt aError )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::HandleAlbumArtEventL" );
+    if ( aError != KErrNone && iAlbumArtMode != EMPXModeTracksView )
+        {
+        // continue to extract next album art if current one is not found
+        ExtractMultipleAlbumArtL();
+        }
+    else
+        {
+        MPX_DEBUG2( "CMPXAlbumArtEditorDialog::HandleAlbumArtEventL extract Error = %d", aError );
+        iCommonUiHelper->DismissWaitNoteL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::HandleFindAllL
+// Handle callback for "find" operation
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::HandleFindAllL(
+    const CMPXMedia& aResults,
+    TBool /*aComplete*/,
+    TInt aError )
+    {
+    MPX_DEBUG2( "-->CMPXAlbumArtEditorDialog::HandleFindAllL Error = %d", aError );
+    switch ( iCurrentFindAllLOp )
+        {
+        case EMPXOpFindAllLGetAlbumArtInfo:
+            {
+            if ( aError == KErrNone )
+                {
+                delete iMediaArray;
+                iMediaArray= NULL;
+                CMPXMediaArray* mediaAry( aResults.Value<CMPXMediaArray>( KMPXMediaArrayContents ) );
+                if (!mediaAry )
+                    {
+                    iCommonUiHelper->DismissWaitNoteL();
+                    User::Leave(KErrNoMemory);
+                    }
+                iMediaArray = CMPXMediaArray::NewL( *mediaAry );
+                if ( iMediaArray )
+                    {
+                    TInt count = iMediaArray->Count();
+                    for ( TInt i = 0; i < count && !iAlbumArtChanged; i++ )
+                        {
+                        // check if album art has changed
+                        CMPXMedia* media = iMediaArray->AtL( i );
+                        const TDesC& albumArtFileName =
+                            media->ValueText( KMPXMediaMusicAlbumArtFileName );
+                        if ( albumArtFileName.Length() > 0 )
+                            {
+                            if ( albumArtFileName.Compare( media->ValueText(
+                                KMPXMediaMusicOriginalAlbumArtFileName ) ) != 0 )
+                                {
+                                iAlbumArtChanged = ETrue;
+                                }
+                            }
+                        }
+                    iCurrentAlbumArtIndex = 0;
+                    ExtractMultipleAlbumArtL();
+                    iCurrentFindAllLOp = EMPXOpFindAllLIdle;
+                    return;
+                    }
+                }
+            iCommonUiHelper->DismissWaitNoteL();
+            break;
+            }
+        case EMPXOpFindAllLGetTrackArtInfo:
+            {
+            CMPXMediaArray* tempArray =
+                aResults.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+            if (!tempArray )
+                {
+                iCommonUiHelper->DismissWaitNoteL();
+                User::Leave (KErrNoMemory );
+                }
+            if ( tempArray->Count() == 1 )
+                {
+                delete iMedia;
+                iMedia = NULL;
+                CMPXMedia* origMedia( tempArray->AtL( 0 ) );
+                iMedia = CMPXMedia::NewL( *origMedia );
+                const TDesC& albumArtFileName =
+                    iMedia->ValueText( KMPXMediaMusicAlbumArtFileName );
+                if ( albumArtFileName.Length() > 0 )
+                    {
+                    if ( albumArtFileName.Compare(
+                        iMedia->ValueText( KMPXMediaMusicOriginalAlbumArtFileName ) ) == 0 )
+                        {
+                        iAlbumArtChanged = EFalse;
+                        }
+                    else
+                        {
+                        iAlbumArtChanged = ETrue;
+                        }
+                    }
+                ExtractAlbumArtL( *iMedia );
+                }
+            else
+                {
+                MPX_DEBUG2( "CMPXAlbumArtEditorDialog::HandleFindAllL invalid array length %d", tempArray->Count() );
+                iCommonUiHelper->DismissWaitNoteL();
+                }
+            break;
+            }
+        default:
+            {
+            MPX_DEBUG2( "CMPXAlbumArtEditorDialog::HandleFindAllL unknown op %d", iCurrentFindAllLOp );
+            iCommonUiHelper->DismissWaitNoteL();
+            break;
+            }
+        }
+    iCurrentFindAllLOp = EMPXOpFindAllLIdle;
+    MPX_DEBUG1( "<--CMPXAlbumArtEditorDialog::HandleFindAllL" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::ProcessCommandL
+// Act on the menu selection if menu is showing.
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::ProcessCommandL( TInt aCommandId )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::ProcessCommandL" );
+    CAknDialog::ProcessCommandL( aCommandId );
+    if ( MenuShowing() )
+        {
+        HideMenu();
+        }
+    DoProcessCommandL( aCommandId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::CreateCustomControlL
+// Creates a Custom Control for the dialog.
+// -----------------------------------------------------------------------------
+//
+SEikControlInfo CMPXAlbumArtEditorDialog::CreateCustomControlL(
+    TInt aControlType )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::CreateCustomControlL" );
+    SEikControlInfo controlInfo;
+    controlInfo.iControl = NULL;
+    controlInfo.iTrailerTextId = 0;
+    controlInfo.iFlags = 0;
+
+    switch (aControlType)
+        {
+        case EMPXAlbumArtEditorDlg:
+            {
+            controlInfo.iControl = new ( ELeave )
+                CMPXAlbumArtEditorCustomControlContainer;
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    return controlInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::PreLayoutDynInitL
+// Initialises the dialog's controls before the dialog is sized and layed out.
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::PreLayoutDynInitL()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::PreLayoutDynInitL" );
+
+    // determine current mode
+    GetCurrentModeL();
+
+    AknLayoutUtils::LayoutMetricsRect(
+            AknLayoutUtils::EMainPane, iModRect );
+
+    CMPXAlbumArtEditorCustomControlContainer *control1 =
+        ( CMPXAlbumArtEditorCustomControlContainer* ) ControlOrNull (
+            EMPXAlbumArtEditorDlgCtrlId );
+    CMPXAlbumArtEditorDialogCustomControl *control = NULL;
+
+    if ( control1 )
+        {
+        control = CMPXAlbumArtEditorDialogCustomControl::NewL(
+            *control1, iModRect, this );
+        control1->iDialogCustomControl = control;
+        GetAlbumArtEditorDialogCustomControl()->MakeVisible( ETrue );
+        }
+
+    BackupPreviousStatusPaneL();
+
+    // Set new title pane
+    HBufC* title = StringLoader::LoadLC(
+        R_MPX_CUI_COLLECTION_ALBUM_ART_DIALOG_TITLE );
+    iTitlePane->SetTextL( *title );
+    CleanupStack::PopAndDestroy( title );
+
+    TSize size( iModRect.Width() - KMPXAlbumArtBorder,
+        iModRect.Height() - KMPXAlbumArtBorder );
+    CAknDialog::PreLayoutDynInitL();
+    iAvkonAppUi->AddToStackL( this );
+
+    HBufC* string = StringLoader::LoadLC( R_MPX_QTN_NMP_NOTE_OPENING );
+    // display waiting note
+    iCommonUiHelper->ShowWaitNoteL( *string, R_AVKON_SOFTKEYS_EMPTY,
+        EFalse, this );
+    CleanupStack::PopAndDestroy( string );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::OkToExitL
+// This function ALWAYS returns ETrue.
+// -----------------------------------------------------------------------------
+//
+TBool CMPXAlbumArtEditorDialog::OkToExitL( TInt aButtonId )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::OkToExitL" );
+    if ( iFetchingPicture )
+       {
+       return EFalse;
+       }
+    TBool retVal = EFalse;
+    switch (aButtonId)
+        {
+        case EAknSoftkeyBack:
+            {
+            retVal = ETrue;
+            break;
+            }
+        case EAknSoftkeyOk:
+            {
+            // middle softkey should not dismiss dialog
+            retVal = EFalse;
+            break;
+            }
+         case EAknSoftkeyChange:
+            {
+             DoProcessCommandL(EMPXCmdAlbumArtEditorDlgChange);
+             break;
+             }
+        default:
+            {
+            retVal = CAknDialog::OkToExitL( aButtonId );
+            break;
+            }
+        }
+    if (retVal) // if dialog is dismissed
+        {
+        RestorePreviousStatusPaneL();
+        }
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::DynInitMenuPaneL
+// Dynamically initialises a menu pane.
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::DynInitMenuPaneL(
+     TInt aResourceId,
+     CEikMenuPane* aMenuPane )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::DynInitMenuPaneL" );
+    if ( aResourceId == R_MPX_CUI_ALBUM_ART_DIALOG_MENU )
+        {
+        aMenuPane->SetItemDimmed( EAknCmdExit, ETrue ); 
+        TInt usbUnblockingStatus;
+        RProperty::Get( KMPXViewPSUid,
+                        KMPXUSBUnblockingPSStatus, 
+                        usbUnblockingStatus );
+
+        if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+            {
+            aMenuPane->SetItemDimmed( EMPXCmdAlbumArtEditorDlgChange, ETrue );
+            aMenuPane->SetItemDimmed( EMPXCmdAlbumArtEditorDlgRestore, ETrue );
+            }
+        if ( !iAlbumArtChanged )
+            {
+            aMenuPane->SetItemDimmed( EMPXCmdAlbumArtEditorDlgRestore, ETrue );
+            }
+        }
+    CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::DoProcessCommandL
+// Process menu command.
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::DoProcessCommandL( TInt aCommandId )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::DoProcessCommandL" );
+    switch ( aCommandId )
+        {
+        case EMPXCmdAlbumArtEditorDlgChange:
+            {
+            // Renders Image Selection Query
+            CMPXAlbumArtEditorDialogImageThumbnailUtil* thumbnailCmd =
+                CMPXAlbumArtEditorDialogImageThumbnailUtil::NewL();
+            CleanupStack::PushL( thumbnailCmd );
+            CDesCArray* selectedFile = new ( ELeave ) CDesCArrayFlat( 1 );
+            CleanupStack::PushL( selectedFile );
+            // selectedFile includes the pathname to the img
+            // Check if any img is selected
+            iFetchingPicture = ETrue; // Set the flag for async retrieval
+            TBool fecthOK( EFalse );
+            TRAP_IGNORE( fecthOK = thumbnailCmd->FetchThumbnailL( *selectedFile ) )
+            iFetchingPicture = EFalse; // Now we can safely process events
+			// Restore dialog size
+			AknLayoutUtils::LayoutMetricsRect(
+				AknLayoutUtils::EMainPane, iModRect );
+			CMPXAlbumArtEditorCustomControlContainer *control =
+				( CMPXAlbumArtEditorCustomControlContainer* )
+				ControlOrNull ( EMPXAlbumArtEditorDlgCtrlId );
+			if( control )
+				{
+				control->SetRect( iModRect );
+				control->iDialogCustomControl->SetRect( iModRect );
+				SetRect(iModRect);
+				}
+
+            if ( fecthOK )
+                {
+                TInt err = KErrNone;
+                if ( iAlbumArtMode != EMPXModeTracksView )
+                    {
+                    // show confirmation in album level
+                    CAknQueryDialog* confirmationDlg = CAknQueryDialog::NewL();
+                    CleanupStack::PushL( confirmationDlg );
+
+                    HBufC* promptTxt = StringLoader::LoadLC(
+                        R_MPX_CUI_CHANGE_ALBUM_ART_CONFIRMATION );
+
+                    confirmationDlg->SetPromptL( *promptTxt );
+                    CleanupStack::PopAndDestroy( promptTxt );
+                    CleanupStack::Pop( confirmationDlg );
+
+                    if ( !confirmationDlg->ExecuteLD(
+                        R_MPX_CUI_RESTORE_ALBUM_ART_CONFIRMATION_QUERY ) )
+                        {
+                        err = KErrCancel;
+                        }
+                    }
+                if ( err == KErrNone )
+                    {
+                    HBufC* string = StringLoader::LoadLC(
+                        R_MPX_QTN_NMP_NOTE_ADDING_ALBUM_ART );
+                    // display waiting note
+                    iCommonUiHelper->ShowWaitNoteL( *string,
+                        R_MPX_WAITNOTE_SOFTKEYS_EMPTY_STOP, EFalse, this );
+                    CleanupStack::PopAndDestroy( string );
+                    string = NULL;
+                    const TDesC& fileName = selectedFile->MdcaPoint( 0 );
+                    delete iNewFileName;
+                    iNewFileName = NULL;
+                    iNewFileName = fileName.AllocL();
+                    iInvalidFileExist = EFalse;
+                    if ( iMediaArray )
+                        {
+                        iIsSaving = ETrue;
+                        SaveMultipleMediaL( EFalse );
+                        }
+                    else
+                        {
+                        CMPXMedia* media = SaveMediaLC( fileName, EFalse );
+                        if( media )
+                            {
+                            DoSetCollectionL( media, EFalse );
+                            CleanupStack::PopAndDestroy( media );
+                            }
+                        }
+                    }
+                }
+            CleanupStack::PopAndDestroy( selectedFile );
+            CleanupStack::PopAndDestroy( thumbnailCmd );
+            break;
+            }
+        case EMPXCmdAlbumArtEditorDlgRestore:
+            {
+            TInt err = KErrNone;
+            if ( iAlbumArtMode != EMPXModeTracksView )
+                {
+                // show confirmation in album level
+                CAknQueryDialog* confirmationDlg = CAknQueryDialog::NewL();
+                CleanupStack::PushL( confirmationDlg );
+
+                HBufC* promptTxt = StringLoader::LoadLC(
+                    R_MPX_CUI_RESTORE_ALBUM_ART_CONFIRMATION );
+
+                confirmationDlg->SetPromptL( *promptTxt );
+                CleanupStack::PopAndDestroy( promptTxt );
+                CleanupStack::Pop( confirmationDlg );
+
+                if ( !confirmationDlg->ExecuteLD(
+                    R_MPX_CUI_RESTORE_ALBUM_ART_CONFIRMATION_QUERY ) )
+                    {
+                    err = KErrCancel;
+                    }
+                }
+            if ( err == KErrNone )
+                {
+                HBufC* string = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_NOTE_RESTORING_ALBUM_ART );
+                // display waiting note
+                iCommonUiHelper->ShowWaitNoteL( *string,
+                    R_MPX_WAITNOTE_SOFTKEYS_EMPTY_STOP, EFalse, this );
+                CleanupStack::PopAndDestroy( string );
+                string = NULL;
+                delete iNewFileName;
+                iNewFileName = NULL;
+                iInvalidFileExist = EFalse;
+                if ( iMediaArray )
+                    {
+                    // save for all songs
+                    iIsSaving = ETrue;
+                    SaveMultipleMediaL( ETrue );
+                    }
+                else
+                    {
+                    // Everything ok, now the original album art can be restored
+                    const TDesC& originalAlbumArtFileName =
+                        iMedia->ValueText( KMPXMediaMusicOriginalAlbumArtFileName );
+                    CMPXMedia* media = SaveMediaLC( originalAlbumArtFileName, ETrue );
+                    if( media )
+                        {
+                        DoSetCollectionL( media, EFalse );
+                        CleanupStack::PopAndDestroy( media );
+                        }
+                    }
+                }
+            break;
+            }
+        case EMPXCmdAlbumArtEditorDlgHelp:
+            {
+            TCoeHelpContext helpContext;
+            GetHelpContext( helpContext );
+
+            CArrayFixFlat<TCoeHelpContext>* array =
+                new(ELeave)CArrayFixFlat<TCoeHelpContext>( 1 );
+
+            CleanupStack::PushL( array );
+            array->AppendL( helpContext );
+            CleanupStack::Pop(); // array
+
+            // HlpLauncher deletes array
+            HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), array );
+            break;
+            }
+        case EAknCmdExit:
+            {
+            static_cast<MEikCommandObserver*>(iEikonEnv->EikAppUi())->
+                ProcessCommandL(aCommandId);
+            }
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::CountComponentControls
+// Counts the number of components.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAlbumArtEditorDialog::CountComponentControls() const
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::CountComponentControls" );
+    TInt newitems = 0;
+    if ( GetAlbumArtEditorDialogCustomControl() ) newitems++;
+    return CAknDialog::CountComponentControls() + newitems;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::ComponentControl
+// Returns component control.
+// -----------------------------------------------------------------------------
+//
+CCoeControl* CMPXAlbumArtEditorDialog::ComponentControl( TInt aIndex ) const
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::ComponentControl" );
+    if (aIndex == CAknDialog::CountComponentControls() )
+        {
+        return GetAlbumArtEditorDialogCustomControl();
+        }
+    return CAknDialog::ComponentControl( aIndex );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::UpdateNaviPane
+// Update the dialogs navipane.
+// -----------------------------------------------------------------------------
+//
+
+void CMPXAlbumArtEditorDialog::UpdateNaviPaneL(const TDesC& aText)
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::UpdateNaviPane" );
+
+    // Set the navi text
+    CAknNaviLabel* naviLabel = static_cast<CAknNaviLabel*>
+        ( iNaviLabelPane->DecoratedControl() );
+    naviLabel->SetTextL( aText );
+    iNaviLabelPane->DrawNow();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::GetHelpContext
+// Gets Help
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::GetHelpContext" );
+    aContext.iMajor = KAppUidMusicPlayerX;
+    aContext.iContext = KMUS_HLP_ALBUM_ART_EDITING; 
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::HandleResourceChange( TInt aType )
+    {
+    MPX_DEBUG2( "-->CMPXAlbumArtEditorDialog::HandleResourceChange type = 0x%x", aType );
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        AknLayoutUtils::LayoutMetricsRect(
+            AknLayoutUtils::EMainPane, iModRect );
+
+        CMPXAlbumArtEditorCustomControlContainer *control =
+            ( CMPXAlbumArtEditorCustomControlContainer* )
+            ControlOrNull ( EMPXAlbumArtEditorDlgCtrlId );
+        if ( control )
+            {
+            TRAP_IGNORE(
+                control->iDialogCustomControl->SetModeL(
+                CMPXAlbumArtEditorDialogCustomControl::EMPXAlbumArtEditorDialogBlank)
+                );
+            control->SetRect( iModRect );
+            control->iDialogCustomControl->SetRect( iModRect );
+            }
+        TRAP_IGNORE( LoadAlbumArtL( EFalse ) );
+        }
+    else if ( aType == KAknsMessageSkinChange )
+        {
+        CMPXAlbumArtEditorCustomControlContainer *control =
+            ( CMPXAlbumArtEditorCustomControlContainer* )
+            ControlOrNull ( EMPXAlbumArtEditorDlgCtrlId );
+        if ( control )
+            {
+            TRAP_IGNORE(
+                control->iDialogCustomControl->HandleSkinChangedL() );
+            }
+        }
+    CAknDialog::HandleResourceChange( aType );
+    MPX_DEBUG1( "<--CMPXAlbumArtEditorDialog::HandleResourceChange" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MProgressDialogCallback
+// Callback method. Get's called when a dialog is dismissed
+// ---------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialog::DialogDismissedL( TInt aButtonId )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::DialogDismissedL" );
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyCancel:
+            {
+            MPX_DEBUG1( "CMPXAlbumArtEditorDialog::DialogDismissedL canceled, sending cancel requet" );
+            // after canceling, the current request will still be completed
+            // handle the canceling in the callback
+            iCollectionUtility->Collection().CancelRequest();
+            // setup flag so that confirmation note is not displayed
+            iOpCanceled = ETrue;
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+TInt CMPXAlbumArtEditorDialog::ExtractNextAlbumArtCallBackL(TAny* aPtr)
+    {
+	static_cast<CMPXAlbumArtEditorDialog*>(aPtr)->ExtractNextAlbumArtL();
+	return KErrNone;
+    }
+
+void CMPXAlbumArtEditorDialog::ExtractNextAlbumArtL()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialog::ExtractNextAlbumArtL" );
+    if ( iCurrentAlbumArtIndex < iMediaArray->Count() )
+        {
+        MPX_DEBUG2( "CMPXAlbumArtEditorDialog::ExtractNextAlbumArtL extracting %d", iCurrentAlbumArtIndex );
+        CMPXMedia* media( iMediaArray->AtL( iCurrentAlbumArtIndex ) );
+        MPX_TRAPD( err, ExtractAlbumArtL( *media, EFalse ) );
+        iCurrentAlbumArtIndex++;
+        if (err != KErrNone)
+            {
+            iAsyncCallNext->Call();
+            }
+        }
+    else
+        {
+        // when no Album art found:
+        GetAlbumArtEditorDialogCustomControl()->SetModeL(
+            CMPXAlbumArtEditorDialogCustomControl::
+            EMPXAlbumArtEditorDialogNoAlbumArt );
+        MPX_DEBUG1( "CMPXAlbumArtEditorDialog::ExtractNextAlbumArtL show default album art" );
+        iCommonUiHelper->DismissWaitNoteL();
+        DrawDeferred();
+        }
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/src/mpxalbumarteditordialogcustomcontrol.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,380 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player album art editor dialog implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <AknUtils.h>
+#include <eiklabel.h>
+#include <StringLoader.h>
+#include <mpxalbumarteditordialog.rsg>
+#include <AknsDrawUtils.h>
+#include <AknsBasicBackgroundControlContext.h>
+#include <mpxlog.h>
+
+#include "mpxalbumarteventobserver.h"
+#include "mpxalbumarteditordialogcustomcontrol.h"
+
+// CONSTANTS
+const TInt KMPXLabelCount = 2;
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogCustomControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMPXAlbumArtEditorDialogCustomControl*
+    CMPXAlbumArtEditorDialogCustomControl::NewLC(
+    const CCoeControl& aParent,
+    const TRect &aRect,
+    MMPXAlbumArtEventObserver* aObserver )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogCustomControl::NewLC" );
+    CMPXAlbumArtEditorDialogCustomControl* self =
+        new ( ELeave ) CMPXAlbumArtEditorDialogCustomControl();
+    CleanupStack::PushL( self );
+    self->ConstructL( aParent, aRect, aObserver );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogCustomControl::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMPXAlbumArtEditorDialogCustomControl*
+    CMPXAlbumArtEditorDialogCustomControl::NewL(
+    const CCoeControl& aParent,
+    const TRect &aRect,
+    MMPXAlbumArtEventObserver* aObserver )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogCustomControl::NewL" );
+    CMPXAlbumArtEditorDialogCustomControl* self = NewLC(
+        aParent, aRect, aObserver );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// Destructor
+CMPXAlbumArtEditorDialogCustomControl::~CMPXAlbumArtEditorDialogCustomControl()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogCustomControl::~CMPXAlbumArtEditorDialogCustomControl" );
+    delete iImage;
+    delete iLabel;
+    delete iBackground;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogCustomControl::CMPXAlbumArtEditorDialogCustomControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXAlbumArtEditorDialogCustomControl::CMPXAlbumArtEditorDialogCustomControl() :
+    iLabel( NULL ), iObserver( NULL )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogCustomControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialogCustomControl::ConstructL(
+    const CCoeControl& aParent,
+    const TRect &aRect,
+    MMPXAlbumArtEventObserver* aObserver )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogCustomControl::ConstructL" );
+    SetMopParent( const_cast < CCoeControl* >( &aParent ) );
+    CreateWindowL();
+
+    iImage = new ( ELeave ) CEikImage();
+    iImage->SetContainerWindowL( *this );
+
+    iLabel = new ( ELeave ) CEikLabel;
+    iLabel->SetContainerWindowL( *this );
+    iLabel->SetTextL( _L( "" ) );
+    iLabel->MakeVisible ( EFalse );
+
+    iObserver = aObserver;
+
+    iMode = EMPXAlbumArtEditorDialogBlank;
+    SetRect( aRect );
+    HandleSkinChangedL();
+    ActivateL();
+    MakeVisible( ETrue );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogCustomControl::UpdateAlbumArt
+// Updates new image to CEikImage
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialogCustomControl::UpdateAlbumArt(
+    TMPXAlbumArtEditorDialogMode aMode,
+    CFbsBitmap* aNewAlbumArt )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogCustomControl::UpdateAlbumArt" );
+    switch ( aMode )
+        {
+        case EMPXAlbumArtEditorDialogAlbumArt:
+            {
+            iImage->SetPictureOwnedExternally( EFalse) ;
+            iImage->SetNewBitmaps( aNewAlbumArt, NULL );
+            iImage->SetSize( iImage->MinimumSize() );
+            iImage->SetPictureOwnedExternally( EFalse );
+            iImage->SetAlignment( EHCenterVCenter );
+            iImage->MakeVisible( ETrue );
+
+            TRect myRect = Rect();
+            TSize bSize = aNewAlbumArt->SizeInPixels();
+            AknLayoutUtils::LayoutImage(
+                iImage, myRect, EColor256,
+                ( myRect.Width() - bSize.iWidth ) / 2 ,
+                ( myRect.Height() - bSize.iHeight ) / 2,
+                NULL, NULL, bSize.iWidth, bSize.iHeight );
+
+            // layout border
+            TInt tX = ( myRect.Width() - bSize.iWidth ) / 2;
+            TInt tY = ( myRect.Height() - bSize.iHeight ) / 2;
+            iBorder.iTl.iX = tX - 1;
+            iBorder.iTl.iY = tY - 1;
+            iBorder.iBr.iX = tX + bSize.iWidth + 1;
+            iBorder.iBr.iY = tY + bSize.iHeight + 1;
+
+            TRAP_IGNORE( SetModeL( EMPXAlbumArtEditorDialogAlbumArt ) );
+            break;
+            }
+        default:
+            {
+            TRAP_IGNORE( SetModeL( aMode ) );
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogCustomControl::SetModeL
+// Displays image in a specific mode, either Album Art/No Album Art or Various
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialogCustomControl::SetModeL(
+    TMPXAlbumArtEditorDialogMode aMode )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogCustomControl::SetModeL" );
+    iMode = aMode;
+    switch( iMode )
+        {
+        case EMPXAlbumArtEditorDialogAlbumArt:
+            {
+            iLabel->MakeVisible( EFalse );
+            iImage->MakeVisible( ETrue );
+            DrawDeferred();
+            break;
+            }
+        case EMPXAlbumArtEditorDialogNoAlbumArt:
+            {
+            if(iImage->Bitmap())
+                {
+                iImage->MakeVisible( EFalse );
+                }
+            iLabel->MakeVisible( EFalse );
+
+            HBufC* labeltext = StringLoader::LoadLC(
+                R_MPX_CUI_ALBUM_ART_NO_ART_TEXT  );
+            iLabel->SetTextL( *labeltext );
+            CleanupStack::PopAndDestroy( labeltext );
+
+            iLabel->MakeVisible( ETrue );
+            DrawDeferred();
+            break;
+            }
+        case EMPXAlbumArtEditorDialogBlank:
+            iImage->MakeVisible( EFalse );
+            break;
+        default: // some error
+            {
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogCustomControl::HandleSkinChangedL
+// updates skin color
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialogCustomControl::HandleSkinChangedL()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogCustomControl::HandleSkinChangedL" );
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TRgb color = KRgbBlack;
+    // Color is not updated if it not found from the skin
+    AknsUtils::GetCachedColor(
+        skin,
+        color,
+        KAknsIIDQsnTextColors,
+        EAknsCIQsnTextColorsCG6 );
+
+    AknLayoutUtils::OverrideControlColorL(
+        *iLabel,
+        EColorLabelText,
+        color );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXAlbumArtUtilObserver
+// Notify that extraction of album art started.
+// ---------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialogCustomControl::ExtractAlbumArtStarted()
+    {
+    // Do Nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXAlbumArtUtilObserver
+// Album art is extracted from file and ready to use.
+// ---------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialogCustomControl::ExtractAlbumArtCompleted(
+    CFbsBitmap* aBitmap,
+    TInt aErr )
+    {
+    MPX_DEBUG3( "CMPXAlbumArtEditorDialogCustomControl::ExtractAlbumArtCompleted(bitmap:0x%x, err:%d)",
+        aBitmap, aErr );
+
+    if ( !aErr )
+        {
+        UpdateAlbumArt( EMPXAlbumArtEditorDialogAlbumArt, aBitmap );
+        }
+    else
+        {
+        // error case, do not display album art
+        UpdateAlbumArt( EMPXAlbumArtEditorDialogNoAlbumArt );
+        }
+    if ( iObserver )
+        {
+        TRAP_IGNORE (
+            iObserver->HandleAlbumArtEventL(
+                EMPXAlbumArtEventExtractCompleted, aErr ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogCustomControl::Draw
+// Draws to the display
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialogCustomControl::Draw( const TRect& aRect ) const
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogCustomControl::Draw" );
+    CWindowGc& gc = SystemGc();
+    if ( iBackground )
+        {
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+        AknsDrawUtils::DrawBackground(
+            skin,
+            iBackground,
+            this,
+            gc,
+            aRect.iTl,
+            aRect,
+            KAknsDrawParamDefault );
+        }
+    else
+        {
+        gc.Clear( aRect );
+        }
+    gc.SetClippingRect( aRect );
+    switch( iMode )
+        {
+        case EMPXAlbumArtEditorDialogAlbumArt:
+            {
+            gc.SetBrushColor( KRgbBlack );
+            gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+            gc.DrawRect( iBorder );
+            break;
+            }
+        case EMPXAlbumArtEditorDialogBlank:
+            {
+            break;
+            }
+        default: // either various of no album art
+            {
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogCustomControl::CountComponentControls
+// Returns the number of components in the container.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAlbumArtEditorDialogCustomControl::CountComponentControls() const
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogCustomControl::CountComponentControls" );
+    return KMPXLabelCount;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogCustomControl::ComponentControl
+// Returns the control given the index.
+// -----------------------------------------------------------------------------
+//
+CCoeControl* CMPXAlbumArtEditorDialogCustomControl::ComponentControl(
+    TInt aIndex ) const
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogCustomControl::ComponentControl" );
+    switch ( aIndex )
+        {
+        case 0:
+            return iImage;
+        case 1:
+            return iLabel;
+        default:
+            return NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogCustomControl::SizeChanged
+// Resizes controls.
+// -----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialogCustomControl::SizeChanged()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogCustomControl::SizeChanged" );
+    delete iBackground;
+    iBackground = NULL;
+    TRect appRect = iEikonEnv->EikAppUi()->ApplicationRect();
+    MPX_TRAPD( error,
+        iBackground = CAknsBasicBackgroundControlContext::NewL(
+            KAknsIIDQsnBgAreaMain, appRect, EFalse ) );
+    if ( error == KErrNone && iLabel )
+        {
+        TRect coeRect = Rect();
+        AknLayoutUtils::LayoutLabel( iLabel, coeRect,
+            R_MPX_CUI_ALBUM_ART_LAYOUT );
+        TRAP_IGNORE( HandleSkinChangedL() );
+        }
+     }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/albumarteditordialog/src/mpxalbumarteditordialogimagethumbnailutil.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player album art editor dialog implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include <MGFetch.h>
+#include <aknnotewrappers.h>
+
+#include <aknSDData.h>
+#include <AknMediatorFacade.h>
+#include "mplayersecondarydisplayapi.h"
+
+#include <mpxmedia.h>
+#include <mpxattribute.h>
+#include <mpxalbumarteditordialog.rsg>
+#include <mpxdrmmediautility.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxlog.h>
+
+#include "mpxalbumarteditordialogimagethumbnailutil.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogImageThumbnailUtil::NewL
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXAlbumArtEditorDialogImageThumbnailUtil*
+    CMPXAlbumArtEditorDialogImageThumbnailUtil::NewL()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogImageThumbnailUtil::NewL" );
+    CMPXAlbumArtEditorDialogImageThumbnailUtil* self = new ( ELeave )
+        CMPXAlbumArtEditorDialogImageThumbnailUtil();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogImageThumbnailUtil::~CMPXAlbumArtEditorDialogImageThumbnailUtil
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CMPXAlbumArtEditorDialogImageThumbnailUtil::
+    ~CMPXAlbumArtEditorDialogImageThumbnailUtil()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogImageThumbnailUtil::~CMPXAlbumArtEditorDialogImageThumbnailUtil" );
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogImageThumbnailUtil::FetchThumbnailL
+// Fetch thumbnail from the device
+// ----------------------------------------------------------------------------
+//
+TBool CMPXAlbumArtEditorDialogImageThumbnailUtil::FetchThumbnailL(
+    CDesCArray& aFilesArray )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogImageThumbnailUtil::FetchThumbnailL" );
+    // fetch thumbnail from media gallery
+    HBufC* title = StringLoader::LoadLC( R_MPX_CUI_ALBUM_ART_DLG_TITLE );
+
+    TBool res = MGFetch::RunL( aFilesArray, EImageFile, EFalse,
+            KNullDesC, *title, this );
+
+    CleanupStack::PopAndDestroy( title );
+    return res;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogImageThumbnailUtil::CMPXAlbumArtEditorDialogImageThumbnailUtil
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CMPXAlbumArtEditorDialogImageThumbnailUtil::
+    CMPXAlbumArtEditorDialogImageThumbnailUtil()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogImageThumbnailUtil::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXAlbumArtEditorDialogImageThumbnailUtil::ConstructL()
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogImageThumbnailUtil::ConstructL" );
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialogImageThumbnailUtil::VerifySelectionL
+// Verify thumbnail selection
+// ----------------------------------------------------------------------------
+//
+TBool CMPXAlbumArtEditorDialogImageThumbnailUtil::VerifySelectionL(
+    const MDesCArray* aSelectedFiles )
+    {
+    MPX_FUNC( "CMPXAlbumArtEditorDialogImageThumbnailUtil::VerifySelectionL" );
+    TBool result = ETrue;
+
+    if ( aSelectedFiles && aSelectedFiles->MdcaCount() > 0 )
+        {
+        // DRM for phonebook thumbnail fetch
+        TPtrC fileName = aSelectedFiles->MdcaPoint( 0 );
+        CMPXDrmMediaUtility* drmUtil = CMPXDrmMediaUtility::NewLC();
+        drmUtil->InitL( fileName );
+
+        const CMPXMedia* media = drmUtil->GetMediaL( EMPXMediaDrmProtected );
+        if ( media )
+            {
+            if ( media->IsSupported( KMPXMediaDrmProtected ) )
+                {
+                TBool isProtected( media->ValueTObjectL<TBool>(
+                    KMPXMediaDrmProtected ) );
+                if ( isProtected )
+                    {
+                    // show user copyright note
+                    HBufC* prompt = StringLoader::LoadLC( R_MPX_QTN_MP_DRM_NOT_ALLOWED );
+                    CAknInformationNote* dlg = new( ELeave ) CAknInformationNote( ETrue );
+                    CleanupStack::PushL(dlg);
+                    dlg->PublishDialogL( EMPlayerNoteDrmNotAllowed, KMPlayerNoteCategory );
+                    CleanupStack::Pop(dlg);
+                    dlg->ExecuteLD( *prompt );
+                    CleanupStack::PopAndDestroy( prompt );
+                    result = EFalse;
+                    }
+                }
+            }
+        CleanupStack::PopAndDestroy( drmUtil );
+        }
+    return result;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/bwinscw/mpxaudioeffectsviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewL@CMPXAudioEffectsView@@SAPAV1@XZ @ 1 NONAME ; class CMPXAudioEffectsView * CMPXAudioEffectsView::NewL(void)
+	?NewLC@CMPXAudioEffectsView@@SAPAV1@XZ @ 2 NONAME ; class CMPXAudioEffectsView * CMPXAudioEffectsView::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/data/mpxaudioeffectsview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,392 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxaudioeffectsview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME  MXAV // 4 letter ID
+
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <avkon.mbg>
+#include <eikon.rh>
+
+#include "mpxaudioeffects.hrh"
+#include <mpxaudioeffects.loc>
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    { 
+    buf = "ms"; 
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_audioeffects_softkeys_options_change_back
+// CBA for Audio Effects view.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_audioeffects_softkeys_options_change_back
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; },
+        CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent; txt=qtn_msk_change; }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffects_settingslist_view
+// Audio Effects view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_audioeffects_settingslist_view
+    {
+    menubar = r_audioeffects_settingslist_menu_bar;  
+    cba = r_audioeffects_softkeys_options_change_back;  
+    }
+#else
+// ---------------------------------------------------------------------------
+// r_audioeffects_settingslist_view
+// Audio Effects view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_audioeffects_settingslist_view
+    {
+    menubar = r_audioeffects_settingslist_menu_bar;  
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;  
+    }
+#endif // __ENABLE_MSK
+
+// ---------------------------------------------------------------------------
+// r_audioeffect_caption_text
+// Title for Audio Effects view.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_audioeffect_caption_text
+    { 
+    buf = qtn_nmp_audioeffects; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffects_settingslist_menu_bar
+// Audio Effects view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_audioeffects_settingslist_menu_bar
+    {
+    titles=
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_audioeffects_settingslist_menu_pane;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffects_settingslist_menu_pane
+// Audio Effects view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_audioeffects_settingslist_menu_pane
+    {
+    items =
+        {
+#ifndef SINGLE_CLICK_INCLUDED
+        MENU_ITEM
+            {
+            command = ESettingsListCmdChange;
+            txt = qtn_options_change;
+            },
+#endif
+        MENU_ITEM
+            {
+            command = ESettingsListCmdHelp;
+            txt = qtn_options_help;
+            }
+             ,
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffects_setting_item_list
+// Audio Effects view setting items list.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_ITEM_LIST r_audioeffects_setting_item_list
+    {
+    flags = EAknSettingItemIncludeHiddenInOrdinal;
+    items =
+        {
+        //balance
+        AVKON_SETTING_ITEM
+            {
+            identifier = EBalanceSettingItem;
+            setting_page_resource = r_balance_setting_page;
+            name = qtn_nmp_balance;
+            },
+        //Loudness
+        AVKON_SETTING_ITEM
+            {
+            identifier = ELoudnessItem;
+            setting_page_resource = r_loudness_setting_page;
+            associated_resource = r_settingslist_hints_popup_setting_texts;
+            name = qtn_nmp_loudness;
+            },
+        //stereo widening
+        AVKON_SETTING_ITEM
+            {
+            identifier = EStereoWideningSettingItem;
+            setting_page_resource = r_stereowidening_setting_page;
+            associated_resource = r_settingslist_hints_popup_setting_texts;
+            name = qtn_nmp_stereowidening;
+            }        
+        };
+    }
+  
+
+// BALANCE
+
+// ---------------------------------------------------------------------------
+// r_balance_setting_page
+// Audio Effects view balance setting page.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_balance_setting_page
+    {
+    label = qtn_nmp_balance;
+    type = EAknCtSlider;
+    editor_resource_id = r_settingslist_balance_slider;
+    }
+
+// ---------------------------------------------------------------------------
+// r_settingslist_balance_slider
+// Audio Effects view balance slider.
+// ---------------------------------------------------------------------------
+//
+RESOURCE SLIDER r_settingslist_balance_slider
+    {
+    layout = EAknSettingsItemSliderLayout;
+    minvalue = -100;  
+    maxvalue = 100;
+    step = 25;
+    valuetype = EAknSliderValueNone;
+    minlabel = qtn_nmp_balance_left;
+    maxlabel = qtn_nmp_balance_right;
+    }
+
+// LOUDNESS
+
+// ---------------------------------------------------------------------------
+// r_loudness_setting_page
+// Audio Effects view loudness setting page.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_loudness_setting_page
+    { 
+    label= HINTS_SETTING_ITEM_TITLE;
+    type = EAknCtPopupSettingList;
+    editor_resource_id = r_settingslist_common_use_popup_setting_list;
+    }
+
+  
+// STEREO WIDENING
+
+// ---------------------------------------------------------------------------
+// r_stereowidening_setting_page
+// Audio Effects view stereo widening setting page.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_SETTING_PAGE r_stereowidening_setting_page
+    { 
+    label= HINTS_SETTING_ITEM_TITLE;
+    type = EAknCtPopupSettingList;
+    editor_resource_id = r_settingslist_common_use_popup_setting_list;
+    }
+
+// ---------------------------------------------------------------------------
+// r_settingslist_common_use_popup_setting_list
+// Audio Effects view common use popup setting list.
+// ---------------------------------------------------------------------------
+//
+RESOURCE POPUP_SETTING_LIST r_settingslist_common_use_popup_setting_list
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// r_settingslist_hints_popup_setting_texts
+// Audio Effects view hints popup setting texts.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_POPUP_SETTING_TEXTS r_settingslist_hints_popup_setting_texts
+    {
+    setting_texts_resource = r_settingslist_hints_texts;
+    popped_up_texts_resource = r_settingslist_hints_popup_texts;
+    }
+
+// ---------------------------------------------------------------------------
+// r_settingslist_hints_texts
+// Audio Effects view hints texts.
+// ---------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_settingslist_hints_texts
+    {
+    items =
+        {
+        AVKON_ENUMERATED_TEXT 
+            { 
+            value = 1; 
+            text = qtn_nmp_on; 
+            },
+        AVKON_ENUMERATED_TEXT 
+            { 
+            value = 0; 
+            text = qtn_nmp_off; 
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_settingslist_hints_popup_texts
+// Audio Effects view hints popup texts.
+// ---------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_settingslist_hints_popup_texts
+    {
+    items =
+        {
+        LBUF 
+            { 
+            txt = qtn_nmp_on;
+            },
+        LBUF 
+            { 
+            txt = qtn_nmp_off;
+            }
+        };
+    }
+
+
+// BALANCE
+
+// Balance settings page text
+
+// ---------------------------------------------------------------------------
+// r_audioeffect_balance_left100
+// Audio Effects view balance left 100 text.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_audioeffect_balance_left100
+    { 
+    buf = qtn_nmp_balance_left100; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffect_balance_left75
+// Audio Effects view balance left 75 text.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_audioeffect_balance_left75
+    { 
+    buf = qtn_nmp_balance_left75; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffect_balance_left50
+// Audio Effects view balance left 50 text.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_audioeffect_balance_left50
+    {
+    buf = qtn_nmp_balance_left50; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffect_balance_left25
+// Audio Effects view balance left 25 text.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_audioeffect_balance_left25
+    {
+    buf = qtn_nmp_balance_left25; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffect_balance_center
+// Audio Effects view balance center text.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_audioeffect_balance_center
+    { 
+    buf = qtn_nmp_balance_centre; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffect_balance_right25
+// Audio Effects view balance right 25 text.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_audioeffect_balance_right25
+    {
+    buf = qtn_nmp_balance_right25; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffect_balance_right50
+// Audio Effects view balance right 50 text.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_audioeffect_balance_right50
+    {
+    buf = qtn_nmp_balance_right50; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffect_balance_right75
+// Audio Effects view balance right 75 text.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_audioeffect_balance_right75
+    { 
+    buf = qtn_nmp_balance_right75; 
+    }
+
+// ---------------------------------------------------------------------------
+// r_audioeffect_balance_right100
+// Audio Effects view balance right 100 text.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_audioeffect_balance_right100
+    { 
+    buf = qtn_nmp_balance_right100; 
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/data/reverb.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,599 @@
+"Alley"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     86 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   1490 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+  -1204 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+      7 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     11 # iReverbDelay
+     60 # iReverbDelayMax
+     -4 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -270 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Arena"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     33 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   7240 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+  -1166 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+     20 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     30 # iReverbDelay
+     60 # iReverbDelayMax
+     16 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -698 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Auditorium"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     59 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   4320 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+   -789 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+     20 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     30 # iReverbDelay
+     60 # iReverbDelayMax
+   -289 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -476 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Bathroom"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     54 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   1490 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+     60 # iDensity
+    100 # iDiffusion
+   -370 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+      7 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     11 # iReverbDelay
+     60 # iReverbDelayMax
+   1030 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+  -1200 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Cave"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+    130 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   2910 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+   -602 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+     15 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     22 # iReverbDelay
+     60 # iReverbDelayMax
+   -302 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+      0 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"City"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     67 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   1490 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+     50 # iDiffusion
+  -2273 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+      7 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     11 # iReverbDelay
+     60 # iReverbDelayMax
+  -2217 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -800 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Concert hall"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     70 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   3920 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+  -1230 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+     20 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     29 # iReverbDelay
+     60 # iReverbDelayMax
+     -2 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -500 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Forest"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     54 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   1490 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+     79 # iDiffusion
+  -2560 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+     50 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     10 # iReverbDelay
+     60 # iReverbDelayMax
+   -613 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+  -3300 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Hallway"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     59 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   1490 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+  -1219 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+      7 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     11 # iReverbDelay
+     60 # iReverbDelayMax
+    441 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -300 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Hangar"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     23 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+  10050 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+   -602 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+     20 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     30 # iReverbDelay
+     60 # iReverbDelayMax
+    198 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+  -1000 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Large hall"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     70 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   2000 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+  -2500 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+     30 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     30 # iReverbDelay
+     60 # iReverbDelayMax
+  -1000 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -600 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Large room"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     83 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   1500 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+  -1600 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+     20 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     40 # iReverbDelay
+     60 # iReverbDelayMax
+  -1000 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -600 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Living room"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     10 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+    500 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+  -1376 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+      3 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+      4 # iReverbDelay
+     60 # iReverbDelayMax
+  -1104 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+  -6000 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Medium hall"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     70 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   1800 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+  -1300 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+     15 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     30 # iReverbDelay
+     60 # iReverbDelayMax
+   -800 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -600 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Medium room"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     83 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   1300 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+  -1000 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+     10 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     20 # iReverbDelay
+     60 # iReverbDelayMax
+   -200 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -600 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Mountains"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     21 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   2000 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+     27 # iDiffusion
+ -10000 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+     53 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+      7 # iReverbDelay
+     60 # iReverbDelayMax
+  -1600 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+  -2500 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Plate"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     90 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   1300 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+     75 # iDensity
+    100 # iDiffusion
+      0 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+      2 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     10 # iReverbDelay
+     60 # iReverbDelayMax
+      0 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -200 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Room"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     83 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+    400 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+  -1646 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+      2 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+      3 # iReverbDelay
+     60 # iReverbDelayMax
+     53 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -454 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Small room"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     83 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   1100 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+   -400 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+      5 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     10 # iReverbDelay
+     60 # iReverbDelayMax
+    500 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+   -600 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
+
+"Underwater"
+      0 # iEnabled
+      0 # iEnforced
+      0 # iHaveUpdateRights
+     10 # iDecayHFRatio
+     10 # iDecayHFRatioMin
+    200 # iDecayHFRatioMax
+   1490 # iDecayTime
+    100 # iDecayTimeMin
+  20000 # iDecayTimeMax
+    100 # iDensity
+    100 # iDiffusion
+   -449 # iReflectionsLevel
+ -10000 # iReflectionsLevelMin
+   1000 # iReflectionsLevelMax
+      7 # iReflectionsDelay
+     60 # iReflectionsDelayMax
+     11 # iReverbDelay
+     60 # iReverbDelayMax
+   1700 # iReverbLevel
+ -10000 # iReverbLevelMin
+   2000 # iReverbLevelMax
+  -4000 # iRoomHFLevel
+ -10000 # iRoomHFLevelMin
+      0 # iRoomHFLevelMax
+  -1000 # iRoomLevel
+ -10000 # iRoomLevelMin
+      0 # iRoomLevelMax
+     60 # iDelayMax
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/eabi/mpxaudioeffectsviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	_ZN20CMPXAudioEffectsView4NewLEv @ 1 NONAME
+	_ZN20CMPXAudioEffectsView5NewLCEv @ 2 NONAME
+	_ZTI29CMPXAudioEffectsViewContainer @ 3 NONAME ; #<TI>#
+	_ZTV29CMPXAudioEffectsViewContainer @ 4 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxaudioeffectsview.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxaudioeffects.loc	APP_LAYER_LOC_EXPORT_PATH(mpxaudioeffects.loc)
+
+PRJ_MMPFILES
+mpxaudioeffectsview.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/group/mpxaudioeffectsview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,82 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxaudioeffectsview.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+#include "../../../../../inc/musicplayerbldvariant.hrh"
+
+TARGET          mpxaudioeffectsview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC73
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+MACRO __S60_MPX_UI_SPEC_COMPLIANCE
+MACRO __ENABLE_MSK
+#ifdef IAD_INCLUDE_SINGLE_CLICK 
+MACRO SINGLE_CLICK_INCLUDED
+#endif
+
+SOURCEPATH      ../src
+SOURCE          mpxaudioeffectsview.cpp
+SOURCE          mpxaudioeffectsviewimp.cpp
+SOURCE          mpxaudioeffectsviewcontainer.cpp
+SOURCE          mpxaudioeffectsitems.cpp
+SOURCE          mpxaudioeffectsmodel.cpp
+
+START RESOURCE  ../data/mpxaudioeffectsview.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+#ifndef __S60_50__
+USERINCLUDE     ../loc
+#endif
+USERINCLUDE     ../../../inc
+USERINCLUDE     ../../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+
+LIBRARY     euser.lib
+LIBRARY     eikcoctl.lib
+LIBRARY     avkon.lib
+LIBRARY     bafl.lib
+LIBRARY     cone.lib
+LIBRARY     estor.lib
+LIBRARY     efsrv.lib
+LIBRARY     eikcore.lib
+LIBRARY     hlplch.lib
+LIBRARY     commonengine.lib
+LIBRARY     mpxplaybackutility.lib
+LIBRARY	    mpxcommon.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffects.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxaudioeffects
+*
+*/
+
+
+#ifndef MPXAUDIOEFFECTS_HRH
+#define MPXAUDIOEFFECTS_HRH
+
+//#define _HIDE_EQUALIZER		//hides equalizer in settinglist, doesn't disable the effect
+#undef _HIDE_EQUALIZER
+
+enum TMPlayerMSViewIds
+    {
+    KMPXAudioEffectsViewId = 51
+    };
+
+// Command ids
+enum 
+	{
+	ESettingsListCmdChange = 0x6000,
+	ESettingsListCmdHelp
+	};
+
+
+// Setting items
+enum TSettingsListSettingItems
+	{
+	EEqualizerSettingItem =-1,
+	EBalanceSettingItem,
+	EReverbSettingItem,
+	ELoudnessItem,
+	EStereoWideningSettingItem
+	};
+
+#endif	// MPXAUDIOEFFECTS_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffectsitems.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Setting List.
+*
+*/
+
+
+#ifndef MPXAUDIOEFFECTSITEMS_H
+#define MPXAUDIOEFFECTSITEMS_H
+
+
+// INCLUDES
+
+// SYSTEM INCLUDES
+ 
+#include <aknsettingpage.h> 
+#include <akntextsettingpage.h> 
+#include <aknsettingitemlist.h> // CAknSettingItemList
+#include <AknQueryDialog.h> 
+
+// USER INCLUDES
+#include "mpxaudioeffectsmodel.h"
+#include "mpxaudioeffects.hrh"
+
+// FORWARD DECLARATIONS
+class CAknSettingItem;
+class CAknSliderSettingPage;
+class CMPXAudioEffectsModel;
+
+// CLASS DECLARATION
+
+/**
+*
+* @class	CMPXAudioEffectsItems 
+* @brief	This is the SettingItemList class for a setting list based on the
+* standard Symbian OS architecture.    
+*/
+NONSHARABLE_CLASS(CMPXAudioEffectsItems) : public CAknSettingItemList, 
+                                           public MAknSettingPageObserver
+	{
+public: // Constructors and destructor
+
+    /**
+    *  Constructor
+    */
+	CMPXAudioEffectsItems(CMPXAudioEffectsModel* aModel);
+	
+	/**
+	* Virtual destructor
+	*/
+	virtual ~CMPXAudioEffectsItems();
+	
+private: 
+    /*
+    * From MAknSettingPageObserver
+    */
+	void HandleSettingPageEventL(CAknSettingPage* aSettingPage,
+	                             TAknSettingPageEvent aEventType);
+	
+	/*
+    * From CAknSettingItemList
+    */
+	CAknSettingItem* CreateSettingItemL(TInt identifier);
+	
+	/*
+    * From CAknSettingItemList
+    */
+	void EditItemL (TInt aIndex, TBool aCalledFromMenu);
+	
+public:// members
+
+    /*
+    * ChangeSelectedItem()
+    * Modifys the current list box selection
+    */
+	void ChangeSelectedItemL();
+	
+private: 
+    /**
+    * From CAknSettingItemList
+    */
+	void SizeChanged();
+
+private: // New functions
+
+    /*
+    *  Sets the text for the balance slider item
+    */
+    void SetBalanceTextL( CAknSliderSettingPage* slider );
+    
+private: // member data
+	CMPXAudioEffectsModel* iModel;
+	CArrayPtr<CGulIcon>* iIconArray;
+	};
+
+#endif // MPXAUDIOEFFECTSITEMS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffectsmodel.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio effects model implementation.
+*
+*/
+
+
+#ifndef MPXAUDIOEFFECTSMODEL_H
+#define MPXAUDIOEFFECTSMODEL_H
+
+// INCLUDES
+
+// SYSTEM INCLUDES
+#include <e32base.h>
+#include <f32file.h>
+#include <aknViewAppUi.h>
+
+// FORWARD DECLARATIONS
+class CAknViewAppUi;
+class CMsEqualizerHelper;
+class CEikStatusPane;
+class CMPXAudioEffectProperties;
+class CMPXAudioEffectEngine;
+class MMPXPlaybackUtility;
+
+/**
+*  CMPXAudioEffectsModel, Model class for audio settings 
+*  
+*  @lib mpxaudioeffectsview.dll
+*  @since Series 60 3.0
+*/
+NONSHARABLE_CLASS(CMPXAudioEffectsModel) : public CBase
+    {
+public:
+    friend class CMPXAudioEffectsItems;
+
+public: // accessors
+    
+    /**
+    * Virtual Destructor
+    */
+    virtual	~CMPXAudioEffectsModel();
+    
+    /**
+    * Two-phased constructor
+    *
+    * @param aEngine Audio effect engine 
+    * @return CMPXAudioEffectsModel
+    */
+	static CMPXAudioEffectsModel* NewL(MMPXPlaybackUtility& aEngine);
+	
+	/**
+    * Sets the balance
+    */
+    void SetBalanceL();
+	
+	/**
+    * Sets the bass boost
+    */
+	void SetBassBoostL();
+	
+	/**
+    * Sets the stereo widening
+    */
+	void SetStereoWideningL();
+ 	
+ 	/**
+    * Sets the reverberation
+    */
+ 	void SetReverberationL();
+
+    /**
+    * Sets the loudness
+    */
+    void SetLoudnessL();
+
+private:
+
+    /**
+    *  2nd-phased constructor
+    */
+    void ConstructL();
+    
+    /**
+    * Constructor
+    *
+    * aEngine Audio effect engine 
+    */
+	CMPXAudioEffectsModel(MMPXPlaybackUtility& aEngine);
+
+private: //Data
+	
+	TInt  iBalance; //(From -100 to 100, 0 = center)
+	TInt  iReverb; //(from 1 to 8, 0 = default)
+	TBool iStereo; //(default off)
+	TBool iBassBoost; //(default off)
+    TBuf<32> iPresetName;
+    TBool iLoudness; 
+    MMPXPlaybackUtility& iPlaybackUtility;  // not own
+    CMPXAudioEffectProperties* iProp;
+	};
+
+#endif  // MPXAUDIOEFFECTSMODEL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffectsview.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxaudioeffectview
+*
+*/
+
+
+
+#ifndef MPXAUDIOEFFECTSVIEW_HLP_HRH
+#define MPXAUDIOEFFECTSVIEW_HLP_HRH
+
+_LIT( KMusHlpSoundCheckView, "MUS_HLP_AUDIO_SETT" );  
+
+#endif  // MPXAUDIOEFFECTSVIEW_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffectsviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Container class.
+*
+*/
+
+
+
+#ifndef MPXAUDIOEFFECTSVIEWCONTAINER_H
+#define MPXAUDIOEFFECTSVIEWCONTAINER_H
+
+
+// INCLUDES
+#include <coecntrl.h>
+
+
+// FORWARD DECLARATIONS
+class CMPXAudioEffectsItems;
+class CMPXAudioEffectsModel;
+class CMPXAudioEffectsViewImp;
+
+
+/**
+*
+* @class    CMPXAudioEffectsViewContainer 
+* @brief    This is the container class for a list example based on the
+* standard Symbian OS architecture.  
+* 
+*/
+class CMPXAudioEffectsViewContainer : public CCoeControl
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXAudioEffectsViewContainer();
+
+    /**
+    * Two-phased constructor
+    */
+    void ConstructL(
+        const TRect& aRect,
+        CMPXAudioEffectsModel* aModel );
+
+    /**
+    * Destructor
+    */
+    ~CMPXAudioEffectsViewContainer();
+
+    /**
+    * Change currently selected item
+    */
+    void ChangeSelectedItemL();
+
+private: // from CoeControl
+    
+    /**
+    * From CCoeControl
+    * Called by the framework in compound controls
+    * @return The number of controls in this CMPXAudioEffectContainer
+    */
+    TInt CountComponentControls() const;
+    
+    /**
+    * From CCoeControl
+    * Called by the framework in compound controls  
+    * @param The index of the control to return
+    * @return The control for aIndex
+    */
+    CCoeControl* ComponentControl( TInt aIndex ) const;
+    
+    /**
+    * From CCoeControl
+    * Called by the framework whenever a key event occurs.  
+    * Passes the key event to the saved games list if it is not null, 
+    * otherwise returns EKeyWasNotConsumed
+    *
+    * @param aKeyEvent the Key event which occured, e.g. select key pressed
+    * @param aType the type of Key event which occurred, e.g. key up, key
+    *              down
+    * @return TKeyResponse EKeyWasNotConsumed if the key was not processed,
+    *         EKeyWasConsumed if it was
+    */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CCoeControl.
+     * Responds to changes to the size and position of the contents of this 
+     * control.
+     */
+    void SizeChanged();
+
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );
+
+    /**
+    * From CCoeControl
+    */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+private: //data
+
+    CMPXAudioEffectsModel* iModel;  // Not own
+    CMPXAudioEffectsItems* iSettingItems; // Own. The settings list
+    };
+
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/inc/mpxaudioeffectsviewimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Audio Effect view class.
+*
+*/
+
+
+
+#ifndef C_CMPXAUDIOEFFECTSVIEWIMP_H
+#define C_CMPXAUDIOEFFECTSVIEWIMP_H
+
+
+//INCLUDES
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxaudioeffectsview.h"
+
+
+// FORWARD DECLARATIONS
+class CMPXAudioEffectsModel;
+class CMPXAudioEffectsViewContainer;
+class MMPXPlaybackUtility;
+class CMPXAudioEffectEngine;
+class CCustomCommandUtility;
+
+
+/**
+*  CMPXAudioEffectsViewImp, View class for audio settings 
+*  
+*  @lib mpxaudioeffectsview.dll
+*  @since Series 60 3.0
+*/
+NONSHARABLE_CLASS( CMPXAudioEffectsViewImp ) : public CMPXAudioEffectsView
+    {
+public:
+
+    /**
+    * Two-phased constructor
+    *
+    * @return object of constructed
+    */
+    static CMPXAudioEffectsViewImp* NewL();
+
+    /**
+    * Two-phased constructor
+    *
+    * @return object of constructed
+    */
+    static CMPXAudioEffectsViewImp* NewLC();
+
+    /**
+    * Destructor
+    *
+    */
+    virtual ~CMPXAudioEffectsViewImp();
+
+protected:
+    /**
+     * From CAknView
+     * Processes user commands.
+     *
+     * @since 3.0
+     * @param aCommand ID of the command to respond to.
+     */
+    virtual void ProcessCommandL( TInt aCommand );
+
+private:
+
+    /*
+    *  Second-phased Constructor
+    */
+    void ConstructL();
+    
+    /*
+    *  Privatre Constructor
+    */
+    CMPXAudioEffectsViewImp();
+
+    /**
+    * Change selected item
+    */
+    void ChangeSelectedItemL();
+
+// from CAknView
+
+    /**
+    * From CAknView
+    */
+    TUid Id() const;
+    
+    /**
+    * From CAknView
+    */
+    void HandleCommandL( TInt aCommand );
+    
+    /**
+    * From CAknView
+    */    
+    void DoActivateL(
+        const TVwsViewId& aPrevViewId,
+        TUid aCustomMessageId,
+        const TDesC8& aCustomMessage );
+    
+    /**
+    * From CAknView
+    */
+    void DoDeactivate();
+
+private: // data
+
+    CMPXAudioEffectsViewContainer* iContainer;
+    CMPXAudioEffectsModel* iModel;
+    MMPXPlaybackUtility* iPlaybackUtility;  // not own
+    
+    TVwsViewId iPreviousView;
+    TInt iResourceOffset;
+    };
+
+#endif    // C_CMPXAUDIOEFFECTSVIEWIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/loc/mpxaudioeffects.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,174 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+ *     This is a localisation file for Sound check dll
+ *     A .loc file is the one and only place where the logical strings
+ *     to be localised are defined. 
+ * >>>
+ * The text between >>> and <<< is just to document the syntax and
+ * you can remove it if you like.
+ *
+*/
+
+
+
+// LOCALISATION STRINGS
+
+// d:Used in Sound check view.
+// d:Name of a component that will change 
+// d:audio balance setting.
+// d:Series_60_Music_settings_UI_Specification_v2.0.doc, Figure 3.1
+// l:list_setting_pane_t1
+// r:3.1
+//
+#define qtn_nmp_balance "Balance"
+
+// d:Used in Sound check view.
+// d:Name of an option to move balance effect
+// d:to the left for audio.
+// d:Series_60_Music_settings_UI_Specification_v2.0.doc, Figure 3.1
+// l:setting_slider_pane_t2
+// r:3.1
+//
+#define qtn_nmp_balance_left    "Left"
+
+// d:Used in Sound check view, balance page.
+// d:Name of an option to move balance effect
+// d:to the right for audio.
+// d:Series_60_Music_settings_UI_Specification_v2.0.doc, Figure 3.1
+// l:setting_slider_pane_t2
+// r:3.1
+//
+#define qtn_nmp_balance_right   "Right"
+
+// d:The status pane in Sound check will use this as caption.
+// d:Series_60_Music_settings_UI_Specification_v2.0.doc, Figure 3.1
+// d:When choosing options in musicplayer this will be an
+// d:option that will open the Sound check view. Therefore
+// d:a second (//l:) is specified in following rows.
+// l:title_pane_t2/opt9
+// r:3.1
+//
+#define qtn_nmp_audioeffects    "Audio settings"
+
+// d:Used in Sound check view.
+// d:Name of an option to switch off bassboost and stereo
+// d:widening effect for audio.
+// d:Series_60_Music_settings_UI_Specification_v2.0.doc, Figure 4.5-3
+// l:list_set_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_off "Off"
+
+// d:Used in Sound check view.
+// d:Name of an option to switch on bassboost and stereo
+// d:widening effect for audio.
+// d:Series_60_Music_settings_UI_Specification_v2.0.doc, Figure 4.5-3
+// l:list_set_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_on  "On"
+
+// d:Used in Sound check view.
+// d:Name of a component that will change stereo widening
+// d:effect for audio.
+// d:Series_60_Music_settings_UI_Specification_v2.0.doc, Figure 3.1
+// l:list_setting_pane_t1
+// r:3.1
+//
+#define qtn_nmp_stereowidening "Stereo widening"
+
+// d:Used in Audio effect view.
+// d:Name of a component that will change Loudness
+// d:effect for audio.
+// d:Series_60_Music_settings_UI_Specification_v2.0.doc, Figure 3.1
+// l:list_setting_pane_t1
+// r:3.1
+//
+#define qtn_nmp_loudness "Loudness"
+
+// d:Used in Audio effect view.
+// d:Balance settings to state how the balance to either the left or right channel 
+// d:of the headset 
+// l:setting_slider_pane_t1
+// r:3.1
+//
+#define qtn_nmp_balance_right100 "Balance - Right 100"
+
+// d:Used in Audio effect view.
+// d:Balance settings to state how the balance to either the left or right channel 
+// d:of the headset 
+// l:setting_slider_pane_t1
+// r:3.1
+//
+#define qtn_nmp_balance_right75 "Balance - Right 75"
+
+// d:Used in Audio effect view.
+// d:Balance settings to state how the balance to either the left or right channel 
+// d:of the headset 
+// d:
+// l:setting_slider_pane_t1
+// r:3.1
+//
+#define qtn_nmp_balance_right50 "Balance - Right 50"
+
+// d:Used in Audio effect view.
+// d:Balance settings to state how the balance to either the left or right channel 
+// d:of the headset 
+// l:setting_slider_pane_t1
+// r:3.1
+//
+#define qtn_nmp_balance_right25 "Balance - Right 25"
+
+// d:Used in Audio effect view.
+// d:Balance settings to state how the balance to either the left or right channel 
+// d:of the headset 
+// l:setting_slider_pane_t1
+// r:3.1
+//
+#define qtn_nmp_balance_centre "Balance - Center"
+
+// d:Used in Audio effect view.
+// d:Balance settings to state how the balance to either the left or right channel 
+// d:of the headset 
+// l:setting_slider_pane_t1
+// r:3.1
+//
+#define qtn_nmp_balance_left25 "Balance - Left 25"
+
+// d:Used in Audio effect view.
+// d:Balance settings to state how the balance to either the left or right channel 
+// d:of the headset 
+// l:setting_slider_pane_t1
+// r:3.1
+//
+#define qtn_nmp_balance_left50 "Balance - Left 50"
+
+// d:Used in Audio effect view.
+// d:Balance settings to state how the balance to either the left or right channel 
+// d:of the headset 
+// l:setting_slider_pane_t1
+// r:3.1
+//
+#define qtn_nmp_balance_left75 "Balance - Left 75"
+
+// d:Used in Audio effect view.
+// d:Balance settings to state how the balance to either the left or right channel 
+// d:of the headset 
+// l:setting_slider_pane_t1
+// r:3.1
+//
+#define qtn_nmp_balance_left100 "Balance - Left 100"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/src/mpxaudioeffectsitems.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,280 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Setting List
+*
+*/
+
+
+// INCLUDE FILES 
+
+#include <aknnotewrappers.h>
+#include <aknsettingpage.h> 
+#include <aknslidersettingpage.h> 
+#include <eikfrlbd.h> 
+#include <eikfrlb.h> 
+#include <mpxlog.h>
+
+#include <mpxaudioeffectsview.rsg>
+#include <avkon.rsg>
+#include <StringLoader.h>
+
+// User Includes
+#include "mpxaudioeffectsitems.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsItems::CMPXAudioEffectsItems()
+// Constructor
+// -----------------------------------------------------------------------------
+//  
+CMPXAudioEffectsItems::CMPXAudioEffectsItems(CMPXAudioEffectsModel* aModel)
+    {
+    iModel = aModel;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsItems::~CMPXAudioEffectsItems()
+// Destructor
+// -----------------------------------------------------------------------------
+//
+CMPXAudioEffectsItems::~CMPXAudioEffectsItems()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsItems::SizeChanged()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsItems::SizeChanged()
+    {
+    if( ListBox() ) 
+        {
+        ListBox()->SetRect( Rect() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsItems::CreateSettingItemL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CAknSettingItem* CMPXAudioEffectsItems::CreateSettingItemL(TInt aIdentifier)
+    {
+    CAknSettingItem* settingItem = NULL;
+    
+    switch (aIdentifier)
+        {
+        case EEqualizerSettingItem: // Not used
+            settingItem = new (ELeave) CAknTextSettingItem(aIdentifier, 
+                                                         iModel->iPresetName);
+            break;
+        case EBalanceSettingItem:
+            settingItem = new (ELeave) CAknSliderSettingItem(aIdentifier, 
+                                                             iModel->iBalance);
+            break;
+        case EReverbSettingItem:
+            settingItem = new ( ELeave ) CAknEnumeratedTextPopupSettingItem(
+                                                    aIdentifier,iModel->iReverb);
+            break;
+        case EStereoWideningSettingItem:
+            settingItem = new (ELeave) CAknBinaryPopupSettingItem(aIdentifier, 
+                                                                  iModel->iStereo);
+            break;
+        case ELoudnessItem:
+            settingItem = new (ELeave) CAknBinaryPopupSettingItem(aIdentifier, 
+                                                                  iModel->iLoudness);
+          break;
+        }
+    return settingItem;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsItems::ChangeSelectedItemL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsItems::ChangeSelectedItemL()
+    {
+    EditItemL(ListBox()->CurrentItemIndex(), ETrue);  
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsItems::EditItemL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsItems::EditItemL(TInt aIndex, TBool aCalledFromMenu)
+    {
+    if (aIndex==0) //balance
+        {
+        TInt oldValue = iModel->iBalance;
+
+        CAknSliderSettingPage* dlg = 
+                new(ELeave) CAknSliderSettingPage(R_BALANCE_SETTING_PAGE, 
+                                                  iModel->iBalance);
+        dlg->SetSettingId(EBalanceSettingItem);
+        dlg->SetSettingPageObserver(this);
+        SetBalanceTextL(dlg);
+        dlg->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
+          
+        MPX_TRAPD( err, iModel->SetBalanceL() );
+        if(err != KErrNone)// the slider button will return to the previous
+                           // position if an error accures
+            {
+            iModel->iBalance = oldValue;
+            TRAP_IGNORE(iModel->SetBalanceL()); // update value in file
+            }
+            
+        // Redraw the text box correctly
+        CAknSliderSettingItem* settingItem = (CAknSliderSettingItem*) 
+                                                 SettingItemArray()->At(0);
+        settingItem->LoadL();
+        settingItem->UpdateListBoxTextL();
+        }
+    else if (aIndex==1) //Loundness
+        {
+        TBool oldLoudnessValue = iModel->iLoudness;
+        CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu );
+        (*SettingItemArray())[aIndex]->StoreL(); //activates change in listbox
+        MPX_TRAPD( err, iModel->SetLoudnessL() );    //calls engine to change API
+
+        if (err != KErrNone) //change in UI will not accure if API is not changed
+            {
+            CAknSettingItemList::EditItemL( aIndex, EFalse );
+            iModel->iLoudness = oldLoudnessValue;
+            TRAP_IGNORE(iModel->SetLoudnessL());
+            }
+        }
+    else if (aIndex==2)//stereo widening
+        {
+        TBool oldStereoValue = iModel->iStereo;
+        CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu );
+        (*SettingItemArray())[aIndex]->StoreL(); //activates change in listbox
+        MPX_TRAPD( err, iModel->SetStereoWideningL() ); //calls engine to change API
+
+        if (err != KErrNone) //change in UI will not accure if API is not 
+                             //changed(=error in API)
+            {
+            CAknSettingItemList::EditItemL( aIndex, EFalse );
+            iModel->iStereo = oldStereoValue;
+            TRAP_IGNORE(iModel->SetStereoWideningL()); // update value in file 
+            }
+        }
+    DrawDeferred();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsItems::HandleSettingPageEventL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsItems::HandleSettingPageEventL(
+    CAknSettingPage* aSettingPage,
+    TAknSettingPageEvent aEventType)
+    {
+    TInt id = aSettingPage->SettingId();
+
+    if (aEventType == EEventSettingChanged)
+        {
+        switch (id)
+            {
+            case EBalanceSettingItem:
+                {
+                CAknSliderSettingPage* slider = 
+                            static_cast<CAknSliderSettingPage*>(aSettingPage);
+                iModel->iBalance = slider->SliderControl()->Value();
+                iModel->SetBalanceL();
+                SetBalanceTextL( slider );
+                break;
+                }
+            default:
+                break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsItems::SetBalanceTextL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsItems::SetBalanceTextL( CAknSliderSettingPage* slider )
+    {
+    HBufC* title = NULL;
+    
+    switch ( iModel->iBalance )
+        {
+        
+        case -100:
+            {
+            title = StringLoader::LoadLC( R_AUDIOEFFECT_BALANCE_LEFT100 );
+            break;
+            }
+        case -75:
+            {
+            title = StringLoader::LoadLC( R_AUDIOEFFECT_BALANCE_LEFT75 );
+            break;
+            }    
+        case -50:
+            {
+            title = StringLoader::LoadLC( R_AUDIOEFFECT_BALANCE_LEFT50 );
+            break;
+            }
+        case -25:
+            {
+            title = StringLoader::LoadLC( R_AUDIOEFFECT_BALANCE_LEFT25 );
+            break;
+            }
+        case 0:
+            {
+            title = StringLoader::LoadLC( R_AUDIOEFFECT_BALANCE_CENTER );
+            break;
+            }
+        case 25:
+            {
+            title = StringLoader::LoadLC( R_AUDIOEFFECT_BALANCE_RIGHT25 );
+            break;
+            }    
+        case 50:
+            {
+            title = StringLoader::LoadLC( R_AUDIOEFFECT_BALANCE_RIGHT50 );
+            break;
+            }
+        case 75:
+            {
+            title = StringLoader::LoadLC( R_AUDIOEFFECT_BALANCE_RIGHT75 );
+            break;
+            }    
+        case 100:
+            {
+            title = StringLoader::LoadLC( R_AUDIOEFFECT_BALANCE_RIGHT100 );
+            break;
+            }                    
+        default: 
+        break;
+        }
+        
+    if( title )
+        {
+        slider->SetSettingTextL( *title );
+        slider->DrawNow();
+        CleanupStack::PopAndDestroy( title );
+        }
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/src/mpxaudioeffectsmodel.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Engine class that uses the Effects API and saves changes.
+*
+*/
+
+
+// INCLUDE FILES
+#include  <s32file.h>
+#include  <s32std.h>
+
+#include  "mpxaudioeffectproperties.h"
+#include  <mpxaudioeffectsview.rsg>
+#include  <mpxplaybackutility.h>
+#include  <mpxlog.h>
+
+#include  "mpxaudioeffects.hrh"
+#include  "mpxaudioeffectsmodel.h"
+
+// CONSTANTS
+const TInt KAudioEffectsCustomCommand = 0x101FFC02;
+
+// ================= MEMBER FUNCTIONS =======================
+   
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsModel::NewL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CMPXAudioEffectsModel* CMPXAudioEffectsModel::NewL(
+    MMPXPlaybackUtility& aPlaybackUtility)
+    {
+    CMPXAudioEffectsModel* self = new( ELeave ) 
+                                        CMPXAudioEffectsModel(aPlaybackUtility);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsModel::CMPXAudioEffectsModel()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CMPXAudioEffectsModel::CMPXAudioEffectsModel(MMPXPlaybackUtility& aPlaybackUtility)
+    :iPlaybackUtility(aPlaybackUtility)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsModel::~CMPXAudioEffectsModel()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+CMPXAudioEffectsModel::~CMPXAudioEffectsModel()
+    {
+    if (iProp)
+        {
+        delete iProp;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsModel::ConstructL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsModel::ConstructL()
+    {
+    iProp = new(ELeave) CMPXAudioEffectProperties();   
+    MPX_TRAPD( err, iProp->LoadFromFileL() ); //Loads saved settings if available
+    if( err != KErrNone )
+        {
+        MPX_DEBUG1("CMPXAudioEffectsModel::ConstructL -- load error");
+        iProp->Reset();
+        iBalance = 0;
+        iReverb = 0;
+        iStereo = EFalse;
+        iBassBoost = EFalse;
+        iLoudness = EFalse;
+#if 1 // VCPCC_MOD
+        iLoudness=EFalse; 
+#endif // VCPCC_MOD   
+        MPX_DEBUG1("CMPXAudioEffectsModel::ConstructL -- save to file");
+        iProp->SaveToFileL();        
+        }
+    else
+        {
+        iBalance = iProp->Balance();
+        iReverb = iProp->Reverb();
+        iStereo = iProp->Stereo();
+        iBassBoost = iProp->BassBoost(); 
+        iLoudness = iProp->Loudness();   
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsModel::SetBalanceL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsModel::SetBalanceL()
+    {
+    iProp->SetBalance(iBalance);
+    MPX_DEBUG1("CMPXAudioEffectsModel::SetBalanceL -- save to file");
+    iProp->SaveToFileL();
+
+    iPlaybackUtility.CommandL( EPbApplyEffect, KAudioEffectsCustomCommand );
+    }
+  
+  
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsModel::SetReverberationL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsModel::SetReverberationL()
+    {
+    iProp->SetReverb(iReverb);
+    MPX_DEBUG1("CMPXAudioEffectsModel::SetReverberationL -- reverb save to file");
+    iProp->SaveToFileL();
+    
+    iPlaybackUtility.CommandL( EPbApplyEffect, KAudioEffectsCustomCommand );
+    }
+  
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsModel::SetStereoWideningL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsModel::SetStereoWideningL()
+    {
+    iProp->SetStereo(iStereo);
+    MPX_DEBUG1("CMPXAudioEffectsModel::SetStereoWideningL -- set stereo save to file");
+    iProp->SaveToFileL();
+    
+    iPlaybackUtility.CommandL( EPbApplyEffect, KAudioEffectsCustomCommand );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsModel::SetBassBoostL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsModel::SetBassBoostL()
+    {
+#if 0 // VCPCC_MOD    
+    iProp->SetBassBoost(iBassBoost);
+    iProp->SaveToFileL();
+
+    iPlaybackUtility.CommandL( EPbApplyEffect, KAudioEffectsCustomCommand );
+#endif // VCPCC_MOD   
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsModel::SetLoudnessL()
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsModel::SetLoudnessL()
+    {
+    iProp->SetLoudness(iLoudness);
+    
+    MPX_DEBUG1("CMPXAudioEffectsModel::SetLoudnessL -- save to file");
+    iProp->SaveToFileL();
+    
+    iPlaybackUtility.CommandL( EPbApplyEffect, KAudioEffectsCustomCommand );
+    }
+
+// End of file
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/src/mpxaudioeffectsview.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Audio effects view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxaudioeffectsview.h"
+#include "mpxaudioeffectsviewimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXAudioEffectsView* CMPXAudioEffectsView::NewL()
+    {
+    return CMPXAudioEffectsViewImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXAudioEffectsView* CMPXAudioEffectsView::NewLC()
+    {
+    return CMPXAudioEffectsViewImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXAudioEffectsView::~CMPXAudioEffectsView()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/src/mpxaudioeffectsviewcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,195 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Container class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <hlplch.h>
+#include <akntitle.h>
+#include <eikspane.h>
+#include <mpxaudioeffectsview.rsg>
+#include <mpxconstants.h>
+
+#include "mpxaudioeffectsview.hlp.hrh"
+#include "mpxaudioeffectsitems.h"
+#include "mpxaudioeffectsviewcontainer.h"
+#include "mpxaudioeffectsviewimp.h"
+
+// ================= MEMBER FUNCTIONS =======================
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXAudioEffectsViewContainer::CMPXAudioEffectsViewContainer()
+    {
+    // Do nothing
+    }
+
+// -----------------------------------------------------------------------------
+// Symbian OS 2nd phase constructor.  Creates a Window for the controls, which
+// it contains. Constructs a label and adds it to the window, which it then
+// activates.
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewContainer::ConstructL(
+    const TRect& aRect,
+    CMPXAudioEffectsModel* aModel )
+    {
+    CreateWindowL();
+    SetRect( aRect );
+
+    iModel = aModel;
+
+    //inserting title
+    CAknTitlePane* titlePane = static_cast<CAknTitlePane*>
+        ( iAvkonViewAppUi->StatusPane()->ControlL(
+            TUid::Uid( EEikStatusPaneUidTitle ) ) );
+
+    HBufC* title =
+        CEikonEnv::Static()->AllocReadResourceL( R_AUDIOEFFECT_CAPTION_TEXT );
+    titlePane->SetText( title );   // Ownership transferred
+
+    //inserting setting list
+    iSettingItems = new ( ELeave ) CMPXAudioEffectsItems( iModel );
+    iSettingItems->SetContainerWindowL( *this );
+    iSettingItems->ConstructFromResourceL( R_AUDIOEFFECTS_SETTING_ITEM_LIST );
+    // Layout setting list box
+    SizeChanged();
+    ActivateL();
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.  Frees up memory for the settings list.
+// -----------------------------------------------------------------------------
+//
+CMPXAudioEffectsViewContainer::~CMPXAudioEffectsViewContainer()
+    {
+    delete iSettingItems;
+    }
+
+// -----------------------------------------------------------------------------
+// Asks the setting list to change the currently selected item
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewContainer::ChangeSelectedItemL()
+    {
+    if ( iSettingItems )
+        {
+        iSettingItems->ChangeSelectedItemL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From CCoeControl
+// Called by the framework in compound controls
+// -----------------------------------------------------------------------------
+//
+TInt CMPXAudioEffectsViewContainer::CountComponentControls() const
+    {
+    return 1; // return number of controls inside this container
+    }
+
+// -----------------------------------------------------------------------------
+// From CCoeControl
+// Called by the framework in compound controls
+// -----------------------------------------------------------------------------
+//
+CCoeControl* CMPXAudioEffectsViewContainer::ComponentControl(
+    TInt aIndex ) const
+    {
+    switch ( aIndex )
+        {
+        case 0:
+            {
+            return iSettingItems;
+            }
+        default:
+            {
+            return NULL;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From CCoeControl
+// Process a key event
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CMPXAudioEffectsViewContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    // VC_PCC_MOD: Do not merge changes in this function, Music Player uses 
+    // the volumne popup instead of navi pane
+    //
+    if ( iSettingItems )
+        {
+        return iSettingItems->OfferKeyEventL( aKeyEvent, aType );
+        }
+    else
+        {
+        return EKeyWasNotConsumed;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Responds to changes to the size and position of the contents of this
+// control.
+// ---------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewContainer::SizeChanged()
+    {
+    if ( iSettingItems )
+        {
+        iSettingItems->SetRect( Rect() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewContainer::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType );
+
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        TRect mainPaneRect;
+        AknLayoutUtils::LayoutMetricsRect(
+            AknLayoutUtils::EMainPane, mainPaneRect );
+        SetRect( mainPaneRect );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From CCoeControl
+// Gets Help
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewContainer::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KAppUidMusicPlayerX;
+    aContext.iContext = KMusHlpSoundCheckView;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/audioeffectsview/src/mpxaudioeffectsviewimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Audio effects view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <bautils.h>
+#include <eikmenub.h>
+#include <AknUtils.h>
+#include <hlplch.h>
+#include <data_caging_path_literals.hrh>
+#include <avkon.rsg>
+#include <mpxuser.h>
+
+#include <mpxplaybackutility.h>
+#include <mpxaudioeffectsview.rsg>
+#include "mpxaudioeffectengine.h"
+
+#include "mpxaudioeffectsmodel.h"
+#include "mpxaudioeffectsviewcontainer.h"
+#include "mpxaudioeffectsviewimp.h"
+#include "mpxaudioeffects.hrh"
+
+
+// CONSTANTS
+_LIT( KMPXAudioEffectsRscPath, "mpxaudioeffectsview.rsc" );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXAudioEffectsViewImp::CMPXAudioEffectsViewImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewImp::ConstructL()
+    {
+    //get resource file
+    TParse parse;
+    parse.Set( KMPXAudioEffectsRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile(
+        CCoeEnv::Static()->FsSession(), resourceFile );
+    iResourceOffset = CCoeEnv::Static()->AddResourceFileL( resourceFile );
+    BaseConstructL( R_AUDIOEFFECTS_SETTINGSLIST_VIEW );
+
+    // Get the playback utility instance from engine
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+
+    iModel = CMPXAudioEffectsModel::NewL( *iPlaybackUtility );
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXAudioEffectsViewImp* CMPXAudioEffectsViewImp::NewL()
+    {
+    CMPXAudioEffectsViewImp* self = CMPXAudioEffectsViewImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXAudioEffectsViewImp* CMPXAudioEffectsViewImp::NewLC()
+    {
+    CMPXAudioEffectsViewImp* self = new ( ELeave ) CMPXAudioEffectsViewImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXAudioEffectsViewImp::~CMPXAudioEffectsViewImp()
+    {
+    delete iModel;
+
+    if ( iPlaybackUtility )
+        {
+        iPlaybackUtility->Close();
+        }
+
+    if ( iResourceOffset )
+        {
+        CCoeEnv::Static()->DeleteResourceFile( iResourceOffset );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsViewImp::ChangeSelectedItemL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewImp::ChangeSelectedItemL()
+    {
+    if( iContainer )
+        {
+        iContainer->ChangeSelectedItemL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsViewImp::Id
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TUid CMPXAudioEffectsViewImp::Id() const
+    {
+    return TUid::Uid( KMPXAudioEffectsViewId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsViewImp::HandleCommandL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewImp::HandleCommandL( TInt aCommand )
+    {
+    switch ( aCommand )
+        {
+        case ESettingsListCmdChange:
+            {
+            ChangeSelectedItemL();
+            break;
+            }
+        case EAknCmdHelp:
+        case ESettingsListCmdHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(),
+            AppUi()->AppHelpContextL());
+            break;
+            }
+        default:
+            {
+            // Pass the command to AppUi to handle.
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+         }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsViewImp::DoActivateL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewImp::DoActivateL(
+    const TVwsViewId& aPrevViewId,
+    TUid /*aCustomMessageId*/,
+    const TDesC8& /*aCustomMessage*/ )
+    {
+    StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL );
+    iPreviousView = aPrevViewId;
+
+    if (!iContainer)
+        {
+        iContainer = new ( ELeave ) CMPXAudioEffectsViewContainer();
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( ClientRect(), iModel );
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAudioEffectsViewImp::DoDeactivate
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewImp::DoDeactivate()
+    {
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Processes user commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXAudioEffectsViewImp::ProcessCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2("ProcessCommandL::ProcessCommandL(%d): entering", aCommand);
+    if ( aCommand == EAknCmdExit )
+        {
+        HandleCommandL( aCommand );
+        }
+    CAknView::ProcessCommandL( aCommand );
+    MPX_DEBUG1("ProcessCommandL::ProcessCommandL(): exiting");
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/bwinscw/mpxcollectionviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewL@CMPXCollectionView@@SAPAV1@XZ @ 1 NONAME ; class CMPXCollectionView * CMPXCollectionView::NewL(void)
+	?NewLC@CMPXCollectionView@@SAPAV1@XZ @ 2 NONAME ; class CMPXCollectionView * CMPXCollectionView::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/data/mpxcollectionview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1384 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxcollectionview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MXCV // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <CommonDialogs.hrh> 
+#include <CommonDialogs.rh> 
+#include <bldvariant.hrh>
+#include <pathconfiguration.hrh>
+
+#include <AiwCommon.hrh>
+#include <AiwCommon.rh>
+
+#include <mpxappui.hrh>
+#include <mpxcommonui.loc>
+#include <mpxcollectionview.loc>
+#include "mpxcollectionview.hrh"
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view
+// Collection view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_mpx_collection_view
+    {
+    menubar = r_mpx_collection_view_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menubar_music_menu
+// Collection view main music menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_collection_view_menubar_music_menu
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_collection_view_music_menu;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menubar_embedded_playlist_view
+// Collection view menu bar for embedded playlist view.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_collection_view_menubar_embedded_playlist_view
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_collection_view_embedded_playlist_view;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menubar_no_marking
+// Collection view menu bar without marking.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_collection_view_menubar_no_marking
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_collection_view_menu_2;
+            },
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_collection_view_menu_1;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menubar
+// Collection view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_collection_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_collection_view_menu_2;
+            },
+        MENU_TITLE 
+            {
+            menu_pane = R_AVKON_MENUPANE_MARKABLE_LIST;
+            },
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_collection_view_menu_1;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menu_1
+// Collection view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_collection_view_menu_1
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToNowPlaying;
+            txt = qtn_nmp_options_go_to_nowplaying;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdFind;
+            txt = qtn_options_find;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdCreatePlaylist;
+            txt = qtn_mg_options_create_new_pl;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdAddToPlaylist;
+            txt = qtn_mus_options_add_to_pl;
+            cascade = r_mpx_add_to_pl_sub_menu;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdUpnpPlayVia;
+            txt = qtn_nmp_options_play_via;
+            cascade = r_mpx_collection_play_via_sub_menu; 
+            },    
+        MENU_ITEM
+            {
+            command = EMPXCmdAddSongs;
+            txt = qtn_mus_options_add_tracks;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdReorder;
+            txt = qtn_nmp_options_reorder_list;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdSend;
+            txt = qtn_options_send_via;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdUPnPAiwCmdCopyToExternalCriteria;
+            txt = "(copy to ext)";
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdDelete;
+            txt = qtn_mus_options_delete;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdRemove;
+            txt = qtn_mp_options_remove;
+            }        
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menu_2
+// Collection view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_collection_view_menu_2
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdUseAsCascade;
+            txt = qtn_mus_options_use_tone_as;
+            cascade = r_mpx_use_as_cascade;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdSongDetails;
+            txt = qtn_mus_options_details_track;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdRename;
+            txt = qtn_nmp_options_rename;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdAlbumArt;
+            txt = qtn_nmp_options_album_art;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdFindInMusicShop;
+            txt = qtn_nmp_find_in_musicshop;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdPlaylistDetails;
+            txt = qtn_mus_options_details_pl;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_music_menu
+// Collection view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_collection_view_music_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToNowPlaying;
+            txt = qtn_nmp_options_go_to_nowplaying;
+            },    
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU                
+        MENU_ITEM
+            {
+            command = EMPXCmdRefreshLibrary;
+            txt = qtn_mus_options_update_collection1;
+            },    
+#endif            
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToMusicShop;
+            txt = qtn_nmp_options_go_to_shop;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdGoToMultipleMusicShop;
+            txt = qtn_nmp_options_go_to_shop;
+            cascade = r_mpx_playback_collection_musicshop_sub_menu; 
+            },                
+        MENU_ITEM
+            {
+            command = EMPXCmdMusicLibraryDetails;
+            txt = qtn_mus_options_details_library;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_embedded_playlist_view
+// Collection view menu items for embedded playlist view.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_collection_view_embedded_playlist_view
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdSavePlaylist;
+            txt = qtn_mp_options_save;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdFindInMusicShop;
+            txt = qtn_nmp_find_in_musicshop;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_add_to_pl_sub_menu
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_add_to_pl_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdAddToSavedPlaylist;
+            txt = qtn_nmp_sub_add_to_playlist_saved;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdAddToNewPlaylist;
+            txt = qtn_nmp_sub_add_to_playlist_new; 
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_collection_via_sub_menu
+// Collection view UPnP Play Via sub menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_collection_play_via_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdUpnpPlayViaLocal;
+            txt = qtn_nmp_options_play_device;
+            flags = EEikMenuItemRadioStart;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdUpnpPlayViaRemotePlayer;
+            txt = qtn_nmp_options_play_homenet;
+            flags = EEikMenuItemRadioEnd;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_collection_musicshop_sub_menu
+// Collection view goto music shop menu items
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_playback_collection_musicshop_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToOperatorMusicShop;
+             txt = "";
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdGoToNokiaMusicShop;
+            txt = "Nokia Music Store";
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_upnp_copy_to_external_menu_interest
+// Copy to remote menu definition needed by AIW to display and handle the menu
+// ---------------------------------------------------------------------------
+//
+RESOURCE AIW_INTEREST r_mpx_upnp_copy_to_external_menu_interest
+    {
+    items=
+        {
+        AIW_CRITERIA_ITEM
+            {
+            id = EMPXCmdUPnPAiwCmdCopyToExternalCriteria;
+            serviceCmd   = KAiwCmdUPnPCopy; //AIWCommon.hrh
+            serviceClass = KAiwClassMenu;   //AIWCommon.hrh
+            contentType  = "*";
+            maxProviders = 1;
+            }
+        };
+    }
+//------------------------------------------------------------------------------
+//
+//      r_mpx_aiw_assign_interest
+//      AIW interest criteria for "Use tone as" menu
+//
+//------------------------------------------------------------------------------
+//
+RESOURCE AIW_INTEREST r_mpx_aiw_assign_interest
+    {
+    items=
+        {
+        AIW_CRITERIA_ITEM
+            {
+            id = EMPXCmdAiwCmdAssign;
+            serviceCmd = KAiwCmdAssign;
+            contentType = "*";
+            serviceClass = KAiwClassMenu;
+            }
+        };
+    }    
+
+//----------------------------------------------------
+//
+//    r_mplayer_use_as_cascade
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_use_as_cascade
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdAiwCmdAssign;
+            txt = "";
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_add_songs_confirmation_query
+// Confirmation query dialog for add songs after a new playlist is created
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_cui_add_songs_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_delete_confirmation_query
+// Confirmation query dialog for deleting.
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_cui_delete_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_rename_query
+// Name query dialog for renaming
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_cui_rename_query
+    {
+    flags = EAknGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_DATA_QUERY 
+                { 
+                layout = EDataLayout;
+                control = EDWIN 
+                    {
+                    };
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_generic_confirmation_query
+// Generic confirmation query dialog.
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_collection_generic_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_mpx_cui_reorder_drop_cancel_cba
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_cui_reorder_drop_cancel_cba
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderDrop;
+            txt = qtn_nmp_softkey_drop;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderCancel;
+            txt = text_softkey_cancel;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderDrop;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_cui_reorder_drop_cancel_cba
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_cui_reorder_drop_cancel_cba
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderDrop;
+            txt = qtn_nmp_softkey_drop;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderCancel;
+            txt = text_softkey_cancel;
+            }
+        };
+    }
+#endif // __ENABLE_MSK
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_mpx_cui_reorder_grab_done_cba
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_cui_reorder_grab_done_cba
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderGrab;
+            txt = qtn_nmp_softkey_grab;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderDone;
+            txt = text_softkey_done;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderGrab;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_cui_reorder_grab_done_cba
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_cui_reorder_grab_done_cba
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderGrab;
+            txt = qtn_nmp_softkey_grab;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderDone;
+            txt = text_softkey_done;
+            }
+        };
+    }
+#endif // __ENABLE_MSK
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_mpx_options_back_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_back_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_back;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_open;
+            }
+        };
+    }
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_options_back_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_back_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_back;
+            }
+        };
+    }
+#endif // __ENABLE_MSK
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_mpx_options_exit_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_exit_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_exit;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_open;
+            }
+        };
+    }
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_options_exit_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_exit_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_exit;
+            }
+        };
+    }
+#endif // __ENABLE_MSK
+
+// ---------------------------------------------------------------------------
+// r_mpx_options_hide_cba
+// CBA with "Options" and "Hide" Softkey.
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_options_hide_cba
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdHideApp;
+            txt = qtn_softkey_hide;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA_BUTTON r_mpx_collection_rsk_find_cancel
+    {
+    id = EMPXCmdFindCancel;
+    txt = text_softkey_cancel;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_mpx_cui_collection_details_headings
+// Headings for Collection Details popup
+// ---------------------------------------------------------------------------
+//
+#ifdef RD_MULTIPLE_DRIVE
+RESOURCE ARRAY r_mpx_cui_collection_details_headings
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_mus_detail_number_of_songs;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_phone_memory;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_mass_memory;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_mmc;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_date_refresh;
+            }
+        };
+    }    
+#else
+RESOURCE ARRAY r_mpx_cui_collection_details_headings
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_mus_detail_number_of_songs;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_phone_memory;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_memory_card;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_date_refresh;
+            }
+        };
+    }    
+#endif // RD_MULTIPLE_DRIVE   
+
+// ---------------------------------------------------------------------------
+// r_mpx_cui_playlist_details_headings_with_uri
+// Headings for playlist Details popup with uri field
+// ---------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_mpx_cui_playlist_details_headings_with_uri
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_mus_pl_detail_name;
+            },
+        LBUF
+            {
+            txt = qtn_mus_detail_number_of_songs;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_location;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_date;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_time;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_cui_playlist_details_headings_without_uri
+// Headings for playlist Details popup without uri field
+// ---------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_mpx_cui_playlist_details_headings_without_uri
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_mus_pl_detail_name;
+            },
+        LBUF
+            {
+            txt = qtn_mus_detail_number_of_songs;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_date;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_time;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_waitnote_softkeys_empty_stop
+// Softkeys used by generic wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_collection_waitnote_softkeys_empty_stop
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;
+            txt = text_softkey_stop;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collectionview_title
+// Title for Collection view.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_collection_view_title
+    {
+    buf = qtn_mp_title_collection_view;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_qtn_nmp_title_reorder_list
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_nmp_title_reorder_list
+    {
+    buf = qtn_nmp_title_reorder_list;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_cui_position_counter_txt
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_cui_position_counter_txt
+    {
+    buf = qtn_nmp_position_counter;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_query_add_songs
+// Text for add songs after a new playlist is created.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_query_add_songs
+    {
+    buf = qtn_nmp_query_add_songs;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_query_common_conf_delete
+// Text for single item deletion confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_query_common_conf_delete
+    {
+    buf = qtn_query_common_conf_delete;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_del_songs_query
+// Text for multiple tracks deletion confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_del_songs_query
+    {
+    buf = qtn_nmp_del_songs_query;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_query_conf_delete_group
+// Text for group deletion confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_query_conf_delete_group
+    {
+    buf = qtn_nmp_query_conf_delete_group;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_del_songs_wait_note
+// Text for multiple item deletion wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_del_songs_wait_note
+    {
+    buf = qtn_nmp_del_songs_wait_note;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_note_removing_many
+// Text for multiple item remove wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_note_removing_many
+    {
+    buf = qtn_nmp_note_removing_many;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_query_conf_remove_many
+// Text for multiple item remove confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mus_query_conf_remove_many
+    {
+    buf = qtn_mus_query_conf_remove_many;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_note_removing_track
+// Text for single item remove wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mus_note_removing_track
+    {
+    buf = qtn_mus_note_removing_track;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_query_conf_remove_track
+// Text for single item remove confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mus_query_conf_remove_track
+    {
+    buf = qtn_mus_query_conf_remove_track;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_album_waiting_deleting
+// Text for single item deletion wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_album_waiting_deleting
+    {
+    buf = qtn_album_waiting_deleting;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_query_conf_delete_all
+// Text for group deletion wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mus_query_conf_delete_all
+    {
+    buf = qtn_mus_query_conf_delete_all;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_title_collection_details
+// Text used for Collection Details title.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_title_collection_details
+    {
+    buf = qtn_nmp_title_collection_details1;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_title_playlist_details
+// Text used for Collection Details title.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_title_playlist_details
+    {
+    buf = qtn_mus_title_details_pl;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_phone_memory_root_path
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_phone_memory_root_path
+    {
+    buf = text_phone_memory_root_path;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_memory_card_root_path
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_memory_card_root_path
+    {
+    buf = text_memory_card_root_path;
+    }
+
+#ifdef RD_MULTIPLE_DRIVE
+// -----------------------------------------------------------------------------
+// r_mpx_cui_collection_details_card_unavailable_item
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_cui_collection_details_memory_unavailable
+    {
+    buf = qtn_nmp_memory_unavailable;
+    }   
+#endif // RD_MULTIPLE_DRIVE   
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_collection_details_card_unavailable_item
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_cui_collection_details_card_unavailable_item
+    {
+    buf = qtn_nmp_mmc_unavailable;
+    }   
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_prmpt_new_name
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_nmp_prmpt_new_name
+    {
+    buf = qtn_nmp_prmpt_new_name;
+    }   
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_mp_unknown
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_mp_unknown
+    {
+    buf = qtn_mp_list_unknown;
+    }   
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_unknown_artist
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_nmp_unknown_artist
+    {
+    buf = qtn_nmp_title_unknown_artist;
+    }   
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_mus_title_unknown_album
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_mus_title_unknown_album
+    {
+    buf = qtn_mus_title_unknown_album;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_mus_title_unknown_genre
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_mus_title_unknown_genre
+    {
+    buf = qtn_mus_title_unknown_genre;
+    }   
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_mus_title_unknown_composer
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_mus_title_unknown_composer
+    {
+    buf = qtn_mus_title_unknown_composer;
+    }       
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_delete_fail
+// Text used when a delete fails due to a file in use error
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_delete_fail
+    {
+    buf = qtn_nmp_delete_file_open;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_delete_fail_multi_selection
+// Text used when a delete fails due to a file in use error
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_delete_fail_multi_selection
+    {
+    buf = qtn_nmp_delete_mutl_file_open;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_updating_multiple_items
+// wait note text for updating multiple items
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_updating_multiple_items
+    {
+    buf = qtn_nmp_note_updating_name;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_updating_item
+// wait note text for updating single item
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_updating_item
+    {
+    buf = qtn_nmp_note_updating_name1;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_info_file_not_found
+// info note for file not found
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_info_file_not_found
+    {
+    buf = qtn_mp_note_broken_file;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_query_send_invalid_songs_txt
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_query_send_invalid_songs_txt
+    {
+    buf = qtn_nmp_query_send_valid_songs1;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_send_all_invalid_songs_note_txt
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_send_all_invalid_songs_note_txt
+    {
+    buf = qtn_nmp_note_nothing_to_send;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_category_artist_lbx_emptytext
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_artist_lbx_emptytext
+    {
+    buf = qtn_nmp_no_artists_editor;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_album_lbx_emptytext
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_album_lbx_emptytext
+    {
+    buf = qtn_nmp_no_albums_editor;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_genre_lbx_emptytext
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_genre_lbx_emptytext
+    {
+    buf = qtn_nmp_no_genres_editor;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_composer_lbx_emptytext
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_composer_lbx_emptytext
+    {
+    buf = qtn_nmp_no_composers_editor;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_songs_lbx_emptytext
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_song_lbx_emptytext
+    {
+    buf = qtn_nmp_no_songs_editor;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_rename_with_invalid
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_rename_with_invalid
+    {
+    buf = qtn_nmp_note_rename_with_invalid;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_empty_playlist
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_empty_playlist
+    {
+    buf = qtn_nmp_note_empty_playlist;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_menu_play_via_on_device
+// Text used when Play via sub menu opens
+// This is local player type name
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_menu_play_via_on_device
+    {
+    buf = qtn_nmp_options_play_device;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_menu_play_via_home_net
+// Text used when Play via sub menu opens
+// This is remote player type name
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_menu_play_via_home_net
+    {
+    buf = qtn_nmp_options_play_homenet;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_remote_connection_failed
+// Text used when a remote connection failed and player reverts to Local
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_remote_connection_failed
+    {
+    buf = qtn_nmp_note_remote_connection_failed;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_del_batch_songs_wait_note
+// Text for group deletion wait note.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_del_batch_songs_wait_note
+    {
+    buf = qtn_nmp_del_batch_songs_wait_note;
+    }
+
+    
+//------------------------------------------------------------------------------
+// r_mpx_progress_note
+// Generic Progress note.      
+//------------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_progress_note
+    {
+    flags = EAknProgressNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = 0x1000;
+            control = AVKON_NOTE
+                {
+                layout = EProgressLayout;
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/eabi/mpxcollectionviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_ZN18CMPXCollectionView4NewLEv @ 1 NONAME
+	_ZN18CMPXCollectionView5NewLCEv @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxcollectionview.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxcollectionview.loc	APP_LAYER_LOC_EXPORT_PATH(mpxcollectionview.loc)
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxcollectionview.mif
+OPTION HEADERFILE mpxcollectionview.mbg
+OPTION SOURCEFILE iconlist.txt
+END
+
+
+PRJ_MMPFILES
+//gnumakefile mpxcollectionviewicons.mk
+
+mpxcollectionview.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+-c8,8 qgn_prop_mup_songs
+-c8,8 qgn_prop_mup_artist
+-c8,8 qgn_prop_mup_album
+-c8,8 qgn_prop_mup_playlist
+-c8,8 qgn_prop_mup_playlist_auto
+-c8,8 qgn_prop_mup_genre
+-c8,8 qgn_prop_mup_composer
+-c8,8 qgn_menu_folder_apps
+-c8,8 qgn_prop_mup_audio
+-c8,8 qgn_prop_unknown
+-c8,8 qgn_graf_mup_npv_icon_pause
+-c8,8 qgn_graf_mup_npv_icon_play
+-c8,8 qgn_indi_mup_forw_add
+-c8,8 qgn_indi_mup_rew_add
+-c8,8 qgn_indi_mmc_add
+-c8,8 qgn_graf_mup_adtl_reorder_down
+-c8,8 qgn_graf_mup_adtl_reorder_up
+-c8,8 qgn_graf_mup_adtl_reorder_updown
+-c8,8 qgn_graf_mup_ctx_reordersong
+-c8,8 qgn_graf_mup_lst_userplayl
+-c8,8 qgn_graf_mup_lst_corrupttrack
+-c8,8 qgn_graf_mup_lst_brokentrack
+-c8,8 qgn_graf_mup_lst_brokenplayl
+-c8,8 qgn_graf_mup_lst_drm_exp
+-c8,8 qgn_graf_mup_dlst_podcast
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/group/mpxcollectionview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxcollectionview.
+*
+*/
+
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../../../inc/musicplayerbldvariant.hrh"
+
+TARGET          mpxcollectionview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC7F
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+#ifdef IAD_INCLUDE_UPNP 
+MACRO UPNP_INCLUDED
+#endif
+
+//MACRO __S60_MPX_UI_SPEC_COMPLIANCE
+//MACRO __S60_MPX_COLLECTIONVIEW_MSK
+MACRO __ENABLE_MSK
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+#define __ENABLE_PODCAST_IN_MUSIC_MENU
+MACRO __HG_COLLECTIONVIEW
+#ifdef IAD_INCLUDE_BACKSTEPPING
+MACRO BACKSTEPPING_INCLUDED 
+#endif
+
+SOURCEPATH      ../src
+SOURCE          mpxcollectionviewimp.cpp
+SOURCE          mpxcollectionview.cpp
+SOURCE          mpxcollectionviewcontainer.cpp
+SOURCE          mpxcollectionviewlistboxarray.cpp
+
+START RESOURCE  ../data/mpxcollectionview.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+LIBRARY         eikctl.lib
+LIBRARY         euser.lib
+LIBRARY         apgrfx.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         egul.lib
+LIBRARY         estor.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknicon.lib
+LIBRARY         commonengine.lib
+LIBRARY         sendui.lib
+LIBRARY         centralrepository.lib
+LIBRARY         platformenv.lib // pathinfo
+LIBRARY         commondialogs.lib
+LIBRARY         profileeng.lib
+
+LIBRARY         alfclient.lib
+
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcollectionhelper.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxcommoncontainer.lib
+
+LIBRARY         servicehandler.lib  // AIW
+
+#ifdef IAD_INCLUDE_UPNP
+LIBRARY         upnpcommand.lib
+#endif
+
+LIBRARY         playbackhelper.lib // CMediaRecognizer
+// Cover UI start
+LIBRARY         eikdlg.lib
+LIBRARY         mediatorclient.lib
+LIBRARY         featmgr.lib
+// Cover UI end
+
+#ifdef IAD_INCLUDE_BACKSTEPPING
+LIBRARY         mpxbacksteppingutility.lib 
+#endif // IAD_INCLUDE_BACKSTEPPING
+
+LIBRARY         ecom.lib
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/group/mpxcollectionviewicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxcollectionview
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxcollectionview.mif
+HEADERFILENAME=$(HEADERDIR)/mpxcollectionview.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/inc/mpxcollectionview.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxcollectionview
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONVIEW_HLP_HRH
+#define MPXCOLLECTIONVIEW_HLP_HRH
+
+_LIT( KMusHlpLibMainView, "MUS_HLP_LIB_MAIN_VIEW" );
+_LIT( KMusHlpPlaylistView, "MUS_HLP_PLAYLISTS_VIEW" );
+_LIT( KMusHlpCategoryView, "MUS_HLP_CATEGORY_VIEW" );
+_LIT( KMusHlpTracksView, "MUS_HLP_TRACKS_VIEW" );
+_LIT( KMusHlpPlaylistTracksView, "MUS_HLP_PLAYLISTS_VIEW" );
+_LIT( KMusHlpEmbeddedPlaylistTracksView, "MUS_HLP_PLAYLISTS_VIEW" );
+
+#endif  // MPXCOLLECTIONVIEW_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/inc/mpxcollectionview.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxcollectionview
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONVIEW_HRH
+#define MPXCOLLECTIONVIEW_HRH
+
+// ENUMS
+
+// Collection view ID
+enum TMPXCollectionViewIds
+    {
+    KMPXCollectionViewId = 20001
+    };
+    
+// command ID's
+enum TMPXCollectionCommandIds
+    {
+    EMPXCmdSongDetails = 0x0010,
+    EMPXCmdAlbumArt,
+    EMPXCmdSend,
+    EMPXCmdDelete,
+    EMPXCmdSetAsRingtone,
+    EMPXCmdCreatePlaylist,
+    EMPXCmdAddToPlaylist,
+    EMPXCmdAddToNewPlaylist,
+    EMPXCmdAddToSavedPlaylist,
+    EMPXCmdFindInMusicShop,
+    EMPXCmdRename,
+    EMPXCmdPlaylistDetails,
+    EMPXCmdReorder,
+    EMPXCmdAddSongs,
+    EMPXCmdRemove,
+    EMPXCmdGoToMusicShop,
+    EMPXCmdGoToMultipleMusicShop,
+    EMPXCmdGoToNokiaMusicShop,
+    EMPXCmdGoToOperatorMusicShop,
+    EMPXCmdMusicLibraryDetails,
+    EMPXCmdSavePlaylist,
+    EMPXCmdReorderGrab,
+    EMPXCmdReorderDrop,
+    EMPXCmdReorderDone,
+    EMPXCmdReorderCancel,
+    EMPXCmdUpArrow,
+    EMPXCmdDownArrow,
+    EMPXCmdUpArrowAfterListboxHandled,
+    EMPXCmdDownArrowAfterListboxHandled,
+    EMPXCmdFind,
+    EMPXCmdFindCancel,
+    EMPXCmdUPnPAiwCmdCopyToExternalCriteria,    
+    EMPXCmdUpnpPlayVia,
+    EMPXCmdUpnpPlayViaLocal,
+    EMPXCmdUpnpPlayViaRemotePlayer,  // 0x101D
+    // Should always be the last one in the list.  Sets the end of the Upnpplayer commands.
+    // Allows for dynamic upnp player commands.  Currently set to allow up to 28 more
+    // dynamic players.  If more are needed then this number needs to be adjusted.
+    EMPXCmdUpnpLastCommandId = 0x0055,
+    EMPXCmdAiwCmdAssign,
+    EMPXCmdUseAsCascade
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU                
+    ,EMPXCmdRefreshLibrary
+#endif
+    };
+
+// current MediaL operation
+enum TMPXCollectionViewCurrentMediaLOp
+    {
+    EMPXOpMediaLIdle,
+    EMPXOpMediaLCopyToRemote,
+    EMPXOpMediaLGetContainerInfo,
+    EMPXOpMediaLSend,
+    EMPXOpMediaLCollectionDetails,
+    EMPXOpMediaLPlaylistDetails,
+    EMPXOpMediaLRenamePlaylist,
+    EMPXOpMediaLSongDetailsFileCheck,
+    EMPXOpMediaLAlbumArtFileCheck,
+    EMPXOpMediaLNewPlaylistCollectionSongCount,
+    EMPXOpMediaLFindInMusicShopSongDetails,
+    EMPXOpMediaLFindInMusicShopMediaLCompleted
+    };
+
+// current FindAllL operation    
+enum TMPXCollectionViewCurrentFindAllLOp
+    {
+    EMPXOpFindAllLIdle,
+    EMPXOpFindAllLUpnp,
+    EMPXOpFindAllLGetPlaylists,
+    EMPXOpFindAllLRenameArtist,
+    EMPXOpFindAllLRenameAlbum,
+    EMPXOpFindAllLRenameGenre,
+    EMPXOpFindAllLRenameComposer,
+    EMPXOpFindAllLAlbumArtistAddToNewPlaylist,
+    EMPXOpFindAllLAlbumArtistAddToSavedPlaylist,
+    EMPXOpFindAllLPlaylistTracksCount,
+    EMPXOpFindAllLUpnpPlayback
+    };    
+
+// current playlist related operation    
+enum TMPXCollectionViewCurrentPlaylistOp
+    {
+    EMPXOpPLIdle,
+    EMPXOpPLCreating,
+    EMPXOpPlOpening
+    };
+
+// headings in file detail dialog
+enum TMPXCollectionDetailsHeading
+    {
+    EMPXCollectionDetailsSongs,
+    EMPXCollectionDetailsDuration,
+    EMPXCollectionDetailsPhoneMemory,
+    EMPXCollectionDetailsMemoryCard,
+    EMPXCollectionDetailsRefreshed,
+    EMPXCollectionDetailsCount
+    };
+
+// headings in playlist detail dialog    
+enum TMPXPlaylistDetailsHeading
+    {
+    EMPXPlaylistDetailsName,
+    EMPXPlaylistDetailsSongs,
+    EMPXPlaylistDetailsDuration,
+    EMPXPlaylistDetailsUri,
+    EMPXPlaylistDetailsDate,
+    EMPXPlaylistDetailsTime,
+    EMPXPlaylistDetailsCount
+    };
+
+#endif  // MPXCOLLECTIONVIEW_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/inc/mpxcollectionviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Collection view container implementation
+*
+*/
+
+
+
+#ifndef CMPXCOLLECTIONVIEWCONTAINER_H
+#define CMPXCOLLECTIONVIEWCONTAINER_H
+
+
+// INCLUDES
+#include <mpxcommonframeworkdefs.h> // TMPXItemId
+#include "mpxviewcontainer.h"
+#include "mpxcommoncontainer.h"
+
+// FORWARD DECLARATION
+class TAknsItemID;
+class CAknContextPane;
+class CMPXCommonContainerFactory;
+class MMPXCommonContainer;
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Collection view container.
+ *
+ *  @lib mpxcollectionview.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXCollectionViewContainer )
+    : public CBase
+    , public MMPXViewContainer
+    , public MMPXCommonListBoxArrayObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 5.1
+     * @param aView Command observer.
+     * @param aObserver MEikListBoxObserver
+     * @param aIsEmbedded ETrue to indicate that view is embedded
+     * @return Pointer to newly created object.
+     */
+    static CMPXCollectionViewContainer* NewL(
+        MEikCommandObserver* aView,
+        MEikListBoxObserver* aObserver,
+        TBool aIsEmbedded );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCollectionViewContainer();
+
+    /**
+     * Sets playback status with item id
+     *
+     * @param aId item id of the song
+     * @param aStatus status of the song
+     */
+    void SetPlaybackStatusByIdL( TMPXItemId aId, TMPXPlaybackState aStatus, TInt aIndex = 0 );
+
+    /**
+     * Get current playback index
+     *
+     * @return Current playback index, KErrNotFound if nothing is playing
+     */
+    TInt PlaybackIndex();
+
+    /**
+     * Activates reorder mode
+     *
+     * @param aEnable ETrue to enable reorder mode, EFalse to disable
+     */
+    void ActivateReorderMode( TBool aEnable );
+
+    /**
+     * Set reorder mode
+     *
+     * @param aEnable ETrue to enable reorder mode, EFalse to disable reorder mode
+     * @param aIndex current selected index
+     */
+    void SetReorderGrabbedMode( TBool aEnable, TInt aIndex = 0 );
+
+    /**
+     * Determines if it's currently in reorder mode
+     *
+     * @return ETrue if in reorder mode, EFalse otherwise
+     */
+    TBool IsInReorderMode();
+
+    /**
+     * Move current reorder index relatively
+     *
+     * @param aDirection +1 to move down, -1 to move up
+     */
+    void MoveReorderIndex( TInt aDirection );
+
+    /**
+     * Set current reorder index
+     *
+     * @param aIndex current reorder index
+     */
+    void SetReorderIndex( TInt aIndex );
+
+    /**
+     * Confirm reorder
+     */
+    void ConfirmReorderL();
+
+    /**
+     * Cancel reorder
+     */
+    void CancelReorder();
+
+    /**
+     * Gets original index of currently selected item in reorder mode
+     */
+    TInt GetOriginalIndex();
+
+    /**
+     * Update Titlepane icon to reorder image
+     */
+    void UpdateReorderTitleIconL();
+
+    /**
+     * Update titlepane to use original icon
+     */
+    void RestoreOriginalTitleIconL();
+
+    /**
+     * Content is ready
+     */
+    void ContentIsReady( TBool aReady );
+
+    /**
+     * Return common container
+     *
+     * @since 3.2
+     */
+    MMPXCommonContainer* Common();
+
+// from base class MMPXViewContainer
+
+    /**
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse HandleKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * Handles the retrieval of the view container's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void HandleHelpContext( TCoeHelpContext& aContext ) const;
+
+    /**
+     * Returns the indicators for the specified item within the view container
+     *
+     * @param aIndex specified array index
+     * @return Indicator icon indices
+     */
+    RArray<TInt> IndicatorsL( TInt aIndex );
+
+private:
+
+    /**
+     * C++ constructor.
+     */
+    CMPXCollectionViewContainer(
+        MEikCommandObserver* aView,
+        MEikListBoxObserver* aObserver,
+        TBool aIsEmbedded);
+
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Creates listbox array
+     */
+    CMPXCommonListBoxArrayBase* CreateListBoxArrayL();
+
+// from base class MMPXCommonListBoxArrayObserver
+
+    /**
+     * From MMPXCommonListBoxArrayObserver.
+     * Handle listbox array events
+     *
+     *  @param aEvent list box event
+     */
+    void HandleListBoxArrayEventL(
+        MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent );
+
+private: // data member
+
+    MMPXCommonContainer*            iCommonContainer; // Owned
+    MEikCommandObserver*            iView; // not owned
+    MEikListBoxObserver*            iListBoxObserver; // not owned
+    CAknContextPane*                iContextPane;    // Not owned
+    CMPXCollectionViewListBoxArray* iLbxArray; // Not owned
+    CEikImage*                      iNewIcon;  // New context icon, owned
+    CEikImage*                      iOrigIcon;  // New context icon, not owned
+    TBool                           iReorder;
+    TBool                           iReady;
+    TBool                           iIsEmbedded;
+    };
+
+#endif  // CMPXCOLLECTIONVIEWCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/inc/mpxcollectionviewimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,964 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX collection view implementation
+*
+*/
+
+
+#ifndef C_CMPXCOLLECTIONVIEWIMP_H
+#define C_CMPXCOLLECTIONVIEWIMP_H
+
+// INCLUDES
+#include <eikspmod.h>
+#include <eikclb.h>
+#include <AknProgressDialog.h>  // MProgressDialogCallback
+#include <eikprogi.h>
+#include <AknWaitDialog.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxcollectionobserver.h>
+#include <mpxplaybackobserver.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionuihelperobserver.h>
+#include <mpxcollectionhelper.h>
+#include <mpxcollectionpath.h>  // TMPXItemId
+#include <mpxviewactivationobserver.h>
+
+#include "mpxcollectionview.h"
+#include "mpxplaybackframeworkdefs.h" // TMPXPlaybackPlayerType
+#include "mpxwaitnotedefs.h"
+
+// FORWARD DECLARATIONS
+class CMPXCollectionViewContainer;
+class MMPXCollectionUtility;
+class CMPXCollectionPlaylist;
+class MMPXPlaybackUtility;
+class CMPXCommonUiHelper;
+class MMPXViewUtility;
+class CSendUi;
+class CAknNavigationDecorator;
+class CAknNaviLabel;
+class CAknNavigationControlContainer;
+class CEikButtonGroupContainer;
+class MProfileEngine;
+class CAknQueryDialog;
+class CMPXCollectionOpenUtility;
+
+class CMediatorCommandInitiator;
+
+class MMPXPlayerManager;
+class CAiwServiceHandler;
+
+#ifdef BACKSTEPPING_INCLUDED
+class MMPXBackSteppingUtility;
+#endif // BACKSTEPPING_INCLUDED
+class CMediaRecognizer;
+class CAiwGenericParamList;
+#ifdef UPNP_INCLUDED
+class CUpnpCopyCommand;
+#endif
+// CLASS DECLARATION
+
+/**
+ *  MPX collection view.
+ *
+ *  @lib mpxcollectionview.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXCollectionViewImp ) : public CMPXCollectionView,
+                                             public MMPXCollectionObserver,
+                                             public MMPXPlaybackObserver,
+                                             public MMPXPlaybackCallback,
+                                             public MEikListBoxObserver,
+                                             public MProgressDialogCallback,
+                                             public MMPXCollectionFindObserver,
+                                             public MMPXCollectionHelperObserver,
+                                             public MMPXCHelperObserver,
+                                             public MMPXViewActivationObserver,
+                                             public MCoeViewDeactivationObserver,
+                                             public MCoeViewActivationObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXCollectionViewImp* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXCollectionViewImp* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCollectionViewImp();
+
+    /**
+     * Launch music shop application.
+     *
+     * @ since 3.1
+     */
+    void LaunchMusicShopL();
+
+
+private:
+
+    /**
+     * C++ constructor.
+     */
+    CMPXCollectionViewImp();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Delete the selected items
+     * @param aCommand the command that triggered the deletion
+     *
+     */
+    void DeleteSelectedItemsL(TInt aCommand);
+
+    /**
+     * Updates list box
+     *
+     * @param aEntries collection entries opened
+     * @param aIndex focused entry
+     * @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     */
+    void UpdateListBoxL(
+        const CMPXMedia& aEntries,
+        TInt aIndex,
+        TBool aComplete);
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error code to be handled.
+     */
+    void HandleError( TInt aError );
+
+    /**
+     * Updates the navi pane
+     */
+    void UpdateNaviPaneL();
+
+    /**
+     * Updates the title pane
+     */
+    void UpdateTitlePaneL();
+
+    /**
+     * Update navi pane in reorder mode
+     */
+    void UpdateReorderNaviPaneL();
+
+    /**
+     * Updates playback status/indicator
+     * Returns the current selection index of now playing song
+     * if a match is found in current context
+     *
+     * @return Index of the song that is currently playing
+     */
+    TInt UpdatePlaybackStatusL();
+
+    /**
+     * Start either the refresh or scanning note
+     */
+    void StartWaitNoteL( TWaitNoteType aNoteType );
+
+    /**
+     * Start either the delete progress note
+     *
+     */
+    void StartProgressNoteL();
+
+    /**
+     * Updates the progress note text and progress bar
+     *
+     * @param aProgress Indicates the portion of the process completed
+     * @param aProgressText Text to be displayed on the progress note
+     */
+    void UpdateProcessL( TInt aProgress, const TDesC& aProgressText );
+
+    /**
+    * Close a wait note
+    */
+    void CloseWaitNoteL();
+
+    /**
+     * Activates reorder mode
+     */
+    void ActivateReorderGrabbedModeL();
+
+    /**
+     * Deactivates reorder mode
+     *
+     * @param aExit ETrue to exit reorder mode, EFalse otherwise
+     */
+    void DeactivateReorderGrabbedModeL( TBool aExit );
+
+    /**
+     * Change the button group
+     *
+     * @param aResId resource ID
+     */
+    void SetNewCbaL( TInt aResId );
+
+    /**
+     * Display the details dialog
+     *
+     * @param aDataArray Array containing the data to display
+     * @param aDialogResourceId Resource defination for the dialog
+     * @param aTitleResourceId Resource defination for the title of the dialog
+     */
+    void DisplayDetailsDialogL( MDesC16Array& aDataArray,
+        TInt aDialogResourceId, TInt aTitleResourceId );
+
+    /**
+     * Display collection details
+     *
+     * @param aMedia media object containing the library details
+     */
+    void DoShowCollectionDetailsL( const CMPXMedia& aMedia );
+
+    /**
+     * Display playlist details
+     *
+     * @param aMedia media object containing the playlist details
+     */
+    void DoShowPlaylistDetailsL( const CMPXMedia& aMedia );
+
+    /**
+     * Handles Upnp menus from DynInitMenuPaneL()
+     *
+     * @param aResourceId Resource id of the option menu
+     * @param aMenuPane Reference to the menu pane
+     */
+    void HandleDynInitUpnpL( TInt aResourceId, CEikMenuPane& aMenuPane );
+
+    /**
+     * Checks if UPnP AP is defined
+     *
+     * @return ETrue if visible, EFalse otherwise
+     */
+    TBool IsUpnpVisible();
+
+    /**
+     * Displays the available players in the Play via submenu
+     *
+     * @param aMenuPane Menu pane to put the sub menu items
+     */
+    void AddPlayersNamesToMenuL( CEikMenuPane& aMenuPane );
+
+    /**
+     * Adds one player type to the Play via submenu
+     *
+     * @param aMenuPane menu pane to add player name to
+     * @param aCommandId ID of the command
+     * @param aPlayerManager player manager
+     * @param aPlayerType type of the player
+     * @param aMenuText optional menu text
+     */
+     void AddPlayerNameToMenuL( CEikMenuPane& aMenuPane,
+                                TInt aCommandId,
+                                MMPXPlayerManager& aPlayerManager,
+                                TMPXPlaybackPlayerType& aPlayerType,
+                                const TDesC& aMenuText = KNullDesC );
+
+    /**
+     * Retrieves the current player name and type
+     */
+    void GetCurrentPlayerDetails();
+
+    /**
+     * Selects a new player for audio playback
+     *
+     * @param aCommand Command Id to identify which player to use
+     */
+    void SelectNewPlayerL( TInt aCommand );
+
+    /**
+     * Copies selected file(s) to remote player
+     */
+    void CopySelectedItemsToRemoteL();
+
+    /**
+     * Handle call back from collectionframework for Copy to Remote command
+     *
+     * @param aMedia media
+     * @param aComplete all selected medias have been found
+     */
+    void DoHandleCopyToRemoteL(
+        const CMPXMedia& aMedia, TBool aComplete = ETrue );
+
+
+    /**
+     * Create and launch the search URL page to the Service
+     * @param song name, artistname, album name
+     */
+    void DoFindInMusicShopL(const TDesC& aSongName,
+                            const TDesC& aArtistName,
+                            const TDesC& aAlbumName );
+
+    /**
+     * Parameter passed in from viewframework
+     *
+     * @param aParam Parameter pass in from viewframework.
+     */
+    void SetParamL( const TDesC* aParam );
+
+    /**
+     * Get media property for the current song
+     */
+    void DoGetSongMediaPropertyL();
+
+    /**
+     * Find playlists
+     *
+     * @return the number of playlist in the system
+     */
+    TInt FindPlaylistsL();
+
+    /**
+     * Save the changes to the playlist that is currently displaying
+     */
+    void SaveCurrentPlaylistL();
+
+    /**
+     * Handles rename operation complete
+     */
+    void HandleRenameOpCompleteL();
+
+    /**
+     * Checks if send option should be shown
+     *
+     * @return ETrue if send command should be hiden, EFalse if it should be shown
+     */
+    TBool SendOptionVisibilityL();
+
+    /**
+     * Checks if Set as ringtone option should be shown
+     *
+     * @return ETrue if the command should be hiden, EFalse if it should be shown
+     */
+    TBool SetAsRingToneOptionVisibilityL();
+
+    /**
+     * Checks if file details option should be shown
+     *
+     * @return ETrue if the command should be hiden, EFalse if it should be shown
+     */
+    TBool FileDetailsOptionVisibilityL();
+
+    /**
+     * Handle send command
+     */
+    void DoSendL();
+
+    /**
+     * Handle send playlist command
+     *
+     * @param aItemId playlist id
+     */
+    void DoSendPlaylistL( TMPXItemId aItemId );
+
+    /**
+     * Handle call back from collectionframework for send command
+     *
+     * @param aMedia media
+     */
+    void DoHandleSendL( const CMPXMedia& aMedia );
+
+    /**
+     * Handle rename command
+     */
+    void DoHandleRenameL();
+
+    /**
+     * Prepares media object for selected items
+     *
+     * @param aMedia on return, populates the media object with a media array
+     *        containing info for currently selected items used by playlist
+     *        does not own this object
+     */
+    void PrepareMediaForSelectedItemsL( CMPXMedia& aMedia );
+
+    /**
+     * Populates media object with information needed for save to
+     * existing playlist
+     *
+     * @param aMedia media object containing the entry
+     * @param aCollectionId Id for collection containing the object
+     * @return Media object needed for save to playlist operation
+     */
+    CMPXMedia* PopulateMediaLC( const CMPXMedia& aMedia, TMPXItemId aCollectionId );
+
+    /**
+     * Handle rename playlist command
+     * @param aMedia media
+     */
+    void DoHandleRenamePlaylistL( const CMPXMedia& aMedia );
+
+    /**
+     * Set/clears the flags for item in database
+     * @param aIndex index of the item in the list box
+     * @param aMedia media object containing at least the following attribute:
+     *        TMPXAttribute( KMPXMediaIdGeneral,EMPXMediaGeneralCollectionId )
+     * @param aFlag flag to set/clear
+     * @param aSet ETrue to set the flag, EFalse to clear the flag
+     * @param aEnableInfoDialog ETrue to enable info dialog display, EFalse to disable
+     */
+    void UpdateDatabaseFlagL( TInt aIndex, const CMPXMedia& aMedia,
+        TUint aFlag, TBool aSet, TBool aEnableInfoDialog = ETrue );
+
+    /**
+     * Get duration of current view
+     */
+    void GetDurationL();
+
+    /**
+     * Handles file check result
+     *
+     * @param aViewToActivate View to activate if the result is ok
+     * @param aMedia Media object containing the information
+     */
+    void DoHandleFileCheckResultL( TUid aViewToActivate, const CMPXMedia& aMedia );
+
+#ifdef __ENABLE_MSK
+    /**
+     * Updates the middle softkey display to a label or icon depending on
+     *  whether there are marked indices
+     * @param aMskId middle softkey command id
+     */
+    void UpdateMiddleSoftKeyDisplayL( TInt aMskId );
+#endif // __ENABLE_MSK
+
+    /**
+     * Handles the completion of adding a playlist event.
+     * @param aPlaylist, a media object representing the exported
+     *        playlist. The content of this object is the same
+     *        as what's supplied in AddPlaylistL, except that
+     *        URI for the playlist file is added to the object
+     *        upon successful processing of AddPlaylistL. Client
+     *        should take over the ownership of this object. NULL
+     *        if an error has occured while processing AddPlaylistL.
+     * @param aError. the error code for AddPlaylistL processing
+     *        error.
+     */
+    void HandleAddCompletedL( CMPXMedia* aPlaylist, TInt aError );
+
+    /**
+    * Handles the completion of setting a media event.
+    * @param aMedia, a media object representing the updated media.
+    * @param aError. the error code for SetL processing error.
+    */
+    void HandleSetCompletedL( CMPXMedia* aMedia, TInt aError );
+
+    /**
+     * Handle playback message
+     *
+     * @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+    /**
+     * Handle collection message
+     *
+     * @param aMessage collection message
+     */
+    void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+
+    /**
+    * Calls to Re-open the collection view
+    * @param aShowWaitDlg show the "opening" dialog or not
+    */
+    void DoIncrementalOpenL( TBool aShowWaitDlg = ETrue );
+
+    /**
+     * Start wait note for delayed action due to the items not ready
+     * (incremental openL change)
+     *
+     * @param aCommand the action to be executed when the items become ready
+     * @param aNote text for wait note
+     * @param aSkipDisplay flag use to determine if waitnote should be displayed or not
+     */
+    void StartDelayedActionL( TInt aCommand, TDesC& aNote, TBool aSkipDisplay = EFalse );
+
+// from base class MProgressDialogCallback
+
+    /**
+     * From MProgressDialogCallback
+     * Callback method
+     * Get's called when a dialog is dismissed.
+     *
+     * @param aButtonId Button pressed when the dialog is dismissed
+     */
+    void DialogDismissedL( TInt aButtonId );
+
+// from base class MMPXCollectionObserver
+
+    /**
+     * From MMPXCollectionObserver
+     * Handle collection message.
+     *
+     * @param aMessage Collection message
+     * @param aErr system error code.
+     */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d a folder
+     *
+     *  @param aEntries collection entries opened
+     *  @param aIndex focused entry
+     *  @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     *  @param aError error code
+     */
+    void HandleOpenL(
+        const CMPXMedia& aEntries,
+        TInt aIndex,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d an item. Client typically responds by
+     *  'playing' the item
+     *
+     *  @param aPlaylist collection path to item
+     *  @param aError error code
+     */
+    void HandleOpenL(
+        const CMPXCollectionPlaylist& aPlaylist,
+        TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handle media properties
+     *
+     *  @param aMedia media
+     *  @param aError error code
+     */
+    void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+    /**
+     * From MMPXCollectionObserver
+     */
+    void HandleCommandComplete(CMPXCommand* aCommandResult,
+                               TInt aError);
+
+// from base class MMPXCollectionHelperObserver
+
+    /**
+     * From MMPXCollectionHelperObserver
+     * Callback function to signal that adding a file is complete
+     *
+     * @param aError, error of the operation
+     */
+    void HandleAddFileCompleteL( TInt aErr );
+
+// from base class MMPXCHelperObserver
+
+    /**
+     * From MMPXCHelperObserver
+     * Handles the completion of any collection helper event.
+     *
+     * @param aOperation, operation completed
+     * @param aErr. the error code
+     * @param aArgument Argument returned from the operation
+     */
+    void HandleOperationCompleteL( TCHelperOperation aOperation,
+                                   TInt aErr,
+                                   void* aArgument );
+
+// from base class MMPXPlaybackObserver
+
+    /**
+     * From MMPXPlaybackObserver
+     * Handle playback message
+     *
+     * @param aMessage playback message
+     * @param aErr system error code.
+     */
+    void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+// from base class MMPXPlaybackCallback
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle playback property
+     *
+     * @param aProperty the property
+     * @param aValue the value of the property
+     * @param aError error code
+     */
+    void HandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue,
+        TInt aError );
+
+    /**
+     * 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
+     *
+     * @param aPlayer UID of the player
+     * @param aSubPlayers a list of sub players
+     * @param aComplete ETrue no more sub players. EFalse more subplayer
+     *                  expected
+     * @param aError error code
+     */
+    void HandleSubPlayerNamesL(
+        TUid aPlayer,
+        const MDesCArray* aSubPlayers,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle media properties
+     *
+     * @param aMedia media
+     * @param aError error code
+     */
+    void HandleMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Returns views id.
+     *
+     * @return Views Uid
+     */
+    TUid Id() const;
+
+    /**
+     * From CAknView
+     * Command handling function.
+     *
+     * @param aCommand Command which is handled
+     */
+    void HandleCommandL( TInt aCommand );
+
+	/**
+	 * From CAknView
+	 * Called when status pane layout has changed
+	 */
+	void HandleStatusPaneSizeChange();
+
+    /**
+     * From CAknView
+     * Handles a view activation.
+     *
+     * @param aPrevViewId Specifies the view previously active.
+     * @param aCustomMessageId Specifies the message type.
+     * @param aCustomMessage The activation message.
+     */
+    void DoActivateL(
+        const TVwsViewId& aPrevViewId,
+        TUid aCustomMessageId,
+        const TDesC8& aCustomMessage );
+
+    /**
+     * From CAknView
+     * View deactivation function.
+     */
+    void DoDeactivate();
+
+    /**
+     * From CAknView
+     * Foreground event handling function.
+     *
+     * @param aForeground Indicates the required focus state of the control.
+     */
+    void HandleForegroundEventL( TBool aForeground );
+
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    void DynInitMenuPaneL(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+
+// from MEikListBoxObserver
+
+    /**
+     * From MEikListBoxObserver
+     * Handles listbox events.
+     *
+     * @param aListBox Listbox where the event occurred.
+     * @param aEventType Event type.
+     */
+     void HandleListBoxEventL(
+        CEikListBox* aListBox,
+        TListBoxEvent aEventType );
+
+// from MEikCommandObserver
+
+    /**
+     * From MEikCommandObserver
+     * Processes user commands.
+     *
+     * @param aCommandId ID of the command to respond to.
+     */
+    virtual void ProcessCommandL(TInt aCommandId);
+
+// from MMPXCollectionFindObserver
+
+    /**
+     * From MMPXCollectionFindObserver
+     * Handle callback for "find" operation
+     * @param aEntries, CMPXMedia to be returned
+     * @param aComplete ETrue no more entries. EFalse more entries
+     *                  expected
+     * @param aError error code
+     */
+    virtual void HandleFindAllL(const CMPXMedia& aResults,
+                                TBool aComplete,TInt aError);
+
+// from MMPXViewActivationObserver
+
+    /**
+     * From MMPXViewActivationObserver
+     * Handle view activation.
+     *
+     * @param aCurrentViewType Current view type Uid.
+     * @param aPreviousViewType Previous view type Uid.
+     */
+    void HandleViewActivation(
+        const TUid& aCurrentViewType,
+        const TUid& aPreviousViewType );
+    /**
+     * @see MMPXViewActivationObserver
+     */
+    void HandleViewUpdate(
+        TUid aViewUid,
+        MMPXViewActivationObserver::TViewUpdateEvent aUpdateEvent,
+        TBool aLoaded,
+        TInt aData);
+
+// from MCoeViewActivationObserver
+
+    /**
+     * From MCoeViewActivationObserver
+     * Handle view activation.
+     *
+     * @param aNewlyActivatedViewId newly activated view id.
+     * @param aViewIdToBeDeactivated deactivated view id.
+     */
+    void HandleViewActivation(
+        const TVwsViewId& aNewlyActivatedViewId,
+        const TVwsViewId& aViewIdToBeDeactivated );
+
+// from MCoeViewDeactivationObserver
+    /**
+    * Handles view deactivation notification from view server
+    */
+    void HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,
+                                const TVwsViewId& aNewlyActivatedViewId);
+
+    void InitiateWaitDialogL();
+    void FillAiwParametersL( CAiwGenericParamList& aParamList );
+
+    void GetUint32Presentation( TUint32& aResult, const TDesC8& aBuf, TInt aOffset );
+    /**
+     * Launches Java Midlet Music Store
+     *
+     * @param aUid Uid of the Java app generated dynamically
+     */
+    void LaunchOperatorJavaMusicShopL(TUid aUid) ;
+
+    /**
+     * Launches Native Music Shop
+     *
+     * @param aUid Uid of the native app for music Shp
+     */ 
+ 	void LaunchOperatorNativeMusicShopL();
+ 		/**
+      * Launches Native URL Music Shop
+      *
+      * @param URl of the native app for music Shp
+      */ 
+ 	void LaunchOperatorURLMusicShopL();
+ 	
+ 	/*
+ 	 * Stores the current list box item index.
+ 	 */
+ 	void StoreListboxItemIndexL();
+	
+
+ 	/*
+ 	 * Internal function for registering to BackStepping service.
+ 	 */
+ 	void HandleBacksteppingActivation();
+
+                               
+private:    // Data
+
+    MMPXCollectionUtility*      iCollectionUtility;
+    CMPXCollectionViewContainer* iContainer;
+    MMPXPlaybackUtility*        iPlaybackUtility;
+    MMPXViewUtility*            iViewUtility;
+    CMPXCommonUiHelper*         iCommonUiHelper;
+    MMPXCollectionUiHelper*     iCollectionUiHelper;
+    MMPXCollectionHelper*       iCollectionHelper;
+    CMPXMedia*                  iUserPlaylists;
+
+    CSendUi*                    iSendUi;
+    HBufC*                      iTitle;
+    HBufC*                      iDuration;
+    HBufC*                      iOriginalTitle;
+    HBufC*                      iOriginalDuration;
+    HBufC*                      iNewName;
+    CArrayFix<TInt>*            iBottomIndex;
+
+    TBool                       iBackOneLevel;
+    TBool                       iPossibleJump;
+    TBool                       iIsGrabbed;
+    TBool                       iIsEmbedded;
+    TBool                       iAddingSong;
+    TBool                       iIsDeleting;
+    TBool                       iIsSavingReorderPlaylist;
+    TBool                       iIsWaitNoteCanceled;
+    TBool                       iInvalidFileExist;
+    TBool                       iHandlingKeyEvent;
+    TBool                       iAddingToNewPlaylist;
+    TBool                       iExitOptionHidden;
+    TBool                       iGoToMusicShopOptionHidden;
+    TBool                       iIgnoreNextFocusChangedMessage;
+    TBool                       iCollectionReady;  // for incremental open
+    TBool                       iCollectionCacheReady; //cache ready
+
+    TInt                        iCurrentPlaylistOp;
+    TInt                        iNumSongAddedToPlaylist;
+    TMPXItemId                  iPlaylistId;
+
+    TInt                        iCurrentMediaLOp;   // current mediaL operation
+    TInt                        iCurrentFindAllLOp; // current FindAllL operation
+    TInt                        iLastDepth;
+    TInt                        iPlayIndex;
+    TInt                        iResourceOffset;       // must be freed
+    TInt                        iSetMediaLCount;
+
+    TInt                        iCurrentHighlightedIndex;
+
+    TInt                        iCachedCommand; // for incremental open
+    CListBoxView::CSelectionIndexArray* iCachedSelectionIndex;
+
+    CAknNavigationDecorator*        iNaviDecorator;
+    CAknNaviLabel*                  iNaviLabel;
+    CAknNavigationControlContainer* iNaviPane;
+
+    CEikButtonGroupContainer*       iCurrentCba;
+
+    CAknQueryDialog*            iConfirmationDlg;
+
+    const CArrayFix<TInt>*      iSelectionIndexCache; // not owned
+#ifdef __ENABLE_MSK
+    TInt                            iCurrentMskId;
+    TBool                           iShowContextMenu;
+#endif // __ENABLE_MSK
+
+    MProfileEngine*             iProfileEngine;
+
+    RArray<TUid> iPlayersList;
+    CAiwServiceHandler* iServiceHandler;
+    TInt iErrorAttachCopyMenu;
+    TMPXPlaybackPlayerType iCurrentPlayerType;
+    HBufC* iSubPlayerName;
+
+    HBufC* iCurrentSelectedIndex;   // current selected item index
+    TBool   iUsingNokiaService;
+
+    CMPXCollectionOpenUtility* iIncrementalOpenUtil;
+
+    TInt iUpCount;
+    TInt iDownCount;
+
+    CMediatorCommandInitiator* iCommandInitiator;
+    TPtrC iItemTitle;
+    TInt iWaitNoteId;
+    TBool iCoverDisplay;
+
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+    TBool iPodcast;
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+#ifdef BACKSTEPPING_INCLUDED
+    MMPXBackSteppingUtility* iBackSteppingUtility;
+    TBool iActivateBackStepping;
+#endif // BACKSTEPPING_INCLUDED
+
+    TBool iUSBOnGoing;
+    TBool iInAlbumArtDialog;
+    TBool iDisablePodcasting;
+    TProcessPriority iPriority;
+    TBool iInSongDetails;
+
+    TBool iUpnpFrameworkSupport;
+    CMediaRecognizer* iMediaRecognizer;
+    TInt iErrorAttachAssignMenu;
+    TWaitNoteType iNoteType;
+
+    // Music Store
+    TInt iOperatorMusicStore;
+    TUint32 iMusicStoreUID;
+	TUint32 iOperatorNativeMusicStoreUID;
+    TUid iOperatorMusicStoreUID;
+    HBufC16* iOperatorMusicStoreName;
+    TInt iOperatorMusicStoreType;
+    TInt iMusicStoreWebPage;
+    HBufC16* iOperatorMusicStoreURI;
+  
+    // Progress note for delete
+    CAknProgressDialog*	iProgressDialog;
+    CEikProgressInfo*	iProgressInfo;
+    TBool iIsAddingToPlaylist;  // flag used to handle the return by adding songs incrementally  
+#ifdef UPNP_INCLUDED
+    CUpnpCopyCommand* iUpnpCopyCommand; 
+#endif
+    TBool iOpeningNote; // Waitnote is opening
+	TBool iMarkedAll;
+	TBool iFirstIncrementalBatch;
+    };
+
+#endif  // C_CMPXCOLLECTIONVIEWIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/inc/mpxcollectionviewlistboxarray.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,280 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listbox array for collection view.
+*
+*/
+
+
+#ifndef C_CMPXCOLLECTIONVIEWLISTBOXARRAY_H
+#define C_CMPXCOLLECTIONVIEWLISTBOXARRAY_H
+
+#include "mpxcommonlistboxarraybase.h"
+
+// FORWARD DECLARATIONS
+class TAknsItemID;
+
+// CLASS DECLARATION
+
+/**
+ *  Listbox array for collection view container.
+ *  Creates item text descriptors according to the list model.
+ *
+ *  @lib mpxcollectionview.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXCollectionViewListBoxArray ): public CMPXCommonListBoxArrayBase
+    {
+public:  // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.1
+     * @return Pointer to newly created object.
+     */
+    static CMPXCollectionViewListBoxArray* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCollectionViewListBoxArray();
+
+    /**
+     * Sets playback status with item id
+     *
+     * @since 3.1
+     * @param aId item id of the song
+     * @param aStatus status of the song
+     * @return The index of previous playing song
+     */
+    TInt SetPlaybackStatusByIdL( TMPXItemId aId, TMPXPlaybackState aStatus, TInt aIndex );
+
+    /**
+     * Activates reorder mode
+     *
+     * @since 3.1
+     * @param aEnable ETrue to enable reorder mode, EFalse to disable
+     */
+    void ActivateReorderMode( TBool aEnable );
+
+    /**
+     * Set reorder mode
+     *
+     * @since 3.1
+     * @param aEnable ETrue to enable reorder mode, EFalse to disable reorder mode
+     * @param aIndex current selected index
+     */
+    void SetReorderGrabbedMode( TBool aEnable, TInt aIndex = 0 );
+
+    /**
+     * Move current reorder index
+     *
+     * @since 3.1
+     * @param aDirection +1 to move down, -1 to move up
+     */
+    void MoveReorderIndex( TInt aDirection );
+
+    /**
+     * Set current reorder index
+     *
+     * @since 3.1
+     * @param aIndex current reorder index
+     */
+    void SetReorderIndex( TInt aIndex );
+
+    /**
+     * Confirm reorder
+     *
+     * @since 3.1
+     */
+    void ConfirmReorderL();
+
+    /**
+     * Cancel reorder
+     *
+     * @since 3.1
+     */
+    void CancelReorder();
+
+    /**
+     * Gets original index of currently selected item in reorder mode
+     *
+     * @since 3.1
+     * @return The original index of the current item in reorder mode
+     */
+    TInt GetOriginalIndex() const;
+
+    /**
+     * Gets the index for the song that's currently playing
+     *
+     * @return The index for the song that's currently playing
+     */
+    TInt GetPlaybackIndex() const;
+
+    /**
+     * Indicates if Unknown entry exists in this view
+     *
+     * @since 3.1
+     * @return ETrue if "unknown" category exists, EFalse otherwise
+     */
+    TBool IsCategoryUnknownExist() const ;
+
+    /**
+     * Checks if the item is a broken link, ETrue if broken
+     *
+     * @since 3.1
+     * @param aIndex index of the item
+     * @return ETrue if the item is a broken link, EFalse otherwise
+     */
+    TBool IsItemBrokenLinkL( TInt aIndex ) const ;
+
+    /**
+     * Checks if the item is corrupted, ETrue if corrupted
+     *
+     * @since 3.1
+     * @param aIndex index of the item
+     * @return ETrue if the item is corrupted link, EFalse otherwise
+     */
+    TBool IsItemCorruptedL( TInt aIndex ) const;
+
+    /**
+     * Get array of indicator icon indices at the specified index
+     */
+    RArray<TInt> IndicatorIconIndicesL( TInt aIndex);
+
+public: // Functions from base classes
+
+    /**
+     * From MDesCArray, indexes into a descriptor array.
+     *
+     * @param aIndex The position of the descriptor element within a descriptor array.
+     * @return Descriptor element located at position aIndex within a descriptor array
+     */
+    TPtrC MdcaPoint( TInt aIndex ) const;
+
+    /**
+     * From CMPXCommonListBoxArrayBase
+     * Creates icon array
+     *
+     * @return Pointer to the created icon array
+     */
+    CAknIconArray* CreateIconArrayL();
+
+    /**
+     * From CMPXCommonListBoxArrayBase
+     * Appends media array to the current array
+     *
+     * @param aMedia media array to append
+     */
+    void AppendMediaL( const CMPXMedia& aMedia );
+
+private: // constructors
+
+    /**
+     * C++ constructor.
+     */
+    CMPXCollectionViewListBoxArray();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private: // new functions
+
+    /**
+     * Load an icon and append it to an icon array.
+     *
+     * @param aArray    pointer to the icon array
+     * @param aID       skin id of the icon
+     * @param aMbmFile  path to the mbm/mif file containing the icon
+     * @param aBitmapId mbm id of the bitmap
+     * @param aMaskId   mbm id of the mask
+     */
+    void AppendIconToArrayL(
+        CAknIconArray* aArray,
+        const TAknsItemID& aID,
+        const TDesC& aMbmFile,
+        TInt aBitmapId,
+        TInt aMaskId );
+
+    /**
+     * Load an icon and append it to an icon array.
+     *
+     * @param aArray    pointer to the icon array
+     * @param aID       skin id of the icon
+     * @param aColorId  Item ID of the color table.
+     * @param aColorIndex Index in the color table.
+     * @param aMbmFile  path to the mbm/mif file containing the icon
+     * @param aBitmapId mbm id of the bitmap
+     * @param aMaskId   mbm id of the mask
+     */
+    void AppendColorIconToArrayL(
+        CAknIconArray* aArray,
+        const TAknsItemID& aID,
+        const TAknsItemID& aColorId,
+        TInt aColorIndex,
+        const TDesC& aMbmFile,
+        TInt aBitmapId,
+        TInt aMaskId );
+
+    /**
+     * Maps list box index to array index in reorder mode
+     *
+     * @aIndex listbox index
+     * @return The mapped index
+     */
+    TInt GetArrayIndexForListBoxIndex( TInt aIndex ) const;
+
+    /**
+     * Get reorder icon
+     *
+     * @return The index of the reorder icon
+     */
+    TInt GetReorderIcon() const;
+
+    /**
+     * Retrieve indexes into a descriptor array.
+     *
+     * @param aIndex The position of the descriptor element within a descriptor array.
+     * @return Descriptor element located at position aIndex within a descriptor array
+     */
+    TPtrC GetMdcaPointL( TInt aIndex ) const;
+
+    /**
+     * Sets playback status
+     *
+     * @param aIndex index of the song to set
+     * @param aStatus status of the song
+     * @return The index of previous playing song
+     */
+    TInt SetPlaybackStatusByIndex( TInt aIndex, TMPXPlaybackState aStatus );
+
+private: // data
+    CMPXMediaArray*         iMediaOwned;
+
+    TBool                   iReorderActivated;
+    TBool                   iReorder;
+    TInt                    iOriginalIndex;
+    TInt                    iMovedIndex;
+    TBool                   iMoveNowPlaying;
+
+    TBool                   iIsUnknownExist;
+    HBufC*                  iUnknown;
+    TInt                    iMMCDrive;
+    };
+
+#endif  // C_CMPXCOLLECTIONVIEWLISTBOXARRAY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/loc/mpxcollectionview.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,494 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxcollectionview
+*
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Text in title pane
+// d:Collection view
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mp_title_collection_view "Music player"
+
+// d:Text in title pane for reordering
+// d:Collection view
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_nmp_title_reorder_list "Reorder list"
+
+// d:Options menu item for opening Track details popup.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_details_track "Song details"
+
+// d:Options menu item for opening album art popup.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_album_art "Album art"
+
+// d:Options menu item for creating a playlist.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mg_options_create_new_pl "Create playlist"
+
+// d:Options menu item for find in music store.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_find_in_musicshop "Find in Music Store"
+
+//d:Command in options list
+//d:Opens use tone as cascade menu
+//l:list_single_pane_t1_cp2/opt3
+//r:5.0
+//
+#define qtn_mus_options_use_tone_as "Use tone as"
+
+
+// d:Options menu item add songs.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_add_tracks "Add songs"
+
+// d:Options menu item reorder playlist.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_reorder_list "Reorder list"
+
+// d:Options menu item for removing from playlist.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mp_options_remove "Remove"
+
+// d:Options menu item for deleting selected items.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_delete "Delete"
+
+// d:Options menu item for renaming selected items.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_rename "Rename"
+
+// d:Options menu item for playlist details.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_details_pl "Playlist details"
+
+// d:Options menu item for go to now playing.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_go_to_nowplaying "Go to Now Playing"
+
+// d:Options menu item for go to music store.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_go_to_shop "Go to Music Store"
+
+// d:Options menu item for music library details.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_details_library "Music library details"
+
+//d:Command in options list in Music Collection Main view.
+//d:Update Music Library (search for new and removed audio files)
+// l:list_single_pane_t1_cp2/opt1
+//r:5.0
+//
+#define qtn_mus_options_update_collection1  "Refresh library"
+
+// d:Options menu item save playlist.
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mp_options_save "Save"
+
+// d:Text for not found dialog.
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_mp_note_broken_file "File cannot be found. Operation cancelled."
+
+// d:Text for softkey option grab.
+// l:control_pane_t1/opt7
+// r:5.0
+//
+#define qtn_nmp_softkey_grab "Grab"
+
+// d:Text for softkey option drop.
+// l:control_pane_t1/opt7
+// r:5.0
+//
+#define qtn_nmp_softkey_drop "Drop"
+
+// d:list position status shown in navi pane when reordering a song in
+// d:the Reorder list view
+// d:%0N is the position of the song being reordered
+// d:%1N is the total number of positions
+// l:navi_text_pane_t1
+// r:5.0
+//
+#define qtn_nmp_position_counter "%0N/%1N"
+
+// d:Text for a confirmation query shown after user creates a playlist
+// d:asking if add songs is needed
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_query_add_songs    "Add songs now?"
+
+// d:Text for a confirmation query shown when user attempts to delete
+// d:multiple tracks.
+// d:%N is the number of the selected tracks.
+// d:For example, if the user selects delete when 3 tracks are marked in 
+// d:general tracks view, %N will be 3.
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_del_songs_query    "Delete %N items?"
+
+// d:Text for a confirmation query shown when user attempts to delete
+// d:all tracks belonging to a category. Category may be one album, artist,
+// d:composer or genre. %U is the name of the selected category.
+// d:For example, if the user selects delete when Mozart is focused in 
+// d:composer category view, %U will be Mozart.
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_query_conf_delete_group     "Delete all items belonging to '%U'?"
+
+// d:Text for wait note for deleting multiple items
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_del_songs_wait_note "Deleting"
+
+// d:Text for wait note for deleting one item
+// d:%U is the item being deleted
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_album_waiting_deleting "Deleting '%U'"
+
+// d:Text for wait note for deleting a group
+// d:%U is the category being deleted
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_mus_query_conf_delete_all "Deleting items belonging to '%U'"
+
+// d:Text for a confirmation query shown when user attempts to remove
+// d:multiple tracks from playlist.
+// d:%N is the number of the selected tracks.
+// d:For example, if the user selects delete when 3 tracks are marked in 
+// d:general tracks view, %N will be 3.
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_mus_query_conf_remove_many    "Remove %N songs from the playlist?"
+
+// d:Text for a confirmation query shown when user attempts to remove
+// d:an entry from playlist
+// d:%U is the item being removed
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_mus_query_conf_remove_track     "Remove '%U' from the playlist?"
+
+// d:Text for wait note for removing multiple items
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_note_removing_many "Removing songs"
+
+// d:Text for wait note for removing one item
+// d:%U is the item being removed
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_mus_note_removing_track "Removing '%U'"
+
+// d:title for library details window
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_nmp_title_collection_details1 "Library details:"
+
+// d:Collection details popup label.
+// d:Label for collection details popup, number of songs.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mus_detail_number_of_songs "Songs"
+
+// d:Collection details popup label.
+// d:Label for collection details popup, total duration.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mp_details_duration "Duration"
+
+// d:Collection details popup label.
+// d:Label for collection details popup, available phone memory.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_nmp_details_phone_memory "Phone Memory"
+
+// d:Collection details popup label.
+// d:Label for collection details popup, available internal mass storage.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_mass_memory "Mass Memory"
+
+// d:Collection details popup label.
+// d:Label for collection details popup.
+// d:Space available on memory card
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_memory_card "Memory Card"
+
+// d:Collection details popup label.
+// d:Label for collection details popup.
+// d:Space available on memory card
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_mmc "MMC"
+
+// d:Collection details popup label.
+// d:Label for collection details popup, last refreshed date.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_date_refresh "Refreshed"
+
+// d:Item for Music Library Details dialog.
+// d:Displayed when MMC is not present in the phone
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_nmp_mmc_unavailable "Card Unavailable"
+
+// d:Item for Music Library Details dialog.
+// d:Displayed when Memory is not present in the phone
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_nmp_memory_unavailable "Unavailable"
+
+// d:Playlist details heading
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_mus_title_details_pl "Playlist details:"
+
+// d:Heading item text for the playlist details popup listbox.
+// d:Playlist's name.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mus_pl_detail_name "Name"
+
+// d:Heading item text for the playlist details popup listbox.
+// d:Playlist creation date.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mp_details_date "Date"
+
+// d:Heading item text for the playlist details popup listbox.
+// d:Playlist creation time.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mp_details_time "Time"
+
+// d:Heading item text for the file details popup listbox.
+// d:Playlist location.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mp_details_location "Location"
+
+// d:Options menu item for choosing player
+// l:list_single_pane_t1_cp2/opt3
+// r:5.0
+//
+#define qtn_nmp_options_play_via "Play"
+
+// d:Options submenu item for choosing player
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_nmp_options_play_device "On device"
+
+// d:Options submenu item for choosing player
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_nmp_options_play_homenet "Via Home Net"
+
+// d:Text for connection to player failed error note
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_note_remote_connection_failed "Connection with %U failed."
+
+// d:prompt text for new playlist name
+// l:popup_query_data_window
+// r:5.0
+//
+#define qtn_nmp_prmpt_new_name "New name:"
+
+// d:Unknown in listbox.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mp_list_unknown "Unknown"
+
+// d:Unknown artist in title.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_nmp_title_unknown_artist "Unknown artist"
+
+// d:Unknown album in title.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_unknown_album "Unknown album"
+
+// d:Unknown genre in title.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_unknown_genre "Unknown genre"
+
+// d:Unknown composer in title.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_unknown_composer "Unknown composer"
+
+// d:Cannot delete a file because it is in use
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_delete_file_open "Unable to delete item. It is currently in use."
+
+// d:Cannot delete a file because it is in use (multiple selection in list box)
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_delete_mutl_file_open   "Unable to delete some items. They are currently in use."
+
+// d:wait note for renaming multiple items
+// d:%N is the number of the tracks.
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_note_updating_name "Updating %N songs"
+
+// d:wait note for renaming single item
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_note_updating_name1 "Updating 1 song"
+
+// d:sending multiple files, but at least one cannot be sent
+// d:invalid files confirmation query
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_query_send_valid_songs1 "Some files cannot be sent. Continue?"
+
+// d:Information note text
+// d:Display when all files to be sent are broken.
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_note_nothing_to_send    "Files cannot be found. Nothing to send."
+
+// d:Text shown in Category view when there are no albums to display.
+// l:main_list_empty_pane
+// r:5.0
+//
+#define qtn_nmp_no_albums_editor    "(no albums)"
+
+// d:Text shown in Category view when there are no artists to display.
+// l:main_list_empty_pane
+// r:5.0
+//
+#define qtn_nmp_no_artists_editor    "(no artists)"
+
+// d:Text shown in Category view when there are no genres to display.
+// l:main_list_empty_pane
+// r:5.0
+//
+#define qtn_nmp_no_genres_editor   "(no genres)"
+
+// d:Text shown in Category view when there are no composers to display.
+// l:main_list_empty_pane
+// r:5.0
+//
+#define qtn_nmp_no_composers_editor   "(no composers)"
+
+// d:Text shown in Category view when there are no songs to display.
+// l:main_list_empty_pane
+// r:5.0
+//
+#define qtn_nmp_no_songs_editor   "(no songs)"
+
+// d:Information note text
+// d:Display when some songs being renamed is not valid.
+// d:%U is the new name
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_note_rename_with_invalid    "Some songs could not be updated with new %U name"
+
+// d:Information note text for trying to play empty playlist.
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_note_empty_playlist   "Playlist is empty. Nothing to Play."
+
+// d:wait note for deleting multiple items
+// d:%N is the percentage of the tracks deleted.
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_del_batch_songs_wait_note "Deleting: %N%"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/src/mpxcollectionview.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Collection view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxcollectionview.h"
+#include "mpxcollectionviewimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXCollectionView* CMPXCollectionView::NewL()
+    {
+    return CMPXCollectionViewImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXCollectionView* CMPXCollectionView::NewLC()
+    {
+    return CMPXCollectionViewImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionView::~CMPXCollectionView()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/src/mpxcollectionviewcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,524 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Collection view container
+*
+*/
+
+
+// INCLUDE FILES
+#include <hlplch.h>
+#include <aknappui.h>
+#include <akncontext.h>
+#include <AknsUtils.h>  // AknsUtils
+#include <AknUtils.h>
+#include <data_caging_path_literals.hrh>
+#include <eikspane.h>
+#include <eiktxlbx.h>
+#include <mpxcollectionview.mbg>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmedia.h>
+#include <mpxconstants.h>
+#include <mpxlog.h>
+#include <eikon.hrh>
+#include <mpxuser.h>
+
+#include "mpxcollectionview.hrh"
+#include "mpxcollectionviewlistboxarray.h"
+#include "mpxcollectionview.hlp.hrh"
+#include "mpxcollectionviewcontainer.h"
+
+// CONSTANTS
+_LIT( KMPXCollectionViewIconFile, "mpxcollectionview.mbm" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewContainer* CMPXCollectionViewContainer::NewL(
+    MEikCommandObserver* aView,
+    MEikListBoxObserver* aObserver,
+    TBool aIsEmbedded)
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::NewL" );
+    CMPXCollectionViewContainer* self =
+        new ( ELeave ) CMPXCollectionViewContainer(aView, aObserver, aIsEmbedded);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewContainer::CMPXCollectionViewContainer(
+    MEikCommandObserver* aView,
+    MEikListBoxObserver* aObserver,
+    TBool aIsEmbedded) 
+    : iView( aView )
+    , iListBoxObserver( aObserver )
+    , iReady( EFalse )
+    , iIsEmbedded(aIsEmbedded)    
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewContainer::~CMPXCollectionViewContainer()
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::~CMPXCollectionViewContainer" );
+    delete iCommonContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::ConstructL()
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::ConstructL" );
+    iCommonContainer = CMPXCommonContainerFactory::NewL();
+    iCommonContainer->SetViewContainer( this );
+    iCommonContainer->SetCommandObserver( iView );
+    iCommonContainer->SetListBoxObserver( iListBoxObserver );
+    iCommonContainer->ConstructContainerL( MMPXCommonContainer::EMPXCommonContainerMusic );
+    iLbxArray = static_cast<CMPXCollectionViewListBoxArray*>(
+        CreateListBoxArrayL() );
+    iCommonContainer->SetListBoxArrayL( iLbxArray );
+    iCommonContainer->HandleListBoxArrayEventL(
+        MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventIconArrayChange );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets playback status
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::SetPlaybackStatusByIdL(
+    TMPXItemId aId, TMPXPlaybackState aStatus, TInt aIndex)
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::SetPlaybackStatusByIdL" );
+    if ( iLbxArray && iCommonContainer )
+        {
+        TInt index( iLbxArray->SetPlaybackStatusByIdL( aId, aStatus, aIndex ) );
+        if ( index != KErrNotFound )
+            {
+            // Update the previous item as not playing anymore
+            iCommonContainer->DrawLbxItem( index );
+            }
+        index = iLbxArray->GetPlaybackIndex();
+        if ( index != KErrNotFound )
+            {
+            // Update new item as playing
+            iCommonContainer->DrawLbxItem( index );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get playback index
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewContainer::PlaybackIndex()
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::PlaybackIndex" );
+    return ( iLbxArray ? iLbxArray->GetPlaybackIndex() : KErrNotFound );
+    }
+
+// ---------------------------------------------------------------------------
+// Activate reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::ActivateReorderMode( TBool aEnable )
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::ActivateReorderMode" );
+    if ( iLbxArray )
+        {
+        iReorder = aEnable;
+        iLbxArray->ActivateReorderMode( iReorder );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::SetReorderGrabbedMode(
+    TBool aEnable, TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::SetReorderGrabbedMode" );
+    if ( iLbxArray )
+        {
+        iLbxArray->SetReorderGrabbedMode( aEnable, aIndex );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Determines if it's currently in reorder mode
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewContainer::IsInReorderMode()
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::IsInReorderMode" );
+    return iReorder;
+    }
+
+// ---------------------------------------------------------------------------
+// Move current reorder index
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::MoveReorderIndex( TInt aDirection )
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::MoveReorderIndex" );
+    if ( iLbxArray )
+        {
+        iLbxArray->MoveReorderIndex( aDirection );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// set current reorder index
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::SetReorderIndex( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::SetReorderIndex" );
+    if ( iLbxArray )
+        {
+        iLbxArray->SetReorderIndex( aIndex );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Confirm reorder
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::ConfirmReorderL()
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::ConfirmReorderL" );
+    if ( iLbxArray )
+        {
+        iLbxArray->ConfirmReorderL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Cancel reorder
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::CancelReorder()
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::CancelReorder" );
+    TInt originalIndex( GetOriginalIndex() );
+    if ( iLbxArray )
+        {
+        iLbxArray->CancelReorder();
+        }
+    iCommonContainer->SetLbxCurrentItemIndexAndDraw( originalIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// Gets original index of currently selected item
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewContainer::GetOriginalIndex()
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::GetOriginalIndex" );
+    TInt index( KErrNotFound );
+    if ( iLbxArray )
+        {
+        index = iLbxArray->GetOriginalIndex();
+        }
+    return index;
+    }
+
+// -----------------------------------------------------------------------------
+// Update Titlepane icon to reorder image
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::UpdateReorderTitleIconL()
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::UpdateReorderTitleIconL" );
+    // For status changes
+    CEikStatusPane* sp = iAvkonAppUi->StatusPane();
+    TParse parse;
+    parse.Set( KMPXCollectionViewIconFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
+
+    CFbsBitmap* bitmap( NULL );
+    CFbsBitmap* mask( NULL );
+
+    AknsUtils::CreateIconLC(
+        skin,
+        KAknsIIDNone,
+        bitmap,
+        mask,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_ctx_reordersong,
+        EMbmMpxcollectionviewQgn_graf_mup_ctx_reordersong_mask );
+
+    CEikImage* newIcon = new ( ELeave ) CEikImage();
+    CleanupStack::PushL( newIcon );
+    newIcon->SetPicture( bitmap, mask );
+    newIcon->SetPictureOwnedExternally( EFalse );
+    iContextPane = static_cast<CAknContextPane*>
+        ( sp->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ) );
+    iOrigIcon = iContextPane->SwapPicture( newIcon );
+    CleanupStack::Pop( 3 ); // bitmap, mask, newIcon
+    }
+
+// -----------------------------------------------------------------------------
+// Update Titlepane icon to use original image
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::RestoreOriginalTitleIconL()
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::RestoreOriginalTitleIconL" );
+    if ( iOrigIcon )
+        {
+        CEikImage* newIcon = iContextPane->SwapPicture( iOrigIcon );
+        delete newIcon;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Creates listbox array
+// -----------------------------------------------------------------------------
+//
+CMPXCommonListBoxArrayBase* CMPXCollectionViewContainer::CreateListBoxArrayL()
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::CreateListBoxArrayL" );
+    CMPXCollectionViewListBoxArray* array = CMPXCollectionViewListBoxArray::NewL();
+    array->ConstructListBoxArrayL();
+    array->SetObserver( this );
+    return array;
+    }
+
+// -----------------------------------------------------------------------------
+// Returns common container
+// -----------------------------------------------------------------------------
+//
+MMPXCommonContainer* CMPXCollectionViewContainer::Common()
+    {
+    ASSERT( iCommonContainer );
+    return iCommonContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXViewContainer
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXCollectionViewContainer::HandleKeyEventL(
+    const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    ASSERT( iCommonContainer );
+    MPX_DEBUG4( "CMPXCollectionViewContainer::HandleKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+
+    if ( aKeyEvent.iCode == EKeyUpArrow ||
+        aKeyEvent.iCode == EKeyPrevious )
+        {
+        iView->ProcessCommandL( EMPXCmdUpArrow );
+        }
+    else if ( aKeyEvent.iCode == EKeyDownArrow ||
+            aKeyEvent.iCode == EKeyNext )
+        {
+        iView->ProcessCommandL( EMPXCmdDownArrow );
+        }
+    TKeyResponse response = EKeyWasNotConsumed;
+
+    if( iReady )
+        {
+        const CMPXMedia& containerMedia(
+            iCommonContainer->ListBoxArray()->ContainerMedia() );
+        TMPXGeneralType containerType(
+            containerMedia.ValueTObjectL<TMPXGeneralType>(
+                KMPXMediaGeneralType ) );
+        TMPXGeneralCategory containerCategory(
+            containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory ) );
+
+        // Hashkey mark/unmark works in all song's view and other tracks view,
+        // not on other category views
+        if( containerCategory == EMPXSong ||
+            (( containerCategory == EMPXPlaylist ||
+            containerCategory == EMPXAlbum  ||
+            containerCategory == EMPXGenre ||
+            containerCategory == EMPXComposer ) &&
+            containerType == EMPXItem ) ||
+            aKeyEvent.iScanCode != EStdKeyHash )
+            {
+            response = iCommonContainer->HandleKeyEventL( aKeyEvent, aType );
+            }
+        }
+    else
+        {
+        response = iCommonContainer->HandleKeyEventL( aKeyEvent, aType );
+        MPX_DEBUG2( "CMPXCollectionViewContainer::OfferKeyEventL commoncontainer offerkey res = %d", response);
+        }
+
+    if ( aKeyEvent.iCode == EKeyUpArrow ||
+        aKeyEvent.iCode == EKeyPrevious )
+        {
+        iView->ProcessCommandL( EMPXCmdUpArrowAfterListboxHandled );
+        }
+    else if ( aKeyEvent.iCode == EKeyDownArrow ||
+            aKeyEvent.iCode == EKeyNext )
+        {
+        iView->ProcessCommandL( EMPXCmdDownArrowAfterListboxHandled );
+        }
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXViewContainer
+// Handle the retrieval of the view container's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::HandleHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    ASSERT( iCommonContainer );
+    MPX_FUNC( "CMPXCollectionViewContainer::HandleHelpContext" );
+    aContext.iMajor = KAppUidMusicPlayerX;
+
+    const CMPXMedia& containerMedia(
+        iCommonContainer->ListBoxArray()->ContainerMedia() );
+    TMPXGeneralType containerType(
+        containerMedia.ValueTObjectL<TMPXGeneralType>(
+            KMPXMediaGeneralType ) );
+    TMPXGeneralCategory containerCategory(
+        containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory ) );
+    MPX_DEBUG3( "CMPXCollectionViewContainer::HandleHelpContext containertype = %d, containercategory = %d", containerType, containerCategory );
+
+    switch ( containerCategory )
+        {
+        case EMPXCollection:
+            {
+            // music menu view
+            aContext.iContext = KMusHlpLibMainView;
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            if (iIsEmbedded)
+                {
+                aContext.iContext = KMusHlpEmbeddedPlaylistTracksView;
+                }
+            else
+                {            	
+                if ( containerType == EMPXGroup )
+                    {
+                    // playlist view
+                    aContext.iContext = KMusHlpPlaylistView;
+                    }
+                else if ( containerType == EMPXItem )
+                    {
+                    // playlist tracks view
+                    aContext.iContext = KMusHlpPlaylistTracksView;
+                    }
+                else
+                    {
+                    // default to music main view help context
+                    aContext.iContext = KMusHlpLibMainView;
+                    }
+                }
+            break;
+            }
+        case EMPXAlbum:
+        case EMPXGenre:
+        case EMPXComposer:
+            {
+            if ( containerType == EMPXGroup )
+                {
+                // album, genre, composer view
+                aContext.iContext = KMusHlpCategoryView;
+                }
+            else if ( containerType == EMPXItem )
+                {
+                // album, genre, composer tracks view
+                aContext.iContext = KMusHlpTracksView;
+                }
+            else
+                {
+                // default to music main view help context
+                aContext.iContext = KMusHlpLibMainView;
+                }
+            break;
+            }
+        case EMPXArtist:
+            {
+            // artist view
+            // artist/album view
+            aContext.iContext = KMusHlpCategoryView;
+            break;
+            }
+        case EMPXSong:
+            {
+            // all songs view
+            aContext.iContext = KMusHlpTracksView;
+            break;
+            }
+        default:
+            {
+            // default to music main view help context
+            aContext.iContext = KMusHlpLibMainView;
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXViewContainer
+// Returns the indicators for the specified item within the view container
+// ---------------------------------------------------------------------------
+//
+RArray<TInt> CMPXCollectionViewContainer::IndicatorsL( TInt aIndex )
+    {
+    return iLbxArray->IndicatorIconIndicesL( aIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCommonListBoxArrayObserver
+// Handle listbox array events.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::HandleListBoxArrayEventL(
+    TMPXCommonListBoxArrayEvents aEvent )
+    {
+    MPX_FUNC( "CMPXCollectionViewContainer::HandleListBoxArrayEventL" );
+    ASSERT( iCommonContainer );
+    iCommonContainer->HandleListBoxArrayEventL( aEvent );
+    }
+
+// ---------------------------------------------------------------------------
+// Content is ready.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewContainer::ContentIsReady( TBool aReady )
+    {
+    iReady = aReady;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/src/mpxcollectionviewimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,7412 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Collection view
+*
+*/
+
+// INCLUDE FILES
+#include <aknlists.h>
+#include <aknViewAppUi.h>
+#include <AknQueryDialog.h>
+#include <eikmenub.h>
+#include <StringLoader.h>
+#include <aknnavilabel.h>
+#include <aknnavide.h>
+#include <eikapp.h>
+#include <AknUtils.h>
+#include <AknsUtils.h>
+#include <akntitle.h>
+#include <aknconsts.h>
+#include <avkon.mbg>
+#include <coeutils.h>
+#include <textresolver.h>
+#include <aknnotewrappers.h>
+#include <aknnavi.h>
+#include <hlplch.h>
+#include <f32file.h>
+#include <bautils.h>
+#include <eikspmod.h>
+#include <eikclb.h>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <sendui.h>
+#include <CMessageData.h>
+#include <centralrepository.h>
+#include <avkon.rsg>
+#include <eikbtgpc.h>
+#include <AknWaitDialog.h>
+#include <bldvariant.hrh>
+#include <apgtask.h>
+#include <apgcli.h>
+#include <apaid.h>
+#include <CAknFileNamePromptDialog.h>
+#include <MProfileEngine.h>
+#include <MProfile.h>
+#include <AknDlgShut.h>
+#ifdef RD_MULTIPLE_DRIVE
+#include <driveinfo.h>
+#endif //RD_MULTIPLE_DRIVE
+
+#include <e32const.h>
+#ifdef UPNP_INCLUDED
+#include <upnpcopycommand.h>
+#endif
+#include <AiwServiceHandler.h>  //Copy to remote feature
+
+#include <mediarecognizer.h>
+#include <featmgr.h>
+#include <aknSDData.h>
+#include <AknMediatorFacade.h>
+#include <MediatorCommandInitiator.h>
+#include <MediatorDomainUIDs.h>
+#include <mplayersecondarydisplayapi.h>
+
+#include <data_caging_path_literals.hrh>
+#include <layoutmetadata.cdl.h>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxviewutility.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpxcollectionview.rsg>
+#include <mpxcollectionview.mbg>
+#include <mpxcommonui.rsg>
+#include <mpxcollectionutility.h>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxmedia.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediaarray.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxviewpluginmanager.h>
+#include <mpxviewplugin.h>
+
+#ifdef BACKSTEPPING_INCLUDED
+#include <mpxbacksteppingutility.h>
+#endif // BACKSTEPPING_INCLUDED
+
+#include <e32property.h>
+#include <mpxfindinmusicshop.h>
+#include <mpxfindinmusicshopcommon.h>  // KFindInMShopKeyInValid
+#include <MusicWapCenRepKeys.h>
+#include <mpxcollectionopenutility.h>
+
+// cenrep key need to be checked whether USB cable is connected in MTP/Combined Mode
+#include <UsbWatcherInternalPSKeys.h>
+#include <usbpersonalityids.h>
+#include <mpxappui.hrh>
+#include <mpxinternalcrkeys.h>
+#include <mpxtlshelper.h>
+#include <mpxuser.h>
+#include "mpxcollectionviewlistboxarray.h"
+#include "mpxcommoncontainer.hrh"
+#include "mpxcommoncontainer.h"
+#include "mpxcommonuihelper.h"
+#include "mpxcollectionviewcontainer.h"
+#include "mpxcollectionview.hrh"
+#include "mpxcollectionview.hlp.hrh"
+#include "mpxcollectionviewimp.h"
+#include "mpxlog.h"
+#include "mpxviewprivatepskeys.h"
+
+
+// CONSTANTS
+_LIT( KMPXCollectionRscPath, "mpxcollectionview.rsc" );
+
+const TInt KMilliSecondsToSeconds( 1000 );
+const TInt KMPXReorderNaviPaneGranularity( 2 );
+const TInt KMPXMaxBufferLength( 160 );
+const TInt KMPXMaxTimeLength( 36 );
+const TInt KMPXDurationDisplayResvLen( 10 );
+const TInt KMPXPlaylistExportRetry( 10 );
+const TInt KMPXDirectionUp( -1 );
+const TInt KMPXDirectionDown( 1 );
+const TInt KMPXErrDataNotReady( -8000 );
+const TInt KMPXErrDataNotReadyCacheCommand( -8001 );
+const TInt KMPXArrayGranularity( 100 );
+const TInt KMusicCollectionMenuLevel( 2 );
+
+_LIT( KMPXCollDetailsItemsFormat, "%S\t%S" );
+
+_LIT( KCategoryEmpty, "" );
+_LIT( KAlbums, "Albums" );
+
+const TInt KIncrementalDelayNone = 0;
+const TInt KIncrementalDelayHalfSecond = 1000000;
+const TInt KIncrementalFetchBlockSize = 400;
+const TInt KIncrementalDirectionCount = 8;
+const TInt KProgressBarMaxValue = 100;  // Max Value for the Progress Info bar
+// MusicStore application Uid
+const TUid KUidMusicStore = { 0x10207BF5 };
+const TInt KWaitNoteImpUid = 0x101FFC6C; // refresh wait note UID
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+const TInt KMusicMenuPodcastMenuItemIndex = 4; // podcast menu item index
+#define KPodcastCollectionUid 0x101FFC3C
+#endif
+
+#ifdef BACKSTEPPING_INCLUDED
+const TInt KMaxIntLen( 10 );
+_LIT8( KMVPrefix, "MVviewID:" );
+const TInt KMVPrefixLen( 9 );
+#endif // BACKSTEPPING_INCLUDED
+// Music setting
+const TUid KCRUidMPXMPSettings = {0x101FFCDC};
+const TUint32 KMPXMusicStoreUID = 0x00000003;
+const TUint32 KOperatorMusicStore = 0x00000004;
+const TUint32 KOperatorMusicStoreType = 0x00000005;
+const TUint32 KOperatorMusicStoreDisplayName = 0x00000006;
+const TUint32 KOperatorMusicStoreNativeUid = 0x00000007;
+const TUint32 KOperatorMusicStoreJavaName = 0x00000008;
+const TUint32 KOperatorMusicStoreWebPage = 0x00000009;
+const TUint32 KOperatorMusicStoreURI = 0x0000000A;
+
+
+const TInt KJavaMusicShopType( 1 );
+const TInt KUIDMaxLength = 8;
+const TInt KMPXMaxHistoryLength( 255 );
+
+#define KProgressDownloadUid  0x10207BCD
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewImp* CMPXCollectionViewImp::NewL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::NewL" );
+    CMPXCollectionViewImp* self = CMPXCollectionViewImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewImp* CMPXCollectionViewImp::NewLC()
+    {
+    CMPXCollectionViewImp* self = new ( ELeave ) CMPXCollectionViewImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewImp::~CMPXCollectionViewImp()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::~CMPXCollectionViewImp" );
+
+    if ( iCoverDisplay )
+        {
+        delete iCommandInitiator;
+        }
+
+    // Cleanup observer, does not panic if not found
+    //
+    AppUi()->RemoveViewDeactivationObserver( this );
+
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+
+    if ( iPlaybackUtility )
+        {
+        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+        iPlaybackUtility->Close();
+        }
+
+    if ( iViewUtility )
+        {
+        iViewUtility->RemoveObserver( this );
+        iViewUtility->Close();
+        }
+
+    if ( iCollectionUiHelper )
+        {
+        iCollectionUiHelper->Close();
+        }
+
+    if ( iCollectionHelper )
+        {
+        iCollectionHelper->Close();
+        }
+
+    if ( iProfileEngine )
+        {
+        iProfileEngine->Release();
+        }
+
+    if ( iUpnpFrameworkSupport )
+        {
+        MPX_DEBUG1(_L("CMPXCollectionViewImp::~CMPXCollectionViewImp Detaching 'Copy to external' menu service..."));
+        if ( iServiceHandler )
+            {
+            iServiceHandler->DetachMenu( R_MPX_COLLECTION_VIEW_MENU_1,
+                                     R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST );
+        iServiceHandler->DetachMenu( R_MPX_USE_AS_CASCADE,
+                                 R_MPX_AIW_ASSIGN_INTEREST );
+            delete iServiceHandler;
+            iServiceHandler = NULL;
+            }
+        iPlayersList.Close();
+        delete iSubPlayerName;
+        }
+#ifdef UPNP_INCLUDED
+    if ( iUpnpCopyCommand )
+        {
+        delete iUpnpCopyCommand;
+        }
+#endif
+    if ( iServiceHandler )
+        {
+        iServiceHandler->DetachMenu( R_MPX_USE_AS_CASCADE,
+                                 R_MPX_AIW_ASSIGN_INTEREST );
+        delete iServiceHandler;
+        }
+    if ( iMediaRecognizer )
+        {
+        delete iMediaRecognizer;
+        }
+
+#ifdef BACKSTEPPING_INCLUDED
+    if( iBackSteppingUtility )
+        {
+        iBackSteppingUtility->Close();
+        }
+#endif // BACKSTEPPING_INCLUDED
+
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer->Common()->CoeControl() );
+        delete iContainer;
+        }
+
+    delete iNaviDecorator;
+    delete iUserPlaylists;
+    delete iCommonUiHelper;
+    delete iSendUi;
+    delete iTitle;
+    delete iDuration;
+    delete iOriginalTitle;
+    delete iOriginalDuration;
+    delete iNewName;
+    delete iBottomIndex;
+    delete iCurrentCba;
+    delete iIncrementalOpenUtil;
+    delete iCachedSelectionIndex;
+    FeatureManager::UnInitializeLib();
+    delete iOperatorMusicStoreName ;
+    if ( iOperatorMusicStoreURI )
+        {
+        delete iOperatorMusicStoreURI;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewImp::CMPXCollectionViewImp() :
+    iLastDepth( 1 ), iPlayIndex( KErrNotFound ),
+    iSetMediaLCount( KErrNotFound ),
+    iCurrentHighlightedIndex( KErrNotFound ),
+    iCachedCommand( KErrNotFound ),
+    iNoteType( EMPXNoteNotDefined ),
+	iFirstIncrementalBatch( ETrue )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::CMPXCollectionViewImp" );
+    iUsingNokiaService = EFalse;
+#ifdef __ENABLE_MSK
+    iCurrentMskId = KErrNotFound;
+    iShowContextMenu = EFalse;
+    iCollectionCacheReady = ETrue;
+#endif // __ENABLE_MSK
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+    iPodcast = EFalse;
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+    iInAlbumArtDialog = EFalse;
+
+    iMarkedAll = EFalse;
+    // grab the current process priority
+    RProcess proc;
+    iPriority = proc.Priority();
+    }
+
+void CMPXCollectionViewImp::HandleStatusPaneSizeChange()
+    {
+	MPX_FUNC( "CMPXCollectionViewImp::HandleStatusPaneSizeChange" );
+	CMPXCollectionView::HandleStatusPaneSizeChange();
+	if ( iContainer )
+        {
+		iContainer->Common()->CoeControl()->SetRect( ClientRect() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::ConstructL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::ConstructL" );
+
+// initialize FeatureManager
+    FeatureManager::InitializeLibL();
+
+    if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
+        {
+        iCoverDisplay = ETrue;
+        iCommandInitiator = CMediatorCommandInitiator::NewL( NULL );
+        }
+    else
+        {
+        iCoverDisplay = EFalse;
+        }
+
+
+    CCoeEnv* coeEnv( iEikonEnv );
+    TParse parse;
+    parse.Set( KMPXCollectionRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    BaseConstructL( R_MPX_COLLECTION_VIEW );
+
+    iIsEmbedded = iEikonEnv->StartedAsServerApp();
+
+    // create a new collection utility bound to the default context.
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+    iPlaybackUtility->AddObserverL( *this );
+    iViewUtility = MMPXViewUtility::UtilityL();
+    iViewUtility->AddObserverL( this );
+    iBottomIndex = new (ELeave) CArrayFixFlat<TInt>( 1 );
+
+    iCommonUiHelper = CMPXCommonUiHelper::NewL( iCollectionUtility );
+    iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+
+    // Monitor for view activation
+    AppUi()->AddViewActivationObserverL( this );
+
+#ifdef UPNP_INCLUDED
+    if (!iUpnpCopyCommand )
+        {
+        MPX_TRAPD ( error, iUpnpCopyCommand = CUpnpCopyCommand::NewL() );   
+		    if ( error == KErrNone )
+            {
+            iUpnpFrameworkSupport = ETrue;
+            iServiceHandler = CAiwServiceHandler::NewL();
+            MPX_DEBUG1("CMPXCollectionViewImp::ConstructL() Attaching 'Copy to external' menu service...");
+            MPX_TRAP( iErrorAttachCopyMenu, iServiceHandler->AttachMenuL( R_MPX_COLLECTION_VIEW_MENU_1,
+                                                   R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST ) );
+            if ( iErrorAttachCopyMenu == KErrNotSupported )
+                {
+                // when CCoeEnv is not available
+                User::Leave( iErrorAttachCopyMenu );
+                }
+            MPX_DEBUG2( "CMPXCollectionViewImp::ConstructL(): attach Copy menu error: %d", iErrorAttachCopyMenu );
+            }
+        else
+            {
+            iUpnpFrameworkSupport = EFalse;
+            iUpnpCopyCommand = NULL;	
+            }
+        }
+#endif
+
+    iMediaRecognizer = CMediaRecognizer::NewL();
+    if ( iServiceHandler == NULL)
+        {
+        iServiceHandler = CAiwServiceHandler::NewL();
+        }
+    MPX_DEBUG1("CMPXCollectionViewImp::ConstructL() Attaching 'use tone as' menu service...");
+    MPX_TRAP( iErrorAttachAssignMenu, iServiceHandler->AttachMenuL( R_MPX_USE_AS_CASCADE,
+                                               R_MPX_AIW_ASSIGN_INTEREST ) );
+
+    iNaviPane =
+        static_cast<CAknNavigationControlContainer*>
+        ( iAvkonViewAppUi->StatusPane()->ControlL(
+            TUid::Uid( EEikStatusPaneUidNavi ) ) );
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC );
+    //Create label to change text in Navi pane
+    iNaviLabel = static_cast<CAknNaviLabel*>
+            ( iNaviDecorator->DecoratedControl() );
+
+    TInt flags( 0 );
+    CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
+    repository->Get( KMPXMPLocalVariation, flags );
+    delete repository;
+    iGoToMusicShopOptionHidden =
+        !static_cast<TBool>( flags & KMPXEnableGoToMusicShopOption );
+    iUsingNokiaService =
+        static_cast<TBool>( flags & KMPXEnableFindInMusicShopOption );
+    MPX_DEBUG2( "CMPXCollectionViewImp::ConstructL(): iUsingNokiaService: %d", iUsingNokiaService );
+    iDisablePodcasting = flags&KMPXDisablePodcastingOption ? ETrue : EFalse;
+
+#ifdef _DEBUG
+    iExitOptionHidden = EFalse;
+#else // _DEBUG
+    iExitOptionHidden = iCommonUiHelper->ExitOptionHiddenL() && !iIsEmbedded;
+#endif // _DEBUG
+
+    iBottomIndex->AppendL( 0 );
+    iProfileEngine = CreateProfileEngineL();
+
+    _LIT_SECURITY_POLICY_C1(KMPlayerRemoteReadPolicy, ECapabilityReadUserData);
+    _LIT_SECURITY_POLICY_C1(KMPlayerRemoteWritePolicy, ECapabilityWriteUserData);
+
+    if (iGoToMusicShopOptionHidden)
+        {
+        iMusicStoreUID = 0;
+        }
+    else
+        {
+        // Get music store uid from cenrep
+        //
+        TBuf8< KUIDMaxLength > musicStoreUID;
+        TRAP_IGNORE(
+            {
+            CRepository* repository = CRepository::NewL( KCRUidMPXMPSettings );
+            repository->Get( KMPXMusicStoreUID, musicStoreUID );
+            delete repository;
+            repository = NULL;
+            } );
+
+        GetUint32Presentation( iMusicStoreUID, musicStoreUID, 0 );
+        if (iMusicStoreUID == 0)
+            {
+            iGoToMusicShopOptionHidden = ETrue;
+            }
+        }
+    MPX_DEBUG2("CMPXCollectionViewImp::ConstructL musicStoreUID = %x", iMusicStoreUID);
+
+    TInt retval(KErrNone);
+    // P/S key for music shop
+    retval = RProperty::Define( TUid::Uid(iMusicStoreUID),
+                                KMShopCategoryId,
+                                RProperty::EInt,
+                                KMPlayerRemoteReadPolicy,
+                                KMPlayerRemoteWritePolicy );
+
+    if( retval != KErrAlreadyExists)
+        {
+        RProperty::Set( TUid::Uid(iMusicStoreUID),
+                        KMShopCategoryId,
+                        KFindInMShopKeyInValid );  // initialize Find In Musicshop was not called
+
+
+        RProperty::Define(  TUid::Uid(iMusicStoreUID),
+                            KMShopCategoryName,
+                            RProperty::ELargeText,
+                            KMPlayerRemoteReadPolicy,
+                            KMPlayerRemoteWritePolicy );
+        }
+
+    iCachedSelectionIndex = new ( ELeave )CArrayFixFlat<TInt>( KMPXArrayGranularity );
+    iIncrementalOpenUtil = CMPXCollectionOpenUtility::NewL( this );
+
+#ifdef BACKSTEPPING_INCLUDED
+    // Initialize the Back Stepping Service Utility with the MPX Music Player
+    iBackSteppingUtility = MMPXBackSteppingUtility::UtilityL();
+    iBackSteppingUtility->InitializeL(
+        TUid::Uid( KMusicPlayerAppUidConstant ) );
+    iActivateBackStepping = EFalse;
+#endif // BACKSTEPPING_INCLUDED
+
+    iIsAddingToPlaylist = EFalse;
+    
+       // Get music store information from cenrep
+   //
+   TBuf8< KUIDMaxLength > operatorMusicStoreUID;
+   
+   iOperatorMusicStoreName = HBufC16::NewL( KMPXMaxHistoryLength );
+   TPtr operatorMusicStoreMenuOption = iOperatorMusicStoreName->Des();
+ 
+   HBufC16* musicStoreJavaName = HBufC16::NewLC( KMPXMaxHistoryLength );
+   TPtr operatorMusicStoreJavaName = musicStoreJavaName->Des();  
+
+   TRAP_IGNORE(
+    {
+    CRepository* musicshoprepository = CRepository::NewL( KCRUidMPXMPSettings );
+    musicshoprepository->Get( KOperatorMusicStore, iOperatorMusicStore );
+    if(iOperatorMusicStore)
+        {
+        musicshoprepository->Get( KOperatorMusicStoreType, iOperatorMusicStoreType );
+        musicshoprepository->Get( KOperatorMusicStoreDisplayName, operatorMusicStoreMenuOption );
+        if (iOperatorMusicStoreType == KJavaMusicShopType)
+            {   
+            musicshoprepository->Get( KOperatorMusicStoreJavaName, operatorMusicStoreJavaName );
+            }
+        else
+            {
+            musicshoprepository->Get( KOperatorMusicStoreNativeUid, operatorMusicStoreUID );
+            GetUint32Presentation( iOperatorNativeMusicStoreUID, operatorMusicStoreUID, 0 );
+            
+            musicshoprepository->Get(KOperatorMusicStoreWebPage, iMusicStoreWebPage);
+            iOperatorMusicStoreURI = HBufC16::NewL( KMPXMaxHistoryLength );
+            TPtr16 operatorMusicStoreuri = iOperatorMusicStoreURI->Des();
+            musicshoprepository->Get(KOperatorMusicStoreURI, operatorMusicStoreuri);
+            
+            }
+        }
+    delete musicshoprepository;
+    musicshoprepository = NULL;
+    } );
+   
+    if(iOperatorMusicStoreType == KJavaMusicShopType)
+        {
+            TApaAppInfo appInfo;
+            RApaLsSession apaSession;
+            User::LeaveIfError( apaSession.Connect() );
+            CleanupClosePushL( apaSession );
+            User::LeaveIfError( apaSession.GetAllApps() );
+
+            while ( apaSession.GetNextApp( appInfo ) == KErrNone )
+                {
+                if(appInfo.iFullName.Right(8).Compare(_L(".fakeapp")) == 0)
+                    {
+                    TApaAppCaption appname;
+                    appname = appInfo.iCaption ;
+                    if (!appInfo.iCaption.Compare(operatorMusicStoreJavaName))
+                        {
+                        iOperatorMusicStoreUID = appInfo.iUid;
+                        }
+                    }
+                }
+            CleanupStack::PopAndDestroy(); // close apaSession
+        }
+    //else 
+    //    {
+    //    GetUint32Presentation( iMusicStoreUID, operatorMusicStoreUID, 0 );
+    //    }
+    CleanupStack::PopAndDestroy(musicStoreJavaName);
+
+    TInt retval2(KErrNone);
+    // P/S key for usb unblocking
+    retval2 = RProperty::Define( KMPXViewPSUid,
+                                KMPXUSBUnblockingPSStatus, 
+                                RProperty::EInt, 
+                                KMPlayerRemoteReadPolicy,
+                                KMPlayerRemoteWritePolicy );
+
+    TInt usbStatus;
+    RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, usbStatus);
+    
+    
+    // if object doesn't exist or the usb doesn't connect
+    if(( retval2 != KErrAlreadyExists )
+            || ( usbStatus != KUsbPersonalityIdPCSuite
+                    || usbStatus != KUsbPersonalityIdMS
+                    || usbStatus != KUsbPersonalityIdPTP
+                    || usbStatus != KUsbPersonalityIdMTP
+                    || usbStatus != KUsbPersonalityIdPCSuiteMTP ))
+        {  
+        RProperty::Set( KMPXViewPSUid,
+                        KMPXUSBUnblockingPSStatus, 
+                        EMPXUSBUnblockingPSStatusUninitialized );
+        }
+    // if usb mode is in MTP mode or pc suite mode
+    else if ( usbStatus == KUsbPersonalityIdMTP
+    		|| usbStatus == KUsbPersonalityIdPCSuiteMTP
+    		|| usbStatus == KUsbPersonalityIdPCSuite )
+    	{
+    	RProperty::Set( KMPXViewPSUid,
+    			KMPXUSBUnblockingPSStatus,
+    			EMPXUSBUnblockingPSStatusActive );
+    	}    
+    }
+
+// ---------------------------------------------------------------------------
+// Delete the selected items
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DeleteSelectedItemsL(TInt aCommand)
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DeleteSelectedItemsL" );
+
+    // if reorder mode is on, or something is currently deleting, disable delete
+    TBool isIgnore( iContainer->IsInReorderMode() || iIsDeleting );
+
+    CMPXCommonListBoxArrayBase* listboxArray(
+        iContainer->Common()->ListBoxArray() );
+    const CMPXMedia& containerMedia( listboxArray->ContainerMedia() );
+    TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() );
+
+    // Marked indicies
+    // cannot use the caches indexes since this can be reached by pressing the cancel key
+    const CArrayFix<TInt>* array (
+        iContainer->Common()->CurrentSelectionIndicesL() ); // not owned
+    TInt arrayCount( array->Count() );
+
+    if ( !isIgnore )
+        {
+        if ( iContainer->Common()->CurrentListItemCount() == 0 )
+            {
+            // list is empty
+            isIgnore = ETrue;
+            }
+        if ( !isIgnore &&
+            containerMedia.IsSupported( KMPXMediaGeneralNonPermissibleActions ) )
+            {
+            TMPXGeneralNonPermissibleActions attr(
+                containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                KMPXMediaGeneralNonPermissibleActions ) );
+            if ( attr & EMPXWrite )
+                {
+                isIgnore = ETrue;
+                }
+            }
+        if ( !isIgnore )
+            {
+            const CMPXMedia& media( listboxArray->MediaL( currentIndex ) );
+            if ( ( arrayCount == 0 || arrayCount == 1 ) &&
+                ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId ) )
+                {
+                // not marked, or only 1 item is marked
+                // and the highlighted item is not yet available
+                isIgnore = ETrue;
+                }
+            else if ( media.IsSupported( KMPXMediaGeneralNonPermissibleActions ) )
+                {
+                TMPXGeneralNonPermissibleActions attr(
+                    media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                        KMPXMediaGeneralNonPermissibleActions ) );
+                if ( attr & EMPXWrite )
+                    {
+                    isIgnore = ETrue;
+                    }
+                }
+            }
+        }
+
+    if ( !isIgnore )
+        {
+        // Create a copy of collection path
+        CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
+        CleanupStack::PushL( path );
+        HBufC* promptTxt( NULL );
+        HBufC* waitNoteText( NULL );
+        TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY );
+        MPX_DEBUG2( "CMPXCollectionViewImp::DeleteSelectedItemsL delete array count = %d", arrayCount );
+
+        TMPXGeneralType containerType(
+            containerMedia.ValueTObjectL<TMPXGeneralType>(
+                KMPXMediaGeneralType ) );
+        TMPXGeneralCategory containerCategory(
+            containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory ) );
+
+        if ( arrayCount > 1 )
+            {
+            if ( containerType == EMPXItem && containerCategory == EMPXPlaylist )
+                {
+                // playlist view
+                waitNoteText = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_NOTE_REMOVING_MANY );
+                promptTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_QUERY_CONF_REMOVE_MANY,
+                    arrayCount );
+                }
+            else
+                {
+                waitNoteText = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_DEL_SONGS_WAIT_NOTE );
+                promptTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_DEL_SONGS_QUERY,
+                    arrayCount );
+                }
+            waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP;
+            iConfirmationDlg = CAknQueryDialog::NewL(
+                CAknQueryDialog::EConfirmationTone );
+            if ( iCoverDisplay )
+                {
+                if ( containerType == EMPXItem && containerCategory == EMPXPlaylist )
+                    {
+                    iConfirmationDlg->PublishDialogL(
+                        EMPlayerQueryRemoveTracks,
+                        KMPlayerNoteCategory);
+                    iWaitNoteId = EMPlayerNoteRemovingMany;
+                    }
+                else
+                    {
+                    iConfirmationDlg->PublishDialogL(
+                        EMPlayerQueryDeleteTracks,
+                        KMPlayerNoteCategory);
+                    iWaitNoteId = EMPlayerNoteDeletingMany;
+                    }
+                CAknMediatorFacade* covercl(
+                    AknMediatorFacade( iConfirmationDlg ) );
+                if ( covercl )
+                    {
+                    covercl->BufStream().WriteInt32L( arrayCount );
+                    }
+                }
+            if(iCollectionReady || aCommand == EMPXCmdCommonDelete )
+                {
+            for ( TInt i = 0; i < arrayCount; i++ )
+                {
+                MPX_DEBUG2( "CMPXCollectionViewImp::DeleteSelectedItemsL delete array index = %d", array->At( i ) );
+                path->SelectL( array->At(i) );
+                    } 
+                }                        
+            }
+        else
+            {
+            // not marked, process the highlighted item
+            const CMPXMedia& media( listboxArray->MediaL(
+                ( arrayCount > 0 ) ? array->At( 0 ) : currentIndex ) );
+            const TDesC& title( media.ValueText( KMPXMediaGeneralTitle ) );
+
+            TMPXGeneralType type(
+                media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+            TMPXGeneralCategory category(
+                media.ValueTObjectL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory ) );
+
+            if ( containerType == EMPXItem && containerCategory == EMPXPlaylist )
+                {
+                // playlist view
+                waitNoteText = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_NOTE_REMOVING_TRACK, title );
+                promptTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_QUERY_CONF_REMOVE_TRACK,
+                    title );
+                }
+            else if ( containerType == EMPXItem && containerCategory == EMPXArtist
+                && type == EMPXItem && category == EMPXAlbum && currentIndex == 0 )
+                {
+                // deleting first entry in artist/album view
+                const TDesC& containerTitle(
+                    containerMedia.ValueText( KMPXMediaGeneralTitle ) );
+                waitNoteText = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_QUERY_CONF_DELETE_ALL, containerTitle );
+                waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP;
+                promptTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_QUERY_CONF_DELETE_GROUP,
+                    containerTitle );
+                }
+            else
+                {
+                if ( ( type == EMPXItem && category == EMPXSong ) ||
+                    ( type == EMPXItem && category == EMPXPlaylist ) )
+                    {
+                    // tracks level, or deleting a playlist
+                    waitNoteText = StringLoader::LoadLC(
+                        R_MPX_QTN_ALBUM_WAITING_DELETING, title );
+                    promptTxt = StringLoader::LoadLC(
+                        R_MPX_QTN_QUERY_COMMON_CONF_DELETE,
+                        title );
+                    }
+                else
+                    {
+                    // deleting a group
+                    if ( ( currentIndex == ( iContainer->Common()->CurrentListItemCount() - 1 ) ) &&
+                        title.Compare( KNullDesC ) == 0 )
+                        {
+                        // check for unknown entry
+                        // if it's the last entry, and it's null text
+                        // load "unknown" text to display in prompt
+                        HBufC* unknownText( StringLoader::LoadLC( R_MPX_QTN_MP_UNKNOWN ) );
+                        waitNoteText = StringLoader::LoadLC(
+                            R_MPX_QTN_MUS_QUERY_CONF_DELETE_ALL, *unknownText );
+                        promptTxt = StringLoader::LoadL(
+                            R_MPX_QTN_NMP_QUERY_CONF_DELETE_GROUP, *unknownText );
+                        CleanupStack::Pop( waitNoteText );
+                        CleanupStack::PopAndDestroy( unknownText );
+                        CleanupStack::PushL( waitNoteText );
+                        CleanupStack::PushL( promptTxt );
+                        }
+                    else
+                        {
+                        waitNoteText = StringLoader::LoadLC(
+                            R_MPX_QTN_MUS_QUERY_CONF_DELETE_ALL, title );
+                        promptTxt = StringLoader::LoadLC(
+                            R_MPX_QTN_NMP_QUERY_CONF_DELETE_GROUP, title );
+                        }
+                    waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP;
+                    }
+                }
+            iConfirmationDlg = CAknQueryDialog::NewL(
+                CAknQueryDialog::EConfirmationTone );
+            if ( iCoverDisplay )
+                {
+                if ( containerType == EMPXItem && containerCategory == EMPXPlaylist )
+                    {
+                    iConfirmationDlg->PublishDialogL(
+                        EMPlayerQueryRemoveTrack,
+                        KMPlayerNoteCategory);
+                    iWaitNoteId = EMPlayerNoteRemovingTrack;
+                    }
+                else if ( containerType == EMPXItem && containerCategory == EMPXArtist
+                    && type == EMPXItem && category == EMPXAlbum && currentIndex == 0 )
+                    {
+                    iConfirmationDlg->PublishDialogL(
+                        EMPlayerQueryDeleteCategory,
+                        KMPlayerNoteCategory);
+                    iWaitNoteId = EMPlayerNoteDeletingSingle;
+                    }
+                else
+                    {
+                    if ( ( type == EMPXItem && category == EMPXSong ) ||
+                        ( type == EMPXItem && category == EMPXPlaylist ) )
+                        {
+                        // tracks level
+                        iConfirmationDlg->PublishDialogL(
+                            EMPlayerQueryDeleteCategory,
+                            KMPlayerNoteCategory);
+                        iWaitNoteId = EMPlayerNoteDeletingSingle;
+                        }
+                    else
+                        {
+                        iConfirmationDlg->PublishDialogL(
+                            EMPlayerQueryDeleteTrack,
+                            KMPlayerNoteCategory);
+                        iWaitNoteId = EMPlayerNoteDeletingSingle;
+                        }
+                    }
+                CAknMediatorFacade* covercl(
+                    AknMediatorFacade( iConfirmationDlg ) );
+                if ( covercl )
+                    {
+                    covercl->BufStream() << title;
+                    }
+                iItemTitle.Set( title );
+                }
+//#endif //__COVER_DISPLAY
+// Cover UI end
+            if(iCollectionReady || aCommand == EMPXCmdCommonDelete )
+                {
+            path->SelectL( arrayCount > 0 ? array->At( 0 ) : currentIndex );
+                }
+            }
+        iConfirmationDlg->SetPromptL( *promptTxt );
+        CleanupStack::PopAndDestroy( promptTxt );
+        TBool performDelete(EFalse);
+        if(iCachedCommand == aCommand)
+            {
+            performDelete = ETrue;
+            }
+        if (!performDelete)
+            {
+        if ( iConfirmationDlg->ExecuteLD( R_MPX_CUI_DELETE_CONFIRMATION_QUERY ) )
+                {
+                performDelete = ETrue;
+                }
+            }
+        if (performDelete)
+            {
+            HandleCommandL( EMPXCmdIgnoreExternalCommand );
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+        if ( iCoverDisplay )
+            {
+            InitiateWaitDialogL();
+            }
+//#endif // __COVER_DISPLAY
+// Cover UI end
+            MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE );
+            if(iCachedCommand != aCommand)
+                {
+                iIsWaitNoteCanceled = EFalse;
+                StartProgressNoteL();
+				TPtr buf = waitNoteText->Des();
+				UpdateProcessL(0, buf);
+                }
+
+                if ( !iIsWaitNoteCanceled )
+                    {
+                    iIsDeleting = ETrue;
+                    iCollectionUiHelper->DeleteL( *path, this );
+                    }
+                else if( iContainer )
+                    {
+                    // delete was canceled before it even began, clear marked items
+                    iContainer->Common()->ClearLbxSelection();
+                    }
+                iIsWaitNoteCanceled = EFalse;
+              
+            
+            if(iContainer->Common()->FindBoxVisibility())
+                {
+                iContainer->Common()->EnableFindBox(EFalse);
+                }
+            }
+        iConfirmationDlg = NULL;
+        CleanupStack::PopAndDestroy( waitNoteText );
+        CleanupStack::PopAndDestroy( path );          
+        }      
+    }
+
+// ---------------------------------------------------------------------------
+// Initiates wait dialog
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::InitiateWaitDialogL()
+    {
+    if ( iCommandInitiator )
+        {
+        HBufC8* filename8 = HBufC8::NewLC( KMaxFileName );
+        filename8->Des().Copy( iItemTitle );
+        HBufC8* data = HBufC8::NewLC(KMaxFileName);
+
+        TPtr8 dataPtr = data->Des();
+        RDesWriteStream str(dataPtr);
+
+        TPtrC8 b(KNullDesC8);
+        b.Set(*filename8);
+
+        str << b;
+        str.CommitL();
+
+        iCommandInitiator->IssueCommand( KMediatorSecondaryDisplayDomain,
+                                    KMPlayerNoteCategory,
+                                    iWaitNoteId,
+                                    TVersion ( 0,0,0 ),
+                                    *data );
+
+        CleanupStack::PopAndDestroy( 2 );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates list box
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::UpdateListBoxL(
+    const CMPXMedia& aEntries,
+    TInt aIndex,
+    TBool aComplete)
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::UpdateListBox" );
+    MPX_DEBUG2( "CMPXCollectionViewImp::UpdateListBox aIndex = %d", aIndex );
+    if ( iContainer )
+        {
+        CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+        CleanupStack::PushL( cpath );
+
+        TInt topIndex = 0;
+        if (iContainer->IsInReorderMode())
+            {
+            TInt currentItem( iContainer->Common()->CurrentLbxItemIndex() );
+            TInt currentBottomIndex( iContainer->Common()->BottomLbxItemIndex() );
+            topIndex = iContainer->Common()->CalculateTopIndex( currentBottomIndex ) ;
+            }
+
+        CMPXCommonListBoxArrayBase* array(
+            iContainer->Common()->ListBoxArray() );
+        array->ResetMediaArrayL();
+        array->AppendMediaL( aEntries );
+        iCollectionCacheReady = ETrue;
+        //keep the marked item indicies 
+        const CArrayFix<TInt>* markedList = iContainer->Common()->CurrentSelectionIndicesL();
+		if ( iFirstIncrementalBatch )
+            {
+            iContainer->Common()->HandleLbxItemAdditionL();
+            iFirstIncrementalBatch = EFalse;
+            }
+		else
+			{
+			iContainer->Common()->HandleListBoxArrayEventL(
+			MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventMediaArrayChange );
+			}
+
+        if (aComplete)
+            {
+            iFirstIncrementalBatch = ETrue;
+            }
+        //mark all again after list box item addition
+        if (iMarkedAll)
+            {
+            iContainer->Common()->HandleMarkableListProcessCommandL(EAknMarkAll);
+            if (aComplete)
+                {
+                iMarkedAll = EFalse;
+                }
+            }
+		   //mark again individual items after list box item addition
+        else if ( markedList )
+            {
+		       TInt markedItemCount( markedList->Count() );
+		       if ( markedItemCount >0 )
+                {             
+                iContainer->Common()->SetCurrentSelectionIndicesL( const_cast<CArrayFix<TInt>*>(markedList) );
+                }
+            }
+        UpdatePlaybackStatusL();
+
+        if ( iBackOneLevel || iPossibleJump )
+            {
+            if ( cpath->Levels() == iLastDepth )
+                {
+                iLastDepth--;
+                iContainer->Common()->SetLbxTopItemIndex(
+                    iContainer->Common()->CalculateTopIndex(
+                    iBottomIndex->At( iLastDepth ) ) );
+                iContainer->Common()->SetLbxCurrentItemIndexAndDraw( aIndex );
+                iBottomIndex->Delete( iLastDepth );
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXCollectionViewImp::UpdateListBox Invalid history, rebuilding" );
+                // invalid path, rebuild with all 0. possibily caused by a jump in views
+                iBottomIndex->Reset();
+                iLastDepth = cpath->Levels();
+                for ( TInt i = 0; i < iLastDepth; i++ )
+                    {
+                    iBottomIndex->AppendL( 0 );
+                    }
+                iContainer->Common()->SetLbxCurrentItemIndexAndDraw( aIndex );
+                }
+            iPossibleJump = EFalse;
+            iBackOneLevel = EFalse;
+            }
+        else
+            {
+            if ( iAddingSong )
+                {
+                // always highlight the last item when a track
+                // is added in add tracks view
+                TInt currentItemCount =
+                    iContainer->Common()->CurrentListItemCount();
+                if ( currentItemCount > 0 )
+                    {
+                    iContainer->Common()->
+                        SetLbxCurrentItemIndexAndDraw( currentItemCount - 1 );
+                    }
+                }
+            else if ( iCurrentHighlightedIndex > KErrNotFound &&
+                ( iCurrentHighlightedIndex <
+                iContainer->Common()->CurrentListItemCount() ) )
+                {
+                if (iContainer->IsInReorderMode())
+                    {
+                    iContainer->Common()->SetLbxTopItemIndex( topIndex );
+                    }
+                iContainer->Common()->
+                    SetLbxCurrentItemIndexAndDraw( iCurrentHighlightedIndex );
+                iCollectionUtility->Collection().CommandL(
+                    EMcCmdSelect, iCurrentHighlightedIndex );
+                iCurrentHighlightedIndex = KErrNotFound;
+                }
+            else if ( ( aIndex > 0 )
+                && ( aIndex < iContainer->Common()->CurrentListItemCount() ) )
+                {
+                iContainer->Common()->SetLbxCurrentItemIndexAndDraw( aIndex );
+                }
+            else
+                {
+                iContainer->Common()->SetLbxCurrentItemIndexAndDraw( 0 );
+                }
+            }
+        if (!aComplete || cpath->Levels() == KMusicCollectionMenuLevel || iContainer->IsInReorderMode())
+            {
+            iContainer->Common()->EnableFindBox(EFalse);
+            }
+        else
+            {
+            iContainer->Common()->EnableFindBox(ETrue);
+            }
+
+        CleanupStack::PopAndDestroy( cpath );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleError( TInt aError )
+    {
+    MPX_DEBUG2( "CMPXCollectionViewImp::HandleError(%d)", aError );
+    ASSERT( aError );
+
+    // only display error message if collection view is in the foreground
+    if ( iContainer )
+        {
+        TRAP_IGNORE( iCommonUiHelper->HandleErrorL( aError ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the navi pane
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::UpdateNaviPaneL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::UpdateNaviPaneL" );
+    if ( iContainer &&
+        (iViewUtility->ActiveViewType() !=
+                       TUid::Uid( KMPXPluginTypeAddSongsEditorUid )) &&
+        (iViewUtility->ActiveViewType() !=
+                      TUid::Uid( KMPXPluginTypeAlbumArtEditorUid )) &&
+        (iViewUtility->ActiveViewType() !=
+                      TUid::Uid( KMPXPluginTypeMetadataEditorUid ))
+       )
+        {
+        MPX_DEBUG2("CMPXCollectionViewImp::UpdateNaviPaneL updating %d", iDuration);
+        if ( iDuration )
+            {
+            iNaviLabel->SetTextL( *iDuration );
+            iNaviPane->PushL( *iNaviDecorator );
+            }
+        else
+            {
+            iNaviPane->Pop( iNaviDecorator );
+            }
+        iNaviPane->DrawNow();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the title pane
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::UpdateTitlePaneL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::UpdateTitlePaneL" );
+    // Set title
+
+    if ( iViewUtility->ActiveViewType() ==
+        TUid::Uid( KMPXPluginTypeCollectionUid ) ||
+        ( iViewUtility->ActiveViewType() ==
+         TUid::Uid( KMPXPluginTypeWaitNoteDialogUid ) && iContainer ) )
+        {
+        CAknTitlePane* title( NULL );
+
+        TRAP_IGNORE(
+            {
+            title = static_cast<CAknTitlePane*>
+                ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+            } );
+
+        if ( title )
+            {
+            if ( iTitle )
+                {
+                title->SetTextL( *iTitle );
+                }
+            else if ( !iIsEmbedded )
+                {
+                // use default title if no metadata is available
+                // and is not in embedded view
+                HBufC* titleText = StringLoader::LoadLC(
+                    R_MPX_COLLECTION_VIEW_TITLE );
+                title->SetTextL( *titleText );
+                CleanupStack::PopAndDestroy( titleText );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates playback status indicator
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewImp::UpdatePlaybackStatusL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::UpdatePlaybackStatusL" );
+    TInt ret( KErrNotFound );  // default selection
+    if ( iContainer )
+        {
+        TMPXPlaybackState pbState( EPbStateNotInitialised );
+        TInt selectedIndex( KErrNotFound );
+        TMPXItemId selectedItemId( KMPXInvalidItemId );
+        CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+        CleanupStack::PushL( cpath );
+
+        MMPXSource* source( iPlaybackUtility->Source() );
+        if ( source )
+            {
+            CMPXCollectionPlaylist* playlist( source->PlaylistL() );
+            if ( playlist )
+                {
+                CleanupStack::PushL( playlist );
+                CMPXCollectionPath* pbPath(
+                    CMPXCollectionPath::NewL( playlist->Path() ) );
+                CleanupStack::PushL( pbPath );
+                TInt playbackPathCount( pbPath->Levels() );
+                if ( cpath->Levels() == playbackPathCount )
+                    {
+                    // not comparing the index
+                    TBool isEqual( ETrue );
+                    for ( TInt i = 0; i < playbackPathCount - 1; i++ )
+                        {
+                        if ( cpath->Id( i ) != pbPath->Id( i ) )
+                            {
+                            isEqual = EFalse;
+                            break;
+                            }
+                        }
+                    if ( isEqual )
+                        {
+                        selectedIndex = pbPath->Index();
+                        selectedItemId = pbPath->Id();
+                        ret = selectedIndex;
+                        pbState = iPlaybackUtility->StateL();
+                        }
+                    }
+                CleanupStack::PopAndDestroy( pbPath );
+                CleanupStack::PopAndDestroy( playlist );
+                }
+            }
+        CleanupStack::PopAndDestroy( cpath );
+        if ( selectedIndex != KErrNotFound )
+            {
+            if ( iContainer->IsInReorderMode() )
+                {
+                // in reorder mode, need to pass unique ID to list box
+                // to search for now playing song
+                iContainer->SetPlaybackStatusByIdL( selectedItemId, pbState );
+                }
+            else
+                {
+                // Fixed for EBLI-7AG8ZN, the Playlist in the Engine is updated
+                // later than UI (because of Inc Open), so index does not work
+                iContainer->SetPlaybackStatusByIdL( selectedItemId, pbState, selectedIndex );
+                }
+            }
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Start a refreshing note
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::StartWaitNoteL( TWaitNoteType aNoteType )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::StartWaitNoteL" );
+    TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid );
+    TUid activeView = iViewUtility->ActiveViewType();
+    if( !iIsEmbedded && activeView != waitnoteId )
+        {
+        TPckg<TWaitNoteType> note = aNoteType;
+        HBufC* arg = MPXUser::AllocL( note );
+        CleanupStack::PushL( arg );
+        RProcess proc;
+        iPriority = proc.Priority();
+        proc.SetPriority( EPriorityHigh );
+        iNoteType = aNoteType;
+        iViewUtility->ActivateViewL( waitnoteId, arg );
+        CleanupStack::PopAndDestroy( arg );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Start a Progress note
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::StartProgressNoteL()
+    {
+    iProgressDialog = new (ELeave) CAknProgressDialog(
+        (REINTERPRET_CAST(CEikDialog**, &iProgressDialog)),
+        ETrue);
+    iProgressDialog->PrepareLC(R_MPX_PROGRESS_NOTE);
+    iProgressInfo = iProgressDialog->GetProgressInfoL();
+    iProgressDialog->SetCallback(this);
+    iProgressDialog->RunLD();
+    iProgressInfo->SetFinalValue(KProgressBarMaxValue);
+    }
+
+// ---------------------------------------------------------------------------
+// Update the Progress note
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::UpdateProcessL( TInt aProgress, const TDesC& aProgressText )
+    {
+    if ( iProgressDialog )
+        {
+        iProgressDialog->SetTextL(aProgressText);
+        iProgressInfo->SetAndDraw(aProgress);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Close waitnote dialog
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::CloseWaitNoteL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::CloseWaitNoteL" );
+    if( !iUSBOnGoing && !iIsEmbedded)
+        {
+        RProcess proc;
+        proc.SetPriority( iPriority );
+        // Fix for ESLU-7CFEPF, try to close the WaitNote even if it's not the current view
+        TRAP_IGNORE(
+            CMPXViewPlugin* pi =
+                iViewUtility->ViewPluginManager().PluginL( TUid::Uid(KWaitNoteImpUid) );
+            pi->DeactivateView();
+            );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Change the navi pane
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::UpdateReorderNaviPaneL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::UpdateReorderNaviPaneL" );
+    delete iDuration;
+    iDuration = NULL;
+
+    // Set playlist counter text to pos/size by default
+    CArrayFixFlat<TInt>* params =
+        new ( ELeave ) CArrayFixFlat<TInt>( KMPXReorderNaviPaneGranularity );
+    CleanupStack::PushL( params );
+    // Position of selection in index
+    params->AppendL( iContainer->Common()->CurrentLbxItemIndex() + 1 );
+    // Total Number of items in lbx
+    params->AppendL( iContainer->Common()->TotalListItemCount() );
+    iDuration = StringLoader::LoadL(
+        R_MPX_CUI_POSITION_COUNTER_TXT, *params );
+    CleanupStack::PopAndDestroy( params );
+    UpdateNaviPaneL();
+    }
+
+// ---------------------------------------------------------------------------
+// Activates reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::ActivateReorderGrabbedModeL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::ActivateReorderGrabbedModeL" );
+    iIsGrabbed = ETrue;
+    TInt currentItem( iContainer->Common()->CurrentLbxItemIndex() );
+    iContainer->Common()->EnableFindBox( EFalse );
+    iContainer->SetReorderGrabbedMode( ETrue, currentItem );
+    if ( !iContainer->IsInReorderMode() )
+        {
+        iContainer->UpdateReorderTitleIconL();
+
+        if ( iTitle )
+            {
+            delete iOriginalTitle;
+            iOriginalTitle = NULL;
+            iOriginalTitle = iTitle->AllocL();
+            delete iTitle;
+            iTitle = NULL;
+            }
+        iTitle = StringLoader::LoadL( R_QTN_NMP_TITLE_REORDER_LIST );
+        UpdateTitlePaneL();
+
+        if ( iDuration )
+            {
+            delete iOriginalDuration;
+            iOriginalDuration = NULL;
+            iOriginalDuration = iDuration->AllocL();
+            delete iDuration;
+            iDuration = NULL;
+            }
+        iContainer->ActivateReorderMode( ETrue );
+        SetNewCbaL( R_MPX_CUI_REORDER_DROP_CANCEL_CBA );
+        }
+    iContainer->Common()->SetLbxCurrentItemIndexAndDraw( currentItem );
+    //show new indicator
+    iContainer->Common()->DrawLbxItem(currentItem);
+    UpdateReorderNaviPaneL();
+    }
+
+// ---------------------------------------------------------------------------
+// Deactivates reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DeactivateReorderGrabbedModeL( TBool aExit )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DeactivateReorderGrabbedModeL" );
+    iIsGrabbed = EFalse;
+    delete iCurrentCba;
+    iCurrentCba = NULL;
+
+    iContainer->SetReorderGrabbedMode( EFalse );
+    if ( aExit )
+        {
+        CEikButtonGroupContainer* cba = Cba();
+        if ( cba )
+            {
+            cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+            cba->DrawDeferred();
+
+#ifdef __ENABLE_MSK
+            // set middle softkey label display
+            UpdateMiddleSoftKeyDisplayL( R_QTN_MSK_PLAY );
+#endif // __ENABLE_MSK
+
+            }
+
+        iContainer->RestoreOriginalTitleIconL();
+        delete iTitle;
+        iTitle = NULL;
+        if ( iOriginalTitle )
+            {
+            iTitle = iOriginalTitle->AllocL();
+            delete iOriginalTitle;
+            iOriginalTitle = NULL;
+            }
+        UpdateTitlePaneL();
+
+        delete iDuration;
+        iDuration = NULL;
+        if ( iOriginalDuration )
+            {
+            iDuration = iOriginalDuration->AllocL();
+            delete iOriginalDuration;
+            iOriginalDuration = NULL;
+            }
+        if ( iViewUtility->ActiveViewType() == TUid::Uid( KMPXPluginTypeCollectionUid ) )
+            {
+            UpdateNaviPaneL();
+            }
+        iContainer->ActivateReorderMode( EFalse );
+        iContainer->Common()->EnableFindBox( ETrue );
+        }
+    iContainer->Common()->HandleLbxItemAdditionPreserveIndexL();
+    }
+
+// -----------------------------------------------------------------------------
+// Change the button group
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::SetNewCbaL( TInt aResId )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::SetNewCbaL" );
+    if ( !iCurrentCba )
+        {
+        CCoeControl* coeControl = iContainer->Common()->CoeControl();
+        iCurrentCba = CEikButtonGroupContainer::NewL(
+            CEikButtonGroupContainer::ECba,
+            CEikButtonGroupContainer::EHorizontal,
+            this,
+            aResId, *coeControl );
+        }
+    else
+        {
+        iCurrentCba->SetCommandSetL( aResId );
+        iCurrentCba->DrawDeferred();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Display the details dialog
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DisplayDetailsDialogL( MDesC16Array& aDataArray,
+    TInt aDialogResourceId, TInt aTitleResourceId )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DisplayDetailsDialogL" );
+    CAknSingleHeadingPopupMenuStyleListBox* list =
+        new ( ELeave ) CAknSingleHeadingPopupMenuStyleListBox;
+    CleanupStack::PushL( list );
+    CAknPopupList* popupList = CAknPopupList::NewL(
+        list, R_AVKON_SOFTKEYS_OK_EMPTY,
+        AknPopupLayouts::EMenuGraphicHeadingWindow);
+    CleanupStack::PushL( popupList );
+    list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect );
+    list->CreateScrollBarFrameL( ETrue );
+    list->ScrollBarFrame()->SetScrollBarVisibilityL(
+        CEikScrollBarFrame::EOff,
+        CEikScrollBarFrame::EAuto);
+
+    // Enable Marquee
+    static_cast<CEikFormattedCellListBox*>( list )->ItemDrawer()->ColumnData()->
+        EnableMarqueeL( ETrue );
+
+    // Retrieve heading array
+    CDesCArrayFlat* headingsArray(
+        iCoeEnv->ReadDesCArrayResourceL( aDialogResourceId ) );
+    CleanupStack::PushL( headingsArray );
+
+    // Item array combines heading array and data array
+    CDesCArrayFlat* itemArray =
+        new ( ELeave ) CDesCArrayFlat( headingsArray->Count() );
+    CleanupStack::PushL( itemArray );
+
+    TInt count = headingsArray->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        HBufC* item = HBufC::NewLC(
+            headingsArray->MdcaPoint( i ).Length() +
+            aDataArray.MdcaPoint( i ).Length() +
+            KMPXDurationDisplayResvLen );
+
+        TPtrC tempPtr1 = headingsArray->MdcaPoint( i );
+        TPtrC tempPtr2 = aDataArray.MdcaPoint( i );
+
+        item->Des().Format( KMPXCollDetailsItemsFormat,
+                            &tempPtr1,
+                            &tempPtr2 );
+
+        itemArray->AppendL( *item );
+        CleanupStack::PopAndDestroy( item );
+        }
+
+    CleanupStack::Pop( itemArray );
+    CleanupStack::PopAndDestroy( headingsArray );
+
+    // Set list items
+    CTextListBoxModel* model = list->Model();
+    model->SetOwnershipType( ELbmOwnsItemArray );
+    model->SetItemTextArray( itemArray );
+
+    // Set title
+    HBufC* title = StringLoader::LoadLC( aTitleResourceId );
+    popupList->SetTitleL( *title );
+    CleanupStack::PopAndDestroy( title );
+
+    // Show popup list
+    CleanupStack::Pop( popupList );
+    popupList->ExecuteLD();
+    CleanupStack::PopAndDestroy( list );
+    }
+
+// -----------------------------------------------------------------------------
+// Display collection details
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoShowCollectionDetailsL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::ShowCollectionDetailsL" );
+    CDesCArrayFlat* dataArray =
+        new ( ELeave ) CDesCArrayFlat( EMPXCollectionDetailsCount );
+    CleanupStack::PushL( dataArray );
+
+    // number of items
+    HBufC* dataToAppend = HBufC::NewLC( KMPXMaxBufferLength );
+    TInt songsCount( 0 );
+    if ( aMedia.IsSupported( KMPXMediaColDetailNumberOfItems ) )
+        {
+        songsCount = aMedia.ValueTObjectL<TInt>( KMPXMediaColDetailNumberOfItems );
+        }
+    TPtr ptr( dataToAppend->Des() );
+    ptr.AppendNum( songsCount );
+    AknTextUtils::LanguageSpecificNumberConversion( ptr );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // total duration
+    TInt duration( 0 );
+    if ( aMedia.IsSupported( KMPXMediaColDetailDuration ) )
+        {
+        duration = aMedia.ValueTObjectL<TInt>( KMPXMediaColDetailDuration );
+        }
+    if ( duration > 0 )
+        {
+        dataToAppend = iCommonUiHelper->DisplayableDurationInTextL( duration/KMilliSecondsToSeconds );
+        CleanupStack::PushL( dataToAppend );
+        ptr.Set( dataToAppend->Des() );
+        AknTextUtils::LanguageSpecificNumberConversion( ptr );
+        dataArray->AppendL( ptr );
+        CleanupStack::PopAndDestroy( dataToAppend );
+        }
+    else
+        {
+        dataArray->AppendL( KNullDesC );
+        }
+
+#ifdef RD_MULTIPLE_DRIVE
+    RFs& fileSession( iCoeEnv->FsSession() );
+    TDriveList driveList;
+    TInt driveCount(0);
+    TInt64 freePhoneMemory(KErrNotFound);
+    TInt64 freeInternalMemory(KErrNotFound);
+    TInt64 freeExternalMemory(KErrNotFound);
+    TVolumeInfo volInfo;
+
+    // Get all visible drives
+    User::LeaveIfError( DriveInfo::GetUserVisibleDrives(
+           fileSession, driveList, driveCount ) );
+    MPX_DEBUG2 ("CMPXCollectionViewImp::ShowCollectionDetailsL - driveCount = %d", driveCount);
+
+    for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ )
+        {
+        if (driveList[driveNum])
+            {
+            // Get the volume information
+            if ( fileSession.Volume( volInfo, driveNum ) == KErrNone )
+                {
+                // Get the drive status
+                TUint driveStatus(0);
+                DriveInfo::GetDriveStatus( fileSession, driveNum, driveStatus );
+
+                // Add up free memory depending on memory location
+                if ( driveNum == EDriveC )
+                    {
+                    if ( freePhoneMemory == KErrNotFound )
+                        {
+                        freePhoneMemory = 0;
+                        }
+                    freePhoneMemory += volInfo.iFree;
+                    }
+                else if ( driveStatus & DriveInfo::EDriveInternal )
+                    {
+                    if ( freeInternalMemory == KErrNotFound )
+                        {
+                        freeInternalMemory = 0;
+                        }
+                    freeInternalMemory += volInfo.iFree;
+                    }
+                else if ( driveStatus &
+                    (DriveInfo::EDriveRemovable | DriveInfo::EDriveRemote) )
+                    {
+                    if ( freeExternalMemory == KErrNotFound )
+                        {
+                        freeExternalMemory = 0;
+                        }
+                    freeExternalMemory += volInfo.iFree;
+                    }
+                }
+            }
+        }
+
+    // phone memory free
+    if ( freePhoneMemory != KErrNotFound )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL(
+            freePhoneMemory, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr);
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_MEMORY_UNAVAILABLE );
+        ptr.Set(dataToAppend->Des());
+        }
+
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // internal memory (mass storage) free
+    if ( freeInternalMemory != KErrNotFound )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL(
+            freeInternalMemory, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr); 
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_MEMORY_UNAVAILABLE );
+        ptr.Set(dataToAppend->Des());
+        }
+
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // removable/remote (memory card) memory free
+    if ( freeExternalMemory != KErrNotFound )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL(
+            freeExternalMemory, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr); 
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM );
+        ptr.Set(dataToAppend->Des());
+        }
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+#else
+    // phone memory free
+    HBufC* driveLetter = StringLoader::LoadLC( R_MPX_COLLECTION_PHONE_MEMORY_ROOT_PATH );
+    RFs& fileSession( iCoeEnv->FsSession() );
+    TVolumeInfo volInfo;
+    TDriveUnit driveUnit( *driveLetter ); // Get the drive
+    CleanupStack::PopAndDestroy( driveLetter );
+    if ( KErrNone == fileSession.Volume( volInfo, ( TInt )driveUnit ) )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL( volInfo.iFree, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr);
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM );
+        ptr.Set(dataToAppend->Des());
+        }
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // memory card
+    driveLetter = StringLoader::LoadLC( R_MPX_COLLECTION_MEMORY_CARD_ROOT_PATH );
+    driveUnit = *driveLetter; // Get the drive
+    CleanupStack::PopAndDestroy( driveLetter );
+    if ( fileSession.Volume( volInfo, ( TInt )driveUnit ) == KErrNone )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL( volInfo.iFree, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr); 
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM );
+        ptr.Set(dataToAppend->Des());
+        }
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+#endif // RD_MULTIPLE_DRIVE
+
+    // last refreshed
+    TInt64 lastRefreshed( 0 );
+    if ( aMedia.IsSupported( KMPXMediaColDetailLastRefreshed ) )
+        {
+        lastRefreshed = aMedia.ValueTObjectL<TInt64>( KMPXMediaColDetailLastRefreshed );
+        }
+    TTime time( lastRefreshed );
+    dataToAppend = HBufC::NewLC(
+        KMPXMaxTimeLength + KMPXDurationDisplayResvLen );
+    HBufC* format( StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO ) );
+    TPtr modDatePtr( dataToAppend->Des() );
+    time.FormatL( modDatePtr, *format );
+    CleanupStack::PopAndDestroy( format );
+    AknTextUtils::LanguageSpecificNumberConversion( modDatePtr ); 
+    dataArray->AppendL( modDatePtr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    DisplayDetailsDialogL( *dataArray,
+        R_MPX_CUI_COLLECTION_DETAILS_HEADINGS,
+        R_MPX_QTN_NMP_TITLE_COLLECTION_DETAILS );
+    CleanupStack::PopAndDestroy( dataArray );
+    }
+
+// -----------------------------------------------------------------------------
+// Display playlist details
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoShowPlaylistDetailsL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::ShowPlaylistDetailsL" );
+    CDesCArrayFlat* dataArray =
+        new ( ELeave ) CDesCArrayFlat( EMPXPlaylistDetailsCount );
+    CleanupStack::PushL( dataArray );
+
+    // playlist name
+    if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) )
+        {
+        dataArray->AppendL( aMedia.ValueText( KMPXMediaGeneralTitle ) );
+        }
+    else if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
+        {
+        TParsePtrC fileDetail( aMedia.ValueText( KMPXMediaGeneralUri ) );
+        dataArray->AppendL( fileDetail.Name() );
+        }
+    else
+        {
+        dataArray->AppendL( KNullDesC );
+        }
+
+    // number of songs
+    TInt songsCount( 0 );
+    if ( aMedia.IsSupported( KMPXMediaGeneralCount ) )
+        {
+        songsCount = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralCount );
+        }
+    HBufC* dataToAppend = HBufC::NewLC( KMPXMaxBufferLength );
+    TPtr ptr( dataToAppend->Des() );
+    ptr.AppendNum( songsCount );
+    AknTextUtils::LanguageSpecificNumberConversion( ptr );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // Duration
+    TInt duration( 0 );
+    if ( aMedia.IsSupported( KMPXMediaGeneralDuration ) )
+        {
+        duration = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
+        }
+    if ( duration > 0 )
+        {
+        dataToAppend = iCommonUiHelper->DisplayableDurationInTextL( duration/KMilliSecondsToSeconds );
+        CleanupStack::PushL( dataToAppend );
+        ptr.Set( dataToAppend->Des() );
+        AknTextUtils::LanguageSpecificNumberConversion( ptr );
+        dataArray->AppendL( ptr );
+        CleanupStack::PopAndDestroy( dataToAppend );
+        }
+    else
+        {
+        dataArray->AppendL( KNullDesC );
+        }
+
+    // Location
+    TUint flags( aMedia.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) );
+    TUint isVirtual( ( flags ) & ( KMPXMediaGeneralFlagsIsVirtual ) );
+    if ( !isVirtual )
+        {
+        if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
+            {
+            dataArray->AppendL( aMedia.ValueText( KMPXMediaGeneralUri ) );
+            }
+        else
+            {
+            dataArray->AppendL( KNullDesC );
+            }
+        }
+
+    // last refreshed
+    TInt64 lastMod( 0 );
+    if ( aMedia.IsSupported( KMPXMediaGeneralDate ) )
+        {
+        lastMod = aMedia.ValueTObjectL<TInt64>( KMPXMediaGeneralDate );
+        }
+    TTime time( lastMod );
+    dataToAppend = HBufC::NewLC(
+        KMPXMaxTimeLength + KMPXDurationDisplayResvLen );
+    HBufC* format = StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO );
+    ptr.Set( dataToAppend->Des() );
+    time.FormatL( ptr, *format );
+    CleanupStack::PopAndDestroy( format );
+    AknTextUtils::LanguageSpecificNumberConversion( ptr );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    dataToAppend = HBufC::NewLC(
+        KMPXMaxTimeLength + KMPXDurationDisplayResvLen );
+    format = StringLoader::LoadLC( R_QTN_TIME_USUAL );
+    ptr.Set( dataToAppend->Des() );
+    time.FormatL( ptr, *format );
+    CleanupStack::PopAndDestroy( format );
+    AknTextUtils::LanguageSpecificNumberConversion( ptr );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    TInt headingResource( isVirtual ?
+        R_MPX_CUI_PLAYLIST_DETAILS_HEADINGS_WITHOUT_URI :
+        R_MPX_CUI_PLAYLIST_DETAILS_HEADINGS_WITH_URI );
+    DisplayDetailsDialogL( *dataArray, headingResource,
+        R_MPX_QTN_NMP_TITLE_PLAYLIST_DETAILS );
+    CleanupStack::PopAndDestroy( dataArray );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Handles Upnp menus from DynInitMenuPaneL()
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleDynInitUpnpL(
+    TInt aResourceId,
+    CEikMenuPane& aMenuPane )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleDynInitUpnpL()" );
+
+    if ( !IsUpnpVisible() )
+        {
+        GetCurrentPlayerDetails();
+
+        if ( iCurrentPlayerType == EPbLocal )
+            {
+            aMenuPane.SetItemDimmed(
+                EMPXCmdUpnpPlayVia,
+                ETrue);
+            }
+        aMenuPane.SetItemDimmed(
+            EMPXCmdUPnPAiwCmdCopyToExternalCriteria,
+            ETrue);
+        }
+    else
+        {
+        MPX_DEBUG1( "CMPXCollectionViewImp::HandleDynInitUpnpL(): UPnP visible and media" );
+        TInt currentItem( iContainer->Common()->CurrentLbxItemIndex() );
+
+        const CMPXMedia& media =
+            (iContainer->Common()->ListBoxArray())->MediaL( currentItem );
+        TMPXGeneralType type( EMPXNoType );
+        if (media.IsSupported(KMPXMediaGeneralType))
+            {
+            type =
+                media.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+            }
+
+        if ( ( type == EMPXItem ) ||
+             ( type == EMPXGroup ) )
+            {
+            MPX_DEBUG1( "CMPXCollectionViewImp::HandleDynInitUpnpL(): folder or song" );
+            if ( iErrorAttachCopyMenu != KErrNone )
+                {
+                MPX_DEBUG1( "CMPXCollectionViewImp::HandleDynInitUpnpL(): error, Dim Copy" );
+                aMenuPane.SetItemDimmed(
+                    EMPXCmdUPnPAiwCmdCopyToExternalCriteria,
+                    ETrue);
+                }
+            else
+                {
+                if (iServiceHandler->HandleSubmenuL(aMenuPane))
+                    {
+                    return;
+                    }
+
+                if ( iServiceHandler->IsAiwMenu(aResourceId))
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewImp::HandleDynInitUpnpL(): Aiw menu" );
+                    CAiwGenericParamList& in = iServiceHandler->InParamListL();
+
+                    iServiceHandler->InitializeMenuPaneL(aMenuPane, aResourceId, EMPXCmdUPnPAiwCmdCopyToExternalCriteria, in);
+                    MPX_DEBUG1( "CMPXCollectionViewImp::HandleDynInitUpnpL(): after InitializeMenuPaneL" );
+                    }
+                }
+            }
+         else
+            {
+            aMenuPane.SetItemDimmed(
+                EMPXCmdUpnpPlayVia,
+                ETrue);
+            aMenuPane.SetItemDimmed(
+                EMPXCmdUPnPAiwCmdCopyToExternalCriteria,
+                ETrue);
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::IsUpnpVisible
+// Checks if UPnP access point is defined
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewImp::IsUpnpVisible()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::IsUpnpVisible" );
+ 	  TBool returnValue = EFalse; 
+#ifdef UPNP_INCLUDED
+   	if ( iUpnpCopyCommand  && iUpnpFrameworkSupport) 	  
+        {
+        returnValue = iUpnpCopyCommand->IsAvailableL();   
+        }
+#endif
+    return returnValue; 
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::AddPlayersNamesToMenuL
+// Taken from Gallery upnp support implementation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::AddPlayersNamesToMenuL( CEikMenuPane& aMenuPane )
+    {
+    RArray<TMPXPlaybackPlayerType> playerTypes;
+    CleanupClosePushL(playerTypes);
+
+    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+    manager.GetPlayerTypesL(playerTypes);
+
+    GetCurrentPlayerDetails();
+
+    TInt countPlayersTypes( playerTypes.Count() );
+    TInt countLocalType(0);
+    TInt countRemoteType(0);
+
+    if ( countPlayersTypes >= 1 )
+        {
+        iPlayersList.Close();
+
+        for ( TInt i = 0; i < countPlayersTypes; i++ )
+            {
+            MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] );
+            switch (playerTypes[i])
+                {
+                case EPbLocal:
+                    {
+                    // we only show 1 specific type once in the menu
+                    if ( countLocalType == 0 )
+                        {
+                        AddPlayerNameToMenuL( aMenuPane,
+                                            EMPXCmdUpnpPlayViaLocal,
+                                            manager,
+                                            playerTypes[i] );
+
+                        countLocalType++;
+                        }
+                    break;
+                    }
+                case EPbRemote:
+                    {
+                    // we only show 1 specific type once in the menu
+                    if ( countRemoteType == 0 )
+                        {
+                        AddPlayerNameToMenuL( aMenuPane,
+                                            EMPXCmdUpnpPlayViaRemotePlayer,
+                                            manager,
+                                            playerTypes[i] );
+                        countRemoteType++;
+                        }
+                    break;
+                    }
+                default:
+                    {
+                    // default case is handled in the next loop, we want
+                    // to add any "other" player at the end of the list
+                    break;
+                    }
+                }
+            } // for loop
+
+        for ( TInt i = 0; i < countPlayersTypes; i++ )
+            {
+            MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] );
+            // EPbLocal and EPbRemote were already added to the
+            // submenu in the previous loop
+            if ( playerTypes[i] != EPbLocal &&
+                 playerTypes[i] != EPbRemote )
+                {
+                // EPbUnknown or else
+                TBool alreadyInTheList( EFalse );
+
+                for ( TInt j = 0; j < i; j++)
+                    {
+                    // if the new playertype is already in the list
+                    if ( playerTypes[i] == playerTypes[j] )
+                        {
+                        alreadyInTheList = ETrue;
+                        break;
+                        }
+                    }
+
+                if ( !alreadyInTheList )
+                    {
+                    HBufC* buf = manager.PlayerTypeDisplayNameL(playerTypes[i]);
+
+                    if ( buf )
+                        {
+                        CleanupStack::PushL(buf);
+                        AddPlayerNameToMenuL( aMenuPane,
+                                            EMPXCmdUpnpPlayViaRemotePlayer,
+                                            manager,
+                                            playerTypes[i],
+                                            *buf );
+                        CleanupStack::PopAndDestroy(buf);
+                        }
+                    // else we don't do anything. other player type is not
+                    // currently supported. Implementation will be finalized
+                    // when the requirement is defined.
+                    }
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&playerTypes);
+
+    if ( iPlayersList.Count() <= 1 )
+        {
+        aMenuPane.SetItemDimmed( EMPXCmdUpnpPlayViaRemotePlayer,
+                                  ETrue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::AddPlayerNameToMenuL
+// Taken from Gallery upnp support implementation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::AddPlayerNameToMenuL( CEikMenuPane& aMenuPane,
+                                                TInt aCommandId,
+                                                MMPXPlayerManager& aPlayerManager,
+                                                TMPXPlaybackPlayerType& aPlayerType,
+                                                const TDesC& aMenuText )
+    {
+    RArray<TUid> players;
+    CleanupClosePushL(players);
+    aPlayerManager.GetPlayerListL(players, aPlayerType);
+
+    // For now we only keep the first player we find
+    // Local player is always the first one in the list
+    // Ui spec limitation
+    MPX_DEBUG2( "players[0]: %d", players[0].iUid );
+    if ( aCommandId == EMPXCmdUpnpPlayViaLocal )
+        {
+        iPlayersList.Insert(players[0], 0);
+        }
+    else if ( ( aCommandId == EMPXCmdUpnpPlayViaRemotePlayer ) &&
+              (iPlayersList.Count() > 1) )
+        {
+        iPlayersList.Insert(players[0], 1);
+        }
+    else
+        {
+        iPlayersList.AppendL(players[0]);
+        }
+    CleanupStack::PopAndDestroy(&players);
+
+    // if the player is of unknown type
+    if ( ( aCommandId != EMPXCmdUpnpPlayViaRemotePlayer ) &&
+         ( aCommandId != EMPXCmdUpnpPlayViaLocal ) )
+        {
+        CEikMenuPaneItem::SData menuItem;
+        menuItem.iText.Copy( aMenuText );
+        menuItem.iCascadeId = 0;
+        menuItem.iFlags = EEikMenuItemRadioEnd;
+
+        menuItem.iCommandId = aCommandId + (iPlayersList.Count() - 1);
+        aCommandId = menuItem.iCommandId;
+
+        aMenuPane.AddMenuItemL( menuItem );
+        }
+
+    if ( iCurrentPlayerType == aPlayerType )
+        {
+        aMenuPane.SetItemButtonState( aCommandId, EEikMenuItemSymbolOn );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::GetCurrentPlayerDetails
+// Retrieves the current player name and type
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::GetCurrentPlayerDetails()
+    {
+    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+    TUid currentlyUsedPlayer;
+    TInt currentlyUsedSubPlayer;
+    iCurrentPlayerType = EPbLocal;
+    delete iSubPlayerName;
+    iSubPlayerName = NULL;
+    TRAP_IGNORE( manager.GetSelectionL( iCurrentPlayerType,
+                                        currentlyUsedPlayer,
+                                        currentlyUsedSubPlayer,
+                                        iSubPlayerName));
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::SelectNewPlayerL
+// Selects a new player for audio playback
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::SelectNewPlayerL( TInt aCommand )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::SelectNewPlayerL()" );
+    MPX_DEBUG2( "CMPXCollectionViewImp::SelectNewPlayerL(%d)", aCommand );
+
+    TInt errorSelectPlayer( KErrCancel );
+
+    switch (aCommand)
+        {
+        case EMPXCmdUpnpPlayViaLocal:
+            {
+            // if Local is not already the current player, select it
+            if ( iCurrentPlayerType != EPbLocal )
+                {
+                MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+                MPX_TRAP( errorSelectPlayer, manager.ClearSelectPlayersL() );
+                }
+            else // no need to reselect it but always start playback
+                {
+                errorSelectPlayer = KErrNone;
+                }
+            break;
+            }
+        default:
+            {
+            if ( aCommand >= EMPXCmdUpnpPlayViaRemotePlayer )
+                {
+                HBufC* buf = HBufC::NewLC( KMaxUidName );
+                buf->Des().AppendNum(
+                     (iPlayersList[aCommand -
+                                   EMPXCmdUpnpPlayViaLocal]).iUid );
+
+                // ActivateViewL leaves with KErrCancel if the dialog is
+                // cancelled
+                // ActivateViewL leaves with KErrInUse if the selected player
+                // is already the active player
+                MPX_TRAP(errorSelectPlayer, iViewUtility->ActivateViewL(
+                                TUid::Uid( KMPXPluginTypeUPnPBrowseDialogUid ),
+                                buf ));
+                CleanupStack::PopAndDestroy( buf );
+                }
+            break;
+            }
+        }
+
+    GetCurrentPlayerDetails();
+
+    // If InUse, the player selected is already the current one, we start playback anyway
+    // contrary to Playback view
+    if ( ( errorSelectPlayer == KErrNone ) ||
+         ( errorSelectPlayer == KErrInUse ) )
+        {
+        // Starts playback by calling OpenL() for the selected track
+        CMPXCommonListBoxArrayBase* array = iContainer->Common()->ListBoxArray();
+        if ( array && ( iContainer->Common()->TotalListItemCount() > 0 ) )
+            {
+            MPX_DEBUG1( "CMPXCollectionViewImp::SelectNewPlayerL() before MediaL()" );
+
+            TInt currentListBoxItemIndex(
+                iContainer->Common()->CurrentLbxItemIndex() );
+
+            if ( currentListBoxItemIndex >= 0 )
+                {
+                const CMPXMedia& media = array->MediaL( currentListBoxItemIndex );
+
+                TMPXGeneralType type( EMPXNoType );
+                TMPXGeneralCategory category( EMPXNoCategory );
+
+                if ( media.IsSupported( KMPXMediaGeneralType ) )
+                    {
+                    type = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+                    }
+
+                if ( media.IsSupported( KMPXMediaGeneralCategory ) )
+                    {
+                    category = media.ValueTObjectL<TMPXGeneralCategory>(
+                                    KMPXMediaGeneralCategory );
+                    }
+
+                MPX_DEBUG2( "CMPXCollectionViewImp::SelectNewPlayerL() currentIndex %d", currentListBoxItemIndex );
+
+                // Needed to reset the status of iPreservedState
+                iPlaybackUtility->CommandL(EPbCmdResetPreserveState);
+
+                if ( ( type == EMPXItem ) && ( category == EMPXSong ) )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewImp::SelectNewPlayerL() type is EMPXItem" );
+                    if(iCollectionCacheReady)
+                        {
+                        iCollectionUtility->Collection().OpenL( currentListBoxItemIndex );
+						iFirstIncrementalBatch = ETrue;
+                        }
+                    }
+                else if ( ( type == EMPXItem ) && ( category == EMPXPlaylist ) )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewImp::SelectNewPlayerL() category is EMPXPlaylist" );
+                    // if we want to play a playlist, we need to find out
+                    // if it's empty first
+                    ASSERT( iCurrentFindAllLOp == EMPXOpFindAllLIdle );
+
+                    TMPXItemId id(
+                        media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                    CMPXMedia* entry = CMPXMedia::NewL();
+                    CleanupStack::PushL( entry );
+                    entry->SetTObjectValueL<TMPXGeneralType>(
+                        KMPXMediaGeneralType, EMPXGroup );
+                    entry->SetTObjectValueL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory, EMPXSong );
+                    entry->SetTObjectValueL<TMPXItemId>(
+                        KMPXMediaGeneralId, id );
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL( attrs );
+                    attrs.Append( KMPXMediaGeneralId );
+                    iCollectionUtility->Collection().FindAllL(
+                                            *entry, attrs.Array(), *this );
+                    iCurrentFindAllLOp = EMPXOpFindAllLUpnpPlayback;
+
+                    CleanupStack::PopAndDestroy( &attrs );
+                    CleanupStack::PopAndDestroy( entry );
+                    }
+                else // if a folder is selected
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewImp::SelectNewPlayerL() type is EMPXGroup" );
+                    if(iCollectionCacheReady)
+                        {
+                        iCollectionUtility->Collection().OpenL( currentListBoxItemIndex,
+                                                            EMPXOpenPlaylistOnly);
+						iFirstIncrementalBatch = ETrue;
+                        }
+                    }
+                }
+            }
+        }
+    else if ( errorSelectPlayer != KErrCancel )
+        {
+        User::LeaveIfError(errorSelectPlayer);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::CopySelectedItemsToRemoteL
+// Copies selected file(s) to remote player
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::CopySelectedItemsToRemoteL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::CopySelectedItemsToRemoteL()" );
+
+    TInt index( iContainer->Common()->CurrentLbxItemIndex() );
+    if ( index >= 0 )
+        {
+        CMPXCommonListBoxArrayBase* array =
+            iContainer->Common()->ListBoxArray();
+        const CMPXMedia& media = array->MediaL( index );
+
+        TMPXGeneralType type( EMPXNoType );
+        TMPXGeneralCategory category( EMPXNoCategory );
+
+       if ( media.IsSupported( KMPXMediaGeneralType ) )
+            {
+            type =
+                media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+            }
+        if ( media.IsSupported( KMPXMediaGeneralCategory ) )
+            {
+            category =
+                media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+            }
+
+        CMPXCollectionPath* cpath =
+                              iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL( cpath );
+
+        if ( ( type == EMPXItem ) && ( category == EMPXSong ) )
+            {
+            const CArrayFix<TInt>* arrayIndex =
+                iContainer->Common()->CurrentSelectionIndicesL();
+            TInt arrayCount( arrayIndex->Count() );
+
+            cpath->ClearSelection();
+            if ( arrayCount > 0 )
+                {
+                for (TInt index=0; index < arrayCount; index++)
+                    {
+                    cpath->SelectL(arrayIndex->At(index));
+                    }
+                }
+            else
+                {
+                cpath->Set( index );
+                }
+
+            // Ask for the list of selected song paths: will return in HandleMedia()
+            ASSERT( iCurrentMediaLOp == EMPXOpMediaLIdle );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append( KMPXMediaGeneralUri );
+            iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+            iCurrentMediaLOp = EMPXOpMediaLCopyToRemote;
+            CleanupStack::PopAndDestroy( &attrs );
+            }
+        else // if a folder is selected
+            {
+            TMPXItemId id(0);
+            if ( media.IsSupported( KMPXMediaGeneralId ) )
+                {
+                id = media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+                }
+
+            RArray<TInt> supportedIds;
+            CleanupClosePushL(supportedIds);
+            supportedIds.AppendL(KMPXMediaIdGeneral);
+
+            CMPXMedia* entry = CMPXMedia::NewL(supportedIds.Array());
+            CleanupStack::PushL(entry);
+            entry->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup );
+
+            entry->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong );
+
+            entry->SetTObjectValueL( KMPXMediaGeneralId, id );
+
+            if ( category == EMPXAlbum )
+                {
+                const CMPXMedia& containerMedia = array->ContainerMedia();
+                TMPXGeneralCategory containerCategory( EMPXNoCategory );
+                if ( containerMedia.IsSupported( KMPXMediaGeneralCategory ) )
+                    {
+                    containerCategory = containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                                                KMPXMediaGeneralCategory );
+                    }
+
+                if ( containerCategory == EMPXArtist )
+                    {
+                    // artist/album level, need to specify artist ID in container ID
+                    TMPXItemId containerId =
+                        containerMedia.ValueTObjectL<TMPXItemId>(
+                            KMPXMediaGeneralId );
+                    entry->SetTObjectValueL<TMPXItemId>(
+                        KMPXMediaGeneralContainerId, containerId );
+                    }
+                }
+
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append( KMPXMediaGeneralUri );
+
+            ASSERT( iCurrentFindAllLOp == EMPXOpFindAllLIdle );
+            iCollectionUtility->Collection().FindAllL( *entry,
+                                                       attrs.Array(),
+                                                       *this );
+            iCurrentFindAllLOp = EMPXOpFindAllLUpnp;
+
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PopAndDestroy( entry );
+            CleanupStack::PopAndDestroy( &supportedIds );
+            }
+        CleanupStack::PopAndDestroy( cpath );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::DoHandleCopyToRemoteL
+// Handle call back from collectionframework for Copy to Remote command
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoHandleCopyToRemoteL(
+    const CMPXMedia& aMedia, TBool aComplete )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoHandleCopyToRemoteL()");
+
+    CMPXMediaArray* mediaArray( NULL );
+    TInt fileCount( 0 );
+
+    if ( aMedia.IsSupported( KMPXMediaArrayContents ) )
+        {
+        mediaArray =
+            aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+        if ( mediaArray )
+            {
+            fileCount = mediaArray->Count();
+            }
+        }
+    MPX_DEBUG2("CMPXCollectionViewImp::DoHandleCopyToRemoteL Entry count = %d", fileCount);
+
+    // Change this to Global will be needed if FindAll() is called
+    // repeatedly until aComplete is ETrue (Inc9?)
+    CAiwGenericParamList* aiwCopyInParamList = CAiwGenericParamList::NewLC();
+
+    // multiple files or folder
+    if ( fileCount > 0 )
+        {
+        if ( mediaArray )
+            {
+            for ( TInt i = 0; i < fileCount; i++ )
+                {
+                CMPXMedia* media( mediaArray->AtL( i ) );
+
+                const TDesC& location =
+                    media->ValueText( KMPXMediaGeneralUri );
+                MPX_DEBUG3( "CMPXCollectionViewImp::DoHandleCopyToRemote %d filePath = %S", i, &location );
+
+                TAiwVariant path( location );
+                TAiwGenericParam fileParameter( EGenericParamFile,
+                                                path );
+                aiwCopyInParamList->AppendL( fileParameter );
+                }
+            }
+        }
+    else // single file
+        {
+        TMPXGeneralType type( EMPXNoType );
+
+        if ( aMedia.IsSupported( KMPXMediaGeneralType ) )
+            {
+            type = aMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+            }
+
+        if ( type == EMPXItem )
+            {
+            const TDesC& location =
+                aMedia.ValueText( KMPXMediaGeneralUri );
+            TAiwVariant path( location );
+            MPX_DEBUG2( "CMPXCollectionViewImp::DoHandleCopyToRemote filePath = %S", &location );
+
+            TAiwGenericParam fileParameter( EGenericParamFile, path );
+            aiwCopyInParamList->AppendL( fileParameter );
+            }
+        }
+
+    if ( ( aiwCopyInParamList->Count() > 0 ) &&
+         aComplete )
+        {
+        CAiwGenericParamList* outParamList = CAiwGenericParamList::NewLC();
+        // do not allow the copy dialog to be dismissed by external command
+        HandleCommandL( EMPXCmdIgnoreExternalCommand );
+        iServiceHandler->ExecuteMenuCmdL(
+                  EMPXCmdUPnPAiwCmdCopyToExternalCriteria, /* command id */
+                  *aiwCopyInParamList,   /* in parameters */
+                  *outParamList,          /* out parameters */
+                  0,                      /* options */
+                  NULL );                 /* call back */
+        HandleCommandL( EMPXCmdHandleExternalCommand );
+
+        CleanupStack::PopAndDestroy( outParamList );
+        }
+
+    // Clear selection
+    if( iContainer )
+        {
+        iContainer->Common()->ClearLbxSelection();
+        }
+
+    CleanupStack::PopAndDestroy( aiwCopyInParamList );
+    }
+
+// -----------------------------------------------------------------------------
+// Find playlists
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewImp::FindPlaylistsL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::FindPlaylistsL" );
+    TInt entriesCount( 0 );
+    delete iUserPlaylists;
+    iUserPlaylists = NULL;
+    iUserPlaylists = iCommonUiHelper->FindPlaylistsL();
+
+    if ( iUserPlaylists )
+        {
+        const CMPXMediaArray* mediaArray =
+            iUserPlaylists->Value<CMPXMediaArray>( KMPXMediaArrayContents );
+        User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+        
+        entriesCount = mediaArray->Count();
+        MPX_DEBUG2( "CMPXCollectionViewImp::FindPlaylistsL Entry count = %d", entriesCount );
+        }
+    else
+        {
+        MPX_DEBUG1( "CMPXCollectionViewImp::FindPlaylistsL Error getting playlist" );
+        User::Leave( KErrNotFound );
+        }
+    return entriesCount;
+    }
+
+// -----------------------------------------------------------------------------
+// Save the playlist after reorder
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::SaveCurrentPlaylistL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::SaveCurrentPlaylistL" );
+    CMPXCommonListBoxArrayBase* listboxArray =
+        iContainer->Common()->ListBoxArray();
+    TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() );
+    TInt origIndex( iContainer->GetOriginalIndex() );
+    const CMPXMedia& media( listboxArray->MediaL( origIndex ) );
+    TMPXItemId id( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+    const CMPXMedia& containerMedia = listboxArray->ContainerMedia();
+    TMPXItemId playlistId( containerMedia.ValueTObjectL<TMPXItemId>(
+        KMPXMediaGeneralId ) );
+    MPX_DEBUG4( "CMPXCollectionViewImp::SaveCurrentPlaylistL song 0x%x is moved from %d to %d",
+         id.iId1, origIndex, currentIndex );
+    MPX_DEBUG2( "CMPXCollectionViewImp::SaveCurrentPlaylistL playlist ID 0x%x", playlistId.iId1 );
+    iIsSavingReorderPlaylist = ETrue;
+    iCollectionUiHelper->ReorderPlaylistL(
+        playlistId, id, origIndex, currentIndex, this );
+    iCurrentHighlightedIndex = currentIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// Handles rename operation complete
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleRenameOpCompleteL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleRenameOpCompleteL" );
+    iSetMediaLCount = KErrNotFound;
+    MPX_DEBUG1( "CMPXCollectionViewImp::HandleRenameOpCompleteL dismiss wait note" );
+    iCommonUiHelper->DismissWaitNoteL();
+    HandleCommandL( EMPXCmdHandleExternalCommand );
+    if ( iInvalidFileExist )
+        {
+        // there are invalid files, diplay info note
+        HBufC* string = StringLoader::LoadLC(
+            R_MPX_COLLECTION_NOTE_RENAME_WITH_INVALID, *iNewName );
+        iCommonUiHelper->DisplayInfoNoteL( *string );
+        CleanupStack::PopAndDestroy( string );
+        }
+    MPX_DEBUG1( "CMPXCollectionViewImp::HandleRenameOpCompleteL calling OpenL" );
+    // path changed messages were ignored during rename, need to
+    // manually refresh the screen
+    DoIncrementalOpenL();
+    }
+
+// -----------------------------------------------------------------------------
+// checks if send option should be shown
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewImp::SendOptionVisibilityL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::SendOptionVisibilityL" );
+    TBool isHidden( iContainer->Common()->TotalListItemCount() < 1 );
+
+    if ( !isHidden )
+        {
+        CMPXCommonListBoxArrayBase* baseArray =
+            iContainer->Common()->ListBoxArray();
+        CMPXCollectionViewListBoxArray* array =
+            static_cast<CMPXCollectionViewListBoxArray*>( baseArray );
+        TInt selectionCount( 0 );
+        if ( iSelectionIndexCache)
+            {
+            selectionCount = iSelectionIndexCache->Count();
+            }
+
+        if ( selectionCount > 0 )
+            {
+            TBool isValid( EFalse );
+            for ( TInt i = 0; i < selectionCount && !isValid; i++ )
+                {
+                // multiple selection
+                isValid = !array->IsItemBrokenLinkL(
+                    iSelectionIndexCache->At( i ) );
+                isValid = isValid &&
+                    !array->IsItemCorruptedL(
+                    iSelectionIndexCache->At( i ));
+                }
+            // if anything is valid, display the item
+            isHidden = !isValid;
+            }
+        else
+            {
+            //single selection
+            isHidden = array->IsItemBrokenLinkL(
+                iContainer->Common()->CurrentLbxItemIndex() );
+            isHidden = isHidden ||
+                array->IsItemCorruptedL(
+                iContainer->Common()->CurrentLbxItemIndex() );
+            }
+        }
+
+    return isHidden;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if Set as ringtone option should be shown
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewImp::SetAsRingToneOptionVisibilityL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::SetAsRingToneOptionVisibilityL" );
+    TBool isHidden( iContainer->Common()->TotalListItemCount() < 1 );
+
+    if ( !isHidden )
+        {
+        CMPXCollectionViewListBoxArray* array =
+            static_cast<CMPXCollectionViewListBoxArray*>(
+            iContainer->Common()->ListBoxArray() );
+        const CMPXMedia& media =
+            array->MediaL( iContainer->Common()->CurrentLbxItemIndex() );
+
+        // if item is not yet fetched from database, assume that it's valid
+        if ( !( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
+            KMPXInvalidItemId ) )
+            {
+            CMPXMedia* criteria = CMPXMedia::NewL();
+            CleanupStack::PushL( criteria );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL( attrs );
+            attrs.Append( KMPXMediaGeneralUri );
+            attrs.Append( KMPXMediaDrmProtected );
+            attrs.Append( KMPXMediaDrmCanSetAutomated );
+            criteria->SetTObjectValueL<TMPXGeneralType>(
+                KMPXMediaGeneralType,
+                media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+            criteria->SetTObjectValueL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory,
+                media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+            if ( media.IsSupported( KMPXMediaGeneralCollectionId ) )
+                {
+                criteria->SetTObjectValueL<TUid>(
+                    KMPXMediaGeneralCollectionId,
+                    media.ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId ) );
+                }
+            else
+                {
+                CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
+                CleanupStack::PushL( path );
+                criteria->SetTObjectValueL<TUid>(
+                    KMPXMediaGeneralCollectionId,
+                    TUid::Uid( path->Id( 0 ) ) );
+                CleanupStack::PopAndDestroy( path );
+                }
+            criteria->SetTObjectValueL<TMPXItemId>(
+                KMPXMediaGeneralId,
+                media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+
+            CMPXMedia* songInfo = iCollectionUtility->Collection().FindAllL( *criteria,
+                                                             attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PushL( songInfo );
+
+            const CMPXMediaArray* mediaArray(
+                songInfo->Value<CMPXMediaArray>( KMPXMediaArrayContents ) );
+            User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+            
+            if ( mediaArray->Count() > 0 )
+                {
+                CMPXMedia* si( mediaArray->AtL( 0 ) );
+                if ( si->IsSupported( KMPXMediaDrmProtected ) )
+                    {
+                    if ( si->ValueTObjectL<TBool>( KMPXMediaDrmProtected ) &&
+                        si->IsSupported( KMPXMediaDrmCanSetAutomated ) )
+                        {
+                        // if it's drm protected, check if
+                        // KMPXMediaDrmCanSetAutomated
+                        isHidden = !( si->ValueTObjectL<TBool>( KMPXMediaDrmCanSetAutomated ) );
+                        }
+                    }
+                }
+            CleanupStack::PopAndDestroy( songInfo );
+            CleanupStack::PopAndDestroy( criteria );
+            }
+        }
+    return isHidden;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if file details option should be shown
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewImp::FileDetailsOptionVisibilityL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::FileDetailsOptionVisibilityL" );
+    TInt selectionCount( 0 );
+    if ( iSelectionIndexCache)
+        {
+        selectionCount = iSelectionIndexCache->Count();
+        }
+    TBool isHidden( iContainer->Common()->TotalListItemCount() < 1 ||
+            selectionCount );
+    if ( !isHidden )
+        {
+        CMPXCollectionViewListBoxArray* array =
+            static_cast<CMPXCollectionViewListBoxArray*>(
+            iContainer->Common()->ListBoxArray() );
+        const CMPXMedia& media = array->MediaL(
+            iContainer->Common()->CurrentLbxItemIndex() );
+
+        if ( media.IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            TUint flags( media.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) );
+            if ( ( flags ) & ( KMPXMediaGeneralFlagsIsMissingDetails ) )
+                {
+                isHidden = ETrue;
+                }
+            }
+        }
+    return isHidden;
+    }
+
+// -----------------------------------------------------------------------------
+// Handle send command.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoSendL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoSendL" );
+
+
+    CMPXCommonListBoxArrayBase* listboxArray(
+        iContainer->Common()->ListBoxArray() );
+    TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() );
+    const CMPXMedia& media( listboxArray->MediaL(
+        iContainer->Common()->CurrentLbxItemIndex() ) );
+
+    // Marked indicies
+    TInt arrayCount( iSelectionIndexCache->Count() );
+
+    if ( ( arrayCount == 0 || arrayCount == 1 ) &&
+        ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId ) )
+        {
+        // not marked, or only 1 item is marked
+        // and the highlighted item is not yet available
+        MPX_DEBUG1( "CMPXCollectionViewImp::DoSendL item not yet fetched" );
+        }
+    else
+        {
+        CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL( path );
+
+        MPX_DEBUG2( "CMPXCollectionViewImp::DoSendL array count = %d", arrayCount );
+        if ( arrayCount > 1 )
+            {
+            // if more than 1 selected
+            for ( TInt i = 0; i < arrayCount; i++ )
+                {
+                MPX_DEBUG2( "CMPXCollectionViewImp::DoSendL array index = %d", iSelectionIndexCache->At( i ) );
+                path->SelectL( iSelectionIndexCache->At(i) );
+                }
+            }
+        else
+            {
+            // if only 1 item is marked, treat it as single selection
+            path->Set( ( arrayCount == 1 ) ?
+                iSelectionIndexCache->At( 0 ) : iContainer->Common()->CurrentLbxItemIndex() );
+            }
+
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        attrs.Append(
+            TMPXAttribute( KMPXMediaIdGeneral,
+                EMPXMediaGeneralUri | EMPXMediaGeneralSize |
+                EMPXMediaGeneralCollectionId |
+                EMPXMediaGeneralFlags | EMPXMediaGeneralId |
+                EMPXMediaGeneralType | EMPXMediaGeneralCategory ) );
+        iCurrentMediaLOp = EMPXOpMediaLSend;
+        iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+        CleanupStack::PopAndDestroy( &attrs );
+        CleanupStack::PopAndDestroy( path );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle send playlist command
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoSendPlaylistL( TMPXItemId aItemId )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoSendPlaylistL" );
+    // export the playlist to file system, and send the playlist
+    // when the operation is completed
+    HBufC* defaultDrive = iCommonUiHelper->DefaultDriveLC();
+    TFileName defaultPath;
+    defaultPath.Append( *defaultDrive );
+    RFs& fileSession = iCoeEnv->FsSession();
+    TBool folderExist = BaflUtils::FolderExists( fileSession, defaultPath );
+    TInt count( 0 );
+    // use time stamp as the directory name for export, so that
+    // it won't overwrite any existing files.  It will search for the first
+    // available folder that is not currently in the file system
+    while ( folderExist )
+        {
+        if ( count++ > KMPXPlaylistExportRetry )
+            {
+            MPX_DEBUG1( "CMPXCollectionViewImp::DoSendPlaylistL maximum retry count reached, leaving" );
+            User::Leave( KErrNotReady );
+            }
+        defaultPath.Copy( *defaultDrive );
+        TTime timeStamp;
+        timeStamp.UniversalTime();
+        defaultPath.AppendNum( timeStamp.Int64() );
+        defaultPath.Append( KPathDelimiter );
+        folderExist = BaflUtils::FolderExists( fileSession, defaultPath );
+        }
+    CleanupStack::PopAndDestroy( defaultDrive );
+    MPX_DEBUG2( "CMPXCollectionViewImp::DoSendPlaylistL creating path = %S", &defaultPath );
+    BaflUtils::EnsurePathExistsL( fileSession, defaultPath );
+    // playlist is sent in the call back of this function
+    iCollectionUiHelper->ExportPlaylistL( aItemId, defaultPath, this );
+    }
+
+// -----------------------------------------------------------------------------
+// Handle call back from collectionframework for send command
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoHandleSendL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoHandleSendL" );
+    TInt invalidFileCount( 0 );
+    TInt maxSize( 0 );
+    CMessageData* messageData = CMessageData::NewLC();
+
+    TInt fileCount( 0 );
+    if( aMedia.IsSupported( KMPXMediaArrayContents ) )
+        {
+        const CMPXMediaArray* mediaArray =
+            aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+        User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+        fileCount = mediaArray->Count();
+
+        }
+    MPX_DEBUG2( "CMPXCollectionViewImp::DoHandleSendL Entry count = %d", fileCount );
+
+    if ( fileCount > 0 )
+        {
+        const CMPXMediaArray* mediaArray =
+            aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+        User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+        
+        CMPXMedia* media( NULL );
+        for ( TInt i = 0; i < fileCount; i++ )
+            {
+            media = mediaArray->AtL( i );
+            TUint flags( media->ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) );
+            const TDesC& location = media->ValueText( KMPXMediaGeneralUri );
+
+            if ( !( flags & KMPXMediaGeneralFlagsIsInvalid ) &&
+                ConeUtils::FileExists( location ) )
+                {
+                TInt fileSize( 0 );
+                if ( media->IsSupported( KMPXMediaGeneralSize ) )
+                    {
+                    fileSize = media->ValueTObjectL<TInt>( KMPXMediaGeneralSize );
+                    }
+                else
+                    {
+                    RFs& fileSession = iCoeEnv->FsSession();
+                    TEntry pl;
+                    fileSession.Entry( location, pl );
+                    fileSize = pl.iSize;
+                    }
+                if ( fileSize > maxSize )
+                    {
+                    maxSize = fileSize;
+                    }
+                messageData->AppendAttachmentL( location );
+                }
+            else
+                {
+                UpdateDatabaseFlagL( KErrNotFound, *media,
+                    KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse );
+                invalidFileCount++;
+                }
+            }
+        }
+    else
+        {
+        // single file
+        fileCount = 1;
+        TUint flags = aMedia.ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+        const TDesC& location = aMedia.ValueText( KMPXMediaGeneralUri );
+
+        if ( !( flags & KMPXMediaGeneralFlagsIsInvalid ) &&
+            ConeUtils::FileExists( location ) )
+            {
+            TInt fileSize( 0 );
+            if ( aMedia.IsSupported( KMPXMediaGeneralSize ) )
+                {
+                fileSize = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralSize );
+                }
+            else
+                {
+                RFs& fileSession = iCoeEnv->FsSession();
+                TEntry pl;
+                fileSession.Entry( location, pl );
+                fileSize = pl.iSize;
+                }
+            if ( fileSize > maxSize )
+                {
+                maxSize = fileSize;
+                }
+            messageData->AppendAttachmentL( location );
+            }
+        else
+            {
+            UpdateDatabaseFlagL( KErrNotFound, aMedia,
+                KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse );
+            invalidFileCount++;
+            }
+        }
+    TBool confirmOk( EFalse );
+    MPX_DEBUG3( "CMPXCollectionViewImp::DoHandleSendL Invalid Count = %d, Total Count = %d", invalidFileCount, fileCount );
+    if ( invalidFileCount )
+        {
+        if ( invalidFileCount == fileCount )
+            {
+            // all files are invalid
+            iCommonUiHelper->DisplayInfoNoteL( ( invalidFileCount == 1 ) ?
+                R_MPX_COLLECTION_INFO_FILE_NOT_FOUND :
+                R_MPX_COLLECTION_SEND_ALL_INVALID_SONGS_NOTE_TXT );
+            }
+        else
+            {
+            // Show confirmation query if invalid file found
+            HBufC* queryTxt = StringLoader::LoadLC(
+                R_MPX_COLLECTION_QUERY_SEND_INVALID_SONGS_TXT );
+            CAknQueryDialog* query = CAknQueryDialog::NewL(
+                CAknQueryDialog::EConfirmationTone );
+            CleanupStack::PushL( query );
+            query->PublishDialogL( EMPlayerNoteSendInvalidSongs,
+                                KMPlayerNoteCategory);
+            CleanupStack::Pop( query );
+            confirmOk = query->ExecuteLD(
+                R_MPX_COLLECTION_GENERIC_CONFIRMATION_QUERY,
+                *queryTxt );
+            CleanupStack::PopAndDestroy( queryTxt );
+            }
+        }
+
+    if ( !invalidFileCount || confirmOk )
+        {
+        if ( !iSendUi )
+            {
+            iSendUi = CSendUi::NewL();
+            }
+        TSendingCapabilities capabilities(
+            0,
+            maxSize,
+            TSendingCapabilities::ESupportsAttachments );
+        // ignore commands from external clients so that the
+        // sending is not interrupted
+        HandleCommandL( EMPXCmdIgnoreExternalCommand );
+        // send ui leaves with error 0 if canceled, have to be trapped
+        MPX_TRAPD( err, iSendUi->ShowQueryAndSendL( messageData, capabilities ) );
+        if ( err != KErrNone )
+            {
+            HandleError( err );
+            }
+        HandleCommandL( EMPXCmdHandleExternalCommand );
+        }
+
+    // Clear selection
+    iContainer->Common()->ClearLbxSelection();
+    CleanupStack::PopAndDestroy( messageData );
+    }
+
+// -----------------------------------------------------------------------------
+// Handle rename command
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoHandleRenameL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoHandleRenameL" );
+    CMPXCommonListBoxArrayBase* listboxArray(
+        iContainer->Common()->ListBoxArray() );
+    TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() );
+    const CMPXMedia& currentMedia( listboxArray->MediaL( currentIndex ) );
+    TMPXGeneralCategory category(
+        currentMedia.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+    switch ( category )
+        {
+        case EMPXPlaylist:
+            {
+            // rename playlist
+            iCurrentMediaLOp = EMPXOpMediaLRenamePlaylist;
+            CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( path );
+            path->Set( iContainer->Common()->CurrentLbxItemIndex() );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append(
+                TMPXAttribute( KMPXMediaIdGeneral,
+                    EMPXMediaGeneralUri | EMPXMediaGeneralId |
+                    EMPXMediaGeneralTitle ) );
+            iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PopAndDestroy( path );
+            break;
+            }
+        case EMPXAlbum:
+        case EMPXArtist:
+        case EMPXGenre:
+        case EMPXComposer:
+            {
+            delete iNewName;
+            iNewName = NULL;
+            iNewName = HBufC::NewL( KMaxFileName );
+            TPtr ptr( iNewName->Des() );
+
+            // Set default text as current selected item text
+            const CMPXMediaArray& mediaAry = listboxArray->MediaArray();
+            CMPXMedia* origMedia( mediaAry.AtL( currentIndex ) );
+            const TDesC& title = origMedia->ValueText( KMPXMediaGeneralTitle );
+            ptr.Append( title.Left(KMaxFileName) );
+
+            CAknTextQueryDialog* query = CAknTextQueryDialog::NewL( ptr );
+            CleanupStack::PushL( query );
+            query->SetMaxLength( KMaxFileName );
+            HBufC* promptTxt = StringLoader::LoadLC( R_MPX_QTN_NMP_PRMPT_NEW_NAME );
+            query->SetPromptL( *promptTxt );
+            query->SetPredictiveTextInputPermitted( ETrue );
+            CleanupStack::PopAndDestroy( promptTxt );
+            query->PublishDialogL(
+                    EMPlayerQueryPrmptNewName,
+                    KMPlayerNoteCategory);
+            CleanupStack::Pop( query );
+            if ( query->ExecuteLD( R_MPX_CUI_RENAME_QUERY ) )
+                {
+                TMPXItemId id(
+                    currentMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+
+                CMPXMedia* media = CMPXMedia::NewL();
+                CleanupStack::PushL( media );
+                media->SetTObjectValueL<TMPXGeneralType>(
+                    KMPXMediaGeneralType, EMPXGroup );
+                media->SetTObjectValueL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory, EMPXSong );
+                media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+
+                switch ( category )
+                    {
+                    case EMPXAlbum:
+                        {
+                        iCurrentFindAllLOp = EMPXOpFindAllLRenameAlbum;
+                        // check if it's album or artist/album
+                        const CMPXMedia& containerMedia = listboxArray->ContainerMedia();
+                        TMPXGeneralCategory containerCategory(
+                            containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                             KMPXMediaGeneralCategory ) );
+                        if ( containerCategory == EMPXArtist )
+                            {
+                            // artist/album level, need to specify artist ID in container ID
+                            TMPXItemId containerId(
+                                containerMedia.ValueTObjectL<TMPXItemId>(
+                                    KMPXMediaGeneralId ) );
+                            media->SetTObjectValueL<TMPXItemId>(
+                                KMPXMediaGeneralContainerId, containerId );
+                            }
+                        break;
+                        }
+                    case EMPXArtist:
+                        {
+                        iCurrentFindAllLOp = EMPXOpFindAllLRenameArtist;
+                        break;
+                        }
+                    case EMPXGenre:
+                        {
+                        iCurrentFindAllLOp = EMPXOpFindAllLRenameGenre;
+                        break;
+                        }
+                    case EMPXComposer:
+                        {
+                        iCurrentFindAllLOp = EMPXOpFindAllLRenameComposer;
+                        break;
+                        }
+                    default:
+                        {
+                        ASSERT( 0 );
+                        break;
+                        }
+                    }
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL( attrs );
+                attrs.Append(
+                    TMPXAttribute( KMPXMediaIdGeneral,
+                        EMPXMediaGeneralId | EMPXMediaGeneralUri |
+                        EMPXMediaGeneralCollectionId |
+                        EMPXMediaGeneralType | EMPXMediaGeneralCategory | EMPXMediaGeneralFlags ) );
+                if ( category == EMPXAlbum || category == EMPXArtist )
+                    {
+                    attrs.Append( TMPXAttribute( KMPXMediaIdMusic, 
+                        EMPXMediaMusicAlbumArtFileName ) );
+                    }
+                iCollectionUtility->Collection().FindAllL( *media, attrs.Array(), *this );
+                CleanupStack::PopAndDestroy( &attrs );
+                CleanupStack::PopAndDestroy( media );
+                }
+            break;
+            }
+        default:
+            {
+            // shouldn't reach here
+            ASSERT( 0 );
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Prepares media object for selected items
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::PrepareMediaForSelectedItemsL( CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::PrepareMediaForSelectedItemsL" );
+    CMPXMediaArray* mediaArray( CMPXMediaArray::NewL() );
+    CleanupStack::PushL( mediaArray );
+    CMPXCommonListBoxArrayBase* listBoxArray =
+        iContainer->Common()->ListBoxArray();
+    TInt count( iSelectionIndexCache->Count() );
+
+    CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
+    CleanupStack::PushL( path );
+    TMPXItemId id( path->Id( 0 ) );
+    MPX_DEBUG2( "CMPXCollectionViewImp::PrepareMediaForSelectedItemsL collection ID = 0x%x", id.iId1 );
+    CleanupStack::PopAndDestroy( path );
+
+    if ( count > 0 )
+        {
+        if ( count == 1 )
+            {
+            // marked one item, if it's not valid, ignore the command
+            const CMPXMedia& listBoxMedia = listBoxArray->MediaL( iSelectionIndexCache->At(0) );
+            if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
+                {
+                // leave with special error code, this error
+                // should not trigger any error message, the operation should
+                // be terminated silently
+                User::Leave( KMPXErrDataNotReady );
+                }
+            }
+        for ( TInt i = 0; i < count; i++ )
+            {
+            const CMPXMedia& listBoxMedia = listBoxArray->MediaL( iSelectionIndexCache->At(i) );
+            if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
+                {
+                // item not ready, cache this command and execute
+                // it when the data becomes valid
+                User::Leave( KMPXErrDataNotReadyCacheCommand );
+                }
+            CMPXMedia* entry( PopulateMediaLC( listBoxMedia, id ) );
+            mediaArray->AppendL( entry );
+            CleanupStack::Pop( entry );
+            }
+        }
+    else
+        {
+        const CMPXMedia& listBoxMedia = listBoxArray->MediaL(
+            iContainer->Common()->CurrentLbxItemIndex() );
+        if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
+            {
+            // leave with special error code, this error
+            // should not trigger any error message, the operation should
+            // be terminated silently
+            User::Leave( KMPXErrDataNotReady );
+            }
+        else
+            {
+            CMPXMedia* entry( PopulateMediaLC( listBoxMedia, id ) );
+            mediaArray->AppendL( entry );
+            CleanupStack::Pop( entry );
+            }
+        }
+    aMedia.SetTObjectValueL( KMPXMediaGeneralCollectionId, id );
+    aMedia.SetCObjectValueL( KMPXMediaArrayContents, mediaArray );
+    aMedia.SetTObjectValueL( KMPXMediaArrayCount, mediaArray->Count() );
+    iNumSongAddedToPlaylist = mediaArray->Count();
+    CleanupStack::PopAndDestroy( mediaArray );
+    }
+
+// -----------------------------------------------------------------------------
+// Populates media object with information needed for save to
+// existing playlist
+// -----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXCollectionViewImp::PopulateMediaLC(
+    const CMPXMedia& aMedia, TMPXItemId aCollectionId )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::PopulateMediaLC" );
+    CMPXMedia* entry = CMPXMedia::NewL();
+    CleanupStack::PushL( entry );
+    entry->SetTextValueL(
+        KMPXMediaGeneralTitle,
+        aMedia.ValueText( KMPXMediaGeneralTitle ) );
+    entry->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem);
+    entry->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong );
+    entry->SetTObjectValueL( KMPXMediaGeneralId,
+        aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+    entry->SetTObjectValueL( KMPXMediaGeneralCollectionId, aCollectionId );
+    return entry;
+    }
+
+// -----------------------------------------------------------------------------
+// Handle rename playlist command
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoHandleRenamePlaylistL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoHandleRenamePlaylistL" );
+    const TDesC& uri = aMedia.ValueText( KMPXMediaGeneralUri );
+    TParsePtrC fn( uri );
+#ifdef _DEBUG
+    TPtrC ptr( fn.NameAndExt() );
+    MPX_DEBUG2( "CMPXCollectionViewImp::DoHandleRenamePlaylistL Original Uri = %S", &ptr );
+#endif
+    HBufC* playlistName = HBufC::NewLC( KMaxFileName );
+    TPtr playlistNamePtr = playlistName->Des();
+    const TDesC& title = aMedia.ValueText( KMPXMediaGeneralTitle );
+    TInt ret = iCommonUiHelper->LaunchRenameDialogL(
+        title, playlistNamePtr, fn.DriveAndPath() );
+    if ( ret )
+        {
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL( media );
+        media->SetTObjectValueL<TMPXGeneralType>(
+            KMPXMediaGeneralType, EMPXItem );
+        media->SetTObjectValueL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory, EMPXPlaylist );
+        TMPXItemId id( aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+        media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+        TParsePtrC newFn( *playlistName );
+        media->SetTextValueL( KMPXMediaGeneralTitle, newFn.NameAndExt() );
+        iCollectionUiHelper->RenameL( *media, this );
+        CleanupStack::PopAndDestroy( media );
+        }
+    CleanupStack::PopAndDestroy( playlistName );
+    }
+
+// ---------------------------------------------------------------------------
+// Set/clears the flags for item in database
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::UpdateDatabaseFlagL(
+    TInt aIndex, const CMPXMedia& aMedia, TUint aFlag,
+    TBool aSet, TBool aEnableInfoDialog )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::UpdateDatabaseFlagL" );
+    MPX_DEBUG3( "CMPXCollectionViewImp::UpdateDatabaseFlagL aFlag = 0x%x, aSet = %d", aFlag, aSet );
+    CMPXCommonListBoxArrayBase* array( iContainer->Common()->ListBoxArray() );
+    ASSERT( array );
+
+    // set the item as invalid
+    TUint flags( 0 );
+    if ( aSet )
+        {
+        flags = KMPXMediaGeneralFlagsSetOrUnsetBit;
+        }
+    flags |= aFlag;
+
+    MPX_DEBUG2( "CMPXCollectionViewImp::UpdateDatabaseFlagL flag after 0x%x", flags );
+    CMPXMedia* entry = CMPXMedia::NewL();
+    CleanupStack::PushL( entry );
+    if ( aIndex > KErrNotFound )
+        {
+        MPX_DEBUG2( "CMPXCollectionViewImp::UpdateDatabaseFlagL using aIndex = %d", aIndex );
+        const CMPXMedia& media = array->MediaL( aIndex );
+        TMPXItemId id( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+        TMPXGeneralType type(
+            media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+        TMPXGeneralCategory category(
+            media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+        entry->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+        entry->SetTObjectValueL<TMPXGeneralType>(
+            KMPXMediaGeneralType, type );
+        entry->SetTObjectValueL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory, category );
+        }
+    else
+        {
+        // try to look for the info inside aMedia
+        if ( aMedia.IsSupported( KMPXMediaGeneralId ) )
+            {
+            TMPXItemId id( aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+            entry->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+            }
+        if ( aMedia.IsSupported( KMPXMediaGeneralType ) )
+            {
+            TMPXGeneralType type(
+                aMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+            entry->SetTObjectValueL<TMPXGeneralType>(
+                KMPXMediaGeneralType, type );
+            }
+        if ( aMedia.IsSupported( KMPXMediaGeneralCategory ) )
+            {
+            TMPXGeneralCategory category(
+                aMedia.ValueTObjectL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory ) );
+            entry->SetTObjectValueL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory, category );
+            }
+        }
+    TUid collectionId( aMedia.ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId ) );
+    entry->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, collectionId );
+    entry->SetTObjectValueL<TUint>( KMPXMediaGeneralFlags, flags );
+
+    // Update the collection via CommandL
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet );
+    cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue );
+    TUid colId( entry->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId) );
+    cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid );
+    cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColSetMedia, entry );
+    iCollectionUtility->Collection().CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+
+    CleanupStack::PopAndDestroy( entry );
+    if ( aEnableInfoDialog && KMPXMediaGeneralFlagsIsInvalid == aFlag )
+        {
+        iCommonUiHelper->DisplayInfoNoteL( R_MPX_COLLECTION_INFO_FILE_NOT_FOUND );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get duration of current view
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::GetDurationL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::GetDurationL" );
+    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL( cpath );
+    cpath->Back();  // Container
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL(attrs);
+    iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo;
+    attrs.Append( KMPXMediaGeneralDuration );
+    iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+    CleanupStack::PopAndDestroy( &attrs );
+    CleanupStack::PopAndDestroy( cpath );
+    }
+
+// ---------------------------------------------------------------------------
+// Handles file check result
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoHandleFileCheckResultL(
+    TUid aViewToActivate, const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleFileCheckResultL" );
+    const TDesC& location = aMedia.ValueText( KMPXMediaGeneralUri );
+    if ( location.Length() == 0 || ConeUtils::FileExists( location ) )
+        {
+        HandleListBoxEventL( NULL, EEventItemClicked );
+        HBufC* buf = HBufC::NewLC( 5 ); // magic number, array granularity
+        buf->Des().AppendNum( iContainer->Common()->CurrentLbxItemIndex() );
+        // Activate view via View Framework
+        iViewUtility->ActivateViewL( aViewToActivate, buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    else
+        {
+        // mark database entry for this item as invalid
+        UpdateDatabaseFlagL( iContainer->Common()->CurrentLbxItemIndex(),
+            aMedia, KMPXMediaGeneralFlagsIsInvalid, ETrue );
+        }
+    }
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// Updates the middle softkey display
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::UpdateMiddleSoftKeyDisplayL( TInt aMskId )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::UpdateMiddleSoftKeyDisplayL" );
+    CEikButtonGroupContainer* cba = Cba();
+    if ( cba )
+        {
+        if ( !iContainer->Common()->CurrentListItemCount() ) // list is empty
+            {
+            // remove middle softkey label
+            iCommonUiHelper->RemoveMiddleSoftKeyLabel( *cba );
+            MPX_DEBUG1( "CMPXCollectionViewImp::UpdateMiddleSoftKeyDisplayL - remove label, list is empty" );
+            }
+        else if ( iContainer->Common()->CurrentSelectionIndicesL()->Count() ) // marked items
+            {
+            CFbsBitmap* bitmap = NULL;
+            CFbsBitmap* mask = NULL;
+            AknsUtils::CreateColorIconL(
+                AknsUtils::SkinInstance(),
+                KAknsIIDQgnPropMskMenu,
+                KAknsIIDQsnComponentColors,
+                EAknsCIQsnComponentColorsCG13,
+                bitmap,
+                mask,
+                AknIconUtils::AvkonIconFileName(),
+                EMbmAvkonQgn_prop_msk_menu,
+                EMbmAvkonQgn_prop_msk_menu_mask,
+                KRgbBlack);
+
+            CleanupStack::PushL(bitmap);
+            CleanupStack::PushL(mask);
+
+            // set middle softkey icon
+            iCommonUiHelper->SetMiddleSoftKeyIconL(*cba, bitmap, mask);
+
+            CleanupStack::PopAndDestroy(2, bitmap);
+            MPX_DEBUG1("CMPXCollectionViewImp::UpdateMiddleSoftKeyDisplayL - items marked, show icon");
+            }
+        else
+            {
+            // set middle softkey label
+            iCommonUiHelper->SetMiddleSoftKeyLabelL(
+                *cba,
+                aMskId,
+                EAknSoftkeyForwardKeyEvent );
+            iCurrentMskId = aMskId;
+            MPX_DEBUG1( "CMPXCollectionViewImp::UpdateMiddleSoftKeyDisplayL - label displayed" );
+            }
+        cba->DrawDeferred();
+        }
+    }
+#endif // __ENABLE_MSK
+
+
+// ---------------------------------------------------------------------------
+// Handles the completion of adding a playlist event
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleAddCompletedL(
+    CMPXMedia* aPlaylist, TInt aError )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleAddCompletedL" );
+    iAddingToNewPlaylist = EFalse;
+    iCommonUiHelper->DismissWaitNoteL();
+    HandleCommandL( EMPXCmdHandleExternalCommand );
+    if ( aError == KErrNone )
+        {
+        // Show confirmation note
+        if( aPlaylist->IsSupported( KMPXMediaGeneralId ) )
+            {
+            iPlaylistId = aPlaylist->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+            }
+        MPX_DEBUG2( "CMPXCollectionViewImp::HandleAddCompletedL iPlaylistId = 0x%x", iPlaylistId.iId1 );
+        if ( iCurrentPlaylistOp != EMPXOpPLCreating )
+            {
+            HBufC* confirmTxt( NULL );
+            const TDesC& title( aPlaylist->ValueText( KMPXMediaGeneralTitle ) );
+            TMPlayerSecondaryDisplayNote noteId( EMPlayerNoteNone );
+            if ( iNumSongAddedToPlaylist > 1 )
+                {
+                confirmTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_MULTIPLE_TRACKS_ADDED_TO_PL,
+                    title, iNumSongAddedToPlaylist );
+                noteId = EMPlayerNoteAddManySongToPlaylist;
+                }
+            else
+                {
+                confirmTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_NOTE_TRACK_ADDED_TO_PL, title );
+                noteId = EMPlayerNoteAddSongToPlaylist;
+                }
+
+            CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote();
+
+            note->PublishDialogL(
+                noteId,
+                KMPlayerNoteCategory );
+
+            if ( iCoverDisplay )
+                {
+                CAknMediatorFacade* covercl = AknMediatorFacade( note );
+                if ( covercl )
+                    {
+                    covercl->BufStream() << title;
+                    if ( iNumSongAddedToPlaylist > 1 )
+                        {
+                        covercl->BufStream().WriteInt32L( iNumSongAddedToPlaylist );
+                        }
+                    }
+                }
+
+            note->ExecuteLD( *confirmTxt );
+            CleanupStack::PopAndDestroy( confirmTxt );
+
+            }
+        else // iCurrentPlaylistOp == EMPXOpPLCreating
+            {
+            // Re-open the collection, because we cannot
+            // depend on the change events that could be a race condition
+            // against this HandleAddCompleteL() callback!
+            //
+            DoIncrementalOpenL();
+            }
+        }
+    else
+        {
+        HandleError( aError );
+        }
+
+    delete aPlaylist;
+    if ( iContainer )
+        {
+        iContainer->Common()->ClearLbxSelection();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handles the completion of setting a media event.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleSetCompletedL( CMPXMedia* aMedia, TInt aError )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleSetCompletedL" );
+    delete aMedia;
+    if ( aError == KErrNone )
+        {
+        // save successful, set flag so that it can't be saved again
+        MPXTlsHelper::SetNeedSave( EFalse );
+        }
+    else
+        {
+        if (iContainer->IsInReorderMode())
+            {
+            DeactivateReorderGrabbedModeL(ETrue);
+            }
+        HandleError( aError );
+        }
+    if ( iIsSavingReorderPlaylist )
+        {
+        // change messages are ignored during save command,
+        // when save is complete, it should open the collection again to refresh
+        // display data
+        DoIncrementalOpenL();
+        iIsSavingReorderPlaylist = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle playback message
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoHandlePlaybackMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        switch ( event )
+            {
+            case TMPXPlaybackMessage::EActivePlayerChanged:
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                MPX_DEBUG2( "CMPXCollectionViewImp::HandlePlaybackMessageL - EStateChanged(%d)", type );
+                UpdatePlaybackStatusL();
+                break;
+                }
+            case TMPXPlaybackMessage::EError:
+                {
+                if ( iCommonUiHelper )
+                    {
+                    iCommonUiHelper->DismissWaitNoteL();
+                    HandleCommandL( EMPXCmdHandleExternalCommand );
+                    }
+                if ( iIsDeleting )
+                    {
+                    iCollectionUiHelper->Cancel();
+                    iIsDeleting = EFalse;
+                    // if delete is interrupted, reopen
+                    DoIncrementalOpenL();
+                    }
+                MPX_DEBUG2( "CMPXCollectionViewImp::HandlePlaybackMessageL Error = %d", data );
+                break;
+                }
+            case TMPXPlaybackMessage::EPlayerUnavailable:
+                {
+                if ( iUpnpFrameworkSupport )
+                    {
+                    if ( data == KErrNotFound )
+                        {
+                        if ( iViewUtility->ActiveViewType() ==
+                            TUid::Uid( KMPXPluginTypeCollectionUid ) )
+                            {
+                            if ( iSubPlayerName )
+                                {
+                                HBufC* dialogText = StringLoader::LoadLC( R_MPX_COLLECTION_NOTE_REMOTE_CONNECTION_FAILED,
+                                                                          *iSubPlayerName );
+                                CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+                                errNote->SetTimeout(CAknNoteDialog::ELongTimeout);
+                                errNote->ExecuteLD( *dialogText );
+                                CleanupStack::PopAndDestroy( dialogText );
+                                }
+                            }
+                        }
+                    }
+                // else we don't show any error note
+                break;
+                }
+            default:
+                {
+                // ignore other messages
+                break;
+                }
+            }
+        }
+    else
+        {
+        iHandlingKeyEvent = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle collection message
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoHandleCollectionMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoHandleCollectionMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        MPX_DEBUG4( "CMPXCollectionViewImp::DoHandleCollectionMessageL Event = %d, Type() = %d, data = %d",
+            event, type, data );
+
+        // Only handle collection messages while collection view is in focus
+        // and not transitioning views
+        if( iContainer )
+            {
+
+            if ( event == TMPXCollectionMessage::EPathChanged &&
+                 type == EMcPathChangedByOpen &&
+                 data == EMcContainerOpened
+                 )
+                { // Open new entries
+                MPX_DEBUG1( "CMPXCollectionViewImp::DoHandleCollectionMessageL calling OpenL EMcPathChangedByOpen" );
+                if ( iContainer->IsInReorderMode() )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewImp::DoHandleCollectionMessageL canceling reorder mode" );
+                    // cancel reorder mode if path has changed
+                    ProcessCommandL( EMPXCmdReorderDone );
+                    }
+                if( iContainer->Common()->CurrentSelectionIndicesL()->Count() )
+                    {
+                    HandleCommandL( EAknUnmarkAll );
+                    }
+
+                // Incremental Open when browsing to the next level
+                DoIncrementalOpenL();
+                }
+            else if ( event == TMPXCollectionMessage::EPathChanged &&
+                      type == EMcPathChangedByCollectionChange )
+                {
+                // Re-Fetch entries only if we are in playlist
+                // creation idle stage. Ignore change messages during playlist op
+                // because there are race conditions and we don't know
+                // which handle open is actually opening the playlist!
+                //
+                // don't call openL if it's currently deleting
+                // don't call openL if saving after reorder
+                // don't call openL if renaming
+                if( iCurrentPlaylistOp == EMPXOpPLIdle  && !iIsDeleting
+                    && !iIsSavingReorderPlaylist && iSetMediaLCount == KErrNotFound )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewImp::DoHandleCollectionMessageL calling OpenL EMcPathChangedByCollectionChange" );
+                    if( iContainer->Common()->CurrentSelectionIndicesL()->Count() )
+                        {
+                        HandleCommandL( EAknUnmarkAll );
+                        }
+                    // dismiss find pane if it's visible
+                    if( iContainer->Common()->FindBoxVisibility() )
+                        {
+                        iContainer->Common()->EnableFindBox( EFalse );
+                        }
+                    DoIncrementalOpenL();
+                    }
+                else
+                    {
+                    MPX_DEBUG4( "CMPXCollectionViewImp::DoHandleCollectionMessageL PathChange Message Ignored iIsDeleting = %d, iCurrentPlaylistOp = %d, iIsSavingReorderPlaylist = %d", iIsDeleting, iCurrentPlaylistOp, iIsSavingReorderPlaylist );
+                    MPX_DEBUG2( "CMPXCollectionViewImp::DoHandleCollectionMessageL PathChange Message Ignored iSetMediaLCount = %d", iSetMediaLCount );
+                    }
+                }
+            else if ( event == TMPXCollectionMessage::EPathChanged &&
+                 type == EMcPathChangedByOpen &&
+                 data == EMcItemOpened)
+                {
+                // opened a song, revert back one level when collection view
+                // is activated again
+                iIncrementalOpenUtil->Stop();
+                iBackOneLevel = ETrue;
+                }
+            else if( event == TMPXCollectionMessage::EBroadcastEvent )
+                {
+                MPX_DEBUG2( "CMPXCollectionViewImp::DoHandleCollectionMessageL - broadcast type = %d", type );
+                if ( type == EMcMsgDiskRemoved &&
+                     iViewUtility->ActiveViewType() != TUid::Uid(KMPXPluginTypeWaitNoteDialogUid) )
+                    {
+                    AknDialogShutter::ShutDialogsL( *CEikonEnv::Static() );
+                    }
+                if ( iConfirmationDlg && ( type == EMcMsgUSBMTPStart || type == EMcMsgUSBMassStorageStart ) )
+                    {
+                    TKeyEvent kEvent;
+                    kEvent.iCode = EKeyEscape;
+                    kEvent.iScanCode = EStdKeyEscape;
+                    iConfirmationDlg->OfferKeyEventL( kEvent, EEventKey );
+                    }
+
+                }
+        else if ( event == TMPXCollectionMessage::EFocusChanged && iContainer && iCoverDisplay )
+            {
+            if ( data != KErrNotFound &&
+                 data < iContainer->Common()->CurrentListItemCount() &&
+                 !iIgnoreNextFocusChangedMessage )
+                {
+                MPX_DEBUG2( "CMPXCollectionViewImp::DoHandleCollectionMessageL - EFocusChanged to %d", data );
+                iContainer->Common()->SetLbxCurrentItemIndexAndDraw( data );
+                }
+            iIgnoreNextFocusChangedMessage = EFalse;
+            }
+            } // if iContainer
+
+        // System events need to be checked regardless of iContainer
+        //
+        if( event == TMPXCollectionMessage::EBroadcastEvent )
+            {
+            if((type == EMcMsgUSBMassStorageStart ) || (type == EMcMsgUSBMTPEnd) || (type == EMcMsgRefreshEnd))
+                {
+                iCollectionCacheReady = EFalse;
+                }
+            // USB flags
+            //
+            if( type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart )
+                {
+                iUSBOnGoing = ETrue;
+                }
+            else if( type == EMcMsgUSBMassStorageEnd || type == EMcMsgUSBMTPEnd )
+                {
+                iUSBOnGoing = EFalse;
+                RProperty::Set( KMPXViewPSUid,
+                                KMPXUSBUnblockingPSStatus, 
+                                EMPXUSBUnblockingPSStatusUninitialized );
+                }
+            else if( type == EMcMsgUSBMTPNotActive )
+                {
+                RProperty::Set( KMPXViewPSUid,
+                                KMPXUSBUnblockingPSStatus, 
+                                EMPXUSBUnblockingPSStatusActive );
+				}
+            
+            if ( iIsEmbedded && type == EMcMsgUSBMassStorageEnd )
+            	{
+            	DoIncrementalOpenL();
+            	}
+            } // if event == EBroadcastEvent
+        } // if ( KMPXMessageGeneral == id )
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXCollectionViewImp::DoIncrementalOpenL
+// Start the incremental fetching algorithm
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoIncrementalOpenL( TBool aShowWaitDlg )
+    {
+     MPX_FUNC( "CMPXCollectionViewImp::DoIncrementalOpenL" );
+    // Show the opening note if > 1.5 seconds
+    if( aShowWaitDlg )
+        {
+        //StartWaitNoteL( EMPXOpeningNote );
+        }
+
+    // Cancel any reads
+    iIncrementalOpenUtil->Stop();
+
+    // Start the read
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    TArray<TMPXAttribute> ary = attrs.Array();
+    iIncrementalOpenUtil->SetDelay( KIncrementalDelayNone );
+    iIncrementalOpenUtil->StartL( ary, KIncrementalFetchBlockSize,
+                                  KErrNotFound, CMPXCollectionOpenUtility::EFetchNormal );
+    iIncrementalOpenUtil->SetDelay( KIncrementalDelayHalfSecond );
+    CleanupStack::PopAndDestroy( &attrs );
+
+    // Default empty text
+    iContainer->Common()->SetLbxEmptyTextL( KNullDesC );
+    iContainer->Common()->CoeControl()->DrawDeferred();
+    iFirstIncrementalBatch = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// Start wait note for delayed action due to the items not ready
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::StartDelayedActionL( 
+    TInt aCommand, TDesC& aNote,TBool aSkipDisplay  )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::StartDelayedActionL" );
+    HandleCommandL( EMPXCmdIgnoreExternalCommand );
+    if(!aSkipDisplay)
+        {
+    iCommonUiHelper->ShowWaitNoteL( aNote, R_AVKON_SOFTKEYS_EMPTY, ETrue, this );
+        }
+        
+    iCachedCommand = aCommand;
+    const CArrayFix<TInt>* array (
+        iContainer->Common()->CurrentSelectionIndicesL() ); // not owned
+    TInt arrayCount( array->Count() );
+    iCachedSelectionIndex->Reset();
+    for ( TInt i = 0; i < arrayCount; i++ )
+        {
+        iCachedSelectionIndex->AppendL( array->At( i ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MProgressDialogCallback
+// Callback method. Get's called when a dialog is dismissed
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DialogDismissedL( TInt aButtonId )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DialogDismissedL" );
+    if ( iCommandInitiator )
+        {
+        iCommandInitiator->CancelCommand( KMediatorSecondaryDisplayDomain,
+                                      KMPlayerNoteCategory,
+                                      iWaitNoteId );
+        }
+
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyCancel:
+            {
+            iIsWaitNoteCanceled = ETrue;
+            if( iIsDeleting )
+                {
+                iCollectionUiHelper->Cancel();
+                iIsDeleting = EFalse;
+                // if delete is interrupted, reopen
+                }
+            else if ( iSetMediaLCount > 0 )
+                {
+                // cancel the async request
+                iCollectionUtility->Collection().CancelRequest();
+                iSetMediaLCount = KErrNotFound;
+
+                DoIncrementalOpenL();
+                }
+            else if ( iIsAddingToPlaylist )
+                {
+                // cancel incremental adding of songs
+                iCommonUiHelper->CancelCollectionOperation();
+                iIsAddingToPlaylist = EFalse;
+                }
+            break;
+            }
+        default:
+            {
+            // no special handling for other cases
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection message
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleCollectionMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d a folder
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleOpenL(
+    const CMPXMedia& aEntries,
+    TInt aIndex,
+    TBool aComplete,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleOpenL 4" );
+    iHandlingKeyEvent = EFalse;
+    if( aError == KErrNone )
+        {
+        if ( !iContainer )
+            {
+            // View is not active. Ignore.
+            return;
+            }
+#ifdef BACKSTEPPING_INCLUDED			
+        // handle deferred notification when view is in focus but not for view transitions
+        if ( iActivateBackStepping )
+            {
+	        HandleBacksteppingActivation();
+		    }
+#endif // BACKSTEPPING_INCLUDED 
+        iCollectionReady = aComplete;
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        if( iPodcast && !iDisablePodcasting )
+            {
+            iPodcast = EFalse;
+            UpdateListBoxL( aEntries, KMusicMenuPodcastMenuItemIndex, aComplete );
+            ( void ) aIndex;
+            }
+        else
+            {
+            UpdateListBoxL( aEntries, aIndex, aComplete );
+            }
+#else
+        UpdateListBoxL( aEntries, aIndex, aComplete );
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+        if ( iContainer )
+            {
+            iContainer->ContentIsReady( ETrue );
+            // this has to be done after the list box media is properly
+            // updated
+            if ( !iContainer->Common()->FindBoxVisibility() )
+                {
+                MPX_DEBUG1( "CMPXCollectionViewImp::HandleOpenL find box not visible" );
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+                CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+                CleanupStack::PushL( cpath );
+
+                // media is not valid until the first HandleOpenL call
+                CEikButtonGroupContainer* cba = Cba();
+                if ( cba )
+                    {
+                    cba->SetCommandSetL(
+                        ( cpath->Levels() == 2 && !iIsEmbedded ) ?
+                        R_MPX_OPTIONS_HIDE_CBA : R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                    cba->DrawDeferred();
+                    }
+
+                CleanupStack::PopAndDestroy(cpath);
+#else
+                CEikButtonGroupContainer* cba = Cba();
+                if ( cba )
+                    {
+                    cba->SetCommandSetL(
+                        ( iViewUtility->ViewHistoryDepth() == 1 && !iIsEmbedded ) ?
+                        R_AVKON_SOFTKEYS_OPTIONS_EXIT : R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                    cba->DrawDeferred();
+                    }
+#endif
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXCollectionViewImp::HandleOpenL find box visible" );
+                }
+
+            CMPXCommonListBoxArrayBase* array(
+                iContainer->Common()->ListBoxArray() );
+            const CMPXMedia& containerMedia = array->ContainerMedia();
+            if ( containerMedia.IsSupported( KMPXMediaGeneralTitle ) )
+                {            
+                delete iTitle;
+                iTitle = NULL;
+                iTitle = containerMedia.ValueText( KMPXMediaGeneralTitle ).AllocL();
+                }
+            if ( !iContainer->IsInReorderMode() &&
+                !iAddingSong &&
+                !iInAlbumArtDialog &&
+                !iInSongDetails )
+                {
+                UpdateTitlePaneL();
+                }
+
+            TMPXGeneralType containerType( EMPXNoType );
+            if( containerMedia.IsSupported( KMPXMediaGeneralType ) )
+                {
+                containerType = containerMedia.ValueTObjectL<TMPXGeneralType>(
+                                KMPXMediaGeneralType );
+                }
+
+            TMPXGeneralCategory containerCategory( EMPXNoCategory );
+            if( containerMedia.IsSupported( KMPXMediaGeneralCategory ) )
+                {
+                containerCategory = containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                                    KMPXMediaGeneralCategory );
+                }
+            MPX_DEBUG3( "CMPXCollectionViewImp::HandleOpenL container type = %d, category = %d", containerType, containerCategory );
+
+            CEikMenuBar* menuBar( MenuBar() );
+            TInt resId( KErrNotFound );
+#ifdef __ENABLE_MSK
+            TInt mskId( R_QTN_MSK_OPEN );
+#endif // __ENABLE_MSK
+            if ( iIsEmbedded )
+                {
+                // embedded playlist view
+                iContainer->Common()->EnableMarking( ETrue );
+                menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_EMBEDDED_PLAYLIST_VIEW );
+                resId = R_MPX_COLLECTION_SONG_LBX_EMPTYTEXT;
+#ifdef __ENABLE_MSK
+                mskId = R_QTN_MSK_PLAY;
+#endif // __ENABLE_MSK
+                }
+            else
+                {
+                if ( containerType == EMPXGroup && containerCategory == EMPXCollection )
+                    {
+                    // music menu view
+                    iContainer->Common()->EnableMarking( EFalse );
+                    menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_MUSIC_MENU );
+                    }
+                else if ( ( containerType == EMPXGroup && containerCategory == EMPXPlaylist ) || // playlist view
+                    ( containerType == EMPXGroup && containerCategory == EMPXArtist ) || // artist view
+                    ( containerType == EMPXItem && containerCategory == EMPXArtist ) || // artist/album view
+                    ( containerType == EMPXGroup && containerCategory == EMPXAlbum ) || // album view
+                    ( containerType == EMPXGroup && containerCategory == EMPXGenre ) || // genre view
+                    ( containerType == EMPXGroup && containerCategory == EMPXComposer ) ) // composer view
+                    {
+                    iContainer->Common()->EnableMarking( EFalse );
+                    menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_NO_MARKING );
+                    switch ( containerCategory )
+                        {
+                        case EMPXArtist:
+                            {
+                            if ( containerType == EMPXGroup )
+                                {
+                                // artist view
+                                resId = R_MPX_COLLECTION_ARTIST_LBX_EMPTYTEXT;
+                                }
+                            else if ( containerType == EMPXItem )
+                                {
+                                // artist/album view
+                                resId = R_MPX_COLLECTION_ALBUM_LBX_EMPTYTEXT;
+                                }
+                            else
+                                {
+                                // should not reach here
+                                ASSERT( 0 );
+                                }
+                            break;
+                            }
+                        case EMPXAlbum:
+                            {
+                            // album view
+                            resId = R_MPX_COLLECTION_ALBUM_LBX_EMPTYTEXT;
+                            break;
+                            }
+                        case EMPXGenre:
+                            {
+                            // genre view
+                            resId = R_MPX_COLLECTION_GENRE_LBX_EMPTYTEXT;
+                            break;
+                            }
+                        case EMPXComposer:
+                            {
+                            // composer view
+                            resId = R_MPX_COLLECTION_COMPOSER_LBX_EMPTYTEXT;
+                            break;
+                            }
+                        case EMPXPlaylist:
+                            {
+                            // no special handling for playlist
+                            break;
+                            }
+                        default:
+                            {
+                            // should not reach here
+                            ASSERT( 0 );
+                            break;
+                            }
+                        }
+                    }
+                else
+                    {
+                    // tracks view
+                    iContainer->Common()->EnableMarking( ETrue );
+                    menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR );
+                    resId = R_MPX_COLLECTION_SONG_LBX_EMPTYTEXT;
+#ifdef __ENABLE_MSK
+                    mskId = R_QTN_MSK_PLAY;
+#endif // __ENABLE_MSK
+                    }
+                }
+
+            if ( resId != KErrNotFound )
+                {
+                HBufC* emptyText = StringLoader::LoadLC( resId );
+                iContainer->Common()->SetLbxEmptyTextL( *emptyText );
+                CleanupStack::PopAndDestroy( emptyText );
+                iContainer->Common()->CoeControl()->DrawDeferred();
+                }
+
+#ifdef __ENABLE_MSK
+            // set middle softkey label display
+            UpdateMiddleSoftKeyDisplayL( mskId );
+#endif // __ENABLE_MSK
+
+            switch ( iCurrentPlaylistOp )
+                {
+                case EMPXOpPLCreating:
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewImp::HandleOpenL searching for playlist" );
+                    // after creating a new playlist
+                    // playlist created callback will always come before this
+                    // iPlaylistId should have already been set, check to see if
+                    // we're in playlist view
+                    if ( iPlaylistId != 0 &&
+                        containerType == EMPXGroup && containerCategory == EMPXPlaylist )
+                        {
+                        const CMPXMediaArray& mediaArray = array->MediaArray();
+                        TInt arrayCount( mediaArray.Count() );
+                        for ( TInt i = 0; i < arrayCount; i++ )
+                            {
+                            CMPXMedia* origMedia( mediaArray.AtL( i ) );
+                            TMPXItemId plId = origMedia->ValueTObjectL<TMPXItemId>(
+                                KMPXMediaGeneralId );
+                            if ( plId == iPlaylistId )
+                                {
+                                MPX_DEBUG2( "CMPXCollectionViewImp::HandleOpenL Playlist match found 0x%x", iPlaylistId.iId1 );
+                                iCurrentPlaylistOp = EMPXOpPlOpening;
+                                iContainer->Common()->SetLbxCurrentItemIndex( i );
+                                HandleListBoxEventL( NULL, // not used
+                                    EEventEnterKeyPressed );
+                                break;
+                                }
+
+                            // Stay in Creating state as every OpenL()
+                            // will be called back with a HandleOpenL()
+                            // During playlist creation, there is a race condition
+                            // between HandleCollectionMessage() -> Collection change -> OpenL()
+                            // and playlist added's  OpenL()
+                            }
+                        }
+                    break;
+                    }
+                case EMPXOpPlOpening:
+                    {
+                    // check how many songs are stored in collection
+                    iCurrentMediaLOp = EMPXOpMediaLNewPlaylistCollectionSongCount;
+                    CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+                    CleanupStack::PushL( path );
+                    path->Back();
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL( attrs );
+                    attrs.Append( KMPXMediaColDetailNumberOfItems );
+                    iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+                    CleanupStack::PopAndDestroy( &attrs );
+                    CleanupStack::PopAndDestroy( path );
+                    iCurrentPlaylistOp = EMPXOpPLIdle;
+                    break;
+                    }
+                case EMPXOpPLIdle: // fall through
+                default:
+                    {
+                    // Update Duration
+                    //
+                    if ( !iContainer->IsInReorderMode() && !iAddingSong )
+                        {
+                        GetDurationL();
+                        }
+                    break;
+                    }
+                }
+            iPlaylistId = 0;
+            }
+        }
+    else
+        {
+        if ( iContainer )
+            {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+            CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+            CleanupStack::PushL( cpath );
+
+            // media is not valid until the first HandleOpenL call
+            CEikButtonGroupContainer* cba = Cba();
+            if ( cba )
+                {
+                cba->SetCommandSetL(
+                    ( cpath->Levels() == 2 && !iIsEmbedded ) ?
+                    R_AVKON_SOFTKEYS_OPTIONS_BACK : R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                cba->DrawDeferred();
+                }
+
+            CleanupStack::PopAndDestroy(cpath);
+#else
+            CEikButtonGroupContainer* cba = Cba();
+            if ( cba )
+                {
+                cba->SetCommandSetL(
+                    ( iViewUtility->ViewHistoryDepth() == 1 && !iIsEmbedded ) ?
+                    R_AVKON_SOFTKEYS_OPTIONS_EXIT : R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                cba->DrawDeferred();
+                }
+
+#endif
+            }
+        if (aError == KErrNotFound)
+            {
+            HandleCommandL(EAknSoftkeyBack);
+            }
+        else
+            {
+            HandleError( aError );
+            }
+        }
+    if ( iIsDeleting )
+        {
+        // nothing else to delete
+        iIsDeleting = EFalse;
+        if ( iProgressDialog )
+            {
+            iProgressDialog->ProcessFinishedL();
+            }
+        HandleCommandL( EMPXCmdHandleExternalCommand );
+        }
+    if ( iPlayIndex > KErrNotFound )
+        {
+        CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+        CleanupStack::PushL( cpath );
+        cpath->Set( iPlayIndex );
+        iPlayIndex = KErrNotFound;
+        iCollectionUtility->Collection().OpenL( *cpath, EMPXOpenPlaylistOnly );
+        iFirstIncrementalBatch = ETrue;
+        CleanupStack::PopAndDestroy( cpath );
+        }
+    if ( ( iCachedCommand != KErrNotFound ) && iCollectionReady )
+        {
+        if((iCachedCommand != EMPXCmdRemove) && (iCachedCommand != EMPXCmdCommonDelete) && (iCachedCommand != EMPXCmdDelete) )
+            {
+        iCommonUiHelper->DismissWaitNoteL();
+        HandleCommandL( EMPXCmdHandleExternalCommand );
+            }
+        else
+            {
+            iCachedCommand = EMPXCmdRemove;
+            }
+        if( iContainer )
+            {
+            iContainer->Common()->SetCurrentSelectionIndicesL( iCachedSelectionIndex );
+            }
+        HandleCommandL( iCachedCommand );
+        iCachedSelectionIndex->Reset();
+        iCachedCommand = KErrNotFound;
+        }
+
+    // Close the opening wait note, if the current item is valid or all open completes
+    if ( iContainer && !aComplete )
+        {
+        // if the list is empty, it shouldn't go in this path as aComplete should be ETrue
+        CMPXCommonListBoxArrayBase* listboxArray(
+            iContainer->Common()->ListBoxArray() );
+        const CMPXMedia& currentMedia( listboxArray->MediaL( aIndex ) );
+        }
+    else
+        {
+        if ( EMPXOpeningNote == iNoteType || EMPXImmediatelyOpeningNote == iNoteType )
+            {
+            CloseWaitNoteL();
+            }
+        }
+
+    MPX_PERF_CHECKPT("Collection View opened");
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleOpenL(
+    const CMPXCollectionPlaylist& /*aPlaylist*/,
+    TInt /*aError*/ )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleOpenL 2" );
+    iHandlingKeyEvent = EFalse;
+    // Do Nothing: playback/fetch client should handle this stage
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle media properties
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleCollectionMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError)
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleCollectionMediaL" );
+
+    TInt nextMediaLOp( EMPXOpMediaLIdle );
+    if ( aError == KErrNone )
+        {
+        switch ( iCurrentMediaLOp )
+            {
+            case EMPXOpMediaLGetContainerInfo:
+                {
+                delete iDuration;
+                iDuration = NULL;
+                if ( aMedia.IsSupported( KMPXMediaGeneralDuration ) )
+                    {
+                    TInt duration(
+                        aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralDuration ) );
+                    if ( duration > 0 )
+                        {
+                        // only display duration when the list contains something
+                        iDuration = iCommonUiHelper->DisplayableDurationInTextL( duration/KMilliSecondsToSeconds );
+                        }
+                    }
+                UpdateNaviPaneL();
+                break;
+                }
+            case EMPXOpMediaLSend:
+                {
+                DoHandleSendL( aMedia );
+                if ( !iContainer->Common()->FindBoxVisibility() )
+                    {
+                    iContainer->Common()->RestoreFindBoxPopupCBA();
+                    }
+                break;
+                }
+            case EMPXOpMediaLSongDetailsFileCheck:
+                {
+                if ( iContainer )
+                    {
+                    DoHandleFileCheckResultL(
+                        TUid::Uid( KMPXPluginTypeMetadataEditorUid ), aMedia );
+                    if ( !iContainer->Common()->FindBoxVisibility() )
+                        {
+                        iContainer->Common()->RestoreFindBoxPopupCBA();
+                        }
+                    }
+                break;
+                }
+            case EMPXOpMediaLAlbumArtFileCheck:
+                {
+                if ( iContainer )
+                    {
+                    DoHandleFileCheckResultL(
+                        TUid::Uid( KMPXPluginTypeAlbumArtEditorUid ), aMedia );
+
+                    if ( !iContainer->Common()->FindBoxVisibility() )
+                        {
+                        iContainer->Common()->RestoreFindBoxPopupCBA();
+                        }
+                    }
+                break;
+                }
+            case EMPXOpMediaLCollectionDetails:
+                {
+                DoShowCollectionDetailsL( aMedia );
+                break;
+                }
+            case EMPXOpMediaLPlaylistDetails:
+                {
+                DoShowPlaylistDetailsL( aMedia );
+                break;
+                }
+            case EMPXOpMediaLRenamePlaylist:
+                {
+                DoHandleRenamePlaylistL( aMedia );
+                break;
+                }
+            case EMPXOpMediaLNewPlaylistCollectionSongCount:
+                {
+                TInt songsCount( 0 );
+                if ( aMedia.IsSupported( KMPXMediaColDetailNumberOfItems ) )
+                    {
+                    songsCount =
+                        aMedia.ValueTObjectL<TInt>( KMPXMediaColDetailNumberOfItems );
+                    }
+                if ( songsCount > 0 )
+                    {
+                    // show add songs prompt only if collection contains
+                    // at least one song
+                    MPX_DEBUG2( "CMPXCollectionViewImp::HandleCollectionMediaL openning add songs view, collection contains %d songs", songsCount );
+                    CAknQueryDialog* confirmationDlg = CAknQueryDialog::NewL(
+                        CAknQueryDialog::EConfirmationTone );
+                    CleanupStack::PushL( confirmationDlg );
+                    HBufC* promptTxt = StringLoader::LoadLC(
+                        R_MPX_QTN_NMP_QUERY_ADD_SONGS );
+                    confirmationDlg->SetPromptL( *promptTxt );
+                    CleanupStack::PopAndDestroy( promptTxt );
+                    confirmationDlg->PublishDialogL(
+                        EMPlayerQueryAddSongsToPlaylist,
+                        KMPlayerNoteCategory);
+                    CleanupStack::Pop( confirmationDlg );
+                    AppUi()->StopDisplayingMenuBar();
+                    if ( confirmationDlg->ExecuteLD( R_MPX_CUI_ADD_SONGS_CONFIRMATION_QUERY ) )
+                        {
+                        HandleCommandL( EMPXCmdAddSongs );
+                        iCurrentMediaLOp = EMPXOpMediaLNewPlaylistCollectionSongCount;
+                        }
+                    }
+#ifdef _DEBUG
+                else
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewImp::HandleCollectionMediaL collection empty, not opening add songs view" );
+                    }
+#endif // _DEBUG
+                break;
+                }
+            case EMPXOpMediaLCopyToRemote:
+                {
+                if ( iUpnpFrameworkSupport )
+                    {
+                    DoHandleCopyToRemoteL( aMedia );
+                    }
+                break;
+                }
+
+            case EMPXOpMediaLFindInMusicShopSongDetails:
+                {
+                const TDesC& location = aMedia.ValueText( KMPXMediaGeneralUri );
+                if ( location != KNullDesC && ConeUtils::FileExists( location ) )
+                    {
+                    HBufC* buf = HBufC::NewLC( 5 ); // magic number to hold index value
+                    buf->Des().AppendNum(
+                        iContainer->Common()->CurrentLbxItemIndex() );
+                    // set current list box index
+                    SetParamL( buf );
+                    CleanupStack::PopAndDestroy( buf );
+
+                    DoGetSongMediaPropertyL();
+                    // Set the next operation to handle MediaL completed.
+                    nextMediaLOp = EMPXOpMediaLFindInMusicShopMediaLCompleted;
+                    }
+                else
+                    {
+                    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+                    CleanupStack::PushL( cpath );
+                    TInt currentDepth( cpath->Levels() );
+                    CleanupStack::PopAndDestroy( cpath );
+                    CMPXCommonListBoxArrayBase* listboxArray =
+                        iContainer->Common()->ListBoxArray();
+                    TInt currentIndex =
+                        iContainer->Common()->CurrentLbxItemIndex();
+                    const CMPXMedia& currentMedia = listboxArray->MediaL( currentIndex );
+                    TMPXGeneralCategory category(
+                        currentMedia.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+                    const CMPXMediaArray& mediaAry( listboxArray->MediaArray() );
+                    CMPXMedia* origMedia( mediaAry.AtL( currentIndex ) );
+                    const TDesC& title( origMedia->ValueText( KMPXMediaGeneralTitle ) );
+                    if ( ( title.Length() > 0 ) && ( title.Length() < KMaxFileName ) )
+                        {
+                        switch ( category )
+                            {
+                            case EMPXAlbum:
+                                {
+                                const CMPXMedia& containerMedia = listboxArray->ContainerMedia();
+                                // The Artist/Album View Title shows the Artist name
+                                const TDesC& titleArtist =
+                                        containerMedia.ValueText( KMPXMediaGeneralTitle );
+                                HBufC* unknownArtistText =
+                                        StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_ARTIST );
+                                // 4 is the level of Artist and Album View
+                                if ( currentDepth == 4 && titleArtist != unknownArtistText->Des() )
+                                    {
+                                    DoFindInMusicShopL(KCategoryEmpty, titleArtist, title); // Artist and Album View
+                                    }
+                                else
+                                    {
+                                    DoFindInMusicShopL(KCategoryEmpty, KCategoryEmpty, title); // Album View
+                                    }
+                                CleanupStack::PopAndDestroy( unknownArtistText );
+                                break;
+                                }
+                            case EMPXArtist:
+                                {
+                                DoFindInMusicShopL(KCategoryEmpty, title, KCategoryEmpty);  // Artist only
+                                break;
+                                }
+                            case EMPXSong:
+                                {
+                                DoFindInMusicShopL(title, KCategoryEmpty, KCategoryEmpty);  // Song only
+                                break;
+                                }
+                            default:
+                                {
+                                break;
+                                }
+                            } // switch
+                        } // if
+                    }  // else
+                break;
+                }
+            case EMPXOpMediaLFindInMusicShopMediaLCompleted:
+                {
+                // call DoFindInMusicShop when SongName, AlbumName, and ArtistName are
+                // available at this point
+                DoFindInMusicShopL(
+                    aMedia.ValueText( KMPXMediaGeneralTitle ),
+                    aMedia.ValueText( KMPXMediaMusicArtist ),
+                    aMedia.ValueText( KMPXMediaMusicAlbum ) );
+                break;
+                }
+
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else
+        {
+        /* If a Composer,Artist or Album consists single song.
+         * On changing the song details(composer+genre or album name+genre)
+         * No more record exist corresponding to previous data. 
+         * In this case no need to show Error Message. */
+        if( aError != KErrNotFound)
+            {   
+            HandleError( aError );
+            }
+        else
+            {
+            MPX_DEBUG2( "CMPXCollectionViewImp::HandleCollectionMediaL ERROR: %d",aError); 
+            }
+        }
+    if ( iCurrentMediaLOp == EMPXOpMediaLNewPlaylistCollectionSongCount )
+        {
+        iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo;
+        }
+    else
+        {
+        iCurrentMediaLOp = nextMediaLOp;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionHelperObserver
+// Callback function after executing a command
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleCommandComplete(CMPXCommand* /*aCommandResult*/,
+                                                  TInt /*aError*/)
+    {
+    // Make sure we are doing the right operation
+    if( iSetMediaLCount )
+        {
+        iSetMediaLCount--;
+        if ( iSetMediaLCount < 1 )
+            {
+            TRAP_IGNORE( HandleRenameOpCompleteL() );
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// From MMPXCollectionHelperObserver
+// Callback function to signal that adding a file is complete
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleAddFileCompleteL( TInt aErr )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleAddFileCompleteL" );
+    if ( aErr != KErrNone )
+        {
+        HandleError( aErr );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCHelperObserver
+// Handles the completion of helper events
+// ---------------------------------------------------------------------------
+//
+
+void CMPXCollectionViewImp::HandleOperationCompleteL( TCHelperOperation aOperation,
+                                           TInt aErr,
+                                           void* aArgument )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleOperationCompleteL" );
+    MPX_DEBUG2( "CMPXCollectionViewImp::HandleOperationCompleteL aErr = %d", aErr );
+    switch( aOperation )
+        {
+        case EDeleteOp:
+            {
+            MPX_DEBUG1( "CMPXCollectionViewImp::HandleOperationCompleteL Delete operation" );
+            // do not dismiss the wait note until HandleOpenL is called,
+            // unless it's error case
+            delete iCurrentCba;
+            iCurrentCba = NULL;
+            if( aErr == KErrInUse )
+                {
+                if ( !iIsWaitNoteCanceled )
+                    {
+                    // only dismiss wait note if the wait note is not
+                    // canceled
+                    if ( iProgressDialog )
+                        {
+                        iProgressDialog->ProcessFinishedL();
+                        }
+                    HandleCommandL( EMPXCmdHandleExternalCommand );
+                    iIsWaitNoteCanceled = EFalse;
+                    }
+                if ( iIsDeleting )
+                    {
+                    HBufC* text = StringLoader::LoadLC(
+                        ( iContainer->Common()->CurrentSelectionIndicesL()->Count() == 0 ) ?
+                        R_MPX_COLLECTION_NOTE_DELETE_FAIL : // Single selection
+                        R_MPX_COLLECTION_NOTE_DELETE_FAIL_MULTI_SELECTION ); // Multi selection
+
+                    CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+                    dlg->ExecuteLD( *text );
+                    CleanupStack::PopAndDestroy( text );
+                    }
+                iIsDeleting = EFalse;
+                }
+            else if ( aErr != KErrNone )
+                {
+                iIsDeleting = EFalse;
+                if ( !iIsWaitNoteCanceled )
+                    {
+                    if ( iProgressDialog )
+                    	{
+						iProgressDialog->ProcessFinishedL();
+						}
+                    HandleCommandL( EMPXCmdHandleExternalCommand );
+                    iIsWaitNoteCanceled = EFalse;
+                    }
+                HandleError( aErr );
+                }
+            if ( iContainer )
+                {
+                iContainer->Common()->ClearLbxSelection();
+                }
+            MPX_PERF_END_EX( MPX_PERF_SHOW_WAITNOTE );
+            // reopen collection
+            DoIncrementalOpenL( !iIsDeleting );
+            break;
+            }
+        case EExportPlaylistOp:
+            {
+            MPX_DEBUG1( "CMPXCollectionViewImp::HandleOperationCompleteL Export playlist operation" );
+            if ( aErr == KErrNone )
+                {
+                HBufC* uri = static_cast<HBufC*>( aArgument );
+                CleanupStack::PushL(uri);
+                MPX_DEBUG2( "CMPXCollectionViewImp::HandleOperationCompleteL playlist exported as %S", uri );
+
+                CMessageData* messageData = CMessageData::NewLC();
+                messageData->AppendAttachmentL( *uri );
+                RFs& fileSession = iCoeEnv->FsSession();
+                TEntry pl;
+                TInt err( fileSession.Entry( *uri, pl ) );
+                if ( err == KErrNone )
+                    {
+                    MPX_DEBUG2( "CMPXCollectionViewImp::HandleOperationCompleteL playlist size = %d", pl.iSize );
+                    if ( !iSendUi )
+                        {
+                        iSendUi = CSendUi::NewL();
+                        }
+                    TSendingCapabilities capabilities(
+                        0,
+                        pl.iSize,
+                        TSendingCapabilities::ESupportsAttachments );
+
+                    // sendui leaves with error code 0 when canceling sending
+                    // via bluetooth, this should be trapped
+                    MPX_TRAP( err, iSendUi->ShowQueryAndSendL( messageData, capabilities ) );
+                    if ( err != KErrNone )
+                        {
+                        HandleError( err );
+                        }
+                    // remove the file then remove the directory
+                    err = fileSession.Delete( *uri );
+                    if ( err != KErrNone )
+                        {
+                        HandleError( err );
+                        }
+                    err = fileSession.RmDir( *uri );
+                    if ( err != KErrNone )
+                        {
+                        HandleError( err );
+                        }
+                    }
+                else
+                    {
+                    HandleError( err );
+                    }
+                CleanupStack::PopAndDestroy( 2, uri ); // messageData & uri
+                aArgument = NULL;
+                }
+            else
+                {
+                HandleError( aErr );
+                }
+            break;
+            }
+        case EAddOp:
+            {
+            HandleAddCompletedL( (CMPXMedia*)aArgument, aErr );
+            aArgument = NULL; // ownership transferred
+            iIsAddingToPlaylist = EFalse;  // reset flag once incremental adding is finished
+            break;
+            }
+        case ESetOp:
+            {
+            if ( iAddingToNewPlaylist )
+                {
+                // if user selects overwrite existing playlist,
+                // the OP will be set, and is handled here
+                HandleAddCompletedL( (CMPXMedia*)aArgument, aErr );
+                }
+            else
+                {
+                HandleSetCompletedL( (CMPXMedia*)aArgument, aErr );
+                }
+            aArgument = NULL; // ownership transferred
+            break;
+            }
+        case EReorderPlaylistOp:
+            {
+            HandleSetCompletedL( (CMPXMedia*)aArgument, aErr );
+            aArgument = NULL; // ownership transferred
+            break;
+            }
+        case ERenameOp:
+            {
+            if ( aErr != KErrNone )
+                {
+                iCommonUiHelper->HandleErrorL( aErr );
+                }
+            break;
+            }
+        case EDeleteStatusOp:
+            {
+            if ( aArgument )
+                {
+                CMPXMedia* media = (CMPXMedia*)aArgument;
+                CleanupStack::PushL( media );
+                if ( media->IsSupported( KMPXMediaGeneralCount ) )
+                    {
+                    TInt deletePercent = media->ValueTObjectL<TInt>( KMPXMediaGeneralCount );
+                    MPX_DEBUG2( "CMPXCollectionViewImp::HandleOperationCompleteL % Files Deleted: %d", deletePercent );
+                    // update WaitNote dialog.
+                    HBufC* string = StringLoader::LoadLC(R_MPX_QTN_NMP_DEL_BATCH_SONGS_WAIT_NOTE, deletePercent);
+                    TPtr buf = string->Des();
+                    UpdateProcessL(deletePercent, buf);
+                    CleanupStack::PopAndDestroy( string );
+                    }
+                CleanupStack::PopAndDestroy( media );
+                aArgument = NULL;
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+
+    if( aArgument )
+        {
+        delete ( CBase* )aArgument;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandlePlaybackMessage" );
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    // Fix EBLI-7CFE4D press select key very quick cause System Error KErrArgument
+    else
+        {
+        // Fix for EJDI-77WCRF Low memory cause MP not resp.
+        iHandlingKeyEvent = EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandlePropertyL(
+    TMPXPlaybackProperty /*aProperty*/,
+    TInt /*aValue*/,
+    TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// 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 CMPXCollectionViewImp::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media event.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleMediaL(
+    const CMPXMedia& /*aMedia*/,
+    TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Returns views id.
+// ---------------------------------------------------------------------------
+//
+TUid CMPXCollectionViewImp::Id() const
+    {
+    return TUid::Uid( KMPXCollectionViewId );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Command handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2( "CMPXCollectionViewImp::HandleCommandL(0x%x) entering", aCommand );
+
+    switch (aCommand)
+        {
+        case EAknCmdMark:
+        case EAknCmdUnmark:
+        case EAknMarkAll:
+        case EAknUnmarkAll:
+            {
+            // Custom handling of markable lists
+            iContainer->Common()->HandleMarkableListProcessCommandL(
+                aCommand );
+#ifdef __ENABLE_MSK
+            // Determine middle soft key labeling
+            UpdateMiddleSoftKeyDisplayL( iCurrentMskId );
+#endif // __ENABLE_MSK
+            if (aCommand == EAknMarkAll && !iCollectionReady)
+                {
+                iMarkedAll = ETrue;
+                }
+            if (aCommand == EAknUnmarkAll || aCommand == EAknCmdUnmark)
+                {
+                iMarkedAll = EFalse;
+                }
+            break;
+            }
+        case EMPXCmdGoToNowPlaying:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        case EMPXCmdCreatePlaylist:
+            {
+            iCurrentPlaylistOp = EMPXOpPLCreating;
+            CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
+            CleanupStack::PushL( mediaArray );
+            CMPXMedia* media = CMPXMedia::NewL();
+            CleanupStack::PushL( media );
+            media->SetCObjectValueL( KMPXMediaArrayContents, mediaArray );
+            media->SetTObjectValueL( KMPXMediaArrayCount, 0 );
+            TInt ret( iCommonUiHelper->CreatePlaylistL( *media, this, this ) );
+            if ( !ret )
+                {
+                // create playlist failed,
+                iCurrentPlaylistOp = EMPXOpPLIdle;
+                }
+            CleanupStack::PopAndDestroy( media );
+            CleanupStack::PopAndDestroy( mediaArray );
+            break;
+            }
+        case EMPXCmdAddToNewPlaylist:
+        case EMPXCmdAddToSavedPlaylist:
+            {
+            // flag used only in the case when songs are added incrementally
+            iIsAddingToPlaylist = ETrue;
+            iNumSongAddedToPlaylist = -1;
+            TMPXGeneralCategory category( EMPXNoCategory );
+            CMPXCommonListBoxArrayBase* array(
+                iContainer->Common()->ListBoxArray() );
+            const CMPXMedia& media = array->MediaL(
+                iContainer->Common()->CurrentLbxItemIndex() );
+            category = media.ValueTObjectL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory );
+            if ( category == EMPXSong )
+                {
+                CMPXMedia* tracks = CMPXMedia::NewL();
+                CleanupStack::PushL( tracks );
+
+                MPX_TRAPD( err, PrepareMediaForSelectedItemsL( *tracks ) );
+                if ( err == KErrNone )
+                    {
+                    TBool ret = EFalse;
+                    if ( aCommand == EMPXCmdAddToNewPlaylist )
+                        {
+                        iAddingToNewPlaylist = ETrue;
+                        MPX_TRAP( err,ret = iCommonUiHelper->CreatePlaylistL(
+                                *tracks, this, this ) );
+                        if ( err != KErrNone )
+                            {
+                            HandleError( err );
+                            }
+                        if ( !ret )
+                            {
+                            iAddingToNewPlaylist = EFalse;
+                            }
+                        }
+                    else
+                        {
+                        MPX_TRAP( err, ret = iCommonUiHelper->AddToSavedPlaylistL(
+                            *iUserPlaylists, *tracks, this, this ) );
+                        if ( err != KErrNone )
+                            {
+                            HandleError( err );
+                            }
+                        }
+#ifdef __ENABLE_MSK
+                     // If Save play list or create play list return True (OK)
+                     //  1 - Unselect marks
+                     //  2 - Force to refresh the MSK with title "Play"
+                     // If Save play list or create play list return False (Cancel)
+                     //  1 - let the marks
+                     //  2 - let the MSK with the "context menu"
+                     if (ret)
+                       {
+                       iContainer->Common()->ClearLbxSelection();
+                       UpdateMiddleSoftKeyDisplayL( iCurrentMskId );
+                       }
+#endif // __ENABLE_MSK
+                    }
+                else if ( err == KMPXErrDataNotReadyCacheCommand )
+                    {
+                    // cache this command
+                    HBufC* text = StringLoader::LoadLC(
+                        R_MPX_QTN_MUS_NOTE_ADDING_TRACKS );
+                    StartDelayedActionL( aCommand, *text );
+                    CleanupStack::PopAndDestroy( text );
+                    }
+                else if ( err != KMPXErrDataNotReady )
+                    {
+                    HandleError( err );
+                    }
+                else
+                    {
+                    // KMPXErrDataNotReady, ignore
+                    }
+                CleanupStack::PopAndDestroy( tracks );
+                }
+            else
+                {
+                // on artist/album level
+                if ( aCommand == EMPXCmdAddToNewPlaylist )
+                    {
+                    iAddingToNewPlaylist = ETrue;
+                    iCurrentFindAllLOp = EMPXOpFindAllLAlbumArtistAddToNewPlaylist;
+                    }
+                else
+                    {
+                    iCurrentFindAllLOp = EMPXOpFindAllLAlbumArtistAddToSavedPlaylist;
+                    }
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL( attrs );
+                attrs.Append(
+                    TMPXAttribute( KMPXMediaIdGeneral,
+                    EMPXMediaGeneralTitle | EMPXMediaGeneralId |
+                    EMPXMediaGeneralType | EMPXMediaGeneralCategory ) );
+                CMPXMedia* criteria = CMPXMedia::NewL();
+                CleanupStack::PushL( criteria );
+                CMPXCommonListBoxArrayBase* listboxArray =
+                    iContainer->Common()->ListBoxArray();
+                const CMPXMedia& containerMedia =
+                    listboxArray->ContainerMedia();
+                TMPXGeneralCategory containerCategory(
+                    containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory ) );
+                if ( containerCategory == EMPXArtist )
+                    {
+                    // artist/album level, need to specify artist ID in container ID
+                    TMPXItemId containerId(
+                        containerMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                    criteria->SetTObjectValueL<TMPXItemId>(
+                        KMPXMediaGeneralContainerId, containerId );
+                    }
+                const CMPXMedia& currentMedia = listboxArray->MediaL(
+                    iContainer->Common()->CurrentLbxItemIndex() );
+                TMPXItemId id(
+                    currentMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                criteria->SetTObjectValueL<TMPXGeneralType>(
+                    KMPXMediaGeneralType, EMPXGroup );
+                criteria->SetTObjectValueL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory, EMPXSong );
+                criteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+                iCollectionUtility->Collection().FindAllL(
+                    *criteria, attrs.Array(), *this );
+                CleanupStack::PopAndDestroy( criteria );
+                CleanupStack::PopAndDestroy( &attrs );
+                }
+            break;
+            }
+        case EMPXCmdAddSongs:
+            {
+            iAddingSong = ETrue;
+            iViewUtility->ActivateViewL(
+                TUid::Uid( KMPXPluginTypeAddSongsEditorUid ) );
+            break;
+            }
+        case EMPXCmdReorder:
+            {
+            ActivateReorderGrabbedModeL();
+            break;
+            }
+        case EMPXCmdDelete: // fall through
+        case EMPXCmdRemove:
+            {
+            StoreListboxItemIndexL();
+            DeleteSelectedItemsL(aCommand);
+            break;
+            }
+        case EMPXCmdSend:
+            {
+            const CMPXMedia& media =
+                iContainer->Common()->ListBoxArray()->MediaL(
+                    iContainer->Common()->CurrentLbxItemIndex() );
+
+            TMPXGeneralType type(
+                media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+            TMPXGeneralCategory category(
+                media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+
+            if ( iContainer->Common()->CurrentSelectionIndicesL()->Count() == 0 &&
+                type == EMPXItem &&
+                category == EMPXPlaylist )
+                {
+                // sending a playlist
+                DoSendPlaylistL( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                }
+            else
+                {
+                DoSendL();
+                }
+            break;
+            }
+        case EMPXCmdSongDetails: // fall through
+        case EMPXCmdAlbumArt: // fall through
+        case EMPXCmdFindInMusicShop:
+            {
+            StoreListboxItemIndexL();
+            
+            CMPXCommonListBoxArrayBase* listboxArray(
+                iContainer->Common()->ListBoxArray() );
+            const CMPXMedia& media( listboxArray->MediaL(
+                iContainer->Common()->CurrentLbxItemIndex() ) );
+            if ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
+                {
+                // highlighted item is not yet available
+                MPX_DEBUG1( "CMPXCollectionViewImp::HandleCommandL item not yet fetched" );
+                }
+            else
+                {
+                // need to check if the file exists.  if the file doesn't exist
+                // and mediaL is called with drm status, it'll leave
+                if ( aCommand == EMPXCmdSongDetails )
+                    {
+                    iCurrentMediaLOp = EMPXOpMediaLSongDetailsFileCheck;
+                    iInSongDetails = ETrue;
+                    }
+                else if ( aCommand == EMPXCmdAlbumArt )
+                    {
+                    iInAlbumArtDialog = ETrue;
+                    iCurrentMediaLOp = EMPXOpMediaLAlbumArtFileCheck;
+                    }
+                else if ( aCommand == EMPXCmdFindInMusicShop )
+                    {
+                    iCurrentMediaLOp = EMPXOpMediaLFindInMusicShopSongDetails;
+                    }
+                CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+                CleanupStack::PushL( path );
+                path->Set( iContainer->Common()->CurrentLbxItemIndex() );
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL( attrs );
+                attrs.Append(
+                    TMPXAttribute( KMPXMediaIdGeneral,
+                        EMPXMediaGeneralUri | EMPXMediaGeneralCollectionId ) );
+                iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+                CleanupStack::PopAndDestroy( &attrs );
+                CleanupStack::PopAndDestroy( path );
+                }
+            break;
+            }
+        case EMPXCmdGoToMusicShop:
+            {
+            LaunchMusicShopL();
+            break;
+            }
+        case EMPXCmdGoToNokiaMusicShop:
+            {
+            LaunchMusicShopL();
+            break;
+            }
+        case EMPXCmdGoToOperatorMusicShop:
+            {
+            if(iMusicStoreWebPage)
+                {
+                LaunchOperatorURLMusicShopL();
+                }
+            else
+                {
+                if(iOperatorMusicStoreType)
+                {
+                LaunchOperatorJavaMusicShopL(iOperatorMusicStoreUID);
+                }
+            else
+                {
+                LaunchOperatorNativeMusicShopL();
+                }
+                }
+            break;
+            }
+        case EMPXCmdMusicLibraryDetails:
+            {
+            iCurrentMediaLOp = EMPXOpMediaLCollectionDetails;
+            CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( path );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL( attrs );
+            attrs.Append( KMPXMediaColDetailAll );
+            iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PopAndDestroy( path );
+            break;
+            }
+        case EMPXCmdRename:
+            {
+            StoreListboxItemIndexL();
+            DoHandleRenameL();
+            break;
+            }
+        case EMPXCmdPlaylistDetails:
+            {
+            iCurrentMediaLOp = EMPXOpMediaLPlaylistDetails;
+            CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( path );
+            path->Set( iContainer->Common()->CurrentLbxItemIndex() );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL( attrs );
+            attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
+                EMPXMediaGeneralCount | EMPXMediaGeneralTitle |
+                EMPXMediaGeneralUri | EMPXMediaGeneralDate |
+                EMPXMediaGeneralDuration | EMPXMediaGeneralFlags ) );
+            iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PopAndDestroy( path );
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            iMarkedAll = EFalse;
+            if( iIsDeleting )
+            	{
+            	break;
+            	}
+
+            if ( iIsEmbedded )
+                {
+                AppUi()->HandleCommandL(
+                    ( MPXTlsHelper::NeedSave() && iCommonUiHelper->IsHostMessagingBrowserL() )
+                    ? EMPXCmdSaveAndExit : EEikCmdExit );
+                }
+            else
+                {
+                if ( !iHandlingKeyEvent )
+                    {
+                    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+                    CleanupStack::PushL( cpath );
+                    TInt currentDepth( cpath->Levels() );
+                    if ( currentDepth == 2 ) // 2 is the level of music main view
+                        {
+#ifdef BACKSTEPPING_INCLUDED
+                        // let Back Stepping Service handle the event
+                        TInt statusInfo( KMPXBackSteppingNotConsumed );
+                        if( iViewUtility &&
+                            ( iViewUtility->ActiveViewImplementationUid() != KNullUid ) )
+                            {
+                            TInt viewId( iViewUtility->ActiveViewType().iUid );
+                            TBuf8<KMVPrefixLen + KMaxIntLen> buf;
+                            buf.Copy( KMVPrefix );
+                            buf.AppendNum( viewId );
+                            statusInfo = iBackSteppingUtility->HandleBackCommandL( buf );
+                            MPX_DEBUG3("CMPXCollectionViewImp::HandleCommandL - viewid=0x%x, statusInfo=%d",
+                                 viewId, statusInfo );
+                            }
+                        if ( statusInfo == KMPXBackSteppingNotConsumed )
+                            // event not consumed by Back Stepping utility, handle here
+                            //
+#endif // BACKSTEPPING_INCLUDED
+                            {
+                            AppUi()->HandleCommandL( aCommand );
+                            }
+                        }
+                    else
+                        {
+                        if ( currentDepth > 2 && !iBackOneLevel )
+                            {
+                            iContainer->Common()->ClearLbxSelection();
+                            iCollectionUtility->Collection().BackL();
+                            iFirstIncrementalBatch = ETrue;
+                            MPX_DEBUG2( "CMPXCollectionViewImp::HandleCommandL Getting container media, currentDepth = %d", currentDepth );
+                            cpath->Back();
+                            cpath->Back();
+                            RArray<TMPXAttribute> attrs;
+                            CleanupClosePushL(attrs);
+                            iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo;
+                            attrs.Append( KMPXMediaGeneralDuration );
+                            iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+                            CleanupStack::PopAndDestroy( &attrs );
+                            iBackOneLevel = ETrue;
+                            }
+                        else
+                            {
+                            MPX_DEBUG1( "CMPXCollectionViewImp::HandleCommandL Not getting container media" );
+                            }
+
+                        iHandlingKeyEvent = ETrue;
+                        }
+                    CleanupStack::PopAndDestroy( cpath );
+                    }
+                else
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewImp::HandleCommandL Busy, ignoring command" );
+                    }
+                }
+            break;
+            }
+        case EMPXCmdSavePlaylist:
+            {
+            AppUi()->HandleCommandL( EMPXCmdSaveAndReopen );
+            break;
+            }
+        case EAknCmdExit:
+        case EAknSoftkeyExit:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        case EMPXCmdCancelReorder:
+            {
+            if ( iContainer && iContainer->IsInReorderMode() )
+                {
+                TRAP_IGNORE( ProcessCommandL( EMPXCmdReorderCancel ) );
+                iCurrentHighlightedIndex = KErrNotFound;
+                }
+            break;
+            }
+        case EMPXCmdUpnpPlayViaLocal:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                SelectNewPlayerL( aCommand );
+                }
+            break;
+            }
+        case EMPXCmdUPnPAiwCmdCopyToExternalCriteria:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                CopySelectedItemsToRemoteL();
+                }
+            break;
+            }
+
+        case EMPXCmdPlay:
+        case EMPXCmdForcePlay:
+        case EMPXCmdPlayPause:
+            {
+            TBool isReady( ETrue );
+            TMPXPlaybackState state( iPlaybackUtility->StateL() );
+
+            // if it's in paused state, resume playback, no need
+            // to check if current highlight is a playlist
+            if ( iContainer &&
+                aCommand != EMPXCmdForcePlay &&
+                state != EPbStatePaused && state != EPbStatePlaying )
+                {
+                CMPXCommonListBoxArrayBase* listboxArray =
+                    iContainer->Common()->ListBoxArray();
+                if ( iContainer->Common()->CurrentListItemCount() > 0 )
+                    {
+                    TInt currentItem(
+                        iContainer->Common()->CurrentLbxItemIndex() );
+                    const CMPXMedia& media = listboxArray->MediaL( currentItem );
+                    TMPXGeneralType type(
+                        media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+                    TMPXGeneralCategory category(
+                        media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+                    if ( category == EMPXPlaylist && type == EMPXItem )
+                        {
+                        MPX_DEBUG1( "CMPXCollectionViewImp::HandleCommandL checking item count in playlist" );
+                        isReady = EFalse;
+                        TMPXItemId id(
+                            media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                        CMPXMedia* entry = CMPXMedia::NewL();
+                        CleanupStack::PushL( entry );
+                        entry->SetTObjectValueL<TMPXGeneralType>(
+                            KMPXMediaGeneralType, EMPXGroup );
+                        entry->SetTObjectValueL<TMPXGeneralCategory>(
+                            KMPXMediaGeneralCategory, EMPXSong );
+                        entry->SetTObjectValueL<TMPXItemId>(
+                            KMPXMediaGeneralId, id );
+                        iCurrentFindAllLOp = EMPXOpFindAllLPlaylistTracksCount;
+                        RArray<TMPXAttribute> attrs;
+                        CleanupClosePushL( attrs );
+                        attrs.Append( KMPXMediaGeneralId );
+                        iCollectionUtility->Collection().FindAllL(
+                            *entry, attrs.Array(), *this );
+                        CleanupStack::PopAndDestroy( &attrs );
+                        CleanupStack::PopAndDestroy( entry );
+                        }
+                    }
+                else
+                    {
+                    // current list view is empty, and no song currently playing
+                    // ignore the command
+                    isReady = EFalse;
+                    }
+                }
+            if ( isReady )
+                {
+                if ( aCommand == EMPXCmdForcePlay )
+                    {
+                    aCommand = EMPXCmdPlay;
+                    }
+                if ( EPbStateNotInitialised == state ||
+                     EPbStateStopped == state )
+                    {
+                    // Needed to reset the status of iPreservedState
+                    if ( EPbStateStopped == state )
+                        {
+                        iPlaybackUtility->CommandL(EPbCmdResetPreserveState);
+                        }
+                    TInt currentItem(
+                        iContainer->Common()->CurrentLbxItemIndex() );
+                    MPX_DEBUG2( "CMPXCollectionViewImp::HandleCommandL playing index %d", currentItem );
+                    if ( iContainer->IsInReorderMode() )
+                        {
+                        // if in reorder mode, and in not playing state
+                        // drop the reorder target and start playing
+                        if ( iIsGrabbed )
+                            {
+                            ProcessCommandL( EMPXCmdReorderDrop );
+                            }
+                        ProcessCommandL( EMPXCmdReorderDone );
+                        iPlayIndex = currentItem;
+                        }
+                    else if ( currentItem != KErrNotFound )
+                        {
+                        if ( iContainer && !AppUi()->IsDisplayingDialog() )
+                            {
+                            StopDisplayingMenuBar();
+                            }
+                        iPlayIndex = KErrNotFound;
+                        if(iCollectionCacheReady)
+                            {
+                            iCollectionUtility->Collection().OpenL( currentItem, EMPXOpenPlaylistOnly );
+                            iFirstIncrementalBatch = ETrue;
+                            }
+                        }
+                    }
+                else
+                    {
+                    AppUi()->HandleCommandL( aCommand );
+                    }
+                }
+            break;
+            }
+        case EMPXCmdSaveComplete:
+            {
+            MPXTlsHelper::SetNeedSave( EFalse );
+            break;
+            }
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        case EMPXCmdRefreshLibrary:
+            {
+            MPX_PERF_CHECKPT("Refresh collection library");
+            // Package the argument from 8bit to 16bit then activate view
+            //
+            StartWaitNoteL( EMPXRefreshingNote );
+            iPlaybackUtility->CommandL( EPbCmdStop );
+            break;
+            }
+#endif
+        default:
+            {
+            MPX_PERF_CHECKPT("Handle Collection view unknown command");
+            if ( iUpnpFrameworkSupport )
+                {
+                if ( aCommand >= EMPXCmdUpnpPlayViaRemotePlayer  &&
+                     aCommand < EMPXCmdUpnpLastCommandId )
+                    {
+                    SelectNewPlayerL( aCommand );
+                    }
+                else
+                    {
+                    if ( iServiceHandler->ServiceCmdByMenuCmd(aCommand) != KAiwCmdNone )
+                        {
+                        CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+                        FillAiwParametersL(paramList);
+                        iServiceHandler->ExecuteMenuCmdL(aCommand, paramList,
+                            iServiceHandler->OutParamListL());
+                        }
+                    AppUi()->HandleCommandL( aCommand );
+                    }
+                }
+            else
+                {
+                if ( iServiceHandler->ServiceCmdByMenuCmd(aCommand) != KAiwCmdNone )
+                    {
+                    CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+                    FillAiwParametersL(paramList);
+                    iServiceHandler->ExecuteMenuCmdL(aCommand, paramList,
+                        iServiceHandler->OutParamListL());
+                    }
+                AppUi()->HandleCommandL( aCommand );
+                }
+            break;
+            }
+        }
+    MPX_DEBUG1( "CMPXCollectionViewImp::HandleCommandL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Handles a view activation.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoActivateL(
+    const TVwsViewId& /* aPrevViewId */,
+    TUid /* aCustomMessageId */,
+    const TDesC8& /* aCustomMessage */ )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoActivateL()" );
+
+    // Add view deactivation observer
+    AppUi()->AddViewDeactivationObserverL( this );
+
+    // Set status pane layout if switched here directly from another view,
+    // such as when using the AnyKey
+    StatusPane()->MakeVisible( ETrue );
+    if ( StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_USUAL )
+        {
+        StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+        }
+
+    if ( !iContainer )
+        {
+        iContainer = CMPXCollectionViewContainer::NewL( this, this, iIsEmbedded );
+        }
+    CCoeControl* coeControl = iContainer->Common()->CoeControl();
+    coeControl->SetMopParent( this );
+    AppUi()->AddToStackL( *this, coeControl );
+    coeControl->SetRect( ClientRect() );
+    iContainer->Common()->ActivateContainerL();
+
+    CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+    CleanupStack::PushL( cpath );
+
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+    // media is not valid until the first HandleOpenL call
+    CEikButtonGroupContainer* cba = Cba();
+    if ( cba )
+        {
+        cba->SetCommandSetL(
+            ( cpath->Levels() == 2 && !iIsEmbedded ) ?
+            R_MPX_OPTIONS_BACK_CBA_NO_ACTION : R_MPX_OPTIONS_BACK_CBA_NO_ACTION );
+        cba->DrawDeferred();
+        }
+#else
+    // media is not valid until the first HandleOpenL call
+    CEikButtonGroupContainer* cba = Cba();
+    if ( cba )
+        {
+        cba->SetCommandSetL(
+            ( iViewUtility->ViewHistoryDepth() == 1 && !iIsEmbedded ) ?
+            R_MPX_OPTIONS_EXIT_CBA_NO_ACTION : R_MPX_OPTIONS_BACK_CBA_NO_ACTION );
+        cba->DrawDeferred();
+        }
+#endif
+
+	UpdateTitlePaneL();
+    UpdateNaviPaneL();
+
+
+    if ( iViewUtility->PreviousViewType().iUid == KMPXPluginTypePlaybackUid )
+        {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        // If previous view is Playback view, it can only be normal playback view
+        // Podcast shouldn't be highlighted in any case.
+        iPodcast = EFalse;
+#endif
+
+        // return back from playback view and in songs level,
+        // highlight the new playing song
+        MMPXSource* source( iPlaybackUtility->Source() );
+
+        if ( source )
+            {
+            CMPXCollectionPlaylist* playlist( source->PlaylistL() );
+            if ( playlist )
+                {
+                // Going from Now Playing View -> Collection, same collection level
+                iPossibleJump = ( playlist->Path().Levels() == cpath->Levels() );
+                delete playlist;
+                }
+            }
+
+        if ( cpath->Levels() > 1 )
+            {
+            // valid path in collection
+            GetDurationL();
+
+            DoIncrementalOpenL();
+            }
+        else
+            {
+            TUid defaultView( iViewUtility->DefaultViewUid() );
+            iViewUtility->ActivateViewL( ( defaultView != KNullUid ) ?
+                defaultView : TUid::Uid( KMPXPluginTypeMainUid ) );
+            }
+        }
+    else
+        {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        // If previous view is Collection view, it can only be podcast view
+        if ( iViewUtility->PreviousViewType().iUid == KMPXPluginTypeCollectionUid )
+            {
+            iPodcast = ETrue;
+            }
+        // don't bother getting duration if at plugin list
+        if ( cpath->Levels() > 1 )
+#endif
+            {
+            GetDurationL();
+            }
+
+        DoIncrementalOpenL( cpath->Levels()>KMusicCollectionMenuLevel ? ETrue:EFalse );
+
+        iUpCount = 0;
+        iDownCount = 0;
+        }
+    CleanupStack::PopAndDestroy( cpath );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// View deactivation function.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoDeactivate()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoDeactivate" );
+    if ( iContainer && iContainer->IsInReorderMode() )
+        {
+        TRAP_IGNORE( ProcessCommandL( EMPXCmdReorderDone ) );
+        iCurrentHighlightedIndex = KErrNotFound;
+        }
+
+    if ( iContainer )
+        {
+        iContainer->ContentIsReady( EFalse );
+        AppUi()->RemoveFromStack( iContainer->Common()->CoeControl() );
+        delete iContainer;
+        iContainer = NULL;
+        }
+
+    if (iDuration)
+        {
+        delete iDuration;
+        iDuration = NULL;
+        TRAP_IGNORE(UpdateNaviPaneL());
+        }
+
+    // Cleanup view deactivation observer
+    AppUi()->RemoveViewDeactivationObserver( this );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Foreground event handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleForegroundEventL( TBool aForeground )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleForegroundEventL" );
+    if ( aForeground && iOpeningNote )
+    	{
+        CloseWaitNoteL();
+        iOpeningNote = EFalse;
+    	}	
+#ifdef BACKSTEPPING_INCLUDED
+    iActivateBackStepping = EFalse;
+    MPX_DEBUG3("CMPXCollectionViewImp::HandleForegroundEventL - is in foreground=%d, this view=0x%x",
+        aForeground, Id().iUid );
+    if( aForeground &&
+        iViewUtility &&
+        ( iViewUtility->ActiveViewImplementationUid() != KNullUid ) )
+        {
+        iActivateBackStepping = ETrue;
+        }
+#endif // BACKSTEPPING_INCLUDED
+        {
+        CAknView::HandleForegroundEventL( aForeground );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::HandleBacksteppingActivation
+// Handle backstepping activation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleBacksteppingActivation()
+    {
+#ifdef BACKSTEPPING_INCLUDED
+    TInt viewId( iViewUtility->ActiveViewType().iUid );
+    TBuf8<KMVPrefixLen + KMaxIntLen> buf;
+    buf.Copy( KMVPrefix );
+    buf.AppendNum( viewId );
+    TInt statusInfo( KMPXBackSteppingNotConsumed );
+    TRAP_IGNORE(
+       statusInfo =
+        iBackSteppingUtility->ForwardActivationEventL( buf, ETrue );
+         );
+    MPX_DEBUG3("CMPXCollectionViewImp::HandleBacksteppingActivation - viewId=0x%x, statusInfo=%d", viewId, statusInfo );
+    iActivateBackStepping = EFalse;
+#endif // BACKSTEPPING_INCLUDED
+   }
+
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DynInitMenuPaneL" );
+    CMPXCollectionViewListBoxArray* array =
+        static_cast<CMPXCollectionViewListBoxArray*>(
+        iContainer->Common()->ListBoxArray() );
+    TInt currentItem( iContainer->Common()->CurrentLbxItemIndex() );
+    TBool isListEmpty( currentItem < 0 );
+    TInt selectionCount( 0 );
+    if ( iSelectionIndexCache)
+        {
+        selectionCount = iSelectionIndexCache->Count();
+        }
+    
+    TInt usbUnblockingStatus;
+    RProperty::Get( KMPXViewPSUid,
+                    KMPXUSBUnblockingPSStatus, 
+                    usbUnblockingStatus);
+
+    switch ( aResourceId )
+        {
+        case R_MPX_COLLECTION_VIEW_MENU_1:
+            {
+            const CMPXMedia& containerMedia = array->ContainerMedia();
+            TMPXGeneralType containerType(
+                containerMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+            TMPXGeneralCategory containerCategory(
+                containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory ) );
+            MPX_DEBUG3( "CMPXCollectionViewImp::DynInitMenuPaneL container type = %d, category = %d", containerType, containerCategory );
+
+            // Always dim the find in hg implementation
+            aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
+            MMPXPlaybackUtility* pdPlaybackUtility;
+            pdPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid( KProgressDownloadUid ) );
+            MMPXSource* pdsource( pdPlaybackUtility->Source() );
+            MMPXSource* source( iPlaybackUtility->Source() );
+            TBool hideNowPlaying;
+            hideNowPlaying = ( (pdsource == 0) 
+                           &&  (source == 0));
+            pdPlaybackUtility->Close();
+            if ( hideNowPlaying )
+                {
+                aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
+                }
+            if ( !isListEmpty )
+                {
+                const CMPXMedia& media = array->MediaL( currentItem );
+                TMPXGeneralType type(
+                    media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+                TMPXGeneralCategory category(
+                    media.ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory ) );
+                MPX_DEBUG3( "CMPXCollectionViewImp::DynInitMenuPaneL item type = %d, category = %d", type, category );
+                if ( containerType == EMPXItem && containerCategory == EMPXPlaylist )
+                    {
+                    // in playlist tracks view
+                    // enable reordering and add songs in playlist view
+                    aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                    aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                    if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                        {
+                        aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                        aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                        aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                        aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                        aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                        }
+                    else
+                        {
+                        // do not display add songs option when marking is on
+                        aMenuPane->SetItemDimmed( EMPXCmdAddSongs, selectionCount > 0 );
+                        TInt totalItemCount( iContainer->Common()->TotalListItemCount() );
+                        // display reorder option only when more than 1 item is visible
+                        // do not display reorder option when marking is on
+                        aMenuPane->SetItemDimmed( EMPXCmdReorder,
+                            ( totalItemCount > 1 && selectionCount == 0 ) ?
+                            EFalse : ETrue );
+                        aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                        aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                        aMenuPane->SetItemDimmed( EMPXCmdRemove, EFalse );
+						}
+
+                    if ( containerMedia.IsSupported(
+                        KMPXMediaGeneralNonPermissibleActions ) )
+                        {
+                        // check for auto playlist, disable add, remove and reorder
+                        TMPXGeneralNonPermissibleActions attr(
+                            containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                                KMPXMediaGeneralNonPermissibleActions ) );
+                        if ( attr & EMPXWrite )
+                            {
+                            aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                            }
+                        }
+                    }
+                else if ( type == EMPXItem )
+                    {
+                    switch ( category )
+                        {
+                        case EMPXPlaylist:
+                            {
+                            // playlist view
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
+                                }
+                            if ( media.IsSupported(
+                                KMPXMediaGeneralNonPermissibleActions ) )
+                                {
+                                // check for auto playlist, disable delete
+                                TMPXGeneralNonPermissibleActions attr(
+                                    media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                                        KMPXMediaGeneralNonPermissibleActions ) );
+                                if ( attr & EMPXWrite )
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                    }
+                                }
+                            aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                            break;
+                            }
+                        case EMPXAlbum:
+                        case EMPXArtist:
+                        case EMPXGenre:
+                        case EMPXComposer:
+                            {
+                            // artist, album, genre, composer view
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );								
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                }
+                            break;
+                            }
+                        case EMPXSong:
+                            {
+                            // any tracks view except playlist tracks
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                }
+                            break;
+                            }
+                        default:
+                            {
+                            ASSERT( 0 );
+                            break;
+                            }
+                        }
+                    }
+
+                if ( iUpnpFrameworkSupport )
+                    {
+                    HandleDynInitUpnpL( aResourceId, *aMenuPane );
+                    }
+                else
+                    {
+                    aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
+                    aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
+                    }
+                }
+            else
+                {
+                // list empty
+
+                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist,
+                    ( containerType == EMPXGroup && containerCategory == EMPXPlaylist) ? // in playlist view?
+                    EFalse : ETrue );
+                if ( containerType == EMPXItem && containerCategory == EMPXPlaylist)
+                    {
+                    // in playlist tracks view
+                    if ( containerMedia.IsSupported(
+                        KMPXMediaGeneralNonPermissibleActions ) )
+                        {
+                        // check for auto playlist, disable add songs
+                        TMPXGeneralNonPermissibleActions attr(
+                            containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                                KMPXMediaGeneralNonPermissibleActions ) );
+                        if ( attr & EMPXWrite )
+                            {
+                            aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                            }
+                        }
+                    }
+                else
+                    {
+                    aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                    }
+                aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                }
+            break;
+            }
+        case R_MPX_COLLECTION_VIEW_MENU_2:
+            {
+            if ( !isListEmpty )
+                {
+                const CMPXMedia& media = array->MediaL( currentItem );
+                TMPXGeneralType type(
+                    media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+                TMPXGeneralCategory category(
+                    media.ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory ) );
+                const CMPXMedia& containerMedia = array->ContainerMedia();
+                TMPXGeneralType containerType(
+                    containerMedia.ValueTObjectL<TMPXGeneralType>(
+                        KMPXMediaGeneralType ) );
+                TMPXGeneralCategory containerCategory(
+                    containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory ) );
+                MPX_DEBUG3( "CMPXCollectionViewImp::DynInitMenuPaneL container type = %d, category = %d", containerType, containerCategory );
+                MPX_DEBUG3( "CMPXCollectionViewImp::DynInitMenuPaneL item type = %d, category = %d", type, category );
+                if ( type == EMPXItem)
+                    {
+                    switch ( category )
+                        {
+                        case EMPXPlaylist:
+                            {
+                            // playlist view
+                            aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdRename, EFalse );
+                                }
+                            aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, EFalse );
+                            if ( media.IsSupported(
+                                KMPXMediaGeneralNonPermissibleActions ) )
+                                {
+                                // check for auto playlist, disable delete
+                                TMPXGeneralNonPermissibleActions attr(
+                                    media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                                        KMPXMediaGeneralNonPermissibleActions ) );
+                                if ( attr & EMPXWrite )
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
+                                    }
+                                }
+                            if ( array->IsItemBrokenLinkL( currentItem ) ||
+                                array->IsItemCorruptedL( currentItem ) )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
+                                }
+                            break;
+                            }
+                        case EMPXAlbum:
+                        case EMPXArtist:
+                        case EMPXGenre:
+                        case EMPXComposer:
+                            {
+                            // artist, album, genre, composer view
+                            aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdRename, EFalse );
+                                }
+                            if ( category == EMPXAlbum )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, EFalse );
+                                // if unknown entry exist in album level, disable album art
+                                // for last item, if unknown exist it'll be at this
+                                // location
+                                if ( array->IsCategoryUnknownExist() &&
+                                    category == EMPXAlbum &&
+                                    currentItem == iContainer->Common()->TotalListItemCount() - 1 )
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                                    }
+                                if ( containerCategory == EMPXArtist )
+                                    {
+                                    // in artist/album view, do not display album art/rename
+                                    // option on All ( first item in list )
+                                    if ( currentItem == 0 )
+                                        {
+                                        aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                                        aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                                        }
+                                    }
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                                }
+                            if ( ( category == EMPXGenre ) || ( category == EMPXComposer ) )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                                }
+                            else
+                                {
+                                if ( array->IsCategoryUnknownExist() &&
+                                    ( category == EMPXAlbum || category == EMPXArtist ) &&
+                                    currentItem == iContainer->Common()->TotalListItemCount() - 1 )
+                                    {
+                                    // if unknown entry exist in artist or album level
+                                    aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                                    }
+                                else
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, EFalse );
+                                    }
+                                }
+                            aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
+
+                            if ( !iUsingNokiaService )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                                }
+                            break;
+                            }
+                        case EMPXSong:
+                            {
+                            // any tracks view
+#ifdef __ENABLE_MSK
+                            // show context menu if MSK selected and there are
+                            // multiple selections; otherwise, show options menu
+                            if ( ( selectionCount > 0 ) && iShowContextMenu )
+                                {
+                                MenuBar()->SetMenuType(CEikMenuBar::EMenuContext);
+                                iShowContextMenu = EFalse;
+                                }
+                            else
+                                {
+                                MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions);
+                                }
+#endif //__ENABLE_MSK
+                            if ( selectionCount > 0 )
+                                {
+                                // multiple selection
+                                aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                                }
+                            else
+                                {
+                                TBool fileDetailVisibility( FileDetailsOptionVisibilityL() );
+                                // use the same criteria for showing/hiding song details
+                                // and album art
+                                aMenuPane->SetItemDimmed( EMPXCmdSongDetails,
+                                    fileDetailVisibility );
+                                aMenuPane->SetItemDimmed( EMPXCmdAlbumArt,
+                                    fileDetailVisibility );
+                                TBool vis = ETrue;
+                                TRAPD( err, vis = SetAsRingToneOptionVisibilityL() );
+
+                                if ( err )
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade,
+                                        ETrue); // dim the option if any sql error.
+                                    }
+                                else
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade,
+                                        vis);
+                                    }
+                                if ( array->IsItemBrokenLinkL( currentItem ) ||
+                                    array->IsItemCorruptedL( currentItem ) )
+                                    {
+                                aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                                    }
+                                else // Show this option even when song is DRM protected
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, EFalse );
+                                    }
+                                }
+                            aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
+                            if ( !iUsingNokiaService )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                                }
+                            if (iServiceHandler->HandleSubmenuL(*aMenuPane))
+                                {
+                                return;
+                                }
+                            break;
+                            }
+                        default:
+                            {
+                            // other types, not handled
+                            break;
+                            }
+                        }
+                    }
+                }
+            else
+                {
+                // list empty
+                aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
+                }
+            aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden );
+            break;
+            }
+        case R_MPX_ADD_TO_PL_SUB_MENU:
+            {
+            aMenuPane->SetItemDimmed( EMPXCmdAddToSavedPlaylist, !FindPlaylistsL() );
+            break;
+            }
+        case R_MPX_COLLECTION_PLAY_VIA_SUB_MENU:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                AddPlayersNamesToMenuL( *aMenuPane );
+                }
+            break;
+            }
+        case R_MPX_COLLECTION_VIEW_MUSIC_MENU:
+            {
+            MMPXPlaybackUtility* pdPlaybackUtility;
+            pdPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid( KProgressDownloadUid ) );
+            MMPXSource* pdsource( pdPlaybackUtility->Source() );
+            MMPXSource* source( iPlaybackUtility->Source() );
+            TBool hideNowPlaying;
+            hideNowPlaying = ( (pdsource == 0) 
+                           &&  (source == 0));
+            pdPlaybackUtility->Close();
+            if ( hideNowPlaying )
+                {
+                aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
+                }
+            if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive)
+                {
+                aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
+                }
+            aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden );
+            aMenuPane->SetItemDimmed(
+                EMPXCmdGoToMusicShop, iGoToMusicShopOptionHidden );
+            if (iOperatorMusicStore)
+            	{
+            	aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
+            	}
+            else
+            	{
+            	aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
+          		}
+            break;
+            }
+        case R_MPX_COLLECTION_VIEW_EMBEDDED_PLAYLIST_VIEW:
+            {
+            // if it's from browser/messaging, display save option if
+            // it has not been saved
+            aMenuPane->SetItemDimmed( EMPXCmdSavePlaylist,
+                ( !iCommonUiHelper->IsHostMessagingBrowserL() || !MPXTlsHelper::NeedSave() ) );
+            aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, isListEmpty );
+
+            break;
+            }
+        case R_MPX_PLAYBACK_COLLECTION_MUSICSHOP_SUB_MENU:
+        	{
+        	aMenuPane->SetItemTextL(EMPXCmdGoToOperatorMusicShop,  iOperatorMusicStoreName->Des() );
+        	break;
+        	}
+        case R_AVKON_MENUPANE_MARKABLE_LIST:
+            {
+            // Mark/Unmark submenu is displayed only if USB is on going
+            if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive)
+                {
+                MPX_DEBUG1("CMPXCollectionViewImp::DynInitMenuPaneL() dimmed Mark/Unmark submenu");
+                aMenuPane->SetItemDimmed(EAknCmdEditListMenu, ETrue);
+                }
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        } 
+   
+
+		if ( iServiceHandler->IsAiwMenu(aResourceId) && aResourceId == R_MPX_USE_AS_CASCADE )
+            {
+            MPX_DEBUG1( "CMPXCollectionViewImp::DynInitMenuPaneL(): Aiw menu for assign" );
+            CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+            FillAiwParametersL(paramList);
+            iServiceHandler->InitializeMenuPaneL(*aMenuPane,
+                                                aResourceId,
+                                                EMPXCmdAiwCmdAssign,
+                                                paramList);
+            MPX_DEBUG1( "CMPXCollectionViewImp::DynInitMenuPaneL(): Aiw menu for assign end" );
+            }
+
+
+    if (!(aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST && usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive))
+        {
+        // Custom handling of menu pane for markable lists
+        iContainer->Common()->HandleMarkableListDynInitMenuPane(
+            aResourceId,
+            aMenuPane );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikListBoxObserver
+// Handles listbox events.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleListBoxEventL(
+    CEikListBox* /*aListBox*/,
+    TListBoxEvent aEventType)
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleListBoxEventL" );
+    MPX_DEBUG2( "CMPXCollectionViewImp::HandleListBoxEventL iLastDepth = %d", iLastDepth );
+    MPX_PERF_CHECKPT( "Select collection item to open" );
+    if ( iContainer )
+        {
+        //to keep/change focus on right song in rename/remove
+        if ( aEventType == EEventItemClicked )
+            {
+            if ( !iHandlingKeyEvent && iCollectionCacheReady )
+                {
+                CMPXCommonListBoxArrayBase* listboxArray( iContainer->Common()->ListBoxArray() );
+                TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() );
+    
+                CMPXCommand* command = CMPXCommand::NewL();
+                CleanupStack::PushL( command );
+                command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId,
+                                                          KMPXCommandIdCollectionSelect );
+                command->SetTObjectValueL( KMPXCommandCollectionSelectIndex, currentIndex );
+                command->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+                iCollectionUtility->Collection().CommandL( *command );
+                CleanupStack::PopAndDestroy( command );
+                }
+            }
+        
+        if ( aEventType == EEventEnterKeyPressed || aEventType == EEventItemDoubleClicked )
+            {
+            if ( iContainer->IsInReorderMode() )
+                {
+                ProcessCommandL( iContainer->IsInReorderMode() ?
+                    EMPXCmdReorderDrop : EMPXCmdReorderGrab );
+                iIsGrabbed = !iIsGrabbed;
+                }
+            else if ( !iHandlingKeyEvent )
+                {
+                TMPXPlaybackState pbState( iPlaybackUtility->StateL() );
+                TBool isEqual( EFalse );
+                if ( pbState == EPbStatePlaying || pbState == EPbStatePaused )
+                    {
+                    // in currently playing view, check if current item is playing
+                    if ( iContainer->Common()->CurrentLbxItemIndex() ==
+                        iContainer->PlaybackIndex() )
+                        {
+                        isEqual = ETrue;
+                        }
+                    }
+    
+                if ( isEqual )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewImp::HandleListBoxEventL going to now playing view" );
+                    if ( pbState == EPbStatePaused )
+                        {
+                        MPX_DEBUG1( "CMPXCollectionViewImp::HandleListBoxEventL resuming playback" );
+                        iPlaybackUtility->CommandL( EPbCmdPlay );
+                        }
+                    HandleCommandL( EMPXCmdGoToNowPlaying );
+                    }
+                else
+                    {
+                    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+                    CleanupStack::PushL( cpath );
+                    if ( cpath->Levels() == ( iLastDepth + 1 ) )
+                        {
+                        // navigated in one level
+                        iLastDepth++;
+                        iBottomIndex->AppendL(
+                            iContainer->Common()->BottomLbxItemIndex() );
+                        }
+                    else
+                        {
+                        // invalid path, rebuild with all 0
+                        iBottomIndex->Reset();
+                        iLastDepth = cpath->Levels();
+                        for ( TInt i = 0; i < iLastDepth; i++ )
+                            {
+                            iBottomIndex->AppendL( 0 );
+                            }
+                        }
+                    CleanupStack::PopAndDestroy( cpath );
+                    TInt currentItem( iContainer->Common()->CurrentLbxItemIndex() );
+                    MPX_DEBUG2( "CMPXCollectionViewImp::HandleListBoxEventL Opening Item: %d", currentItem );
+    
+                    iHandlingKeyEvent = ETrue;
+    
+                    // Needed to reset the status of iPreservedState
+                    if ( EPbStateStopped == pbState )
+                        {
+                        iPlaybackUtility->CommandL(EPbCmdResetPreserveState);
+                        }
+    
+    #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+                    // check to see if user has selected podcast item
+                    if ( (iLastDepth == KMusicCollectionMenuLevel) &&
+                         (currentItem == KMusicMenuPodcastMenuItemIndex) &&
+                         !iDisablePodcasting )
+                        {
+                        // open the podcast collection db plugin
+                        iPodcast = ETrue;
+                        CMPXCollectionPath* mainPodcastMenu = CMPXCollectionPath::NewL();
+                        CleanupStack::PushL( mainPodcastMenu );
+                        mainPodcastMenu->AppendL(KPodcastCollectionUid);
+                        iCollectionUtility->Collection().OpenL( *mainPodcastMenu );
+						iFirstIncrementalBatch = ETrue;
+                        CleanupStack::PopAndDestroy( mainPodcastMenu );
+    
+                        // activate the podcast collection view
+                        RArray<TUid> uids;
+                        CleanupClosePushL( uids );
+                        uids.AppendL( TUid::Uid( KMPXPluginTypeCollectionUid ) );
+                        uids.AppendL( TUid::Uid( KPodcastCollectionUid ));
+                        iViewUtility->ActivateViewL(uids);
+    
+                        CleanupStack::PopAndDestroy( &uids );
+                        }
+                    else
+    #endif
+                        {
+                        if(iCollectionCacheReady)
+                            {
+                            CMPXCommonListBoxArrayBase* listboxArray( iContainer->Common()->ListBoxArray() );
+                            TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() );
+                            const CMPXMedia& media( listboxArray->MediaL( currentIndex ) );
+                            TMPXGeneralType type(
+                                media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+                            TMPXGeneralCategory category(
+                                media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+                            if ( type != EMPXItem || category != EMPXSong )
+                                {
+                                if ( type == EMPXGroup && category== EMPXSong )
+                                    {
+                                    // dismiss for HGList
+                                    //StartWaitNoteL( EMPXImmediatelyOpeningNote );
+                                    }
+                                else
+                                    {
+                                    //do not show wait note if opening a song
+                                    // dismiss for HGList
+                                    //StartWaitNoteL( EMPXOpeningNote );
+                                    }
+                                }
+                            iCollectionUtility->Collection().OpenL( currentItem );
+							iFirstIncrementalBatch = ETrue;
+                            }
+                        }
+    
+                    }
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXCollectionViewImp::HandleListBoxEventL Busy, ignoring command" );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikCommandObserver
+// Processes user commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::ProcessCommandL(TInt aCommandId)
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::ProcessCommandL" );
+
+    switch( aCommandId )
+        {
+        case EMPXCmdReorderDrop:
+            {
+            SaveCurrentPlaylistL();
+            iContainer->ConfirmReorderL();
+            DeactivateReorderGrabbedModeL( EFalse );
+            SetNewCbaL( R_MPX_CUI_REORDER_GRAB_DONE_CBA );
+            break;
+            }
+        case EMPXCmdReorderGrab:
+            {
+            SetNewCbaL( R_MPX_CUI_REORDER_DROP_CANCEL_CBA );
+            ActivateReorderGrabbedModeL();
+            break;
+            }
+        case EMPXCmdReorderCancel:
+            {
+            iCurrentHighlightedIndex = iContainer->GetOriginalIndex();
+            MPX_DEBUG2( "CMPXCollectionViewImp::ProcessCommandL Setting iCurrentHighlightedIndex = %d", iCurrentHighlightedIndex );
+            iContainer->CancelReorder();
+            } // Fall through on purpose
+        case EMPXCmdReorderDone:
+            {
+            DeactivateReorderGrabbedModeL( ETrue );
+            break;
+            }
+        case EMPXCmdUpArrow:
+            {
+            iIgnoreNextFocusChangedMessage = ETrue;
+            if ( iContainer->IsInReorderMode() )
+                {
+                iContainer->MoveReorderIndex( KMPXDirectionUp );
+                }
+            else
+                {
+                iDownCount = 0;
+
+                if( iUpCount != KErrNotFound )
+                    {
+                    if( iUpCount++ > KIncrementalDirectionCount )
+                        {
+                        iIncrementalOpenUtil->SetDirection( CMPXCollectionOpenUtility::EFetchUp );
+                        iUpCount = KErrNotFound;
+                        }
+                    }
+                }
+            break;
+            }
+        case EMPXCmdDownArrow:
+            {
+            iIgnoreNextFocusChangedMessage = ETrue;
+            if ( iContainer->IsInReorderMode() )
+                {
+                iContainer->MoveReorderIndex( KMPXDirectionDown );
+                }
+            else
+                {
+                iUpCount = 0;
+
+                if( iDownCount != KErrNotFound )
+                    {
+                    if( iDownCount++ > KIncrementalDirectionCount  )
+                        {
+                        iIncrementalOpenUtil->SetDirection( CMPXCollectionOpenUtility::EFetchDown );
+                        iDownCount = KErrNotFound;
+                        }
+
+                    }
+                }
+            break;
+            }
+        case EMPXCmdCommonEnterKey:
+            {
+            // Handle list box event for enter key pressed
+            TInt index( iContainer->Common()->CurrentLbxItemIndex() );
+            if( index >= 0 )
+            	{
+                HandleListBoxEventL(
+            	    NULL, // ignore
+            	    EEventEnterKeyPressed );
+            	}
+            break;
+            }
+        case EMPXCmdUpArrowAfterListboxHandled:
+            {
+            if ( iContainer->IsInReorderMode() )
+                {
+                TInt index( iContainer->Common()->CurrentLbxItemIndex() );
+                if ( index == iContainer->Common()->CurrentListItemCount() - 1 )
+                    {
+                    // if after up arrow is pressed, and end up at the
+                    // lowest index.  list box looped, sync with listboxarray needed
+                    iContainer->SetReorderIndex( index );
+                    iContainer->Common()->HandleLbxItemAdditionL();
+                    // need to set index and redraw
+                    iContainer->Common()->SetLbxCurrentItemIndexAndDraw( index );
+                    }
+                UpdateReorderNaviPaneL();
+                }
+            break;
+            }
+        case EMPXCmdDownArrowAfterListboxHandled:
+            {
+            if ( iContainer->IsInReorderMode() )
+                {
+                TInt index( iContainer->Common()->CurrentLbxItemIndex() );
+                if ( index == 0 )
+                    {
+                    // if after down arrow is pressed, and end up at the
+                    // top index.  list box looped, sync with listboxarray needed
+                    iContainer->SetReorderIndex( index );
+                    iContainer->Common()->HandleLbxItemAdditionL();
+                    }
+                UpdateReorderNaviPaneL();
+                }
+            break;
+            }
+        case EMPXCmdCommonDelete:
+            {
+            if ( !iIsEmbedded )
+                {
+                StoreListboxItemIndexL();
+                // embedded mode doesn't support delete key
+                DeleteSelectedItemsL(aCommandId);
+                }
+            break;
+            }
+        case EMPXCmdCommonResourceChange:
+            {
+            iContainer->Common()->CoeControl()->SetRect( ClientRect() );
+            break;
+            }
+        case EAknSoftkeyEmpty:
+            {
+            // do nothing.  handled to avoid "unsupported" message
+            break;
+            }
+#ifdef __ENABLE_MSK
+        case EMPXCmdCommonUpdateMiddleSoftKey:
+            {
+            // Determine middle soft key labeling
+            UpdateMiddleSoftKeyDisplayL( iCurrentMskId );
+            break;
+            }
+        case EAknSoftkeyContextOptions :
+            {
+            // set context menu flag
+            iShowContextMenu = ETrue;
+            // open context menu (by processing "Options" command)
+            if ( iContainer )
+                {
+                iSelectionIndexCache = iContainer->Common()->CurrentSelectionIndicesL(); // not owned
+                MPX_DEBUG2( "CMPXCollectionViewImp::ProcessCommandL count = %d", iSelectionIndexCache->Count() );
+                }
+            CAknView::ProcessCommandL( EAknSoftkeyOptions );
+            break;
+            }
+#endif // __ENABLE_MSK
+        case EAknCmdExit:
+			{
+            HandleCommandL( aCommandId );
+			CAknView::ProcessCommandL( aCommandId );
+			break;
+			}
+		case EAknSoftkeyOptions:
+            {
+            if ( iContainer )
+                {
+                iSelectionIndexCache = iContainer->Common()->CurrentSelectionIndicesL(); // not owned
+                MPX_DEBUG2( "CMPXCollectionViewImp::ProcessCommandL count = %d", iSelectionIndexCache->Count() );
+                }
+            }
+        default:
+            {
+            CAknView::ProcessCommandL( aCommandId );
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::LaunchMusicShopL
+// Launch music shop application
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::LaunchMusicShopL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::LaunchMusicShopL" );
+
+    if ( iMusicStoreUID != 0)
+        {
+    TApaTaskList tasList( iCoeEnv->WsSession() );
+        TApaTask task = tasList.FindApp( TUid::Uid(iMusicStoreUID) );
+
+    if ( task.Exists() )
+        {
+        task.BringToForeground();
+        }
+    else
+        {
+        RApaLsSession session;
+        if ( KErrNone == session.Connect() )
+            {
+            CleanupClosePushL( session );
+            TThreadId threadId;
+                session.CreateDocument( KNullDesC, TUid::Uid(iMusicStoreUID), threadId );
+            CleanupStack::PopAndDestroy(&session);
+                }
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPlayerCategoryView::DoFindInMusicShopL
+// Handle find in music shop event
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoFindInMusicShopL( const TDesC& aSongName,
+                                                const TDesC& aArtistName,
+                                                const TDesC& aAlbumName )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoFindInMusicShopL" );
+    CMPXFindInMShop* finder = CMPXFindInMShop::NewL();
+    CleanupStack::PushL( finder );
+    HBufC* url = NULL;
+    url = finder->CreateSearchURLL( aSongName,
+                                     aArtistName,
+                                     aAlbumName,
+                                     KNullDesC,     // Composer - Not used
+                                     KNullDesC );   // Genre - Not used
+    CleanupStack::PushL(url);   // the pointer will be poped
+    RProperty::Set( TUid::Uid(iMusicStoreUID),
+                    KMShopCategoryId,
+                    KFindInMShopKeyValid );  // Set Key to Valid
+
+    RProperty::Set( TUid::Uid(iMusicStoreUID),
+                    KMShopCategoryName,
+                    *url );
+
+    LaunchMusicShopL();
+
+
+    if(url)
+        {
+        CleanupStack::PopAndDestroy(url);
+        }
+
+    CleanupStack::PopAndDestroy( finder ); // finder
+    REComSession::FinalClose();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CMPXCollectionViewImp::SetParamL
+// Set the parameter passed in from viewframework to the current select index
+// ----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::SetParamL( const TDesC* aParam )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::SetParamL" );
+    delete iCurrentSelectedIndex;
+    iCurrentSelectedIndex = NULL;
+    iCurrentSelectedIndex = aParam->AllocL();    //  aParam = L"0" for 1st item
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPlayerCategoryView::DoGetSongMediaPropertyL
+// Handle find in music shop event
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::DoGetSongMediaPropertyL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::DoGetSongMediaPropertyL" );
+
+    if ( iCurrentSelectedIndex )
+        {
+        TLex currentSelectedIndexLex( iCurrentSelectedIndex->Des() );
+        TInt lexToInt = NULL;
+        if ( currentSelectedIndexLex.Val( lexToInt ) == KErrNone )
+            {
+            // Get media property for the current song
+            CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( cpath );
+
+            cpath->Set( lexToInt );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            // to get EMPXMediaGeneralTitle
+            attrs.Append( KMPXMediaGeneralTitle );
+            // to get EMPXMediaMusicArtist and EMPXMediaMusicAlbum
+            attrs.Append( KMPXMediaMusicArtist );
+            attrs.Append( KMPXMediaMusicAlbum );
+
+            // Call MediaL and handle callback at HandleCollectionMediaL
+            iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PopAndDestroy( cpath );
+            }
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::HandleFindAllL
+// Handle callback for "find" operation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleFindAllL(
+    const CMPXMedia& aResults,
+    TBool aComplete,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleFindAllL" );
+    if ( aError == KErrNone )
+        {
+        switch ( iCurrentFindAllLOp )
+            {
+            case EMPXOpFindAllLAlbumArtistAddToNewPlaylist:
+                {
+                iNumSongAddedToPlaylist = aResults.ValueTObjectL<TInt>(
+                    KMPXMediaArrayCount );
+                TBool ret = iCommonUiHelper->CreatePlaylistL(
+                    aResults, this, this );
+                if ( !ret )
+                    {
+                    iAddingToNewPlaylist = EFalse;
+                    }
+                break;
+                }
+            case EMPXOpFindAllLAlbumArtistAddToSavedPlaylist:
+                {
+                if ( !iUserPlaylists )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewImp::HandleFindAllL Null iUserPlaylists" );
+                    User::Leave( KErrArgument );
+                    }
+                iNumSongAddedToPlaylist = aResults.ValueTObjectL<TInt>(
+                    KMPXMediaArrayCount );
+                MPX_TRAPD( err, iCommonUiHelper->AddToSavedPlaylistL(
+                    *iUserPlaylists, aResults, this, this ) );
+                if ( err != KErrNone )
+                    {
+                    HandleError( err );
+                    }
+                break;
+                }
+            case EMPXOpFindAllLRenameAlbum:
+            case EMPXOpFindAllLRenameArtist:
+            case EMPXOpFindAllLRenameGenre:
+            case EMPXOpFindAllLRenameComposer:
+                {
+                const CMPXMediaArray* mediaArray =
+                    aResults.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+                User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+                
+                iSetMediaLCount = mediaArray->Count();
+                iInvalidFileExist = EFalse;
+                TInt invalidItemCount( 0 );
+                MPX_DEBUG2( "CMPXCollectionViewImp::HandleFindAllL Rename song count = %d", iSetMediaLCount );
+                iIsWaitNoteCanceled = EFalse;
+                HBufC* waitNoteString( NULL );
+                if ( iSetMediaLCount > 1 )
+                    {
+                    // multiple item
+                    waitNoteString = StringLoader::LoadLC(
+                        R_MPX_COLLECTION_NOTE_UPDATING_MULTIPLE_ITEMS,
+                        iSetMediaLCount );
+                    }
+                else
+                    {
+                    // single item
+                    waitNoteString = StringLoader::LoadLC(
+                        R_MPX_COLLECTION_NOTE_UPDATING_ITEM );
+                    }
+                HandleCommandL( EMPXCmdIgnoreExternalCommand );
+                iCommonUiHelper->ShowWaitNoteL( *waitNoteString,
+                    R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP, EFalse, this );
+                CleanupStack::PopAndDestroy( waitNoteString );
+
+                TPtrC art( KNullDesC );
+                if ( (iCurrentFindAllLOp == EMPXOpFindAllLRenameAlbum || iCurrentFindAllLOp == EMPXOpFindAllLRenameArtist )&&
+                        iContainer )
+                    {
+                    CMPXCommonListBoxArrayBase* listboxArray(
+                        iContainer->Common()->ListBoxArray() );
+                    TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() );
+                    const CMPXMedia& currentMedia( listboxArray->MediaL( currentIndex ) );
+                    if ( currentMedia.IsSupported( KMPXMediaMusicAlbumArtFileName ) )
+                        {
+                        art.Set( currentMedia.ValueText( KMPXMediaMusicAlbumArtFileName ) );
+                        }
+                    }
+
+                CMPXMediaArray* entryArray = CMPXMediaArray::NewL();
+                CleanupStack::PushL( entryArray );
+                TUid collectionId( KNullUid );
+                for ( TInt i = 0; i < iSetMediaLCount && !iIsWaitNoteCanceled; i++ )
+                    {
+                    CMPXMedia* media( mediaArray->AtL( i ) );
+                    TUint flags( 0 );
+                    if( media->IsSupported( KMPXMediaGeneralFlags ) )
+                        {
+                        flags = media->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+                        }
+                    const TDesC& songUri =
+                        media->ValueText( KMPXMediaGeneralUri );
+                    TBool fileExist( ConeUtils::FileExists( songUri ) );
+                    if (!(flags & KMPXMediaGeneralFlagsIsInvalid)
+                     && !(flags & KMPXMediaGeneralFlagsIsCorrupted)
+                     && fileExist )
+                        {
+                        CMPXMedia* entry = CMPXMedia::NewL();
+                        CleanupStack::PushL( entry );
+                        entry->SetTextValueL( KMPXMediaGeneralUri, songUri );
+                        TMPXItemId id( media->ValueTObjectL<TMPXItemId>(
+                                        KMPXMediaGeneralId ) );
+                        collectionId = media->ValueTObjectL<TUid>(
+                                             KMPXMediaGeneralCollectionId );
+                        entry->SetTObjectValueL<TMPXItemId>(
+                            KMPXMediaGeneralId, id );
+                        entry->SetTObjectValueL<TUid>(
+                            KMPXMediaGeneralCollectionId, collectionId );
+                        entry->SetTObjectValueL<TMPXGeneralType>(
+                            KMPXMediaGeneralType, EMPXItem );
+                        entry->SetTObjectValueL<TMPXGeneralCategory>(
+                            KMPXMediaGeneralCategory, EMPXSong );
+
+                        TPtrC ptr( songUri );
+                        MPX_DEBUG3( "CMPXCollectionViewImp::HandleFindAllL setting item id 0x%x, uri %S", id.iId1, &ptr );
+                        switch ( iCurrentFindAllLOp )
+                            {
+                            case EMPXOpFindAllLRenameAlbum:
+                                {
+                                if ( art.Compare( KNullDesC ) != 0 &&
+                                        art.Compare( 
+                                            media->ValueText( KMPXMediaMusicAlbumArtFileName ) ) == 0 )
+                                    {
+                                    entry->SetTextValueL(
+                                        KMPXMediaMusicAlbumArtFileName,
+                                        art );
+                                    }
+                                entry->SetTextValueL(
+                                    KMPXMediaMusicAlbum, *iNewName );
+                                break;
+                                }
+                            case EMPXOpFindAllLRenameArtist:
+                                {
+                                if ( art.Compare( KNullDesC ) != 0 &&
+                                        art.Compare( 
+                                            media->ValueText( KMPXMediaMusicAlbumArtFileName ) ) == 0 )
+                                    {
+                                    entry->SetTextValueL(
+                                        KMPXMediaMusicAlbumArtFileName,
+                                        art );
+                                    }
+                                entry->SetTextValueL(
+                                    KMPXMediaMusicArtist, *iNewName );
+                                break;
+                                }
+                            case EMPXOpFindAllLRenameGenre:
+                                {
+                                entry->SetTextValueL(
+                                    KMPXMediaMusicGenre, *iNewName );
+                                break;
+                                }
+                            case EMPXOpFindAllLRenameComposer:
+                                {
+                                entry->SetTextValueL(
+                                    KMPXMediaMusicComposer, *iNewName );
+                                break;
+                                }
+                            default:
+                                {
+                                // should not reach here
+                                ASSERT( 0 );
+                                break;
+                                }
+                            }
+                        if ( (iCurrentFindAllLOp == EMPXOpFindAllLRenameAlbum || iCurrentFindAllLOp == EMPXOpFindAllLRenameArtist) &&
+                                art.Compare( KNullDesC ) != 0 &&
+                                art.Compare( 
+                                    media->ValueText( KMPXMediaMusicAlbumArtFileName ) ) == 0 )
+                            {
+                            entryArray->InsertL( entry, 0 );  // ownership xfer
+                            }
+                        else
+                            {
+                            entryArray->AppendL( entry );  // ownership xfer
+                            }
+                        CleanupStack::Pop( entry );
+                        }
+                    else
+                        {
+                        iInvalidFileExist = ETrue;
+                        invalidItemCount++;
+                        if ( !fileExist )
+                            {
+                            UpdateDatabaseFlagL( KErrNotFound, *media,
+                                KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse );
+                            }
+                        }
+                    }
+                // Package array of items to set
+                //
+                CMPXMedia* setData = CMPXMedia::NewL();
+                CleanupStack::PushL( setData );
+                setData->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup );
+                setData->SetCObjectValueL( KMPXMediaArrayContents, entryArray );
+
+                // Generate the command
+                //
+                CMPXCommand* command = CMPXCommand::NewL();
+                CleanupStack::PushL( command );
+                command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId,
+                                                          KMPXCommandIdCollectionSet );
+                command->SetTObjectValueL<TInt>( KMPXCommandGeneralCollectionId,
+                                                 collectionId.iUid);
+                command->SetCObjectValueL( KMPXCommandColSetMedia, setData );
+
+                iCollectionUtility->Collection().CommandL( *command );
+
+                // Cleanup
+                CleanupStack::PopAndDestroy( command );
+                CleanupStack::PopAndDestroy( setData );
+                CleanupStack::PopAndDestroy( entryArray );
+
+                iSetMediaLCount = 1;  // 1 async set
+                MPX_DEBUG3( "CMPXCollectionViewImp::HandleFindAllL valid items = %d, invalid items = %d", iSetMediaLCount, invalidItemCount );
+                if ( iSetMediaLCount == 0 )
+                    {
+                    // if all items are invalid, display note
+                    // now instead of waiting for callback
+                    HandleRenameOpCompleteL();
+                    }
+                break;
+                }
+            case EMPXOpFindAllLPlaylistTracksCount:
+                {
+                TInt trackCount = aResults.ValueTObjectL<TInt>( KMPXMediaArrayCount );
+                MPX_DEBUG2( "CMPXCollectionViewImp:: playlist tracks count = %d", trackCount );
+                if ( trackCount == 0 )
+                    {
+                    // empty playlist, display info note
+                    HBufC* string = StringLoader::LoadLC(
+                        R_MPX_COLLECTION_NOTE_EMPTY_PLAYLIST );
+                    iCommonUiHelper->DisplayInfoNoteL( *string );
+                    CleanupStack::PopAndDestroy( string );
+                    }
+                else
+                    {
+                    HandleCommandL( EMPXCmdForcePlay );
+                    }
+                break;
+                }
+            case EMPXOpFindAllLUpnp:
+                {
+                if ( iUpnpFrameworkSupport )
+                    {
+                    DoHandleCopyToRemoteL( aResults, aComplete );
+                    }
+                break;
+                }
+            case EMPXOpFindAllLUpnpPlayback:
+                {
+                if ( iUpnpFrameworkSupport )
+                    {
+                    TInt trackCount = aResults.ValueTObjectL<TInt>( KMPXMediaArrayCount );
+                    MPX_DEBUG2( "CMPXCollectionViewImp:: playlist tracks count = %d", trackCount );
+                    if ( trackCount > 0 )
+                        {
+                        TInt currentListBoxItemIndex(
+                            iContainer->Common()->CurrentLbxItemIndex() );
+                        if ( currentListBoxItemIndex >= 0 )
+                            {
+                            GetCurrentPlayerDetails();
+
+                            // Needed to reset the status of iPreservedState
+                            if ( EPbStateStopped == iPlaybackUtility->StateL() )
+                                {
+                                iPlaybackUtility->CommandL(EPbCmdResetPreserveState);
+                                }
+                            if(iCollectionCacheReady)
+                                {
+                                iCollectionUtility->Collection().OpenL(
+                                                currentListBoxItemIndex,
+                                                EMPXOpenPlaylistOnly);
+								iFirstIncrementalBatch = ETrue;
+                                }
+                            }
+                        }
+                    else
+                        {
+                        // empty playlist, display info note
+                        HBufC* string = StringLoader::LoadLC(
+                            R_MPX_COLLECTION_NOTE_EMPTY_PLAYLIST );
+                        iCommonUiHelper->DisplayInfoNoteL( *string );
+                        CleanupStack::PopAndDestroy( string );
+                        }
+                    }
+                break;
+                }
+            default:
+                {
+                // should not reach here
+                break;
+                }
+            }
+        }
+    else
+        {
+        HandleError( aError );
+        }
+    iCurrentFindAllLOp = EMPXOpFindAllLIdle;
+
+    if ( !iUpnpFrameworkSupport )
+        {
+        // Remove compilation warnings
+        (void)aComplete;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::HandleViewActivation
+// Handle view activation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleViewActivation(
+    const TUid& aCurrentViewType,
+    const TUid& /*aPreviousViewType*/ )
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::HandleViewActivation" );
+
+    if ( aCurrentViewType.iUid == KMPXPluginTypeCollectionUid )
+        {
+        if( iAddingSong )
+            {
+            iAddingSong = EFalse;
+            TRAP_IGNORE( GetDurationL() );
+            TRAP_IGNORE( UpdateNaviPaneL() );
+            }
+        if( iInAlbumArtDialog )
+            {
+            iInAlbumArtDialog = EFalse;
+            TRAP_IGNORE( UpdateTitlePaneL() );
+            }
+        if( iInSongDetails )
+            {
+            iInSongDetails = EFalse;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::HandleViewUpdate
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleViewUpdate(
+    TUid /* aViewUid */,
+    MMPXViewActivationObserver::TViewUpdateEvent /* aUpdateEvent */,
+    TBool /* aLoaded */,
+    TInt /* aData */)
+    {
+    // Do nothing, this should be handled by the AppUI
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::HandleViewActivation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleViewActivation(const TVwsViewId& aNewlyActivatedViewId,
+                                                 const TVwsViewId& /*aViewIdToBeDeactivated */)
+    {
+    if( aNewlyActivatedViewId.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) &&
+        aNewlyActivatedViewId.iViewUid == Id() )
+        {
+        TRAP_IGNORE( UpdateNaviPaneL() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::HandleViewDeactivation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,
+                                                   const TVwsViewId& /*aNewlyActivatedViewId*/)
+    {
+    if( aViewIdToBeDeactivated.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) &&
+        aViewIdToBeDeactivated.iViewUid == Id() )
+        {
+        if( iContainer )
+            {
+            if ( iNaviPane && iNaviDecorator )
+                {
+                if (iNaviPane->Top() == iNaviDecorator) // Only pop if it's the top, don't pop when it's behind a dialog
+                    iNaviPane->Pop( iNaviDecorator );
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::FillAiwParameters
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::FillAiwParametersL(
+    CAiwGenericParamList& aParamList )
+    {
+    CMPXCommonListBoxArrayBase* array( iContainer->Common()->ListBoxArray() );
+    const CMPXMedia& media = array->MediaL(
+        iContainer->Common()->CurrentLbxItemIndex() );
+    TPtrC location( media.ValueText(KMPXMediaGeneralUri) );
+    TPtrC mimeType( media.ValueText(KMPXMediaGeneralMimeType) );
+
+    if ( !location.Length() )
+        {
+        if ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
+            {
+            // highlighted item is not yet available
+            MPX_DEBUG1( "CMPXCollectionViewImp::FillAiwParametersL item not yet fetched" );
+            User::Leave( KMPXErrDataNotReady );
+            }
+        else
+            {
+            TMPXItemId id(
+                    media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+            CMPXMedia* criteria = CMPXMedia::NewL();
+            CleanupStack::PushL( criteria );
+            criteria->SetTObjectValueL<TMPXGeneralType>(
+                KMPXMediaGeneralType, EMPXItem );
+            criteria->SetTObjectValueL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory, EMPXSong );
+            criteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL( attrs );
+            attrs.Append( KMPXMediaGeneralUri );
+            attrs.Append( KMPXMediaGeneralMimeType );
+
+            CMPXMedia* songInfo = iCollectionUtility->Collection().FindAllL( *criteria,
+                                                             attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PushL( songInfo );
+
+            const CMPXMediaArray* mediaArray(
+                songInfo->Value<CMPXMediaArray>( KMPXMediaArrayContents ) );
+            User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+            
+            if ( mediaArray->Count() > 0 )
+                {
+                CMPXMedia* si( mediaArray->AtL( 0 ) );
+                location.Set( si->ValueText(KMPXMediaGeneralUri) );
+                mimeType.Set( si->ValueText(KMPXMediaGeneralMimeType) );
+                }
+            CleanupStack::PopAndDestroy( songInfo );
+            CleanupStack::PopAndDestroy( criteria );
+            }
+        }
+
+    TAiwVariant varMime(mimeType);
+    if ( !mimeType.Length() && ( iMediaRecognizer ) )
+        {
+        varMime.Set(iMediaRecognizer->MimeTypeL(location));
+        }
+    TAiwGenericParam paramMime(EGenericParamMIMEType, varMime);
+    aParamList.Reset();
+    aParamList.AppendL(paramMime);
+    TAiwVariant varFile(location);
+    TAiwGenericParam paramFile(EGenericParamFile, varFile);
+    aParamList.AppendL(paramFile);
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::GetUint32Presentation
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::GetUint32Presentation( TUint32& aResult,
+                                                   const TDesC8& aBuf,
+                                                   TInt aOffset )
+    {
+    aResult = 0;
+    const TInt KProEngByteLength( 8 );
+    const TInt length( aBuf.Length() );
+    const TInt maxBitShift( KProEngByteLength * ( length - 1 ) );
+
+    for( TInt i( 0 ); i<length; ++i )
+        {
+        aResult |= ( aBuf[aOffset + i] <<
+                   ( maxBitShift - ( KProEngByteLength * i ) ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::LaunchMusicShopL
+// Launch music shop application
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::LaunchOperatorJavaMusicShopL(TUid aUid)
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::LaunchOperatorMusicShopL" );  
+    TThreadId threadId;
+    RApaLsSession apaSession;
+    User::LeaveIfError( apaSession.Connect() );
+    CleanupClosePushL( apaSession );
+    apaSession.StartDocument(_L(""), aUid, threadId);
+    CleanupStack::PopAndDestroy(); // close apaSession
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::LaunchMusicShopL
+// Launch music shop application
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::LaunchOperatorNativeMusicShopL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::LaunchMusicShopL" );  
+    
+    TApaTaskList tasList( iCoeEnv->WsSession() );
+    TApaTask task = tasList.FindApp( TUid::Uid(iOperatorNativeMusicStoreUID) );
+
+    if ( task.Exists() )
+        {
+        task.BringToForeground();
+        }
+    else
+        {
+        RApaLsSession session;
+        if ( KErrNone == session.Connect() )
+            {
+            CleanupClosePushL( session );
+            TThreadId threadId;
+            session.CreateDocument( KNullDesC, TUid::Uid(iOperatorNativeMusicStoreUID), threadId );
+            CleanupStack::PopAndDestroy(&session);
+            }
+        }
+    }
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::LaunchOperatorURLMusicShopL
+// Launch music shop URL application
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::LaunchOperatorURLMusicShopL()
+    {
+    MPX_FUNC( "CMPXCollectionViewImp::LaunchOperatorURLMusicShopL" );
+    const TUid KOSSBrowserUidValue = {0x10008D39}; // 0x1020724D for S60 3rd Ed
+    TUid id(KOSSBrowserUidValue);
+    TApaTaskList taskList(CEikonEnv::Static()->WsSession());
+    TApaTask task = taskList.FindApp(id);
+    
+    if ( task.Exists() )
+        {
+        task.BringToForeground();
+        if ( iOperatorMusicStoreURI->Length() != NULL )
+            {
+            TBuf8<KMPXMaxHistoryLength> tempUrl;
+            tempUrl.Copy(iOperatorMusicStoreURI->Des());
+            task.SendMessage(TUid::Uid(0), tempUrl);
+            }
+        }
+    else
+        {
+        RApaLsSession apaLsSession;
+        if ( KErrNone == apaLsSession.Connect() )
+            {
+            CleanupClosePushL( apaLsSession );
+            TThreadId threadId;
+
+ 			apaLsSession.StartDocument(*iOperatorMusicStoreURI, KOSSBrowserUidValue, threadId);
+         	CleanupStack::PopAndDestroy(&apaLsSession);
+            }
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::StoreListboxItemIndexL
+// Stores the current list box item index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewImp::StoreListboxItemIndexL()
+	{
+    TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() );
+
+	CMPXCommand* command = CMPXCommand::NewL();
+	CleanupStack::PushL( command );
+	command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId,
+											  KMPXCommandIdCollectionSelect );
+	command->SetTObjectValueL( KMPXCommandCollectionSelectIndex, currentIndex );
+	command->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+	iCollectionUtility->Collection().CommandL( *command );
+	CleanupStack::PopAndDestroy( command );
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionview/src/mpxcollectionviewlistboxarray.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1129 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listbox array for collection view container
+*
+*/
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include <gulicon.h>
+#include <AknsSkinInstance.h>
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <aknconsts.h>
+#include <AknIconArray.h>
+#include <avkon.mbg>
+#include <f32file.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxmedia.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediaarray.h>
+#include <mpxlog.h>
+#include <mpxcollectionview.mbg>
+#include <mpxcollectionpath.h>  // TMPXItemId
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxcollectionview.rsg>
+#include <mpxuser.h>
+
+#include <mpxcommonuihelper.h>
+#include "mpxcollectionview.hrh"
+#include "mpxcommoncontainer.hrh"
+#include "mpxcommonlistboxarrayobserver.h"
+#include "mpxcollectionviewlistboxarray.h"
+
+// CONSTANTS
+_LIT( KMPXCommonListboxFormatString, "%d\t%S" );
+_LIT( KMPXTab, "\t" );
+_LIT( KMPXCollectionViewIconFile, "mpxcollectionview.mbm" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewListBoxArray* CMPXCollectionViewListBoxArray::NewL()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::NewL" );
+    CMPXCollectionViewListBoxArray* self =
+        new ( ELeave ) CMPXCollectionViewListBoxArray();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::CMPXCollectionViewListBoxArray
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXCollectionViewListBoxArray::CMPXCollectionViewListBoxArray() :
+    CMPXCommonListBoxArrayBase()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CMPXCollectionViewListBoxArray::~CMPXCollectionViewListBoxArray()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::~CMPXCollectionViewListBoxArray" );
+    delete iUnknown;
+    delete iMediaOwned;
+    }
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::ConstructL()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::ConstructL" );
+    iUnknown = StringLoader::LoadL(R_MPX_QTN_MP_UNKNOWN );
+    iMMCDrive = CMPXCommonUiHelper::MMCDriveNumber();
+    }
+
+// ---------------------------------------------------------------------------
+// Sets playback status
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewListBoxArray::SetPlaybackStatusByIdL(
+    TMPXItemId aId, TMPXPlaybackState aStatus, TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::SetPlaybackStatusByIdL" );
+    // fix crash when click back too quick after play a song
+    // aIndex < 0 means no icon to place, iMedia->Count() == 0 means no song, don't search
+    if ( iMedia == NULL || aIndex < 0 || iMedia->Count() == 0)
+        {
+        return SetPlaybackStatusByIndex( KErrNotFound, aStatus );
+        }
+
+    TInt index( KErrNotFound );
+    TInt count( iMedia->Count() );
+    // Search start from aIndex, then aIndex-1, aIndex+1, aIndex-2, aIndex+2
+    // until the boundary reach then search for the rest
+    if ( aIndex > count - 1 ) // remove song before the last
+        {
+        aIndex = count - 1;
+        }
+    CMPXMedia* origMedia( iMedia->AtL( aIndex ) );
+    TMPXItemId id( origMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+    if ( id == aId )
+        {
+        index = aIndex;
+        }
+    else
+        {
+        TInt upBound( ( count - 1 ) - aIndex );
+        TInt loBound( aIndex - 0 );
+        TInt biBound( Min( upBound, loBound ) );
+        for ( TInt i = 1; i <= biBound; i++ )
+            {
+            CMPXMedia* entry( iMedia->AtL( aIndex - i ) );
+            TMPXItemId id( entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+            if ( id == aId )
+                {
+                index = aIndex - i;
+                break;
+                }
+
+            entry = iMedia->AtL( aIndex + i );
+            id = entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+            if ( id == aId )
+                {
+                index = aIndex + i;
+                break;
+                }
+            }
+        if ( index == KErrNotFound && upBound != loBound ) // still not found search for the rest
+            {
+            TInt begin( ( loBound > upBound ) ? 0 : aIndex + biBound + 1 );
+            TInt end( ( loBound>upBound ) ? aIndex - biBound : count );
+            for ( TInt i = begin; i < end; i++ )
+                {
+                CMPXMedia* entry( iMedia->AtL( i ) );
+                TMPXItemId id( entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                if ( id == aId )
+                    {
+                    index = i;
+                    break;
+                    }
+                }
+            }
+        }
+    return SetPlaybackStatusByIndex( index, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// Activates reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::ActivateReorderMode( TBool aEnable )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::ActivateReorderMode" );
+    iReorderActivated = aEnable;
+    if ( !iMediaOwned && aEnable )
+        {
+        // make a copy of the current array so that any modification to the array
+        // does not pollute the master copy
+        MPX_TRAPD( error, iMediaOwned = CMPXMediaArray::NewL() );
+        if ( error == KErrNone )
+            {
+            TInt count( iMedia->Count() );
+            TRAP_IGNORE(
+                for ( TInt i = 0; i < count; i++ )
+                    {
+                    CMPXMedia* entry( iMedia->AtL( i ) );
+                    iMediaOwned->AppendL( *entry );
+                    } );
+            // no need to delete iMedia, we don't own it
+            // iMedia might get reset before we have a chance to delete it
+            // keep a copy of the pointer so that we can delete
+            iMedia = iMediaOwned;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::SetReorderGrabbedMode(
+    TBool aEnable, TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::SetReorderGrabbedMode" );
+    iReorder = aEnable;
+    iOriginalIndex = aIndex;
+    iMovedIndex = aIndex;
+    if ( aEnable && aIndex == iIndex )
+        {
+        // if the item currently being moved is now playing
+        // manually move the icon after it's complete, and before the result
+        // is saved to db
+        iMoveNowPlaying = ETrue;
+        }
+    else
+        {
+        iMoveNowPlaying = EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Move current reorder index
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::MoveReorderIndex( TInt aDirection )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::MoveReorderIndex" );
+    if ( iReorder )
+        {
+        if ( ( aDirection == 1 ) && ( iMovedIndex < MdcaCount() - 1 ) )
+            {
+            iMovedIndex++;
+            }
+        else if ( ( aDirection == -1 ) && ( iMovedIndex > 0 ) )
+            {
+            iMovedIndex--;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set current reorder index
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::SetReorderIndex( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::SetReorderIndex" );
+    iMovedIndex = aIndex;
+    }
+
+// ---------------------------------------------------------------------------
+// Confirm reorder
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::ConfirmReorderL()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::ConfirmReorderL" );
+    CMPXMedia* origMedia( iMedia->AtL( iOriginalIndex ) );
+    CMPXMedia* entry( CMPXMedia::NewL( *origMedia ) );
+    iMedia->Remove( iOriginalIndex );
+    iMedia->Insert( entry, iMovedIndex ); // iMedia takes ownership
+    if ( iMoveNowPlaying )
+        {
+        iIndex = iMovedIndex;
+        iMoveNowPlaying = EFalse;
+        }
+    iOriginalIndex = KErrNotFound;
+    iMovedIndex = KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// Cancel reorder
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::CancelReorder()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::CancelReorder" );
+    iOriginalIndex = KErrNotFound;
+    iMovedIndex = KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets original index of currently selected item
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewListBoxArray::GetOriginalIndex() const
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::GetOriginalIndex" );
+    return iOriginalIndex;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the index for the song that's currently playing
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewListBoxArray::GetPlaybackIndex() const
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::GetPlaybackIndex" );
+    return iIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// Indicates if Unknown entry exists in this view
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewListBoxArray::IsCategoryUnknownExist() const
+    {
+    return iIsUnknownExist;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if the current item is a broken link
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewListBoxArray::IsItemBrokenLinkL( TInt aIndex ) const
+    {
+    TBool ret( EFalse );
+    if ( iMedia )
+        {
+        CMPXMedia* entry( iMedia->AtL( aIndex ) );
+        TUint flags( 0 );
+        if( entry->IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+            ret = ( ( flags ) & ( KMPXMediaGeneralFlagsIsInvalid ) );
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if the current item is corrupted
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewListBoxArray::IsItemCorruptedL( TInt aIndex ) const
+    {
+    TBool ret( EFalse );
+    if ( iMedia )
+        {
+        CMPXMedia* entry( iMedia->AtL( aIndex ) );
+        TUint flags( 0 );
+        if( entry->IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+            ret = ( ( flags ) & ( KMPXMediaGeneralFlagsIsCorrupted ) );
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::IndicationIconIndices
+// Get array of indicator icon indices at the specified view index
+// Only used when using Hitchcock container.
+// -----------------------------------------------------------------------------
+//
+RArray<TInt> CMPXCollectionViewListBoxArray::IndicatorIconIndicesL(
+    TInt aIndex )
+    {
+    RArray<TInt> iconIndices;
+
+    TInt index( GetArrayIndexForListBoxIndex( aIndex ) );
+    CMPXMedia* entry( iMedia->AtL( index ) );
+
+    TMPXGeneralType type( EMPXNoType );
+    if ( entry->IsSupported( KMPXMediaGeneralType ) )
+        {
+        type = entry->ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+        }
+    TMPXGeneralCategory category( EMPXNoCategory );
+    if ( entry->IsSupported( KMPXMediaGeneralCategory ) )
+        {
+        category = entry->ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+        }
+    TUint flags(0);
+    if ( entry->IsSupported( KMPXMediaGeneralFlags ) )
+        {
+        flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+        }
+
+    // reorder icon
+    if ( ( iReorder ) && ( aIndex == iMovedIndex ) )
+        {
+        iconIndices.Append( GetReorderIcon() );
+        }
+    else if ( !iReorderActivated )
+        {
+        // playback status icon
+        if ( iIndex == index )
+            {
+            switch ( iPbState )
+                {
+                case EPbStatePlaying:
+                    {
+                    iconIndices.Append( EMPXClvIconPlay );
+                    break;
+                    }
+                case EPbStatePaused:
+                    {
+                    iconIndices.Append( EMPXClvIconPause );
+                    break;
+                    }
+                default:
+                    {
+                    // other playback states, not handled
+                    break;
+                    }
+                }
+            }
+        }
+
+    if ( category == EMPXSong && type == EMPXItem )
+        {
+        if ( flags & KMPXMediaGeneralFlagsIsInvalid )
+            {
+            iconIndices.Append( EMPXClvIconBrokenTrack );
+            }
+        else if ( flags & KMPXMediaGeneralFlagsIsCorrupted )
+            {
+            iconIndices.Append( EMPXClvIconCorruptTrack );
+            }
+        else if ( flags & KMPXMediaGeneralFlagsIsDrmLicenceInvalid )
+            {
+            iconIndices.Append( EMPXClvIconDrmExpired );
+            }
+        }
+    else if ( category == EMPXPlaylist )
+        {
+        if ( flags & KMPXMediaGeneralFlagsIsInvalid )
+            {
+            iconIndices.Append( EMPXClvIconBrokenPlaylist );
+            }
+        }
+
+    TInt driveNum = ( ( flags ) & ( KMPXMediaGeneralFlagsDriveInfo ) );
+    if ( driveNum == iMMCDrive )
+        {
+        // The MMC icon is displayed in the first Indicator slot
+        iconIndices.Append( EMPXClvIconMMC );
+        }
+
+    return iconIndices;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::MdcaPoint
+// indexes into a descriptor array.
+// -----------------------------------------------------------------------------
+//
+TPtrC CMPXCollectionViewListBoxArray::MdcaPoint( TInt aIndex ) const
+    {
+    //MPX_FUNC( "CMPXCollectionViewListBoxArray::MdcaPoint" );
+    //MPX_DEBUG2( "CMPXCollectionViewListBoxArray::MdcaPoint media count %d", iMedia->Count() );
+    TPtrC item( KNullDesC );
+    TRAP_IGNORE( item.Set( GetMdcaPointL( aIndex ) ) );
+    return item;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::CreateIconArrayL
+// creates icon array.
+// -----------------------------------------------------------------------------
+//
+CAknIconArray* CMPXCollectionViewListBoxArray::CreateIconArrayL()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::CreateIconArrayL" );
+    TParse mbmFileName;
+    mbmFileName.Set( KMPXCollectionViewIconFile,
+                     &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( mbmFileName.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+    // Prepare icon array for listbox
+    CAknIconArray* iconArray = new ( ELeave ) CAknIconArray( 26 ); // magic: array granularity
+#else
+    // Prepare icon array for listbox
+    CAknIconArray* iconArray = new ( ELeave ) CAknIconArray( 25 ); // magic: array granularity
+#endif
+
+    // Update the enums when this list is updated
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMarkedAdd,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        KAvkonBitmapFile,
+        EMbmAvkonQgn_indi_marked_add,
+        EMbmAvkonQgn_indi_marked_add_mask);
+   AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropEmpty,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        KAvkonBitmapFile,
+        EMbmAvkonQgn_prop_empty,
+        EMbmAvkonQgn_prop_empty_mask);    
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupSongs,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_prop_mup_songs,
+        EMbmMpxcollectionviewQgn_prop_mup_songs_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupArtist,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_prop_mup_artist,
+        EMbmMpxcollectionviewQgn_prop_mup_artist_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupAlbum,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_prop_mup_album,
+        EMbmMpxcollectionviewQgn_prop_mup_album_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupPlaylist,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_prop_mup_playlist,
+        EMbmMpxcollectionviewQgn_prop_mup_playlist_mask);
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupPlaylist,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_lst_userplayl,
+        EMbmMpxcollectionviewQgn_graf_mup_lst_userplayl_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupPlaylistAuto,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_prop_mup_playlist_auto,
+        EMbmMpxcollectionviewQgn_prop_mup_playlist_auto_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupGenre,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_prop_mup_genre,
+        EMbmMpxcollectionviewQgn_prop_mup_genre_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupComposer,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_prop_mup_composer,
+        EMbmMpxcollectionviewQgn_prop_mup_composer_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnMenuFolderApps,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_menu_folder_apps,
+        EMbmMpxcollectionviewQgn_menu_folder_apps_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupAudio,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_prop_mup_audio,
+        EMbmMpxcollectionviewQgn_prop_mup_audio_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_lst_corrupttrack,
+        EMbmMpxcollectionviewQgn_graf_mup_lst_corrupttrack_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_lst_brokentrack,
+        EMbmMpxcollectionviewQgn_graf_mup_lst_brokentrack_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_lst_brokenplayl,
+        EMbmMpxcollectionviewQgn_graf_mup_lst_brokenplayl_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_lst_drm_exp,
+        EMbmMpxcollectionviewQgn_graf_mup_lst_drm_exp_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropUnknown,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_prop_unknown,
+        EMbmMpxcollectionviewQgn_prop_unknown_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewQgn_indi_mmc_add,
+        EMbmMpxcollectionviewQgn_indi_mmc_add_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupPlay,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_npv_icon_play,
+        EMbmMpxcollectionviewQgn_graf_mup_npv_icon_play_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupPause,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_npv_icon_pause,
+        EMbmMpxcollectionviewQgn_graf_mup_npv_icon_pause_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupForwAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewQgn_indi_mup_forw_add,
+        EMbmMpxcollectionviewQgn_indi_mup_forw_add_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupRewAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewQgn_indi_mup_rew_add,
+        EMbmMpxcollectionviewQgn_indi_mup_rew_add_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_adtl_reorder_down,
+        EMbmMpxcollectionviewQgn_graf_mup_adtl_reorder_down_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_adtl_reorder_up,
+        EMbmMpxcollectionviewQgn_graf_mup_adtl_reorder_up_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_adtl_reorder_updown,
+        EMbmMpxcollectionviewQgn_graf_mup_adtl_reorder_updown_mask );
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupDlstPodcast,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewQgn_graf_mup_dlst_podcast,
+        EMbmMpxcollectionviewQgn_graf_mup_dlst_podcast_mask );
+#endif
+    return iconArray;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::AppendMediaL
+// Appends media array to the current array
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::AppendMediaL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::AppendMediaL" );
+    if ( iMediaOwned )
+        {
+        delete iMediaOwned;
+        iMediaOwned = NULL;
+        }
+    CMPXCommonListBoxArrayBase::AppendMediaL( aMedia );
+    iIsUnknownExist = EFalse;
+
+    if ( iMedia )
+        {
+        TInt entriesCount( iMedia->Count() );
+        if ( entriesCount > 0 )
+            {
+            // check if the last entry is "unknown" entry
+            // if the last entry has a length of 0, then it's
+            // "unknown" category and needs to be localized
+            CMPXMedia* origMedia( iMedia->AtL( entriesCount - 1 ) );
+            if ( origMedia->ValueText(
+                KMPXMediaGeneralTitle ).Length() == 0 )
+                {
+                iIsUnknownExist = ETrue;
+                }
+            }
+        }
+    if ( iContainerMedia )
+        {
+        if ( iContainerMedia->IsSupported( KMPXMediaGeneralTitle ) )
+            {
+            if ( iContainerMedia->ValueText(
+                KMPXMediaGeneralTitle ).Length() == 0 )
+                {
+                TMPXGeneralCategory containerCategory(
+                    iContainerMedia->ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory ) );
+                HBufC* text( NULL );
+                switch ( containerCategory )
+                    {
+                    case EMPXArtist:
+                        {
+                        text = StringLoader::LoadLC(
+                            R_MPX_QTN_NMP_UNKNOWN_ARTIST );
+                        break;
+                        }
+                    case EMPXAlbum:
+                        {
+                        text = StringLoader::LoadLC(
+                            R_MPX_QTN_MUS_TITLE_UNKNOWN_ALBUM );
+                        break;
+                        }
+                    case EMPXGenre:
+                        {
+                        text = StringLoader::LoadLC(
+                            R_MPX_QTN_MUS_TITLE_UNKNOWN_GENRE );
+                        break;
+                        }
+                    case EMPXComposer:
+                        {
+                        text = StringLoader::LoadLC(
+                            R_MPX_QTN_MUS_TITLE_UNKNOWN_COMPOSER );
+                        break;
+                        }
+                    default:
+                        {
+                        text = StringLoader::LoadLC(
+                            R_MPX_QTN_MP_UNKNOWN );
+                        break;
+                        }
+                    }
+                iContainerMedia->SetTextValueL(
+                    KMPXMediaGeneralTitle, *text );
+                CleanupStack::PopAndDestroy( text );
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Append icon to array
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::AppendColorIconToArrayL(
+    CAknIconArray* aArray,
+    const TAknsItemID& aID,
+    const TAknsItemID& aColorId,
+    TInt aColorIndex,
+    const TDesC& aMbmFile,
+    TInt aBitmapId,
+    TInt aMaskId )
+    {
+    MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
+
+    CFbsBitmap* bitmap( NULL );
+    CFbsBitmap* mask( NULL );
+
+    if ( aColorId == KAknsIIDNone )
+        {
+        // do not use theme color, use the default color from the file
+        AknsUtils::CreateIconLC( skin, aID,
+            bitmap, mask, aMbmFile, aBitmapId, aMaskId );
+        }
+    else
+        {
+        // use theme color
+        AknsUtils::CreateColorIconLC( skin, aID, aColorId, aColorIndex,
+            bitmap, mask, aMbmFile, aBitmapId, aMaskId, KRgbBlack );
+        }
+
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+    icon->SetBitmapsOwnedExternally( EFalse );
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop( 2 ); // mask, bitmap
+
+    CleanupStack::PushL( icon );
+    aArray->AppendL( icon );
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop( icon );
+    }
+
+// -----------------------------------------------------------------------------
+// Maps list box index to array index in reorder mode
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewListBoxArray::GetArrayIndexForListBoxIndex(
+    TInt aIndex ) const
+    {
+    TInt index( aIndex );
+
+    if ( ( iReorder ) && ( iOriginalIndex != iMovedIndex ) )
+        {
+        if ( iMovedIndex > iOriginalIndex )
+            {
+            // moved down
+            if ( aIndex < iOriginalIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex > iMovedIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex < iMovedIndex )
+                {
+                // between original index and moved index
+                index = aIndex + 1;
+                }
+            else if ( aIndex == iMovedIndex )
+                {
+                index = iOriginalIndex;
+                }
+            }
+        else
+            {
+            // moved up
+            if ( aIndex > iOriginalIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex < iMovedIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex > iMovedIndex )
+                {
+                // between original index and moved index
+                index = aIndex - 1;
+                }
+            else if ( aIndex == iMovedIndex )
+                {
+                index = iOriginalIndex;
+                }
+            }
+        }
+
+    return index;
+    }
+
+// -----------------------------------------------------------------------------
+// Get reorder icon
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewListBoxArray::GetReorderIcon() const
+    {
+    TInt icon( EMPXClvIconNone );
+
+    // Determine the icon to display
+    if ( iReorder )
+        {
+        if ( iMovedIndex == 0 )
+            {
+            icon = EMPXClvIconReorderDown;
+            }
+        else if ( MdcaCount() - 1 == iMovedIndex )
+            {
+            icon = EMPXClvIconReorderUp;
+            }
+        else
+            {
+            icon = EMPXClvIconReorderUpDown;
+            }
+        }
+    return icon;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::GetMdcaPointL
+// indexes into a descriptor array.
+// -----------------------------------------------------------------------------
+//
+TPtrC CMPXCollectionViewListBoxArray::GetMdcaPointL( TInt aIndex ) const
+    {
+    TInt index( GetArrayIndexForListBoxIndex( aIndex ) );
+    TPtrC item( KNullDesC );
+    CMPXMedia* entry( iMedia->AtL( index ) );
+    if( entry->IsSupported( KMPXMediaGeneralTitle ) )
+        {
+        TPtrC title( entry->ValueText( KMPXMediaGeneralTitle ) );
+        if ( IsCategoryUnknownExist() && aIndex== MdcaCount() - 1 && title.Length()==0 )
+            {
+            title.Set( *iUnknown );
+            }
+
+        TMPXGeneralType type( EMPXNoType );
+        if( entry->IsSupported( KMPXMediaGeneralType ) )
+            {
+            type = entry->ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+            }
+        TMPXGeneralCategory category( EMPXNoCategory );
+        if( entry->IsSupported( KMPXMediaGeneralCategory ) )
+            {
+            category = entry->ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory );
+            }
+        TUint flags(0);
+        if( entry->IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+            }
+        //MPX_DEBUG3( "CMPXCollectionViewListBoxArray::MdcaPoint (%d) Name: %S", aIndex, &title );
+        //MPX_DEBUG4( "CMPXCollectionViewListBoxArray::MdcaPoint (%d) Type: %d, Category: %d", aIndex, type, category );
+        TInt iconID( EMPXClvIconNone );
+        switch( category )
+            {
+            case EMPXSong:
+                {
+                if ( type == EMPXGroup )
+                    {
+                    iconID = EMPXClvIconSongs;
+                    }
+                else
+                    {
+                    TUint flags(0);
+                    if( entry->IsSupported( KMPXMediaGeneralFlags ) )
+                        {
+                        flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+                        }
+                    if ( flags & KMPXMediaGeneralFlagsIsInvalid )
+                        {
+                        iconID = EMPXClvIconBrokenTrack;
+                        }
+                    else if ( flags & KMPXMediaGeneralFlagsIsCorrupted )
+                        {
+                        iconID = EMPXClvIconCorruptTrack;
+                        }
+                    else if ( flags & KMPXMediaGeneralFlagsIsDrmLicenceInvalid )
+                        {
+                        iconID = EMPXClvIconDrmExpired;
+                        }
+                    else
+                        {
+                        iconID = EMPXClvIconAudio;
+                        }
+                    }
+                break;
+                }
+            case EMPXArtist:
+                {
+                iconID = EMPXClvIconArtist;
+                break;
+                }
+            case EMPXAlbum:
+                {
+                iconID = EMPXClvIconAlbum;
+                if ( entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
+                    iContainerMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) )
+                    {
+                    // if id == containerid, "all" under artist/album
+                    iconID = EMPXClvIconSongs;
+                    }
+                break;
+                }
+            case EMPXPlaylist:
+                {
+                if ( flags & KMPXMediaGeneralFlagsIsInvalid )
+                    {
+                    iconID = EMPXClvIconBrokenPlaylist;
+                    }
+                else
+                    {
+                    if ( type == EMPXGroup )
+                        {
+                        iconID = EMPXClvIconPlaylist;
+                        }
+                    else
+                        {
+                        iconID = EMPXClvIconUserPlaylist;
+                        }
+                    if ( type == EMPXItem )
+                        {
+                        if ( entry->IsSupported(
+                            KMPXMediaGeneralNonPermissibleActions ) )
+                            {
+                            // check for auto playlist and display a different icon
+                            TMPXGeneralNonPermissibleActions attr(
+                                entry->ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                                    KMPXMediaGeneralNonPermissibleActions ) );
+                            if ( attr & EMPXWrite )
+                                {
+                                iconID = EMPXClvIconPlaylistAuto;
+                                }
+                            }
+                        }
+                    }
+                break;
+                }
+            case EMPXGenre:
+                {
+                iconID = EMPXClvIconGenre;
+                break;
+                }
+            case EMPXComposer:
+                {
+                iconID = EMPXClvIconComposer;
+                break;
+                }
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+            case EMPXPodcast:
+                {
+                iconID = EMPXClvIconPodcasts;
+                break;
+                }
+#endif
+            case EMPXFile:
+                {
+                // a group of files is a folder
+                iconID = EMPXClvIconFolder;
+                break;
+                }
+
+            default:
+                {
+                // unknown folder icon
+                iconID = EMPXClvIconUnknowFile;
+                break;
+                }
+            }
+        TPtr ptr = iItem->Des();
+        ptr.Zero();
+
+        ptr.Format( KMPXCommonListboxFormatString, iconID, &title );
+
+        iconID = EMPXClvIconNone;
+        // reorder icon
+        if ( ( iReorder ) && ( aIndex == iMovedIndex ) )
+            {
+            iconID = GetReorderIcon();
+            }
+        else if ( !iReorderActivated )
+            {
+            // playback status icon
+            if ( iIndex == index )
+                {
+                switch ( iPbState )
+                    {
+                    case EPbStatePlaying:
+                        {
+                        iconID = EMPXClvIconPlay;
+                        break;
+                        }
+                    case EPbStatePaused:
+                        {
+                        iconID = EMPXClvIconPause;
+                        break;
+                        }
+                    case EPbStateSeekingForward:
+                        {
+                        iconID = EMPXClvIconForward;
+                        break;
+                        }
+                    case EPbStateSeekingBackward:
+                        {
+                        iconID = EMPXClvIconRewind;
+                        break;
+                        }
+                    default:
+                        {
+                        // other playback states, not handled
+                        break;
+                        }
+                    }
+                }
+            }
+        else
+            {
+            // Do nothing
+            }
+
+        if ( iconID != EMPXClvIconNone )
+            {
+            ptr.Append( KMPXTab );
+            ptr.AppendNum( iconID );
+            }
+
+        // mmc icon
+        TInt driveNum = ( ( flags ) & ( KMPXMediaGeneralFlagsDriveInfo ) );
+        if ( driveNum == iMMCDrive )
+            {
+            ptr.Append( KMPXTab );
+            ptr.AppendNum( EMPXClvIconMMC );
+            }
+
+        item.Set( *iItem );
+        }
+    return item;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets playback status
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewListBoxArray::SetPlaybackStatusByIndex(
+    TInt aIndex, TMPXPlaybackState aStatus )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::SetPlaybackStatusByIndex" );
+    TInt ret( iIndex );
+    iIndex = aIndex;
+
+    // Not to display seeking icons for seeking mode
+    if ( aStatus != EPbStateSeekingForward &&
+        aStatus != EPbStateSeekingBackward )
+        {
+        iPbState = aStatus;
+        }
+    return ret;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/bwinscw/mpxcollectionviewhgu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewL@CMPXCollectionViewHg@@SAPAV1@XZ @ 1 NONAME ; class CMPXCollectionViewHg * CMPXCollectionViewHg::NewL(void)
+	?NewLC@CMPXCollectionViewHg@@SAPAV1@XZ @ 2 NONAME ; class CMPXCollectionViewHg * CMPXCollectionViewHg::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/data/mpxcollectionviewhg.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1572 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxcollectionviewhg
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MCCV // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <CommonDialogs.hrh> 
+#include <CommonDialogs.rh> 
+#include <bldvariant.hrh>
+#include <pathconfiguration.hrh>
+
+#include <AiwCommon.hrh>
+#include <AiwCommon.rh>
+
+#include <mpxappui.hrh>
+#include <mpxcommonui.loc>
+#include <mpxcommoncontainer.loc>
+#include <mpxcollectionviewhg.loc>
+#include "mpxcollectionviewhg.hrh"
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view
+// Collection view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_mpx_collection_view
+    {
+    menubar = r_mpx_collection_view_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menubar_music_menu
+// Collection view main music menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_collection_view_menubar_music_menu
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_collection_view_music_menu;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menubar_embedded_playlist_view
+// Collection view menu bar for embedded playlist view.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_collection_view_menubar_embedded_playlist_view
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_collection_view_embedded_playlist_view;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menubar_no_marking
+// Collection view menu bar without marking.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_collection_view_menubar_no_marking
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_collection_view_menu_2;
+            },
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_collection_view_menu_1;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menubar
+// Collection view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_collection_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_collection_view_menu_2;
+            },
+        MENU_TITLE 
+            {
+            menu_pane = R_AVKON_MENUPANE_MARKABLE_LIST;
+            },
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_collection_view_menu_1;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menu_1
+// Collection view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_collection_view_menu_1
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToNowPlaying;
+            txt = qtn_nmp_options_go_to_nowplaying;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToAllSongs;
+            txt = "Songs";
+            },            
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToArtistAlbums;
+            txt = "Artists & Albums";
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToPlaylists;
+            txt = "Playlists";
+            },            
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToPodcasts;
+            txt = "Podcasts";
+            },                        
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToGenre;
+            txt = "Sort by genre";
+            },                             
+        MENU_ITEM
+            {
+            command = EMPXCmdRefreshLibrary;
+            txt = qtn_mus_options_update_collection1;
+            },
+#ifdef SINGLE_CLICK_INCLUDED
+        MENU_ITEM
+            {
+            command = EMPXCmdPlayItem;
+            txt = "Play";
+            flags = EEikMenuItemSpecific;
+            },
+#endif
+        MENU_ITEM
+            {
+            command = EMPXCmdFind;
+            txt = qtn_options_find;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdCreatePlaylist;
+            txt = qtn_mg_options_create_new_pl;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdAddToPlaylist;
+            txt = qtn_mus_options_add_to_pl;
+            cascade = r_mpx_add_to_pl_sub_menu;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecificListQuery;
+#endif
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdUpnpPlayVia;
+            txt = qtn_nmp_options_play_via;
+            cascade = r_mpx_collection_play_via_sub_menu; 
+            },    
+        MENU_ITEM
+            {
+            command = EMPXCmdAddSongs;
+            txt = qtn_mus_options_add_tracks;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdReorder;
+            txt = qtn_nmp_options_reorder_list;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdSend;
+            txt = qtn_options_send_via;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;
+#endif
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdUPnPAiwCmdCopyToExternalCriteria;
+            txt = "(copy to ext)";
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdDelete;
+            txt = qtn_mus_options_delete;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;
+#endif
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdRemove;
+            txt = qtn_mp_options_remove;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;
+#endif
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menu_2
+// Collection view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_collection_view_menu_2
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdUseAsCascade;
+            txt = qtn_mus_options_use_tone_as;
+            cascade = r_mpx_use_as_cascade;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecificListQuery;
+#endif
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdSongDetails;
+            txt = qtn_mus_options_details_track;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;
+#endif            
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdRename;
+            txt = qtn_nmp_options_rename;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;
+#endif
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdAlbumArt;
+            txt = qtn_nmp_options_album_art;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdFindInMusicShop;
+            txt = qtn_nmp_find_in_musicshop;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;            
+#endif
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdPlaylistDetails;
+            txt = qtn_mus_options_details_pl;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_music_menu
+// Collection view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_collection_view_music_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToNowPlaying;
+            txt = qtn_nmp_options_go_to_nowplaying;
+            },
+
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU                
+        MENU_ITEM
+            {
+            command = EMPXCmdRefreshLibrary;
+            txt = qtn_mus_options_update_collection1;
+            },    
+#endif            
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToMusicShop;
+            txt = qtn_nmp_options_go_to_shop;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdGoToMultipleMusicShop;
+            txt = qtn_nmp_options_go_to_shop;
+            cascade = r_mpx_playback_collection_musicshop_sub_menu; 
+            },                
+        MENU_ITEM
+            {
+            command = EMPXCmdMusicLibraryDetails;
+            txt = qtn_mus_options_details_library;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_embedded_playlist_view
+// Collection view menu items for embedded playlist view.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_collection_view_embedded_playlist_view
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdSavePlaylist;
+            txt = qtn_mp_options_save;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdFindInMusicShop;
+            txt = qtn_nmp_find_in_musicshop;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_add_to_pl_sub_menu
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_add_to_pl_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdAddToSavedPlaylist;
+            txt = qtn_nmp_sub_add_to_playlist_saved;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdAddToNewPlaylist;
+            txt = qtn_nmp_sub_add_to_playlist_new; 
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_collection_via_sub_menu
+// Collection view UPnP Play Via sub menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_collection_play_via_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdUpnpPlayViaLocal;
+            txt = qtn_nmp_options_play_device;
+            flags = EEikMenuItemRadioStart;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdUpnpPlayViaRemotePlayer;
+            txt = qtn_nmp_options_play_homenet;
+            flags = EEikMenuItemRadioEnd;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_collection_musicshop_sub_menu
+// Collection view goto music shop menu items
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_playback_collection_musicshop_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToOperatorMusicShop;
+             txt = "";
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdGoToNokiaMusicShop;
+            txt = "Nokia Music Store";
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_upnp_copy_to_external_menu_interest
+// Copy to remote menu definition needed by AIW to display and handle the menu
+// ---------------------------------------------------------------------------
+//
+RESOURCE AIW_INTEREST r_mpx_upnp_copy_to_external_menu_interest
+    {
+    items=
+        {
+        AIW_CRITERIA_ITEM
+            {
+            id = EMPXCmdUPnPAiwCmdCopyToExternalCriteria;
+            serviceCmd   = KAiwCmdUPnPCopy; //AIWCommon.hrh
+            serviceClass = KAiwClassMenu;   //AIWCommon.hrh
+            contentType  = "*";
+            maxProviders = 1;
+            }
+        };
+    }
+//------------------------------------------------------------------------------
+//
+//      r_mpx_aiw_assign_interest
+//      AIW interest criteria for "Use tone as" menu
+//
+//------------------------------------------------------------------------------
+//
+RESOURCE AIW_INTEREST r_mpx_aiw_assign_interest
+    {
+    items=
+        {
+        AIW_CRITERIA_ITEM
+            {
+            id = EMPXCmdAiwCmdAssign;
+            serviceCmd = KAiwCmdAssign;
+            contentType = "*";
+            serviceClass = KAiwClassMenu;
+            }
+        };
+    }    
+
+//----------------------------------------------------
+//
+//    r_mplayer_use_as_cascade
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_use_as_cascade
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdAiwCmdAssign;
+            txt = "";
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_add_songs_confirmation_query
+// Confirmation query dialog for add songs after a new playlist is created
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_cui_add_songs_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_delete_confirmation_query
+// Confirmation query dialog for deleting.
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_cui_delete_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_rename_query
+// Name query dialog for renaming
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_cui_rename_query
+    {
+    flags = EAknGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items=
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_DATA_QUERY 
+                { 
+                layout = EDataLayout;
+                control = EDWIN 
+                    {
+                    };
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_generic_confirmation_query
+// Generic confirmation query dialog.
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_collection_generic_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_mpx_cui_reorder_drop_cancel_cba
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_cui_reorder_drop_cancel_cba
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderDrop;
+            txt = qtn_nmp_softkey_drop;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderCancel;
+            txt = text_softkey_cancel;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderDrop;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_cui_reorder_drop_cancel_cba
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_cui_reorder_drop_cancel_cba
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderDrop;
+            txt = qtn_nmp_softkey_drop;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderCancel;
+            txt = text_softkey_cancel;
+            }
+        };
+    }
+#endif // __ENABLE_MSK
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_mpx_cui_reorder_grab_done_cba
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_cui_reorder_grab_done_cba
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderGrab;
+            txt = qtn_nmp_softkey_grab;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderDone;
+            txt = text_softkey_done;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderGrab;
+            txt = text_softkey_empty;
+            }
+        };
+    }
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_cui_reorder_grab_done_cba
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_cui_reorder_grab_done_cba
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderGrab;
+            txt = qtn_nmp_softkey_grab;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdReorderDone;
+            txt = text_softkey_done;
+            }
+        };
+    }
+#endif // __ENABLE_MSK
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_mpx_options_back_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_back_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_back;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_open;
+            }
+        };
+    }
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_options_back_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_back_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_back;
+            }
+        };
+    }
+#endif // __ENABLE_MSK
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_mpx_options_exit_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_exit_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_exit;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_open;
+            }
+        };
+    }
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_options_exit_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_exit_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_exit;
+            }
+        };
+    }
+#endif // __ENABLE_MSK
+
+// ---------------------------------------------------------------------------
+// r_mpx_options_hide_cba
+// CBA with "Options" and "Hide" Softkey.
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_options_hide_cba
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdHideApp;
+            txt = qtn_softkey_hide;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_transparent_cba
+// transparent CBA with "Options" and "Hide" Softkey.
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_collection_transparent_cba
+    {
+    flags = EEikCbaFlagTransparent;
+    buttons =
+        {
+        CBA_BUTTON 
+            { 
+            id = EAknSoftkeyOptions; 
+            txt = text_softkey_option; 
+            },
+        CBA_BUTTON 
+            { 
+            id = EMPXCmdHideApp; 
+            txt = qtn_softkey_hide; 
+            },
+        CBA_BUTTON 
+            { 
+            id = EAknSoftkeyBack; 
+            txt = text_softkey_back; 
+            }   
+        };
+    }
+    
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA_BUTTON r_mpx_collection_rsk_find_cancel
+    {
+    id = EMPXCmdFindCancel;
+    txt = text_softkey_cancel;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_mpx_cui_collection_details_headings
+// Headings for Collection Details popup
+// ---------------------------------------------------------------------------
+//
+#ifdef RD_MULTIPLE_DRIVE
+RESOURCE ARRAY r_mpx_cui_collection_details_headings
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_mus_detail_number_of_songs;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_phone_memory;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_mass_memory;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_mmc;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_date_refresh;
+            }
+        };
+    }    
+#else
+RESOURCE ARRAY r_mpx_cui_collection_details_headings
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_mus_detail_number_of_songs;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_phone_memory;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_memory_card;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_date_refresh;
+            }
+        };
+    }    
+#endif // RD_MULTIPLE_DRIVE   
+
+// ---------------------------------------------------------------------------
+// r_mpx_cui_playlist_details_headings_with_uri
+// Headings for playlist Details popup with uri field
+// ---------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_mpx_cui_playlist_details_headings_with_uri
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_mus_pl_detail_name;
+            },
+        LBUF
+            {
+            txt = qtn_mus_detail_number_of_songs;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_location;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_date;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_time;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_cui_playlist_details_headings_without_uri
+// Headings for playlist Details popup without uri field
+// ---------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_mpx_cui_playlist_details_headings_without_uri
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_mus_pl_detail_name;
+            },
+        LBUF
+            {
+            txt = qtn_mus_detail_number_of_songs;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_date;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_time;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_waitnote_softkeys_empty_stop
+// Softkeys used by generic wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_collection_waitnote_softkeys_empty_stop
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;
+            txt = text_softkey_stop;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collectionview_title
+// Title for Collection view.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_collection_view_title
+    {
+    buf = qtn_mp_title_collection_view;
+    }
+
+// ---------------------------------------------------------------------------
+// r_qtn_qtn_nmp_title_reorder_list
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_qtn_nmp_title_reorder_list
+    {
+    buf = qtn_nmp_title_reorder_list;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_cui_position_counter_txt
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_cui_position_counter_txt
+    {
+    buf = qtn_nmp_position_counter;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_query_add_songs
+// Text for add songs after a new playlist is created.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_query_add_songs
+    {
+    buf = qtn_nmp_query_add_songs;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_query_common_conf_delete
+// Text for single item deletion confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_query_common_conf_delete
+    {
+    buf = qtn_query_common_conf_delete;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_del_songs_query
+// Text for multiple tracks deletion confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_del_songs_query
+    {
+    buf = qtn_nmp_del_songs_query;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_query_conf_delete_group
+// Text for group deletion confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_query_conf_delete_group
+    {
+    buf = qtn_nmp_query_conf_delete_group;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_del_songs_wait_note
+// Text for multiple item deletion wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_del_songs_wait_note
+    {
+    buf = qtn_nmp_del_songs_wait_note;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_note_removing_many
+// Text for multiple item remove wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_note_removing_many
+    {
+    buf = qtn_nmp_note_removing_many;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_query_conf_remove_many
+// Text for multiple item remove confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mus_query_conf_remove_many
+    {
+    buf = qtn_mus_query_conf_remove_many;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_note_removing_track
+// Text for single item remove wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mus_note_removing_track
+    {
+    buf = qtn_mus_note_removing_track;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_query_conf_remove_track
+// Text for single item remove confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mus_query_conf_remove_track
+    {
+    buf = qtn_mus_query_conf_remove_track;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_album_waiting_deleting
+// Text for single item deletion wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_album_waiting_deleting
+    {
+    buf = qtn_album_waiting_deleting;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_query_conf_delete_all
+// Text for group deletion wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mus_query_conf_delete_all
+    {
+    buf = qtn_mus_query_conf_delete_all;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_title_collection_details
+// Text used for Collection Details title.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_title_collection_details
+    {
+    buf = qtn_nmp_title_collection_details1;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_title_playlist_details
+// Text used for Collection Details title.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_title_playlist_details
+    {
+    buf = qtn_mus_title_details_pl;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_phone_memory_root_path
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_phone_memory_root_path
+    {
+    buf = text_phone_memory_root_path;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_memory_card_root_path
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_memory_card_root_path
+    {
+    buf = text_memory_card_root_path;
+    }
+
+#ifdef RD_MULTIPLE_DRIVE
+// -----------------------------------------------------------------------------
+// r_mpx_cui_collection_details_card_unavailable_item
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_cui_collection_details_memory_unavailable
+    {
+    buf = qtn_nmp_memory_unavailable;
+    }   
+#endif // RD_MULTIPLE_DRIVE   
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_collection_details_card_unavailable_item
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_cui_collection_details_card_unavailable_item
+    {
+    buf = qtn_nmp_mmc_unavailable;
+    }   
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_prmpt_new_name
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_nmp_prmpt_new_name
+    {
+    buf = qtn_nmp_prmpt_new_name;
+    }   
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_mp_unknown
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_mp_unknown
+    {
+    buf = qtn_mp_list_unknown;
+    }   
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_unknown_artist
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_nmp_unknown_artist
+    {
+    buf = qtn_nmp_title_unknown_artist;
+    }   
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_mus_title_unknown_album
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_mus_title_unknown_album
+    {
+    buf = qtn_mus_title_unknown_album;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_mus_title_unknown_genre
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_mus_title_unknown_genre
+    {
+    buf = qtn_mus_title_unknown_genre;
+    }   
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_mus_title_unknown_composer
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_mus_title_unknown_composer
+    {
+    buf = qtn_mus_title_unknown_composer;
+    }       
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_delete_fail
+// Text used when a delete fails due to a file in use error
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_delete_fail
+    {
+    buf = qtn_nmp_delete_file_open;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_delete_fail_multi_selection
+// Text used when a delete fails due to a file in use error
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_delete_fail_multi_selection
+    {
+    buf = qtn_nmp_delete_mutl_file_open;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_updating_multiple_items
+// wait note text for updating multiple items
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_updating_multiple_items
+    {
+    buf = qtn_nmp_note_updating_name;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_updating_item
+// wait note text for updating single item
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_updating_item
+    {
+    buf = qtn_nmp_note_updating_name1;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_info_file_not_found
+// info note for file not found
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_info_file_not_found
+    {
+    buf = qtn_mp_note_broken_file;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_query_send_invalid_songs_txt
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_query_send_invalid_songs_txt
+    {
+    buf = qtn_nmp_query_send_valid_songs1;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_send_all_invalid_songs_note_txt
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_send_all_invalid_songs_note_txt
+    {
+    buf = qtn_nmp_note_nothing_to_send;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_category_artist_lbx_emptytext
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_artist_lbx_emptytext
+    {
+    buf = qtn_nmp_no_artists_editor;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_album_lbx_emptytext
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_album_lbx_emptytext
+    {
+    buf = qtn_nmp_no_albums_editor;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_genre_lbx_emptytext
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_genre_lbx_emptytext
+    {
+    buf = qtn_nmp_no_genres_editor;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_composer_lbx_emptytext
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_composer_lbx_emptytext
+    {
+    buf = qtn_nmp_no_composers_editor;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_songs_lbx_emptytext
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_song_lbx_emptytext
+    {
+    buf = qtn_nmp_no_songs_editor;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_rename_with_invalid
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_rename_with_invalid
+    {
+    buf = qtn_nmp_note_rename_with_invalid;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_empty_playlist
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_empty_playlist
+    {
+    buf = qtn_nmp_note_empty_playlist;
+    }
+
+// -----------------------------------------------------------------------------
+//    r_mpx_collection_wait_upnp_loading_song
+//    Text used in wait note while loading a song to remote player.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_wait_upnp_loading_song
+    {
+    buf = qtn_nmp_wait_loading_items;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_menu_play_via_on_device
+// Text used when Play via sub menu opens
+// This is local player type name
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_menu_play_via_on_device
+    {
+    buf = qtn_nmp_options_play_device;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_menu_play_via_home_net
+// Text used when Play via sub menu opens
+// This is remote player type name
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_menu_play_via_home_net
+    {
+    buf = qtn_nmp_options_play_homenet;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_remote_connection_failed
+// Text used when a remote connection failed and player reverts to Local
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_remote_connection_failed
+    {
+    buf = qtn_nmp_note_remote_connection_failed;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_info_remote_copy_one
+// Confirmation note after 1 file was successfully copied to remote server
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_info_remote_copy_one
+    {
+    buf = qtn_nmp_info_copy_one;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_info_remote_copy_many
+// Confirmation note after many files were successfully copied to remote server
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_info_remote_copy_many
+    {
+    buf = qtn_nmp_info_copy_many;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_del_batch_songs_wait_note
+// Text for group deletion wait note.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_del_batch_songs_wait_note
+    {
+    buf = qtn_nmp_del_batch_songs_wait_note;
+    }
+
+    
+//------------------------------------------------------------------------------
+// r_mpx_progress_note
+// Generic Progress note.      
+//------------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_progress_note
+    {
+    flags = EAknProgressNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = 0x1000;
+            control = AVKON_NOTE
+                {
+                layout = EProgressLayout;
+                };
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_details_one_album
+// Details text for single item
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_collection_details_one_album
+    {
+    buf = qtn_vmp_collection_detail_1_album;
+    }
+
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_details_one_song
+// Details text for single item
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_collection_details_one_song
+    {
+    buf = qtn_vmp_detail_1_song;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_details_number_of_songs
+// Details text for multiple items
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_collection_details_number_of_songs
+    {
+    buf = qtn_vmp_detail_n_songs;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_unknown
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_collection_unknown
+    {
+    buf = qtn_vmp_unknown;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_mpx_collection_albumsongs_list_cba
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_collection_albumsongs_list_cba
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyYes;
+            txt = "Play";
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;
+            txt = text_softkey_cancel;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyYes;
+            txt = "";
+            }
+        };
+    }
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/eabi/mpxcollectionviewhgu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_ZN20CMPXCollectionViewHg4NewLEv @ 1 NONAME
+	_ZN20CMPXCollectionViewHg5NewLCEv @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxcollectionviewhg.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxcollectionviewhg.loc  APP_LAYER_LOC_EXPORT_PATH(mpxcollectionviewhg.loc)
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxcollectionviewhg.mif
+OPTION HEADERFILE mpxcollectionviewhg.mbg
+OPTION SOURCEFILE iconlist.txt
+END
+
+
+PRJ_MMPFILES
+//gnumakefile mpxcollectionviewhgicons.mk
+
+mpxcollectionviewhg.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+-c8,8 qgn_prop_mup_songs
+-c8,8 qgn_prop_mup_artist
+-c8,8 qgn_prop_mup_album
+-c8,8 qgn_prop_mup_playlist
+-c8,8 qgn_prop_mup_playlist_auto
+-c8,8 qgn_prop_mup_genre
+-c8,8 qgn_prop_mup_composer
+-c8,8 qgn_menu_folder_apps
+-c8,8 qgn_prop_mup_audio
+-c8,8 qgn_prop_unknown
+-c8,8 qgn_graf_mup_npv_icon_pause
+-c8,8 qgn_graf_mup_npv_icon_play
+-c8,8 qgn_indi_mup_forw_add
+-c8,8 qgn_indi_mup_rew_add
+-c8,8 qgn_indi_mmc_add
+-c8,8 qgn_graf_mup_adtl_reorder_down
+-c8,8 qgn_graf_mup_adtl_reorder_up
+-c8,8 qgn_graf_mup_adtl_reorder_updown
+-c8,8 qgn_graf_mup_ctx_reordersong
+-c8,8 qgn_graf_mup_lst_userplayl
+-c8,8 qgn_graf_mup_lst_corrupttrack
+-c8,8 qgn_graf_mup_lst_brokentrack
+-c8,8 qgn_graf_mup_lst_brokenplayl
+-c8,8 qgn_graf_mup_lst_drm_exp
+-c8,8 qgn_graf_mup_dlst_podcast
+-c8,8 qgn_graf_mup_npv_icon_shuffle.svg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/group/mpxcollectionviewhg.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,122 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxcollectionview.
+*
+*/
+
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../../../inc/musicplayerbldvariant.hrh"
+
+TARGET          mpxcollectionviewhg.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x10207C84
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+//MACRO __S60_MPX_UI_SPEC_COMPLIANCE
+//MACRO __S60_MPX_COLLECTIONVIEW_MSK
+MACRO __ENABLE_MSK
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+#define __ENABLE_PODCAST_IN_MUSIC_MENU
+MACRO __HG_COLLECTIONVIEW
+#ifdef IAD_INCLUDE_SINGLE_CLICK 
+MACRO SINGLE_CLICK_INCLUDED
+#endif
+
+SOURCEPATH      ../src
+SOURCE          mpxcollectionviewhg.cpp
+SOURCE          mpxcollectionviewhgimp.cpp
+SOURCE          mpxcollectionviewhgcontainer.cpp
+SOURCE          mpxcollectionviewhglistboxarray.cpp
+SOURCE          mpxcollectionviewhgplaylisthelper.cpp
+SOURCE          mpxcollectionviewhgtnloader.cpp
+
+START RESOURCE  ../data/mpxcollectionviewhg.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+LIBRARY         eikctl.lib
+LIBRARY         euser.lib
+LIBRARY         apgrfx.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         egul.lib
+LIBRARY         estor.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknicon.lib
+LIBRARY         commonengine.lib
+LIBRARY         sendui.lib
+LIBRARY         centralrepository.lib
+LIBRARY         platformenv.lib // pathinfo
+LIBRARY         commondialogs.lib
+LIBRARY         profileeng.lib
+LIBRARY         cdlengine.lib
+
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcollectionhelper.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxcommoncontainer.lib
+
+LIBRARY         servicehandler.lib  // AIW
+LIBRARY         upnpcommand.lib
+
+LIBRARY         playbackhelper.lib // CMediaRecognizer
+// Cover UI start
+LIBRARY         eikdlg.lib
+LIBRARY         mediatorclient.lib
+LIBRARY         featmgr.lib
+// Cover UI end
+
+LIBRARY         mpxbacksteppingutility.lib 
+
+// Added by Harri for Hurriganes MediaWall mod
+LIBRARY         ws32.lib
+LIBRARY         ecom.lib
+LIBRARY         aknlayout2scalable.lib
+
+LIBRARY         thumbnailmanager.lib    // Album art
+LIBRARY         ganes.lib
+LIBRARY         aknskinsrv.lib
+LIBRARY         bitgdi.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/group/mpxcollectionviewhgicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxcollectionview
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxcollectionview.mif
+HEADERFILENAME=$(HEADERDIR)/mpxcollectionview.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+    mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+        /Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+    @echo $(HEADERFILENAME)&& \
+    @echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhg.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxcollectionview
+*
+*/
+
+
+#ifndef MPXCOLLECTIONVIEWHG_HLP_HRH
+#define MPXCOLLECTIONVIEWHG_HLP_HRH
+
+_LIT( KMusHlpLibMainView, "MUS_HLP_LIB_MAIN_VIEW" );
+_LIT( KMusHlpPlaylistView, "MUS_HLP_PLAYLISTS_VIEW" );
+_LIT( KMusHlpCategoryView, "MUS_HLP_CATEGORY_VIEW" );
+_LIT( KMusHlpTracksView, "MUS_HLP_TRACKS_VIEW" );
+_LIT( KMusHlpPlaylistTracksView, "MUS_HLP_PLAYLISTS_VIEW" );
+_LIT( KMusHlpEmbeddedPlaylistTracksView, "MUS_HLP_PLAYLISTS_VIEW" );
+
+#endif  // MPXCOLLECTIONVIEWHG_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhg.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxcollectionview
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONVIEWHG_HRH
+#define MPXCOLLECTIONVIEWHG_HRH
+
+#define KMPXCollectionViewHgId 0x10207C85
+
+// ENUMS
+
+// command ID's
+enum TMPXCollectionCommandIds
+    {
+    EMPXCmdSongDetails = 0x0010,
+    EMPXCmdAlbumArt,
+    EMPXCmdSend,
+    EMPXCmdDelete,
+    EMPXCmdSetAsRingtone,
+    EMPXCmdCreatePlaylist,
+    EMPXCmdAddToPlaylist,
+    EMPXCmdAddToNewPlaylist,
+    EMPXCmdAddToSavedPlaylist,
+    EMPXCmdFindInMusicShop,
+    EMPXCmdRename,
+    EMPXCmdPlaylistDetails,
+    EMPXCmdReorder,
+    EMPXCmdAddSongs,
+    EMPXCmdRemove,
+    EMPXCmdGoToMusicShop,
+    EMPXCmdGoToMultipleMusicShop,
+    EMPXCmdGoToNokiaMusicShop,
+    EMPXCmdGoToOperatorMusicShop,
+    EMPXCmdMusicLibraryDetails,
+    EMPXCmdSavePlaylist,
+    EMPXCmdReorderGrab,
+    EMPXCmdReorderDrop,
+    EMPXCmdReorderDone,
+    EMPXCmdReorderCancel,
+    EMPXCmdUpArrow,
+    EMPXCmdDownArrow,
+    EMPXCmdUpArrowAfterListboxHandled,
+    EMPXCmdDownArrowAfterListboxHandled,
+    EMPXCmdFind,
+    EMPXCmdFindCancel,
+    EMPXCmdUPnPAiwCmdCopyToExternalCriteria,    
+    EMPXCmdUpnpPlayVia,
+    EMPXCmdUpnpPlayViaLocal,
+    EMPXCmdUpnpPlayViaRemotePlayer,  // 0x0032
+    // Should always be the last one in the list.  Sets the end of the Upnpplayer commands.
+    // Allows for dynamic upnp player commands.  Currently set to allow up to 28 more
+    // dynamic players.  If more are needed then this number needs to be adjusted.
+    EMPXCmdUpnpLastCommandId = 0x004E,
+    EMPXCmdAiwCmdAssign,
+    EMPXCmdUseAsCascade,
+    EMPXCmdGoToAllSongs,
+    EMPXCmdGoToArtistAlbums,    
+    EMPXCmdGoToPlaylists,    
+    EMPXCmdGoToPodcasts,
+    EMPXCmdGoToGenre
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU                
+    ,EMPXCmdRefreshLibrary
+#endif
+#ifdef SINGLE_CLICK_INCLUDED
+    ,EMPXCmdPlayItem
+#endif
+
+    };
+
+// current MediaL operation
+enum TMPXCollectionViewCurrentMediaLOp
+    {
+    EMPXOpMediaLIdle,
+    EMPXOpMediaLCopyToRemote,
+    EMPXOpMediaLGetContainerInfo,
+    EMPXOpMediaLSend,
+    EMPXOpMediaLCollectionDetails,
+    EMPXOpMediaLPlaylistDetails,
+    EMPXOpMediaLRenamePlaylist,
+    EMPXOpMediaLSongDetailsFileCheck,
+    EMPXOpMediaLAlbumArtFileCheck,
+    EMPXOpMediaLNewPlaylistCollectionSongCount,
+    EMPXOpMediaLFindInMusicShopSongDetails,
+    EMPXOpMediaLFindInMusicShopMediaLCompleted
+    };
+
+// current FindAllL operation    
+enum TMPXCollectionViewCurrentFindAllLOp
+    {
+    EMPXOpFindAllLIdle,
+    EMPXOpFindAllLUpnp,
+    EMPXOpFindAllLGetPlaylists,
+    EMPXOpFindAllLRenameArtist,
+    EMPXOpFindAllLRenameAlbum,
+    EMPXOpFindAllLRenameGenre,
+    EMPXOpFindAllLRenameComposer,
+    EMPXOpFindAllLAlbumArtistAddToNewPlaylist,
+    EMPXOpFindAllLAlbumArtistAddToSavedPlaylist,
+    EMPXOpFindAllLPlaylistTracksCount,
+    EMPXOpFindAllLUpnpPlayback
+    };    
+
+// current playlist related operation    
+enum TMPXCollectionViewCurrentPlaylistOp
+    {
+    EMPXOpPLIdle,
+    EMPXOpPLCreating,
+    EMPXOpPlOpening
+    };
+
+// headings in file detail dialog
+enum TMPXCollectionDetailsHeading
+    {
+    EMPXCollectionDetailsSongs,
+    EMPXCollectionDetailsDuration,
+    EMPXCollectionDetailsPhoneMemory,
+    EMPXCollectionDetailsMemoryCard,
+    EMPXCollectionDetailsRefreshed,
+    EMPXCollectionDetailsCount
+    };
+
+// headings in playlist detail dialog    
+enum TMPXPlaylistDetailsHeading
+    {
+    EMPXPlaylistDetailsName,
+    EMPXPlaylistDetailsSongs,
+    EMPXPlaylistDetailsDuration,
+    EMPXPlaylistDetailsUri,
+    EMPXPlaylistDetailsDate,
+    EMPXPlaylistDetailsTime,
+    EMPXPlaylistDetailsCount
+    };
+
+#endif  // MPXCOLLECTIONVIEWHG_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,811 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Collection view container implementation
+*
+*/
+
+
+
+#ifndef CMPXCOLLECTIONVIEWHGCONTAINER_H
+#define CMPXCOLLECTIONVIEWHGCONTAINER_H
+
+
+// INCLUDES
+#include <coecntrl.h>
+
+#include <ganes/HgScrollBufferObserverIface.h>
+#include <ganes/HgSelectionObserverIface.h>
+#include <ganes/HgVgMediaWallObserverIface.h>
+#include <ganes/HgItem.h>
+#include <mpxcommonframeworkdefs.h> // TMPXItemId
+#include "mpxcollectionviewhgtnloader.h"
+#include "mpxcommonlistboxarrayobserver.h"
+#include "mpxcommonlistboxarraybase.h"
+
+// FORWARD DECLARATION
+class CAknContextPane;
+class CAknIconArray;
+class CAknsBasicBackgroundControlContext;
+class CEikMenuPane;
+class CHgScroller;
+class CHgScroller;
+class CHgVgMediaWall;
+class CMPXCollectionViewHgPlaylistHelper;
+class CMPXCommonUiHelper;
+class CMPXMediaArray;
+class MCoeControlObserver;
+class MEikCommandObserver;
+class MEikListBoxObserver;
+class MMPXCollectionUiHelper;
+class MMPXCollectionUtility;
+class MMPXPlaybackUtility;
+class MMpxCbaHandler;
+class TAknsItemID;
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Collection view container.
+ *
+ *  @lib mpxcollectionviewhg.lib
+ *  @since S60 v5.0
+ */
+NONSHARABLE_CLASS( CMPXCollectionViewHgContainer )
+    : public CCoeControl
+    , public MCoeControlObserver
+    , public MMPXCommonListBoxArrayObserver
+	, public MHgScrollBufferObserver
+	, public MHgSelectionObserver
+    , public MMPXCollectionFindObserver
+    , public MHgVgMediaWallObserver
+    , public MMpxTNLoaderObserver
+	{
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 5.1
+     * @param aView Command observer.
+     * @param aObserver MEikListBoxObserver
+     * @param aIsEmbedded ETrue to indicate that view is embedded
+     * @return Pointer to newly created object.
+     */
+    static CMPXCollectionViewHgContainer* NewL(
+        MEikCommandObserver* aView,
+        MEikListBoxObserver* aObserver,
+        TBool aIsEmbedded );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCollectionViewHgContainer();
+
+    /**
+     * Sets playback status with item id
+     *
+     * @param aId item id of the song
+     * @param aStatus status of the song
+     */
+    void SetPlaybackStatusByIdL( TMPXItemId aId, TMPXPlaybackState aStatus, TInt aIndex = 0 );
+
+    /**
+     * Get current playback index
+     *
+     * @return Current playback index, KErrNotFound if nothing is playing
+     */
+    TInt PlaybackIndex();
+
+    /**
+     * Activates reorder mode
+     *
+     * @param aEnable ETrue to enable reorder mode, EFalse to disable
+     */
+    void ActivateReorderMode( TBool aEnable );
+
+    /**
+     * Set reorder mode
+     *
+     * @param aEnable ETrue to enable reorder mode, EFalse to disable reorder mode
+     * @param aIndex current selected index
+     */
+    void SetReorderGrabbedMode( TBool aEnable, TInt aIndex = 0 );
+
+    /**
+     * Determines if it's currently in reorder mode
+     *
+     * @return ETrue if in reorder mode, EFalse otherwise
+     */
+    TBool IsInReorderMode();
+
+    /**
+     * Move current reorder index relatively
+     *
+     * @param aDirection +1 to move down, -1 to move up
+     */
+    void MoveReorderIndex( TInt aDirection );
+
+    /**
+     * Set current reorder index
+     *
+     * @param aIndex current reorder index
+     */
+    void SetReorderIndex( TInt aIndex );
+
+    /**
+     * Confirm reorder
+     */
+    void ConfirmReorderL();
+
+    /**
+     * Cancel reorder
+     */
+    void CancelReorder();
+
+    /**
+     * Gets original index of currently selected item in reorder mode
+     */
+    TInt GetOriginalIndex();
+
+    /**
+     * Update Titlepane icon to reorder image
+     */
+    void UpdateReorderTitleIconL();
+
+    /**
+     * Update titlepane to use original icon
+     */
+    void RestoreOriginalTitleIconL();
+
+    /**
+     * Content is ready
+     */
+    void ContentIsReady( TBool aReady );
+
+    /**
+     * Returns list box array, ownership not transfered
+     *
+     * @since 3.1
+     * @return A pointer to the list box array
+     */
+    CMPXCommonListBoxArrayBase* ListBoxArray() const;
+
+    /**
+     * Return number of listbox items shown in the current listbox.
+     *
+     * @since 3.1
+     * @return The number of items shown in the list box
+     */
+    TInt CurrentListItemCount() const;
+
+    /**
+     * Return total number of listbox items in the listbox.
+     *
+     * @since 3.1
+     * @return Total items in the list box
+     */
+    TInt TotalListItemCount() const;
+
+    /**
+     * Gets top listbox item index (relative to the original listbox).
+     * @return Top listbox item index
+     *
+     * @since 3.1
+     */
+    TInt TopLbxItemIndex() const;
+
+    /**
+     * Gets bottom listbox item index (relative to the original listbox).
+     * @return Bottom listbox item index
+     *
+     * @since 3.1
+     */
+    TInt BottomLbxItemIndex() const;
+
+    /**
+     * Gets current listbox item index (relative to the original listbox).
+     * @return Current listbox item index
+     *
+     * @since 3.1
+     */
+    TInt CurrentLbxItemIndex() const;
+
+    /**
+     * Get current selected listbox items indices (relative to the original
+     * listbox). Ownership not transferred.
+     *
+     * @since 3.1
+     * @return Current listbox item indices
+     */
+    const CArrayFix<TInt>* CurrentSelectionIndicesL() const;
+
+    /**
+     * Sewt current selected listbox items indices
+     *
+     * @since 3.1
+     * @param aIndices Array of selection indices, ownership not transfered
+     */
+    void SetCurrentSelectionIndicesL( CArrayFix<TInt>* aIndices ) const;
+
+    /**
+     * Set top listbox item index.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxTopItemIndex( TInt aIndex );
+
+    /**
+     * Set current listbox item index.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxCurrentItemIndex( TInt aIndex );
+
+    /**
+     * Set current listbox item index and highlight it.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxCurrentItemIndexAndDraw( TInt aIndex );
+
+    /**
+     * Clear listbox selection.
+     *
+     * @since 3.1
+     */
+    void ClearLbxSelection();
+
+    /**
+     * Sets list box backround text. This text is visible if the list box
+     * has no items.
+     *
+     * @param aText The text for the empty list box background.
+     * @since 3.2
+     */
+	void SetLbxEmptyTextL( const TDesC& aText );
+
+    /**
+     * Draws list box item index
+     *
+     * @since 3.2
+     */
+    void DrawLbxItemL( TInt aIndex );
+
+    /**
+     * Set Find box's focus.
+     *
+     * @since 3.1
+     * @param aFocus ETrue if set focus on FindBox. Otherwise, EFalse.
+     */
+    void SetFindBoxFocus( TBool aFocus );
+
+    /**
+     * Handle listbox item addition.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemAdditionL();
+
+    /**
+     * Handle listbox item addition, preserving the current display index.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemAdditionPreserveIndexL();
+
+    /**
+     * Handle listbox item removal.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemRemovalL();
+
+    /**
+     * Show/hide find box
+     *
+     * @since 3.1
+     * @param aIsVisible ETrue to set findbox visible. Otherwise, EFalse
+     */
+    void SetFindBoxVisibilityL( TBool aIsVisible );
+
+    /**
+     * Determine find box visibility
+     *
+     * @since 3.1
+     * @return ETrue if find box is currently visible, EFalse otherwise
+     */
+    TBool FindBoxVisibility();
+
+    /**
+     * Restore the PopupCBA of find box
+     */
+    void RestoreFindBoxPopupCBA();
+
+    /**
+     * Calculate the top index of the visible items
+     *
+     * @since 3.1
+     * @param aBottomIndex the bottom index of the visible items
+     * @return top index
+     */
+    TInt CalculateTopIndex( TInt aBottomIndex );
+
+
+    /**
+     * Enable/disable find box
+     *
+     * @since 3.1
+     * @aEnable ETrue to enable find box, EFalse to disable
+     */
+    void EnableFindBox( TBool aEnable );
+
+    /**
+     * Enable/disable marking
+     *
+     * @since 3.1
+     * @aEnable ETrue to enable marking, EFalse to disable
+     */
+    void EnableMarking( TBool aEnable );
+
+    /**
+     * Custom handling of commands for markable lists.
+     */
+    void HandleMarkableListProcessCommandL( TInt aCommand );
+
+    /**
+     * Custom handling of menu pane for markable lists
+     */
+    void HandleMarkableListDynInitMenuPane(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+
+
+// from base class MMPXViewContainer
+
+    /**
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse HandleKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * Handles the retrieval of the view container's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void HandleHelpContext( TCoeHelpContext& aContext ) const;
+
+    /**
+     * Returns the indicators for the specified item within the view container
+     *
+     * @param aIndex specified array index
+     * @return Indicator icon indices
+     */
+    RArray<TInt> IndicatorsL( TInt aIndex );
+
+    void SetCbaHandler( MMpxCbaHandler* aCbaHandler );
+
+// from base class CCoeControl
+
+    /**
+     * From CCoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CCoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );
+
+    /**
+     * From CoeControl.
+     * Draw this application's view to the screen
+     *
+     * @param aRect the rectangle of this view that needs updating
+     */
+    void Draw( const TRect& aRect ) const;
+
+    /**
+     * From CoeControl.
+     * Get the control input capabilities
+     */
+	TCoeInputCapabilities InputCapabilities() const;
+
+    TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
+
+
+// from base class MCoeControlObserver
+
+    /**
+    * From MCoeControlObserver, Acts upon changes in the hosted control's state.
+    * This class's implementation is trivial and should be able to be safely
+    * re-implemented in directly client-derived classes. For non-base setting
+    * page classes, a call to the base class should be made.
+    * @param aControl Control that caused the event. (not used in default implementation)
+    * @param aEventType Type of the event.
+    */
+    void HandleControlEventL(CCoeControl* aControl, TCoeEvent aEventType);
+
+
+    /**
+     * From MMPXCommonListBoxArrayObserver.
+     * Handle listbox array events
+     *
+     *  @param aEvent list box event
+     */
+    void HandleListBoxArrayEventL(
+        MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent );
+
+
+// from base class MHgScrollBufferObserver
+
+    /**
+     * from MHgScrollBufferObserver
+     * Buffer position changed.
+     * The items between the aBufferStart and aBufferEnd should be loaded as soon as possible.
+     *
+     * @param aBufferStart The index of the first item in buffer.
+     * @param aBufferEnd The index of the last item in buffer.
+     * @param aDirection report direction of scrolling
+     */
+    void Request(TInt aBufferStart, TInt aBufferEnd, THgScrollDirection aDirection);
+
+// from base class MHgBufferOwner
+
+    /**
+     * from MHgBufferOwner
+     *
+     *
+     */
+    void Release(TInt aReleaseStart, TInt aReleaseEnd);
+
+
+// from base class MHgSelectionObserver
+
+    /**
+     * Handle selection.
+     *
+     * @param aIndex Selected item index.
+     */
+    void HandleSelectL( TInt aIndex );
+
+    void HandleSelectL( TInt aIndex, CCoeControl* aControl );
+    /**
+     * Handle opening.
+     *
+     * @param aIndex Opened item index.
+     */
+    void HandleOpenL( TInt aIndex );
+    void HandleOpenL( TInt aIndex, CCoeControl* aControl );
+
+
+    /**
+     *  From MMPXCollectionFindObserver
+     *  Handle callback for "find" operation
+     *
+     *  @param aEntries, CMPXMedia to be returned
+     *  @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     *  @param aError error code
+     */
+    void HandleFindAllL( const CMPXMedia& aResults, TBool aComplete, TInt aError );
+
+    void TNReadyL(TInt aError, CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aIndex);
+
+    /**
+     * Determines if current selected list item is a song
+     *
+     * @return ETrue if is a song, EFalse otherwise
+     */
+	TBool IsSelectedItemASong();
+	
+	void HandleItemCommandL( TInt aCommand );
+	
+	CMPXMedia* SelectedItemMediaL();
+	
+private:
+
+    /**
+     * C++ constructor.
+     */
+    CMPXCollectionViewHgContainer(
+        MEikCommandObserver* aView,
+        MEikListBoxObserver* aObserver,
+        TBool aIsEmbedded);
+
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Creates listbox array
+     */
+    CMPXCommonListBoxArrayBase* CreateListBoxArrayL();
+
+    /**
+     * From MHgVgMediaWallObserver
+     */
+    void HandleMediaWallEvent(TInt aEvent, CHgVgMediaWall* aSender);
+
+    /**
+     * Creates icon array, populates iIconArray to be used by listbox
+     */
+    void CreateIconArrayL();
+
+    /**
+     * Sets default icon for HgList
+     */
+    void SetDefaultIconL();
+
+    /**
+     * Sets default icon for list item
+     */
+    void SetDefaultIconL(TInt aIndex);
+
+    /*
+	 * Adds detail to the list item at the specified index
+     */
+    void AddDetailToDisplayedItemL( CHgItem* aVisualItem, CMPXMedia* aMedia, TInt aIndex);
+    void AddThumbnailToDisplayedItemL( CHgItem* aVisualItem, CMPXMedia* aMedia, TInt aIndex);
+    void SetTitleL( CHgItem* aVisualItem, CMPXMedia* aMedia );
+    void SetSongTitleL( CHgItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailCountL( CHgItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailArtistL( CHgItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailAlbumL( CHgItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailDurationL( CHgItem* aVisualItem, CMPXMedia* aMedia );
+    void UpdateTimeIndicatorsL( TDes& aBuf, TInt aDuration );
+    void SetDetailIndicatorL( CHgItem* aVisualItem, TInt aIndex );
+    void SetDetailIconL( CHgItem* aVisualItem, TInt aIndex );
+    void SetDetailThumbnailL( CMPXMedia* aMedia, TInt aIndex = 0 );
+	CGulIcon* DefaultIconL();
+	void SetDetailIconShuffleL();
+	TBool SetShuffleItemTextL(CHgItem* aItem, CMPXMedia* aMedia);
+	void SetShuffleItemToListL( CHgScroller* aList );
+
+    /**
+     * Set the collection context
+     */
+    void SetCollectionContextL();
+
+    void ProvideDataL( TInt aStart, TInt aEnd );
+
+    void SetScrollbarType();
+
+    void CancelTNRequest();
+
+    /**
+      * Save the selected album item
+      *
+      */
+    void SaveSelectedAlbumItemL(TInt aIndex);
+
+    /**
+     * Write the album name, artist name and album art in media data to file
+     *
+     * @param aMedia         the selected media data in Album view
+     */
+    void WriteToStreamFileL( const CMPXMedia* aMedia );
+
+    /**
+     * Read the album name, artist name and album art from file
+     *
+     * @param aMedia         the media data will be returned
+     */
+    void ReadFromStreamFileL( CMPXMedia* aMedia );
+
+	void RestoreSelectedAlbumItemL(const CMPXMediaArray& aMediaArray);
+
+    /**
+     * Refresh list as needed
+     */
+    void RefreshL(TInt aIndex);
+
+    /**
+     * Refresh list as needed
+     */
+    void RefreshNoThumbnailL(TInt aIndex);
+
+	/**
+	* Clean AlbumArt request Queue
+	*/
+    void CleanAlbumArtReqQueue();
+
+    /**
+     * Handle requests in visible area
+     * @param aBufferStart  the starting buffer index
+     * @param aBufferEnd  the ending buffer index
+     */
+    void ProvideDataIntersectL(TInt aBufferStart, TInt aBufferEnd);
+
+    /**
+     * Refresh list as needed
+     * @param aBufferStart  the starting buffer index
+     * @param aBufferEnd  the ending buffer index
+     */
+    void ProvideDataDifferenceL(TInt aBufferStart, TInt aBufferEnd);
+    void ProvideDataWithoutThumbnailsL(const CMPXMediaArray& aMediaArray, TInt aStartIndex = 0);
+    void ProvideDataWithoutThumbnailsMwL(const CMPXMediaArray& aMediaArray, TInt aStartIndex = 0);
+    void ProvideDataForRangeL( TInt aBufferStart, TInt aBufferEnd );
+
+	void PrepareMediaWallL(const CMPXMediaArray& aMediaArray, TInt aCount);
+	void PrepareMediaWallWithListL(const CMPXMediaArray& aMediaArray, TInt aCount);
+	void PrepareListL(const CMPXMediaArray& aMediaArray, TInt aCount);
+	void ResizeListL(const CMPXMediaArray& aMediaArray, TInt aCount);
+
+	CHgScroller* CurrentListWidget();
+	void ResolveCurrentViewType();
+	void CleanPrevView();
+
+	TBool ShufflePlayAllL(TInt aIndex);
+	void UpdatePathAndOpenL(TInt aIndex, TBool aSelectAll = EFalse);
+	void UpdatePathAndOpenPlaylistL( const CMPXMedia& aResults );
+	void FindAlbumSongsL(TInt aIndex);
+	void FindPlaylistSongsL(TInt aIndex);
+	void FindGenreSongsL(TInt aIndex);
+	TBool IsPlayingCurrentIndexL(CMPXCollectionPath* aPath);
+	void ShowAlbumSongsDialogL( const CMPXMedia& aResults );
+    void ShowAlbumSongsL( const CMPXMedia& aAlbum );
+    void OpenAlbumL(TInt aIndex);
+    void PlayAlbumL(TInt aIndex);
+    void PlayPlaylistL(TInt aIndex);
+    void PlayGenreL(TInt aIndex);
+
+private: // data member
+
+    /**
+     * Context of collection view. It's the exact location within collection navigation
+     * based on category type + category.
+     */
+    enum TContext
+        {
+        EContextUnknown,
+        EContextGroupCollection,
+        EContextGroupArtist,
+        EContextGroupAlbum,
+        EContextGroupPlaylist,
+        EContextGroupSong,
+        EContextGroupPodcast,
+        EContextGroupGenre,
+        EContextGroupComposer,
+        EContextItemArtist,
+        EContextItemAlbum,
+        EContextItemPlaylist,
+        EContextItemSong,
+        EContextItemPodcast,
+        EContextItemGenre,
+        EContextItemComposer
+        };
+
+    enum TDefaultIcon
+        {
+        EMPXDefaultIconNotSet = -1,
+        EMPXDefaultIconArtist,
+        EMPXDefaultIconAlbum,
+        EMPXDefaultIconPlaylist,
+        EMPXDefaultIconSongs,
+        EMPXDefaultIconPodcasts,
+        EMPXDefaultIconGenre,
+        EMPXDefaultIconComposer,
+        EMPXDefaultTitleIconPodcasts,
+        EMPXDefaultIconEmpty
+        };
+
+    enum TViewType
+        {
+        EMPXViewUnknown,
+        EMPXViewCoverFlow,
+        EMPXViewList,
+        EMPXViewTBone
+        };
+
+    enum TFindOp
+        {
+        EMPXNoOp,
+        EMPXOpenAlbum,
+        EMPXPlayAlbum,
+        EMPXPlayPlaylist,
+        EMPXPlayGenre
+        };
+
+    MEikCommandObserver*            iView; // not owned
+    MEikListBoxObserver*            iListBoxObserver; // not owned
+    CAknContextPane*                iContextPane;    // Not owned
+    CMPXCollectionViewListBoxArray* iListBoxArray; // owned
+    CEikImage*                      iNewIcon;  // New context icon, owned
+    CEikImage*                      iOrigIcon;  // New context icon, not owned
+    TBool                           iReorder;
+    TBool                           iReady;
+    TBool                           iIsEmbedded;
+
+    THgScrollDirection iDirection;
+    RArray<TBool> iThumbnailReqMap;
+
+    HBufC* iAlbumTitle;
+    HBufC* iSongTitle;
+
+    TBool iPodcastContext;
+    TBool iTitleSet;
+    TDefaultIcon iCurrentDefaultIcon;
+
+    TFileName iSelectedAlbumItemFileName;
+    CMPXMedia* iSelectedMediaInAlbumView;
+
+	CMPXCommonUiHelper*         iCommonUiHelper;        // Owned
+    MMPXCollectionUtility* 		iCollectionUtility;		// Owned
+    MMPXPlaybackUtility* 		iPlaybackUtility;       // Owned
+
+    CHgScroller* 				iMwListWidget;  		// Owned
+    CHgScroller* 				iListWidget;  		    // Owned
+    CHgVgMediaWall* 			iMediaWall;             // Owned
+    CMpxTNLoader*               iThumbnailManager;      // Owned
+
+    TContext                    iContext;
+    TContext                    iPrevContext;
+    TInt                        iResourceOffset;        // Must be freed
+    TBool                       iIsMarkingEnabled;
+	TInt						iTopIndex;
+	TInt						iBottomIndex;
+	TSize						iImageSize;
+    CAknsBasicBackgroundControlContext* iBgContext; 	// Owned
+
+    CArrayFixFlat<TInt>*        iListSelections;        // Owned
+    CAknIconArray*              iIconArray;             // Owned
+
+    MMPXCollectionUiHelper* iCollectionUiHelper;
+    CMPXCollectionPlaylist* iPlaylist;
+    CMPXCollectionViewHgPlaylistHelper* iPlaylistHelper;
+
+    // List/Media wall management
+    TInt iLastValidMediaItemIndex;
+    TInt iRequestStart;
+    TInt iRequestEnd;
+    TInt iAlbumIndex; // opened album index in mediawall
+    TInt iSelectedAlbumIndex; // selected album index in mediawall
+    TInt iRestoredAlbumIndex; // restored selected album index
+    TBool iDefaultIconSet;
+    MMpxCbaHandler* iCbaHandler;
+    TViewType iCurrentViewType;
+    TViewType iPrevViewType;
+    TFindOp iFindOp;
+
+    };
+
+#endif  // CMPXCOLLECTIONVIEWHGCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,964 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX collection view implementation
+*
+*/
+
+
+#ifndef C_CMPXCOLLECTIONVIEWHGIMP_H
+#define C_CMPXCOLLECTIONVIEWHGIMP_H
+
+// INCLUDES
+#include <eikclb.h>
+#include <AknProgressDialog.h>  // MProgressDialogCallback
+#include <eikprogi.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxcollectionobserver.h>
+#include <mpxplaybackobserver.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionuihelperobserver.h>
+#include <mpxcollectionhelper.h>
+#include <mpxcollectionpath.h>  // TMPXItemId
+#include <mpxviewactivationobserver.h>
+#include "mpxcbahandler.h"
+
+#include "mpxcollectionviewhg.h"
+#include "mpxplaybackframeworkdefs.h" // TMPXPlaybackPlayerType
+#include "mpxwaitnotedefs.h"
+
+// FORWARD DECLARATIONS
+class CAiwGenericParamList;
+class CAiwServiceHandler;
+class CAknNaviLabel;
+class CAknNavigationControlContainer;
+class CAknNavigationDecorator;
+class CAknQueryDialog;
+class CEikButtonGroupContainer;
+class CMPXCollectionOpenUtility;
+class CMPXCollectionPlaylist;
+class CMPXCollectionViewHgContainer;
+class CMPXCommonUiHelper;
+class CMediaRecognizer;
+class CMediatorCommandInitiator;
+class CSendUi;
+class CUpnpCopyCommand;
+class MMPXBackSteppingUtility;
+class MMPXCollectionUtility;
+class MMPXPlaybackUtility;
+class MMPXPlayerManager;
+class MMPXViewUtility;
+class MProfileEngine;
+// CLASS DECLARATION
+
+/**
+ *  MPX collection view.
+ *
+ *  @lib mpxcollectionview.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXCollectionViewHgImp ) : public CMPXCollectionViewHg,
+                                             public MMPXCollectionObserver,
+                                             public MMPXPlaybackObserver,
+                                             public MMPXPlaybackCallback,
+                                             public MEikListBoxObserver,
+                                             public MProgressDialogCallback,
+                                             public MMPXCollectionFindObserver,
+                                             public MMPXCollectionHelperObserver,
+                                             public MMPXCHelperObserver,
+                                             public MMPXViewActivationObserver,
+                                             public MCoeViewDeactivationObserver,
+                                             public MCoeViewActivationObserver,
+                                             public MMpxCbaHandler
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXCollectionViewHgImp* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXCollectionViewHgImp* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCollectionViewHgImp();
+
+    /**
+     * Launch music shop application.
+     *
+     * @ since 3.1
+     */
+    void LaunchMusicShopL();
+
+
+private:
+
+    /**
+     * C++ constructor.
+     */
+    CMPXCollectionViewHgImp();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Delete the selected items
+     * @param aCommand the command that triggered the deletion
+     *
+     */
+    void DeleteSelectedItemsL(TInt aCommand);
+
+    /**
+     * Updates list box
+     *
+     * @param aEntries collection entries opened
+     * @param aIndex focused entry
+     * @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     */
+    void UpdateListBoxL(
+        const CMPXMedia& aEntries,
+        TInt aIndex,
+        TBool aComplete);
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error code to be handled.
+     */
+    void HandleError( TInt aError );
+
+    /**
+     * Updates the navi pane
+     */
+    void UpdateNaviPaneL();
+
+    /**
+     * Updates the title pane
+     */
+    void UpdateTitlePaneL();
+
+    /**
+     * Update navi pane in reorder mode
+     */
+    void UpdateReorderNaviPaneL();
+
+    /**
+     * Updates playback status/indicator
+     * Returns the current selection index of now playing song
+     * if a match is found in current context
+     *
+     * @return Index of the song that is currently playing
+     */
+    TInt UpdatePlaybackStatusL();
+
+    /**
+     * Start either the refresh or scanning note
+     */
+    void StartWaitNoteL( TWaitNoteType aNoteType );
+
+    /**
+     * Start either the delete progress note
+     *
+     */
+    void StartProgressNoteL();
+
+    /**
+     * Updates the progress note text and progress bar
+     *
+     * @param aProgress Indicates the portion of the process completed
+     * @param aProgressText Text to be displayed on the progress note
+     */
+    void UpdateProcessL( TInt aProgress, const TDesC& aProgressText );
+
+    /**
+    * Close a wait note
+    */
+    void CloseWaitNoteL();
+
+    /**
+     * Activates reorder mode
+     */
+    void ActivateReorderGrabbedModeL();
+
+    /**
+     * Deactivates reorder mode
+     *
+     * @param aExit ETrue to exit reorder mode, EFalse otherwise
+     */
+    void DeactivateReorderGrabbedModeL( TBool aExit );
+
+    /**
+     * Change the button group
+     *
+     * @param aResId resource ID
+     */
+    void SetNewCbaL( TInt aResId );
+
+    /**
+     * Display the details dialog
+     *
+     * @param aDataArray Array containing the data to display
+     * @param aDialogResourceId Resource defination for the dialog
+     * @param aTitleResourceId Resource defination for the title of the dialog
+     */
+    void DisplayDetailsDialogL( MDesC16Array& aDataArray,
+        TInt aDialogResourceId, TInt aTitleResourceId );
+
+    /**
+     * Display collection details
+     *
+     * @param aMedia media object containing the library details
+     */
+    void DoShowCollectionDetailsL( const CMPXMedia& aMedia );
+
+    /**
+     * Display playlist details
+     *
+     * @param aMedia media object containing the playlist details
+     */
+    void DoShowPlaylistDetailsL( const CMPXMedia& aMedia );
+
+    /**
+     * Handles Upnp menus from DynInitMenuPaneL()
+     *
+     * @param aResourceId Resource id of the option menu
+     * @param aMenuPane Reference to the menu pane
+     */
+    void HandleDynInitUpnpL( TInt aResourceId, CEikMenuPane& aMenuPane );
+
+    /**
+     * Checks if UPnP AP is defined
+     *
+     * @return ETrue if visible, EFalse otherwise
+     */
+    TBool IsUpnpVisible();
+
+    /**
+     * Displays the available players in the Play via submenu
+     *
+     * @param aMenuPane Menu pane to put the sub menu items
+     */
+    void AddPlayersNamesToMenuL( CEikMenuPane& aMenuPane );
+
+    /**
+     * Adds one player type to the Play via submenu
+     *
+     * @param aMenuPane menu pane to add player name to
+     * @param aCommandId ID of the command
+     * @param aPlayerManager player manager
+     * @param aPlayerType type of the player
+     * @param aMenuText optional menu text
+     */
+     void AddPlayerNameToMenuL( CEikMenuPane& aMenuPane,
+                                TInt aCommandId,
+                                MMPXPlayerManager& aPlayerManager,
+                                TMPXPlaybackPlayerType& aPlayerType,
+                                const TDesC& aMenuText = KNullDesC );
+
+    /**
+     * Retrieves the current player name and type
+     */
+    void GetCurrentPlayerDetails();
+
+    /**
+     * Selects a new player for audio playback
+     *
+     * @param aCommand Command Id to identify which player to use
+     */
+    void SelectNewPlayerL( TInt aCommand );
+
+    /**
+     * Copies selected file(s) to remote player
+     */
+    void CopySelectedItemsToRemoteL();
+
+    /**
+     * Handle call back from collectionframework for Copy to Remote command
+     *
+     * @param aMedia media
+     * @param aComplete all selected medias have been found
+     */
+    void DoHandleCopyToRemoteL(
+        const CMPXMedia& aMedia, TBool aComplete = ETrue );
+
+
+    /**
+     * Create and launch the search URL page to the Service
+     * @param song name, artistname, album name
+     */
+    void DoFindInMusicShopL(const TDesC& aSongName,
+                            const TDesC& aArtistName,
+                            const TDesC& aAlbumName );
+
+    /**
+     * Parameter passed in from viewframework
+     *
+     * @param aParam Parameter pass in from viewframework.
+     */
+    void SetParamL( const TDesC* aParam );
+
+    /**
+     * Get media property for the current song
+     */
+    void DoGetSongMediaPropertyL();
+
+    /**
+     * Find playlists
+     *
+     * @return the number of playlist in the system
+     */
+    TInt FindPlaylistsL();
+
+    /**
+     * Save the changes to the playlist that is currently displaying
+     */
+    void SaveCurrentPlaylistL();
+
+    /**
+     * Handles rename operation complete
+     */
+    void HandleRenameOpCompleteL();
+
+    /**
+     * Checks if send option should be shown
+     *
+     * @return ETrue if send command should be hiden, EFalse if it should be shown
+     */
+    TBool SendOptionVisibilityL();
+
+    /**
+     * Checks if Set as ringtone option should be shown
+     *
+     * @return ETrue if the command should be hiden, EFalse if it should be shown
+     */
+    TBool SetAsRingToneOptionVisibilityL();
+
+    /**
+     * Checks if file details option should be shown
+     *
+     * @return ETrue if the command should be hiden, EFalse if it should be shown
+     */
+    TBool FileDetailsOptionVisibilityL();
+
+    /**
+     * Handle send command
+     */
+    void DoSendL();
+
+    /**
+     * Handle send playlist command
+     *
+     * @param aItemId playlist id
+     */
+    void DoSendPlaylistL( TMPXItemId aItemId );
+
+    /**
+     * Handle call back from collectionframework for send command
+     *
+     * @param aMedia media
+     */
+    void DoHandleSendL( const CMPXMedia& aMedia );
+
+    /**
+     * Handle rename command
+     */
+    void DoHandleRenameL();
+
+    /**
+     * Prepares media object for selected items
+     *
+     * @param aMedia on return, populates the media object with a media array
+     *        containing info for currently selected items used by playlist
+     *        does not own this object
+     */
+    void PrepareMediaForSelectedItemsL( CMPXMedia& aMedia );
+
+    /**
+     * Populates media object with information needed for save to
+     * existing playlist
+     *
+     * @param aMedia media object containing the entry
+     * @param aCollectionId Id for collection containing the object
+     * @return Media object needed for save to playlist operation
+     */
+    CMPXMedia* PopulateMediaLC( const CMPXMedia& aMedia, TMPXItemId aCollectionId );
+
+    /**
+     * Handle rename playlist command
+     * @param aMedia media
+     */
+    void DoHandleRenamePlaylistL( const CMPXMedia& aMedia );
+
+    /**
+     * Set/clears the flags for item in database
+     * @param aIndex index of the item in the list box
+     * @param aMedia media object containing at least the following attribute:
+     *        TMPXAttribute( KMPXMediaIdGeneral,EMPXMediaGeneralCollectionId )
+     * @param aFlag flag to set/clear
+     * @param aSet ETrue to set the flag, EFalse to clear the flag
+     * @param aEnableInfoDialog ETrue to enable info dialog display, EFalse to disable
+     */
+    void UpdateDatabaseFlagL( TInt aIndex, const CMPXMedia& aMedia,
+        TUint aFlag, TBool aSet, TBool aEnableInfoDialog = ETrue );
+
+    /**
+     * Get duration of current view
+     */
+    void GetDurationL();
+
+    /**
+     * Handles file check result
+     *
+     * @param aViewToActivate View to activate if the result is ok
+     * @param aMedia Media object containing the information
+     */
+    void DoHandleFileCheckResultL( TUid aViewToActivate, const CMPXMedia& aMedia );
+
+#ifdef __ENABLE_MSK
+    /**
+     * Updates the middle softkey display to a label or icon depending on
+     *  whether there are marked indices
+     * @param aMskId middle softkey command id
+     */
+    void UpdateMiddleSoftKeyDisplayL( TInt aMskId );
+#endif // __ENABLE_MSK
+
+    /**
+     * Handles the completion of adding a playlist event.
+     * @param aPlaylist, a media object representing the exported
+     *        playlist. The content of this object is the same
+     *        as what's supplied in AddPlaylistL, except that
+     *        URI for the playlist file is added to the object
+     *        upon successful processing of AddPlaylistL. Client
+     *        should take over the ownership of this object. NULL
+     *        if an error has occured while processing AddPlaylistL.
+     * @param aError. the error code for AddPlaylistL processing
+     *        error.
+     */
+    void HandleAddCompletedL( CMPXMedia* aPlaylist, TInt aError );
+
+    /**
+    * Handles the completion of setting a media event.
+    * @param aMedia, a media object representing the updated media.
+    * @param aError. the error code for SetL processing error.
+    */
+    void HandleSetCompletedL( CMPXMedia* aMedia, TInt aError );
+
+    /**
+     * Handle playback message
+     *
+     * @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+    /**
+     * Handle collection message
+     *
+     * @param aMessage collection message
+     */
+    void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+
+    /**
+    * Calls to Re-open the collection view
+    * @param aShowWaitDlg show the "opening" dialog or not
+    */
+    void DoIncrementalOpenL( TBool aShowWaitDlg = ETrue );
+
+    /**
+     * Start wait note for delayed action due to the items not ready
+     * (incremental openL change)
+     *
+     * @param aCommand the action to be executed when the items become ready
+     * @param aNote text for wait note
+     * @param aSkipDisplay flag use to determine if waitnote should be displayed or not
+     */
+    void StartDelayedActionL( TInt aCommand, TDesC& aNote, TBool aSkipDisplay = EFalse );
+
+// from base class MProgressDialogCallback
+
+    /**
+     * From MProgressDialogCallback
+     * Callback method
+     * Get's called when a dialog is dismissed.
+     *
+     * @param aButtonId Button pressed when the dialog is dismissed
+     */
+    void DialogDismissedL( TInt aButtonId );
+
+// from base class MMPXCollectionObserver
+
+    /**
+     * From MMPXCollectionObserver
+     * Handle collection message.
+     *
+     * @param aMessage Collection message
+     * @param aErr system error code.
+     */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d a folder
+     *
+     *  @param aEntries collection entries opened
+     *  @param aIndex focused entry
+     *  @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     *  @param aError error code
+     */
+    void HandleOpenL(
+        const CMPXMedia& aEntries,
+        TInt aIndex,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d an item. Client typically responds by
+     *  'playing' the item
+     *
+     *  @param aPlaylist collection path to item
+     *  @param aError error code
+     */
+    void HandleOpenL(
+        const CMPXCollectionPlaylist& aPlaylist,
+        TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handle media properties
+     *
+     *  @param aMedia media
+     *  @param aError error code
+     */
+    void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+    /**
+     * From MMPXCollectionObserver
+     */
+    void HandleCommandComplete(CMPXCommand* aCommandResult,
+                               TInt aError);
+
+// from base class MMPXCollectionHelperObserver
+
+    /**
+     * From MMPXCollectionHelperObserver
+     * Callback function to signal that adding a file is complete
+     *
+     * @param aError, error of the operation
+     */
+    void HandleAddFileCompleteL( TInt aErr );
+
+// from base class MMPXCHelperObserver
+
+    /**
+     * From MMPXCHelperObserver
+     * Handles the completion of any collection helper event.
+     *
+     * @param aOperation, operation completed
+     * @param aErr. the error code
+     * @param aArgument Argument returned from the operation
+     */
+    void HandleOperationCompleteL( TCHelperOperation aOperation,
+                                   TInt aErr,
+                                   void* aArgument );
+
+// from base class MMPXPlaybackObserver
+
+    /**
+     * From MMPXPlaybackObserver
+     * Handle playback message
+     *
+     * @param aMessage playback message
+     * @param aErr system error code.
+     */
+    void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+// from base class MMPXPlaybackCallback
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle playback property
+     *
+     * @param aProperty the property
+     * @param aValue the value of the property
+     * @param aError error code
+     */
+    void HandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue,
+        TInt aError );
+
+    /**
+     * 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
+     *
+     * @param aPlayer UID of the player
+     * @param aSubPlayers a list of sub players
+     * @param aComplete ETrue no more sub players. EFalse more subplayer
+     *                  expected
+     * @param aError error code
+     */
+    void HandleSubPlayerNamesL(
+        TUid aPlayer,
+        const MDesCArray* aSubPlayers,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle media properties
+     *
+     * @param aMedia media
+     * @param aError error code
+     */
+    void HandleMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Returns views id.
+     *
+     * @return Views Uid
+     */
+    TUid Id() const;
+
+    /**
+     * From CAknView
+     * Command handling function.
+     *
+     * @param aCommand Command which is handled
+     */
+    void HandleCommandL( TInt aCommand );
+
+	/**
+	 * From CAknView
+	 * Called when status pane layout has changed
+	 */
+	void HandleStatusPaneSizeChange();
+
+    /**
+     * From CAknView
+     * Handles a view activation.
+     *
+     * @param aPrevViewId Specifies the view previously active.
+     * @param aCustomMessageId Specifies the message type.
+     * @param aCustomMessage The activation message.
+     */
+    void DoActivateL(
+        const TVwsViewId& aPrevViewId,
+        TUid aCustomMessageId,
+        const TDesC8& aCustomMessage );
+
+    /**
+     * From CAknView
+     * View deactivation function.
+     */
+    void DoDeactivate();
+
+    /**
+     * From CAknView
+     * Foreground event handling function.
+     *
+     * @param aForeground Indicates the required focus state of the control.
+     */
+    void HandleForegroundEventL( TBool aForeground );
+
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    void DynInitMenuPaneL(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+
+// from MEikListBoxObserver
+
+    /**
+     * From MEikListBoxObserver
+     * Handles listbox events.
+     *
+     * @param aListBox Listbox where the event occurred.
+     * @param aEventType Event type.
+     */
+     void HandleListBoxEventL(
+        CEikListBox* aListBox,
+        TListBoxEvent aEventType );
+
+// from MEikCommandObserver
+
+    /**
+     * From MEikCommandObserver
+     * Processes user commands.
+     *
+     * @param aCommandId ID of the command to respond to.
+     */
+    virtual void ProcessCommandL(TInt aCommandId);
+
+// from MMPXCollectionFindObserver
+
+    /**
+     * From MMPXCollectionFindObserver
+     * Handle callback for "find" operation
+     * @param aEntries, CMPXMedia to be returned
+     * @param aComplete ETrue no more entries. EFalse more entries
+     *                  expected
+     * @param aError error code
+     */
+    virtual void HandleFindAllL(const CMPXMedia& aResults,
+                                TBool aComplete,TInt aError);
+
+// from MMPXViewActivationObserver
+
+    /**
+     * From MMPXViewActivationObserver
+     * Handle view activation.
+     *
+     * @param aCurrentViewType Current view type Uid.
+     * @param aPreviousViewType Previous view type Uid.
+     */
+    void HandleViewActivation(
+        const TUid& aCurrentViewType,
+        const TUid& aPreviousViewType );
+    /**
+     * @see MMPXViewActivationObserver
+     */
+    void HandleViewUpdate(
+        TUid aViewUid,
+        MMPXViewActivationObserver::TViewUpdateEvent aUpdateEvent,
+        TBool aLoaded,
+        TInt aData);
+
+// from MCoeViewActivationObserver
+
+    /**
+     * From MCoeViewActivationObserver
+     * Handle view activation.
+     *
+     * @param aNewlyActivatedViewId newly activated view id.
+     * @param aViewIdToBeDeactivated deactivated view id.
+     */
+    void HandleViewActivation(
+        const TVwsViewId& aNewlyActivatedViewId,
+        const TVwsViewId& aViewIdToBeDeactivated );
+
+// from MCoeViewDeactivationObserver
+    /**
+    * Handles view deactivation notification from view server
+    */
+    void HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,
+                                const TVwsViewId& aNewlyActivatedViewId);
+
+    void InitiateWaitDialogL();
+    void FillAiwParametersL( CAiwGenericParamList& aParamList );
+
+    void GetUint32Presentation( TUint32& aResult, const TDesC8& aBuf, TInt aOffset );
+    /**
+     * Launches Java Midlet Music Store
+     *
+     * @param aUid Uid of the Java app generated dynamically
+     */
+    void LaunchOperatorJavaMusicShopL(TUid aUid) ;
+
+    /**
+     * Launches Native Music Shop
+     *
+     * @param aUid Uid of the native app for music Shp
+     */
+ 	void LaunchOperatorNativeMusicShopL();
+ 		/**
+      * Launches Native URL Music Shop
+      *
+      * @param URl of the native app for music Shp
+      */
+ 	void LaunchOperatorURLMusicShopL();
+
+ 	/*
+ 	 * Stores the current list box item index.
+ 	 */
+ 	void StoreListboxItemIndexL();
+
+
+ 	/*
+ 	 * Internal function for registering to BackStepping service.
+ 	 */
+ 	void HandleBacksteppingActivation();
+
+ 	void ChangeCbaVisibility( TBool aVisible );
+
+    void HandleInitMusicMenuPaneL(CEikMenuPane* aMenuPane );
+
+    void OpenAllSongsL();
+    void OpenArtistAlbumsL();
+    void OpenPlaylistsL();
+    void OpenGenreL();
+    void OpenPodcastsL();
+
+
+private:    // Data
+
+    MMPXCollectionUtility*      iCollectionUtility;
+    CMPXCollectionViewHgContainer* iContainer;
+    MMPXPlaybackUtility*        iPlaybackUtility;
+    MMPXViewUtility*            iViewUtility;
+    CMPXCommonUiHelper*         iCommonUiHelper;
+    MMPXCollectionUiHelper*     iCollectionUiHelper;
+    MMPXCollectionHelper*       iCollectionHelper;
+    CMPXMedia*                  iUserPlaylists;
+
+    CSendUi*                    iSendUi;
+    HBufC*                      iTitle;
+    HBufC*                      iDuration;
+    HBufC*                      iOriginalTitle;
+    HBufC*                      iOriginalDuration;
+    HBufC*                      iNewName;
+    CArrayFix<TInt>*            iBottomIndex;
+
+    TBool                       iBackOneLevel;
+    TBool                       iPossibleJump;
+    TBool                       iIsGrabbed;
+    TBool                       iIsEmbedded;
+    TBool                       iAddingSong;
+    TBool                       iIsDeleting;
+    TBool                       iIsSavingReorderPlaylist;
+    TBool                       iIsWaitNoteCanceled;
+    TBool                       iInvalidFileExist;
+    TBool                       iHandlingKeyEvent;
+    TBool                       iAddingToNewPlaylist;
+    TBool                       iExitOptionHidden;
+    TBool                       iGoToMusicShopOptionHidden;
+    TBool                       iIgnoreNextFocusChangedMessage;
+    TBool                       iCollectionReady;  // for incremental open
+    TBool                       iCollectionCacheReady; //cache ready
+
+    TInt                        iCurrentPlaylistOp;
+    TInt                        iNumSongAddedToPlaylist;
+    TMPXItemId                  iPlaylistId;
+
+    TInt                        iCurrentMediaLOp;   // current mediaL operation
+    TInt                        iCurrentFindAllLOp; // current FindAllL operation
+    TInt                        iLastDepth;
+    TInt                        iPlayIndex;
+    TInt                        iResourceOffset;       // must be freed
+    TInt                        iSetMediaLCount;
+
+    TInt                        iCurrentHighlightedIndex;
+
+    TInt                        iCachedCommand; // for incremental open
+    CListBoxView::CSelectionIndexArray* iCachedSelectionIndex;
+
+    CAknNavigationDecorator*        iNaviDecorator;
+    CAknNaviLabel*                  iNaviLabel;
+    CAknNavigationControlContainer* iNaviPane;
+
+    CEikButtonGroupContainer*       iCurrentCba;
+
+    CAknQueryDialog*            iConfirmationDlg;
+
+    const CArrayFix<TInt>*      iSelectionIndexCache; // not owned
+#ifdef __ENABLE_MSK
+    TInt                            iCurrentMskId;
+    TBool                           iShowContextMenu;
+#endif // __ENABLE_MSK
+
+    MProfileEngine*             iProfileEngine;
+
+    RArray<TUid> iPlayersList;
+    CAiwServiceHandler* iServiceHandler;
+    TInt iErrorAttachCopyMenu;
+    TMPXPlaybackPlayerType iCurrentPlayerType;
+    HBufC* iSubPlayerName;
+
+    HBufC* iCurrentSelectedIndex;   // current selected item index
+    TBool   iUsingNokiaService;
+
+    CMPXCollectionOpenUtility* iIncrementalOpenUtil;
+
+    TInt iUpCount;
+    TInt iDownCount;
+
+    CMediatorCommandInitiator* iCommandInitiator;
+    TPtrC iItemTitle;
+    TInt iWaitNoteId;
+    TBool iCoverDisplay;
+
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+    TBool iPodcast;
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+
+    MMPXBackSteppingUtility* iBackSteppingUtility;
+
+    TBool iUSBOnGoing;
+    TBool iInAlbumArtDialog;
+    TBool iDisablePodcasting;
+    TProcessPriority iPriority;
+    TBool iInSongDetails;
+
+    TBool iUpnpFrameworkSupport;
+    CMediaRecognizer* iMediaRecognizer;
+    TInt iErrorAttachAssignMenu;
+    TWaitNoteType iNoteType;
+
+    // Music Store
+    TInt iOperatorMusicStore;
+    TUint32 iMusicStoreUID;
+	TUint32 iOperatorNativeMusicStoreUID;
+    TUid iOperatorMusicStoreUID;
+    HBufC16* iOperatorMusicStoreName;
+    TInt iOperatorMusicStoreType;
+    TInt iMusicStoreWebPage;
+    HBufC16* iOperatorMusicStoreURI;
+
+    // Progress note for delete
+    CAknProgressDialog*	iProgressDialog;
+    CEikProgressInfo*	iProgressInfo;
+    TBool iIsAddingToPlaylist;  // flag used to handle the return by adding songs incrementally
+    CUpnpCopyCommand* iUpnpCopyCommand;
+    TBool iActivateBackStepping;
+    TBool iOpeningNote; // Waitnote is opening
+	TBool iMarkedAll;
+	TBool iFirstIncrementalBatch;
+    };
+
+#endif  // C_CMPXCOLLECTIONVIEWHGIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhglistboxarray.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,280 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listbox array for collection view.
+*
+*/
+
+
+#ifndef C_CMPXCOLLECTIONVIEWHGLISTBOXARRAY_H
+#define C_CMPXCOLLECTIONVIEWHGLISTBOXARRAY_H
+
+#include "mpxcommonlistboxarraybase.h"
+
+// FORWARD DECLARATIONS
+class TAknsItemID;
+
+// CLASS DECLARATION
+
+/**
+ *  Listbox array for collection view container.
+ *  Creates item text descriptors according to the list model.
+ *
+ *  @lib mpxcollectionview.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXCollectionViewListBoxArray ): public CMPXCommonListBoxArrayBase
+    {
+public:  // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.1
+     * @return Pointer to newly created object.
+     */
+    static CMPXCollectionViewListBoxArray* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCollectionViewListBoxArray();
+
+    /**
+     * Sets playback status with item id
+     *
+     * @since 3.1
+     * @param aId item id of the song
+     * @param aStatus status of the song
+     * @return The index of previous playing song
+     */
+    TInt SetPlaybackStatusByIdL( TMPXItemId aId, TMPXPlaybackState aStatus, TInt aIndex );
+
+    /**
+     * Activates reorder mode
+     *
+     * @since 3.1
+     * @param aEnable ETrue to enable reorder mode, EFalse to disable
+     */
+    void ActivateReorderMode( TBool aEnable );
+
+    /**
+     * Set reorder mode
+     *
+     * @since 3.1
+     * @param aEnable ETrue to enable reorder mode, EFalse to disable reorder mode
+     * @param aIndex current selected index
+     */
+    void SetReorderGrabbedMode( TBool aEnable, TInt aIndex = 0 );
+
+    /**
+     * Move current reorder index
+     *
+     * @since 3.1
+     * @param aDirection +1 to move down, -1 to move up
+     */
+    void MoveReorderIndex( TInt aDirection );
+
+    /**
+     * Set current reorder index
+     *
+     * @since 3.1
+     * @param aIndex current reorder index
+     */
+    void SetReorderIndex( TInt aIndex );
+
+    /**
+     * Confirm reorder
+     *
+     * @since 3.1
+     */
+    void ConfirmReorderL();
+
+    /**
+     * Cancel reorder
+     *
+     * @since 3.1
+     */
+    void CancelReorder();
+
+    /**
+     * Gets original index of currently selected item in reorder mode
+     *
+     * @since 3.1
+     * @return The original index of the current item in reorder mode
+     */
+    TInt GetOriginalIndex() const;
+
+    /**
+     * Gets the index for the song that's currently playing
+     *
+     * @return The index for the song that's currently playing
+     */
+    TInt GetPlaybackIndex() const;
+
+    /**
+     * Indicates if Unknown entry exists in this view
+     *
+     * @since 3.1
+     * @return ETrue if "unknown" category exists, EFalse otherwise
+     */
+    TBool IsCategoryUnknownExist() const ;
+
+    /**
+     * Checks if the item is a broken link, ETrue if broken
+     *
+     * @since 3.1
+     * @param aIndex index of the item
+     * @return ETrue if the item is a broken link, EFalse otherwise
+     */
+    TBool IsItemBrokenLinkL( TInt aIndex ) const ;
+
+    /**
+     * Checks if the item is corrupted, ETrue if corrupted
+     *
+     * @since 3.1
+     * @param aIndex index of the item
+     * @return ETrue if the item is corrupted link, EFalse otherwise
+     */
+    TBool IsItemCorruptedL( TInt aIndex ) const;
+
+    /**
+     * Get array of indicator icon indices at the specified index
+     */
+    RArray<TInt> IndicatorIconIndicesL( TInt aIndex);
+
+public: // Functions from base classes
+
+    /**
+     * From MDesCArray, indexes into a descriptor array.
+     *
+     * @param aIndex The position of the descriptor element within a descriptor array.
+     * @return Descriptor element located at position aIndex within a descriptor array
+     */
+    TPtrC MdcaPoint( TInt aIndex ) const;
+
+    /**
+     * From CMPXCommonListBoxArrayBase
+     * Creates icon array
+     *
+     * @return Pointer to the created icon array
+     */
+    CAknIconArray* CreateIconArrayL();
+
+    /**
+     * From CMPXCommonListBoxArrayBase
+     * Appends media array to the current array
+     *
+     * @param aMedia media array to append
+     */
+    void AppendMediaL( const CMPXMedia& aMedia );
+
+private: // constructors
+
+    /**
+     * C++ constructor.
+     */
+    CMPXCollectionViewListBoxArray();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+private: // new functions
+
+    /**
+     * Load an icon and append it to an icon array.
+     *
+     * @param aArray    pointer to the icon array
+     * @param aID       skin id of the icon
+     * @param aMbmFile  path to the mbm/mif file containing the icon
+     * @param aBitmapId mbm id of the bitmap
+     * @param aMaskId   mbm id of the mask
+     */
+    void AppendIconToArrayL(
+        CAknIconArray* aArray,
+        const TAknsItemID& aID,
+        const TDesC& aMbmFile,
+        TInt aBitmapId,
+        TInt aMaskId );
+
+    /**
+     * Load an icon and append it to an icon array.
+     *
+     * @param aArray    pointer to the icon array
+     * @param aID       skin id of the icon
+     * @param aColorId  Item ID of the color table.
+     * @param aColorIndex Index in the color table.
+     * @param aMbmFile  path to the mbm/mif file containing the icon
+     * @param aBitmapId mbm id of the bitmap
+     * @param aMaskId   mbm id of the mask
+     */
+    void AppendColorIconToArrayL(
+        CAknIconArray* aArray,
+        const TAknsItemID& aID,
+        const TAknsItemID& aColorId,
+        TInt aColorIndex,
+        const TDesC& aMbmFile,
+        TInt aBitmapId,
+        TInt aMaskId );
+
+    /**
+     * Maps list box index to array index in reorder mode
+     *
+     * @aIndex listbox index
+     * @return The mapped index
+     */
+    TInt GetArrayIndexForListBoxIndex( TInt aIndex ) const;
+
+    /**
+     * Get reorder icon
+     *
+     * @return The index of the reorder icon
+     */
+    TInt GetReorderIcon() const;
+
+    /**
+     * Retrieve indexes into a descriptor array.
+     *
+     * @param aIndex The position of the descriptor element within a descriptor array.
+     * @return Descriptor element located at position aIndex within a descriptor array
+     */
+    TPtrC GetMdcaPointL( TInt aIndex ) const;
+
+    /**
+     * Sets playback status
+     *
+     * @param aIndex index of the song to set
+     * @param aStatus status of the song
+     * @return The index of previous playing song
+     */
+    TInt SetPlaybackStatusByIndex( TInt aIndex, TMPXPlaybackState aStatus );
+
+private: // data
+    CMPXMediaArray*         iMediaOwned;
+
+    TBool                   iReorderActivated;
+    TBool                   iReorder;
+    TInt                    iOriginalIndex;
+    TInt                    iMovedIndex;
+    TBool                   iMoveNowPlaying;
+
+    TBool                   iIsUnknownExist;
+    HBufC*                  iUnknown;
+    TInt                    iMMCDrive;
+    };
+
+#endif  // C_CMPXCOLLECTIONVIEWHGLISTBOXARRAY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgplaylisthelper.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,258 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Collection playlist helper
+*
+*/
+
+
+#ifndef CMPXCOLLECTIONVIEWHGPLAYLISTHELPER_H
+#define CMPXCOLLECTIONVIEWHGPLAYLISTHELPER_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxcollectionobserver.h>
+#include <mpxplaybackobserver.h>
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CMPXAppUi;
+class CMPXCollectionPath;
+class MMPXCollectionUtility;
+class MMPXPlaybackUtility;
+class MMPXCollectionUiHelper;
+class CMPXCollectionOpenUtility;
+
+// CLASS DECLARATION
+/**
+ * Saves/restores current playback path.
+ *
+ *  @lib mpxcommoncontainer.dll
+ */
+NONSHARABLE_CLASS(CMPXCollectionViewHgPlaylistHelper) : public CBase,
+                        public MMPXCollectionObserver,
+                        public MMPXPlaybackObserver
+    {
+    public: // Constructors and destructor
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since 3.1
+         * @param aPlaybackUtility Playback utility to use.
+         * @param aCollectionUiHelper UI helper to use
+         * @return Pointer to newly created object.
+         */
+        static CMPXCollectionViewHgPlaylistHelper * NewL(MMPXPlaybackUtility* aPlaybackUtility,
+                                      MMPXCollectionUiHelper* aCollectionUiHelper);
+
+        /**
+         * Two-phased constructor.
+         *
+         * @since 3.1
+         * @param aPlaybackUtility Playback utility to use.
+         * @param aCollectionUiHelper UI helper to use
+         * @return Pointer to newly created object.
+         */
+        static CMPXCollectionViewHgPlaylistHelper * NewLC(MMPXPlaybackUtility* aPlaybackUtility,
+                                       MMPXCollectionUiHelper* aCollectionUiHelper);
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMPXCollectionViewHgPlaylistHelper();
+
+    public: // New funtions
+
+        /**
+         *  Loads current collection path
+         */
+        void LoadPathL();
+
+        /**
+         * Loads the default collection path
+         * @param some delay to load the path (in ms)
+         */
+        void LoadDefaultPathL( TInt aDelay = 0 );
+
+        /**
+         * Return if the default playlist has been initialized
+         *
+         * @return ETrue if the path has been initialized, EFalse otherwise;
+         */
+        TBool Initialized();
+
+        /**
+         * Return if the playlist is currently initializing
+         *
+         * @return ETrue it's currently initializing, EFalse otherwise;
+         */
+        TBool IsInitializing();
+
+        /**
+         * Set the initialized state
+         *
+         * @param aInit The current state of initialization.
+         */
+        void SetInitialized( TBool aInit );
+
+        /**
+         * Cancels the initialize operation
+         */
+        void CancelInit();
+
+        /**
+         *  Initialize default playlist
+         */
+        void InitPlaylistL(TBool aEnableShuffle);
+
+        /**
+         *  Initialize playlist with path
+         */
+        void InitPlaylistL(CMPXCollectionPath& aPath, TBool aEnableShuffle);
+
+    private:
+
+        /**
+         * C++ Constructor
+         *
+         * @param aPlaybackUtility Playback utility to use.
+         * @param aCollectionUiHelper collection ui helper to use
+         */
+        CMPXCollectionViewHgPlaylistHelper (MMPXPlaybackUtility* aPlaybackUtility,
+                         MMPXCollectionUiHelper* aCollectionUiHelper);
+
+        /**
+         * By default Symbian 2nd phase constructor is private.
+         */
+        void ConstructL();
+
+    // from base class MMPXCollectionObserver
+
+        /**
+         * From MMPXCollectionObserver
+         * Handle media properties.
+         *
+         * @since 3.1
+         * @param aMedia  media properties.
+         * @param aError Error code.
+         */
+        void HandleCollectionMediaL(
+            const CMPXMedia& aMedia,
+            TInt aError );
+
+        /**
+         * From MMPXCollectionObserver
+         * Handle collection message.
+         *
+         * @since 3.1
+         * @param aMessage Collection message
+         * @param aErr system error code.
+         */
+        void HandleCollectionMessage(
+            CMPXMessage* aMessage, TInt aError );
+
+        /**
+         * From MMPXCollectionObserver
+         * Handles the collection entries being opened.
+         *
+         * @since 3.1
+         * @param aEntries Collection entries opened.
+         * @param aIndex Focused entry.
+         * @param aComplete ETrue no more entries. EFalse more entries
+         *                  expected.
+         * @param aError Error code.
+         */
+        void HandleOpenL(
+            const CMPXMedia& aEntries,
+            TInt aIndex,
+            TBool aComplete,
+            TInt aError );
+
+        /**
+         * From MMPXCollectionObserver
+         * Handles the item being opened.
+         *
+         * @since 3.1
+         * @param aPlaylist Collection playlist, owner ship is transfered.
+         * @param aError Error code.
+         */
+        void HandleOpenL(
+            const CMPXCollectionPlaylist& aPlaylist,
+            TInt aError );
+
+        /**
+         * From MMPXPlaybackObserver
+         * Handle playback message
+         *
+         * @param aMessage playback message
+         * @param aErr system error code.
+         */
+        void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+    private:  // New functions
+
+        /**
+         * Initialize playback engine with the path provided
+         *
+         * @param aPath The collection path to initialize playback engine with.
+         */
+        void InitPlaybackEngineL( CMPXCollectionPath& aPath );
+
+        /**
+         * Handle playback message
+         *
+         * @param aMessage playback message
+         */
+        void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+        /**
+         * Handle collection message
+         *
+         * @param aMessage collection message
+         */
+        void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+
+        /**
+        * Start the incremental open operation at a particular index
+        * @param aPath path to open
+        * @param aIndex index to start reading from
+        * @param aDelay delay to start the operation (in ms)
+        */
+        void DoIncrementalOpenL( CMPXCollectionPath& aPath, TInt aIndex,
+                                 TInt aDelay = 0 );
+
+    private:
+
+        MMPXCollectionUtility* iCollectionUtility; 	  // owned
+        MMPXPlaybackUtility* iPlaybackUtility;  	  // not owned
+        MMPXCollectionUiHelper* iCollectionUiHelper;  // not owned
+        CMPXCollectionOpenUtility* iIncOpenUtil;	  // owned
+
+        TBool iPathInitialized;
+        TBool iIsInitializing;
+        TBool iInitCanceled;
+        TBool iDefaultPath;      	// Are we initializing the default path?
+        TMPXItemId iSelectionId; 	// Item we want to play
+        TInt  iSelectionIndex; 		// Index we are restoring to
+        TBool iLoadSavedPath;    	// Load a saved path or load a default path?
+        TBool iUSBOngoing;       	// is usb ongoing
+        TUid iRootPathId;
+		TBool iEnableShuffle;		// enable shuffle play
+    };
+
+#endif // CMPXCOLLECTIONVIEWHGPLAYLISTHELPER_H
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/inc/mpxcollectionviewhgtnloader.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,101 @@
+
+
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Thumbnail loader
+*
+*/
+
+#ifndef MPXCOLLECTIONVIEWHGTNLOADER_H_
+#define MPXCOLLECTIONVIEWHGTNLOADER_H_
+
+#include <e32base.h>
+#include <thumbnailmanager.h> // needs to be included here because of a bug in thumbnailmanagerobserver.h
+#include <thumbnailmanagerobserver.h>
+
+class CThumbnailManager;
+class CFbsBitmap;
+class CAsyncCallBack;
+
+/**
+ * Observer iface
+ */
+class MMpxTNLoaderObserver
+    {
+public:
+    virtual void TNReadyL(TInt aError, CFbsBitmap* aBitmap, CFbsBitmap* aMask, TInt aIndex) = 0;
+    };
+
+/**
+ * TN Loader
+ */
+NONSHARABLE_CLASS( CMpxTNLoader ) : public CBase, public MThumbnailManagerObserver
+    {
+public: // CONSTRUCTORS & DESCTRUCTOR
+
+    static CMpxTNLoader* NewL(MMpxTNLoaderObserver& aObserver, TThumbnailSize aSize );
+    virtual ~CMpxTNLoader();
+
+public: // NEW FUNCTIONS
+
+    void LoadThumbL(TInt aIndex, const TDesC& aFileName );
+    void CancelThumb( TInt aIndex );
+    void CancelAll();
+    void SetSizeL( TThumbnailSize aSize );
+
+private: // From MThumbnailManagerObserver
+
+    void ThumbnailPreviewReady( MThumbnailData& aThumbnail,
+        TThumbnailRequestId aId );
+    void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail,
+        TThumbnailRequestId aId );
+
+private: // CONSTRUCTORS
+
+    CMpxTNLoader(MMpxTNLoaderObserver& aObserver,
+            TThumbnailSize aSize );
+    void ConstructL();
+
+private: // NEW FUNCTIONS
+
+    TInt FindLoadingById(TThumbnailRequestId aId, TBool aRemove = EFalse);
+    TInt FindLoadingByIndex(TInt aIndex, TBool aRemove = EFalse);
+    static TInt LoadThumbnail( TAny* aSelf );
+    void LoadNextTN();
+
+private: // DATA
+
+    MMpxTNLoaderObserver& iObserver;
+    CThumbnailManager* iTnEngine; // Own
+
+    // Loading information
+    class TLoadingTN
+        {
+    public:
+        TLoadingTN(TThumbnailRequestId aId, TInt aIndex, const TDesC& aFileName )
+        : iId(aId), iIndex(aIndex), iFileName( aFileName )
+            {
+            }
+
+        TThumbnailRequestId iId;
+        TInt iIndex;
+        TFileName iFileName;
+        };
+
+    RPointerArray<TLoadingTN> iLoading; // Loading Thubmbs
+    CAsyncCallBack* iAsyncCallBack;
+    TThumbnailSize iSize;
+    };
+
+#endif // MPXCOLLECTIONVIEWHGTNLOADER_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/loc/mpxcollectionviewhg.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,516 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxcollectionviewhg
+*
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Text in title pane
+// d:Collection view
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mp_title_collection_view "Music player"
+
+// d:Text in title pane for reordering
+// d:Collection view
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_nmp_title_reorder_list "Reorder list"
+
+// d:Options menu item for opening Track details popup.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_details_track "Song details"
+
+// d:Options menu item for opening album art popup.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_album_art "Album art"
+
+// d:Options menu item for creating a playlist.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mg_options_create_new_pl "Create playlist"
+
+// d:Options menu item for find in music store.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_find_in_musicshop "Find in Music Store"
+
+//d:Command in options list
+//d:Opens use tone as cascade menu
+//l:list_single_pane_t1_cp2/opt3
+//r:5.0
+//
+#define qtn_mus_options_use_tone_as "Use tone as"
+
+
+// d:Options menu item add songs.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_add_tracks "Add songs"
+
+// d:Options menu item reorder playlist.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_reorder_list "Reorder list"
+
+// d:Options menu item for removing from playlist.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mp_options_remove "Remove"
+
+// d:Options menu item for deleting selected items.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_delete "Delete"
+
+// d:Options menu item for renaming selected items.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_rename "Rename"
+
+// d:Options menu item for playlist details.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_details_pl "Playlist details"
+
+// d:Options menu item for go to now playing.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_go_to_nowplaying "Go to Now Playing"
+
+// d:Options menu item for go to music store.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_go_to_shop "Go to Music Store"
+
+// d:Options menu item for music library details.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_details_library "Music library details"
+
+//d:Command in options list in Music Collection Main view.
+//d:Update Music Library (search for new and removed audio files)
+// l:list_single_pane_t1_cp2/opt1
+//r:5.0
+//
+#define qtn_mus_options_update_collection1  "Refresh library"
+
+// d:Options menu item save playlist.
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_mp_options_save "Save"
+
+// d:Text for softkey option grab.
+// l:control_pane_t1/opt7
+// r:5.0
+//
+#define qtn_nmp_softkey_grab "Grab"
+
+// d:Text for softkey option drop.
+// l:control_pane_t1/opt7
+// r:5.0
+//
+#define qtn_nmp_softkey_drop "Drop"
+
+// d:list position status shown in navi pane when reordering a song in
+// d:the Reorder list view
+// d:%0N is the position of the song being reordered
+// d:%1N is the total number of positions
+// l:navi_text_pane_t1
+// r:5.0
+//
+#define qtn_nmp_position_counter "%0N/%1N"
+
+// d:Text for a confirmation query shown after user creates a playlist
+// d:asking if add songs is needed
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_query_add_songs    "Add songs now?"
+
+// d:Text for a confirmation query shown when user attempts to delete
+// d:multiple tracks.
+// d:%N is the number of the selected tracks.
+// d:For example, if the user selects delete when 3 tracks are marked in 
+// d:general tracks view, %N will be 3.
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_del_songs_query    "Delete %N items?"
+
+// d:Text for a confirmation query shown when user attempts to delete
+// d:all tracks belonging to a category. Category may be one album, artist,
+// d:composer or genre. %U is the name of the selected category.
+// d:For example, if the user selects delete when Mozart is focused in 
+// d:composer category view, %U will be Mozart.
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_query_conf_delete_group     "Delete all items belonging to '%U'?"
+
+// d:Text for wait note for deleting multiple items
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_del_songs_wait_note "Deleting"
+
+// d:Text for wait note for deleting one item
+// d:%U is the item being deleted
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_album_waiting_deleting "Deleting '%U'"
+
+// d:Text for wait note for deleting a group
+// d:%U is the category being deleted
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_mus_query_conf_delete_all "Deleting items belonging to '%U'"
+
+// d:Text for a confirmation query shown when user attempts to remove
+// d:multiple tracks from playlist.
+// d:%N is the number of the selected tracks.
+// d:For example, if the user selects delete when 3 tracks are marked in 
+// d:general tracks view, %N will be 3.
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_mus_query_conf_remove_many    "Remove %N songs from the playlist?"
+
+// d:Text for a confirmation query shown when user attempts to remove
+// d:an entry from playlist
+// d:%U is the item being removed
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_mus_query_conf_remove_track     "Remove '%U' from the playlist?"
+
+// d:Text for wait note for removing multiple items
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_note_removing_many "Removing songs"
+
+// d:Text for wait note for removing one item
+// d:%U is the item being removed
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_mus_note_removing_track "Removing '%U'"
+
+// d:title for library details window
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_nmp_title_collection_details1 "Library details:"
+
+// d:Collection details popup label.
+// d:Label for collection details popup, number of songs.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mus_detail_number_of_songs "Songs"
+
+// d:Collection details popup label.
+// d:Label for collection details popup, total duration.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mp_details_duration "Duration"
+
+// d:Collection details popup label.
+// d:Label for collection details popup, available phone memory.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_phone_memory "Phone Memory"
+
+// d:Collection details popup label.
+// d:Label for collection details popup, available internal mass storage.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_mass_memory "Mass Memory"
+
+// d:Collection details popup label.
+// d:Label for collection details popup.
+// d:Space available on memory card
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_memory_card "Memory Card"
+
+// d:Collection details popup label.
+// d:Label for collection details popup.
+// d:Space available on memory card
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_mmc "MMC"
+
+// d:Collection details popup label.
+// d:Label for collection details popup, last refreshed date.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_date_refresh "Refreshed"
+
+// d:Item for Music Library Details dialog.
+// d:Displayed when MMC is not present in the phone
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_nmp_mmc_unavailable "Card Unavailable"
+
+// d:Item for Music Library Details dialog.
+// d:Displayed when Memory is not present in the phone
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_nmp_memory_unavailable "Unavailable"
+
+// d:Playlist details heading
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_mus_title_details_pl "Playlist details:"
+
+// d:Heading item text for the playlist details popup listbox.
+// d:Playlist's name.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mus_pl_detail_name "Name"
+
+// d:Heading item text for the playlist details popup listbox.
+// d:Playlist creation date.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mp_details_date "Date"
+
+// d:Heading item text for the playlist details popup listbox.
+// d:Playlist creation time.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mp_details_time "Time"
+
+// d:Heading item text for the file details popup listbox.
+// d:Playlist location.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mp_details_location "Location"
+
+// d:Options menu item for choosing player
+// l:list_single_pane_t1_cp2/opt3
+// r:5.0
+//
+#define qtn_nmp_options_play_via "Play"
+
+// d:Text for Loading song wait note
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_wait_loading_items "Loading items to play"
+
+// d:Options submenu item for choosing player
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_nmp_options_play_device "On device"
+
+// d:Options submenu item for choosing player
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_nmp_options_play_homenet "Via Home Net"
+
+// d:Text for connection to player failed error note
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_note_remote_connection_failed "Connection with %U failed."
+
+// d:Information note text
+// d:Display when 1 song has been copied to a remote server
+// l:popup_note_window
+// r:5.0
+//
+#define qtn_nmp_info_copy_one    "1 file copied"
+
+// d:Information note text
+// d:Display when some songs have been copied to a remote server
+// d:%N is the number of items successfully copied
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_info_copy_many    "%N files copied"
+
+// d:prompt text for new playlist name
+// l:popup_query_data_window
+// r:5.0
+//
+#define qtn_nmp_prmpt_new_name "New name:"
+
+// d:Text for an item with unknown description
+// d:Part of text for wait note
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_mp_list_unknown "Unknown"
+
+// d:Unknown artist in title.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_nmp_title_unknown_artist "Unknown artist"
+
+// d:Unknown album in title.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_unknown_album "Unknown album"
+
+// d:Unknown genre in title.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_unknown_genre "Unknown genre"
+
+// d:Unknown composer in title.
+// l:title_pane_t2/opt9
+// r:5.0
+//
+#define qtn_mus_title_unknown_composer "Unknown composer"
+
+// d:Cannot delete a file because it is in use
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_delete_file_open "Unable to delete item. It is currently in use."
+
+// d:Cannot delete a file because it is in use (multiple selection in list box)
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_delete_mutl_file_open   "Unable to delete some items. They are currently in use."
+
+// d:wait note for renaming multiple items
+// d:%N is the number of the tracks.
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_note_updating_name "Updating %N songs"
+
+// d:wait note for renaming single item
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_note_updating_name1 "Updating 1 song"
+
+// d:sending multiple files, but at least one cannot be sent
+// d:invalid files confirmation query
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_query_send_valid_songs1 "Some files cannot be sent. Continue?"
+
+// d:Information note text
+// d:Display when all files to be sent are broken.
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_note_nothing_to_send    "Files cannot be found. Nothing to send."
+
+// d:Text shown in Category view when there are no albums to display.
+// l:main_list_empty_pane
+// r:5.0
+//
+#define qtn_nmp_no_albums_editor    "(no albums)"
+
+// d:Text shown in Category view when there are no artists to display.
+// l:main_list_empty_pane
+// r:5.0
+//
+#define qtn_nmp_no_artists_editor    "(no artists)"
+
+// d:Text shown in Category view when there are no genres to display.
+// l:main_list_empty_pane
+// r:5.0
+//
+#define qtn_nmp_no_genres_editor   "(no genres)"
+
+// d:Text shown in Category view when there are no composers to display.
+// l:main_list_empty_pane
+// r:5.0
+//
+#define qtn_nmp_no_composers_editor   "(no composers)"
+
+// d:Text shown in Category view when there are no songs to display.
+// l:main_list_empty_pane
+// r:5.0
+//
+#define qtn_nmp_no_songs_editor   "(no songs)"
+
+// d:Information note text
+// d:Display when some songs being renamed is not valid.
+// d:%U is the new name
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_note_rename_with_invalid    "Some songs could not be updated with new %U name"
+
+// d:Information note text for trying to play empty playlist.
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_note_empty_playlist   "Playlist is empty. Nothing to Play."
+
+// d:Options menu item for go to Nokia music store.
+// l:list_single_pane_t1_cp2
+// r:5.0
+//
+#define qtn_nmp_options_music_shop "Nokia Music Store"
+
+// d:wait note for deleting multiple items
+// d:%N is the percentage of the tracks deleted.
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_del_batch_songs_wait_note "Deleting: %N%"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhg.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Collection view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxcollectionviewhg.h"
+#include "mpxcollectionviewhgimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXCollectionViewHg* CMPXCollectionViewHg::NewL()
+    {
+    return CMPXCollectionViewHgImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXCollectionViewHg* CMPXCollectionViewHg::NewLC()
+    {
+    return CMPXCollectionViewHgImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewHg::~CMPXCollectionViewHg()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4335 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Collection view container
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32cmn.h>
+#include <e32math.h>
+#include <s32file.h>
+#include <gulicon.h>
+#include <hlplch.h>
+#include <StringLoader.h>
+#include <aknview.h>
+#include <aknappui.h>
+#include <AknIconArray.h>
+#include <aknlists.h>
+#include <aknPopup.h>
+#include <akncontext.h>
+#include <AknsBasicBackgroundControlContext.h>
+#include <data_caging_path_literals.hrh>
+
+#include <mpxlog.h>
+#include <mpxuser.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxconstants.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxpodcastdefs.h>
+#include <mpxcommonuihelper.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionpath.h>
+#include <mpxplaybackutility.h>
+#include <mpxcollectionviewhg.rsg>
+#include <mpxcollectionviewhg.mbg>
+#include <mpxappui.hrh>
+
+#include <ganes/HgDoubleGraphicListFlat.h>
+#include <ganes/HgSingleGraphicList.h>
+#include <ganes/HgSingleTextListWithIcon.h>
+#include <ganes/HgVgItem.h>
+#include <ganes/HgItem.h>
+#include <ganes/HgScrollerWithTitle.h>
+#include <ganes/HgVgMediaWall.h>
+
+#include <layoutmetadata.cdl.h>
+
+#include "mpxcommoncontainer.hrh"
+#include "mpxcollectionviewhg.hrh"
+#include "mpxcollectionviewhglistboxarray.h"
+#include "mpxcollectionviewhg.hlp.hrh"
+#include "mpxcollectionviewhgcontainer.h"
+#include "mpxcollectionviewhgplaylisthelper.h"
+#include "mpxcollectionviewhgtnloader.h"
+#include "mpxcbahandler.h"
+
+// CONSTANTS
+_LIT( KMPXCollectionViewRscPath, "mpxcollectionviewhg.rsc" );
+_LIT( KMPXCollectionViewIconFile, "mpxcollectionviewhg.mbm" );
+const TInt KMPXListSelectionCount = 5;
+const TInt KMPXMinSecSeparatorIndex = 2;
+const TInt KOneHourInSeconds = 3600;
+const TInt KMPXTimeIndicatorLength = 16;
+#ifdef __WINS__
+const TInt KMPXListBufferSize = 20;
+#else
+const TInt KMPXListBufferSize = 400;
+#endif
+// Added by Harri. Buffer size has to be smaller with mediawall, otherwise IVE3 runs out of memory
+#ifdef __WINS__
+const TInt KMPXListBufferSizeWithMediaWall = 20;
+#else
+const TInt KMPXListBufferSizeWithMediaWall = 80;
+#endif
+const TInt KMPXMaxFileLength = 256;
+const TReal KIconFactor = 0.7;
+
+_LIT( KMPXDash, " - " );
+#ifdef HG_MP_LOC_AVAILABLE
+_LIT( KMPXSpace, " ");
+#endif //HG_MP_LOC_AVAILABLE
+_LIT( KMPXZeroDurationMark, "--");
+
+_LIT( KSong, " song" );
+_LIT( KSongs, " songs" );
+_LIT( KEpisode, " episode" );
+_LIT( KEpisodes, " episodes" );
+_LIT( KAlbum, " album" );
+_LIT( KAlbums, " albums" );
+_LIT( KSongDash, " song - " );
+_LIT( KSongsDash, " songs - " );
+
+_LIT( KMPXDriveC, "c:" );
+_LIT( KMPXSelectedAlbumItemFileName, "mpxalbumitem.dat");
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewHgContainer* CMPXCollectionViewHgContainer::NewL(
+    MEikCommandObserver* aView,
+    MEikListBoxObserver* aObserver,
+    TBool aIsEmbedded)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::NewL" );
+    CMPXCollectionViewHgContainer* self =
+        new ( ELeave ) CMPXCollectionViewHgContainer(aView, aObserver, aIsEmbedded);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewHgContainer::CMPXCollectionViewHgContainer(
+    MEikCommandObserver* aView,
+    MEikListBoxObserver* aObserver,
+    TBool aIsEmbedded) :
+	iView( aView ),
+	iListBoxObserver( aObserver ),
+	iReady( EFalse ),
+	iIsEmbedded(aIsEmbedded),
+	iCurrentDefaultIcon( EMPXDefaultIconNotSet ),
+	iContext( EContextUnknown ),
+	iTopIndex( 0 ),
+	iBottomIndex( KErrNotFound ),
+	iAlbumIndex(KErrNotFound),
+	iSelectedAlbumIndex(KErrNotFound),
+	iRestoredAlbumIndex(KErrNotFound)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewHgContainer::~CMPXCollectionViewHgContainer()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::~CMPXCollectionViewHgContainer" );
+    delete iSongTitle;
+    delete iAlbumTitle;
+
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+    delete iListSelections;
+    delete iListBoxArray;
+    delete iIconArray;
+    delete iMediaWall;
+    delete iMwListWidget;
+    delete iListWidget;
+    delete iCommonUiHelper;
+    CancelTNRequest();
+    iThumbnailReqMap.Close();
+    delete iThumbnailManager;
+    delete iBgContext;
+    delete iSelectedMediaInAlbumView;
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+
+    if ( iCollectionUiHelper)
+         {
+         iCollectionUiHelper->Close();
+         }
+
+    if ( iPlaybackUtility )
+        {
+        iPlaybackUtility->Close();
+        }
+
+    delete iPlaylist;
+    delete iPlaylistHelper;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ConstructL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::ConstructL" );
+
+    CCoeEnv* coeEnv( iEikonEnv );
+    TParse parse;
+    parse.Set( KMPXCollectionViewRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    iAlbumTitle = StringLoader::LoadL( R_MPX_COLLECTION_DETAILS_ONE_ALBUM );
+    iSongTitle = StringLoader::LoadL( R_MPX_COLLECTION_DETAILS_ONE_SONG );
+
+    if ( !iCollectionUiHelper )
+        {
+        iCollectionUiHelper = CMPXCollectionHelperFactory:: NewCollectionUiHelperL();
+        }
+    iCollectionUtility = MMPXCollectionUtility::NewL( NULL, KMcModeDefault );
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+
+    iPlaylistHelper = CMPXCollectionViewHgPlaylistHelper::NewL(iPlaybackUtility, iCollectionUiHelper);
+
+    TRect mainPane( 0,0,0,0 );
+    iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgScreen, mainPane, ETrue);
+
+    iBgContext->SetRect(((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect());
+
+    // Common methods used for 2-line list support
+    iCommonUiHelper = CMPXCommonUiHelper::NewL();
+    iListSelections = new (ELeave) CArrayFixFlat<TInt>( KMPXListSelectionCount );
+
+    iThumbnailManager = CMpxTNLoader::NewL( *this, EAudioListThumbnailSize );
+
+    iImageSize = CHgDoubleGraphicListFlat::PreferredImageSize();
+
+    TFileName pathWithoutDrive;
+    iEikonEnv->FsSession().PrivatePath( pathWithoutDrive );
+    iSelectedAlbumItemFileName.Copy( KMPXDriveC );
+    iSelectedAlbumItemFileName.Append( pathWithoutDrive );
+    iSelectedAlbumItemFileName.Append( KMPXSelectedAlbumItemFileName );
+
+    iListBoxArray = static_cast<CMPXCollectionViewListBoxArray*>(
+        CreateListBoxArrayL() );
+
+    CreateIconArrayL();
+
+    CreateWindowL();
+    ActivateL();
+    DrawableWindow()->SetPointerCapture( RWindowBase::TCaptureDisabled );
+    SetPointerCapture( EFalse );
+    CapturesPointer();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgContainer::MopSupplyObject
+// -----------------------------------------------------------------------------
+//
+TTypeUid::Ptr CMPXCollectionViewHgContainer::MopSupplyObject( TTypeUid aId )
+	{
+    MPX_FUNC( "CMPXCollectionViewHgContainer::MopSupplyObject" );
+	return MAknsControlContext::SupplyMopObject(aId, iBgContext );
+	}
+
+// ---------------------------------------------------------------------------
+// Sets playback status
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetPlaybackStatusByIdL(
+    TMPXItemId aId, TMPXPlaybackState aStatus, TInt aIndex)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetPlaybackStatusByIdL" );
+    if ( iListBoxArray )
+        {
+        TInt index( iListBoxArray->SetPlaybackStatusByIdL( aId, aStatus, aIndex ) );
+        if ( index != KErrNotFound )
+            {
+            // Update the previous item as not playing anymore
+            DrawLbxItemL( index );
+            }
+        index = iListBoxArray->GetPlaybackIndex();
+        if ( index != KErrNotFound )
+            {
+            // Update new item as playing
+            DrawLbxItemL( index );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get playback index
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewHgContainer::PlaybackIndex()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::PlaybackIndex" );
+    return ( iListBoxArray ? iListBoxArray->GetPlaybackIndex() : KErrNotFound );
+    }
+
+// ---------------------------------------------------------------------------
+// Activate reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ActivateReorderMode( TBool aEnable )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::ActivateReorderMode" );
+    if ( iListBoxArray )
+        {
+        iReorder = aEnable;
+        iListBoxArray->ActivateReorderMode( iReorder );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetReorderGrabbedMode(
+    TBool aEnable, TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetReorderGrabbedMode" );
+    if ( iListBoxArray )
+        {
+        iListBoxArray->SetReorderGrabbedMode( aEnable, aIndex );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Determines if it's currently in reorder mode
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewHgContainer::IsInReorderMode()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::IsInReorderMode" );
+    return iReorder;
+    }
+
+// ---------------------------------------------------------------------------
+// Move current reorder index
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::MoveReorderIndex( TInt aDirection )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::MoveReorderIndex" );
+    if ( iListBoxArray )
+        {
+        iListBoxArray->MoveReorderIndex( aDirection );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// set current reorder index
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetReorderIndex( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetReorderIndex" );
+    if ( iListBoxArray )
+        {
+        iListBoxArray->SetReorderIndex( aIndex );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Confirm reorder
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ConfirmReorderL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::ConfirmReorderL" );
+    if ( iListBoxArray )
+        {
+        iListBoxArray->ConfirmReorderL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Cancel reorder
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::CancelReorder()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::CancelReorder" );
+    TInt originalIndex( GetOriginalIndex() );
+    if ( iListBoxArray )
+        {
+        iListBoxArray->CancelReorder();
+        }
+    SetLbxCurrentItemIndexAndDraw( originalIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// Gets original index of currently selected item
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewHgContainer::GetOriginalIndex()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::GetOriginalIndex" );
+    TInt index( KErrNotFound );
+    if ( iListBoxArray )
+        {
+        index = iListBoxArray->GetOriginalIndex();
+        }
+    return index;
+    }
+
+// -----------------------------------------------------------------------------
+// Update Titlepane icon to reorder image
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::UpdateReorderTitleIconL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::UpdateReorderTitleIconL" );
+    // For status changes
+    CEikStatusPane* sp = iAvkonAppUi->StatusPane();
+    TParse parse;
+    parse.Set( KMPXCollectionViewIconFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
+
+    CFbsBitmap* bitmap( NULL );
+    CFbsBitmap* mask( NULL );
+
+    AknsUtils::CreateIconLC(
+        skin,
+        KAknsIIDNone,
+        bitmap,
+        mask,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_ctx_reordersong,
+        EMbmMpxcollectionviewhgQgn_graf_mup_ctx_reordersong_mask );
+
+    CEikImage* newIcon = new ( ELeave ) CEikImage();
+    CleanupStack::PushL( newIcon );
+    newIcon->SetPicture( bitmap, mask );
+    newIcon->SetPictureOwnedExternally( EFalse );
+    iContextPane = static_cast<CAknContextPane*>
+        ( sp->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ) );
+    iOrigIcon = iContextPane->SwapPicture( newIcon );
+    CleanupStack::Pop( 3 ); // bitmap, mask, newIcon
+    }
+
+// -----------------------------------------------------------------------------
+// Update Titlepane icon to use original image
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::RestoreOriginalTitleIconL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::RestoreOriginalTitleIconL" );
+    if ( iOrigIcon )
+        {
+        CEikImage* newIcon = iContextPane->SwapPicture( iOrigIcon );
+        delete newIcon;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Creates listbox array
+// -----------------------------------------------------------------------------
+//
+CMPXCommonListBoxArrayBase* CMPXCollectionViewHgContainer::CreateListBoxArrayL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::CreateListBoxArrayL" );
+    CMPXCollectionViewListBoxArray* array = CMPXCollectionViewListBoxArray::NewL();
+    array->ConstructListBoxArrayL();
+    array->SetObserver( this );
+    return array;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXCollectionViewHgContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG4( "CMPXCollectionViewHgContainer::HandleKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+
+    if ( aKeyEvent.iCode == EKeyUpArrow ||
+        aKeyEvent.iCode == EKeyPrevious )
+        {
+        iView->ProcessCommandL( EMPXCmdUpArrow );
+        }
+    else if ( aKeyEvent.iCode == EKeyDownArrow ||
+            aKeyEvent.iCode == EKeyNext )
+        {
+        iView->ProcessCommandL( EMPXCmdDownArrow );
+        }
+    TKeyResponse response = EKeyWasNotConsumed;
+
+    if( iReady )
+        {
+        const CMPXMedia& containerMedia(iListBoxArray->ContainerMedia() );
+        TMPXGeneralType containerType(
+            containerMedia.ValueTObjectL<TMPXGeneralType>(
+                KMPXMediaGeneralType ) );
+        TMPXGeneralCategory containerCategory(
+            containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory ) );
+
+        // Hashkey mark/unmark works in all song's view and other tracks view,
+        // not on other category views
+        if( containerCategory == EMPXSong ||
+            (( containerCategory == EMPXPlaylist ||
+            containerCategory == EMPXAlbum  ||
+            containerCategory == EMPXGenre ||
+            containerCategory == EMPXComposer ) &&
+            containerType == EMPXItem ) ||
+            aKeyEvent.iScanCode != EStdKeyHash )
+            {
+            response = HandleKeyEventL( aKeyEvent, aType );
+            }
+        }
+    else
+        {
+        response = HandleKeyEventL( aKeyEvent, aType );
+        MPX_DEBUG2( "CMPXCollectionViewHgContainer::OfferKeyEventL commoncontainer offerkey res = %d", response);
+        }
+
+    if ( aKeyEvent.iCode == EKeyUpArrow ||
+        aKeyEvent.iCode == EKeyPrevious )
+        {
+        iView->ProcessCommandL( EMPXCmdUpArrowAfterListboxHandled );
+        }
+    else if ( aKeyEvent.iCode == EKeyDownArrow ||
+            aKeyEvent.iCode == EKeyNext )
+        {
+        iView->ProcessCommandL( EMPXCmdDownArrowAfterListboxHandled );
+        }
+    return response;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXCollectionViewHgContainer::HandleKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG5( "CMPXCollectionViewHgContainer::HandleKeyEventL(iCode=%d, iScanCode=%d, iModifiers=0x%x, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iModifiers, aType );
+
+    TKeyResponse response( EKeyWasNotConsumed );
+    if ( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter )
+        {
+            SaveSelectedAlbumItemL(iAlbumIndex);
+        // Handle enter key pressed
+        iView->ProcessCommandL( EMPXCmdCommonEnterKey );
+        }
+    if ( iListWidget )
+        {
+        iListWidget->OfferKeyEventL( aKeyEvent, aType );
+        }
+    else if( iMediaWall )
+        {
+        iMediaWall->OfferKeyEventL( aKeyEvent, aType );
+        }
+    if ( response == EKeyWasNotConsumed &&
+         aType == EEventKey &&
+         aKeyEvent.iCode == EKeyBackspace && iView )
+        {
+        iView->ProcessCommandL( EMPXCmdCommonDelete );
+        response = EKeyWasConsumed;
+        }
+
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleHelpContext" );
+    aContext.iMajor = KAppUidMusicPlayerX;
+
+    const CMPXMedia& containerMedia(iListBoxArray->ContainerMedia() );
+    TMPXGeneralType containerType(
+        containerMedia.ValueTObjectL<TMPXGeneralType>(
+            KMPXMediaGeneralType ) );
+    TMPXGeneralCategory containerCategory(
+        containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory ) );
+    MPX_DEBUG3( "CMPXCollectionViewHgContainer::HandleHelpContext containertype = %d, containercategory = %d", containerType, containerCategory );
+
+    switch ( containerCategory )
+        {
+        case EMPXCollection:
+            {
+            // music menu view
+            aContext.iContext = KMusHlpLibMainView;
+            break;
+            }
+        case EMPXPlaylist:
+            {
+            if (iIsEmbedded)
+                {
+                aContext.iContext = KMusHlpEmbeddedPlaylistTracksView;
+                }
+            else
+                {
+                if ( containerType == EMPXGroup )
+                    {
+                    // playlist view
+                    aContext.iContext = KMusHlpPlaylistView;
+                    }
+                else if ( containerType == EMPXItem )
+                    {
+                    // playlist tracks view
+                    aContext.iContext = KMusHlpPlaylistTracksView;
+                    }
+                else
+                    {
+                    // default to music main view help context
+                    aContext.iContext = KMusHlpLibMainView;
+                    }
+                }
+            break;
+            }
+        case EMPXAlbum:
+        case EMPXGenre:
+        case EMPXComposer:
+            {
+            if ( containerType == EMPXGroup )
+                {
+                // album, genre, composer view
+                aContext.iContext = KMusHlpCategoryView;
+                }
+            else if ( containerType == EMPXItem )
+                {
+                // album, genre, composer tracks view
+                aContext.iContext = KMusHlpTracksView;
+                }
+            else
+                {
+                // default to music main view help context
+                aContext.iContext = KMusHlpLibMainView;
+                }
+            break;
+            }
+        case EMPXArtist:
+            {
+            // artist view
+            // artist/album view
+            aContext.iContext = KMusHlpCategoryView;
+            break;
+            }
+        case EMPXSong:
+            {
+            // all songs view
+            aContext.iContext = KMusHlpTracksView;
+            break;
+            }
+        default:
+            {
+            // default to music main view help context
+            aContext.iContext = KMusHlpLibMainView;
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleResourceChange( TInt aType )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleResourceChange" );
+    CCoeControl::HandleResourceChange( aType );
+
+    TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
+    TRAP_IGNORE(
+        if ( aType == KAknsMessageSkinChange )
+            {
+            delete iIconArray;
+            iIconArray = NULL;
+            CreateIconArrayL();
+
+            if( iCurrentViewType == EMPXViewCoverFlow || iCurrentViewType == EMPXViewTBone )
+                {
+            	iMediaWall->SetDefaultIconL(NULL);
+                iMediaWall->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
+                }
+            else
+                {
+                CHgScroller* list = CurrentListWidget();
+                if( list )
+                    {
+                    list->SetDefaultIconL(NULL);
+                    list->EnableScrollBufferL(*this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4);
+                    }
+                }
+			SetDetailIconShuffleL();
+            }
+        else if ( aType == KEikDynamicLayoutVariantSwitch )
+            {
+            TRect clientRect = ((CAknView*)iView)->ClientRect();
+
+            iBgContext->SetRect(((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect());
+
+            // In current design we switch to different type of control in
+            // all orientation switches.
+            HandleLbxItemAdditionL();
+            }
+        );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Draw this application's view to the screen
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::Draw(const TRect& /*aRect*/) const
+    {
+    if ( iContext == EContextUnknown )
+        {
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+        MAknsControlContext* cc = AknsDrawUtils::ControlContext( this );
+        AknsDrawUtils::DrawBackground( skin, cc, this, SystemGc(),
+                TPoint(0,0), Rect(), KAknsDrawParamDefault );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Provide control input capabilities
+// ---------------------------------------------------------------------------
+//
+TCoeInputCapabilities CMPXCollectionViewHgContainer::InputCapabilities() const
+	{
+	switch( iCurrentViewType )
+        {
+        case EMPXViewCoverFlow:
+        case EMPXViewTBone:
+            {
+            return iMediaWall->InputCapabilities();
+            }
+        case EMPXViewList:
+            {
+            return iListWidget->InputCapabilities();
+            }
+        default:
+            break;
+        }
+	return CCoeControl::InputCapabilities();
+	}
+
+// ---------------------------------------------------------------------------
+// From MCoeControlObserver
+// Handle control event
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleControlEventL(
+    CCoeControl* /*aControl*/,
+    TCoeEvent /*aEventType*/ )
+    {
+    }
+// ---------------------------------------------------------------------------
+// From MMPXViewContainer
+// Returns the indicators for the specified item within the view container
+// ---------------------------------------------------------------------------
+//
+RArray<TInt> CMPXCollectionViewHgContainer::IndicatorsL( TInt aIndex )
+    {
+    return iListBoxArray->IndicatorIconIndicesL( aIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCommonListBoxArrayObserver
+// Handle listbox array events.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleListBoxArrayEventL(
+    TMPXCommonListBoxArrayEvents aEvent )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleListBoxArrayEventL" );
+
+    if ( aEvent == MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventIconArrayChange )
+        {
+        delete iIconArray;
+        iIconArray = NULL;
+        CreateIconArrayL();
+        }
+    else if ( aEvent == MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventMediaArrayChange )
+        {
+
+		// Update list widget with new items in the media array.
+        // We start the update from last valid media item index.
+		if ( iListWidget )
+			{
+			ProvideDataWithoutThumbnailsL(iListBoxArray->MediaArray(), iLastValidMediaItemIndex);
+
+
+			if ( iLastValidMediaItemIndex >= iRequestStart && iLastValidMediaItemIndex >= iRequestEnd )
+				{
+
+				 Request(iRequestStart, iRequestEnd, EHgBufferReset );
+				}
+			iListWidget->RefreshScreen(iListWidget->FirstIndexOnScreen());
+			}
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Content is ready.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ContentIsReady( TBool aReady )
+    {
+    iReady = aReady;
+    }
+
+
+void CMPXCollectionViewHgContainer::SetCbaHandler( MMpxCbaHandler* aCbaHandler )
+    {
+    iCbaHandler = aCbaHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// Creates icon array, populates iIconArray to be used by listbox
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::CreateIconArrayL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::CreateIconArrayL" );
+    if ( iListBoxArray )
+        {
+        iIconArray = iListBoxArray->CreateIconArrayL();
+        }
+    SetDefaultIconL();
+    }
+
+// -----------------------------------------------------------------------------
+// Returns a pointer to the listboxarray
+// -----------------------------------------------------------------------------
+//
+CMPXCommonListBoxArrayBase* CMPXCollectionViewHgContainer::ListBoxArray() const
+    {
+    return iListBoxArray;
+    }
+
+// -----------------------------------------------------------------------------
+// Return number of listbox items shown in the current listbox.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewHgContainer::CurrentListItemCount() const
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::CurrentListItemCount" );
+    TInt count = 0;
+
+    switch( iCurrentViewType )
+        {
+        case EMPXViewCoverFlow:
+        case EMPXViewTBone:
+            {
+            count = iMediaWall->ItemCount();
+            break;
+            }
+        case EMPXViewList:
+            {
+            count = iListWidget->ItemCount();
+            break;
+            }
+        default:
+            break;
+        }
+
+    return count;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Return total number of listbox items in the listbox.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewHgContainer::TotalListItemCount() const
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::TotalListItemCount" );
+    TInt count = 0;
+    if ( iListBoxArray )
+        {
+        count = iListBoxArray->MediaArray().Count();
+        }
+    return count;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Gets top listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewHgContainer::TopLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::TopLbxItemIndex" );
+    return iTopIndex;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Gets bottom listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewHgContainer::BottomLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::BottomLbxItemIndex" );
+    return iBottomIndex;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Gets current listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewHgContainer::CurrentLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::CurrentLbxItemIndex" );
+	TInt index( KErrNotFound );
+
+    const TInt count = CurrentListItemCount();
+
+    if ( count <= 0 )
+        return index;
+
+    switch( iCurrentViewType )
+        {
+        case EMPXViewCoverFlow:
+        case EMPXViewTBone:
+            {
+            index = iMediaWall->SelectedIndex();
+            break;
+            }
+        case EMPXViewList:
+            {
+            index = iListWidget->SelectedIndex();
+            break;
+            }
+        default:
+            break;
+        }
+
+    return index;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Get current selected listbox items indices (relative to the original listbox)
+// -----------------------------------------------------------------------------
+//
+const CArrayFix<TInt>* CMPXCollectionViewHgContainer::CurrentSelectionIndicesL() const
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::CurrentSelectionIndicesL" );
+
+    // TODO, check if selection is available only with views that have only list.
+    if ( iListWidget )
+		{
+		iListSelections->Reset();
+		RArray<TInt> selectionArray;
+        CleanupClosePushL( selectionArray );
+		iListWidget->GetMarkedItemsL(selectionArray);
+		int count = selectionArray.Count();
+		for( int i = 0; i < count; i++ )
+			{
+			iListSelections->AppendL( selectionArray[i] );
+			}
+        CleanupStack::PopAndDestroy( &selectionArray );
+		}
+    return iListSelections;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set current selected listbox items indices (relative to the original listbox)
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetCurrentSelectionIndicesL(
+    CArrayFix<TInt>* aIndices ) const
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetCurrentSelectionIndicesL" );
+    TInt count = aIndices->Count();
+    if ( count > 0 && iListWidget )
+        {
+        for( TInt i = 0; i < count; i++ )
+            {
+            iListWidget->Mark( (*aIndices)[i] );
+            }
+        iListWidget->RefreshScreen( (*aIndices)[0] );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set top listbox item index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetLbxTopItemIndex( TInt /*aIndex*/ )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetLbxTopItemIndex" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set current listbox item index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetLbxCurrentItemIndex( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetLbxCurrentItemIndex" );
+
+    // TODO, check if we need to support this with other view types also
+    // David: This needs to be supported for Mediawall and Tbone
+    if ( iListWidget )
+        {
+        iListWidget->SetSelectedIndex( aIndex );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set current listbox item index and highlight it.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetLbxCurrentItemIndexAndDraw(
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetLbxCurrentItemIndexAndDraw" );
+	SetLbxCurrentItemIndex(aIndex);
+    }
+
+
+// -----------------------------------------------------------------------------
+// Clear listbox selection.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ClearLbxSelection()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::ClearLbxSelection" );
+    if ( iListWidget )
+        {
+        iListWidget->UnMarkAll();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Sets the text for an empty list box
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetLbxEmptyTextL( const TDesC& aText )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetLbxEmptyTextL" );
+
+    if ( iListWidget && aText != KNullDesC )
+        {
+        iListWidget->SetEmptyTextL( aText );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Draws a list box item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::DrawLbxItemL( TInt aIndex )
+    {
+    MPX_DEBUG2( "CMPXCollectionViewHgContainer::DrawLbxItem (aIndex=%d)", aIndex );
+
+    CHgScroller* list = CurrentListWidget();
+
+    if( list )
+        {
+        CHgItem* item = &list->ItemL(aIndex);
+        SetDetailIndicatorL(item, aIndex);
+        list->RefreshScreen(aIndex);
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set Find box's focus.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetFindBoxFocus( TBool /*aFocus*/ )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetFindBoxFocus" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// Handle listbox item addition.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleLbxItemAdditionL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleLbxItemAdditionL" );
+    SetCollectionContextL();
+    iLastValidMediaItemIndex = 0;
+
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+    const TInt count( mediaArray.Count() );
+    MPX_DEBUG2( "CMPXCollectionViewHgContainer::HandleLbxItemAdditionL count=%d", count);
+    HandleLbxItemRemovalL();
+
+    iThumbnailReqMap.Reset();
+    iThumbnailReqMap.ReserveL(count);
+    for ( TInt i = 0; i < count; i++ )
+        {
+        iThumbnailReqMap.Append( EFalse );
+        }
+
+    iThumbnailManager->CancelAll();
+
+    TViewType prevViewType = iCurrentViewType;
+    ResolveCurrentViewType();
+
+    if( prevViewType == iCurrentViewType && iContext == iPrevContext )
+        {
+        ResizeListL( mediaArray, count );
+        }
+    else
+        {
+        // MediaWall sets the default icon in the construction phase.
+        iDefaultIconSet = EFalse;
+        switch (iCurrentViewType)
+            {
+            case EMPXViewCoverFlow:
+                {
+                TMPXPlaybackState pbState( iPlaybackUtility->StateL() );
+                if ( pbState == EPbStatePlaying || pbState == EPbStatePaused )
+                    RestoreSelectedAlbumItemL(mediaArray);
+                PrepareMediaWallL(mediaArray, count);
+                break;
+                }
+            case EMPXViewTBone:
+                {
+                RestoreSelectedAlbumItemL(mediaArray);
+                PrepareMediaWallWithListL( mediaArray, count );
+                break;
+                }
+            case EMPXViewList:
+                {
+                PrepareListL(mediaArray, count);
+                break;
+                }
+            default:
+                User::Leave( KErrGeneral );
+                break;
+            }
+
+        }
+
+    DrawableWindow()->SetOrdinalPosition( -1 );
+
+    CleanPrevView();
+
+    iPrevViewType = iCurrentViewType;
+    iPrevContext = iContext;
+    if( !iDefaultIconSet )
+        {
+        SetDefaultIconL();
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// Handle listbox item addition, preserving the current display index
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleLbxItemAdditionPreserveIndexL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleLbxItemAdditionPreserveIndexL" );
+    HandleLbxItemAdditionL();
+    }
+
+
+// -----------------------------------------------------------------------------
+// Handle listbox item removal.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleLbxItemRemovalL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleLbxItemRemovalL" );
+    iTopIndex = 0;
+    iBottomIndex = KErrNotFound;
+    if ( iContext != iPrevContext )
+        {
+        CancelTNRequest();
+        iThumbnailReqMap.Close();
+
+	    }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Show/hide find box.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetFindBoxVisibilityL( TBool /*aIsVisible*/ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// Determine find box visibility
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewHgContainer::FindBoxVisibility()
+    {
+    return EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Restore the PopupCBA of find box
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::RestoreFindBoxPopupCBA()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// Calculate the top index of the visible items
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewHgContainer::CalculateTopIndex( TInt /*aBottomIndex*/ )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::CalculateTopIndex" );
+    return 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Enable/disable find box
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::EnableFindBox( TBool /*aEnable*/ )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::EnableFindBox" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Enable/disable marking
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::EnableMarking( TBool /*aEnable*/ )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::EnableMarking" );
+    }
+
+// ---------------------------------------------------------------------------
+// Custom handling of commands for markable lists.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleMarkableListProcessCommandL(
+    TInt aCommand )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleMarkableListProcessCommandL" );
+
+	if ( iListWidget )
+		{
+		switch ( aCommand )
+			{
+			case EAknCmdMark:
+				iListWidget->Mark(iListWidget->SelectedIndex());
+				break;
+			case EAknCmdUnmark:
+				iListWidget->UnMark(iListWidget->SelectedIndex());
+			    break;
+			case EAknMarkAll:
+				iListWidget->MarkAll();
+				break;
+			case EAknUnmarkAll:
+				iListWidget->UnMarkAll();
+				break;
+			}
+        iListWidget->RefreshScreen(iListWidget->SelectedIndex());
+		}
+    }
+
+
+// ---------------------------------------------------------------------------
+// Custom handling of menu pane for markable lists
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleMarkableListDynInitMenuPane(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleMarkableListDynInitMenuPane" );
+
+    if ( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST )
+        {
+        TInt currentItem = CurrentLbxItemIndex();
+        if ( currentItem == KErrNotFound )
+            {
+            aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue );
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EAknCmdEditListMenu, EFalse );
+            }
+        }
+    else if ( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION )
+        {
+        TRAP_IGNORE(CurrentSelectionIndicesL());
+        TInt currentItem = CurrentLbxItemIndex();
+        if ( currentItem != KErrNotFound )
+            {
+            TBool currentItemMarked = EFalse;
+            for( int i = 0; i < iListSelections->Count(); i++ )
+                {
+                if ( currentItem == iListSelections->At(i) )
+                    {
+                    currentItemMarked = ETrue;
+                    break;
+                    }
+                }
+
+            TInt count = 0;
+            if( iListWidget )
+                {
+                count = iListWidget->ItemCount();
+                }
+            else if ( iMediaWall )
+                {
+                count = iMediaWall->ItemCount();
+                }
+            aMenuPane->SetItemDimmed( EAknCmdMark, currentItemMarked );
+            aMenuPane->SetItemDimmed( EAknCmdUnmark, !currentItemMarked );
+            aMenuPane->SetItemDimmed( EAknMarkAll, iListSelections->Count() == count );
+            aMenuPane->SetItemDimmed( EAknUnmarkAll, iListSelections->Count() == 0 );
+            }
+        }
+    }
+
+
+
+
+// ---------------------------------------------------------------------------
+// Resize the list when contents of media array changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ResizeListL(const CMPXMediaArray& aMediaArray, TInt aCount)
+    {
+    TRect clientRect = ((CAknView*)iView)->ClientRect();
+    if( iListWidget )
+        {
+        TInt index = iListWidget->SelectedIndex();
+        iListWidget->InitScreenL( clientRect );
+        iListWidget->Reset();
+        if ( aCount )
+            {
+            iListWidget->ResizeL( aCount );
+            ProvideDataWithoutThumbnailsL(aMediaArray);
+            iListWidget->SetSelectedIndex( CurrentLbxItemIndex() );
+            }
+        else
+            {
+            iListWidget->RefreshScreen(0);
+            }
+        }
+    else if( iMediaWall )
+        {
+        TInt index = iMediaWall->SelectedIndex();
+        iMediaWall->InitScreenL( clientRect );
+        iMediaWall->Reset();
+        if ( aCount )
+            {
+            iMediaWall->ResizeL( aCount );
+            ProvideDataWithoutThumbnailsMwL(aMediaArray);
+            iMediaWall->SetSelectedIndex( CurrentLbxItemIndex() );
+            }
+        else
+            {
+            iMediaWall->RefreshScreen(0);
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Prepare view for displaying data in list format.
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::PrepareListL(const CMPXMediaArray& aMediaArray, TInt aCount)
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::PrepareListL");
+
+	if (!((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->IsVisible())
+		((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(ETrue);
+
+    TRect clientRect = ((CAknView*)iView)->ClientRect();
+    iThumbnailManager->SetSizeL( EAudioListThumbnailSize );
+
+    if( !iListWidget )
+        {
+        iListWidget = CHgDoubleGraphicListFlat::NewL (
+                clientRect,
+                aCount,
+                NULL,
+                NULL );
+        iListWidget->SetMopParent(this);
+        iListWidget->SetSelectionObserver(*this);
+        // TODO. check if this is correct for all lists
+        iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
+        iListWidget->SetFocus(ETrue);
+        iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
+        ProvideDataWithoutThumbnailsL(aMediaArray);
+        }
+    else
+        {
+        iListWidget->Reset();
+        iListWidget->ResizeL( aCount );
+        iListWidget->SetFocus(ETrue);
+        ProvideDataWithoutThumbnailsL(aMediaArray);
+        iListWidget->MakeVisible(ETrue);
+        iListWidget->InitScreenL(clientRect);
+        }
+
+
+    // TODO. Define here in which views we need to have buffering enabled in the list
+    if( iContext == EContextGroupAlbum ||
+        iContext == EContextGroupArtist ||
+        iContext == EContextGroupSong ||
+        iContext == EContextGroupGenre )
+        {
+        iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
+        }
+    else
+        {
+        iListWidget->RefreshScreen(0);
+        }
+    iDefaultIconSet = EFalse;
+    }
+
+// ----------------------------------------------------------------------------
+// Prepare view for displaying data in media wall with list
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::PrepareMediaWallWithListL(const CMPXMediaArray& aMediaArray, TInt aCount)
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::PrepareMediaWallWithListL");
+
+	// Now create the media wall & the list
+
+    ((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse);
+    iThumbnailManager->SetSizeL( EAudioGridThumbnailSize );
+
+    TRect clientRect = ((CAknView*)iView)->ClientRect();
+
+    // Temporary until we have real layout data
+    TRect mediaWallRect = TRect(clientRect.iTl, TPoint(clientRect.iBr.iX, 250));
+    TRect mwListRect = TRect(TPoint(clientRect.iTl.iX, 250), clientRect.iBr);
+
+    if ( !iMediaWall )
+		{
+		iMediaWall = CHgVgMediaWall::NewL (
+				mediaWallRect,
+				aCount,
+				CHgVgMediaWall::EHgVgMediaWallStyleCoverflowTBonePortrait,
+				EFalse,
+				this,
+				DefaultIconL() );
+
+		iMediaWall->SetMopParent(this);
+		iMediaWall->EnableScrollBufferL(*this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4);
+        iMediaWall->SetSelectionObserver(*this);
+		ProvideDataWithoutThumbnailsMwL(aMediaArray);
+
+		// Create the list to be used with Media wall view
+		iMwListWidget = CHgSingleTextListWithIcon::NewL(mwListRect, 0, NULL, NULL);
+		iMwListWidget->SetMopParent(this);
+		iMwListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
+		iMwListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
+		iMwListWidget->SetSelectionObserver(*this);
+        }
+	else
+	    {
+        // Lets just reuse the mediawall item and resize it.
+	    if( iMediaWall->Style() != CHgVgMediaWall::EHgVgMediaWallStyleCoverflowTBonePortrait )
+	        iMediaWall->ChangeStyleL( CHgVgMediaWall::EHgVgMediaWallStyleCoverflowTBonePortrait, mediaWallRect, ETrue );
+
+	    iMediaWall->EnableScrollBufferL(*this, KMPXListBufferSizeWithMediaWall, KMPXListBufferSizeWithMediaWall/4);
+        iMediaWall->MakeVisible( ETrue );
+        if ( !iMwListWidget )
+            {
+            iMwListWidget = CHgSingleTextListWithIcon::NewL(mwListRect, 0, NULL, NULL);
+            iMwListWidget->SetMopParent(this);
+            iMwListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
+            iMwListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
+            iMwListWidget->SetSelectionObserver(*this);
+            }
+        else
+            {
+            iMwListWidget->MakeVisible( ETrue );
+            iMwListWidget->SetFocus( ETrue );
+            iMwListWidget->SetRect( mwListRect );
+            iMwListWidget->DrawNow();
+            }
+	    }
+
+    if ( iAlbumIndex == KErrNotFound )
+        {
+        iMediaWall->SetSelectedIndex( iRestoredAlbumIndex );
+        iMediaWall->RefreshScreen(iRestoredAlbumIndex);
+        OpenAlbumL(iRestoredAlbumIndex);
+      }
+    else
+        {
+        iMediaWall->SetSelectedIndex( iAlbumIndex );
+        iMediaWall->RefreshScreen(iAlbumIndex);
+        OpenAlbumL(iAlbumIndex);
+       }
+    iMwListWidget->RefreshScreen(0);
+    iDefaultIconSet = ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// Prepare view for displaying data in Media wall format.
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::PrepareMediaWallL(const CMPXMediaArray& aMediaArray, TInt aCount)
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::PrepareMediaWallL");
+   	TRect appRect = ((CAknAppUi*)iCoeEnv->AppUi())->ApplicationRect();
+	((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(EFalse);
+	iThumbnailManager->SetSizeL( EAudioFullScreenThumbnailSize );
+
+	if (!iMediaWall)
+	    {
+        iMediaWall = CHgVgMediaWall::NewL(
+                appRect,
+                aCount,
+                CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen,
+                ETrue,
+                this,
+                DefaultIconL() );
+        iMediaWall->SetMopParent(this);
+        iMediaWall->SetSelectionObserver(*this);
+        iMediaWall->SetObserver( this ); // softkey visibility event observer
+        iMediaWall->SetOpeningAnimationType( CHgVgMediaWall::EHgVgOpeningAnimationFlipToFront );
+        iMediaWall->EnableScrollBufferL(
+                *this,
+                KMPXListBufferSizeWithMediaWall,
+                KMPXListBufferSizeWithMediaWall / 4);
+        // We want softkeys to be drawn on top of mediawall, thats we need to manipulate window pos
+        iMediaWall->DrawableWindow()->SetOrdinalPosition( -1 );
+        ProvideDataWithoutThumbnailsMwL(aMediaArray);
+        if( iAlbumIndex == KErrNotFound )
+            iMediaWall->SetSelectedIndex( iRestoredAlbumIndex );
+        else
+            iMediaWall->SetSelectedIndex( iAlbumIndex );
+	    }
+	else
+	    {
+	    // TODO, do we need to refill the data or are the items same in fullscreen coverflow and tbone coverflow????
+	    // David: Yes because there will be an extra shuffle item in the coverflow list but not in tbone coverflow.
+	    //        Index will be off.
+	    if( iMediaWall->Style() != CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen )
+	        iMediaWall->ChangeStyleL( CHgVgMediaWall::EHgVgMediaWallStyleCoverflowFullScreen, appRect, ETrue );
+
+	    iMediaWall->MakeVisible( ETrue );
+        iMediaWall->SetFocus( ETrue );
+        iMediaWall->EnableScrollBufferL(
+                *this,
+                KMPXListBufferSizeWithMediaWall,
+                KMPXListBufferSizeWithMediaWall / 4);
+        if( iAlbumIndex == KErrNotFound )
+            iMediaWall->SetSelectedIndex( iRestoredAlbumIndex );
+        else
+            iMediaWall->SetSelectedIndex( iAlbumIndex );
+
+        iMediaWall->DrawDeferred();
+	    iMediaWall->RefreshScreen(0);
+	    }
+
+	iDefaultIconSet = ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// Add shuffle list item to the top of the list.
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::SetShuffleItemToListL(CHgScroller* aScroller )
+    {
+    CHgItem* item = CHgItem::NewL();
+    // Todo: Localize
+    item->SetTitleL( _L("Shuffle All") );
+
+    CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle];
+    CFbsBitmap* bitmap = icon->Bitmap();
+    CFbsBitmap* mask = icon->Mask();
+
+    // Icon needs to be bigger!
+    TSize size(35, 35);
+    AknIconUtils::SetSize( bitmap, size );
+    AknIconUtils::SetSize( mask, size );
+
+    CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
+    iconCopy->SetBitmapsOwnedExternally(ETrue);
+    item->SetIcon( iconCopy );
+    aScroller->SetItem( item, 0 );
+    }
+
+// ----------------------------------------------------------------------------
+// Retreive the current list widget
+// ----------------------------------------------------------------------------
+CHgScroller* CMPXCollectionViewHgContainer::CurrentListWidget()
+    {
+    CHgScroller* current = 0;
+    switch (iCurrentViewType)
+        {
+        case EMPXViewTBone:
+            {
+            current = iMwListWidget;
+            break;
+            }
+        case EMPXViewList:
+            {
+            current = iListWidget;
+            break;
+            }
+        default:
+            break;
+        }
+
+    return current;
+    }
+
+// ----------------------------------------------------------------------------
+// Resolve the current view type based on the browsing context
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::ResolveCurrentViewType()
+    {
+    iCurrentViewType = EMPXViewUnknown;
+    TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
+    switch (iContext)
+        {
+        case EContextGroupAlbum:
+            {
+            if( landscapeOrientation )
+                iCurrentViewType = EMPXViewCoverFlow;
+            else
+                iCurrentViewType = EMPXViewList;
+            break;
+            }
+        case EContextItemAlbum:
+        case EContextItemArtist:
+            {
+            // TODO, Change by Harri. Is this correct?
+            if( landscapeOrientation )
+                iCurrentViewType = EMPXViewCoverFlow;
+            else
+                iCurrentViewType = EMPXViewTBone;
+            break;
+            }
+        default:
+            iCurrentViewType = EMPXViewList;
+            break;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Clears the previous view content.
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::CleanPrevView()
+    {
+    if( iCurrentViewType == iPrevViewType )
+        return;
+
+    switch (iPrevViewType)
+        {
+        case EMPXViewCoverFlow:
+            {
+            iMediaWall->MakeVisible( EFalse );
+            iMediaWall->SetFocus( EFalse );
+            iMediaWall->DisableScrollBuffer();
+            break;
+            }
+        case EMPXViewTBone:
+            {
+            iMediaWall->MakeVisible( EFalse );
+            iMediaWall->DisableScrollBuffer();
+            iMwListWidget->MakeVisible( EFalse );
+            iMwListWidget->Reset();
+            break;
+            }
+        case EMPXViewList:
+            {
+            iListWidget->MakeVisible( EFalse );
+            iListWidget->SetFocus( EFalse );
+            iListWidget->DisableScrollBuffer();
+            iListWidget->Reset();
+            break;
+            }
+        default:
+            break;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Check if the selected item is a song.
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewHgContainer::IsSelectedItemASong()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::IsSelectedItemASong" );
+
+	TBool res(EFalse);
+    if ( iContext == EContextItemAlbum  )
+        {
+    	CHgScroller* listWidget = CurrentListWidget();
+		if ( listWidget->SelectedIndex() == 0 &&
+			 listWidget->ItemCount() > 1 )
+			{
+			res = EFalse;
+			}
+		else
+			{
+			res = ETrue;
+			}
+        }
+    return res;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Retreives the selected item's media.
+// -----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXCollectionViewHgContainer::SelectedItemMediaL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::SelectedItemMediaL" );
+    CMPXMedia* song = NULL;    
+    const CMPXMediaArray& albums = iListBoxArray->MediaArray();
+    CMPXMedia* album( albums.AtL( iSelectedAlbumIndex ) );    
+    const CMPXMediaArray* songs = album->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+    CHgScroller* listWidget = CurrentListWidget();
+    if (listWidget && songs)
+        {
+        song = songs->AtL(listWidget->SelectedIndex());
+        }
+    return song;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Handle item command
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleItemCommandL( TInt aCommand )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleItemCommanddL" );
+
+    if ( iContext == EContextGroupAlbum && aCommand == EMPXCmdPlay )
+        {
+    	CHgScroller* listWidget = CurrentListWidget();
+		iSelectedAlbumIndex = listWidget->SelectedIndex();
+        SaveSelectedAlbumItemL(iSelectedAlbumIndex);
+		// Open first song of album & playlist for entire album is created.
+		PlayAlbumL(iSelectedAlbumIndex);
+        }
+    else if ( iContext == EContextGroupPlaylist && aCommand == EMPXCmdPlay )
+        {
+    	CHgScroller* listWidget = CurrentListWidget();
+		TInt index = listWidget->SelectedIndex();
+		PlayPlaylistL(index);
+        }
+    else if ( iContext == EContextGroupGenre && aCommand == EMPXCmdPlay )
+        {
+        CHgScroller* listWidget = CurrentListWidget();
+        TInt index = listWidget->SelectedIndex();
+        PlayGenreL(index);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MHgSelectionObserver
+// Handle Item Selection
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleSelectL( TInt /*aIndex*/ )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleSelect" );
+
+    }
+
+// ---------------------------------------------------------------------------
+// From MHgSelectionObserver
+// Handle Item Selection
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleSelectL( TInt aIndex, CCoeControl* aControl )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleSelect" );
+    if( iCurrentViewType == EMPXViewTBone && iSelectedAlbumIndex != aIndex )
+        {
+        if ( aControl == iMediaWall )
+            {
+            iSelectedAlbumIndex = aIndex;
+            OpenAlbumL(aIndex);
+            }
+        }
+    else if( iCurrentViewType == EMPXViewCoverFlow )
+        {
+        iSelectedAlbumIndex = aIndex;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MHgSelectionObserver
+// Handle Item opened
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleOpenL( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleOpenL" );
+
+    // Mod by harri, had to enable this block since ganes list components still
+    // uses this version of the HandleOpen
+    if ( iContext == EContextItemAlbum  )
+		{
+        SaveSelectedAlbumItemL(iSelectedAlbumIndex);
+		UpdatePathAndOpenL(aIndex);
+		}
+    else if ( iContext == EContextGroupAlbum )
+        {
+        SaveSelectedAlbumItemL(aIndex);
+        // Check if shuffle play all was selected.
+        if (!ShufflePlayAllL(aIndex))
+            {
+			// To open the selected album.
+            iView->ProcessCommandL( EMPXCmdCommonEnterKey );
+            }
+        }
+    else if ( iContext == EContextGroupSong )
+        {
+        // Check if shuffle play all was selected.
+        if (!ShufflePlayAllL(aIndex))
+            {
+            // To open the selected album.
+            iView->ProcessCommandL( EMPXCmdCommonEnterKey );
+            }
+        }
+    else
+		{
+		iView->ProcessCommandL( EMPXCmdCommonEnterKey );
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// From MHgSelectionObserver
+// Handle Item opened
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleOpenL( TInt aIndex, CCoeControl* aControl )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::HandleOpenL" );
+
+    if( iContext == EContextGroupAlbum )
+        {
+        iAlbumIndex = aIndex;
+        SaveSelectedAlbumItemL(aIndex);
+        }
+
+    if ( iContext == EContextItemAlbum  )
+        {
+        if ( aControl == iMediaWall )
+            {
+			// If album was opened, we will play all tracks in the album.
+            SaveSelectedAlbumItemL(aIndex);
+            // Open first song of album & playlist for entire album is created.
+            UpdatePathAndOpenL(0, ETrue);
+            }
+        else if ( aControl == iMwListWidget )
+            {
+			// If item in list was opened, we only play the selected one.
+            SaveSelectedAlbumItemL(iSelectedAlbumIndex);
+           // Open the selected song of album
+            UpdatePathAndOpenL(aIndex);
+            }
+        }
+    else if ( iContext == EContextGroupAlbum  )
+        {
+        if ( aControl == iMediaWall )
+            {
+			// Check if shuffle play all was selected.
+			if (!ShufflePlayAllL(aIndex))
+				{
+	            OpenAlbumL(aIndex);
+				}
+            }
+        }
+    else
+        {
+        iView->ProcessCommandL( EMPXCmdCommonEnterKey );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle media wall event
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleMediaWallEvent(
+	TInt aEvent,
+	CHgVgMediaWall* /*aSender*/)
+    {
+    switch( aEvent )
+        {
+        case CHgVgMediaWall::EHgVgMediaWallEventRequestShowSoftkeys:
+            {
+            if( iCbaHandler )
+                iCbaHandler->ChangeCbaVisibility( ETrue );
+            break;
+            }
+        case CHgVgMediaWall::EHgVgMediaWallEventRequestHideSoftkeys:
+            {
+            if( iCbaHandler )
+                iCbaHandler->ChangeCbaVisibility( EFalse );
+            break;
+            }
+        default:
+            break;
+        }
+    }
+// -----------------------------------------------------------------------------
+// Provides the data to the model
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::Request(
+	TInt aBufferStart,
+	TInt aBufferEnd,
+	THgScrollDirection aDirection )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::Request" );
+   	MPX_DEBUG3( "CMPXCollectionViewHgContainer::Request aBufferStart = %d, aBufferEnd = %d",
+            aBufferStart, aBufferEnd );
+
+	// This should not happen but if not handled, bad things will happen.
+	if ( aBufferStart < 0 || aBufferEnd < 0 )
+   	    return;
+
+	// TODO, add support for last valid media item index later
+    if ( aBufferStart > iLastValidMediaItemIndex || aBufferEnd > iLastValidMediaItemIndex )
+		{
+		// We cannot provide data for the requested range at this time.
+		// Remember the request so we can handle it when there's enough data.
+		iRequestStart = aBufferStart;
+    	iRequestEnd = aBufferEnd;
+    	return;
+		}
+
+    iDirection = aDirection;
+
+    for ( TInt i = aBufferStart; i <= aBufferEnd; i++ )
+        {
+        iThumbnailReqMap[ i ] = EFalse;
+        }
+
+
+    if ( aDirection == EHgBufferReset  || aDirection == EHgBufferScrollDown || aDirection == EHgBufferScrollUp)
+        {
+        // For index range in visible-area
+        TRAP_IGNORE(ProvideDataIntersectL(aBufferStart, aBufferEnd));
+        // For index range elsewhere
+        TRAP_IGNORE(ProvideDataDifferenceL(aBufferStart, aBufferEnd));
+       }
+    else
+        {
+        TRAP_IGNORE(ProvideDataL(aBufferStart, aBufferEnd));
+        }
+
+    // When in main collection view, list can be refresh
+    // without waiting on thumbnails since this list doesn't
+    // require thumbnails.
+    if ( iCurrentViewType == EMPXViewList && (
+	     iContext == EContextGroupCollection ||
+         iContext == EContextGroupPlaylist ||
+         iContext == EContextGroupGenre ||
+         iContext == EContextGroupComposer ) ||
+         iContext == EContextGroupArtist )
+        {
+        iListWidget->RefreshScreen( aBufferStart );
+        }
+    iTopIndex = aBufferStart;
+    iBottomIndex = aBufferEnd;
+    }
+
+// -----------------------------------------------------------------------------
+// Check if request range also covers the visible area and provide data
+// to it first.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ProvideDataIntersectL(
+	TInt aBufferStart,
+	TInt aBufferEnd )
+    {
+    TInt firstOnScreen  = 0;
+    TInt lastOnScreen = 0;
+    if( iMediaWall )
+        {
+        firstOnScreen = iMediaWall->FirstIndexOnScreen();
+        lastOnScreen = firstOnScreen + iMediaWall->ItemsOnScreen();
+        }
+    else
+        {
+        firstOnScreen = iListWidget->FirstIndexOnScreen();
+        lastOnScreen = firstOnScreen + iListWidget->ItemsOnScreen();
+        }
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+
+    TInt startIndex = Max( firstOnScreen, aBufferStart );
+    TInt endIndex = Min( lastOnScreen, aBufferEnd );
+
+    ProvideDataForRangeL( startIndex, endIndex );
+    }
+
+// -----------------------------------------------------------------------------
+// Handles request range outside of visible area.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ProvideDataDifferenceL(
+	TInt aBufferStart,
+	TInt aBufferEnd)
+    {
+    TInt firstOnScreen  = 0;
+    TInt lastOnScreen = 0;
+    if( iMediaWall )
+        {
+        firstOnScreen = iMediaWall->FirstIndexOnScreen();
+        lastOnScreen = firstOnScreen + iMediaWall->ItemsOnScreen();
+        }
+    else
+        {
+        firstOnScreen = iListWidget->FirstIndexOnScreen();
+        lastOnScreen = firstOnScreen + iListWidget->ItemsOnScreen();
+        }
+    if (aBufferStart == firstOnScreen && aBufferEnd == lastOnScreen)
+        return;
+
+    // Start block
+    ProvideDataForRangeL( aBufferStart, firstOnScreen-1 );
+
+    // End block
+    ProvideDataForRangeL( lastOnScreen+1, aBufferEnd );
+
+    }
+
+
+// -----------------------------------------------------------------------------
+// Generic data provider for the requested range.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ProvideDataForRangeL( TInt aBufferStart, TInt aBufferEnd )
+    {
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+    for( TInt i = aBufferStart; i <= aBufferEnd; i++ )
+        {
+        // Just get the exiting item and update the fields + icon.
+        CHgItem* item = NULL;
+        if( iMediaWall )
+            item = &iMediaWall->ItemL(i);
+        else
+            item = &iListWidget->ItemL(i);
+
+        CMPXMedia* currentMedia( mediaArray.AtL( i ) );
+        AddThumbnailToDisplayedItemL( item, currentMedia, i );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgContainer::ProvideDataWithouThumbnailsL
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ProvideDataWithoutThumbnailsL(
+	const CMPXMediaArray& aMediaArray,
+	TInt aStartIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::ProvideDataWithoutThumbnailsL" );
+
+	TInt mediaCount = aMediaArray.Count();
+
+    for ( TInt i = aStartIndex; i < mediaCount ; i++ )
+        {
+        CMPXMedia* currentMedia( aMediaArray.AtL( i ) );
+
+		if ( currentMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
+			KMPXInvalidItemId )
+			{
+			break;
+			}
+
+        // Just get the exiting item and update the fields + icon.
+        CHgItem* item = &iListWidget->ItemL(i);
+
+		TBool shuffleItem(EFalse);
+        if ( i == 0 )
+        	{
+            shuffleItem = SetShuffleItemTextL(item, currentMedia);
+			}
+
+        if (!shuffleItem)
+        	{
+            SetTitleL( item, currentMedia );
+        	AddDetailToDisplayedItemL( item, currentMedia, i );
+			}
+		iLastValidMediaItemIndex = i;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgContainer::ProvideDataWithoutThumbnailsMwL
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ProvideDataWithoutThumbnailsMwL(
+	const CMPXMediaArray& aMediaArray,
+	TInt aStartIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::ProvideDataWithoutThumbnailsMwL" );
+
+	TInt mediaCount = aMediaArray.Count();
+
+    for ( TInt i = aStartIndex; i < mediaCount ; i++ )
+        {
+        // Just get the exiting item and update the fields + icon.
+        CMPXMedia* currentMedia( aMediaArray.AtL( i ) );
+
+		if ( currentMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
+			KMPXInvalidItemId )
+			{
+			break;
+			}
+
+        // Just get the exiting item and update the fields + icon.
+
+        CHgVgItem* item = &iMediaWall->ItemL(i);
+		TBool shuffleItem(EFalse);
+        if ( i == 0 )
+        	{
+            shuffleItem = SetShuffleItemTextL(item, currentMedia);
+			}
+
+        if (!shuffleItem)
+        	{
+            SetTitleL( item, currentMedia );
+        	AddDetailToDisplayedItemL( item, currentMedia, i );
+			}
+		iLastValidMediaItemIndex = i;
+        }
+    }
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgContainer::ProvideDataL
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ProvideDataL( TInt aStart, TInt aEnd )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::ProvideDataL" );
+   	MPX_DEBUG3( "CMPXCollectionViewHgContainer::ProvideDataL aStart = %d, aEnd = %d",
+            aStart, aEnd );
+   	if ( aStart < 0 ) aStart = 0;
+   	if ( aEnd < 0 ) aEnd = 0;
+
+	const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+    for ( TInt i = aStart; i <= aEnd ; i++ )
+        {
+        // Just get the exiting item and update the fields + icon.
+        CHgItem* item = NULL;
+        if( iCurrentViewType == EMPXViewCoverFlow || iCurrentViewType == EMPXViewTBone )
+            item = &iMediaWall->ItemL(i);
+        else
+            item = &iListWidget->ItemL(i);
+
+        CMPXMedia* currentMedia( mediaArray.AtL( i ) );
+
+        AddThumbnailToDisplayedItemL( item, currentMedia, i );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgContainer::Release
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::Release(TInt aReleaseStart, TInt aReleaseEnd)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::Release" );
+
+    for(; aReleaseStart <= aReleaseEnd; ++aReleaseStart)
+        {
+        MPX_DEBUG2( "-->CMPXCollectionViewHgContainer::Release aReleaseStart = %d", aReleaseStart );
+        iThumbnailManager->CancelThumb( aReleaseStart );
+        }
+
+    }
+
+// ---------------------------------------------------------------------------
+// Refresh for item without thumbnail
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::RefreshNoThumbnailL(TInt aIndex)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::RefreshNoThumbnail" );
+
+    RefreshL(aIndex);
+    }
+// ---------------------------------------------------------------------------
+// Refresh list as needed.
+// This function tries to determine the best time to refresh the screen as to
+// avoid too many redraws. In some cases, multiple refresh is unavoidable.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::RefreshL(TInt aIndex)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::Refresh" );
+
+	TInt mediaCount = iListBoxArray->MediaArray().Count();
+
+	TInt firstOnScreen = 0;
+	TInt lastOnScreen =  0;
+
+    TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
+    CHgScroller* listWidget = CurrentListWidget();
+
+    if( iCurrentViewType == EMPXViewTBone || iCurrentViewType == EMPXViewCoverFlow )
+        {
+        firstOnScreen = iMediaWall->FirstIndexOnScreen();
+        lastOnScreen = firstOnScreen + iMediaWall->ItemsOnScreen();
+        }
+    else
+        {
+        firstOnScreen = listWidget->FirstIndexOnScreen();
+        lastOnScreen = firstOnScreen + listWidget->ItemsOnScreen();
+        }
+
+	// Added by Harri
+	if( firstOnScreen < 0 )
+	    firstOnScreen = 0;
+	if (lastOnScreen > (mediaCount - 1))
+		lastOnScreen = mediaCount - 1;
+
+	// Refresh screen if the item is within view and no more thumbnails expected.
+	if ( aIndex >= firstOnScreen && aIndex <= lastOnScreen )
+		{
+		TBool canRefresh(ETrue);
+		for (TInt i= firstOnScreen; i <= lastOnScreen; i++)
+			{
+			if ( !iThumbnailReqMap[i] )
+				{
+				canRefresh = EFalse;
+				break;
+				}
+			}
+        if ( canRefresh )
+            {
+            if( iCurrentViewType == EMPXViewTBone || iCurrentViewType == EMPXViewCoverFlow )
+                iMediaWall->RefreshScreen( firstOnScreen );
+            else
+                listWidget->RefreshScreen( firstOnScreen );
+            }
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// Get the default icon for the current browsing context.
+// ----------------------------------------------------------------------------
+CGulIcon* CMPXCollectionViewHgContainer::DefaultIconL()
+    {
+
+    TInt iconIndex( EMPXClvIconEmpty );
+
+    switch( iContext )
+        {
+        case EContextGroupArtist:
+        case EContextItemArtist:
+            {
+            iconIndex = EMPXClvIconArtist;
+            break;
+            }
+        case EContextGroupAlbum:
+        case EContextItemAlbum:
+            {
+            // Mod by Harri. Lampainen wanted to try default icon in album view.
+            iconIndex = EMPXClvIconAlbum;
+            break;
+            }
+        case EContextGroupPodcast:
+        case EContextItemPodcast:
+            {
+            iconIndex = EMPXPodClvIconTitle; // Podcast default icon
+            break;
+            }
+        case EContextGroupPlaylist:
+            {
+            iconIndex = EMPXClvIconPlaylist;
+            break;
+            }
+        case EContextGroupGenre:
+            {
+            iconIndex = EMPXClvIconGenre;
+            break;
+            }
+        case EContextGroupComposer:
+            {
+            iconIndex = EMPXClvIconComposer;
+            break;
+            }
+        case EContextItemComposer:
+        case EContextGroupSong:
+        case EContextItemSong:
+        case EContextItemPlaylist:
+        case EContextItemGenre:
+        case EContextGroupCollection:
+        case EContextUnknown:
+        default:
+            {
+            // no default icon for main menu items
+            break;
+            }
+        }
+
+    CGulIcon* icon = (*iIconArray)[iconIndex];
+    CFbsBitmap* bitmap = icon->Bitmap();
+    CFbsBitmap* mask = icon->Mask();
+
+    TSize size(iImageSize.iWidth, iImageSize.iHeight);
+    AknIconUtils::SetSize( bitmap, size );
+    AknIconUtils::SetSize( mask, size );
+
+    CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
+    iconCopy->SetBitmapsOwnedExternally(ETrue);
+    return iconCopy;
+    }
+
+// -----------------------------------------------------------------------------
+// Sets default icon to the HgList
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetDefaultIconL()
+	{
+
+	TDefaultIcon defaultIcon( EMPXDefaultIconEmpty );
+	TInt iconIndex( EMPXClvIconEmpty );
+
+	switch( iContext )
+		{
+		case EContextGroupArtist:
+		case EContextItemArtist:
+			{
+			defaultIcon = EMPXDefaultIconArtist;
+			iconIndex = EMPXClvIconArtist;
+			break;
+			}
+		case EContextGroupAlbum:
+		case EContextItemAlbum:
+            {
+			// Mod by Harri. Lampainen wanted to try default icon in album view.
+            defaultIcon = EMPXDefaultIconAlbum;
+            iconIndex = EMPXClvIconAlbum;
+			break;
+			}
+		case EContextGroupPodcast:
+		case EContextItemPodcast:
+			{
+			defaultIcon = EMPXDefaultTitleIconPodcasts;
+			iconIndex = EMPXPodClvIconTitle; // Podcast default icon
+			break;
+			}
+		case EContextGroupPlaylist:
+			{
+			defaultIcon = EMPXDefaultIconPlaylist;
+			iconIndex = EMPXClvIconPlaylist;
+			break;
+			}
+		case EContextGroupGenre:
+			{
+			defaultIcon = EMPXDefaultIconGenre;
+			iconIndex = EMPXClvIconGenre;
+			break;
+			}
+		case EContextGroupComposer:
+			{
+			defaultIcon = EMPXDefaultIconComposer;
+			iconIndex = EMPXClvIconComposer;
+			break;
+			}
+		case EContextGroupSong:
+        case EContextItemPlaylist:
+        case EContextItemGenre:
+			{
+			defaultIcon = EMPXDefaultIconSongs;
+			iconIndex = EMPXClvIconSongs;
+			break;
+			}
+		case EContextItemComposer:
+		case EContextItemSong:
+		case EContextGroupCollection:
+		case EContextUnknown:
+		default:
+			{
+			// no default icon for main menu items
+			break;
+			}
+		}
+
+	CGulIcon* icon = (*iIconArray)[iconIndex];
+	CFbsBitmap* bitmap = icon->Bitmap();
+	CFbsBitmap* mask = icon->Mask();
+
+	TSize size(iImageSize.iWidth, iImageSize.iHeight);
+	AknIconUtils::SetSize( bitmap, size );
+	AknIconUtils::SetSize( mask, size );
+
+	CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
+	iconCopy->SetBitmapsOwnedExternally(ETrue);
+
+	if ( iMediaWall )
+		{
+		iMediaWall->SetDefaultIconL(iconCopy);
+		}
+	else if ( iListWidget )
+		{
+		iListWidget->SetDefaultIconL(iconCopy);
+		}
+	iCurrentDefaultIcon = defaultIcon;
+	}
+
+// -----------------------------------------------------------------------------
+// Sets default icon to list item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetDefaultIconL(TInt aIndex)
+	{
+
+	TDefaultIcon defaultIcon( EMPXDefaultIconNotSet );
+	TInt iconIndex( EMPXClvIconNone );
+
+	switch( iContext )
+		{
+
+		case EContextGroupAlbum:
+			{
+			defaultIcon = EMPXDefaultIconAlbum;
+			iconIndex = EMPXClvIconAlbum;
+			break;
+			}
+		case EContextGroupPodcast:
+		case EContextItemPodcast:
+			{
+			defaultIcon = EMPXDefaultTitleIconPodcasts;
+			iconIndex = EMPXPodClvIconTitle; // Podcast default icon
+			break;
+			}
+		case EContextItemComposer:
+		case EContextGroupSong:
+		case EContextItemSong:
+		case EContextItemPlaylist:
+		case EContextItemGenre:
+		case EContextItemAlbum:
+			{
+			defaultIcon = EMPXDefaultIconSongs;
+			iconIndex = EMPXClvIconSongs;
+			break;
+			}
+		default:
+			{
+			break;
+			}
+		}
+
+	CGulIcon* icon = (*iIconArray)[iconIndex];
+	CFbsBitmap* bitmap = icon->Bitmap();
+	CFbsBitmap* mask = icon->Mask();
+
+	TSize size(iImageSize.iWidth, iImageSize.iHeight);
+	AknIconUtils::SetSize( bitmap, size );
+	AknIconUtils::SetSize( mask, size );
+
+	CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
+	iconCopy->SetBitmapsOwnedExternally(ETrue);
+
+
+	// TODO, fix this to use currentviewtype
+	if ( iMediaWall && defaultIcon != EMPXDefaultIconNotSet )
+		{
+        iMediaWall->ItemL(aIndex).SetIcon(iconCopy);
+		}
+	else if ( iListWidget && defaultIcon != EMPXDefaultIconNotSet )
+		{
+        iListWidget->ItemL(aIndex).SetIcon(iconCopy);
+		}
+	}
+
+
+// -----------------------------------------------------------------------------
+// Adds detail to the list item at the specified index
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::AddDetailToDisplayedItemL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia,
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::AddDetailToDisplayedItemL" );
+
+    switch ( iContext )
+        {
+        case EContextGroupCollection:
+            {
+            SetDetailIconL( aVisualItem, aIndex );
+            SetDetailCountL( aVisualItem, aMedia );
+            break;
+            }
+        case EContextGroupArtist:
+            {
+            SetDetailCountL( aVisualItem, aMedia );
+            break;
+            }
+        case EContextGroupAlbum:
+        	{
+            SetDetailAlbumL( aVisualItem, aMedia );
+        	//SetDetailArtistL( aVisualItem, aMedia );
+            break;
+            }
+        case EContextGroupPlaylist:
+            {
+            SetDetailDurationL( aVisualItem, aMedia );
+            SetDetailIndicatorL( aVisualItem, aIndex );
+          //  SetDetailIconL( aVisualItem, EMPXDefaultIconPlaylist ); // playlist icon
+            break;
+            }
+        case EContextItemAlbum:
+            {
+            SetDetailAlbumL( aVisualItem, aMedia );
+            //SetDetailArtistL( aVisualItem, aMedia );
+            SetDetailIndicatorL( aVisualItem, aIndex );
+            break;
+            }
+        case EContextGroupSong:
+        case EContextItemPlaylist:
+        case EContextItemGenre:
+        case EContextItemComposer:
+        	{
+            SetDetailArtistL( aVisualItem, aMedia );
+            SetDetailIndicatorL( aVisualItem, aIndex );
+            break;
+            }
+        case EContextGroupPodcast:
+            {
+            SetDetailCountL( aVisualItem, aMedia );
+          //  SetDetailIconL( aVisualItem, EMPXDefaultTitleIconPodcasts );
+            break;
+            }
+        case EContextGroupGenre:
+            {
+          //  SetDetailIconL( aVisualItem, EMPXDefaultIconGenre ); //genre icon
+            SetDetailCountL( aVisualItem, aMedia );
+            break;
+            }
+        case EContextGroupComposer:
+            {
+           // SetDetailIconL( aVisualItem, EMPXDefaultIconComposer ); //composer icon
+            SetDetailCountL( aVisualItem, aMedia );
+            break;
+            }
+        case EContextItemArtist:
+        	{
+            SetDetailCountL(aVisualItem, aMedia);
+            break;
+            }
+        case EContextItemSong:
+        	{
+            SetDetailAlbumL( aVisualItem, aMedia );
+            SetDetailIndicatorL( aVisualItem, aIndex );
+            break;
+            }
+        case EContextItemPodcast:
+        	{
+            SetDetailIndicatorL( aVisualItem, aIndex );
+            break;
+            }
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// Adds thumbnail to the list item at the specified index
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::AddThumbnailToDisplayedItemL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia,
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::AddThumbnailToDisplayedItemL" );
+
+
+    switch ( iContext )
+        {
+        case EContextGroupCollection:
+             {
+
+             SetDetailIconL( aVisualItem, aIndex );
+             break;
+             }
+        case EContextGroupAlbum:
+        case EContextGroupSong:
+        case EContextItemPlaylist:
+        case EContextItemGenre:
+        case EContextItemComposer:
+        case EContextItemArtist:
+        case EContextItemSong:
+        case EContextItemPodcast:
+        case EContextItemAlbum:
+            {
+            SetDetailThumbnailL( aMedia, aIndex );
+            break;
+            }
+
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Set title to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetTitleL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetTitleL" );
+
+
+	if ( iContext == EContextGroupAlbum ||  iContext == EContextItemAlbum )
+		{
+
+		if ( aMedia->IsSupported( KMPXMediaMusicArtist ) )
+			{
+			const TDesC& title = aMedia->ValueText( KMPXMediaMusicArtist );
+			if ( title.Compare( KNullDesC ) != 0 )
+				{
+				aVisualItem->SetTitleL( title );
+				}
+			else
+				{
+				HBufC* unknownText =
+						StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN );
+				aVisualItem->SetTitleL( *unknownText );
+				CleanupStack::PopAndDestroy( unknownText );
+				}
+			}
+		}
+	else
+		{
+		if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) )
+			{
+			const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle );
+			if ( title.Compare( KNullDesC ) != 0 )
+				{
+				aVisualItem->SetTitleL( title );
+				}
+			else
+				{
+				HBufC* unknownText =
+						StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN );
+				aVisualItem->SetTitleL( *unknownText );
+				CleanupStack::PopAndDestroy( unknownText );
+				}
+			}
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// Set song title to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetSongTitleL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetSongTitleL" );
+
+
+	if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) )
+		{
+		const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle );
+		if ( title.Compare( KNullDesC ) != 0 )
+			{
+			aVisualItem->SetTitleL( title );
+			}
+		else
+			{
+			HBufC* unknownText =
+					StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN );
+			aVisualItem->SetTitleL( *unknownText );
+			CleanupStack::PopAndDestroy( unknownText );
+			}
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Count to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetDetailCountL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailCountL" );
+	if ( aMedia->IsSupported( KMPXMediaGeneralCount ) )
+		{
+		TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
+
+#ifdef HG_MP_LOC_AVAILABLE
+
+        if ( iContext == EContextGroupArtist )
+			{
+			if ( count > 1 )
+			    {
+                HBufC* albumsTitle = StringLoader::LoadLC( R_MPX_COLLECTION_DETAILS_NUMBER_OF_SONGS, // mod by anjokela
+                    count );
+                TPtr ptr = albumsTitle->Des();
+                AknTextUtils::LanguageSpecificNumberConversion( ptr );
+                aVisualItem->SetTextL( ptr );
+                CleanupStack::PopAndDestroy( albumsTitle );
+			    }
+			else
+			    {
+        		aVisualItem->SetTextL( *iSongTitle ); // mod by anjokela
+			    }
+			}
+		else
+			{
+			if ( count > 1 )
+			    {
+                HBufC* songsTitle = StringLoader::LoadLC( R_MPX_COLLECTION_DETAILS_NUMBER_OF_SONGS, count );
+                TPtr ptr = songsTitle->Des();
+                AknTextUtils::LanguageSpecificNumberConversion( ptr );
+        		aVisualItem->SetTextL( ptr );
+                CleanupStack::PopAndDestroy( songsTitle );
+			    }
+			else
+			    {
+        		aVisualItem->SetTextL( *iSongTitle );
+			    }
+			}
+#else //HG_MP_LOC_AVAILABLE
+
+        TBuf<10> temp;
+        temp.AppendNum( count );
+        AknTextUtils::LanguageSpecificNumberConversion( temp );
+
+		TBuf<KMPXMaxFileLength> detailText;
+        detailText.Append( temp );
+        if ( iContext == EContextGroupPodcast )
+			{
+			detailText.Append( (count > 1 ) ? KEpisodes() : KEpisode() );
+			}
+        else if ( iContext == EContextGroupArtist )
+			{
+			detailText.Append( (count > 1 ) ? KAlbums() : KAlbum() );
+			}
+		else
+			{
+			detailText.Append( (count > 1 ) ? KSongs() : KSong() );
+			}
+		aVisualItem->SetTextL( detailText );
+#endif //HG_MP_LOC_AVAILABLE
+
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Artist to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetDetailArtistL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailArtistL" );
+	if ( aMedia->IsSupported( KMPXMediaMusicArtist ) )
+		{
+		// AK - Needs to be localized
+		TBuf<KMPXMaxFileLength> detailText;
+		const TDesC& artist = aMedia->ValueText( KMPXMediaMusicArtist );
+		if ( artist.Compare( KNullDesC ) != 0 )
+			{
+			detailText.Copy(artist.Left(detailText.MaxLength()));
+	        aVisualItem->SetTextL( detailText );
+			}
+	    else
+	        {
+            HBufC* unknownText =
+                StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN );
+    		aVisualItem->SetTextL( *unknownText );
+            CleanupStack::PopAndDestroy( unknownText );
+            }
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Album to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetDetailAlbumL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailAlbumL" );
+
+    TMPXGeneralCategory category( EMPXNoCategory );
+    if ( aMedia->IsSupported( KMPXMediaGeneralCategory ) )
+        {
+        category = aMedia->ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+        }
+
+    if ( aMedia->IsSupported( KMPXMediaMusicAlbum ) && category != EMPXCommand )
+        {
+        TBuf<KMPXMaxFileLength> detailText;
+        const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbum );
+        if ( album.Compare( KNullDesC ) != 0 )
+            {
+            detailText.Copy( album.Left(detailText.MaxLength()));
+            aVisualItem->SetTextL( detailText );
+            }
+        else
+            {
+            HBufC* unknownText =
+                StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN );
+            aVisualItem->SetTextL( *unknownText );
+            CleanupStack::PopAndDestroy( unknownText );
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set Detail - Count + Duration to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetDetailDurationL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailDurationL" );
+    if ( iContext == EContextGroupPlaylist &&
+         aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
+	     aMedia->IsSupported( KMPXMediaGeneralCount ) )
+		{
+		// AK - Needs to be localized
+		TBuf<KMPXMaxFileLength> detailText;
+		TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
+   		TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
+
+#ifdef HG_MP_LOC_AVAILABLE
+    	if ( count > 1 || count == 0 )
+    	    {
+            HBufC* songsTitle = StringLoader::LoadLC( R_MPX_COLLECTION_DETAILS_NUMBER_OF_SONGS, count );
+    	    detailText.Append(*songsTitle);
+    	    detailText.Append(KMPXDash);
+            UpdateTimeIndicatorsL(detailText, duration);
+    		aVisualItem->SetTextL( detailText );
+            CleanupStack::PopAndDestroy( songsTitle );
+    	    }
+    	else
+    	    {
+    	    detailText.Append(*iSongTitle);
+    	    detailText.Append(KMPXDash);
+            UpdateTimeIndicatorsL(detailText, duration);
+    		aVisualItem->SetTextL( detailText );
+    	    }
+#else //HG_MP_LOC_AVAILABLE
+		TBuf<10> temp;
+		temp.AppendNum( count );
+        AknTextUtils::LanguageSpecificNumberConversion( temp );
+        detailText.Append( temp );
+		detailText.Append( (count > 1 ) ? KSongsDash() : KSongDash() );
+        UpdateTimeIndicatorsL(detailText, duration);
+        aVisualItem->SetTextL( detailText );
+#endif //HG_MP_LOC_AVAILABLE
+		}
+    else if ( iContext == EContextItemPodcast &&
+         aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
+         aMedia->IsSupported( KMPXMediaGeneralSize ) )
+        {
+        TBuf<KMPXMaxFileLength> detailText;
+        TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
+        UpdateTimeIndicatorsL(detailText, duration);
+        detailText.Append( KMPXDash() );
+
+        TInt size( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralSize ) );
+        HBufC* sizeBuf = iCommonUiHelper->UnitConversionL( size, ETrue );
+        TPtr sizePtr( sizeBuf->Des() );
+        detailText.Append( sizePtr );
+        delete sizeBuf;
+
+        aVisualItem->SetTextL( detailText );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Format the duration to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::UpdateTimeIndicatorsL(
+    TDes& aBuf,
+    TInt aDuration )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::UpdateTimeIndicatorsL" );
+    TInt durationInSeconds = aDuration;
+    if ( durationInSeconds > 0 )
+        {
+        durationInSeconds /= 1000;   // MilliSeconds to second conversion
+        }
+    else if ( durationInSeconds < 0 )
+        {
+        durationInSeconds = 0;
+        }
+    if ( durationInSeconds == 0 )
+        {
+        TLocale locale;
+        TBuf<KMPXTimeIndicatorLength> pos;
+        TChar separator = locale.TimeSeparator( KMPXMinSecSeparatorIndex );
+        aBuf.Append(KMPXZeroDurationMark);
+        aBuf.Append( separator );
+        aBuf.Append(KMPXZeroDurationMark);
+        }
+    else
+        {
+        CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode = CMPXCommonUiHelper::EMPXDuratAuto;
+        if ( durationInSeconds > KOneHourInSeconds )
+            {
+            durationMode = CMPXCommonUiHelper::EMPXDuratHMS;
+            }
+        // Convert ellapsed time to texts
+        HBufC* position = iCommonUiHelper->DisplayableDurationL( durationInSeconds, durationMode );
+        aBuf.Append(position->Des());
+        delete position;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set Detail - Indicator to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetDetailIndicatorL(
+    CHgItem* aVisualItem,
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailIndicatorL" );
+    // Get icon indices
+    RArray<TInt> iconIndices = iListBoxArray->IndicatorIconIndicesL( aIndex );
+    CleanupClosePushL( iconIndices );
+
+    const TInt iconCount = iconIndices.Count();
+    TInt flags = aVisualItem->Flags() & CHgItem::EHgItemFlagMarked;
+    aVisualItem->ClearFlags(aVisualItem->Flags());
+    if ( iconCount > 0 )
+    	{
+        TInt iconId = 0;
+		for ( TInt iconIndex = 0; iconIndex < iconCount; iconIndex++ )
+			{
+			iconId = iconIndices[iconIndex];
+			if ( !iPodcastContext )
+			    {
+                switch (iconId)
+                    {
+                    case EMPXClvIconMMC:
+                        {
+                        flags |= CHgItem::EHgItemFlagsMmc;
+                        break;
+                        }
+                    case EMPXClvIconPlay:
+                        {
+                        flags |= CHgItem::EHgItemFlagsPlaybackIndicator;
+                        break;
+                        }
+                    case EMPXClvIconPause:
+                        {
+                        flags |= CHgItem::EHgItemFlagsPauseIndicator;
+                        break;
+                        }
+                    case EMPXClvIconBrokenTrack:
+                        {
+                        flags |= CHgItem::EHgItemFlagsBrokenTrackIndicator;
+                        break;
+                        }
+                    case EMPXClvIconCorruptTrack:
+                        {
+                        flags |= CHgItem::EHgItemFlagsCorruptedTrackIndicator;
+                        break;
+                        }
+                    case EMPXClvIconDrmExpired:
+                        {
+                        flags |= CHgItem::EHgItemFlagsDrmRightsExpired;
+                        break;
+                        }
+                    case EMPXClvIconBrokenPlaylist:
+                        {
+                        flags |= CHgItem::EHgItemFlagsBrokenPlaylistIndicator;
+                        break;
+                        }
+                    }
+			    }
+            else // podcast icons
+                {
+                switch (iconId)
+                    {
+                    case EMPXPodClvIconMMC:
+                        {
+                        flags |= CHgItem::EHgItemFlagsMmc;
+                        break;
+                        }
+                    case EMPXPodClvIconPlay:
+                        {
+                        flags |= CHgItem::EHgItemFlagsPlaybackIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconPause:
+                        {
+                        flags |= CHgItem::EHgItemFlagsPauseIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconBroken:
+                        {
+                        flags |= CHgItem::EHgItemFlagsBrokenTrackIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconCorrupt:
+                        {
+                        flags |= CHgItem::EHgItemFlagsCorruptedTrackIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconNew:
+                        {
+                        flags |= CHgItem::EHgItemFlagsNewPodcastIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconCompplay:
+                        {
+                        flags |= CHgItem::EHgItemFlagsCompletelyPlayedPodcastIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconPartplay:
+                        {
+                        flags |= CHgItem::EHgItemFlagsPlayedPodcastIndicator;
+                        break;
+                        }
+                    }
+                }
+			}
+		}
+    aVisualItem->SetFlags( flags );
+    CleanupStack::PopAndDestroy(&iconIndices);
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set Detail - Icon to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetDetailIconL(
+    CHgItem* aVisualItem,
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetDetailIconL" );
+
+    TInt iconIndex = aIndex;
+    switch ( aIndex )
+        {
+        case 0:
+            iconIndex = EMPXClvIconArtist;
+            break;
+        case 1:
+            iconIndex = EMPXClvIconAlbum;
+            break;
+        case 2:
+            iconIndex = EMPXClvIconPlaylist;
+            break;
+        case 3:
+            iconIndex = EMPXClvIconSongs;
+            break;
+        case 4:
+            iconIndex = EMPXClvIconPodcasts;
+            break;
+        case 5:
+            iconIndex = EMPXClvIconGenre;
+            break;
+        case 6:
+            iconIndex = EMPXClvIconComposer;
+            break;
+        case 7: //EMPXDefaultTitleIconPodcasts
+            iconIndex = 10;
+            break;
+		}
+
+    CGulIcon* icon = (*iIconArray)[iconIndex];
+
+	CFbsBitmap* bitmap = icon->Bitmap();
+	CFbsBitmap* mask = icon->Mask();
+
+	TSize size(iImageSize.iWidth, iImageSize.iHeight);
+    if ( iContext == EContextGroupCollection )
+        { // shrink smaller to look same as in Antriksh
+        size.iWidth = iImageSize.iWidth * KIconFactor;
+        size.iHeight = iImageSize.iHeight * KIconFactor;
+        }
+
+    AknIconUtils::SetSize( bitmap, size );
+    AknIconUtils::SetSize( mask, size );
+
+    CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
+	iconCopy->SetBitmapsOwnedExternally(ETrue);
+    aVisualItem->SetIcon( iconCopy );
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Thumbnail to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetDetailThumbnailL(
+    CMPXMedia* aMedia,
+    TInt aIndex )
+    {
+	  MPX_FUNC("CMPXCollectionViewHgContainer::SetDetailThumbnailL(CMPXMedia* aMedia,TInt aIndex)");
+    TMPXItemId currentId( aMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+
+    if ( currentId == KMPXInvalidItemId )
+        {
+        return;
+        }
+
+	if ( aMedia->IsSupported( KMPXMediaMusicAlbumArtFileName ) )
+		{
+		const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbumArtFileName );
+		#ifdef _DEBUG
+		RDebug::RawPrint(album);
+		#endif
+		if ( album.Compare( KNullDesC ) != 0 )
+			{
+			iThumbnailManager->LoadThumbL( aIndex , album);
+			}
+		else
+			{
+			//no albumart
+			// Default album art has already been set earlier.
+    		iThumbnailReqMap[aIndex] = ETrue;
+    		RefreshNoThumbnailL(aIndex);
+			}
+		}
+	else
+	    {
+		// no album art supported
+		// Default album art has already been set earlier.
+	    if ( iCurrentViewType == EMPXViewCoverFlow ||
+	         iCurrentViewType == EMPXViewList && aIndex == 0 )
+	        SetDetailIconShuffleL(); // BUG: temporarily called here because default icon is shown if SetDefaultIconL is called after.
+    	iThumbnailReqMap[aIndex] = ETrue;
+        RefreshNoThumbnailL(aIndex);
+	    }
+    }
+
+// ----------------------------------------------------------------------------
+// Set the shuffle item icon
+// ----------------------------------------------------------------------------
+
+void CMPXCollectionViewHgContainer::SetDetailIconShuffleL()
+    {
+
+	const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+	if (mediaArray.Count())
+		{
+		CMPXMedia* currentMedia( mediaArray.AtL( 0 ) );
+
+		TMPXGeneralType type( EMPXNoType );
+		if ( currentMedia->IsSupported( KMPXMediaGeneralType ) )
+			{
+			type = currentMedia->ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+			}
+
+		TMPXGeneralCategory category( EMPXNoCategory );
+		if ( currentMedia->IsSupported( KMPXMediaGeneralCategory ) )
+			{
+			category = currentMedia->ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+			}
+
+		if ( type == EMPXItem && category == EMPXCommand )
+			{
+
+			CGulIcon* icon = (*iIconArray)[EMPXClvIconShuffle];
+			CFbsBitmap* bitmap = icon->Bitmap();
+			CFbsBitmap* mask = icon->Mask();
+
+			TSize size(240,240);
+			CHgItem* item = NULL;
+			if( iCurrentViewType == EMPXViewCoverFlow || iCurrentViewType == EMPXViewTBone )
+				{
+				item = &iMediaWall->ItemL(0);
+				}
+			else if( iCurrentViewType == EMPXViewList )
+				{
+				item = &iListWidget->ItemL(0);
+				size = CHgDoubleGraphicListFlat::PreferredImageSize();
+				}
+			else
+				{
+				User::Leave( KErrNotSupported );
+				}
+
+			if ( item )
+				{
+				AknIconUtils::SetSize( bitmap, size );
+				AknIconUtils::SetSize( mask, size );
+
+				CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
+				iconCopy->SetBitmapsOwnedExternally(ETrue);
+				item->SetIcon( iconCopy );
+				}
+			}
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// Set the shuffle item text
+// ----------------------------------------------------------------------------
+
+TBool CMPXCollectionViewHgContainer::SetShuffleItemTextL(CHgItem* aItem, CMPXMedia* aMedia)
+    {
+
+	TBool res(EFalse);
+    TMPXGeneralType type( EMPXNoType );
+    if ( aMedia->IsSupported( KMPXMediaGeneralType ) )
+        {
+        type = aMedia->ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+        }
+
+    TMPXGeneralCategory category( EMPXNoCategory );
+    if ( aMedia->IsSupported( KMPXMediaGeneralCategory ) )
+        {
+        category = aMedia->ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+        }
+
+    if ( type == EMPXItem && category == EMPXCommand )
+        {
+
+        if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) )
+            {
+
+            const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle );
+            if ( title.Compare( KNullDesC ) != 0 )
+                {
+                aItem->SetTitleL( title );
+                }
+            else
+                {
+                HBufC* unknownText =
+                        StringLoader::LoadLC( R_MPX_COLLECTION_UNKNOWN );
+                aItem->SetTitleL( *unknownText );
+                CleanupStack::PopAndDestroy( unknownText );
+                }
+            }
+
+        if ( aMedia->IsSupported( KMPXMediaColDetailNumberOfItems ) )
+            {
+            TInt songsCount = aMedia->ValueTObjectL<TInt>( KMPXMediaColDetailNumberOfItems );
+
+			HBufC* songsTitle = StringLoader::LoadLC( R_MPX_COLLECTION_DETAILS_NUMBER_OF_SONGS, songsCount );
+			TPtr ptr = songsTitle->Des();
+			AknTextUtils::LanguageSpecificNumberConversion( ptr );
+			aItem->SetTextL( ptr );
+			CleanupStack::PopAndDestroy( songsTitle );
+            }
+
+		// We can try to set icon too.
+		SetDetailIconShuffleL();
+		res = ETrue;
+		}
+
+	return res;
+    }
+
+// -----------------------------------------------------------------------------
+// Sets the current category.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::SetCollectionContextL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::SetCollectionContextL" );
+
+    const CMPXMedia& media = iListBoxArray->ContainerMedia();
+
+    TMPXGeneralType containerType( EMPXNoType );
+    if ( media.IsSupported( KMPXMediaGeneralType ) )
+        {
+        containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+        }
+
+    TMPXGeneralCategory containerCategory( EMPXNoCategory );
+    if ( media.IsSupported( KMPXMediaGeneralCategory ) )
+        {
+        containerCategory = media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+        }
+    MPX_DEBUG3( "CMPXCollectionViewHgContainer::SetCollectionContextL container type = %d, category = %d",
+            containerType, containerCategory );
+
+    iPodcastContext = EFalse;
+    TMPXPodcastCategory podcastCategory( EMPXUnknown );
+    if ( media.IsSupported( KMPXMediaPodcastType ) )
+        {
+        iPodcastContext = ETrue;
+        if ( media.IsSupported( KMPXMediaPodcastCategoryGroup ) )
+            {
+            podcastCategory = media.ValueTObjectL<TMPXPodcastCategory>( KMPXMediaPodcastCategoryGroup );
+            }
+        }
+    MPX_DEBUG3( "CMPXCommonContainerHitchcockImp::SetCollectionContextL container podcast = %d, category = %d",
+            iPodcastContext, podcastCategory );
+
+    iPrevContext = iContext;
+
+    if( iListWidget )
+        {
+        iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
+        }
+    if ( !iPodcastContext )
+        {
+        if ( containerType == EMPXGroup )
+            {
+            switch (containerCategory)
+                {
+                case EMPXCollection:
+                    iContext = EContextGroupCollection;
+                    if( iListWidget )
+                        {
+                        iListWidget->SetFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
+                        }
+                    break;
+                case EMPXArtist:
+                    iContext = EContextGroupArtist;
+                    break;
+                case EMPXAlbum:
+                    iContext = EContextGroupAlbum;
+                    break;
+                case EMPXPlaylist:
+                    iContext = EContextGroupPlaylist;
+                    break;
+                case EMPXSong:
+                    iContext = EContextGroupSong;
+                    break;
+                case EMPXGenre:
+                    iContext = EContextGroupGenre;
+                    break;
+                case EMPXComposer:
+                    iContext = EContextGroupComposer;
+                    break;
+                default:
+                    User::Leave(KErrNotSupported);
+                    break;
+                }
+            }
+        else if ( containerType == EMPXItem )
+            {
+            switch (containerCategory)
+                {
+                case EMPXArtist:
+                    iContext = EContextItemArtist;
+                    break;
+                case EMPXAlbum:
+                    iContext = EContextItemAlbum;
+                    break;
+                case EMPXPlaylist:
+                    iContext = EContextItemPlaylist;
+                    break;
+                case EMPXSong:
+                    iContext = EContextItemSong;
+                    break;
+                case EMPXGenre:
+                    iContext = EContextItemGenre;
+                    break;
+                case EMPXComposer:
+                    iContext = EContextItemComposer;
+                    break;
+                default:
+                    User::Leave(KErrNotSupported);
+                    break;
+                }
+            }
+         else if ( containerType == EMPXOtherType )
+            {
+
+			if (containerCategory == EMPXAlbum)
+				{
+				//iContext = EContextItemAlbum2;
+				}
+
+            }
+        }
+    else
+        {
+        if ( (containerType == EMPXGroup) && (podcastCategory == EMPXTitle) )
+            {
+            iContext = EContextGroupPodcast;
+			if( iListWidget )
+				{
+				iListWidget->SetFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
+				}
+			}
+        else if ( (containerType == EMPXItem) && (podcastCategory == EMPXEpisode) )
+            {
+            iContext = EContextItemPodcast;
+            }
+        else
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+    }
+
+
+
+void CMPXCollectionViewHgContainer::TNReadyL(TInt aError, CFbsBitmap* aBitmap, CFbsBitmap* /*aMask*/, TInt aIndex)
+    {
+    if ( aError == KErrNone )
+        {
+        const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+        CMPXMedia* currentMedia( mediaArray.AtL( aIndex ) );
+        if ( currentMedia->IsSupported( KMPXMediaGeneralId ) )
+            {
+            if ( aBitmap )
+                {
+                CGulIcon* icon = CGulIcon::NewL(aBitmap, NULL);
+
+                switch (iCurrentViewType)
+                    {
+                    case EMPXViewCoverFlow:
+                    case EMPXViewTBone:
+                        {
+                        iMediaWall->ItemL(aIndex).SetIcon(icon);
+    					iThumbnailReqMap[aIndex] = ETrue;
+                        break;
+                        }
+                    case EMPXViewList:
+                        {
+                        iListWidget->ItemL(aIndex).SetIcon(icon);
+    					iThumbnailReqMap[aIndex] = ETrue;
+                        break;
+                        }
+                    default:
+                        break;
+                    }
+
+                RefreshL(aIndex);
+                }
+            }
+        }
+    else
+        {
+        //no albumart supported
+        SetDefaultIconL(aIndex);
+        RefreshL(aIndex);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Clears the TN request if any
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::CancelTNRequest()
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::CancelTNRequest");
+
+    }
+
+
+// ----------------------------------------------------------------------------
+// Construct a collection path with the current selection and open the
+// path to start playback.
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::UpdatePathAndOpenL(TInt aIndex, TBool aSelectAll)
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::UpdatePathAndOpenL");
+
+	RArray<TMPXItemId> ids;
+	CleanupClosePushL(ids);
+    const CMPXMediaArray& albums = iListBoxArray->MediaArray();
+    CMPXMedia* album( albums.AtL( iSelectedAlbumIndex ) );
+
+	if( album->IsSupported(KMPXMediaArrayContents) )
+		{
+
+		// Get the current path
+		CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+		CleanupStack::PushL( cpath );
+
+        MPX_DEBUG_PATH(*cpath);
+
+        if (cpath->Levels() == 3)
+			{
+			// go back one level before amending path with new levels
+			cpath->Back();
+			}
+
+        else if  (cpath->Levels() == 4)
+			{
+			// go back 2 levels before appending new level
+			cpath->Back();
+			cpath->Back();
+			}
+
+
+		TInt albumCount = albums.Count();
+		for (TInt i=0; i<albumCount; ++i)
+			{
+			CMPXMedia* album = albums.AtL(i);
+			const TMPXItemId id = album->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+			ids.AppendL(id);
+			}
+		cpath->AppendL(ids.Array()); // top level items
+		cpath->Set(iSelectedAlbumIndex);
+		ids.Reset();
+
+		const CMPXMediaArray* songs = album->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+		User::LeaveIfNull(const_cast<CMPXMediaArray*>(songs));
+		TInt count = songs->Count();
+		for (TInt i=0; i<count; ++i)
+			{
+			CMPXMedia* song = songs->AtL(i);
+			const TMPXItemId id = song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+			ids.AppendL(id);
+			}
+
+		cpath->AppendL(ids.Array()); // top level items
+
+		TBool shuffle(EFalse);
+
+		if ( aSelectAll ) // Plays all songs without shuffle
+			{
+			cpath->Set(0);
+			}
+		else
+			{
+			if ( count > 1 ) // We need to adjust in case aIndex is the shuffle item
+				{
+				if ( aIndex == 0 ) // Plays all songs shuffled
+					{
+					shuffle = ETrue;
+					TTime time;
+					time.UniversalTime();
+					TInt64 seed = time.Int64();
+					TInt randIndex = Math::Rand(seed) % count;
+					cpath->Set(randIndex);
+					}
+				else
+					{
+					cpath->Set(aIndex-1); // actual selection
+					}
+				}
+			else
+				{
+				cpath->Set(aIndex);
+				}
+			}
+
+		MPX_DEBUG_PATH(*cpath);
+
+		TMPXPlaybackState pbState( iPlaybackUtility->StateL() );
+		if ( pbState == EPbStatePlaying || pbState == EPbStatePaused )
+			{
+			if ( IsPlayingCurrentIndexL(cpath) && !shuffle )
+				{
+				if ( pbState == EPbStatePaused )
+					{
+					iPlaybackUtility->CommandL( EPbCmdPlay );
+					}
+                iPlaybackUtility->SetL( EPbPropertyRandomMode, shuffle );
+				iView->ProcessCommandL( EMPXCmdGoToNowPlaying );
+				}
+			else
+			    {
+                iPlaylistHelper->InitPlaylistL(*cpath, shuffle);
+			    }
+			}
+		else
+		    {
+            iPlaylistHelper->InitPlaylistL(*cpath, shuffle);
+		    }
+
+		CleanupStack::PopAndDestroy( cpath );
+
+		// We need to restore the status pane before switching to playback view.
+		if (!((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->IsVisible())
+			((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(ETrue);
+
+		}
+	CleanupStack::PopAndDestroy(&ids);
+	}
+
+
+// ----------------------------------------------------------------------------
+// Construct a collection path with the current selection and construct a
+// playlist from path to start playback.
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::UpdatePathAndOpenPlaylistL(
+	 const CMPXMedia& aFindResult )
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::UpdatePathAndOpenPlaylistL");
+
+	TInt selectedIndex(0);
+    CHgScroller* listWidget = CurrentListWidget();
+	if ( iContext == EContextGroupPlaylist ||
+	     iContext == EContextGroupGenre && listWidget )
+		{
+		selectedIndex = listWidget->SelectedIndex();
+		}
+	else
+		{
+		return;
+		}
+
+	RArray<TMPXItemId> ids;
+	CleanupClosePushL(ids);
+
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+
+	// Get the current path
+	CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+	CleanupStack::PushL( cpath );
+
+	MPX_DEBUG_PATH(*cpath);
+	if (cpath->Levels() == 3)
+		{
+		// go back one level before amending path with new levels
+		cpath->Back();
+		}
+
+	TInt mediaCount = mediaArray.Count();
+	for (TInt i=0; i<mediaCount; ++i)
+		{
+		CMPXMedia* mediaItem = mediaArray.AtL(i);
+		const TMPXItemId id = mediaItem->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+		ids.AppendL(id);
+		}
+	cpath->AppendL(ids.Array()); // top level items
+	cpath->Set(selectedIndex); // set the selected item
+	ids.Reset();
+
+	CMPXMediaArray* songArray(const_cast<CMPXMediaArray*>( aFindResult.Value<CMPXMediaArray>(
+							KMPXMediaArrayContents ) ) );
+	User::LeaveIfNull( songArray );
+
+	TInt count = songArray->Count();
+	for (TInt i=0; i<count; ++i)
+		{
+		CMPXMedia* song = songArray->AtL(i);
+		const TMPXItemId id = song->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+		ids.AppendL(id);
+		}
+
+	cpath->AppendL(ids.Array()); // top level items of songs
+	cpath->Set(0); // select 1st song
+
+	MPX_DEBUG_PATH(*cpath);
+
+	TMPXPlaybackState pbState( iPlaybackUtility->StateL() );
+	if ( pbState == EPbStatePlaying || pbState == EPbStatePaused )
+		{
+		if ( IsPlayingCurrentIndexL(cpath) )
+			{
+			if ( pbState == EPbStatePaused )
+				{
+				iPlaybackUtility->CommandL( EPbCmdPlay );
+				}
+			iPlaybackUtility->SetL( EPbPropertyRandomMode, EFalse );
+			iView->ProcessCommandL( EMPXCmdGoToNowPlaying );
+			}
+		else
+			{
+			iPlaylistHelper->InitPlaylistL(*cpath, EFalse);
+			}
+		}
+	else
+		{
+		iPlaylistHelper->InitPlaylistL(*cpath, EFalse);
+		}
+
+	CleanupStack::PopAndDestroy( cpath );
+
+	// We need to restore the status pane before switching to playback view.
+	if (!((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->IsVisible())
+		((CAknAppUi*)iCoeEnv->AppUi())->StatusPane()->MakeVisible(ETrue);
+
+	CleanupStack::PopAndDestroy(&ids);
+	}
+
+
+// ----------------------------------------------------------------------------
+// Handle opening the album to show songs
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::OpenAlbumL(TInt aIndex)
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::OpenAlbumL");
+
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+    CMPXMedia* album( mediaArray.AtL( aIndex ) );
+    if( album->IsSupported(KMPXMediaArrayContents) )
+        {
+        // We've previously fetched the songs for this album so
+        // all we do now is populate the list with the song titles.
+        if( iCurrentViewType == EMPXViewCoverFlow )
+            {
+            ShowAlbumSongsDialogL(*album);
+            }
+        else
+            {
+            ShowAlbumSongsL(*album);
+            }
+        }
+    else
+        {
+        // We'll find the songs for the selected album
+        iFindOp = EMPXOpenAlbum;
+        FindAlbumSongsL(aIndex);
+        }
+
+    }
+
+// ----------------------------------------------------------------------------
+// Handle preparing playback of the selected album
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::PlayAlbumL(TInt aIndex)
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::PlayAlbumL");
+
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+    CMPXMedia* album( mediaArray.AtL( aIndex ) );
+    if( album->IsSupported(KMPXMediaArrayContents) )
+        {
+        // We've previously fetched the songs for this album so
+        // all we do now is construct a playlist for the album
+        UpdatePathAndOpenL(0, ETrue);
+        }
+    else
+        {
+        // We'll find the songs for the selected album
+        iFindOp = EMPXPlayAlbum;
+        FindAlbumSongsL(aIndex);
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Handle preparing playback of the selected playlist
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::PlayPlaylistL(TInt aIndex)
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::PlayPlaylistL");
+
+	// We'll find the songs for the selected playlist
+	iFindOp = EMPXPlayPlaylist;
+	FindPlaylistSongsL(aIndex);
+    }
+
+// ----------------------------------------------------------------------------
+// Handle preparing playback of the selected genre
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::PlayGenreL(TInt aIndex)
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::PlayGenreL");
+
+	// We'll find the songs for the selected genre
+	iFindOp = EMPXPlayGenre;
+	FindGenreSongsL(aIndex);
+    }
+
+// ----------------------------------------------------------------------------
+// Check if shuffle item is selected and if so, initialize shuffle playback.
+// ----------------------------------------------------------------------------
+TBool CMPXCollectionViewHgContainer::ShufflePlayAllL(TInt aIndex)
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::ShufflePlayAllL");
+
+    TBool shuffle(EFalse);
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+
+	CMPXMedia* currentMedia( mediaArray.AtL( aIndex ) );
+
+    TMPXGeneralType type( EMPXNoType );
+    if ( currentMedia->IsSupported( KMPXMediaGeneralType ) )
+        {
+        type = currentMedia->ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+        }
+
+    TMPXGeneralCategory category( EMPXNoCategory );
+    if ( currentMedia->IsSupported( KMPXMediaGeneralCategory ) )
+        {
+        category = currentMedia->ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+        }
+
+    if ( type == EMPXItem && category == EMPXCommand )
+        {
+		shuffle = ETrue;
+		iPlaylistHelper->InitPlaylistL(shuffle);
+        }
+
+    return shuffle;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgContainer::FindAlbumSongsL
+// Find all the songs for the selected album index.
+// If songs are already in the media array, we don't need to fetch them again.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::FindAlbumSongsL(
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::FindAlbumSongsL" );
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+    CMPXMedia* album( mediaArray.AtL( aIndex ) );
+
+    // Fetch the songs for the selected album
+    TMPXItemId albumId = album->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+    CMPXMedia* findCriteria = CMPXMedia::NewL();
+    CleanupStack::PushL( findCriteria );
+    findCriteria->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, EMPXGroup );
+    findCriteria->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory, EMPXSong );
+    findCriteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, albumId );
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
+                                 EMPXMediaGeneralTitle |
+                                 EMPXMediaGeneralId |
+                                 EMPXMediaGeneralType |
+                                 EMPXMediaGeneralCategory |
+                                 EMPXMediaGeneralFlags ) );
+    attrs.Append( KMPXMediaMusicAlbumTrack );
+
+
+    iCollectionUtility->Collection().FindAllL( *findCriteria, attrs.Array(), *this );
+    CleanupStack::PopAndDestroy( &attrs );
+    CleanupStack::PopAndDestroy( findCriteria );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgContainer::FindPlaylistSongsL
+// Find all the songs for the selected playlist index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::FindPlaylistSongsL(
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::FindPlaylistSongsL" );
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+    CMPXMedia* playlist( mediaArray.AtL( aIndex ) );
+
+    // Fetch the songs for the selected album
+    TMPXItemId playlistId = playlist->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+    CMPXMedia* findCriteria = CMPXMedia::NewL();
+    CleanupStack::PushL( findCriteria );
+    findCriteria->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, EMPXGroup );
+    findCriteria->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory, EMPXSong );
+    findCriteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, playlistId );
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
+                                 EMPXMediaGeneralTitle |
+                                 EMPXMediaGeneralId |
+                                 EMPXMediaGeneralType |
+                                 EMPXMediaGeneralCategory |
+                                 EMPXMediaGeneralFlags ) );
+
+    iCollectionUtility->Collection().FindAllL( *findCriteria, attrs.Array(), *this );
+    CleanupStack::PopAndDestroy( &attrs );
+    CleanupStack::PopAndDestroy( findCriteria );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgContainer::FindGenreSongsL
+// Find all the songs for the selected genre index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::FindGenreSongsL(
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::FindPlaylistSongsL" );
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+    CMPXMedia* genre( mediaArray.AtL( aIndex ) );
+
+    // Fetch the songs for the selected genre
+    TMPXItemId genreId = genre->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+    CMPXMedia* findCriteria = CMPXMedia::NewL();
+    CleanupStack::PushL( findCriteria );
+    findCriteria->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, EMPXGroup );
+    findCriteria->SetTObjectValueL<TMPXGeneralCategory>( KMPXMediaGeneralCategory, EMPXSong );
+    findCriteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, genreId );
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
+                                 EMPXMediaGeneralTitle |
+                                 EMPXMediaGeneralId |
+                                 EMPXMediaGeneralType |
+                                 EMPXMediaGeneralCategory |
+                                 EMPXMediaGeneralFlags ) );
+
+    iCollectionUtility->Collection().FindAllL( *findCriteria, attrs.Array(), *this );
+    CleanupStack::PopAndDestroy( &attrs );
+    CleanupStack::PopAndDestroy( findCriteria );
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionFindObserver
+// Handle callback for "find" operation
+// Songs are saved back into the media array for subsequent use.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::HandleFindAllL(
+    const CMPXMedia& aResults,
+    TBool /*aComplete*/,
+    TInt aError )
+    {
+    MPX_DEBUG2( "-->CMPXCollectionViewHgContainer::HandleFindAllL aError = %d", aError );
+
+    if ( aError == KErrNone )
+		{
+		if ( iFindOp == EMPXOpenAlbum || iFindOp == EMPXPlayAlbum )
+			{
+			CMPXMediaArray* songArray(const_cast<CMPXMediaArray*>( aResults.Value<CMPXMediaArray>(
+							KMPXMediaArrayContents ) ) );
+			User::LeaveIfNull( songArray );
+
+			// save the songs to the album so that we don't need to find them again
+			// if the same album is selected again.
+			if ( songArray->Count() )
+				{
+				const CMPXMediaArray& albumsArray = iListBoxArray->MediaArray();
+				CMPXMedia* albumMedia( albumsArray.AtL( iSelectedAlbumIndex ) );
+				albumMedia->SetCObjectValueL(KMPXMediaArrayContents, songArray);
+				albumMedia->SetTObjectValueL<TInt>(KMPXMediaArrayCount, songArray->Count());
+				}
+
+			if ( iFindOp == EMPXOpenAlbum )
+			    {
+                if( iCurrentViewType == EMPXViewCoverFlow )
+                    {
+                    ShowAlbumSongsDialogL( aResults );
+                    }
+                else
+                    {
+                    ShowAlbumSongsL( aResults );
+                    }
+			    }
+			else if ( iFindOp == EMPXPlayAlbum )
+			    {
+		        PlayAlbumL(iSelectedAlbumIndex);
+			    }
+			iFindOp = EMPXNoOp;
+			}
+		else if ( iFindOp == EMPXPlayPlaylist || iFindOp == EMPXPlayGenre )
+			{
+			iFindOp = EMPXNoOp;
+			UpdatePathAndOpenPlaylistL(aResults);
+			}
+		}
+	else
+		{
+		// We don't do anything if there's error
+		return;
+		}
+    }
+
+// ---------------------------------------------------------------------------
+// Check if the current playing song is the same as the selected song.
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewHgContainer::IsPlayingCurrentIndexL(CMPXCollectionPath* aPath)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::CurrentPlaybackIndexL" );
+    TBool ret( EFalse );
+
+	MMPXSource* source( iPlaybackUtility->Source() );
+	if ( source )
+		{
+		CMPXCollectionPlaylist* playlist( source->PlaylistL() );
+		if ( playlist )
+			{
+			CleanupStack::PushL( playlist );
+			CMPXCollectionPath* pbPath(
+				CMPXCollectionPath::NewL( playlist->Path() ) );
+			CleanupStack::PushL( pbPath );
+	        MPX_DEBUG_PATH(*aPath);
+	        MPX_DEBUG_PATH(*pbPath);
+
+			TInt playbackPathCount( pbPath->Levels() );
+			if ( aPath->Levels() == playbackPathCount )
+				{
+				TBool isEqual( ETrue );
+				for ( TInt i = 0; i < playbackPathCount - 1; i++ )
+					{
+					if ( aPath->Id( i ) != pbPath->Id( i ) )
+						{
+						isEqual = EFalse;
+						break;
+						}
+					}
+				if ( isEqual )
+					{
+					if (pbPath->Index() == aPath->Index() )
+						ret = ETrue;
+					}
+				}
+			CleanupStack::PopAndDestroy( pbPath );
+			CleanupStack::PopAndDestroy( playlist );
+			}
+		}
+
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Shows the album songs in songs dialog.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ShowAlbumSongsDialogL( const CMPXMedia& aResults )
+    {
+    CAknSinglePopupMenuStyleListBox* listBox = new ( ELeave ) CAknSinglePopupMenuStyleListBox;
+    CleanupStack::PushL( listBox );
+
+    CAknPopupList* dialog = CAknPopupList::NewL(listBox, R_MPX_COLLECTION_ALBUMSONGS_LIST_CBA,
+            AknPopupLayouts::EDynMenuWindow );
+
+    listBox->ConstructL( dialog,
+            EAknListBoxSelectionList | EAknListBoxScrollBarSizeExcluded  );
+
+    listBox->CreateScrollBarFrameL( ETrue );
+    listBox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff,
+            CEikScrollBarFrame::EAuto );
+
+    // Set title
+    if ( iSelectedMediaInAlbumView && iSelectedMediaInAlbumView->IsSupported( KMPXMediaMusicAlbum ) )
+        {
+        const TDesC& album = iSelectedMediaInAlbumView->ValueText( KMPXMediaMusicAlbum );
+            if ( album.Compare( KNullDesC ) != 0 )
+            {
+            dialog->SetTitleL( album );
+            }
+        }
+
+    CMPXMediaArray* songArray(const_cast<CMPXMediaArray*>( aResults.Value<CMPXMediaArray>(
+            KMPXMediaArrayContents ) ) );
+    User::LeaveIfNull( songArray );
+    TInt songCount = songArray->Count();
+
+    CDesC16ArrayFlat* songList = new (ELeave) CDesC16ArrayFlat(songCount);
+
+    if ( songCount > 1 )
+        {
+        songList->AppendL( _L("Shuffle All") );
+        }
+
+    for ( TInt i = 0; i < songCount; i++ )
+        {
+        // Just get the exiting item and update the fields + icon.
+        CMPXMedia* currentMedia( songArray->AtL( i ) );
+
+        if ( currentMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
+            KMPXInvalidItemId )
+            {
+            break;
+            }
+        if ( currentMedia->IsSupported( KMPXMediaGeneralTitle ) )
+            {
+            const TDesC& title = currentMedia->ValueText( KMPXMediaGeneralTitle );
+            songList->AppendL( title );
+            }
+        }
+
+    CTextListBoxModel* model = listBox->Model();
+    model->SetItemTextArray( songList );
+    model->SetOwnershipType( ELbmOwnsItemArray );
+    TBool play = dialog->ExecuteLD();
+    TInt index = listBox->CurrentItemIndex();
+    if( play )
+        {
+        // If item in list was opened, we only play the selected one.
+        SaveSelectedAlbumItemL(iSelectedAlbumIndex);
+        // Open the selected song of album
+        UpdatePathAndOpenL(index);
+        }
+    else
+        {
+        // Do nothing if cancel was pressed.
+        }
+
+    CleanupStack::PopAndDestroy( listBox );
+
+    // Close mediawall "flip animation"
+    iMediaWall->StartOpeningAnimationL( EFalse );
+    }
+
+
+// -----------------------------------------------------------------------------
+// Shows the album songs in the tbone list.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::ShowAlbumSongsL( const CMPXMedia& aAlbum )
+    {
+
+	CMPXMediaArray* albumSongs =
+		const_cast<CMPXMediaArray*>(aAlbum.Value<CMPXMediaArray>( KMPXMediaArrayContents ) );
+	TInt songCount = albumSongs->Count();
+	TInt listSize = songCount;
+	TInt indexAddition = 0;
+
+	CHgScroller* currentList = CurrentListWidget();
+	User::LeaveIfNull( currentList );
+
+	if( currentList->ItemCount() > 1 )
+		{
+		// There might be shuffle icon in the first item so lets reset it.
+		currentList->ItemL(0).SetIcon( NULL );
+		}
+	if( songCount > 1 )
+		{
+		listSize++;
+		indexAddition = 1;
+		}
+	// Add space for shuffle item if list contains more than one item.
+	currentList->ResizeL( listSize );
+
+	for ( TInt i = 0; i < songCount ; i++ )
+		{
+		// Just get the exiting item and update the fields + icon.
+		CMPXMedia* song( albumSongs->AtL( i ) );
+
+		if ( song->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
+			KMPXInvalidItemId )
+			{
+			break;
+			}
+		CHgItem* item = &currentList->ItemL(i+indexAddition);
+
+		// Just get the exiting item and update the fields + icon.
+		SetSongTitleL( item, song );
+		// TODO, david has removed this line????
+//            AddDetailToDisplayedItemL( item, song, i );
+		//David: AddDetailToDisplayedItemL( item, currentMedia, i ); is broken
+		// will need to be fixed.
+		}
+
+		if( songCount > 1 )
+			{
+			SetShuffleItemToListL( currentList );
+			}
+		currentList->SetSelectedIndex( 0 );
+		currentList->SetFocus(ETrue, EDrawNow);
+		currentList->DrawNow();
+
+    }
+
+// ----------------------------------------------------------------------------
+// Save the selected album item
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::SaveSelectedAlbumItemL(TInt aIndex)
+    {
+    if ( iContext == EContextGroupAlbum ||
+         iContext == EContextItemArtist ||
+         iContext == EContextItemAlbum )
+        {
+        const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+
+        if ( iSelectedMediaInAlbumView )
+            {
+            delete iSelectedMediaInAlbumView;
+            iSelectedMediaInAlbumView = NULL;
+            }
+
+        iSelectedMediaInAlbumView = CMPXMedia::NewL( *mediaArray.AtL( aIndex ) );
+
+        if ( iSelectedMediaInAlbumView->IsSupported( KMPXMediaGeneralTitle ) )
+            {
+            const TDesC& title = iSelectedMediaInAlbumView->ValueText( KMPXMediaGeneralTitle );
+            if ( title == KNullDesC )
+                {
+                // Cannot use reference to KNullDesC, must
+                // use the literal directly.
+                iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicAlbum, KNullDesC );
+                }
+            else
+                {
+                iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicAlbum, title );
+                }
+            }
+
+        if ( iContext == EContextItemArtist )
+            {
+            const CMPXMedia& containerMedia = iListBoxArray->ContainerMedia();
+            const TDesC& artist = containerMedia.ValueText( KMPXMediaGeneralTitle );
+
+            HBufC* unknownArtistText =
+                    StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_ARTIST );
+
+            if ( artist != unknownArtistText->Des() )
+                {
+                iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicArtist, artist );
+                }
+            else
+                {
+                iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicArtist, KNullDesC );
+                }
+
+            CleanupStack::PopAndDestroy( unknownArtistText );
+            }
+
+        WriteToStreamFileL( iSelectedMediaInAlbumView );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgContainer::RestoreSelectedAlbumItemL
+// When view is deactivated, all the current information about album selection
+// were lost. So we restore the selected album.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgContainer::RestoreSelectedAlbumItemL(
+    const CMPXMediaArray& aMediaArray )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::RestoreSelectedAlbumItemL" );
+
+    CMPXMedia* restoredAlbum = CMPXMedia::NewL();
+    ReadFromStreamFileL(restoredAlbum);
+    TMPXItemId id=restoredAlbum->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+
+    for ( TInt i = 0; i < aMediaArray.Count() ; i++ )
+        {
+        CMPXMedia* currentMedia( aMediaArray.AtL( i ) );
+
+        if ( currentMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == id )
+            {
+            iRestoredAlbumIndex = i;
+            iSelectedAlbumIndex = i;
+            break;
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Write the album name, artist name and album art in media data to file
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::WriteToStreamFileL( const CMPXMedia* aMedia )
+   {
+    MPX_FUNC( "CMPXCollectionViewHgContainer::WriteToStreamFileL" );
+
+    CCoeEnv* coeEnv( iEikonEnv );
+    RFs& fs = coeEnv->FsSession();
+    fs.MkDirAll( iSelectedAlbumItemFileName );
+    TParse parsedName;
+
+    fs.Parse( iSelectedAlbumItemFileName, parsedName );
+    CFileStore* store( NULL );
+    MPX_TRAPD( error, store = CDirectFileStore::ReplaceL(fs,
+                                                 parsedName.FullName(),
+                                                 EFileWrite); );
+
+    if ( error == KErrNone )
+        {
+        CleanupStack::PushL( store );
+        store->SetTypeL( KDirectFileStoreLayoutUid );
+
+        RStoreWriteStream wstream;
+        TStreamId stream = wstream.CreateLC( *store );
+        store->SetRootL( stream );
+
+        aMedia->ExternalizeL(wstream);
+
+        wstream.CommitL();
+        CleanupStack::PopAndDestroy( &wstream );
+        CleanupStack::PopAndDestroy( store );
+        }
+    else
+        {
+        fs.Delete( iSelectedAlbumItemFileName );
+        }
+   }
+
+// ----------------------------------------------------------------------------
+// Read the album name, artist name and album art from file
+// ----------------------------------------------------------------------------
+void CMPXCollectionViewHgContainer::ReadFromStreamFileL( CMPXMedia* aMedia )
+    {
+    MPX_FUNC("CMPXCollectionViewHgContainer::ReadFromStreamFileL");
+
+    CCoeEnv* coeEnv( iEikonEnv );
+    RFs& fs = coeEnv->FsSession();
+    fs.MkDirAll( iSelectedAlbumItemFileName );
+    TParse parsedName;
+
+    fs.Parse( iSelectedAlbumItemFileName, parsedName );
+    CFileStore* store( NULL );
+    MPX_TRAPD( error, store = CDirectFileStore::OpenL(fs,
+                                                 parsedName.FullName(),
+                                                 EFileRead ); );
+
+    if ( error == KErrNone )
+        {
+        CleanupStack::PushL( store );
+
+        RStoreReadStream stream;
+        stream.OpenLC( *store, store->Root() );
+        aMedia->InternalizeL(stream);
+
+        CleanupStack::PopAndDestroy( &stream );
+        CleanupStack::PopAndDestroy( store );
+        }
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,7785 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Collection view
+*
+*/
+
+// INCLUDE FILES
+#include <bldvariant.hrh>
+#include <f32file.h>
+#include <eikmenub.h>
+#include <coeutils.h>
+#include <aknlists.h>
+#include <aknViewAppUi.h>
+#include <AknQueryDialog.h>
+#include <StringLoader.h>
+#include <aknnavilabel.h>
+#include <aknnavide.h>
+#include <akntitle.h>
+#include <textresolver.h>
+#include <aknnotewrappers.h>
+#include <aknnavi.h>
+#include <hlplch.h>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <sendui.h>
+#include <cmessagedata.h>
+#include <centralrepository.h>
+#include <mprofileengine.h>
+#include <akndlgshut.h>
+#ifdef RD_MULTIPLE_DRIVE
+#include <driveinfo.h>
+#endif //RD_MULTIPLE_DRIVE
+
+#include <upnpcopycommand.h>
+#include <AiwServiceHandler.h>  //Copy to remote feature
+
+#include <mediarecognizer.h>
+#include <featmgr.h>
+#include <aknmediatorfacade.h>
+#include <MediatorCommandInitiator.h>
+#include <mediatordomainuids.h>
+
+#include <mplayersecondarydisplayapi.h>
+#include <data_caging_path_literals.hrh>
+#include <layoutmetadata.cdl.h>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxviewutility.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpxcollectionviewhg.rsg>
+#include <mpxcollectionviewhg.mbg>
+#include <mpxcommonui.rsg>
+#include <mpxcollectionutility.h>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxmedia.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediaarray.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxviewpluginmanager.h>
+#include <mpxviewplugin.h>
+#include <mpxbacksteppingutility.h>
+#include <mpxcollectionopenutility.h>
+
+#include <mpxfindinmusicshop.h>
+#include <mpxfindinmusicshopcommon.h>  // KFindInMShopKeyInValid
+#include <MusicWapCenRepKeys.h>
+
+// cenrep key need to be checked whether USB cable is connected in MTP/Combined Mode
+#include <UsbWatcherInternalPSKeys.h>
+#include <usbpersonalityids.h>
+#include <mpxappui.hrh>
+#include <mpxinternalcrkeys.h>
+#include <mpxtlshelper.h>
+#include <mpxuser.h>
+#include "mpxcollectionviewhglistboxarray.h"
+#include "mpxcommoncontainer.hrh"
+#include "mpxcommonuihelper.h"
+#include "mpxcollectionviewhgcontainer.h"
+#include "mpxcollectionviewhg.hrh"
+#include "mpxcollectionviewhg.hlp.hrh"
+#include "mpxcollectionviewhgimp.h"
+#include "mpxviewprivatepskeys.h"
+#include "mpxlog.h"
+
+
+// CONSTANTS
+_LIT( KMPXCollectionRscPath, "mpxcollectionviewhg.rsc" );
+
+const TInt KMilliSecondsToSeconds( 1000 );
+const TInt KMPXReorderNaviPaneGranularity( 2 );
+const TInt KMPXMaxBufferLength( 160 );
+const TInt KMPXMaxTimeLength( 36 );
+const TInt KMPXDurationDisplayResvLen( 10 );
+const TInt KMPXPlaylistExportRetry( 10 );
+const TInt KMPXDirectionUp( -1 );
+const TInt KMPXDirectionDown( 1 );
+const TInt KMPXErrDataNotReady( -8000 );
+const TInt KMPXErrDataNotReadyCacheCommand( -8001 );
+const TInt KMPXArrayGranularity( 100 );
+const TInt KMusicCollectionMenuLevel( 2 );
+
+_LIT( KMPXCollDetailsItemsFormat, "%S\t%S" );
+
+_LIT( KCategoryEmpty, "" );
+
+const TInt KIncrementalDelayNone = 0;
+const TInt KIncrementalDelayHalfSecond = 1000000;
+const TInt KIncrementalFetchBlockSize = 400;
+const TInt KIncrementalDirectionCount = 8;
+const TInt KProgressBarMaxValue = 100;  // Max Value for the Progress Info bar
+const TInt KWaitNoteImpUid = 0x101FFC6C; // refresh wait note UID
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+const TInt KMusicMenuPodcastMenuItemIndex = 4; // podcast menu item index
+#define KPodcastCollectionUid 0x101FFC3C
+#endif
+
+const TInt KMaxIntLen( 10 );
+_LIT8( KMVPrefix, "MVviewID:" );
+const TInt KMVPrefixLen( 9 );
+
+// Music setting
+const TUid KCRUidMPXMPSettings = {0x101FFCDC};
+const TUint32 KMPXMusicStoreUID = 0x00000003;
+const TUint32 KOperatorMusicStore = 0x00000004;
+const TUint32 KOperatorMusicStoreType = 0x00000005;
+const TUint32 KOperatorMusicStoreDisplayName = 0x00000006;
+const TUint32 KOperatorMusicStoreNativeUid = 0x00000007;
+const TUint32 KOperatorMusicStoreJavaName = 0x00000008;
+const TUint32 KOperatorMusicStoreWebPage = 0x00000009;
+const TUint32 KOperatorMusicStoreURI = 0x0000000A;
+
+
+const TInt KJavaMusicShopType( 1 );
+const TInt KUIDMaxLength = 8;
+const TInt KMPXMaxHistoryLength( 255 );
+
+#define KProgressDownloadUid  0x10207BCD
+
+// Music collection browse type
+const TInt KMPXCollectionArtistAlbum( 3 );
+const TInt KMPXCollectionGenre( 5 );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewHgImp* CMPXCollectionViewHgImp::NewL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::NewL" );
+    CMPXCollectionViewHgImp* self = CMPXCollectionViewHgImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewHgImp* CMPXCollectionViewHgImp::NewLC()
+    {
+    CMPXCollectionViewHgImp* self = new ( ELeave ) CMPXCollectionViewHgImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewHgImp::~CMPXCollectionViewHgImp()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::~CMPXCollectionViewHgImp" );
+
+    if ( iCoverDisplay )
+        {
+        delete iCommandInitiator;
+        }
+
+    // Cleanup observer, does not panic if not found
+    //
+    AppUi()->RemoveViewDeactivationObserver( this );
+
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+
+    if ( iPlaybackUtility )
+        {
+        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+        iPlaybackUtility->Close();
+        }
+
+    if ( iViewUtility )
+        {
+        iViewUtility->RemoveObserver( this );
+        iViewUtility->Close();
+        }
+
+    if ( iCollectionUiHelper )
+        {
+        iCollectionUiHelper->Close();
+        }
+
+    if ( iCollectionHelper )
+        {
+        iCollectionHelper->Close();
+        }
+
+    if ( iProfileEngine )
+        {
+        iProfileEngine->Release();
+        }
+
+    if ( iUpnpFrameworkSupport )
+        {
+        MPX_DEBUG1(_L("CMPXCollectionViewHgImp::~CMPXCollectionViewHgImp Detaching 'Copy to external' menu service..."));
+        if ( iServiceHandler )
+            {
+            iServiceHandler->DetachMenu( R_MPX_COLLECTION_VIEW_MENU_1,
+                                     R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST );
+        iServiceHandler->DetachMenu( R_MPX_USE_AS_CASCADE,
+                                 R_MPX_AIW_ASSIGN_INTEREST );
+            delete iServiceHandler;
+            iServiceHandler = NULL;
+            }
+        iPlayersList.Close();
+        delete iSubPlayerName;
+        }
+    if ( iUpnpCopyCommand )
+        {
+        delete iUpnpCopyCommand;
+        }
+
+    if ( iServiceHandler )
+        {
+        iServiceHandler->DetachMenu( R_MPX_USE_AS_CASCADE,
+                                 R_MPX_AIW_ASSIGN_INTEREST );
+        delete iServiceHandler;
+        }
+    if ( iMediaRecognizer )
+        {
+        delete iMediaRecognizer;
+        }
+
+    if( iBackSteppingUtility )
+        {
+        iBackSteppingUtility->Close();
+        }
+
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        }
+
+    delete iNaviDecorator;
+    delete iUserPlaylists;
+    delete iCommonUiHelper;
+    delete iSendUi;
+    delete iTitle;
+    delete iDuration;
+    delete iOriginalTitle;
+    delete iOriginalDuration;
+    delete iNewName;
+    delete iBottomIndex;
+    delete iCurrentCba;
+    delete iIncrementalOpenUtil;
+    delete iCachedSelectionIndex;
+    FeatureManager::UnInitializeLib();
+    delete iOperatorMusicStoreName ;
+    if ( iOperatorMusicStoreURI )
+        {
+        delete iOperatorMusicStoreURI;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewHgImp::CMPXCollectionViewHgImp() :
+    iLastDepth( 1 ), iPlayIndex( KErrNotFound ),
+    iSetMediaLCount( KErrNotFound ),
+    iCurrentHighlightedIndex( KErrNotFound ),
+    iCachedCommand( KErrNotFound ),
+    iNoteType( EMPXNoteNotDefined ),
+	iFirstIncrementalBatch( ETrue )
+	{
+    MPX_FUNC( "CMPXCollectionViewHgImp::CMPXCollectionViewHgImp" );
+    iUsingNokiaService = EFalse;
+#ifdef __ENABLE_MSK
+    iCurrentMskId = KErrNotFound;
+    iShowContextMenu = EFalse;
+    iCollectionCacheReady = ETrue;
+#endif // __ENABLE_MSK
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+    iPodcast = EFalse;
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+    iInAlbumArtDialog = EFalse;
+
+    iMarkedAll = EFalse;
+    // grab the current process priority
+    RProcess proc;
+    iPriority = proc.Priority();
+    }
+
+void CMPXCollectionViewHgImp::HandleStatusPaneSizeChange()
+    {
+	MPX_FUNC( "CMPXCollectionViewHgImp::HandleStatusPaneSizeChange" );
+	CMPXCollectionViewHg::HandleStatusPaneSizeChange();
+	if ( iContainer )
+        {
+		iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::ConstructL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::ConstructL" );
+
+// initialize FeatureManager
+    FeatureManager::InitializeLibL();
+
+    if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
+        {
+        iCoverDisplay = ETrue;
+        iCommandInitiator = CMediatorCommandInitiator::NewL( NULL );
+        }
+    else
+        {
+        iCoverDisplay = EFalse;
+        }
+
+
+    CCoeEnv* coeEnv( iEikonEnv );
+    TParse parse;
+    parse.Set( KMPXCollectionRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    BaseConstructL( R_MPX_COLLECTION_VIEW );
+
+    iIsEmbedded = iEikonEnv->StartedAsServerApp();
+
+    // create a new collection utility bound to the default context.
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+    iPlaybackUtility->AddObserverL( *this );
+    iViewUtility = MMPXViewUtility::UtilityL();
+    iViewUtility->AddObserverL( this );
+    iBottomIndex = new (ELeave) CArrayFixFlat<TInt>( 1 );
+
+    iCommonUiHelper = CMPXCommonUiHelper::NewL( iCollectionUtility );
+    iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+
+    // Monitor for view activation
+    AppUi()->AddViewActivationObserverL( this );
+
+    if (!iUpnpCopyCommand )
+        {
+        MPX_TRAPD ( error, iUpnpCopyCommand = CUpnpCopyCommand::NewL() );
+		    if ( error == KErrNone )
+            {
+            iUpnpFrameworkSupport = ETrue;
+            iServiceHandler = CAiwServiceHandler::NewL();
+            MPX_DEBUG1("CMPXCollectionViewHgImp::ConstructL() Attaching 'Copy to external' menu service...");
+            MPX_TRAP( iErrorAttachCopyMenu, iServiceHandler->AttachMenuL( R_MPX_COLLECTION_VIEW_MENU_1,
+                                                   R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST ) );
+            if ( iErrorAttachCopyMenu == KErrNotSupported )
+                {
+                // when CCoeEnv is not available
+                User::Leave( iErrorAttachCopyMenu );
+                }
+            MPX_DEBUG2( "CMPXCollectionViewHgImp::ConstructL(): attach Copy menu error: %d", iErrorAttachCopyMenu );
+            }
+        else
+            {
+            iUpnpFrameworkSupport = EFalse;
+            iUpnpCopyCommand = NULL;
+            }
+        }
+    iMediaRecognizer = CMediaRecognizer::NewL();
+    if ( iServiceHandler == NULL)
+        {
+        iServiceHandler = CAiwServiceHandler::NewL();
+        }
+    MPX_DEBUG1("CMPXCollectionViewHgImp::ConstructL() Attaching 'use tone as' menu service...");
+    MPX_TRAP( iErrorAttachAssignMenu, iServiceHandler->AttachMenuL( R_MPX_USE_AS_CASCADE,
+                                               R_MPX_AIW_ASSIGN_INTEREST ) );
+
+    iNaviPane =
+        static_cast<CAknNavigationControlContainer*>
+        ( iAvkonViewAppUi->StatusPane()->ControlL(
+            TUid::Uid( EEikStatusPaneUidNavi ) ) );
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL( KNullDesC );
+    //Create label to change text in Navi pane
+    iNaviLabel = static_cast<CAknNaviLabel*>
+            ( iNaviDecorator->DecoratedControl() );
+
+    TInt flags( 0 );
+    CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
+    repository->Get( KMPXMPLocalVariation, flags );
+    delete repository;
+    iGoToMusicShopOptionHidden =
+        !static_cast<TBool>( flags & KMPXEnableGoToMusicShopOption );
+    iUsingNokiaService =
+        static_cast<TBool>( flags & KMPXEnableFindInMusicShopOption );
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::ConstructL(): iUsingNokiaService: %d", iUsingNokiaService );
+    iDisablePodcasting = flags&KMPXDisablePodcastingOption ? ETrue : EFalse;
+
+#ifdef _DEBUG
+    iExitOptionHidden = EFalse;
+#else // _DEBUG
+    iExitOptionHidden = iCommonUiHelper->ExitOptionHiddenL() && !iIsEmbedded;
+#endif // _DEBUG
+
+    iBottomIndex->AppendL( 0 );
+    iProfileEngine = CreateProfileEngineL();
+
+    _LIT_SECURITY_POLICY_C1(KMPlayerRemoteReadPolicy, ECapabilityReadUserData);
+    _LIT_SECURITY_POLICY_C1(KMPlayerRemoteWritePolicy, ECapabilityWriteUserData);
+
+    if (iGoToMusicShopOptionHidden)
+        {
+        iMusicStoreUID = 0;
+        }
+    else
+        {
+        // Get music store uid from cenrep
+        //
+        TBuf8< KUIDMaxLength > musicStoreUID;
+        TRAP_IGNORE(
+            {
+            CRepository* repository = CRepository::NewL( KCRUidMPXMPSettings );
+            repository->Get( KMPXMusicStoreUID, musicStoreUID );
+            delete repository;
+            repository = NULL;
+            } );
+
+        GetUint32Presentation( iMusicStoreUID, musicStoreUID, 0 );
+        if (iMusicStoreUID == 0)
+            {
+            iGoToMusicShopOptionHidden = ETrue;
+            }
+        }
+    MPX_DEBUG2("CMPXCollectionViewHgImp::ConstructL musicStoreUID = %x", iMusicStoreUID);
+
+    TInt retval(KErrNone);
+    // P/S key for music shop
+    retval = RProperty::Define( TUid::Uid(iMusicStoreUID),
+                                KMShopCategoryId,
+                                RProperty::EInt,
+                                KMPlayerRemoteReadPolicy,
+                                KMPlayerRemoteWritePolicy );
+
+    if( retval != KErrAlreadyExists)
+        {
+        RProperty::Set( TUid::Uid(iMusicStoreUID),
+                        KMShopCategoryId,
+                        KFindInMShopKeyInValid );  // initialize Find In Musicshop was not called
+
+
+        RProperty::Define(  TUid::Uid(iMusicStoreUID),
+                            KMShopCategoryName,
+                            RProperty::ELargeText,
+                            KMPlayerRemoteReadPolicy,
+                            KMPlayerRemoteWritePolicy );
+        }
+
+    iCachedSelectionIndex = new ( ELeave )CArrayFixFlat<TInt>( KMPXArrayGranularity );
+    iIncrementalOpenUtil = CMPXCollectionOpenUtility::NewL( this );
+
+    // Initialize the Back Stepping Service Utility with the MPX Music Player
+    iBackSteppingUtility = MMPXBackSteppingUtility::UtilityL();
+    iBackSteppingUtility->InitializeL(
+        TUid::Uid( KMusicPlayerAppUidConstant ) );
+    iActivateBackStepping = EFalse;
+
+    iIsAddingToPlaylist = EFalse;
+
+       // Get music store information from cenrep
+   //
+   TBuf8< KUIDMaxLength > operatorMusicStoreUID;
+
+   iOperatorMusicStoreName = HBufC16::NewL( KMPXMaxHistoryLength );
+   TPtr operatorMusicStoreMenuOption = iOperatorMusicStoreName->Des();
+
+   HBufC16* musicStoreJavaName = HBufC16::NewLC( KMPXMaxHistoryLength );
+   TPtr operatorMusicStoreJavaName = musicStoreJavaName->Des();
+
+   TRAP_IGNORE(
+    {
+    CRepository* musicshoprepository = CRepository::NewL( KCRUidMPXMPSettings );
+    musicshoprepository->Get( KOperatorMusicStore, iOperatorMusicStore );
+    if(iOperatorMusicStore)
+        {
+        musicshoprepository->Get( KOperatorMusicStoreType, iOperatorMusicStoreType );
+        musicshoprepository->Get( KOperatorMusicStoreDisplayName, operatorMusicStoreMenuOption );
+        if (iOperatorMusicStoreType == KJavaMusicShopType)
+            {
+            musicshoprepository->Get( KOperatorMusicStoreJavaName, operatorMusicStoreJavaName );
+            }
+        else
+            {
+            musicshoprepository->Get( KOperatorMusicStoreNativeUid, operatorMusicStoreUID );
+            GetUint32Presentation( iOperatorNativeMusicStoreUID, operatorMusicStoreUID, 0 );
+
+            musicshoprepository->Get(KOperatorMusicStoreWebPage, iMusicStoreWebPage);
+            iOperatorMusicStoreURI = HBufC16::NewL( KMPXMaxHistoryLength );
+            TPtr16 operatorMusicStoreuri = iOperatorMusicStoreURI->Des();
+            musicshoprepository->Get(KOperatorMusicStoreURI, operatorMusicStoreuri);
+
+            }
+        }
+    delete musicshoprepository;
+    musicshoprepository = NULL;
+    } );
+
+    if(iOperatorMusicStoreType == KJavaMusicShopType)
+        {
+            TApaAppInfo appInfo;
+            RApaLsSession apaSession;
+            User::LeaveIfError( apaSession.Connect() );
+            CleanupClosePushL( apaSession );
+            User::LeaveIfError( apaSession.GetAllApps() );
+
+            while ( apaSession.GetNextApp( appInfo ) == KErrNone )
+                {
+                if(appInfo.iFullName.Right(8).Compare(_L(".fakeapp")) == 0)
+                    {
+                    TApaAppCaption appname;
+                    appname = appInfo.iCaption ;
+                    if (!appInfo.iCaption.Compare(operatorMusicStoreJavaName))
+                        {
+                        iOperatorMusicStoreUID = appInfo.iUid;
+                        }
+                    }
+                }
+            CleanupStack::PopAndDestroy(&apaSession); // close apaSession
+        }
+    //else
+    //    {
+    //    GetUint32Presentation( iMusicStoreUID, operatorMusicStoreUID, 0 );
+    //    }
+    CleanupStack::PopAndDestroy(musicStoreJavaName);
+
+    TInt retval2(KErrNone);
+    // P/S key for usb unblocking
+    retval2 = RProperty::Define( KMPXViewPSUid,
+                                KMPXUSBUnblockingPSStatus,
+                                RProperty::EInt,
+                                KMPlayerRemoteReadPolicy,
+                                KMPlayerRemoteWritePolicy );
+
+    TInt usbStatus;
+    RProperty::Get(KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, usbStatus);
+
+
+    // if object doesn't exist or the usb doesn't connect
+    if(( retval2 != KErrAlreadyExists )
+            || ( usbStatus != KUsbPersonalityIdPCSuite
+                    || usbStatus != KUsbPersonalityIdMS
+                    || usbStatus != KUsbPersonalityIdPTP
+                    || usbStatus != KUsbPersonalityIdMTP
+                    || usbStatus != KUsbPersonalityIdPCSuiteMTP ))
+        {
+        RProperty::Set( KMPXViewPSUid,
+                        KMPXUSBUnblockingPSStatus,
+                        EMPXUSBUnblockingPSStatusUninitialized );
+        }
+    // if usb mode is in MTP mode or pc suite mode
+    else if ( usbStatus == KUsbPersonalityIdMTP
+    		|| usbStatus == KUsbPersonalityIdPCSuiteMTP
+    		|| usbStatus == KUsbPersonalityIdPCSuite )
+    	{
+    	RProperty::Set( KMPXViewPSUid,
+    			KMPXUSBUnblockingPSStatus,
+    			EMPXUSBUnblockingPSStatusActive );
+    	}
+    }
+
+// ---------------------------------------------------------------------------
+// Delete the selected items
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DeleteSelectedItemsL(TInt aCommand)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DeleteSelectedItemsL" );
+
+    // if reorder mode is on, or something is currently deleting, disable delete
+    TBool isIgnore( iContainer->IsInReorderMode() || iIsDeleting );
+
+    CMPXCommonListBoxArrayBase* listboxArray(
+        iContainer->ListBoxArray() );
+    const CMPXMedia& containerMedia( listboxArray->ContainerMedia() );
+    TInt currentIndex( iContainer->CurrentLbxItemIndex() );
+
+    // Marked indicies
+    // cannot use the caches indexes since this can be reached by pressing the cancel key
+    const CArrayFix<TInt>* array (
+        iContainer->CurrentSelectionIndicesL() ); // not owned
+    TInt arrayCount( array->Count() );
+
+    if ( !isIgnore )
+        {
+        if ( iContainer->CurrentListItemCount() == 0 )
+            {
+            // list is empty
+            isIgnore = ETrue;
+            }
+        if ( !isIgnore &&
+            containerMedia.IsSupported( KMPXMediaGeneralNonPermissibleActions ) )
+            {
+            TMPXGeneralNonPermissibleActions attr(
+                containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                KMPXMediaGeneralNonPermissibleActions ) );
+            if ( attr & EMPXWrite )
+                {
+                isIgnore = ETrue;
+                }
+            }
+        if ( !isIgnore )
+            {
+            const CMPXMedia& media( listboxArray->MediaL( currentIndex ) );
+            if ( ( arrayCount == 0 || arrayCount == 1 ) &&
+                ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId ) )
+                {
+                // not marked, or only 1 item is marked
+                // and the highlighted item is not yet available
+                isIgnore = ETrue;
+                }
+            else if ( media.IsSupported( KMPXMediaGeneralNonPermissibleActions ) )
+                {
+                TMPXGeneralNonPermissibleActions attr(
+                    media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                        KMPXMediaGeneralNonPermissibleActions ) );
+                if ( attr & EMPXWrite )
+                    {
+                    isIgnore = ETrue;
+                    }
+                }
+            }
+        }
+
+    if ( !isIgnore )
+        {
+        // Create a copy of collection path
+        CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
+        CleanupStack::PushL( path );
+        HBufC* promptTxt( NULL );
+        HBufC* waitNoteText( NULL );
+        TInt waitNoteCBA( R_AVKON_SOFTKEYS_EMPTY );
+        MPX_DEBUG2( "CMPXCollectionViewHgImp::DeleteSelectedItemsL delete array count = %d", arrayCount );
+
+        TMPXGeneralType containerType(
+            containerMedia.ValueTObjectL<TMPXGeneralType>(
+                KMPXMediaGeneralType ) );
+        TMPXGeneralCategory containerCategory(
+            containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory ) );
+
+        if ( arrayCount > 1 )
+            {
+            if ( containerType == EMPXItem && containerCategory == EMPXPlaylist )
+                {
+                // playlist view
+                waitNoteText = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_NOTE_REMOVING_MANY );
+                promptTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_QUERY_CONF_REMOVE_MANY,
+                    arrayCount );
+                }
+            else
+                {
+                waitNoteText = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_DEL_SONGS_WAIT_NOTE );
+                promptTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_DEL_SONGS_QUERY,
+                    arrayCount );
+                }
+            waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP;
+            iConfirmationDlg = CAknQueryDialog::NewL(
+                CAknQueryDialog::EConfirmationTone );
+            if ( iCoverDisplay )
+                {
+                if ( containerType == EMPXItem && containerCategory == EMPXPlaylist )
+                    {
+                    iConfirmationDlg->PublishDialogL(
+                        EMPlayerQueryRemoveTracks,
+                        KMPlayerNoteCategory);
+                    iWaitNoteId = EMPlayerNoteRemovingMany;
+                    }
+                else
+                    {
+                    iConfirmationDlg->PublishDialogL(
+                        EMPlayerQueryDeleteTracks,
+                        KMPlayerNoteCategory);
+                    iWaitNoteId = EMPlayerNoteDeletingMany;
+                    }
+                CAknMediatorFacade* covercl(
+                    AknMediatorFacade( iConfirmationDlg ) );
+                if ( covercl )
+                    {
+                    covercl->BufStream().WriteInt32L( arrayCount );
+                    }
+                }
+            if(iCollectionReady || aCommand == EMPXCmdCommonDelete )
+                {
+            for ( TInt i = 0; i < arrayCount; i++ )
+                {
+                MPX_DEBUG2( "CMPXCollectionViewHgImp::DeleteSelectedItemsL delete array index = %d", array->At( i ) );
+                path->SelectL( array->At(i) );
+                    }
+                }
+            }
+        else
+            {
+            // not marked, process the highlighted item
+            const CMPXMedia& media( listboxArray->MediaL(
+                ( arrayCount > 0 ) ? array->At( 0 ) : currentIndex ) );
+            const TDesC& title( media.ValueText( KMPXMediaGeneralTitle ) );
+
+            TMPXGeneralType type(
+                media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+            TMPXGeneralCategory category(
+                media.ValueTObjectL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory ) );
+
+            if ( containerType == EMPXItem && containerCategory == EMPXPlaylist )
+                {
+                // playlist view
+                waitNoteText = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_NOTE_REMOVING_TRACK, title );
+                promptTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_QUERY_CONF_REMOVE_TRACK,
+                    title );
+                }
+            else if ( containerType == EMPXItem && containerCategory == EMPXArtist
+                && type == EMPXItem && category == EMPXAlbum && currentIndex == 0 )
+                {
+                // deleting first entry in artist/album view
+                const TDesC& containerTitle(
+                    containerMedia.ValueText( KMPXMediaGeneralTitle ) );
+                waitNoteText = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_QUERY_CONF_DELETE_ALL, containerTitle );
+                waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP;
+                promptTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_QUERY_CONF_DELETE_GROUP,
+                    containerTitle );
+                }
+            else
+                {
+                if ( ( type == EMPXItem && category == EMPXSong ) ||
+                    ( type == EMPXItem && category == EMPXPlaylist ) )
+                    {
+                    // tracks level, or deleting a playlist
+                    waitNoteText = StringLoader::LoadLC(
+                        R_MPX_QTN_ALBUM_WAITING_DELETING, title );
+                    promptTxt = StringLoader::LoadLC(
+                        R_MPX_QTN_QUERY_COMMON_CONF_DELETE,
+                        title );
+                    }
+                else
+                    {
+                    // deleting a group
+                    if ( ( currentIndex == ( iContainer->CurrentListItemCount() - 1 ) ) &&
+                        title.Compare( KNullDesC ) == 0 )
+                        {
+                        // check for unknown entry
+                        // if it's the last entry, and it's null text
+                        // load "unknown" text to display in prompt
+                        HBufC* unknownText( StringLoader::LoadLC( R_MPX_QTN_MP_UNKNOWN ) );
+                        waitNoteText = StringLoader::LoadLC(
+                            R_MPX_QTN_MUS_QUERY_CONF_DELETE_ALL, *unknownText );
+                        promptTxt = StringLoader::LoadL(
+                            R_MPX_QTN_NMP_QUERY_CONF_DELETE_GROUP, *unknownText );
+                        CleanupStack::Pop( waitNoteText );
+                        CleanupStack::PopAndDestroy( unknownText );
+                        CleanupStack::PushL( waitNoteText );
+                        CleanupStack::PushL( promptTxt );
+                        }
+                    else
+                        {
+                        waitNoteText = StringLoader::LoadLC(
+                            R_MPX_QTN_MUS_QUERY_CONF_DELETE_ALL, title );
+                        promptTxt = StringLoader::LoadLC(
+                            R_MPX_QTN_NMP_QUERY_CONF_DELETE_GROUP, title );
+                        }
+                    waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP;
+                    }
+                }
+            iConfirmationDlg = CAknQueryDialog::NewL(
+                CAknQueryDialog::EConfirmationTone );
+            if ( iCoverDisplay )
+                {
+                if ( containerType == EMPXItem && containerCategory == EMPXPlaylist )
+                    {
+                    iConfirmationDlg->PublishDialogL(
+                        EMPlayerQueryRemoveTrack,
+                        KMPlayerNoteCategory);
+                    iWaitNoteId = EMPlayerNoteRemovingTrack;
+                    }
+                else if ( containerType == EMPXItem && containerCategory == EMPXArtist
+                    && type == EMPXItem && category == EMPXAlbum && currentIndex == 0 )
+                    {
+                    iConfirmationDlg->PublishDialogL(
+                        EMPlayerQueryDeleteCategory,
+                        KMPlayerNoteCategory);
+                    iWaitNoteId = EMPlayerNoteDeletingSingle;
+                    }
+                else
+                    {
+                    if ( ( type == EMPXItem && category == EMPXSong ) ||
+                        ( type == EMPXItem && category == EMPXPlaylist ) )
+                        {
+                        // tracks level
+                        iConfirmationDlg->PublishDialogL(
+                            EMPlayerQueryDeleteCategory,
+                            KMPlayerNoteCategory);
+                        iWaitNoteId = EMPlayerNoteDeletingSingle;
+                        }
+                    else
+                        {
+                        iConfirmationDlg->PublishDialogL(
+                            EMPlayerQueryDeleteTrack,
+                            KMPlayerNoteCategory);
+                        iWaitNoteId = EMPlayerNoteDeletingSingle;
+                        }
+                    }
+                CAknMediatorFacade* covercl(
+                    AknMediatorFacade( iConfirmationDlg ) );
+                if ( covercl )
+                    {
+                    covercl->BufStream() << title;
+                    }
+                iItemTitle.Set( title );
+                }
+//#endif //__COVER_DISPLAY
+// Cover UI end
+            if(iCollectionReady || aCommand == EMPXCmdCommonDelete )
+                {
+            path->SelectL( arrayCount > 0 ? array->At( 0 ) : currentIndex );
+                }
+            }
+        iConfirmationDlg->SetPromptL( *promptTxt );
+        CleanupStack::PopAndDestroy( promptTxt );
+        TBool performDelete(EFalse);
+        if(iCachedCommand == aCommand)
+            {
+            performDelete = ETrue;
+            }
+        if (!performDelete)
+            {
+        if ( iConfirmationDlg->ExecuteLD( R_MPX_CUI_DELETE_CONFIRMATION_QUERY ) )
+                {
+                performDelete = ETrue;
+                }
+            }
+        if (performDelete)
+            {
+            HandleCommandL( EMPXCmdIgnoreExternalCommand );
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+        if ( iCoverDisplay )
+            {
+            InitiateWaitDialogL();
+            }
+//#endif // __COVER_DISPLAY
+// Cover UI end
+            MPX_PERF_START_EX( MPX_PERF_SHOW_WAITNOTE );
+            if(iCachedCommand != aCommand)
+                {
+                iIsWaitNoteCanceled = EFalse;
+                StartProgressNoteL();
+				TPtr buf = waitNoteText->Des();
+				UpdateProcessL(0, buf);
+                }
+
+                if ( !iIsWaitNoteCanceled )
+                    {
+                    iIsDeleting = ETrue;
+                    iCollectionUiHelper->DeleteL( *path, this );
+                    }
+                else if( iContainer )
+                    {
+                    // delete was canceled before it even began, clear marked items
+                    iContainer->ClearLbxSelection();
+                    }
+                iIsWaitNoteCanceled = EFalse;
+
+
+            if(iContainer->FindBoxVisibility())
+                {
+                iContainer->EnableFindBox(EFalse);
+                }
+            }
+        iConfirmationDlg = NULL;
+        CleanupStack::PopAndDestroy( waitNoteText );
+        CleanupStack::PopAndDestroy( path );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Initiates wait dialog
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::InitiateWaitDialogL()
+    {
+    if ( iCommandInitiator )
+        {
+        HBufC8* filename8 = HBufC8::NewLC( KMaxFileName );
+        filename8->Des().Copy( iItemTitle );
+        HBufC8* data = HBufC8::NewLC(KMaxFileName);
+
+        TPtr8 dataPtr = data->Des();
+        RDesWriteStream str(dataPtr);
+
+        TPtrC8 b(KNullDesC8);
+        b.Set(*filename8);
+
+        str << b;
+        str.CommitL();
+
+        iCommandInitiator->IssueCommand( KMediatorSecondaryDisplayDomain,
+                                    KMPlayerNoteCategory,
+                                    iWaitNoteId,
+                                    TVersion ( 0,0,0 ),
+                                    *data );
+
+        CleanupStack::PopAndDestroy( data );
+        CleanupStack::PopAndDestroy( filename8 );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates list box
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::UpdateListBoxL(
+    const CMPXMedia& aEntries,
+    TInt aIndex,
+    TBool aComplete)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::UpdateListBox" );
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::UpdateListBox aIndex = %d", aIndex );
+    if ( iContainer )
+        {
+        CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+        MPX_DEBUG_PATH(*cpath);
+
+        CleanupStack::PushL( cpath );
+
+        TInt topIndex = 0;
+        if (iContainer->IsInReorderMode())
+            {
+            TInt currentItem( iContainer->CurrentLbxItemIndex() );
+            TInt currentBottomIndex( iContainer->BottomLbxItemIndex() );
+            topIndex = iContainer->CalculateTopIndex( currentBottomIndex ) ;
+            }
+
+        CMPXCommonListBoxArrayBase* array( iContainer->ListBoxArray() );
+        array->ResetMediaArrayL();
+        array->AppendMediaL( aEntries );
+        iCollectionCacheReady = ETrue;
+        //keep the marked item indicies
+        const CArrayFix<TInt>* markedList = iContainer->CurrentSelectionIndicesL();
+		if ( iFirstIncrementalBatch )
+            {
+            iContainer->HandleLbxItemAdditionL();
+            iFirstIncrementalBatch = EFalse;
+            }
+		else
+			{
+			iContainer->HandleListBoxArrayEventL(
+			MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventMediaArrayChange );
+			}
+
+        if (aComplete)
+            {
+            iFirstIncrementalBatch = ETrue;
+            }
+        //mark all again after list box item addition
+        if (iMarkedAll)
+            {
+            iContainer->HandleMarkableListProcessCommandL(EAknMarkAll);
+            if (aComplete)
+                {
+                iMarkedAll = EFalse;
+                }
+            }
+		   //mark again individual items after list box item addition
+        else if ( markedList )
+            {
+		       TInt markedItemCount( markedList->Count() );
+		       if ( markedItemCount >0 )
+                {
+                iContainer->SetCurrentSelectionIndicesL( const_cast<CArrayFix<TInt>*>(markedList) );
+                }
+            }
+        UpdatePlaybackStatusL();
+
+        if ( iBackOneLevel || iPossibleJump )
+            {
+            if ( cpath->Levels() == iLastDepth )
+                {
+                iLastDepth--;
+                iContainer->SetLbxTopItemIndex(
+                    iContainer->CalculateTopIndex(
+                    iBottomIndex->At( iLastDepth ) ) );
+                iContainer->SetLbxCurrentItemIndexAndDraw( aIndex );
+                iBottomIndex->Delete( iLastDepth );
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXCollectionViewHgImp::UpdateListBox Invalid history, rebuilding" );
+                // invalid path, rebuild with all 0. possibily caused by a jump in views
+                iBottomIndex->Reset();
+                iLastDepth = cpath->Levels();
+                for ( TInt i = 0; i < iLastDepth; i++ )
+                    {
+                    iBottomIndex->AppendL( 0 );
+                    }
+                iContainer->SetLbxCurrentItemIndexAndDraw( aIndex );
+                }
+            iPossibleJump = EFalse;
+            iBackOneLevel = EFalse;
+            }
+        else
+            {
+            if ( iAddingSong )
+                {
+                // always highlight the last item when a track
+                // is added in add tracks view
+                TInt currentItemCount =
+                    iContainer->CurrentListItemCount();
+                if ( currentItemCount > 0 )
+                    {
+                    iContainer->
+                        SetLbxCurrentItemIndexAndDraw( currentItemCount - 1 );
+                    }
+                }
+            else if ( iCurrentHighlightedIndex > KErrNotFound &&
+                ( iCurrentHighlightedIndex <
+                iContainer->CurrentListItemCount() ) )
+                {
+                if (iContainer->IsInReorderMode())
+                    {
+                    iContainer->SetLbxTopItemIndex( topIndex );
+                    }
+                iContainer->
+                    SetLbxCurrentItemIndexAndDraw( iCurrentHighlightedIndex );
+                iCollectionUtility->Collection().CommandL(
+                    EMcCmdSelect, iCurrentHighlightedIndex );
+                iCurrentHighlightedIndex = KErrNotFound;
+                }
+            else if ( ( aIndex > 0 )
+                && ( aIndex < iContainer->CurrentListItemCount() ) )
+                {
+                iContainer->SetLbxCurrentItemIndexAndDraw( aIndex );
+                }
+            else
+                {
+                iContainer->SetLbxCurrentItemIndexAndDraw( 0 );
+                }
+            }
+        if (!aComplete || cpath->Levels() == KMusicCollectionMenuLevel || iContainer->IsInReorderMode())
+            {
+            iContainer->EnableFindBox(EFalse);
+            }
+        else
+            {
+            iContainer->EnableFindBox(ETrue);
+            }
+
+        CleanupStack::PopAndDestroy( cpath );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleError( TInt aError )
+    {
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleError(%d)", aError );
+    ASSERT( aError );
+
+    // only display error message if collection view is in the foreground
+    if ( iContainer )
+        {
+        TRAP_IGNORE( iCommonUiHelper->HandleErrorL( aError ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the navi pane
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::UpdateNaviPaneL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::UpdateNaviPaneL" );
+    if ( iContainer &&
+        (iViewUtility->ActiveViewType() !=
+                       TUid::Uid( KMPXPluginTypeAddSongsEditorUid )) &&
+        (iViewUtility->ActiveViewType() !=
+                      TUid::Uid( KMPXPluginTypeAlbumArtEditorUid )) &&
+        (iViewUtility->ActiveViewType() !=
+                      TUid::Uid( KMPXPluginTypeMetadataEditorUid ))
+       )
+        {
+        MPX_DEBUG2("CMPXCollectionViewHgImp::UpdateNaviPaneL updating %d", iDuration);
+        if ( iDuration )
+            {
+            iNaviLabel->SetTextL( *iDuration );
+            iNaviPane->PushL( *iNaviDecorator );
+            }
+        else
+            {
+            iNaviPane->Pop( iNaviDecorator );
+            }
+        iNaviPane->DrawNow();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the title pane
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::UpdateTitlePaneL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::UpdateTitlePaneL" );
+    // Set title
+
+    if ( iViewUtility->ActiveViewType() ==
+        TUid::Uid( KMPXPluginTypeCollectionUid ) ||
+        ( iViewUtility->ActiveViewType() ==
+         TUid::Uid( KMPXPluginTypeWaitNoteDialogUid ) && iContainer ) )
+        {
+        CAknTitlePane* title( NULL );
+
+        TRAP_IGNORE(
+            {
+            title = static_cast<CAknTitlePane*>
+                ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+            } );
+
+        if ( title )
+            {
+            if ( iTitle )
+                {
+                title->SetTextL( *iTitle );
+                }
+            else if ( !iIsEmbedded )
+                {
+                // use default title if no metadata is available
+                // and is not in embedded view
+                HBufC* titleText = StringLoader::LoadLC(
+                    R_MPX_COLLECTION_VIEW_TITLE );
+                title->SetTextL( *titleText );
+                CleanupStack::PopAndDestroy( titleText );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates playback status indicator
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewHgImp::UpdatePlaybackStatusL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::UpdatePlaybackStatusL" );
+    TInt ret( KErrNotFound );  // default selection
+    if ( iContainer )
+        {
+        TMPXPlaybackState pbState( EPbStateNotInitialised );
+        TInt selectedIndex( KErrNotFound );
+        TMPXItemId selectedItemId( KMPXInvalidItemId );
+        CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+        CleanupStack::PushL( cpath );
+
+        MMPXSource* source( iPlaybackUtility->Source() );
+        if ( source )
+            {
+            CMPXCollectionPlaylist* playlist( source->PlaylistL() );
+            if ( playlist )
+                {
+                CleanupStack::PushL( playlist );
+                CMPXCollectionPath* pbPath(
+                    CMPXCollectionPath::NewL( playlist->Path() ) );
+                CleanupStack::PushL( pbPath );
+                TInt playbackPathCount( pbPath->Levels() );
+                if ( cpath->Levels() == playbackPathCount )
+                    {
+                    // not comparing the index
+                    TBool isEqual( ETrue );
+                    for ( TInt i = 0; i < playbackPathCount - 1; i++ )
+                        {
+                        if ( cpath->Id( i ) != pbPath->Id( i ) )
+                            {
+                            isEqual = EFalse;
+                            break;
+                            }
+                        }
+                    if ( isEqual )
+                        {
+                        selectedIndex = pbPath->Index();
+                        selectedItemId = pbPath->Id();
+                        ret = selectedIndex;
+                        pbState = iPlaybackUtility->StateL();
+                        }
+                    }
+                CleanupStack::PopAndDestroy( pbPath );
+                CleanupStack::PopAndDestroy( playlist );
+                }
+            }
+        CleanupStack::PopAndDestroy( cpath );
+        if ( selectedIndex != KErrNotFound )
+            {
+            if ( iContainer->IsInReorderMode() )
+                {
+                // in reorder mode, need to pass unique ID to list box
+                // to search for now playing song
+                iContainer->SetPlaybackStatusByIdL( selectedItemId, pbState );
+                }
+            else
+                {
+                // Fixed for EBLI-7AG8ZN, the Playlist in the Engine is updated
+                // later than UI (because of Inc Open), so index does not work
+                iContainer->SetPlaybackStatusByIdL( selectedItemId, pbState, selectedIndex );
+                }
+            }
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Start a refreshing note
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::StartWaitNoteL( TWaitNoteType aNoteType )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::StartWaitNoteL" );
+    TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid );
+    TUid activeView = iViewUtility->ActiveViewType();
+    if( !iIsEmbedded && activeView != waitnoteId )
+        {
+        TPckg<TWaitNoteType> note = aNoteType;
+        HBufC* arg = MPXUser::AllocL( note );
+        CleanupStack::PushL( arg );
+        RProcess proc;
+        iPriority = proc.Priority();
+        proc.SetPriority( EPriorityHigh );
+        iNoteType = aNoteType;
+        iViewUtility->ActivateViewL( waitnoteId, arg );
+        CleanupStack::PopAndDestroy( arg );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Start a Progress note
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::StartProgressNoteL()
+    {
+    iProgressDialog = new (ELeave) CAknProgressDialog(
+        (REINTERPRET_CAST(CEikDialog**, &iProgressDialog)),
+        ETrue);
+    iProgressDialog->PrepareLC(R_MPX_PROGRESS_NOTE);
+    iProgressInfo = iProgressDialog->GetProgressInfoL();
+    iProgressDialog->SetCallback(this);
+    iProgressDialog->RunLD();
+    iProgressInfo->SetFinalValue(KProgressBarMaxValue);
+    }
+
+// ---------------------------------------------------------------------------
+// Update the Progress note
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::UpdateProcessL( TInt aProgress, const TDesC& aProgressText )
+    {
+    if ( iProgressDialog )
+        {
+        iProgressDialog->SetTextL(aProgressText);
+        iProgressInfo->SetAndDraw(aProgress);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Close waitnote dialog
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::CloseWaitNoteL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::CloseWaitNoteL" );
+    if( !iUSBOnGoing && !iIsEmbedded)
+        {
+        RProcess proc;
+        proc.SetPriority( iPriority );
+        // Fix for ESLU-7CFEPF, try to close the WaitNote even if it's not the current view
+        TRAP_IGNORE(
+            CMPXViewPlugin* pi =
+                iViewUtility->ViewPluginManager().PluginL( TUid::Uid(KWaitNoteImpUid) );
+            pi->DeactivateView();
+            );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Change the navi pane
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::UpdateReorderNaviPaneL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::UpdateReorderNaviPaneL" );
+    delete iDuration;
+    iDuration = NULL;
+
+    // Set playlist counter text to pos/size by default
+    CArrayFixFlat<TInt>* params =
+        new ( ELeave ) CArrayFixFlat<TInt>( KMPXReorderNaviPaneGranularity );
+    CleanupStack::PushL( params );
+    // Position of selection in index
+    params->AppendL( iContainer->CurrentLbxItemIndex() + 1 );
+    // Total Number of items in lbx
+    params->AppendL( iContainer->TotalListItemCount() );
+    iDuration = StringLoader::LoadL(
+        R_MPX_CUI_POSITION_COUNTER_TXT, *params );
+    CleanupStack::PopAndDestroy( params );
+    UpdateNaviPaneL();
+    }
+
+// ---------------------------------------------------------------------------
+// Activates reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::ActivateReorderGrabbedModeL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::ActivateReorderGrabbedModeL" );
+    iIsGrabbed = ETrue;
+    TInt currentItem( iContainer->CurrentLbxItemIndex() );
+    iContainer->EnableFindBox( EFalse );
+    iContainer->SetReorderGrabbedMode( ETrue, currentItem );
+    if ( !iContainer->IsInReorderMode() )
+        {
+        iContainer->UpdateReorderTitleIconL();
+
+        if ( iTitle )
+            {
+            delete iOriginalTitle;
+            iOriginalTitle = NULL;
+            iOriginalTitle = iTitle->AllocL();
+            delete iTitle;
+            iTitle = NULL;
+            }
+        iTitle = StringLoader::LoadL( R_QTN_NMP_TITLE_REORDER_LIST );
+        UpdateTitlePaneL();
+
+        if ( iDuration )
+            {
+            delete iOriginalDuration;
+            iOriginalDuration = NULL;
+            iOriginalDuration = iDuration->AllocL();
+            delete iDuration;
+            iDuration = NULL;
+            }
+        iContainer->ActivateReorderMode( ETrue );
+        SetNewCbaL( R_MPX_CUI_REORDER_DROP_CANCEL_CBA );
+        }
+    iContainer->SetLbxCurrentItemIndexAndDraw( currentItem );
+    UpdateReorderNaviPaneL();
+    }
+
+// ---------------------------------------------------------------------------
+// Deactivates reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DeactivateReorderGrabbedModeL( TBool aExit )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DeactivateReorderGrabbedModeL" );
+    iIsGrabbed = EFalse;
+    delete iCurrentCba;
+    iCurrentCba = NULL;
+
+    iContainer->SetReorderGrabbedMode( EFalse );
+    if ( aExit )
+        {
+        CEikButtonGroupContainer* cba = Cba();
+        if ( cba )
+            {
+            cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+            cba->DrawDeferred();
+
+#ifdef __ENABLE_MSK
+            // set middle softkey label display
+            UpdateMiddleSoftKeyDisplayL( R_QTN_MSK_PLAY );
+#endif // __ENABLE_MSK
+
+            }
+
+        iContainer->RestoreOriginalTitleIconL();
+        delete iTitle;
+        iTitle = NULL;
+        if ( iOriginalTitle )
+            {
+            iTitle = iOriginalTitle->AllocL();
+            delete iOriginalTitle;
+            iOriginalTitle = NULL;
+            }
+        UpdateTitlePaneL();
+
+        delete iDuration;
+        iDuration = NULL;
+        if ( iOriginalDuration )
+            {
+            iDuration = iOriginalDuration->AllocL();
+            delete iOriginalDuration;
+            iOriginalDuration = NULL;
+            }
+        if ( iViewUtility->ActiveViewType() == TUid::Uid( KMPXPluginTypeCollectionUid ) )
+            {
+            UpdateNaviPaneL();
+            }
+        iContainer->ActivateReorderMode( EFalse );
+        iContainer->EnableFindBox( ETrue );
+        }
+    iContainer->HandleLbxItemAdditionPreserveIndexL();
+    }
+
+// -----------------------------------------------------------------------------
+// Change the button group
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::SetNewCbaL( TInt aResId )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::SetNewCbaL" );
+    if ( !iCurrentCba )
+        {
+        iCurrentCba = CEikButtonGroupContainer::NewL(
+            CEikButtonGroupContainer::ECba,
+            CEikButtonGroupContainer::EHorizontal,
+            this,
+            aResId, *iContainer );
+        }
+    else
+        {
+        iCurrentCba->SetCommandSetL( aResId );
+        iCurrentCba->DrawDeferred();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Display the details dialog
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DisplayDetailsDialogL( MDesC16Array& aDataArray,
+    TInt aDialogResourceId, TInt aTitleResourceId )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DisplayDetailsDialogL" );
+    CAknSingleHeadingPopupMenuStyleListBox* list =
+        new ( ELeave ) CAknSingleHeadingPopupMenuStyleListBox;
+    CleanupStack::PushL( list );
+    CAknPopupList* popupList = CAknPopupList::NewL(
+        list, R_AVKON_SOFTKEYS_OK_EMPTY,
+        AknPopupLayouts::EMenuGraphicHeadingWindow);
+    CleanupStack::PushL( popupList );
+    list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect );
+    list->CreateScrollBarFrameL( ETrue );
+    list->ScrollBarFrame()->SetScrollBarVisibilityL(
+        CEikScrollBarFrame::EOff,
+        CEikScrollBarFrame::EAuto);
+
+    // Enable Marquee
+    static_cast<CEikFormattedCellListBox*>( list )->ItemDrawer()->ColumnData()->
+        EnableMarqueeL( ETrue );
+
+    // Retrieve heading array
+    CDesCArrayFlat* headingsArray(
+        iCoeEnv->ReadDesCArrayResourceL( aDialogResourceId ) );
+    CleanupStack::PushL( headingsArray );
+
+    // Item array combines heading array and data array
+    CDesCArrayFlat* itemArray =
+        new ( ELeave ) CDesCArrayFlat( headingsArray->Count() );
+    CleanupStack::PushL( itemArray );
+
+    TInt count = headingsArray->Count();
+    for ( TInt i = 0; i < count; i++ )
+        {
+        HBufC* item = HBufC::NewLC(
+            headingsArray->MdcaPoint( i ).Length() +
+            aDataArray.MdcaPoint( i ).Length() +
+            KMPXDurationDisplayResvLen );
+
+        TPtrC tempPtr1 = headingsArray->MdcaPoint( i );
+        TPtrC tempPtr2 = aDataArray.MdcaPoint( i );
+
+        item->Des().Format( KMPXCollDetailsItemsFormat,
+                            &tempPtr1,
+                            &tempPtr2 );
+
+        itemArray->AppendL( *item );
+        CleanupStack::PopAndDestroy( item );
+        }
+
+    CleanupStack::Pop( itemArray );
+    CleanupStack::PopAndDestroy( headingsArray );
+
+    // Set list items
+    CTextListBoxModel* model = list->Model();
+    model->SetOwnershipType( ELbmOwnsItemArray );
+    model->SetItemTextArray( itemArray );
+
+    // Set title
+    HBufC* title = StringLoader::LoadLC( aTitleResourceId );
+    popupList->SetTitleL( *title );
+    CleanupStack::PopAndDestroy( title );
+
+    // Show popup list
+    CleanupStack::Pop( popupList );
+    popupList->ExecuteLD();
+    CleanupStack::PopAndDestroy( list );
+    }
+
+// -----------------------------------------------------------------------------
+// Display collection details
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoShowCollectionDetailsL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::ShowCollectionDetailsL" );
+    CDesCArrayFlat* dataArray =
+        new ( ELeave ) CDesCArrayFlat( EMPXCollectionDetailsCount );
+    CleanupStack::PushL( dataArray );
+
+    // number of items
+    HBufC* dataToAppend = HBufC::NewLC( KMPXMaxBufferLength );
+    TInt songsCount( 0 );
+    if ( aMedia.IsSupported( KMPXMediaColDetailNumberOfItems ) )
+        {
+        songsCount = aMedia.ValueTObjectL<TInt>( KMPXMediaColDetailNumberOfItems );
+        }
+    TPtr ptr( dataToAppend->Des() );
+    ptr.AppendNum( songsCount );
+    AknTextUtils::LanguageSpecificNumberConversion( ptr );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // total duration
+    TInt duration( 0 );
+    if ( aMedia.IsSupported( KMPXMediaColDetailDuration ) )
+        {
+        duration = aMedia.ValueTObjectL<TInt>( KMPXMediaColDetailDuration );
+        }
+    if ( duration > 0 )
+        {
+        dataToAppend = iCommonUiHelper->DisplayableDurationInTextL( duration/KMilliSecondsToSeconds );
+        CleanupStack::PushL( dataToAppend );
+        ptr.Set( dataToAppend->Des() );
+        AknTextUtils::LanguageSpecificNumberConversion( ptr );
+        dataArray->AppendL( ptr );
+        CleanupStack::PopAndDestroy( dataToAppend );
+        }
+    else
+        {
+        dataArray->AppendL( KNullDesC );
+        }
+
+#ifdef RD_MULTIPLE_DRIVE
+    RFs& fileSession( iCoeEnv->FsSession() );
+    TDriveList driveList;
+    TInt driveCount(0);
+    TInt64 freePhoneMemory(KErrNotFound);
+    TInt64 freeInternalMemory(KErrNotFound);
+    TInt64 freeExternalMemory(KErrNotFound);
+    TVolumeInfo volInfo;
+
+    // Get all visible drives
+    User::LeaveIfError( DriveInfo::GetUserVisibleDrives(
+           fileSession, driveList, driveCount ) );
+    MPX_DEBUG2 ("CMPXCollectionViewHgImp::ShowCollectionDetailsL - driveCount = %d", driveCount);
+
+    for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ )
+        {
+        if (driveList[driveNum])
+            {
+            // Get the volume information
+            if ( fileSession.Volume( volInfo, driveNum ) == KErrNone )
+                {
+                // Get the drive status
+                TUint driveStatus(0);
+                DriveInfo::GetDriveStatus( fileSession, driveNum, driveStatus );
+
+                // Add up free memory depending on memory location
+                if ( driveNum == EDriveC )
+                    {
+                    if ( freePhoneMemory == KErrNotFound )
+                        {
+                        freePhoneMemory = 0;
+                        }
+                    freePhoneMemory += volInfo.iFree;
+                    }
+                else if ( driveStatus & DriveInfo::EDriveInternal )
+                    {
+                    if ( freeInternalMemory == KErrNotFound )
+                        {
+                        freeInternalMemory = 0;
+                        }
+                    freeInternalMemory += volInfo.iFree;
+                    }
+                else if ( driveStatus &
+                    (DriveInfo::EDriveRemovable | DriveInfo::EDriveRemote) )
+                    {
+                    if ( freeExternalMemory == KErrNotFound )
+                        {
+                        freeExternalMemory = 0;
+                        }
+                    freeExternalMemory += volInfo.iFree;
+                    }
+                }
+            }
+        }
+
+    // phone memory free
+    if ( freePhoneMemory != KErrNotFound )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL(
+            freePhoneMemory, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr);
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_MEMORY_UNAVAILABLE );
+        ptr.Set(dataToAppend->Des());
+        }
+
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // internal memory (mass storage) free
+    if ( freeInternalMemory != KErrNotFound )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL(
+            freeInternalMemory, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr);
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_MEMORY_UNAVAILABLE );
+        ptr.Set(dataToAppend->Des());
+        }
+
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // removable/remote (memory card) memory free
+    if ( freeExternalMemory != KErrNotFound )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL(
+            freeExternalMemory, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr);
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM );
+        ptr.Set(dataToAppend->Des());
+        }
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+#else
+    // phone memory free
+    HBufC* driveLetter = StringLoader::LoadLC( R_MPX_COLLECTION_PHONE_MEMORY_ROOT_PATH );
+    RFs& fileSession( iCoeEnv->FsSession() );
+    TVolumeInfo volInfo;
+    TDriveUnit driveUnit( *driveLetter ); // Get the drive
+    CleanupStack::PopAndDestroy( driveLetter );
+    if ( KErrNone == fileSession.Volume( volInfo, ( TInt )driveUnit ) )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL( volInfo.iFree, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr);
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM );
+        ptr.Set(dataToAppend->Des());
+        }
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // memory card
+    driveLetter = StringLoader::LoadLC( R_MPX_COLLECTION_MEMORY_CARD_ROOT_PATH );
+    driveUnit = *driveLetter; // Get the drive
+    CleanupStack::PopAndDestroy( driveLetter );
+    if ( fileSession.Volume( volInfo, ( TInt )driveUnit ) == KErrNone )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL( volInfo.iFree, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr);
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM );
+        ptr.Set(dataToAppend->Des());
+        }
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+#endif // RD_MULTIPLE_DRIVE
+
+    // last refreshed
+    TInt64 lastRefreshed( 0 );
+    if ( aMedia.IsSupported( KMPXMediaColDetailLastRefreshed ) )
+        {
+        lastRefreshed = aMedia.ValueTObjectL<TInt64>( KMPXMediaColDetailLastRefreshed );
+        }
+    TTime time( lastRefreshed );
+    dataToAppend = HBufC::NewLC(
+        KMPXMaxTimeLength + KMPXDurationDisplayResvLen );
+    HBufC* format( StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO ) );
+    TPtr modDatePtr( dataToAppend->Des() );
+    time.FormatL( modDatePtr, *format );
+    CleanupStack::PopAndDestroy( format );
+    AknTextUtils::LanguageSpecificNumberConversion( modDatePtr );
+    dataArray->AppendL( modDatePtr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    DisplayDetailsDialogL( *dataArray,
+        R_MPX_CUI_COLLECTION_DETAILS_HEADINGS,
+        R_MPX_QTN_NMP_TITLE_COLLECTION_DETAILS );
+    CleanupStack::PopAndDestroy( dataArray );
+    }
+
+// -----------------------------------------------------------------------------
+// Display playlist details
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoShowPlaylistDetailsL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::ShowPlaylistDetailsL" );
+    CDesCArrayFlat* dataArray =
+        new ( ELeave ) CDesCArrayFlat( EMPXPlaylistDetailsCount );
+    CleanupStack::PushL( dataArray );
+
+    // playlist name
+    if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) )
+        {
+        dataArray->AppendL( aMedia.ValueText( KMPXMediaGeneralTitle ) );
+        }
+    else if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
+        {
+        TParsePtrC fileDetail( aMedia.ValueText( KMPXMediaGeneralUri ) );
+        dataArray->AppendL( fileDetail.Name() );
+        }
+    else
+        {
+        dataArray->AppendL( KNullDesC );
+        }
+
+    // number of songs
+    TInt songsCount( 0 );
+    if ( aMedia.IsSupported( KMPXMediaGeneralCount ) )
+        {
+        songsCount = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralCount );
+        }
+    HBufC* dataToAppend = HBufC::NewLC( KMPXMaxBufferLength );
+    TPtr ptr( dataToAppend->Des() );
+    ptr.AppendNum( songsCount );
+    AknTextUtils::LanguageSpecificNumberConversion( ptr );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // Duration
+    TInt duration( 0 );
+    if ( aMedia.IsSupported( KMPXMediaGeneralDuration ) )
+        {
+        duration = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
+        }
+    if ( duration > 0 )
+        {
+        dataToAppend = iCommonUiHelper->DisplayableDurationInTextL( duration/KMilliSecondsToSeconds );
+        CleanupStack::PushL( dataToAppend );
+        ptr.Set( dataToAppend->Des() );
+        AknTextUtils::LanguageSpecificNumberConversion( ptr );
+        dataArray->AppendL( ptr );
+        CleanupStack::PopAndDestroy( dataToAppend );
+        }
+    else
+        {
+        dataArray->AppendL( KNullDesC );
+        }
+
+    // Location
+    TUint flags( aMedia.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) );
+    TUint isVirtual( ( flags ) & ( KMPXMediaGeneralFlagsIsVirtual ) );
+    if ( !isVirtual )
+        {
+        if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
+            {
+            dataArray->AppendL( aMedia.ValueText( KMPXMediaGeneralUri ) );
+            }
+        else
+            {
+            dataArray->AppendL( KNullDesC );
+            }
+        }
+
+    // last refreshed
+    TInt64 lastMod( 0 );
+    if ( aMedia.IsSupported( KMPXMediaGeneralDate ) )
+        {
+        lastMod = aMedia.ValueTObjectL<TInt64>( KMPXMediaGeneralDate );
+        }
+    TTime time( lastMod );
+    dataToAppend = HBufC::NewLC(
+        KMPXMaxTimeLength + KMPXDurationDisplayResvLen );
+    HBufC* format = StringLoader::LoadLC( R_QTN_DATE_USUAL_WITH_ZERO );
+    ptr.Set( dataToAppend->Des() );
+    time.FormatL( ptr, *format );
+    CleanupStack::PopAndDestroy( format );
+    AknTextUtils::LanguageSpecificNumberConversion( ptr );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    dataToAppend = HBufC::NewLC(
+        KMPXMaxTimeLength + KMPXDurationDisplayResvLen );
+    format = StringLoader::LoadLC( R_QTN_TIME_USUAL );
+    ptr.Set( dataToAppend->Des() );
+    time.FormatL( ptr, *format );
+    CleanupStack::PopAndDestroy( format );
+    AknTextUtils::LanguageSpecificNumberConversion( ptr );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    TInt headingResource( isVirtual ?
+        R_MPX_CUI_PLAYLIST_DETAILS_HEADINGS_WITHOUT_URI :
+        R_MPX_CUI_PLAYLIST_DETAILS_HEADINGS_WITH_URI );
+    DisplayDetailsDialogL( *dataArray, headingResource,
+        R_MPX_QTN_NMP_TITLE_PLAYLIST_DETAILS );
+    CleanupStack::PopAndDestroy( dataArray );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Handles Upnp menus from DynInitMenuPaneL()
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleDynInitUpnpL(
+    TInt aResourceId,
+    CEikMenuPane& aMenuPane )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleDynInitUpnpL()" );
+
+    if ( !IsUpnpVisible() )
+        {
+        GetCurrentPlayerDetails();
+
+        if ( iCurrentPlayerType == EPbLocal )
+            {
+            aMenuPane.SetItemDimmed(
+                EMPXCmdUpnpPlayVia,
+                ETrue);
+            }
+        aMenuPane.SetItemDimmed(
+            EMPXCmdUPnPAiwCmdCopyToExternalCriteria,
+            ETrue);
+        }
+    else
+        {
+        MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleDynInitUpnpL(): UPnP visible and media" );
+        TInt currentItem( iContainer->CurrentLbxItemIndex() );
+
+        const CMPXMedia& media =
+            (iContainer->ListBoxArray())->MediaL( currentItem );
+        TMPXGeneralType type( EMPXNoType );
+        if (media.IsSupported(KMPXMediaGeneralType))
+            {
+            type =
+                media.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+            }
+
+        if ( ( type == EMPXItem ) ||
+             ( type == EMPXGroup ) )
+            {
+            MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleDynInitUpnpL(): folder or song" );
+            if ( iErrorAttachCopyMenu != KErrNone )
+                {
+                MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleDynInitUpnpL(): error, Dim Copy" );
+                aMenuPane.SetItemDimmed(
+                    EMPXCmdUPnPAiwCmdCopyToExternalCriteria,
+                    ETrue);
+                }
+            else
+                {
+                if (iServiceHandler->HandleSubmenuL(aMenuPane))
+                    {
+                    return;
+                    }
+
+                if ( iServiceHandler->IsAiwMenu(aResourceId))
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleDynInitUpnpL(): Aiw menu" );
+                    CAiwGenericParamList& in = iServiceHandler->InParamListL();
+
+                    iServiceHandler->InitializeMenuPaneL(aMenuPane, aResourceId, EMPXCmdUPnPAiwCmdCopyToExternalCriteria, in);
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleDynInitUpnpL(): after InitializeMenuPaneL" );
+                    }
+                }
+            }
+         else
+            {
+            aMenuPane.SetItemDimmed(
+                EMPXCmdUpnpPlayVia,
+                ETrue);
+            aMenuPane.SetItemDimmed(
+                EMPXCmdUPnPAiwCmdCopyToExternalCriteria,
+                ETrue);
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::IsUpnpVisible
+// Checks if UPnP access point is defined
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewHgImp::IsUpnpVisible()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::IsUpnpVisible" );
+ 	  TBool returnValue = EFalse;
+
+   	if ( iUpnpCopyCommand  && iUpnpFrameworkSupport)
+        {
+        returnValue = iUpnpCopyCommand->IsAvailableL();
+        }
+    return returnValue;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::AddPlayersNamesToMenuL
+// Taken from Gallery upnp support implementation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::AddPlayersNamesToMenuL( CEikMenuPane& aMenuPane )
+    {
+    RArray<TMPXPlaybackPlayerType> playerTypes;
+    CleanupClosePushL(playerTypes);
+
+    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+    manager.GetPlayerTypesL(playerTypes);
+
+    GetCurrentPlayerDetails();
+
+    TInt countPlayersTypes( playerTypes.Count() );
+    TInt countLocalType(0);
+    TInt countRemoteType(0);
+
+    if ( countPlayersTypes >= 1 )
+        {
+        iPlayersList.Close();
+
+        for ( TInt i = 0; i < countPlayersTypes; i++ )
+            {
+            MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] );
+            switch (playerTypes[i])
+                {
+                case EPbLocal:
+                    {
+                    // we only show 1 specific type once in the menu
+                    if ( countLocalType == 0 )
+                        {
+                        AddPlayerNameToMenuL( aMenuPane,
+                                            EMPXCmdUpnpPlayViaLocal,
+                                            manager,
+                                            playerTypes[i] );
+
+                        countLocalType++;
+                        }
+                    break;
+                    }
+                case EPbRemote:
+                    {
+                    // we only show 1 specific type once in the menu
+                    if ( countRemoteType == 0 )
+                        {
+                        AddPlayerNameToMenuL( aMenuPane,
+                                            EMPXCmdUpnpPlayViaRemotePlayer,
+                                            manager,
+                                            playerTypes[i] );
+                        countRemoteType++;
+                        }
+                    break;
+                    }
+                default:
+                    {
+                    // default case is handled in the next loop, we want
+                    // to add any "other" player at the end of the list
+                    break;
+                    }
+                }
+            } // for loop
+
+        for ( TInt i = 0; i < countPlayersTypes; i++ )
+            {
+            MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] );
+            // EPbLocal and EPbRemote were already added to the
+            // submenu in the previous loop
+            if ( playerTypes[i] != EPbLocal &&
+                 playerTypes[i] != EPbRemote )
+                {
+                // EPbUnknown or else
+                TBool alreadyInTheList( EFalse );
+
+                for ( TInt j = 0; j < i; j++)
+                    {
+                    // if the new playertype is already in the list
+                    if ( playerTypes[i] == playerTypes[j] )
+                        {
+                        alreadyInTheList = ETrue;
+                        break;
+                        }
+                    }
+
+                if ( !alreadyInTheList )
+                    {
+                    HBufC* buf = manager.PlayerTypeDisplayNameL(playerTypes[i]);
+
+                    if ( buf )
+                        {
+                        CleanupStack::PushL(buf);
+                        AddPlayerNameToMenuL( aMenuPane,
+                                            EMPXCmdUpnpPlayViaRemotePlayer,
+                                            manager,
+                                            playerTypes[i],
+                                            *buf );
+                        CleanupStack::PopAndDestroy(buf);
+                        }
+                    // else we don't do anything. other player type is not
+                    // currently supported. Implementation will be finalized
+                    // when the requirement is defined.
+                    }
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&playerTypes);
+
+    if ( iPlayersList.Count() <= 1 )
+        {
+        aMenuPane.SetItemDimmed( EMPXCmdUpnpPlayViaRemotePlayer,
+                                  ETrue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::AddPlayerNameToMenuL
+// Taken from Gallery upnp support implementation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::AddPlayerNameToMenuL( CEikMenuPane& aMenuPane,
+                                                TInt aCommandId,
+                                                MMPXPlayerManager& aPlayerManager,
+                                                TMPXPlaybackPlayerType& aPlayerType,
+                                                const TDesC& aMenuText )
+    {
+    RArray<TUid> players;
+    CleanupClosePushL(players);
+    aPlayerManager.GetPlayerListL(players, aPlayerType);
+
+    // For now we only keep the first player we find
+    // Local player is always the first one in the list
+    // Ui spec limitation
+    MPX_DEBUG2( "players[0]: %d", players[0].iUid );
+    if ( aCommandId == EMPXCmdUpnpPlayViaLocal )
+        {
+        iPlayersList.Insert(players[0], 0);
+        }
+    else if ( ( aCommandId == EMPXCmdUpnpPlayViaRemotePlayer ) &&
+              (iPlayersList.Count() > 1) )
+        {
+        iPlayersList.Insert(players[0], 1);
+        }
+    else
+        {
+        iPlayersList.AppendL(players[0]);
+        }
+    CleanupStack::PopAndDestroy(&players);
+
+    // if the player is of unknown type
+    if ( ( aCommandId != EMPXCmdUpnpPlayViaRemotePlayer ) &&
+         ( aCommandId != EMPXCmdUpnpPlayViaLocal ) )
+        {
+        CEikMenuPaneItem::SData menuItem;
+        menuItem.iText.Copy( aMenuText );
+        menuItem.iCascadeId = 0;
+        menuItem.iFlags = EEikMenuItemRadioEnd;
+
+        menuItem.iCommandId = aCommandId + (iPlayersList.Count() - 1);
+        aCommandId = menuItem.iCommandId;
+
+        aMenuPane.AddMenuItemL( menuItem );
+        }
+
+    if ( iCurrentPlayerType == aPlayerType )
+        {
+        aMenuPane.SetItemButtonState( aCommandId, EEikMenuItemSymbolOn );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::GetCurrentPlayerDetails
+// Retrieves the current player name and type
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::GetCurrentPlayerDetails()
+    {
+    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+    TUid currentlyUsedPlayer;
+    TInt currentlyUsedSubPlayer;
+    iCurrentPlayerType = EPbLocal;
+    delete iSubPlayerName;
+    iSubPlayerName = NULL;
+    TRAP_IGNORE( manager.GetSelectionL( iCurrentPlayerType,
+                                        currentlyUsedPlayer,
+                                        currentlyUsedSubPlayer,
+                                        iSubPlayerName));
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::SelectNewPlayerL
+// Selects a new player for audio playback
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::SelectNewPlayerL( TInt aCommand )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::SelectNewPlayerL()" );
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::SelectNewPlayerL(%d)", aCommand );
+
+    TInt errorSelectPlayer( KErrCancel );
+
+    switch (aCommand)
+        {
+        case EMPXCmdUpnpPlayViaLocal:
+            {
+            // if Local is not already the current player, select it
+            if ( iCurrentPlayerType != EPbLocal )
+                {
+                MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+                MPX_TRAP( errorSelectPlayer, manager.ClearSelectPlayersL() );
+                }
+            else // no need to reselect it but always start playback
+                {
+                errorSelectPlayer = KErrNone;
+                }
+            break;
+            }
+        default:
+            {
+            if ( aCommand >= EMPXCmdUpnpPlayViaRemotePlayer )
+                {
+                HBufC* buf = HBufC::NewLC( KMaxUidName );
+                buf->Des().AppendNum(
+                     (iPlayersList[aCommand -
+                                   EMPXCmdUpnpPlayViaLocal]).iUid );
+
+                // ActivateViewL leaves with KErrCancel if the dialog is
+                // cancelled
+                // ActivateViewL leaves with KErrInUse if the selected player
+                // is already the active player
+                MPX_TRAP(errorSelectPlayer, iViewUtility->ActivateViewL(
+                                TUid::Uid( KMPXPluginTypeUPnPBrowseDialogUid ),
+                                buf ));
+                CleanupStack::PopAndDestroy( buf );
+                }
+            break;
+            }
+        }
+
+    GetCurrentPlayerDetails();
+
+    // If InUse, the player selected is already the current one, we start playback anyway
+    // contrary to Playback view
+    if ( ( errorSelectPlayer == KErrNone ) ||
+         ( errorSelectPlayer == KErrInUse ) )
+        {
+        // Starts playback by calling OpenL() for the selected track
+        CMPXCommonListBoxArrayBase* array = iContainer->ListBoxArray();
+        if ( array && ( iContainer->TotalListItemCount() > 0 ) )
+            {
+            MPX_DEBUG1( "CMPXCollectionViewHgImp::SelectNewPlayerL() before MediaL()" );
+
+            TInt currentListBoxItemIndex(
+                iContainer->CurrentLbxItemIndex() );
+
+            if ( currentListBoxItemIndex >= 0 )
+                {
+                const CMPXMedia& media = array->MediaL( currentListBoxItemIndex );
+
+                TMPXGeneralType type( EMPXNoType );
+                TMPXGeneralCategory category( EMPXNoCategory );
+
+                if ( media.IsSupported( KMPXMediaGeneralType ) )
+                    {
+                    type = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+                    }
+
+                if ( media.IsSupported( KMPXMediaGeneralCategory ) )
+                    {
+                    category = media.ValueTObjectL<TMPXGeneralCategory>(
+                                    KMPXMediaGeneralCategory );
+                    }
+
+                MPX_DEBUG2( "CMPXCollectionViewHgImp::SelectNewPlayerL() currentIndex %d", currentListBoxItemIndex );
+
+                // Needed to reset the status of iPreservedState
+                iPlaybackUtility->CommandL(EPbCmdResetPreserveState);
+
+                if ( ( type == EMPXItem ) && ( category == EMPXSong ) )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::SelectNewPlayerL() type is EMPXItem" );
+                    if(iCollectionCacheReady)
+                        {
+                        iCollectionUtility->Collection().OpenL( currentListBoxItemIndex );
+						iFirstIncrementalBatch = ETrue;
+                        }
+                    }
+                else if ( ( type == EMPXItem ) && ( category == EMPXPlaylist ) )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::SelectNewPlayerL() category is EMPXPlaylist" );
+                    // if we want to play a playlist, we need to find out
+                    // if it's empty first
+                    ASSERT( iCurrentFindAllLOp == EMPXOpFindAllLIdle );
+
+                    TMPXItemId id(
+                        media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                    CMPXMedia* entry = CMPXMedia::NewL();
+                    CleanupStack::PushL( entry );
+                    entry->SetTObjectValueL<TMPXGeneralType>(
+                        KMPXMediaGeneralType, EMPXGroup );
+                    entry->SetTObjectValueL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory, EMPXSong );
+                    entry->SetTObjectValueL<TMPXItemId>(
+                        KMPXMediaGeneralId, id );
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL( attrs );
+                    attrs.Append( KMPXMediaGeneralId );
+                    iCollectionUtility->Collection().FindAllL(
+                                            *entry, attrs.Array(), *this );
+                    iCurrentFindAllLOp = EMPXOpFindAllLUpnpPlayback;
+
+                    CleanupStack::PopAndDestroy( &attrs );
+                    CleanupStack::PopAndDestroy( entry );
+                    }
+                else // if a folder is selected
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::SelectNewPlayerL() type is EMPXGroup" );
+                    if(iCollectionCacheReady)
+                        {
+                        iCollectionUtility->Collection().OpenL( currentListBoxItemIndex,
+                                                            EMPXOpenPlaylistOnly);
+						iFirstIncrementalBatch = ETrue;
+                        }
+                    }
+                }
+            }
+        }
+    else if ( errorSelectPlayer != KErrCancel )
+        {
+        User::LeaveIfError(errorSelectPlayer);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::CopySelectedItemsToRemoteL
+// Copies selected file(s) to remote player
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::CopySelectedItemsToRemoteL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::CopySelectedItemsToRemoteL()" );
+
+    TInt index( iContainer->CurrentLbxItemIndex() );
+    if ( index >= 0 )
+        {
+        CMPXCommonListBoxArrayBase* array = iContainer->ListBoxArray();
+        const CMPXMedia& media = array->MediaL( index );
+
+        TMPXGeneralType type( EMPXNoType );
+        TMPXGeneralCategory category( EMPXNoCategory );
+
+       if ( media.IsSupported( KMPXMediaGeneralType ) )
+            {
+            type =
+                media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+            }
+        if ( media.IsSupported( KMPXMediaGeneralCategory ) )
+            {
+            category =
+                media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+            }
+
+        CMPXCollectionPath* cpath =
+                              iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL( cpath );
+
+        if ( ( type == EMPXItem ) && ( category == EMPXSong ) )
+            {
+            const CArrayFix<TInt>* arrayIndex =
+                iContainer->CurrentSelectionIndicesL();
+            TInt arrayCount( arrayIndex->Count() );
+
+            cpath->ClearSelection();
+            if ( arrayCount > 0 )
+                {
+                for (TInt index=0; index < arrayCount; index++)
+                    {
+                    cpath->SelectL(arrayIndex->At(index));
+                    }
+                }
+            else
+                {
+                cpath->Set( index );
+                }
+
+            // Ask for the list of selected song paths: will return in HandleMedia()
+            ASSERT( iCurrentMediaLOp == EMPXOpMediaLIdle );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append( KMPXMediaGeneralUri );
+            iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+            iCurrentMediaLOp = EMPXOpMediaLCopyToRemote;
+            CleanupStack::PopAndDestroy( &attrs );
+            }
+        else // if a folder is selected
+            {
+            TMPXItemId id(0);
+            if ( media.IsSupported( KMPXMediaGeneralId ) )
+                {
+                id = media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+                }
+
+            RArray<TInt> supportedIds;
+            CleanupClosePushL(supportedIds);
+            supportedIds.AppendL(KMPXMediaIdGeneral);
+
+            CMPXMedia* entry = CMPXMedia::NewL(supportedIds.Array());
+            CleanupStack::PushL(entry);
+            entry->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup );
+
+            entry->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong );
+
+            entry->SetTObjectValueL( KMPXMediaGeneralId, id );
+
+            if ( category == EMPXAlbum )
+                {
+                const CMPXMedia& containerMedia = array->ContainerMedia();
+                TMPXGeneralCategory containerCategory( EMPXNoCategory );
+                if ( containerMedia.IsSupported( KMPXMediaGeneralCategory ) )
+                    {
+                    containerCategory = containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                                                KMPXMediaGeneralCategory );
+                    }
+
+                if ( containerCategory == EMPXArtist )
+                    {
+                    // artist/album level, need to specify artist ID in container ID
+                    TMPXItemId containerId =
+                        containerMedia.ValueTObjectL<TMPXItemId>(
+                            KMPXMediaGeneralId );
+                    entry->SetTObjectValueL<TMPXItemId>(
+                        KMPXMediaGeneralContainerId, containerId );
+                    }
+                }
+
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append( KMPXMediaGeneralUri );
+
+            ASSERT( iCurrentFindAllLOp == EMPXOpFindAllLIdle );
+            iCollectionUtility->Collection().FindAllL( *entry,
+                                                       attrs.Array(),
+                                                       *this );
+            iCurrentFindAllLOp = EMPXOpFindAllLUpnp;
+
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PopAndDestroy( entry );
+            CleanupStack::PopAndDestroy( &supportedIds );
+            }
+        CleanupStack::PopAndDestroy( cpath );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::DoHandleCopyToRemoteL
+// Handle call back from collectionframework for Copy to Remote command
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoHandleCopyToRemoteL(
+    const CMPXMedia& aMedia, TBool aComplete )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoHandleCopyToRemoteL()");
+
+    CMPXMediaArray* mediaArray( NULL );
+    TInt fileCount( 0 );
+
+    if ( aMedia.IsSupported( KMPXMediaArrayContents ) )
+        {
+        mediaArray =
+            aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+        if ( mediaArray )
+            {
+            fileCount = mediaArray->Count();
+            }
+        }
+    MPX_DEBUG2("CMPXCollectionViewHgImp::DoHandleCopyToRemoteL Entry count = %d", fileCount);
+
+    // Change this to Global will be needed if FindAll() is called
+    // repeatedly until aComplete is ETrue (Inc9?)
+    CAiwGenericParamList* aiwCopyInParamList = CAiwGenericParamList::NewLC();
+
+    // multiple files or folder
+    if ( fileCount > 0 )
+        {
+        if ( mediaArray )
+            {
+            for ( TInt i = 0; i < fileCount; i++ )
+                {
+                CMPXMedia* media( mediaArray->AtL( i ) );
+
+                const TDesC& location =
+                    media->ValueText( KMPXMediaGeneralUri );
+                MPX_DEBUG3( "CMPXCollectionViewHgImp::DoHandleCopyToRemote %d filePath = %S", i, &location );
+
+                TAiwVariant path( location );
+                TAiwGenericParam fileParameter( EGenericParamFile,
+                                                path );
+                aiwCopyInParamList->AppendL( fileParameter );
+                }
+            }
+        }
+    else // single file
+        {
+        TMPXGeneralType type( EMPXNoType );
+
+        if ( aMedia.IsSupported( KMPXMediaGeneralType ) )
+            {
+            type = aMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+            }
+
+        if ( type == EMPXItem )
+            {
+            const TDesC& location =
+                aMedia.ValueText( KMPXMediaGeneralUri );
+            TAiwVariant path( location );
+            MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleCopyToRemote filePath = %S", &location );
+
+            TAiwGenericParam fileParameter( EGenericParamFile, path );
+            aiwCopyInParamList->AppendL( fileParameter );
+            }
+        }
+
+    if ( ( aiwCopyInParamList->Count() > 0 ) &&
+         aComplete )
+        {
+        CAiwGenericParamList* outParamList = CAiwGenericParamList::NewLC();
+        // do not allow the copy dialog to be dismissed by external command
+        HandleCommandL( EMPXCmdIgnoreExternalCommand );
+        iServiceHandler->ExecuteMenuCmdL(
+                  EMPXCmdUPnPAiwCmdCopyToExternalCriteria, /* command id */
+                  *aiwCopyInParamList,   /* in parameters */
+                  *outParamList,          /* out parameters */
+                  0,                      /* options */
+                  NULL );                 /* call back */
+        HandleCommandL( EMPXCmdHandleExternalCommand );
+
+        CleanupStack::PopAndDestroy( outParamList );
+        }
+
+    // Clear selection
+    if( iContainer )
+        {
+        iContainer->ClearLbxSelection();
+        }
+
+    CleanupStack::PopAndDestroy( aiwCopyInParamList );
+    }
+
+// -----------------------------------------------------------------------------
+// Find playlists
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewHgImp::FindPlaylistsL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::FindPlaylistsL" );
+    TInt entriesCount( 0 );
+    delete iUserPlaylists;
+    iUserPlaylists = NULL;
+    iUserPlaylists = iCommonUiHelper->FindPlaylistsL();
+
+    if ( iUserPlaylists )
+        {
+        const CMPXMediaArray* mediaArray =
+            iUserPlaylists->Value<CMPXMediaArray>( KMPXMediaArrayContents );
+        User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+
+        entriesCount = mediaArray->Count();
+        MPX_DEBUG2( "CMPXCollectionViewHgImp::FindPlaylistsL Entry count = %d", entriesCount );
+        }
+    else
+        {
+        MPX_DEBUG1( "CMPXCollectionViewHgImp::FindPlaylistsL Error getting playlist" );
+        User::Leave( KErrNotFound );
+        }
+    return entriesCount;
+    }
+
+// -----------------------------------------------------------------------------
+// Save the playlist after reorder
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::SaveCurrentPlaylistL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::SaveCurrentPlaylistL" );
+    CMPXCommonListBoxArrayBase* listboxArray =
+        iContainer->ListBoxArray();
+    TInt currentIndex( iContainer->CurrentLbxItemIndex() );
+    TInt origIndex( iContainer->GetOriginalIndex() );
+    const CMPXMedia& media( listboxArray->MediaL( origIndex ) );
+    TMPXItemId id( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+    const CMPXMedia& containerMedia = listboxArray->ContainerMedia();
+    TMPXItemId playlistId( containerMedia.ValueTObjectL<TMPXItemId>(
+        KMPXMediaGeneralId ) );
+    MPX_DEBUG4( "CMPXCollectionViewHgImp::SaveCurrentPlaylistL song 0x%x is moved from %d to %d",
+         id.iId1, origIndex, currentIndex );
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::SaveCurrentPlaylistL playlist ID 0x%x", playlistId.iId1 );
+    iIsSavingReorderPlaylist = ETrue;
+    iCollectionUiHelper->ReorderPlaylistL(
+        playlistId, id, origIndex, currentIndex, this );
+    iCurrentHighlightedIndex = currentIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// Handles rename operation complete
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleRenameOpCompleteL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleRenameOpCompleteL" );
+    iSetMediaLCount = KErrNotFound;
+    MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleRenameOpCompleteL dismiss wait note" );
+    iCommonUiHelper->DismissWaitNoteL();
+    HandleCommandL( EMPXCmdHandleExternalCommand );
+    if ( iInvalidFileExist )
+        {
+        // there are invalid files, diplay info note
+        HBufC* string = StringLoader::LoadLC(
+            R_MPX_COLLECTION_NOTE_RENAME_WITH_INVALID, *iNewName );
+        iCommonUiHelper->DisplayInfoNoteL( *string );
+        CleanupStack::PopAndDestroy( string );
+        }
+    MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleRenameOpCompleteL calling OpenL" );
+    // path changed messages were ignored during rename, need to
+    // manually refresh the screen
+    DoIncrementalOpenL();
+    }
+
+// -----------------------------------------------------------------------------
+// checks if send option should be shown
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewHgImp::SendOptionVisibilityL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::SendOptionVisibilityL" );
+    TBool isHidden( iContainer->TotalListItemCount() < 1 );
+
+    if ( !isHidden )
+        {
+        CMPXCommonListBoxArrayBase* baseArray =
+            iContainer->ListBoxArray();
+        CMPXCollectionViewListBoxArray* array =
+            static_cast<CMPXCollectionViewListBoxArray*>( baseArray );
+        TInt selectionCount( 0 );
+        if ( iSelectionIndexCache)
+            {
+            selectionCount = iSelectionIndexCache->Count();
+            }
+
+        if ( selectionCount > 0 )
+            {
+            TBool isValid( EFalse );
+            for ( TInt i = 0; i < selectionCount && !isValid; i++ )
+                {
+                // multiple selection
+                isValid = !array->IsItemBrokenLinkL(
+                    iSelectionIndexCache->At( i ) );
+                isValid = isValid &&
+                    !array->IsItemCorruptedL(
+                    iSelectionIndexCache->At( i ));
+                }
+            // if anything is valid, display the item
+            isHidden = !isValid;
+            }
+        else
+            {
+            //single selection
+            isHidden = array->IsItemBrokenLinkL(
+                iContainer->CurrentLbxItemIndex() );
+            isHidden = isHidden ||
+                array->IsItemCorruptedL(
+                iContainer->CurrentLbxItemIndex() );
+            }
+        }
+
+    return isHidden;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if Set as ringtone option should be shown
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewHgImp::SetAsRingToneOptionVisibilityL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::SetAsRingToneOptionVisibilityL" );
+    TBool isHidden( iContainer->TotalListItemCount() < 1 );
+
+    if ( !isHidden )
+        {
+        CMPXCollectionViewListBoxArray* array =
+            static_cast<CMPXCollectionViewListBoxArray*>(
+            iContainer->ListBoxArray() );
+        const CMPXMedia& media =
+            array->MediaL( iContainer->CurrentLbxItemIndex() );
+
+        // if item is not yet fetched from database, assume that it's valid
+        if ( !( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
+            KMPXInvalidItemId ) )
+            {
+            CMPXMedia* criteria = CMPXMedia::NewL();
+            CleanupStack::PushL( criteria );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL( attrs );
+            attrs.Append( KMPXMediaGeneralUri );
+            attrs.Append( KMPXMediaDrmProtected );
+            attrs.Append( KMPXMediaDrmCanSetAutomated );
+            criteria->SetTObjectValueL<TMPXGeneralType>(
+                KMPXMediaGeneralType,
+                media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+            criteria->SetTObjectValueL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory,
+                media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+            if ( media.IsSupported( KMPXMediaGeneralCollectionId ) )
+                {
+                criteria->SetTObjectValueL<TUid>(
+                    KMPXMediaGeneralCollectionId,
+                    media.ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId ) );
+                }
+            else
+                {
+                CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
+                CleanupStack::PushL( path );
+                criteria->SetTObjectValueL<TUid>(
+                    KMPXMediaGeneralCollectionId,
+                    TUid::Uid( path->Id( 0 ) ) );
+                CleanupStack::PopAndDestroy( path );
+                }
+            criteria->SetTObjectValueL<TMPXItemId>(
+                KMPXMediaGeneralId,
+                media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+
+            CMPXMedia* songInfo = iCollectionUtility->Collection().FindAllL( *criteria,
+                                                             attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PushL( songInfo );
+
+            const CMPXMediaArray* mediaArray(
+                songInfo->Value<CMPXMediaArray>( KMPXMediaArrayContents ) );
+            User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+
+            if ( mediaArray->Count() > 0 )
+                {
+                CMPXMedia* si( mediaArray->AtL( 0 ) );
+                if ( si->IsSupported( KMPXMediaDrmProtected ) )
+                    {
+                    if ( si->ValueTObjectL<TBool>( KMPXMediaDrmProtected ) &&
+                        si->IsSupported( KMPXMediaDrmCanSetAutomated ) )
+                        {
+                        // if it's drm protected, check if
+                        // KMPXMediaDrmCanSetAutomated
+                        isHidden = !( si->ValueTObjectL<TBool>( KMPXMediaDrmCanSetAutomated ) );
+                        }
+                    }
+                }
+            CleanupStack::PopAndDestroy( songInfo );
+            CleanupStack::PopAndDestroy( criteria );
+            }
+        }
+    return isHidden;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if file details option should be shown
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewHgImp::FileDetailsOptionVisibilityL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::FileDetailsOptionVisibilityL" );
+    TInt selectionCount( 0 );
+    if ( iSelectionIndexCache)
+        {
+        selectionCount = iSelectionIndexCache->Count();
+        }
+    TBool isHidden( iContainer->TotalListItemCount() < 1 ||
+            selectionCount );
+    if ( !isHidden )
+        {
+        CMPXCollectionViewListBoxArray* array =
+            static_cast<CMPXCollectionViewListBoxArray*>(
+            iContainer->ListBoxArray() );
+        const CMPXMedia& media = array->MediaL(
+            iContainer->CurrentLbxItemIndex() );
+
+        if ( media.IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            TUint flags( media.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) );
+            if ( ( flags ) & ( KMPXMediaGeneralFlagsIsMissingDetails ) )
+                {
+                isHidden = ETrue;
+                }
+            }
+        }
+    return isHidden;
+    }
+
+// -----------------------------------------------------------------------------
+// Handle send command.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoSendL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoSendL" );
+
+
+    CMPXCommonListBoxArrayBase* listboxArray(
+        iContainer->ListBoxArray() );
+    TInt currentIndex( iContainer->CurrentLbxItemIndex() );
+    const CMPXMedia& media( listboxArray->MediaL(
+        iContainer->CurrentLbxItemIndex() ) );
+
+    // Marked indicies
+    TInt arrayCount( iSelectionIndexCache->Count() );
+
+    if ( ( arrayCount == 0 || arrayCount == 1 ) &&
+        ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId ) )
+        {
+        // not marked, or only 1 item is marked
+        // and the highlighted item is not yet available
+        MPX_DEBUG1( "CMPXCollectionViewHgImp::DoSendL item not yet fetched" );
+        }
+    else
+        {
+        CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL( path );
+
+        MPX_DEBUG2( "CMPXCollectionViewHgImp::DoSendL array count = %d", arrayCount );
+        if ( arrayCount > 1 )
+            {
+            // if more than 1 selected
+            for ( TInt i = 0; i < arrayCount; i++ )
+                {
+                MPX_DEBUG2( "CMPXCollectionViewHgImp::DoSendL array index = %d", iSelectionIndexCache->At( i ) );
+                path->SelectL( iSelectionIndexCache->At(i) );
+                }
+            }
+        else
+            {
+            // if only 1 item is marked, treat it as single selection
+            path->Set( ( arrayCount == 1 ) ?
+                iSelectionIndexCache->At( 0 ) : iContainer->CurrentLbxItemIndex() );
+            }
+
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        attrs.Append(
+            TMPXAttribute( KMPXMediaIdGeneral,
+                EMPXMediaGeneralUri | EMPXMediaGeneralSize |
+                EMPXMediaGeneralCollectionId |
+                EMPXMediaGeneralFlags | EMPXMediaGeneralId |
+                EMPXMediaGeneralType | EMPXMediaGeneralCategory ) );
+        iCurrentMediaLOp = EMPXOpMediaLSend;
+        iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+        CleanupStack::PopAndDestroy( &attrs );
+        CleanupStack::PopAndDestroy( path );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle send playlist command
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoSendPlaylistL( TMPXItemId aItemId )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoSendPlaylistL" );
+    // export the playlist to file system, and send the playlist
+    // when the operation is completed
+    HBufC* defaultDrive = iCommonUiHelper->DefaultDriveLC();
+    TFileName defaultPath;
+    defaultPath.Append( *defaultDrive );
+    RFs& fileSession = iCoeEnv->FsSession();
+    TBool folderExist = BaflUtils::FolderExists( fileSession, defaultPath );
+    TInt count( 0 );
+    // use time stamp as the directory name for export, so that
+    // it won't overwrite any existing files.  It will search for the first
+    // available folder that is not currently in the file system
+    while ( folderExist )
+        {
+        if ( count++ > KMPXPlaylistExportRetry )
+            {
+            MPX_DEBUG1( "CMPXCollectionViewHgImp::DoSendPlaylistL maximum retry count reached, leaving" );
+            User::Leave( KErrNotReady );
+            }
+        defaultPath.Copy( *defaultDrive );
+        TTime timeStamp;
+        timeStamp.UniversalTime();
+        defaultPath.AppendNum( timeStamp.Int64() );
+        defaultPath.Append( KPathDelimiter );
+        folderExist = BaflUtils::FolderExists( fileSession, defaultPath );
+        }
+    CleanupStack::PopAndDestroy( defaultDrive );
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::DoSendPlaylistL creating path = %S", &defaultPath );
+    BaflUtils::EnsurePathExistsL( fileSession, defaultPath );
+    // playlist is sent in the call back of this function
+    iCollectionUiHelper->ExportPlaylistL( aItemId, defaultPath, this );
+    }
+
+// -----------------------------------------------------------------------------
+// Handle call back from collectionframework for send command
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoHandleSendL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoHandleSendL" );
+    TInt invalidFileCount( 0 );
+    TInt maxSize( 0 );
+    CMessageData* messageData = CMessageData::NewLC();
+
+    TInt fileCount( 0 );
+    if( aMedia.IsSupported( KMPXMediaArrayContents ) )
+        {
+        const CMPXMediaArray* mediaArray =
+            aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+        User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+        fileCount = mediaArray->Count();
+
+        }
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleSendL Entry count = %d", fileCount );
+
+    if ( fileCount > 0 )
+        {
+        const CMPXMediaArray* mediaArray =
+            aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+        User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+
+        CMPXMedia* media( NULL );
+        for ( TInt i = 0; i < fileCount; i++ )
+            {
+            media = mediaArray->AtL( i );
+            TUint flags( media->ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) );
+            const TDesC& location = media->ValueText( KMPXMediaGeneralUri );
+
+            if ( !( flags & KMPXMediaGeneralFlagsIsInvalid ) &&
+                ConeUtils::FileExists( location ) )
+                {
+                TInt fileSize( 0 );
+                if ( media->IsSupported( KMPXMediaGeneralSize ) )
+                    {
+                    fileSize = media->ValueTObjectL<TInt>( KMPXMediaGeneralSize );
+                    }
+                else
+                    {
+                    RFs& fileSession = iCoeEnv->FsSession();
+                    TEntry pl;
+                    fileSession.Entry( location, pl );
+                    fileSize = pl.iSize;
+                    }
+                if ( fileSize > maxSize )
+                    {
+                    maxSize = fileSize;
+                    }
+                messageData->AppendAttachmentL( location );
+                }
+            else
+                {
+                UpdateDatabaseFlagL( KErrNotFound, *media,
+                    KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse );
+                invalidFileCount++;
+                }
+            }
+        }
+    else
+        {
+        // single file
+        fileCount = 1;
+        TUint flags = aMedia.ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+        const TDesC& location = aMedia.ValueText( KMPXMediaGeneralUri );
+
+        if ( !( flags & KMPXMediaGeneralFlagsIsInvalid ) &&
+            ConeUtils::FileExists( location ) )
+            {
+            TInt fileSize( 0 );
+            if ( aMedia.IsSupported( KMPXMediaGeneralSize ) )
+                {
+                fileSize = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralSize );
+                }
+            else
+                {
+                RFs& fileSession = iCoeEnv->FsSession();
+                TEntry pl;
+                fileSession.Entry( location, pl );
+                fileSize = pl.iSize;
+                }
+            if ( fileSize > maxSize )
+                {
+                maxSize = fileSize;
+                }
+            messageData->AppendAttachmentL( location );
+            }
+        else
+            {
+            UpdateDatabaseFlagL( KErrNotFound, aMedia,
+                KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse );
+            invalidFileCount++;
+            }
+        }
+    TBool confirmOk( EFalse );
+    MPX_DEBUG3( "CMPXCollectionViewHgImp::DoHandleSendL Invalid Count = %d, Total Count = %d", invalidFileCount, fileCount );
+    if ( invalidFileCount )
+        {
+        if ( invalidFileCount == fileCount )
+            {
+            // all files are invalid
+            iCommonUiHelper->DisplayInfoNoteL( ( invalidFileCount == 1 ) ?
+                R_MPX_COLLECTION_INFO_FILE_NOT_FOUND :
+                R_MPX_COLLECTION_SEND_ALL_INVALID_SONGS_NOTE_TXT );
+            }
+        else
+            {
+            // Show confirmation query if invalid file found
+            HBufC* queryTxt = StringLoader::LoadLC(
+                R_MPX_COLLECTION_QUERY_SEND_INVALID_SONGS_TXT );
+            CAknQueryDialog* query = CAknQueryDialog::NewL(
+                CAknQueryDialog::EConfirmationTone );
+            CleanupStack::PushL( query );
+            query->PublishDialogL( EMPlayerNoteSendInvalidSongs,
+                                KMPlayerNoteCategory);
+            CleanupStack::Pop( query );
+            confirmOk = query->ExecuteLD(
+                R_MPX_COLLECTION_GENERIC_CONFIRMATION_QUERY,
+                *queryTxt );
+            CleanupStack::PopAndDestroy( queryTxt );
+            }
+        }
+
+    if ( !invalidFileCount || confirmOk )
+        {
+        if ( !iSendUi )
+            {
+            iSendUi = CSendUi::NewL();
+            }
+        TSendingCapabilities capabilities(
+            0,
+            maxSize,
+            TSendingCapabilities::ESupportsAttachments );
+        // ignore commands from external clients so that the
+        // sending is not interrupted
+        HandleCommandL( EMPXCmdIgnoreExternalCommand );
+        // send ui leaves with error 0 if canceled, have to be trapped
+        MPX_TRAPD( err, iSendUi->ShowQueryAndSendL( messageData, capabilities ) );
+        if ( err != KErrNone )
+            {
+            HandleError( err );
+            }
+        HandleCommandL( EMPXCmdHandleExternalCommand );
+        }
+
+    // Clear selection
+    iContainer->ClearLbxSelection();
+    CleanupStack::PopAndDestroy( messageData );
+    }
+
+// -----------------------------------------------------------------------------
+// Handle rename command
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoHandleRenameL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoHandleRenameL" );
+    CMPXCommonListBoxArrayBase* listboxArray(
+        iContainer->ListBoxArray() );
+    TInt currentIndex( iContainer->CurrentLbxItemIndex() );
+    const CMPXMedia& currentMedia( listboxArray->MediaL( currentIndex ) );
+    TMPXGeneralCategory category(
+        currentMedia.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+    switch ( category )
+        {
+        case EMPXPlaylist:
+            {
+            // rename playlist
+            iCurrentMediaLOp = EMPXOpMediaLRenamePlaylist;
+            CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( path );
+            path->Set( iContainer->CurrentLbxItemIndex() );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append(
+                TMPXAttribute( KMPXMediaIdGeneral,
+                    EMPXMediaGeneralUri | EMPXMediaGeneralId |
+                    EMPXMediaGeneralTitle ) );
+            iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PopAndDestroy( path );
+            break;
+            }
+        case EMPXAlbum:
+        case EMPXArtist:
+        case EMPXGenre:
+        case EMPXComposer:
+            {
+            delete iNewName;
+            iNewName = NULL;
+            iNewName = HBufC::NewL( KMaxFileName );
+            TPtr ptr( iNewName->Des() );
+
+            // Set default text as current selected item text
+            const CMPXMediaArray& mediaAry = listboxArray->MediaArray();
+            CMPXMedia* origMedia( mediaAry.AtL( currentIndex ) );
+            const TDesC& title = origMedia->ValueText( KMPXMediaGeneralTitle );
+            ptr.Append( title.Left(KMaxFileName) );
+
+            CAknTextQueryDialog* query = CAknTextQueryDialog::NewL( ptr );
+            CleanupStack::PushL( query );
+            query->SetMaxLength( KMaxFileName );
+            HBufC* promptTxt = StringLoader::LoadLC( R_MPX_QTN_NMP_PRMPT_NEW_NAME );
+            query->SetPromptL( *promptTxt );
+            query->SetPredictiveTextInputPermitted( ETrue );
+            CleanupStack::PopAndDestroy( promptTxt );
+            query->PublishDialogL(
+                    EMPlayerQueryPrmptNewName,
+                    KMPlayerNoteCategory);
+            CleanupStack::Pop( query );
+            if ( query->ExecuteLD( R_MPX_CUI_RENAME_QUERY ) )
+                {
+                TMPXItemId id(
+                    currentMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+
+                CMPXMedia* media = CMPXMedia::NewL();
+                CleanupStack::PushL( media );
+                media->SetTObjectValueL<TMPXGeneralType>(
+                    KMPXMediaGeneralType, EMPXGroup );
+                media->SetTObjectValueL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory, EMPXSong );
+                media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+
+                switch ( category )
+                    {
+                    case EMPXAlbum:
+                        {
+                        iCurrentFindAllLOp = EMPXOpFindAllLRenameAlbum;
+                        // check if it's album or artist/album
+                        const CMPXMedia& containerMedia = listboxArray->ContainerMedia();
+                        TMPXGeneralCategory containerCategory(
+                            containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                             KMPXMediaGeneralCategory ) );
+                        if ( containerCategory == EMPXArtist )
+                            {
+                            // artist/album level, need to specify artist ID in container ID
+                            TMPXItemId containerId(
+                                containerMedia.ValueTObjectL<TMPXItemId>(
+                                    KMPXMediaGeneralId ) );
+                            media->SetTObjectValueL<TMPXItemId>(
+                                KMPXMediaGeneralContainerId, containerId );
+                            }
+                        break;
+                        }
+                    case EMPXArtist:
+                        {
+                        iCurrentFindAllLOp = EMPXOpFindAllLRenameArtist;
+                        break;
+                        }
+                    case EMPXGenre:
+                        {
+                        iCurrentFindAllLOp = EMPXOpFindAllLRenameGenre;
+                        break;
+                        }
+                    case EMPXComposer:
+                        {
+                        iCurrentFindAllLOp = EMPXOpFindAllLRenameComposer;
+                        break;
+                        }
+                    default:
+                        {
+                        ASSERT( 0 );
+                        break;
+                        }
+                    }
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL( attrs );
+                attrs.Append(
+                    TMPXAttribute( KMPXMediaIdGeneral,
+                        EMPXMediaGeneralId | EMPXMediaGeneralUri |
+                        EMPXMediaGeneralCollectionId |
+                        EMPXMediaGeneralType | EMPXMediaGeneralCategory | EMPXMediaGeneralFlags ) );
+                if ( category == EMPXAlbum || category == EMPXArtist )
+                    {
+                    attrs.Append( TMPXAttribute( KMPXMediaIdMusic,
+                        EMPXMediaMusicAlbumArtFileName ) );
+                    }
+                iCollectionUtility->Collection().FindAllL( *media, attrs.Array(), *this );
+                CleanupStack::PopAndDestroy( &attrs );
+                CleanupStack::PopAndDestroy( media );
+                }
+            break;
+            }
+        default:
+            {
+            // shouldn't reach here
+            ASSERT( 0 );
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Prepares media object for selected items
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL( CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL" );
+    CMPXMediaArray* mediaArray( CMPXMediaArray::NewL() );
+    CleanupStack::PushL( mediaArray );
+    CMPXCommonListBoxArrayBase* listBoxArray =
+        iContainer->ListBoxArray();
+    TInt count( iSelectionIndexCache->Count() );
+
+    CMPXCollectionPath* path( iCollectionUtility->Collection().PathL() );
+    CleanupStack::PushL( path );
+    TMPXItemId id( path->Id( 0 ) );
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::PrepareMediaForSelectedItemsL collection ID = 0x%x", id.iId1 );
+    CleanupStack::PopAndDestroy( path );
+
+    if ( count > 0 )
+        {
+        if ( count == 1 )
+            {
+            // marked one item, if it's not valid, ignore the command
+            const CMPXMedia& listBoxMedia = listBoxArray->MediaL( iSelectionIndexCache->At(0) );
+            if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
+                {
+                // leave with special error code, this error
+                // should not trigger any error message, the operation should
+                // be terminated silently
+                User::Leave( KMPXErrDataNotReady );
+                }
+            }
+        for ( TInt i = 0; i < count; i++ )
+            {
+            const CMPXMedia& listBoxMedia = listBoxArray->MediaL( iSelectionIndexCache->At(i) );
+            if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
+                {
+                // item not ready, cache this command and execute
+                // it when the data becomes valid
+                User::Leave( KMPXErrDataNotReadyCacheCommand );
+                }
+            CMPXMedia* entry( PopulateMediaLC( listBoxMedia, id ) );
+            mediaArray->AppendL( entry );
+            CleanupStack::Pop( entry );
+            }
+        }
+    else
+        {
+        const CMPXMedia& listBoxMedia = listBoxArray->MediaL(
+            iContainer->CurrentLbxItemIndex() );
+        if ( listBoxMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
+            {
+            // leave with special error code, this error
+            // should not trigger any error message, the operation should
+            // be terminated silently
+            User::Leave( KMPXErrDataNotReady );
+            }
+        else
+            {
+            CMPXMedia* entry( PopulateMediaLC( listBoxMedia, id ) );
+            mediaArray->AppendL( entry );
+            CleanupStack::Pop( entry );
+            }
+        }
+    aMedia.SetTObjectValueL( KMPXMediaGeneralCollectionId, id );
+    aMedia.SetCObjectValueL( KMPXMediaArrayContents, mediaArray );
+    aMedia.SetTObjectValueL( KMPXMediaArrayCount, mediaArray->Count() );
+    iNumSongAddedToPlaylist = mediaArray->Count();
+    CleanupStack::PopAndDestroy( mediaArray );
+    }
+
+// -----------------------------------------------------------------------------
+// Populates media object with information needed for save to
+// existing playlist
+// -----------------------------------------------------------------------------
+//
+CMPXMedia* CMPXCollectionViewHgImp::PopulateMediaLC(
+    const CMPXMedia& aMedia, TMPXItemId aCollectionId )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::PopulateMediaLC" );
+    CMPXMedia* entry = CMPXMedia::NewL();
+    CleanupStack::PushL( entry );
+    entry->SetTextValueL(
+        KMPXMediaGeneralTitle,
+        aMedia.ValueText( KMPXMediaGeneralTitle ) );
+    entry->SetTObjectValueL( KMPXMediaGeneralType, EMPXItem);
+    entry->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXSong );
+    entry->SetTObjectValueL( KMPXMediaGeneralId,
+        aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+    entry->SetTObjectValueL( KMPXMediaGeneralCollectionId, aCollectionId );
+    return entry;
+    }
+
+// -----------------------------------------------------------------------------
+// Handle rename playlist command
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoHandleRenamePlaylistL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoHandleRenamePlaylistL" );
+    const TDesC& uri = aMedia.ValueText( KMPXMediaGeneralUri );
+    TParsePtrC fn( uri );
+#ifdef _DEBUG
+    TPtrC ptr( fn.NameAndExt() );
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleRenamePlaylistL Original Uri = %S", &ptr );
+#endif
+    HBufC* playlistName = HBufC::NewLC( KMaxFileName );
+    TPtr playlistNamePtr = playlistName->Des();
+    const TDesC& title = aMedia.ValueText( KMPXMediaGeneralTitle );
+    TInt ret = iCommonUiHelper->LaunchRenameDialogL(
+        title, playlistNamePtr, fn.DriveAndPath() );
+    if ( ret )
+        {
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL( media );
+        media->SetTObjectValueL<TMPXGeneralType>(
+            KMPXMediaGeneralType, EMPXItem );
+        media->SetTObjectValueL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory, EMPXPlaylist );
+        TMPXItemId id( aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+        media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+        TParsePtrC newFn( *playlistName );
+        media->SetTextValueL( KMPXMediaGeneralTitle, newFn.NameAndExt() );
+        iCollectionUiHelper->RenameL( *media, this );
+        CleanupStack::PopAndDestroy( media );
+        }
+    CleanupStack::PopAndDestroy( playlistName );
+    }
+
+// ---------------------------------------------------------------------------
+// Set/clears the flags for item in database
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::UpdateDatabaseFlagL(
+    TInt aIndex, const CMPXMedia& aMedia, TUint aFlag,
+    TBool aSet, TBool aEnableInfoDialog )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::UpdateDatabaseFlagL" );
+    MPX_DEBUG3( "CMPXCollectionViewHgImp::UpdateDatabaseFlagL aFlag = 0x%x, aSet = %d", aFlag, aSet );
+    CMPXCommonListBoxArrayBase* array( iContainer->ListBoxArray() );
+    ASSERT( array );
+
+    // set the item as invalid
+    TUint flags( 0 );
+    if ( aSet )
+        {
+        flags = KMPXMediaGeneralFlagsSetOrUnsetBit;
+        }
+    flags |= aFlag;
+
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::UpdateDatabaseFlagL flag after 0x%x", flags );
+    CMPXMedia* entry = CMPXMedia::NewL();
+    CleanupStack::PushL( entry );
+    if ( aIndex > KErrNotFound )
+        {
+        MPX_DEBUG2( "CMPXCollectionViewHgImp::UpdateDatabaseFlagL using aIndex = %d", aIndex );
+        const CMPXMedia& media = array->MediaL( aIndex );
+        TMPXItemId id( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+        TMPXGeneralType type(
+            media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+        TMPXGeneralCategory category(
+            media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+        entry->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+        entry->SetTObjectValueL<TMPXGeneralType>(
+            KMPXMediaGeneralType, type );
+        entry->SetTObjectValueL<TMPXGeneralCategory>(
+            KMPXMediaGeneralCategory, category );
+        }
+    else
+        {
+        // try to look for the info inside aMedia
+        if ( aMedia.IsSupported( KMPXMediaGeneralId ) )
+            {
+            TMPXItemId id( aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+            entry->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+            }
+        if ( aMedia.IsSupported( KMPXMediaGeneralType ) )
+            {
+            TMPXGeneralType type(
+                aMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+            entry->SetTObjectValueL<TMPXGeneralType>(
+                KMPXMediaGeneralType, type );
+            }
+        if ( aMedia.IsSupported( KMPXMediaGeneralCategory ) )
+            {
+            TMPXGeneralCategory category(
+                aMedia.ValueTObjectL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory ) );
+            entry->SetTObjectValueL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory, category );
+            }
+        }
+    TUid collectionId( aMedia.ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId ) );
+    entry->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, collectionId );
+    entry->SetTObjectValueL<TUint>( KMPXMediaGeneralFlags, flags );
+
+    // Update the collection via CommandL
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet );
+    cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue );
+    TUid colId( entry->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId) );
+    cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid );
+    cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColSetMedia, entry );
+    iCollectionUtility->Collection().CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+
+    CleanupStack::PopAndDestroy( entry );
+    if ( aEnableInfoDialog && KMPXMediaGeneralFlagsIsInvalid == aFlag )
+        {
+        iCommonUiHelper->DisplayInfoNoteL( R_MPX_COLLECTION_INFO_FILE_NOT_FOUND );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get duration of current view
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::GetDurationL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::GetDurationL" );
+    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL( cpath );
+    cpath->Back();  // Container
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL(attrs);
+    iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo;
+    attrs.Append( KMPXMediaGeneralDuration );
+    iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+    CleanupStack::PopAndDestroy( &attrs );
+    CleanupStack::PopAndDestroy( cpath );
+    }
+
+// ---------------------------------------------------------------------------
+// Handles file check result
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoHandleFileCheckResultL(
+    TUid aViewToActivate, const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleFileCheckResultL" );
+    const TDesC& location = aMedia.ValueText( KMPXMediaGeneralUri );
+    if ( location.Length() == 0 || ConeUtils::FileExists( location ) )
+        {
+#ifdef SINGLE_CLICK_INCLUDED
+        HandleListBoxEventL( NULL, EEventItemSingleClicked );
+#else
+        HandleListBoxEventL( NULL, EEventItemClicked );   
+#endif
+        HBufC* buf = HBufC::NewLC( 5 ); // magic number, array granularity
+        buf->Des().AppendNum( iContainer->CurrentLbxItemIndex() );
+        // Activate view via View Framework
+        iViewUtility->ActivateViewL( aViewToActivate, buf );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    else
+        {
+        // mark database entry for this item as invalid
+        UpdateDatabaseFlagL( iContainer->CurrentLbxItemIndex(),
+            aMedia, KMPXMediaGeneralFlagsIsInvalid, ETrue );
+        }
+    }
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// Updates the middle softkey display
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::UpdateMiddleSoftKeyDisplayL( TInt aMskId )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::UpdateMiddleSoftKeyDisplayL" );
+    CEikButtonGroupContainer* cba = Cba();
+    if ( cba )
+        {
+        if ( !iContainer->CurrentListItemCount() ) // list is empty
+            {
+            // remove middle softkey label
+            iCommonUiHelper->RemoveMiddleSoftKeyLabel( *cba );
+            MPX_DEBUG1( "CMPXCollectionViewHgImp::UpdateMiddleSoftKeyDisplayL - remove label, list is empty" );
+            }
+        else if ( iContainer->CurrentSelectionIndicesL()->Count() ) // marked items
+            {
+            CFbsBitmap* bitmap = NULL;
+            CFbsBitmap* mask = NULL;
+            AknsUtils::CreateColorIconL(
+                AknsUtils::SkinInstance(),
+                KAknsIIDQgnPropMskMenu,
+                KAknsIIDQsnComponentColors,
+                EAknsCIQsnComponentColorsCG13,
+                bitmap,
+                mask,
+                AknIconUtils::AvkonIconFileName(),
+                EMbmAvkonQgn_prop_msk_menu,
+                EMbmAvkonQgn_prop_msk_menu_mask,
+                KRgbBlack);
+
+            CleanupStack::PushL(bitmap);
+            CleanupStack::PushL(mask);
+
+            // set middle softkey icon
+            iCommonUiHelper->SetMiddleSoftKeyIconL(*cba, bitmap, mask);
+
+            CleanupStack::PopAndDestroy(2, bitmap);
+            MPX_DEBUG1("CMPXCollectionViewHgImp::UpdateMiddleSoftKeyDisplayL - items marked, show icon");
+            }
+        else
+            {
+            // set middle softkey label
+            iCommonUiHelper->SetMiddleSoftKeyLabelL(
+                *cba,
+                aMskId,
+                EAknSoftkeyForwardKeyEvent );
+            iCurrentMskId = aMskId;
+            MPX_DEBUG1( "CMPXCollectionViewHgImp::UpdateMiddleSoftKeyDisplayL - label displayed" );
+            }
+        cba->DrawDeferred();
+        }
+    }
+#endif // __ENABLE_MSK
+
+
+// ---------------------------------------------------------------------------
+// Handles the completion of adding a playlist event
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleAddCompletedL(
+    CMPXMedia* aPlaylist, TInt aError )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleAddCompletedL" );
+    iAddingToNewPlaylist = EFalse;
+    iCommonUiHelper->DismissWaitNoteL();
+    HandleCommandL( EMPXCmdHandleExternalCommand );
+    if ( aError == KErrNone )
+        {
+        // Show confirmation note
+        if( aPlaylist->IsSupported( KMPXMediaGeneralId ) )
+            {
+            iPlaylistId = aPlaylist->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+            }
+        MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleAddCompletedL iPlaylistId = 0x%x", iPlaylistId.iId1 );
+        if ( iCurrentPlaylistOp != EMPXOpPLCreating )
+            {
+            HBufC* confirmTxt( NULL );
+            const TDesC& title( aPlaylist->ValueText( KMPXMediaGeneralTitle ) );
+            TMPlayerSecondaryDisplayNote noteId( EMPlayerNoteNone );
+            if ( iNumSongAddedToPlaylist > 1 )
+                {
+                confirmTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_MULTIPLE_TRACKS_ADDED_TO_PL,
+                    title, iNumSongAddedToPlaylist );
+                noteId = EMPlayerNoteAddManySongToPlaylist;
+                }
+            else
+                {
+                confirmTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_MUS_NOTE_TRACK_ADDED_TO_PL, title );
+                noteId = EMPlayerNoteAddSongToPlaylist;
+                }
+
+            CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote();
+
+            note->PublishDialogL(
+                noteId,
+                KMPlayerNoteCategory );
+
+            if ( iCoverDisplay )
+                {
+                CAknMediatorFacade* covercl = AknMediatorFacade( note );
+                if ( covercl )
+                    {
+                    covercl->BufStream() << title;
+                    if ( iNumSongAddedToPlaylist > 1 )
+                        {
+                        covercl->BufStream().WriteInt32L( iNumSongAddedToPlaylist );
+                        }
+                    }
+                }
+
+            note->ExecuteLD( *confirmTxt );
+            CleanupStack::PopAndDestroy( confirmTxt );
+
+            }
+        else // iCurrentPlaylistOp == EMPXOpPLCreating
+            {
+            // Re-open the collection, because we cannot
+            // depend on the change events that could be a race condition
+            // against this HandleAddCompleteL() callback!
+            //
+            DoIncrementalOpenL();
+            }
+        }
+    else
+        {
+        HandleError( aError );
+        }
+
+    delete aPlaylist;
+    if ( iContainer )
+        {
+        iContainer->ClearLbxSelection();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handles the completion of setting a media event.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleSetCompletedL( CMPXMedia* aMedia, TInt aError )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleSetCompletedL" );
+    delete aMedia;
+    if ( aError == KErrNone )
+        {
+        // save successful, set flag so that it can't be saved again
+        MPXTlsHelper::SetNeedSave( EFalse );
+        }
+    else
+        {
+        if (iContainer->IsInReorderMode())
+            {
+            DeactivateReorderGrabbedModeL(ETrue);
+            }
+        HandleError( aError );
+        }
+    if ( iIsSavingReorderPlaylist )
+        {
+        // change messages are ignored during save command,
+        // when save is complete, it should open the collection again to refresh
+        // display data
+        DoIncrementalOpenL();
+        iIsSavingReorderPlaylist = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle playback message
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoHandlePlaybackMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        switch ( event )
+            {
+            case TMPXPlaybackMessage::EActivePlayerChanged:
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                MPX_DEBUG2( "CMPXCollectionViewHgImp::HandlePlaybackMessageL - EStateChanged(%d)", type );
+                UpdatePlaybackStatusL();
+                break;
+                }
+            case TMPXPlaybackMessage::EError:
+                {
+                if ( iCommonUiHelper )
+                    {
+                    iCommonUiHelper->DismissWaitNoteL();
+                    HandleCommandL( EMPXCmdHandleExternalCommand );
+                    }
+                if ( iIsDeleting )
+                    {
+                    iCollectionUiHelper->Cancel();
+                    iIsDeleting = EFalse;
+                    // if delete is interrupted, reopen
+                    DoIncrementalOpenL();
+                    }
+                MPX_DEBUG2( "CMPXCollectionViewHgImp::HandlePlaybackMessageL Error = %d", data );
+                break;
+                }
+            case TMPXPlaybackMessage::EPlayerUnavailable:
+                {
+                if ( iUpnpFrameworkSupport )
+                    {
+                    if ( data == KErrNotFound )
+                        {
+                        if ( iViewUtility->ActiveViewType() ==
+                            TUid::Uid( KMPXPluginTypeCollectionUid ) )
+                            {
+                            if ( iSubPlayerName )
+                                {
+                                HBufC* dialogText = StringLoader::LoadLC( R_MPX_COLLECTION_NOTE_REMOTE_CONNECTION_FAILED,
+                                                                          *iSubPlayerName );
+                                CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+                                errNote->SetTimeout(CAknNoteDialog::ELongTimeout);
+                                errNote->ExecuteLD( *dialogText );
+                                CleanupStack::PopAndDestroy( dialogText );
+                                }
+                            }
+                        }
+                    }
+                // else we don't show any error note
+                break;
+                }
+            default:
+                {
+                // ignore other messages
+                break;
+                }
+            }
+        // Fix EBLI-7CFE4D press select key very quick cause System Error KErrArgument
+        if (event != TMPXPlaybackMessage::ECommandReceived)
+            {
+            iHandlingKeyEvent = EFalse;
+            }
+        }
+    else
+        {
+        iHandlingKeyEvent = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle collection message
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoHandleCollectionMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        MPX_DEBUG4( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL Event = %d, Type() = %d, data = %d",
+            event, type, data );
+
+        // Only handle collection messages while collection view is in focus
+        // and not transitioning views
+        if( iContainer )
+            {
+
+            if ( event == TMPXCollectionMessage::EPathChanged &&
+                 type == EMcPathChangedByOpen &&
+                 data == EMcContainerOpened
+                 )
+                { // Open new entries
+                MPX_DEBUG1( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL calling OpenL EMcPathChangedByOpen" );
+                if ( iContainer->IsInReorderMode() )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL canceling reorder mode" );
+                    // cancel reorder mode if path has changed
+                    ProcessCommandL( EMPXCmdReorderDone );
+                    }
+                if( iContainer->CurrentSelectionIndicesL()->Count() )
+                    {
+                    HandleCommandL( EAknUnmarkAll );
+                    }
+
+                // Incremental Open when browsing to the next level
+                DoIncrementalOpenL();
+                }
+            else if ( event == TMPXCollectionMessage::EPathChanged &&
+                      type == EMcPathChangedByCollectionChange )
+                {
+                // Re-Fetch entries only if we are in playlist
+                // creation idle stage. Ignore change messages during playlist op
+                // because there are race conditions and we don't know
+                // which handle open is actually opening the playlist!
+                //
+                // don't call openL if it's currently deleting
+                // don't call openL if saving after reorder
+                // don't call openL if renaming
+                if( iCurrentPlaylistOp == EMPXOpPLIdle  && !iIsDeleting
+                    && !iIsSavingReorderPlaylist && iSetMediaLCount == KErrNotFound )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL calling OpenL EMcPathChangedByCollectionChange" );
+                    if( iContainer->CurrentSelectionIndicesL()->Count() )
+                        {
+                        HandleCommandL( EAknUnmarkAll );
+                        }
+                    // dismiss find pane if it's visible
+                    if( iContainer->FindBoxVisibility() )
+                        {
+                        iContainer->EnableFindBox( EFalse );
+                        }
+                    DoIncrementalOpenL();
+                    }
+                else
+                    {
+                    MPX_DEBUG4( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL PathChange Message Ignored iIsDeleting = %d, iCurrentPlaylistOp = %d, iIsSavingReorderPlaylist = %d", iIsDeleting, iCurrentPlaylistOp, iIsSavingReorderPlaylist );
+                    MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL PathChange Message Ignored iSetMediaLCount = %d", iSetMediaLCount );
+                    }
+                }
+            else if ( event == TMPXCollectionMessage::EPathChanged &&
+                 type == EMcPathChangedByOpen &&
+                 data == EMcItemOpened)
+                {
+                // opened a song, revert back one level when collection view
+                // is activated again
+                iIncrementalOpenUtil->Stop();
+                iBackOneLevel = ETrue;
+                }
+            else if( event == TMPXCollectionMessage::EBroadcastEvent )
+                {
+                MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL - broadcast type = %d", type );
+                if ( type == EMcMsgDiskRemoved &&
+                     iViewUtility->ActiveViewType() != TUid::Uid(KMPXPluginTypeWaitNoteDialogUid) )
+                    {
+                    AknDialogShutter::ShutDialogsL( *CEikonEnv::Static() );
+                    }
+                if ( iConfirmationDlg && ( type == EMcMsgUSBMTPStart || type == EMcMsgUSBMassStorageStart ) )
+                    {
+                    TKeyEvent kEvent;
+                    kEvent.iCode = EKeyEscape;
+                    kEvent.iScanCode = EStdKeyEscape;
+                    iConfirmationDlg->OfferKeyEventL( kEvent, EEventKey );
+                    }
+
+                }
+        else if ( event == TMPXCollectionMessage::EFocusChanged && iContainer && iCoverDisplay )
+            {
+            if ( data != KErrNotFound &&
+                 data < iContainer->CurrentListItemCount() &&
+                 !iIgnoreNextFocusChangedMessage )
+                {
+                MPX_DEBUG2( "CMPXCollectionViewHgImp::DoHandleCollectionMessageL - EFocusChanged to %d", data );
+                iContainer->SetLbxCurrentItemIndexAndDraw( data );
+                }
+            iIgnoreNextFocusChangedMessage = EFalse;
+            }
+            } // if iContainer
+
+        // System events need to be checked regardless of iContainer
+        //
+        if( event == TMPXCollectionMessage::EBroadcastEvent )
+            {
+            if((type == EMcMsgUSBMassStorageStart ) || (type == EMcMsgUSBMTPEnd) || (type == EMcMsgRefreshEnd))
+                {
+                iCollectionCacheReady = EFalse;
+                }
+            // USB flags
+            //
+            if( type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart )
+                {
+                iUSBOnGoing = ETrue;
+                }
+            else if( type == EMcMsgUSBMassStorageEnd || type == EMcMsgUSBMTPEnd )
+                {
+                iUSBOnGoing = EFalse;
+                RProperty::Set( KMPXViewPSUid,
+                                KMPXUSBUnblockingPSStatus,
+                                EMPXUSBUnblockingPSStatusUninitialized );
+                }
+            else if( type == EMcMsgUSBMTPNotActive )
+                {
+                RProperty::Set( KMPXViewPSUid,
+                                KMPXUSBUnblockingPSStatus,
+                                EMPXUSBUnblockingPSStatusActive );
+				}
+
+            if ( iIsEmbedded && type == EMcMsgUSBMassStorageEnd )
+            	{
+            	DoIncrementalOpenL();
+            	}
+            } // if event == EBroadcastEvent
+        } // if ( KMPXMessageGeneral == id )
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::DoIncrementalOpenL
+// Start the incremental fetching algorithm
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoIncrementalOpenL( TBool aShowWaitDlg )
+    {
+     MPX_FUNC( "CMPXCollectionViewHgImp::DoIncrementalOpenL" );
+    // Show the opening note if > 1.5 seconds
+    if( aShowWaitDlg )
+        {
+        //StartWaitNoteL( EMPXOpeningNote );
+        }
+
+    // Cancel any reads
+    iIncrementalOpenUtil->Stop();
+
+    // Start the read
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    TArray<TMPXAttribute> ary = attrs.Array();
+    iIncrementalOpenUtil->SetDelay( KIncrementalDelayNone );
+    iIncrementalOpenUtil->StartL( ary, KIncrementalFetchBlockSize,
+                                  KErrNotFound, CMPXCollectionOpenUtility::EFetchNormal );
+    iIncrementalOpenUtil->SetDelay( KIncrementalDelayHalfSecond );
+    CleanupStack::PopAndDestroy( &attrs );
+
+    // Default empty text
+    iContainer->SetLbxEmptyTextL( KNullDesC );
+    iContainer->DrawDeferred();
+    iFirstIncrementalBatch = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// Start wait note for delayed action due to the items not ready
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::StartDelayedActionL(
+    TInt aCommand, TDesC& aNote,TBool aSkipDisplay  )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::StartDelayedActionL" );
+    HandleCommandL( EMPXCmdIgnoreExternalCommand );
+    if(!aSkipDisplay)
+        {
+    	iCommonUiHelper->ShowWaitNoteL( aNote, R_AVKON_SOFTKEYS_EMPTY, ETrue, this );
+        }
+
+    iCachedCommand = aCommand;
+    const CArrayFix<TInt>* array (
+        iContainer->CurrentSelectionIndicesL() ); // not owned
+    TInt arrayCount( array->Count() );
+    iCachedSelectionIndex->Reset();
+    for ( TInt i = 0; i < arrayCount; i++ )
+        {
+        iCachedSelectionIndex->AppendL( array->At( i ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MProgressDialogCallback
+// Callback method. Get's called when a dialog is dismissed
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DialogDismissedL( TInt aButtonId )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DialogDismissedL" );
+    if ( iCommandInitiator )
+        {
+        iCommandInitiator->CancelCommand( KMediatorSecondaryDisplayDomain,
+                                      KMPlayerNoteCategory,
+                                      iWaitNoteId );
+        }
+
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyCancel:
+            {
+            iIsWaitNoteCanceled = ETrue;
+            if( iIsDeleting )
+                {
+                iCollectionUiHelper->Cancel();
+                iIsDeleting = EFalse;
+                // if delete is interrupted, reopen
+                }
+            else if ( iSetMediaLCount > 0 )
+                {
+                // cancel the async request
+                iCollectionUtility->Collection().CancelRequest();
+                iSetMediaLCount = KErrNotFound;
+
+                DoIncrementalOpenL();
+                }
+            else if ( iIsAddingToPlaylist )
+                {
+                // cancel incremental adding of songs
+                iCommonUiHelper->CancelCollectionOperation();
+                iIsAddingToPlaylist = EFalse;
+                }
+            break;
+            }
+        default:
+            {
+            // no special handling for other cases
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection message
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleCollectionMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d a folder
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleOpenL(
+    const CMPXMedia& aEntries,
+    TInt aIndex,
+    TBool aComplete,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleOpenL 4" );
+    iHandlingKeyEvent = EFalse;
+    if( aError == KErrNone )
+        {
+        if ( !iContainer )
+            {
+            // View is not active. Ignore.
+            return;
+            }
+        // handle deferred notification when view is in focus but not for view transitions
+        if ( iActivateBackStepping )
+            {
+	        HandleBacksteppingActivation();
+		    }
+
+        iCollectionReady = aComplete;
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        if( iPodcast && !iDisablePodcasting )
+            {
+            iPodcast = EFalse;
+            UpdateListBoxL( aEntries, KMusicMenuPodcastMenuItemIndex, aComplete );
+            ( void ) aIndex;
+            }
+        else
+            {
+            UpdateListBoxL( aEntries, aIndex, aComplete );
+            }
+#else
+        UpdateListBoxL( aEntries, aIndex, aComplete );
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+        if ( iContainer )
+            {
+            iContainer->ContentIsReady( ETrue );
+            // this has to be done after the list box media is properly
+            // updated
+            if ( !iContainer->FindBoxVisibility() )
+                {
+                MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleOpenL find box not visible" );
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+                CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+                CleanupStack::PushL( cpath );
+
+                CMPXCommonListBoxArrayBase* listboxArray(
+                    iContainer->ListBoxArray() );
+                const CMPXMedia& media( listboxArray->ContainerMedia() );
+
+                TMPXGeneralType containerType( EMPXNoType );
+                if ( media.IsSupported( KMPXMediaGeneralType ) )
+                    {
+                    containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+                    }
+
+                TMPXGeneralCategory containerCategory( EMPXNoCategory );
+                if ( media.IsSupported( KMPXMediaGeneralCategory ) )
+                    {
+                    containerCategory = media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+                    }
+                TBool landscapeOrientation = Layout_Meta_Data::IsLandscapeOrientation();
+                CEikButtonGroupContainer* cba = Cba();
+                if ( cba && containerType == EMPXGroup && containerCategory == EMPXAlbum && landscapeOrientation )
+                    {
+                    cba->SetCommandSetL( R_MPX_COLLECTION_TRANSPARENT_CBA );
+                    cba->MakeVisible( EFalse );
+					cba->DrawDeferred();
+                    }
+                else if ( cba )
+                    {
+                    cba->SetCommandSetL(
+                        ( cpath->Levels() == 3 && !iIsEmbedded ) ?
+                        R_MPX_OPTIONS_HIDE_CBA : R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                    cba->MakeVisible( ETrue );
+                    cba->DrawDeferred();
+                    }
+
+                CleanupStack::PopAndDestroy(cpath);
+#else
+                CEikButtonGroupContainer* cba = Cba();
+                if ( cba )
+                    {
+                    cba->SetCommandSetL(
+                        ( iViewUtility->ViewHistoryDepth() == 1 && !iIsEmbedded ) ?
+                        R_AVKON_SOFTKEYS_OPTIONS_EXIT : R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                    cba->DrawDeferred();
+                    }
+#endif
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleOpenL find box visible" );
+                }
+
+            CMPXCommonListBoxArrayBase* array(
+                iContainer->ListBoxArray() );
+            const CMPXMedia& containerMedia = array->ContainerMedia();
+            if ( containerMedia.IsSupported( KMPXMediaGeneralTitle ) )
+                {
+                delete iTitle;
+                iTitle = NULL;
+                iTitle = containerMedia.ValueText( KMPXMediaGeneralTitle ).AllocL();
+                }
+            if ( !iContainer->IsInReorderMode() &&
+                !iAddingSong &&
+                !iInAlbumArtDialog &&
+                !iInSongDetails )
+                {
+                UpdateTitlePaneL();
+                }
+
+            TMPXGeneralType containerType( EMPXNoType );
+            if( containerMedia.IsSupported( KMPXMediaGeneralType ) )
+                {
+                containerType = containerMedia.ValueTObjectL<TMPXGeneralType>(
+                                KMPXMediaGeneralType );
+                }
+
+            TMPXGeneralCategory containerCategory( EMPXNoCategory );
+            if( containerMedia.IsSupported( KMPXMediaGeneralCategory ) )
+                {
+                containerCategory = containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                                    KMPXMediaGeneralCategory );
+                }
+            MPX_DEBUG3( "CMPXCollectionViewHgImp::HandleOpenL container type = %d, category = %d", containerType, containerCategory );
+
+            CEikMenuBar* menuBar( MenuBar() );
+            TInt resId( KErrNotFound );
+#ifdef __ENABLE_MSK
+            TInt mskId( R_QTN_MSK_OPEN );
+#endif // __ENABLE_MSK
+            if ( iIsEmbedded )
+                {
+                // embedded playlist view
+                iContainer->EnableMarking( ETrue );
+                menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_EMBEDDED_PLAYLIST_VIEW );
+                resId = R_MPX_COLLECTION_SONG_LBX_EMPTYTEXT;
+#ifdef __ENABLE_MSK
+                mskId = R_QTN_MSK_PLAY;
+#endif // __ENABLE_MSK
+                }
+            else
+                {
+                if ( containerType == EMPXGroup && containerCategory == EMPXCollection )
+                    {
+                    // music menu view
+                    iContainer->EnableMarking( EFalse );
+                    menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_MUSIC_MENU );
+                    }
+                else if ( ( containerType == EMPXGroup && containerCategory == EMPXPlaylist ) || // playlist view
+                    ( containerType == EMPXGroup && containerCategory == EMPXArtist ) || // artist view
+                    ( containerType == EMPXItem && containerCategory == EMPXArtist ) || // artist/album view
+                    ( containerType == EMPXGroup && containerCategory == EMPXAlbum ) || // album view
+                    ( containerType == EMPXGroup && containerCategory == EMPXGenre ) || // genre view
+                    ( containerType == EMPXGroup && containerCategory == EMPXComposer ) ) // composer view
+                    {
+                    iContainer->EnableMarking( EFalse );
+                    menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_NO_MARKING );
+                    switch ( containerCategory )
+                        {
+                        case EMPXArtist:
+                            {
+                            if ( containerType == EMPXGroup )
+                                {
+                                // artist view
+                                resId = R_MPX_COLLECTION_ARTIST_LBX_EMPTYTEXT;
+                                }
+                            else if ( containerType == EMPXItem )
+                                {
+                                // artist/album view
+                                resId = R_MPX_COLLECTION_ALBUM_LBX_EMPTYTEXT;
+                                }
+                            else
+                                {
+                                // should not reach here
+                                ASSERT( 0 );
+                                }
+                            break;
+                            }
+                        case EMPXAlbum:
+                            {
+                            // album view
+                            resId = R_MPX_COLLECTION_ALBUM_LBX_EMPTYTEXT;
+                            break;
+                            }
+                        case EMPXGenre:
+                            {
+                            // genre view
+                            resId = R_MPX_COLLECTION_GENRE_LBX_EMPTYTEXT;
+                            break;
+                            }
+                        case EMPXComposer:
+                            {
+                            // composer view
+                            resId = R_MPX_COLLECTION_COMPOSER_LBX_EMPTYTEXT;
+                            break;
+                            }
+                        case EMPXPlaylist:
+                            {
+                            // no special handling for playlist
+                            break;
+                            }
+                        default:
+                            {
+                            // should not reach here
+                            ASSERT( 0 );
+                            break;
+                            }
+                        }
+                    }
+                else
+                    {
+                    // tracks view
+#ifdef SINGLE_CLICK_INCLUDED
+                    iContainer->EnableMarking( EFalse );
+                    menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR_NO_MARKING );
+#else
+                    iContainer->EnableMarking( ETrue );
+                    menuBar->SetMenuTitleResourceId( R_MPX_COLLECTION_VIEW_MENUBAR );
+#endif
+                    resId = R_MPX_COLLECTION_SONG_LBX_EMPTYTEXT;
+#ifdef __ENABLE_MSK
+                    mskId = R_QTN_MSK_PLAY;
+#endif // __ENABLE_MSK
+                    }
+                }
+
+            if ( resId != KErrNotFound )
+                {
+                HBufC* emptyText = StringLoader::LoadLC( resId );
+                iContainer->SetLbxEmptyTextL( *emptyText );
+                CleanupStack::PopAndDestroy( emptyText );
+                iContainer->DrawDeferred();
+                }
+
+#ifdef __ENABLE_MSK
+            // set middle softkey label display
+            UpdateMiddleSoftKeyDisplayL( mskId );
+#endif // __ENABLE_MSK
+
+            switch ( iCurrentPlaylistOp )
+                {
+                case EMPXOpPLCreating:
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleOpenL searching for playlist" );
+                    // after creating a new playlist
+                    // playlist created callback will always come before this
+                    // iPlaylistId should have already been set, check to see if
+                    // we're in playlist view
+                    if ( iPlaylistId != 0 &&
+                        containerType == EMPXGroup && containerCategory == EMPXPlaylist )
+                        {
+                        const CMPXMediaArray& mediaArray = array->MediaArray();
+                        TInt arrayCount( mediaArray.Count() );
+                        for ( TInt i = 0; i < arrayCount; i++ )
+                            {
+                            CMPXMedia* origMedia( mediaArray.AtL( i ) );
+                            TMPXItemId plId = origMedia->ValueTObjectL<TMPXItemId>(
+                                KMPXMediaGeneralId );
+                            if ( plId == iPlaylistId )
+                                {
+                                MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleOpenL Playlist match found 0x%x", iPlaylistId.iId1 );
+                                iCurrentPlaylistOp = EMPXOpPlOpening;
+                                iContainer->SetLbxCurrentItemIndex( i );
+                                HandleListBoxEventL( NULL, // not used
+                                    EEventEnterKeyPressed );
+                                break;
+                                }
+
+                            // Stay in Creating state as every OpenL()
+                            // will be called back with a HandleOpenL()
+                            // During playlist creation, there is a race condition
+                            // between HandleCollectionMessage() -> Collection change -> OpenL()
+                            // and playlist added's  OpenL()
+                            }
+                        }
+                    break;
+                    }
+                case EMPXOpPlOpening:
+                    {
+                    // check how many songs are stored in collection
+                    iCurrentMediaLOp = EMPXOpMediaLNewPlaylistCollectionSongCount;
+                    CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+                    CleanupStack::PushL( path );
+                    path->Back();
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL( attrs );
+                    attrs.Append( KMPXMediaColDetailNumberOfItems );
+                    iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+                    CleanupStack::PopAndDestroy( &attrs );
+                    CleanupStack::PopAndDestroy( path );
+                    iCurrentPlaylistOp = EMPXOpPLIdle;
+                    break;
+                    }
+                case EMPXOpPLIdle: // fall through
+                default:
+                    {
+                    // Update Duration
+                    //
+                    if ( !iContainer->IsInReorderMode() && !iAddingSong )
+                        {
+                        GetDurationL();
+                        }
+                    break;
+                    }
+                }
+            iPlaylistId = 0;
+            }
+        }
+    else
+        {
+        if ( iContainer )
+            {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+            CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+            CleanupStack::PushL( cpath );
+
+            // media is not valid until the first HandleOpenL call
+            CEikButtonGroupContainer* cba = Cba();
+            if ( cba )
+                {
+                cba->SetCommandSetL(
+                    ( cpath->Levels() == 2 && !iIsEmbedded ) ?
+                    R_AVKON_SOFTKEYS_OPTIONS_BACK : R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                cba->DrawDeferred();
+                }
+
+            CleanupStack::PopAndDestroy(cpath);
+#else
+            CEikButtonGroupContainer* cba = Cba();
+            if ( cba )
+                {
+                cba->SetCommandSetL(
+                    ( iViewUtility->ViewHistoryDepth() == 1 && !iIsEmbedded ) ?
+                    R_AVKON_SOFTKEYS_OPTIONS_EXIT : R_AVKON_SOFTKEYS_OPTIONS_BACK );
+                cba->DrawDeferred();
+                }
+
+#endif
+            }
+        if (aError == KErrNotFound)
+            {
+            HandleCommandL(EAknSoftkeyBack);
+            }
+        else
+            {
+            HandleError( aError );
+            }
+        }
+    if ( iIsDeleting )
+        {
+        // nothing else to delete
+        iIsDeleting = EFalse;
+        if ( iProgressDialog )
+            {
+            iProgressDialog->ProcessFinishedL();
+            }
+        HandleCommandL( EMPXCmdHandleExternalCommand );
+        }
+    if ( iPlayIndex > KErrNotFound )
+        {
+        CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+        CleanupStack::PushL( cpath );
+        cpath->Set( iPlayIndex );
+        iPlayIndex = KErrNotFound;
+        iCollectionUtility->Collection().OpenL( *cpath, EMPXOpenPlaylistOnly );
+        iFirstIncrementalBatch = ETrue;
+        CleanupStack::PopAndDestroy( cpath );
+        }
+    if ( ( iCachedCommand != KErrNotFound ) && iCollectionReady )
+        {
+        if((iCachedCommand != EMPXCmdRemove) && (iCachedCommand != EMPXCmdCommonDelete) && (iCachedCommand != EMPXCmdDelete) )
+            {
+        iCommonUiHelper->DismissWaitNoteL();
+        HandleCommandL( EMPXCmdHandleExternalCommand );
+            }
+        else
+            {
+            iCachedCommand = EMPXCmdRemove;
+            }
+        if( iContainer )
+            {
+            iContainer->SetCurrentSelectionIndicesL( iCachedSelectionIndex );
+            }
+        HandleCommandL( iCachedCommand );
+        iCachedSelectionIndex->Reset();
+        iCachedCommand = KErrNotFound;
+        }
+
+    // Close the opening wait note, if the current item is valid or all open completes
+    if ( iContainer && !aComplete )
+        {
+        // if the list is empty, it shouldn't go in this path as aComplete should be ETrue
+        CMPXCommonListBoxArrayBase* listboxArray(
+            iContainer->ListBoxArray() );
+        const CMPXMedia& currentMedia( listboxArray->MediaL( aIndex ) );
+        }
+    else
+        {
+        if ( EMPXOpeningNote == iNoteType || EMPXImmediatelyOpeningNote == iNoteType )
+            {
+            CloseWaitNoteL();
+            }
+        }
+
+    MPX_PERF_CHECKPT("Collection View opened");
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleOpenL(
+    const CMPXCollectionPlaylist& /*aPlaylist*/,
+    TInt /*aError*/ )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleOpenL 2" );
+    iHandlingKeyEvent = EFalse;
+    // Do Nothing: playback/fetch client should handle this stage
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle media properties
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleCollectionMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleCollectionMediaL" );
+
+    TInt nextMediaLOp( EMPXOpMediaLIdle );
+    if ( aError == KErrNone )
+        {
+        switch ( iCurrentMediaLOp )
+            {
+            case EMPXOpMediaLGetContainerInfo:
+                {
+                delete iDuration;
+                iDuration = NULL;
+                if ( aMedia.IsSupported( KMPXMediaGeneralDuration ) )
+                    {
+                    TInt duration(
+                        aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralDuration ) );
+                    if ( duration > 0 )
+                        {
+                        // only display duration when the list contains something
+                        iDuration = iCommonUiHelper->DisplayableDurationInTextL( duration/KMilliSecondsToSeconds );
+                        }
+                    }
+                UpdateNaviPaneL();
+                break;
+                }
+            case EMPXOpMediaLSend:
+                {
+                DoHandleSendL( aMedia );
+                if ( !iContainer->FindBoxVisibility() )
+                    {
+                    iContainer->RestoreFindBoxPopupCBA();
+                    }
+                break;
+                }
+            case EMPXOpMediaLSongDetailsFileCheck:
+                {
+                if ( iContainer )
+                    {
+                    DoHandleFileCheckResultL(
+                        TUid::Uid( KMPXPluginTypeMetadataEditorUid ), aMedia );
+                    if ( !iContainer->FindBoxVisibility() )
+                        {
+                        iContainer->RestoreFindBoxPopupCBA();
+                        }
+                    }
+                break;
+                }
+            case EMPXOpMediaLAlbumArtFileCheck:
+                {
+                if ( iContainer )
+                    {
+                    DoHandleFileCheckResultL(
+                        TUid::Uid( KMPXPluginTypeAlbumArtEditorUid ), aMedia );
+
+                    if ( !iContainer->FindBoxVisibility() )
+                        {
+                        iContainer->RestoreFindBoxPopupCBA();
+                        }
+                    }
+                break;
+                }
+            case EMPXOpMediaLCollectionDetails:
+                {
+                DoShowCollectionDetailsL( aMedia );
+                break;
+                }
+            case EMPXOpMediaLPlaylistDetails:
+                {
+                DoShowPlaylistDetailsL( aMedia );
+                break;
+                }
+            case EMPXOpMediaLRenamePlaylist:
+                {
+                DoHandleRenamePlaylistL( aMedia );
+                break;
+                }
+            case EMPXOpMediaLNewPlaylistCollectionSongCount:
+                {
+                TInt songsCount( 0 );
+                if ( aMedia.IsSupported( KMPXMediaColDetailNumberOfItems ) )
+                    {
+                    songsCount =
+                        aMedia.ValueTObjectL<TInt>( KMPXMediaColDetailNumberOfItems );
+                    }
+                if ( songsCount > 0 )
+                    {
+                    // show add songs prompt only if collection contains
+                    // at least one song
+                    MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleCollectionMediaL openning add songs view, collection contains %d songs", songsCount );
+                    CAknQueryDialog* confirmationDlg = CAknQueryDialog::NewL(
+                        CAknQueryDialog::EConfirmationTone );
+                    CleanupStack::PushL( confirmationDlg );
+                    HBufC* promptTxt = StringLoader::LoadLC(
+                        R_MPX_QTN_NMP_QUERY_ADD_SONGS );
+                    confirmationDlg->SetPromptL( *promptTxt );
+                    CleanupStack::PopAndDestroy( promptTxt );
+                    confirmationDlg->PublishDialogL(
+                        EMPlayerQueryAddSongsToPlaylist,
+                        KMPlayerNoteCategory);
+                    CleanupStack::Pop( confirmationDlg );
+                    AppUi()->StopDisplayingMenuBar();
+                    if ( confirmationDlg->ExecuteLD( R_MPX_CUI_ADD_SONGS_CONFIRMATION_QUERY ) )
+                        {
+                        HandleCommandL( EMPXCmdAddSongs );
+                        iCurrentMediaLOp = EMPXOpMediaLNewPlaylistCollectionSongCount;
+                        }
+                    }
+#ifdef _DEBUG
+                else
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCollectionMediaL collection empty, not opening add songs view" );
+                    }
+#endif // _DEBUG
+                break;
+                }
+            case EMPXOpMediaLCopyToRemote:
+                {
+                if ( iUpnpFrameworkSupport )
+                    {
+                    DoHandleCopyToRemoteL( aMedia );
+                    }
+                break;
+                }
+
+            case EMPXOpMediaLFindInMusicShopSongDetails:
+                {
+                const TDesC& location = aMedia.ValueText( KMPXMediaGeneralUri );
+                if ( location != KNullDesC && ConeUtils::FileExists( location ) )
+                    {
+                    HBufC* buf = HBufC::NewLC( 5 ); // magic number to hold index value
+                    buf->Des().AppendNum(
+                        iContainer->CurrentLbxItemIndex() );
+                    // set current list box index
+                    SetParamL( buf );
+                    CleanupStack::PopAndDestroy( buf );
+
+                    DoGetSongMediaPropertyL();
+                    // Set the next operation to handle MediaL completed.
+                    nextMediaLOp = EMPXOpMediaLFindInMusicShopMediaLCompleted;
+                    }
+                else
+                    {
+                    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+                    CleanupStack::PushL( cpath );
+                    TInt currentDepth( cpath->Levels() );
+                    CleanupStack::PopAndDestroy( cpath );
+                    CMPXCommonListBoxArrayBase* listboxArray =
+                        iContainer->ListBoxArray();
+                    TInt currentIndex =
+                        iContainer->CurrentLbxItemIndex();
+                    const CMPXMedia& currentMedia = listboxArray->MediaL( currentIndex );
+                    TMPXGeneralCategory category(
+                        currentMedia.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+                    const CMPXMediaArray& mediaAry( listboxArray->MediaArray() );
+                    CMPXMedia* origMedia( mediaAry.AtL( currentIndex ) );
+                    const TDesC& title( origMedia->ValueText( KMPXMediaGeneralTitle ) );
+                    if ( ( title.Length() > 0 ) && ( title.Length() < KMaxFileName ) )
+                        {
+                        switch ( category )
+                            {
+                            case EMPXAlbum:
+                                {
+                                const CMPXMedia& containerMedia = listboxArray->ContainerMedia();
+                                // The Artist/Album View Title shows the Artist name
+                                const TDesC& titleArtist =
+                                        containerMedia.ValueText( KMPXMediaGeneralTitle );
+                                HBufC* unknownArtistText =
+                                        StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_ARTIST );
+                                // 4 is the level of Artist and Album View
+                                if ( currentDepth == 4 && titleArtist != unknownArtistText->Des() )
+                                    {
+                                    DoFindInMusicShopL(KCategoryEmpty, titleArtist, title); // Artist and Album View
+                                    }
+                                else
+                                    {
+                                    DoFindInMusicShopL(KCategoryEmpty, KCategoryEmpty, title); // Album View
+                                    }
+                                CleanupStack::PopAndDestroy( unknownArtistText );
+                                break;
+                                }
+                            case EMPXArtist:
+                                {
+                                DoFindInMusicShopL(KCategoryEmpty, title, KCategoryEmpty);  // Artist only
+                                break;
+                                }
+                            case EMPXSong:
+                                {
+                                DoFindInMusicShopL(title, KCategoryEmpty, KCategoryEmpty);  // Song only
+                                break;
+                                }
+                            default:
+                                {
+                                break;
+                                }
+                            } // switch
+                        } // if
+                    }  // else
+                break;
+                }
+            case EMPXOpMediaLFindInMusicShopMediaLCompleted:
+                {
+                // call DoFindInMusicShop when SongName, AlbumName, and ArtistName are
+                // available at this point
+                DoFindInMusicShopL(
+                    aMedia.ValueText( KMPXMediaGeneralTitle ),
+                    aMedia.ValueText( KMPXMediaMusicArtist ),
+                    aMedia.ValueText( KMPXMediaMusicAlbum ) );
+                break;
+                }
+
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else
+        {
+        /* If a Composer,Artist or Album consists single song.
+         * On changing the song details(composer+genre or album name+genre)
+         * No more record exist corresponding to previous data.
+         * In this case no need to show Error Message. */
+        if( aError != KErrNotFound)
+            {
+            HandleError( aError );
+            }
+        else
+            {
+            MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleCollectionMediaL ERROR: %d",aError);
+            }
+        }
+    if ( iCurrentMediaLOp == EMPXOpMediaLNewPlaylistCollectionSongCount )
+        {
+        iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo;
+        }
+    else
+        {
+        iCurrentMediaLOp = nextMediaLOp;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionHelperObserver
+// Callback function after executing a command
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleCommandComplete(CMPXCommand* /*aCommandResult*/,
+                                                  TInt /*aError*/)
+    {
+    // Make sure we are doing the right operation
+    if( iSetMediaLCount )
+        {
+        iSetMediaLCount--;
+        if ( iSetMediaLCount < 1 )
+            {
+            TRAP_IGNORE( HandleRenameOpCompleteL() );
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// From MMPXCollectionHelperObserver
+// Callback function to signal that adding a file is complete
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleAddFileCompleteL( TInt aErr )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleAddFileCompleteL" );
+    if ( aErr != KErrNone )
+        {
+        HandleError( aErr );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCHelperObserver
+// Handles the completion of helper events
+// ---------------------------------------------------------------------------
+//
+
+void CMPXCollectionViewHgImp::HandleOperationCompleteL( TCHelperOperation aOperation,
+                                           TInt aErr,
+                                           void* aArgument )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleOperationCompleteL" );
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleOperationCompleteL aErr = %d", aErr );
+    switch( aOperation )
+        {
+        case EDeleteOp:
+            {
+            MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleOperationCompleteL Delete operation" );
+            // do not dismiss the wait note until HandleOpenL is called,
+            // unless it's error case
+            delete iCurrentCba;
+            iCurrentCba = NULL;
+            if( aErr == KErrInUse )
+                {
+                if ( !iIsWaitNoteCanceled )
+                    {
+                    // only dismiss wait note if the wait note is not
+                    // canceled
+                    if ( iProgressDialog )
+                        {
+                        iProgressDialog->ProcessFinishedL();
+                        }
+                    HandleCommandL( EMPXCmdHandleExternalCommand );
+                    iIsWaitNoteCanceled = EFalse;
+                    }
+                if ( iIsDeleting )
+                    {
+                    HBufC* text = StringLoader::LoadLC(
+                        ( iContainer->CurrentSelectionIndicesL()->Count() == 0 ) ?
+                        R_MPX_COLLECTION_NOTE_DELETE_FAIL : // Single selection
+                        R_MPX_COLLECTION_NOTE_DELETE_FAIL_MULTI_SELECTION ); // Multi selection
+
+                    CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+                    dlg->ExecuteLD( *text );
+                    CleanupStack::PopAndDestroy( text );
+                    }
+                iIsDeleting = EFalse;
+                }
+            else if ( aErr != KErrNone )
+                {
+                iIsDeleting = EFalse;
+                if ( !iIsWaitNoteCanceled )
+                    {
+                    if ( iProgressDialog )
+                    	{
+						iProgressDialog->ProcessFinishedL();
+						}
+                    HandleCommandL( EMPXCmdHandleExternalCommand );
+                    iIsWaitNoteCanceled = EFalse;
+                    }
+                HandleError( aErr );
+                }
+            if ( iContainer )
+                {
+                iContainer->ClearLbxSelection();
+                }
+            MPX_PERF_END_EX( MPX_PERF_SHOW_WAITNOTE );
+            // reopen collection
+            DoIncrementalOpenL( !iIsDeleting );
+            break;
+            }
+        case EExportPlaylistOp:
+            {
+            MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleOperationCompleteL Export playlist operation" );
+            if ( aErr == KErrNone )
+                {
+                HBufC* uri = static_cast<HBufC*>( aArgument );
+                CleanupStack::PushL(uri);
+                MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleOperationCompleteL playlist exported as %S", uri );
+
+                CMessageData* messageData = CMessageData::NewLC();
+                messageData->AppendAttachmentL( *uri );
+                RFs& fileSession = iCoeEnv->FsSession();
+                TEntry pl;
+                TInt err( fileSession.Entry( *uri, pl ) );
+                if ( err == KErrNone )
+                    {
+                    MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleOperationCompleteL playlist size = %d", pl.iSize );
+                    if ( !iSendUi )
+                        {
+                        iSendUi = CSendUi::NewL();
+                        }
+                    TSendingCapabilities capabilities(
+                        0,
+                        pl.iSize,
+                        TSendingCapabilities::ESupportsAttachments );
+
+                    // sendui leaves with error code 0 when canceling sending
+                    // via bluetooth, this should be trapped
+                    MPX_TRAP( err, iSendUi->ShowQueryAndSendL( messageData, capabilities ) );
+                    if ( err != KErrNone )
+                        {
+                        HandleError( err );
+                        }
+                    // remove the file then remove the directory
+                    err = fileSession.Delete( *uri );
+                    if ( err != KErrNone )
+                        {
+                        HandleError( err );
+                        }
+                    err = fileSession.RmDir( *uri );
+                    if ( err != KErrNone )
+                        {
+                        HandleError( err );
+                        }
+                    }
+                else
+                    {
+                    HandleError( err );
+                    }
+                CleanupStack::PopAndDestroy( 2, uri ); // messageData & uri
+                aArgument = NULL;
+                }
+            else
+                {
+                HandleError( aErr );
+                }
+            break;
+            }
+        case EAddOp:
+            {
+            HandleAddCompletedL( (CMPXMedia*)aArgument, aErr );
+            aArgument = NULL; // ownership transferred
+            iIsAddingToPlaylist = EFalse;  // reset flag once incremental adding is finished
+            break;
+            }
+        case ESetOp:
+            {
+            if ( iAddingToNewPlaylist )
+                {
+                // if user selects overwrite existing playlist,
+                // the OP will be set, and is handled here
+                HandleAddCompletedL( (CMPXMedia*)aArgument, aErr );
+                }
+            else
+                {
+                HandleSetCompletedL( (CMPXMedia*)aArgument, aErr );
+                }
+            aArgument = NULL; // ownership transferred
+            break;
+            }
+        case EReorderPlaylistOp:
+            {
+            HandleSetCompletedL( (CMPXMedia*)aArgument, aErr );
+            aArgument = NULL; // ownership transferred
+            break;
+            }
+        case ERenameOp:
+            {
+            if ( aErr != KErrNone )
+                {
+                iCommonUiHelper->HandleErrorL( aErr );
+                }
+            break;
+            }
+        case EDeleteStatusOp:
+            {
+            if ( aArgument )
+                {
+                CMPXMedia* media = (CMPXMedia*)aArgument;
+                CleanupStack::PushL( media );
+                if ( media->IsSupported( KMPXMediaGeneralCount ) )
+                    {
+                    TInt deletePercent = media->ValueTObjectL<TInt>( KMPXMediaGeneralCount );
+                    MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleOperationCompleteL % Files Deleted: %d", deletePercent );
+                    // update WaitNote dialog.
+                    HBufC* string = StringLoader::LoadLC(R_MPX_QTN_NMP_DEL_BATCH_SONGS_WAIT_NOTE, deletePercent);
+                    TPtr buf = string->Des();
+                    UpdateProcessL(deletePercent, buf);
+                    CleanupStack::PopAndDestroy( string );
+                    }
+                CleanupStack::PopAndDestroy( media );
+                aArgument = NULL;
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+
+    if( aArgument )
+        {
+        delete ( CBase* )aArgument;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandlePlaybackMessage" );
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    // Fix EBLI-7CFE4D press select key very quick cause System Error KErrArgument
+    else
+        {
+        // Fix for EJDI-77WCRF Low memory cause MP not resp.
+        iHandlingKeyEvent = EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandlePropertyL(
+    TMPXPlaybackProperty /*aProperty*/,
+    TInt /*aValue*/,
+    TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// 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 CMPXCollectionViewHgImp::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media event.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleMediaL(
+    const CMPXMedia& /*aMedia*/,
+    TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Returns views id.
+// ---------------------------------------------------------------------------
+//
+TUid CMPXCollectionViewHgImp::Id() const
+    {
+    return TUid::Uid( KMPXCollectionViewHgId );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Command handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleCommandL(0x%x) entering", aCommand );
+
+    switch (aCommand)
+        {
+        case EAknCmdMark:
+        case EAknCmdUnmark:
+        case EAknMarkAll:
+        case EAknUnmarkAll:
+            {
+            // Custom handling of markable lists
+            iContainer->HandleMarkableListProcessCommandL(
+                aCommand );
+#ifdef __ENABLE_MSK
+            // Determine middle soft key labeling
+            UpdateMiddleSoftKeyDisplayL( iCurrentMskId );
+#endif // __ENABLE_MSK
+            if (aCommand == EAknMarkAll && !iCollectionReady)
+                {
+                iMarkedAll = ETrue;
+                }
+            if (aCommand == EAknUnmarkAll || aCommand == EAknCmdUnmark)
+                {
+                iMarkedAll = EFalse;
+                }
+            break;
+            }
+        case EMPXCmdGoToNowPlaying:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        case EMPXCmdGoToAllSongs:
+            {
+            OpenAllSongsL();
+            break;
+            }
+        case EMPXCmdGoToArtistAlbums:
+            {
+            OpenArtistAlbumsL();
+            break;
+            }
+        case EMPXCmdGoToPlaylists:
+            {
+            OpenPlaylistsL();
+            break;
+            }
+        case EMPXCmdGoToGenre:
+            {
+            OpenGenreL();
+            break;
+            }
+        case EMPXCmdGoToPodcasts:
+            {
+            OpenPodcastsL();
+            break;
+            }
+#ifdef SINGLE_CLICK_INCLUDED
+        case EMPXCmdPlayItem:
+            {
+            iContainer->HandleItemCommandL(EMPXCmdPlay);
+            break;
+            }
+#endif
+        case EMPXCmdCreatePlaylist:
+            {
+            iCurrentPlaylistOp = EMPXOpPLCreating;
+            CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
+            CleanupStack::PushL( mediaArray );
+            CMPXMedia* media = CMPXMedia::NewL();
+            CleanupStack::PushL( media );
+            media->SetCObjectValueL( KMPXMediaArrayContents, mediaArray );
+            media->SetTObjectValueL( KMPXMediaArrayCount, 0 );
+            TInt ret( iCommonUiHelper->CreatePlaylistL( *media, this, this ) );
+            if ( !ret )
+                {
+                // create playlist failed,
+                iCurrentPlaylistOp = EMPXOpPLIdle;
+                }
+            CleanupStack::PopAndDestroy( media );
+            CleanupStack::PopAndDestroy( mediaArray );
+            break;
+            }
+        case EMPXCmdAddToNewPlaylist:
+        case EMPXCmdAddToSavedPlaylist:
+            {
+            // flag used only in the case when songs are added incrementally
+            iIsAddingToPlaylist = ETrue;
+            iNumSongAddedToPlaylist = -1;
+            TMPXGeneralCategory category( EMPXNoCategory );
+            CMPXCommonListBoxArrayBase* array(
+                iContainer->ListBoxArray() );
+            const CMPXMedia& media = array->MediaL(
+                iContainer->CurrentLbxItemIndex() );
+            category = media.ValueTObjectL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory );
+            if ( category == EMPXSong )
+                {
+                CMPXMedia* tracks = CMPXMedia::NewL();
+                CleanupStack::PushL( tracks );
+
+                MPX_TRAPD( err, PrepareMediaForSelectedItemsL( *tracks ) );
+                if ( err == KErrNone )
+                    {
+                    TBool ret = EFalse;
+                    if ( aCommand == EMPXCmdAddToNewPlaylist )
+                        {
+                        iAddingToNewPlaylist = ETrue;
+                        MPX_TRAP( err,ret = iCommonUiHelper->CreatePlaylistL(
+                                *tracks, this, this ) );
+                        if ( err != KErrNone )
+                            {
+                            HandleError( err );
+                            }
+                        if ( !ret )
+                            {
+                            iAddingToNewPlaylist = EFalse;
+                            }
+                        }
+                    else
+                        {
+                        MPX_TRAP( err, ret = iCommonUiHelper->AddToSavedPlaylistL(
+                            *iUserPlaylists, *tracks, this, this ) );
+                        if ( err != KErrNone )
+                            {
+                            HandleError( err );
+                            }
+                        }
+#ifdef __ENABLE_MSK
+                     // If Save play list or create play list return True (OK)
+                     //  1 - Unselect marks
+                     //  2 - Force to refresh the MSK with title "Play"
+                     // If Save play list or create play list return False (Cancel)
+                     //  1 - let the marks
+                     //  2 - let the MSK with the "context menu"
+                     if (ret)
+                       {
+                       iContainer->ClearLbxSelection();
+                       UpdateMiddleSoftKeyDisplayL( iCurrentMskId );
+                       }
+#endif // __ENABLE_MSK
+                    }
+                else if ( err == KMPXErrDataNotReadyCacheCommand )
+                    {
+                    // cache this command
+                    HBufC* text = StringLoader::LoadLC(
+                        R_MPX_QTN_MUS_NOTE_ADDING_TRACKS );
+                    StartDelayedActionL( aCommand, *text );
+                    CleanupStack::PopAndDestroy( text );
+                    }
+                else if ( err != KMPXErrDataNotReady )
+                    {
+                    HandleError( err );
+                    }
+                else
+                    {
+                    // KMPXErrDataNotReady, ignore
+                    }
+                CleanupStack::PopAndDestroy( tracks );
+                }
+            else
+                {
+                // on artist/album level
+                if ( aCommand == EMPXCmdAddToNewPlaylist )
+                    {
+                    iAddingToNewPlaylist = ETrue;
+                    iCurrentFindAllLOp = EMPXOpFindAllLAlbumArtistAddToNewPlaylist;
+                    }
+                else
+                    {
+                    iCurrentFindAllLOp = EMPXOpFindAllLAlbumArtistAddToSavedPlaylist;
+                    }
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL( attrs );
+                attrs.Append(
+                    TMPXAttribute( KMPXMediaIdGeneral,
+                    EMPXMediaGeneralTitle | EMPXMediaGeneralId |
+                    EMPXMediaGeneralType | EMPXMediaGeneralCategory ) );
+                CMPXMedia* criteria = CMPXMedia::NewL();
+                CleanupStack::PushL( criteria );
+                CMPXCommonListBoxArrayBase* listboxArray =
+                    iContainer->ListBoxArray();
+                const CMPXMedia& containerMedia =
+                    listboxArray->ContainerMedia();
+                TMPXGeneralCategory containerCategory(
+                    containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory ) );
+                if ( containerCategory == EMPXArtist )
+                    {
+                    // artist/album level, need to specify artist ID in container ID
+                    TMPXItemId containerId(
+                        containerMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                    criteria->SetTObjectValueL<TMPXItemId>(
+                        KMPXMediaGeneralContainerId, containerId );
+                    }
+                const CMPXMedia& currentMedia = listboxArray->MediaL(
+                    iContainer->CurrentLbxItemIndex() );
+                TMPXItemId id(
+                    currentMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                criteria->SetTObjectValueL<TMPXGeneralType>(
+                    KMPXMediaGeneralType, EMPXGroup );
+                criteria->SetTObjectValueL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory, EMPXSong );
+                criteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+                iCollectionUtility->Collection().FindAllL(
+                    *criteria, attrs.Array(), *this );
+                CleanupStack::PopAndDestroy( criteria );
+                CleanupStack::PopAndDestroy( &attrs );
+                }
+            break;
+            }
+        case EMPXCmdAddSongs:
+            {
+            iAddingSong = ETrue;
+            iViewUtility->ActivateViewL(
+                TUid::Uid( KMPXPluginTypeAddSongsEditorUid ) );
+            break;
+            }
+        case EMPXCmdReorder:
+            {
+            ActivateReorderGrabbedModeL();
+            break;
+            }
+        case EMPXCmdDelete: // fall through
+        case EMPXCmdRemove:
+            {
+            StoreListboxItemIndexL();
+            DeleteSelectedItemsL(aCommand);
+            break;
+            }
+        case EMPXCmdSend:
+            {
+            const CMPXMedia& media =
+                iContainer->ListBoxArray()->MediaL(
+                    iContainer->CurrentLbxItemIndex() );
+
+            TMPXGeneralType type(
+                media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+            TMPXGeneralCategory category(
+                media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+
+            if ( iContainer->CurrentSelectionIndicesL()->Count() == 0 &&
+                type == EMPXItem &&
+                category == EMPXPlaylist )
+                {
+                // sending a playlist
+                DoSendPlaylistL( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                }
+            else
+                {
+                DoSendL();
+                }
+            break;
+            }
+        case EMPXCmdSongDetails: // fall through
+        case EMPXCmdAlbumArt: // fall through
+        case EMPXCmdFindInMusicShop:
+            {
+            StoreListboxItemIndexL();
+
+            CMPXCommonListBoxArrayBase* listboxArray(
+                iContainer->ListBoxArray() );
+            const CMPXMedia& media( listboxArray->MediaL(
+                iContainer->CurrentLbxItemIndex() ) );
+            if ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
+                {
+                // highlighted item is not yet available
+                MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCommandL item not yet fetched" );
+                }
+            else
+                {
+                // need to check if the file exists.  if the file doesn't exist
+                // and mediaL is called with drm status, it'll leave
+                if ( aCommand == EMPXCmdSongDetails )
+                    {
+                    iCurrentMediaLOp = EMPXOpMediaLSongDetailsFileCheck;
+                    iInSongDetails = ETrue;
+                    }
+                else if ( aCommand == EMPXCmdAlbumArt )
+                    {
+                    iInAlbumArtDialog = ETrue;
+                    iCurrentMediaLOp = EMPXOpMediaLAlbumArtFileCheck;
+                    }
+                else if ( aCommand == EMPXCmdFindInMusicShop )
+                    {
+                    iCurrentMediaLOp = EMPXOpMediaLFindInMusicShopSongDetails;
+                    }
+                CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+                CleanupStack::PushL( path );
+                path->Set( iContainer->CurrentLbxItemIndex() );
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL( attrs );
+                attrs.Append(
+                    TMPXAttribute( KMPXMediaIdGeneral,
+                        EMPXMediaGeneralUri | EMPXMediaGeneralCollectionId ) );
+                iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+                CleanupStack::PopAndDestroy( &attrs );
+                CleanupStack::PopAndDestroy( path );
+                }
+            break;
+            }
+        case EMPXCmdGoToMusicShop:
+            {
+            LaunchMusicShopL();
+            break;
+            }
+        case EMPXCmdGoToNokiaMusicShop:
+            {
+            LaunchMusicShopL();
+            break;
+            }
+        case EMPXCmdGoToOperatorMusicShop:
+            {
+            if(iMusicStoreWebPage)
+                {
+                LaunchOperatorURLMusicShopL();
+                }
+            else
+                {
+                if(iOperatorMusicStoreType)
+                {
+                LaunchOperatorJavaMusicShopL(iOperatorMusicStoreUID);
+                }
+            else
+                {
+                LaunchOperatorNativeMusicShopL();
+                }
+                }
+            break;
+            }
+        case EMPXCmdMusicLibraryDetails:
+            {
+            iCurrentMediaLOp = EMPXOpMediaLCollectionDetails;
+            CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( path );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL( attrs );
+            attrs.Append( KMPXMediaColDetailAll );
+            iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PopAndDestroy( path );
+            break;
+            }
+        case EMPXCmdRename:
+            {
+            DoHandleRenameL();
+            break;
+            }
+        case EMPXCmdPlaylistDetails:
+            {
+            iCurrentMediaLOp = EMPXOpMediaLPlaylistDetails;
+            CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( path );
+            path->Set( iContainer->CurrentLbxItemIndex() );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL( attrs );
+            attrs.Append( TMPXAttribute( KMPXMediaIdGeneral,
+                EMPXMediaGeneralCount | EMPXMediaGeneralTitle |
+                EMPXMediaGeneralUri | EMPXMediaGeneralDate |
+                EMPXMediaGeneralDuration | EMPXMediaGeneralFlags ) );
+            iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PopAndDestroy( path );
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            iMarkedAll = EFalse;
+            if( iIsDeleting )
+            	{
+            	break;
+            	}
+
+            if ( iIsEmbedded )
+                {
+                AppUi()->HandleCommandL(
+                    ( MPXTlsHelper::NeedSave() && iCommonUiHelper->IsHostMessagingBrowserL() )
+                    ? EMPXCmdSaveAndExit : EEikCmdExit );
+                }
+            else
+                {
+                if ( !iHandlingKeyEvent )
+                    {
+                    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+                    CleanupStack::PushL( cpath );
+                    TInt currentDepth( cpath->Levels() );
+                    if ( currentDepth == 2 ) // 2 is the level of music main view
+                        {
+                        // let Back Stepping Service handle the event
+                        TInt statusInfo( KMPXBackSteppingNotConsumed );
+                        if( iViewUtility &&
+                            ( iViewUtility->ActiveViewImplementationUid() != KNullUid ) )
+                            {
+                            TInt viewId( iViewUtility->ActiveViewType().iUid );
+                            TBuf8<KMVPrefixLen + KMaxIntLen> buf;
+                            buf.Copy( KMVPrefix );
+                            buf.AppendNum( viewId );
+                            statusInfo = iBackSteppingUtility->HandleBackCommandL( buf );
+                            MPX_DEBUG3("CMPXCollectionViewHgImp::HandleCommandL - viewid=0x%x, statusInfo=%d",
+                                 viewId, statusInfo );
+                            }
+                        if ( statusInfo == KMPXBackSteppingNotConsumed )
+                            // event not consumed by Back Stepping utility, handle here
+                            //
+                            {
+                            AppUi()->HandleCommandL( aCommand );
+                            }
+                        }
+                    else
+                        {
+                        if ( currentDepth > 2 && !iBackOneLevel )
+                            {
+                            iContainer->ClearLbxSelection();
+                            iCollectionUtility->Collection().BackL();
+                            iFirstIncrementalBatch = ETrue;
+                            MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleCommandL Getting container media, currentDepth = %d", currentDepth );
+                            cpath->Back();
+                            cpath->Back();
+                            RArray<TMPXAttribute> attrs;
+                            CleanupClosePushL(attrs);
+                            iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo;
+                            attrs.Append( KMPXMediaGeneralDuration );
+                            iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+                            CleanupStack::PopAndDestroy( &attrs );
+                            iBackOneLevel = ETrue;
+                            }
+                        else
+                            {
+                            MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCommandL Not getting container media" );
+                            }
+
+                        iHandlingKeyEvent = ETrue;
+                        }
+                    CleanupStack::PopAndDestroy( cpath );
+                    }
+                else
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCommandL Busy, ignoring command" );
+                    }
+                }
+            break;
+            }
+        case EMPXCmdSavePlaylist:
+            {
+            AppUi()->HandleCommandL( EMPXCmdSaveAndReopen );
+            break;
+            }
+        case EAknCmdExit:
+        case EAknSoftkeyExit:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        case EMPXCmdCancelReorder:
+            {
+            if ( iContainer && iContainer->IsInReorderMode() )
+                {
+                TRAP_IGNORE( ProcessCommandL( EMPXCmdReorderCancel ) );
+                iCurrentHighlightedIndex = KErrNotFound;
+                }
+            break;
+            }
+        case EMPXCmdUpnpPlayViaLocal:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                SelectNewPlayerL( aCommand );
+                }
+            break;
+            }
+        case EMPXCmdUPnPAiwCmdCopyToExternalCriteria:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                CopySelectedItemsToRemoteL();
+                }
+            break;
+            }
+
+        case EMPXCmdPlay:
+        case EMPXCmdForcePlay:
+        case EMPXCmdPlayPause:
+            {
+            TBool isReady( ETrue );
+            TMPXPlaybackState state( iPlaybackUtility->StateL() );
+
+            // if it's in paused state, resume playback, no need
+            // to check if current highlight is a playlist
+            if ( iContainer &&
+                aCommand != EMPXCmdForcePlay &&
+                state != EPbStatePaused && state != EPbStatePlaying )
+                {
+                CMPXCommonListBoxArrayBase* listboxArray =
+                    iContainer->ListBoxArray();
+                if ( iContainer->CurrentListItemCount() > 0 )
+                    {
+                    TInt currentItem(
+                        iContainer->CurrentLbxItemIndex() );
+                    const CMPXMedia& media = listboxArray->MediaL( currentItem );
+                    TMPXGeneralType type(
+                        media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+                    TMPXGeneralCategory category(
+                        media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+                    if ( category == EMPXPlaylist && type == EMPXItem )
+                        {
+                        MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCommandL checking item count in playlist" );
+                        isReady = EFalse;
+                        TMPXItemId id(
+                            media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                        CMPXMedia* entry = CMPXMedia::NewL();
+                        CleanupStack::PushL( entry );
+                        entry->SetTObjectValueL<TMPXGeneralType>(
+                            KMPXMediaGeneralType, EMPXGroup );
+                        entry->SetTObjectValueL<TMPXGeneralCategory>(
+                            KMPXMediaGeneralCategory, EMPXSong );
+                        entry->SetTObjectValueL<TMPXItemId>(
+                            KMPXMediaGeneralId, id );
+                        iCurrentFindAllLOp = EMPXOpFindAllLPlaylistTracksCount;
+                        RArray<TMPXAttribute> attrs;
+                        CleanupClosePushL( attrs );
+                        attrs.Append( KMPXMediaGeneralId );
+                        iCollectionUtility->Collection().FindAllL(
+                            *entry, attrs.Array(), *this );
+                        CleanupStack::PopAndDestroy( &attrs );
+                        CleanupStack::PopAndDestroy( entry );
+                        }
+                    }
+                else
+                    {
+                    // current list view is empty, and no song currently playing
+                    // ignore the command
+                    isReady = EFalse;
+                    }
+                }
+            if ( isReady )
+                {
+                if ( aCommand == EMPXCmdForcePlay )
+                    {
+                    aCommand = EMPXCmdPlay;
+                    }
+                if ( EPbStateNotInitialised == state ||
+                     EPbStateStopped == state )
+                    {
+                    // Needed to reset the status of iPreservedState
+                    if ( EPbStateStopped == state )
+                        {
+                        iPlaybackUtility->CommandL(EPbCmdResetPreserveState);
+                        }
+                    TInt currentItem(
+                        iContainer->CurrentLbxItemIndex() );
+                    MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleCommandL playing index %d", currentItem );
+                    if ( iContainer->IsInReorderMode() )
+                        {
+                        // if in reorder mode, and in not playing state
+                        // drop the reorder target and start playing
+                        if ( iIsGrabbed )
+                            {
+                            ProcessCommandL( EMPXCmdReorderDrop );
+                            }
+                        ProcessCommandL( EMPXCmdReorderDone );
+                        iPlayIndex = currentItem;
+                        }
+                    else if ( currentItem != KErrNotFound )
+                        {
+                        if ( iContainer && !AppUi()->IsDisplayingDialog() )
+                            {
+                            StopDisplayingMenuBar();
+                            }
+                        iPlayIndex = KErrNotFound;
+                        if(iCollectionCacheReady)
+                            {
+                            iCollectionUtility->Collection().OpenL( currentItem, EMPXOpenPlaylistOnly );
+                            iFirstIncrementalBatch = ETrue;
+                            }
+                        }
+                    }
+                else
+                    {
+                    AppUi()->HandleCommandL( aCommand );
+                    }
+                }
+            break;
+            }
+        case EMPXCmdSaveComplete:
+            {
+            MPXTlsHelper::SetNeedSave( EFalse );
+            break;
+            }
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        case EMPXCmdRefreshLibrary:
+            {
+            MPX_PERF_CHECKPT("Refresh collection library");
+            // Package the argument from 8bit to 16bit then activate view
+            //
+            StartWaitNoteL( EMPXRefreshingNote );
+            iPlaybackUtility->CommandL( EPbCmdStop );
+            break;
+            }
+#endif
+        default:
+            {
+            MPX_PERF_CHECKPT("Handle Collection view unknown command");
+            if ( iUpnpFrameworkSupport )
+                {
+                if ( aCommand >= EMPXCmdUpnpPlayViaRemotePlayer  &&
+                     aCommand < EMPXCmdUpnpLastCommandId )
+                    {
+                    SelectNewPlayerL( aCommand );
+                    }
+                else
+                    {
+                    if ( iServiceHandler->ServiceCmdByMenuCmd(aCommand) != KAiwCmdNone )
+                        {
+                        CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+                        FillAiwParametersL(paramList);
+                        iServiceHandler->ExecuteMenuCmdL(aCommand, paramList,
+                            iServiceHandler->OutParamListL());
+                        }
+                    AppUi()->HandleCommandL( aCommand );
+                    }
+                }
+            else
+                {
+                if ( iServiceHandler->ServiceCmdByMenuCmd(aCommand) != KAiwCmdNone )
+                    {
+                    CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+                    FillAiwParametersL(paramList);
+                    iServiceHandler->ExecuteMenuCmdL(aCommand, paramList,
+                        iServiceHandler->OutParamListL());
+                    }
+                AppUi()->HandleCommandL( aCommand );
+                }
+            break;
+            }
+        }
+    MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleCommandL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Handles a view activation.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoActivateL(
+    const TVwsViewId& /* aPrevViewId */,
+    TUid /* aCustomMessageId */,
+    const TDesC8& /* aCustomMessage */ )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoActivateL()" );
+
+    // Add view deactivation observer
+    AppUi()->AddViewDeactivationObserverL( this );
+
+    // Set status pane layout if switched here directly from another view,
+    // such as when using the AnyKey
+    StatusPane()->MakeVisible( ETrue );
+    StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT);
+
+    if ( !iContainer )
+        {
+        iContainer = CMPXCollectionViewHgContainer::NewL( this, this, iIsEmbedded );
+        iContainer->SetCbaHandler( this );
+        }
+    iContainer->SetMopParent( this );
+    AppUi()->AddToStackL( *this, iContainer );
+    iContainer->SetRect( ClientRect() );
+
+    CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+    CleanupStack::PushL( cpath );
+
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+    // media is not valid until the first HandleOpenL call
+    CEikButtonGroupContainer* cba = Cba();
+    if ( cba )
+        {
+        cba->SetCommandSetL(
+            ( cpath->Levels() == 2 && !iIsEmbedded ) ?
+            R_MPX_OPTIONS_BACK_CBA_NO_ACTION : R_MPX_OPTIONS_BACK_CBA_NO_ACTION );
+        cba->DrawDeferred();
+        }
+#else
+    // media is not valid until the first HandleOpenL call
+    CEikButtonGroupContainer* cba = Cba();
+    if ( cba )
+        {
+        cba->SetCommandSetL(
+            ( iViewUtility->ViewHistoryDepth() == 1 && !iIsEmbedded ) ?
+            R_MPX_OPTIONS_EXIT_CBA_NO_ACTION : R_MPX_OPTIONS_BACK_CBA_NO_ACTION );
+        cba->DrawDeferred();
+        }
+#endif
+
+	UpdateTitlePaneL();
+    UpdateNaviPaneL();
+
+
+    if ( iViewUtility->PreviousViewType().iUid == KMPXPluginTypePlaybackUid )
+        {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        // If previous view is Playback view, it can only be normal playback view
+        // Podcast shouldn't be highlighted in any case.
+        iPodcast = EFalse;
+#endif
+
+        // return back from playback view and in songs level,
+        // highlight the new playing song
+        MMPXSource* source( iPlaybackUtility->Source() );
+
+        if ( source )
+            {
+            CMPXCollectionPlaylist* playlist( source->PlaylistL() );
+            if ( playlist )
+                {
+                // Going from Now Playing View -> Collection, same collection level
+                iPossibleJump = ( playlist->Path().Levels() == cpath->Levels() );
+                delete playlist;
+                }
+            }
+
+        if ( cpath->Levels() > 1 )
+            {
+            // valid path in collection
+            GetDurationL();
+            MPX_DEBUG_PATH(*cpath);
+
+            DoIncrementalOpenL();
+            }
+        else
+            {
+            TUid defaultView( iViewUtility->DefaultViewUid() );
+            iViewUtility->ActivateViewL( ( defaultView != KNullUid ) ?
+                defaultView : TUid::Uid( KMPXPluginTypeMainUid ) );
+            }
+        }
+    else
+        {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        // If previous view is Collection view, it can only be podcast view
+        if ( iViewUtility->PreviousViewType().iUid == KMPXPluginTypeCollectionUid )
+            {
+            iPodcast = ETrue;
+            }
+        // don't bother getting duration if at plugin list
+        if ( cpath->Levels() > 1 )
+#endif
+            {
+            GetDurationL();
+            }
+        MPX_DEBUG_PATH(*cpath);
+
+        DoIncrementalOpenL( cpath->Levels()>KMusicCollectionMenuLevel ? ETrue:EFalse );
+
+        iUpCount = 0;
+        iDownCount = 0;
+        }
+    CleanupStack::PopAndDestroy( cpath );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// View deactivation function.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoDeactivate()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoDeactivate" );
+    if ( iContainer && iContainer->IsInReorderMode() )
+        {
+        TRAP_IGNORE( ProcessCommandL( EMPXCmdReorderDone ) );
+        iCurrentHighlightedIndex = KErrNotFound;
+        }
+
+    if ( iContainer )
+        {
+        iContainer->ContentIsReady( EFalse );
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+
+    if (iDuration)
+        {
+        delete iDuration;
+        iDuration = NULL;
+        TRAP_IGNORE(UpdateNaviPaneL());
+        }
+
+    // Cleanup view deactivation observer
+    AppUi()->RemoveViewDeactivationObserver( this );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Foreground event handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleForegroundEventL( TBool aForeground )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleForegroundEventL" );
+    if ( aForeground && iOpeningNote )
+    	{
+        CloseWaitNoteL();
+        iOpeningNote = EFalse;
+    	}
+    iActivateBackStepping = EFalse;
+    MPX_DEBUG3("CMPXCollectionViewHgImp::HandleForegroundEventL - is in foreground=%d, this view=0x%x",
+        aForeground, Id().iUid );
+    if( aForeground &&
+        iViewUtility &&
+        ( iViewUtility->ActiveViewImplementationUid() != KNullUid ) )
+        {
+        iActivateBackStepping = ETrue;
+        }
+        {
+        CAknView::HandleForegroundEventL( aForeground );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::HandleBacksteppingActivation
+// Handle backstepping activation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleBacksteppingActivation()
+    {
+    TInt viewId( iViewUtility->ActiveViewType().iUid );
+    TBuf8<KMVPrefixLen + KMaxIntLen> buf;
+    buf.Copy( KMVPrefix );
+    buf.AppendNum( viewId );
+    TInt statusInfo( KMPXBackSteppingNotConsumed );
+    TRAP_IGNORE(
+       statusInfo =
+        iBackSteppingUtility->ForwardActivationEventL( buf, ETrue );
+         );
+    MPX_DEBUG3("CMPXCollectionViewHgImp::HandleBacksteppingActivation - viewId=0x%x, statusInfo=%d", viewId, statusInfo );
+    iActivateBackStepping = EFalse;
+   }
+
+// ---------------------------------------------------------------------------
+// Handle initialing a music menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleInitMusicMenuPaneL(
+    CEikMenuPane* aMenuPane )
+    {
+    CMPXCollectionViewListBoxArray* array =
+        static_cast<CMPXCollectionViewListBoxArray*>(
+        iContainer->ListBoxArray() );
+	const CMPXMedia& containerMedia = array->ContainerMedia();
+
+	TMPXGeneralCategory containerCategory(
+		containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+			KMPXMediaGeneralCategory ) );
+
+	switch ( containerCategory )
+		{
+		case EMPXPlaylist:
+			{
+			// playlist view
+			aMenuPane->SetItemDimmed( EMPXCmdGoToPlaylists, ETrue );
+			aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue );
+			aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
+			break;
+			}
+		case EMPXAlbum:
+		case EMPXArtist:
+			{
+			// Album & Artist view
+			aMenuPane->SetItemDimmed( EMPXCmdGoToArtistAlbums, ETrue );
+			aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue );
+			break;
+			}
+		case EMPXGenre:
+			{
+			// Genre view
+			aMenuPane->SetItemDimmed( EMPXCmdGoToGenre, ETrue );
+			aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
+			break;
+			}
+		case EMPXSong:
+			{
+			aMenuPane->SetItemDimmed( EMPXCmdGoToAllSongs, ETrue );
+			aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
+			break;
+			}
+		default:
+			{
+			break;
+			}
+		}
+   	}
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DynInitMenuPaneL" );
+    CMPXCollectionViewListBoxArray* array =
+        static_cast<CMPXCollectionViewListBoxArray*>(
+        iContainer->ListBoxArray() );
+    TInt currentItem( iContainer->CurrentLbxItemIndex() );
+    TBool isListEmpty( currentItem < 0 );
+    TInt selectionCount( 0 );
+    if ( iSelectionIndexCache)
+        {
+        selectionCount = iSelectionIndexCache->Count();
+        }
+
+    TInt usbUnblockingStatus;
+    RProperty::Get( KMPXViewPSUid,
+                    KMPXUSBUnblockingPSStatus,
+                    usbUnblockingStatus);
+
+    switch ( aResourceId )
+        {
+        case R_MPX_COLLECTION_VIEW_MENU_1:
+            {
+            const CMPXMedia& containerMedia = array->ContainerMedia();
+            TMPXGeneralType containerType(
+                containerMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+            TMPXGeneralCategory containerCategory(
+                containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory ) );
+
+            HandleInitMusicMenuPaneL(aMenuPane);
+
+            MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL container type = %d, category = %d", containerType, containerCategory );
+
+            // Always dim the find in hg implementation
+            aMenuPane->SetItemDimmed( EMPXCmdFind, ETrue );
+            MMPXPlaybackUtility* pdPlaybackUtility;
+            pdPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid( KProgressDownloadUid ) );
+            MMPXSource* pdsource( pdPlaybackUtility->Source() );
+            MMPXSource* source( iPlaybackUtility->Source() );
+            TBool hideNowPlaying;
+            hideNowPlaying = ( (pdsource == 0)
+                           &&  (source == 0));
+            pdPlaybackUtility->Close();
+            if ( hideNowPlaying )
+                {
+                aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
+                }
+            if ( !isListEmpty )
+                {
+                const CMPXMedia& media = array->MediaL( currentItem );
+                TMPXGeneralType type(
+                    media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+                TMPXGeneralCategory category(
+                    media.ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory ) );
+                MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL item type = %d, category = %d", type, category );
+#ifdef SINGLE_CLICK_INCLUDED
+                if ( containerType == EMPXGroup && containerCategory == EMPXAlbum )
+                    {
+                    // album view
+                    switch ( category )
+                        {
+                        case EMPXAlbum:
+                            {
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse );
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdPlayItem, EFalse );
+                                }
+                            break;
+                            }
+                        case EMPXCommand:
+                            {
+                            aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
+                            break;
+                            }
+                        }
+                    }
+                else
+#endif
+                if ( containerType == EMPXItem && containerCategory == EMPXPlaylist )
+                    {
+                    // in playlist tracks view
+                    // enable reordering and add songs in playlist view
+                    aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                    aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                    if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                        {
+                        aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                        aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                        aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                        aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                        aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+#ifdef SINGLE_CLICK_INCLUDED
+                        aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
+#endif
+
+                        }
+                    else
+                        {
+                        // do not display add songs option when marking is on
+                        aMenuPane->SetItemDimmed( EMPXCmdAddSongs, selectionCount > 0 );
+                        TInt totalItemCount( iContainer->TotalListItemCount() );
+                        // display reorder option only when more than 1 item is visible
+                        // do not display reorder option when marking is on
+#ifdef SINGLE_CLICK_INCLUDED
+                        aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+#else
+                        aMenuPane->SetItemDimmed( EMPXCmdReorder,
+                            ( totalItemCount > 1 && selectionCount == 0 ) ?
+                            EFalse : ETrue );
+#endif
+                        aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                        aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                        aMenuPane->SetItemDimmed( EMPXCmdRemove, EFalse );
+#ifdef SINGLE_CLICK_INCLUDED
+                        aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
+#endif
+						}
+
+                    if ( containerMedia.IsSupported(
+                        KMPXMediaGeneralNonPermissibleActions ) )
+                        {
+                        // check for auto playlist, disable add, remove and reorder
+                        TMPXGeneralNonPermissibleActions attr(
+                            containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                                KMPXMediaGeneralNonPermissibleActions ) );
+                        if ( attr & EMPXWrite )
+                            {
+                            aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                            }
+                        }
+                    }
+                else if ( type == EMPXItem )
+                    {
+                    switch ( category )
+                        {
+                        case EMPXPlaylist:
+                            {
+                            // playlist view
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
+                                }
+                            if ( media.IsSupported(
+                                KMPXMediaGeneralNonPermissibleActions ) )
+                                {
+                                // check for auto playlist, disable delete
+                                TMPXGeneralNonPermissibleActions attr(
+                                    media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                                        KMPXMediaGeneralNonPermissibleActions ) );
+                                if ( attr & EMPXWrite )
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                    }
+                                }
+                            aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                            break;
+                            }
+#ifdef SINGLE_CLICK_INCLUDED
+                        case EMPXAlbum:
+                            {
+                            // album contents view
+                            if ( iContainer->IsSelectedItemASong() )
+                                {                            
+                                if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                                    aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
+                                    }
+                                else
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
+                                    aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                                    aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
+                                    aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
+                                    }
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );                                
+                                }
+                            break;
+                            }
+                        case EMPXGenre:
+                            {
+                            // genre view
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                }
+                            break;
+                            }
+#endif
+                            
+#ifdef SINGLE_CLICK_INCLUDED
+                        case EMPXArtist:  
+                        case EMPXComposer:
+#else
+                        case EMPXAlbum:
+                        case EMPXArtist:
+                        case EMPXGenre:
+                        case EMPXComposer:
+#endif
+                            {
+                            // artist, album, genre, composer view
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                                }
+                            break;
+                            }
+                        case EMPXSong:
+                            {
+                            // any tracks view except playlist tracks
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+#ifdef SINGLE_CLICK_INCLUDED
+                                aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
+#endif
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSend, SendOptionVisibilityL() );
+                                aMenuPane->SetItemDimmed( EMPXCmdDelete, EFalse );
+                                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+#ifdef SINGLE_CLICK_INCLUDED
+                                aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
+#endif
+                                }
+                            break;
+                            }
+                        case EMPXCommand:
+                            {
+							aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist, ETrue );
+							aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+							aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+							aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+							aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+							aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+							aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+#ifdef SINGLE_CLICK_INCLUDED
+                            aMenuPane->SetItemDimmed( EMPXCmdPlayItem, ETrue );
+#endif
+							
+                            }
+                            break;
+                        default:
+                            {
+                            ASSERT( 0 );
+                            break;
+                            }
+                        }
+                    }
+
+                if ( iUpnpFrameworkSupport )
+                    {
+                    HandleDynInitUpnpL( aResourceId, *aMenuPane );
+                    }
+                else
+                    {
+                    aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
+                    aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
+                    }
+                }
+            else
+                {
+                // list empty
+
+                aMenuPane->SetItemDimmed( EMPXCmdCreatePlaylist,
+                    ( containerType == EMPXGroup && containerCategory == EMPXPlaylist) ? // in playlist view?
+                    EFalse : ETrue );
+                if ( containerType == EMPXItem && containerCategory == EMPXPlaylist)
+                    {
+                    // in playlist tracks view
+                    if ( containerMedia.IsSupported(
+                        KMPXMediaGeneralNonPermissibleActions ) )
+                        {
+                        // check for auto playlist, disable add songs
+                        TMPXGeneralNonPermissibleActions attr(
+                            containerMedia.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                                KMPXMediaGeneralNonPermissibleActions ) );
+                        if ( attr & EMPXWrite )
+                            {
+                            aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                            }
+                        }
+                    }
+                else
+                    {
+                    aMenuPane->SetItemDimmed( EMPXCmdAddSongs, ETrue );
+                    }
+                aMenuPane->SetItemDimmed( EMPXCmdUpnpPlayVia, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdAddToPlaylist, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdReorder, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdSend, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdDelete, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdRemove, ETrue );
+                }
+            break;
+            }
+        case R_MPX_COLLECTION_VIEW_MENU_2:
+            {
+            if ( !isListEmpty )
+                {
+                const CMPXMedia& media = array->MediaL( currentItem );
+                TMPXGeneralType type(
+                    media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+                TMPXGeneralCategory category(
+                    media.ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory ) );
+                const CMPXMedia& containerMedia = array->ContainerMedia();
+                TMPXGeneralType containerType(
+                    containerMedia.ValueTObjectL<TMPXGeneralType>(
+                        KMPXMediaGeneralType ) );
+                TMPXGeneralCategory containerCategory(
+                    containerMedia.ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory ) );
+                MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL container type = %d, category = %d", containerType, containerCategory );
+                MPX_DEBUG3( "CMPXCollectionViewHgImp::DynInitMenuPaneL item type = %d, category = %d", type, category );
+                if ( type == EMPXItem)
+                    {
+                    switch ( category )
+                        {
+                        case EMPXPlaylist:
+                            {
+                            // playlist view
+                            aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                                }
+                            else
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdRename, EFalse );
+                                }
+                            aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, EFalse );
+                            if ( media.IsSupported(
+                                KMPXMediaGeneralNonPermissibleActions ) )
+                                {
+                                // check for auto playlist, disable delete
+                                TMPXGeneralNonPermissibleActions attr(
+                                    media.ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                                        KMPXMediaGeneralNonPermissibleActions ) );
+                                if ( attr & EMPXWrite )
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
+                                    }
+                                }
+                            if ( array->IsItemBrokenLinkL( currentItem ) ||
+                                array->IsItemCorruptedL( currentItem ) )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
+                                }
+                            break;
+                            }
+                        case EMPXAlbum:
+                        case EMPXArtist:
+                        case EMPXGenre:
+                        case EMPXComposer:
+                            {
+                            // artist, album, genre, composer view
+                            aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
+                            if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                                }
+                            else
+                                {
+#ifdef SINGLE_CLICK_INCLUDED
+                                aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+#else
+                                aMenuPane->SetItemDimmed( EMPXCmdRename, EFalse );                              
+#endif
+                                }
+#ifndef SINGLE_CLICK_INCLUDED
+                            if ( category == EMPXAlbum )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, EFalse );
+                                // if unknown entry exist in album level, disable album art
+                                // for last item, if unknown exist it'll be at this
+                                // location
+                                if ( array->IsCategoryUnknownExist() &&
+                                    category == EMPXAlbum &&
+                                    currentItem == iContainer->TotalListItemCount() - 1 )
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                                    }
+                                if ( containerCategory == EMPXArtist )
+                                    {
+                                    // in artist/album view, do not display album art/rename
+                                    // option on All ( first item in list )
+                                    if ( currentItem == 0 )
+                                        {
+                                        aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                                        aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                                        }
+                                    }
+                                }
+                            else
+#endif
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                                }
+#ifdef SINGLE_CLICK_INCLUDED
+                            if ( category == EMPXComposer )
+#else
+                            if ( ( category == EMPXGenre ) || ( category == EMPXComposer ) )
+#endif
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                                }
+#ifdef SINGLE_CLICK_INCLUDED
+                            else if ( category == EMPXGenre )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, EFalse );
+                                }
+#endif
+                            else
+                                {
+                                if ( array->IsCategoryUnknownExist() &&
+                                    ( category == EMPXAlbum || category == EMPXArtist ) &&
+                                    currentItem == iContainer->TotalListItemCount() - 1 )
+                                    {
+                                    // if unknown entry exist in artist or album level
+                                    aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                                    }
+                                else
+                                    {
+#ifdef SINGLE_CLICK_INCLUDED
+                                    aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+#else
+                                    aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, EFalse );
+#endif
+                                    }
+                                }
+                            aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
+
+                            if ( !iUsingNokiaService )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                                }
+                            break;
+                            }
+                        case EMPXSong:
+                            {
+                            // any tracks view
+#ifdef __ENABLE_MSK
+                            // show context menu if MSK selected and there are
+                            // multiple selections; otherwise, show options menu
+                            if ( ( selectionCount > 0 ) && iShowContextMenu )
+                                {
+                                MenuBar()->SetMenuType(CEikMenuBar::EMenuContext);
+                                iShowContextMenu = EFalse;
+                                }
+                            else
+                                {
+                                MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions);
+                                }
+#endif //__ENABLE_MSK
+
+                            if ( selectionCount > 0 )
+                                {
+                                // multiple selection
+                                aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                                aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                                }
+                            else
+                                {
+                                TBool fileDetailVisibility( FileDetailsOptionVisibilityL() );
+                                // use the same criteria for showing/hiding song details
+                                // and album art
+                                aMenuPane->SetItemDimmed( EMPXCmdSongDetails,
+                                    fileDetailVisibility );
+                                aMenuPane->SetItemDimmed( EMPXCmdAlbumArt,
+                                    fileDetailVisibility );
+#ifdef SINGLE_CLICK_INCLUDED
+                                aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );  
+#else
+                                TBool vis = ETrue;
+                                TRAPD( err, vis = SetAsRingToneOptionVisibilityL() );
+
+                                if ( err )
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade,
+                                        ETrue); // dim the option if any sql error.
+                                    }
+                                else
+                                    {
+                                    aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade,
+                                        vis);
+                                    }
+#endif
+                                
+                                if ( array->IsItemBrokenLinkL( currentItem ) ||
+                                    array->IsItemCorruptedL( currentItem ) )
+                                    {
+                                aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
+                                    aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                                    }
+                                else // Show this option even when song is DRM protected
+                                    {
+#ifdef SINGLE_CLICK_INCLUDED
+                                    aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+#else                                    
+                                    aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, EFalse );
+#endif
+                                    }
+                                }
+                            aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
+                            if ( !iUsingNokiaService )
+                                {
+                                aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                                }
+                            if (iServiceHandler->HandleSubmenuL(*aMenuPane))
+                                {
+                                return;
+                                }
+                            break;
+                            }
+                        case EMPXCommand:
+                            {
+                            aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                            aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
+
+                            }
+                            break;
+                        default:
+                            {
+                            // other types, not handled
+                            break;
+                            }
+                        }
+                    }
+                }
+            else
+                {
+                // list empty
+                aMenuPane->SetItemDimmed( EMPXCmdUseAsCascade, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdSongDetails, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdRename, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdAlbumArt, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, ETrue );
+                aMenuPane->SetItemDimmed( EMPXCmdPlaylistDetails, ETrue );
+                }
+            aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden );
+            break;
+            }
+        case R_MPX_ADD_TO_PL_SUB_MENU:
+            {
+            aMenuPane->SetItemDimmed( EMPXCmdAddToSavedPlaylist, !FindPlaylistsL() );
+            break;
+            }
+        case R_MPX_COLLECTION_PLAY_VIA_SUB_MENU:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                AddPlayersNamesToMenuL( *aMenuPane );
+                }
+            break;
+            }
+        case R_MPX_COLLECTION_VIEW_MUSIC_MENU:
+            {
+            MMPXPlaybackUtility* pdPlaybackUtility;
+            pdPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid( KProgressDownloadUid ) );
+            MMPXSource* pdsource( pdPlaybackUtility->Source() );
+            MMPXSource* source( iPlaybackUtility->Source() );
+            TBool hideNowPlaying;
+            hideNowPlaying = ( (pdsource == 0)
+                           &&  (source == 0));
+            pdPlaybackUtility->Close();
+            if ( hideNowPlaying )
+                {
+                aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
+                }
+            if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive)
+                {
+                aMenuPane->SetItemDimmed( EMPXCmdRefreshLibrary, ETrue );
+                }
+            aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden );
+            aMenuPane->SetItemDimmed(
+                EMPXCmdGoToMusicShop, iGoToMusicShopOptionHidden );
+            if (iOperatorMusicStore)
+            	{
+            	aMenuPane->SetItemDimmed(EMPXCmdGoToMusicShop, ETrue);
+            	}
+            else
+            	{
+            	aMenuPane->SetItemDimmed(EMPXCmdGoToMultipleMusicShop, ETrue);
+          		}
+            break;
+            }
+        case R_MPX_COLLECTION_VIEW_EMBEDDED_PLAYLIST_VIEW:
+            {
+            // if it's from browser/messaging, display save option if
+            // it has not been saved
+            aMenuPane->SetItemDimmed( EMPXCmdSavePlaylist,
+                ( !iCommonUiHelper->IsHostMessagingBrowserL() || !MPXTlsHelper::NeedSave() ) );
+            aMenuPane->SetItemDimmed( EMPXCmdFindInMusicShop, isListEmpty );
+
+            break;
+            }
+        case R_MPX_PLAYBACK_COLLECTION_MUSICSHOP_SUB_MENU:
+        	{
+        	aMenuPane->SetItemTextL(EMPXCmdGoToOperatorMusicShop,  iOperatorMusicStoreName->Des() );
+        	break;
+        	}
+        case R_AVKON_MENUPANE_MARKABLE_LIST:
+            {
+            // Mark/Unmark submenu is displayed only if USB is on going
+            if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive)
+                {
+                MPX_DEBUG1("CMPXCollectionViewHgImp::DynInitMenuPaneL() dimmed Mark/Unmark submenu");
+                aMenuPane->SetItemDimmed(EAknCmdEditListMenu, ETrue);
+                }
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+
+#ifndef SINGLE_CLICK_INCLUDED
+		if ( iServiceHandler->IsAiwMenu(aResourceId) && aResourceId == R_MPX_USE_AS_CASCADE )
+            {
+            MPX_DEBUG1( "CMPXCollectionViewHgImp::DynInitMenuPaneL(): Aiw menu for assign" );
+            CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+            FillAiwParametersL(paramList);
+            iServiceHandler->InitializeMenuPaneL(*aMenuPane,
+                                                aResourceId,
+                                                EMPXCmdAiwCmdAssign,
+                                                paramList);
+            MPX_DEBUG1( "CMPXCollectionViewHgImp::DynInitMenuPaneL(): Aiw menu for assign end" );
+            }
+#endif
+
+    if (!(aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST && usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive))
+        {
+        // Custom handling of menu pane for markable lists
+        iContainer->HandleMarkableListDynInitMenuPane(
+            aResourceId,
+            aMenuPane );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikListBoxObserver
+// Handles listbox events.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleListBoxEventL(
+    CEikListBox* /*aListBox*/,
+    TListBoxEvent aEventType)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleListBoxEventL" );
+    MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleListBoxEventL iLastDepth = %d", iLastDepth );
+    MPX_PERF_CHECKPT( "Select collection item to open" );
+    if ( iContainer )
+        {
+        //to keep/change focus on right song in rename/remove
+#ifdef SINGLE_CLICK_INCLUDED
+        if ( aEventType == EEventItemSingleClicked )         
+#else
+        if ( aEventType == EEventItemClicked )
+#endif
+            {
+            if ( !iHandlingKeyEvent && iCollectionCacheReady )
+                {
+                CMPXCommonListBoxArrayBase* listboxArray( iContainer->ListBoxArray() );
+                TInt currentIndex( iContainer->CurrentLbxItemIndex() );
+
+                CMPXCommand* command = CMPXCommand::NewL();
+                CleanupStack::PushL( command );
+                command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId,
+                                                          KMPXCommandIdCollectionSelect );
+                command->SetTObjectValueL( KMPXCommandCollectionSelectIndex, currentIndex );
+                command->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+                iCollectionUtility->Collection().CommandL( *command );
+                CleanupStack::PopAndDestroy( command );
+                }
+            }
+
+        if ( aEventType == EEventEnterKeyPressed || aEventType == EEventItemDoubleClicked
+#ifdef SINGLE_CLICK_INCLUDED
+            || aEventType == EEventItemSingleClicked
+#endif
+           )
+            {
+            if ( iContainer->IsInReorderMode() )
+                {
+                ProcessCommandL( iContainer->IsInReorderMode() ?
+                    EMPXCmdReorderDrop : EMPXCmdReorderGrab );
+                iIsGrabbed = !iIsGrabbed;
+                }
+            else if ( !iHandlingKeyEvent )
+                {
+                TMPXPlaybackState pbState( iPlaybackUtility->StateL() );
+                TBool isEqual( EFalse );
+                if ( pbState == EPbStatePlaying || pbState == EPbStatePaused )
+                    {
+                    // in currently playing view, check if current item is playing
+                    if ( iContainer->CurrentLbxItemIndex() ==
+                        iContainer->PlaybackIndex() )
+                        {
+                        isEqual = ETrue;
+                        }
+                    }
+
+                if ( isEqual )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleListBoxEventL going to now playing view" );
+                    if ( pbState == EPbStatePaused )
+                        {
+                        MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleListBoxEventL resuming playback" );
+                        iPlaybackUtility->CommandL( EPbCmdPlay );
+                        }
+                    HandleCommandL( EMPXCmdGoToNowPlaying );
+                    }
+                else
+                    {
+                    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+                    CleanupStack::PushL( cpath );
+                    if ( cpath->Levels() == ( iLastDepth + 1 ) )
+                        {
+                        // navigated in one level
+                        iLastDepth++;
+                        iBottomIndex->AppendL(
+                            iContainer->BottomLbxItemIndex() );
+                        }
+                    else
+                        {
+                        // invalid path, rebuild with all 0
+                        iBottomIndex->Reset();
+                        iLastDepth = cpath->Levels();
+                        for ( TInt i = 0; i < iLastDepth; i++ )
+                            {
+                            iBottomIndex->AppendL( 0 );
+                            }
+                        }
+                    CleanupStack::PopAndDestroy( cpath );
+                    TInt currentItem( iContainer->CurrentLbxItemIndex() );
+                    MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleListBoxEventL Opening Item: %d", currentItem );
+
+                    iHandlingKeyEvent = ETrue;
+
+                    // Needed to reset the status of iPreservedState
+                    if ( EPbStateStopped == pbState )
+                        {
+                        iPlaybackUtility->CommandL(EPbCmdResetPreserveState);
+                        }
+
+    #ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+                    // check to see if user has selected podcast item
+                    if ( (iLastDepth == KMusicCollectionMenuLevel) &&
+                         (currentItem == KMusicMenuPodcastMenuItemIndex) &&
+                         !iDisablePodcasting )
+                        {
+                        // open the podcast collection db plugin
+                        iPodcast = ETrue;
+                        CMPXCollectionPath* mainPodcastMenu = CMPXCollectionPath::NewL();
+                        CleanupStack::PushL( mainPodcastMenu );
+                        mainPodcastMenu->AppendL(KPodcastCollectionUid);
+                        iCollectionUtility->Collection().OpenL( *mainPodcastMenu );
+						iFirstIncrementalBatch = ETrue;
+                        CleanupStack::PopAndDestroy( mainPodcastMenu );
+
+                        // activate the podcast collection view
+                        RArray<TUid> uids;
+                        CleanupClosePushL( uids );
+                        uids.AppendL( TUid::Uid( KMPXPluginTypeCollectionUid ) );
+                        uids.AppendL( TUid::Uid( KPodcastCollectionUid ));
+                        iViewUtility->ActivateViewL(uids);
+
+                        CleanupStack::PopAndDestroy( &uids );
+                        }
+                    else
+    #endif
+                        {
+                        if(iCollectionCacheReady)
+                            {
+                            CMPXCommonListBoxArrayBase* listboxArray( iContainer->ListBoxArray() );
+                            TInt currentIndex( iContainer->CurrentLbxItemIndex() );
+                            const CMPXMedia& media( listboxArray->MediaL( currentIndex ) );
+                            TMPXGeneralType type(
+                                media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType ) );
+                            TMPXGeneralCategory category(
+                                media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory ) );
+                            if ( type != EMPXItem || category != EMPXSong )
+                                {
+                                if ( type == EMPXGroup && category== EMPXSong )
+                                    {
+                                    // dismiss for HGList
+                                    //StartWaitNoteL( EMPXImmediatelyOpeningNote );
+                                    }
+                                else
+                                    {
+                                    //do not show wait note if opening a song
+                                    // dismiss for HGList
+                                    //StartWaitNoteL( EMPXOpeningNote );
+                                    }
+                                }
+                            iCollectionUtility->Collection().OpenL( currentItem );
+							iFirstIncrementalBatch = ETrue;
+                            }
+                        }
+
+                    }
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleListBoxEventL Busy, ignoring command" );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikCommandObserver
+// Processes user commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::ProcessCommandL(TInt aCommandId)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::ProcessCommandL" );
+
+    switch( aCommandId )
+        {
+        case EMPXCmdReorderDrop:
+            {
+            SaveCurrentPlaylistL();
+            iContainer->ConfirmReorderL();
+            DeactivateReorderGrabbedModeL( EFalse );
+            SetNewCbaL( R_MPX_CUI_REORDER_GRAB_DONE_CBA );
+            break;
+            }
+        case EMPXCmdReorderGrab:
+            {
+            SetNewCbaL( R_MPX_CUI_REORDER_DROP_CANCEL_CBA );
+            ActivateReorderGrabbedModeL();
+            break;
+            }
+        case EMPXCmdReorderCancel:
+            {
+            iCurrentHighlightedIndex = iContainer->GetOriginalIndex();
+            MPX_DEBUG2( "CMPXCollectionViewHgImp::ProcessCommandL Setting iCurrentHighlightedIndex = %d", iCurrentHighlightedIndex );
+            iContainer->CancelReorder();
+            } // Fall through on purpose
+        case EMPXCmdReorderDone:
+            {
+            DeactivateReorderGrabbedModeL( ETrue );
+            break;
+            }
+        case EMPXCmdUpArrow:
+            {
+            iIgnoreNextFocusChangedMessage = ETrue;
+            if ( iContainer->IsInReorderMode() )
+                {
+                iContainer->MoveReorderIndex( KMPXDirectionUp );
+                }
+            else
+                {
+                iDownCount = 0;
+
+                if( iUpCount != KErrNotFound )
+                    {
+                    if( iUpCount++ > KIncrementalDirectionCount )
+                        {
+                        iIncrementalOpenUtil->SetDirection( CMPXCollectionOpenUtility::EFetchUp );
+                        iUpCount = KErrNotFound;
+                        }
+                    }
+                }
+            break;
+            }
+        case EMPXCmdDownArrow:
+            {
+            iIgnoreNextFocusChangedMessage = ETrue;
+            if ( iContainer->IsInReorderMode() )
+                {
+                iContainer->MoveReorderIndex( KMPXDirectionDown );
+                }
+            else
+                {
+                iUpCount = 0;
+
+                if( iDownCount != KErrNotFound )
+                    {
+                    if( iDownCount++ > KIncrementalDirectionCount  )
+                        {
+                        iIncrementalOpenUtil->SetDirection( CMPXCollectionOpenUtility::EFetchDown );
+                        iDownCount = KErrNotFound;
+                        }
+
+                    }
+                }
+            break;
+            }
+        case EMPXCmdCommonEnterKey:
+            {
+            // Handle list box event for enter key pressed
+            TInt index( iContainer->CurrentLbxItemIndex() );
+            if( index >= 0 )
+            	{
+                HandleListBoxEventL(
+            	    NULL, // ignore
+            	    EEventEnterKeyPressed );
+            	}
+            break;
+            }
+
+		case EMPXCmdGoToNowPlaying:
+			{
+			HandleCommandL( aCommandId );
+			break;
+			}
+        case EMPXCmdUpArrowAfterListboxHandled:
+            {
+            if ( iContainer->IsInReorderMode() )
+                {
+                TInt index( iContainer->CurrentLbxItemIndex() );
+                if ( index == iContainer->CurrentListItemCount() - 1 )
+                    {
+                    // if after up arrow is pressed, and end up at the
+                    // lowest index.  list box looped, sync with listboxarray needed
+                    iContainer->SetReorderIndex( index );
+                    iContainer->HandleLbxItemAdditionL();
+                    // need to set index and redraw
+                    iContainer->SetLbxCurrentItemIndexAndDraw( index );
+                    }
+                UpdateReorderNaviPaneL();
+                }
+            break;
+            }
+        case EMPXCmdDownArrowAfterListboxHandled:
+            {
+            if ( iContainer->IsInReorderMode() )
+                {
+                TInt index( iContainer->CurrentLbxItemIndex() );
+                if ( index == 0 )
+                    {
+                    // if after down arrow is pressed, and end up at the
+                    // top index.  list box looped, sync with listboxarray needed
+                    iContainer->SetReorderIndex( index );
+                    iContainer->HandleLbxItemAdditionL();
+                    }
+                UpdateReorderNaviPaneL();
+                }
+            break;
+            }
+        case EMPXCmdCommonDelete:
+            {
+            if ( !iIsEmbedded )
+                {
+                StoreListboxItemIndexL();
+                // embedded mode doesn't support delete key
+                DeleteSelectedItemsL(aCommandId);
+                }
+            break;
+            }
+        case EMPXCmdCommonResourceChange:
+            {
+            iContainer->SetRect( ClientRect() );
+            break;
+            }
+        case EAknSoftkeyEmpty:
+            {
+            // do nothing.  handled to avoid "unsupported" message
+            break;
+            }
+#ifdef __ENABLE_MSK
+        case EMPXCmdCommonUpdateMiddleSoftKey:
+            {
+            // Determine middle soft key labeling
+            UpdateMiddleSoftKeyDisplayL( iCurrentMskId );
+            break;
+            }
+        case EAknSoftkeyContextOptions :
+            {
+            // set context menu flag
+            iShowContextMenu = ETrue;
+            // open context menu (by processing "Options" command)
+            if ( iContainer )
+                {
+                iSelectionIndexCache = iContainer->CurrentSelectionIndicesL(); // not owned
+                MPX_DEBUG2( "CMPXCollectionViewHgImp::ProcessCommandL count = %d", iSelectionIndexCache->Count() );
+                }
+            CAknView::ProcessCommandL( EAknSoftkeyOptions );
+            break;
+            }
+#endif // __ENABLE_MSK
+        case EAknCmdExit:
+			{
+            HandleCommandL( aCommandId );
+			CAknView::ProcessCommandL( aCommandId );
+			break;
+			}
+		case EAknSoftkeyOptions:
+            {
+            if ( iContainer )
+                {
+                iSelectionIndexCache = iContainer->CurrentSelectionIndicesL(); // not owned
+                MPX_DEBUG2( "CMPXCollectionViewHgImp::ProcessCommandL count = %d", iSelectionIndexCache->Count() );
+                }
+            }
+        default:
+            {
+            CAknView::ProcessCommandL( aCommandId );
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::LaunchMusicShopL
+// Launch music shop application
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::LaunchMusicShopL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::LaunchMusicShopL" );
+
+    if ( iMusicStoreUID != 0)
+        {
+    TApaTaskList tasList( iCoeEnv->WsSession() );
+        TApaTask task = tasList.FindApp( TUid::Uid(iMusicStoreUID) );
+
+    if ( task.Exists() )
+        {
+        task.BringToForeground();
+        }
+    else
+        {
+        RApaLsSession session;
+        if ( KErrNone == session.Connect() )
+            {
+            CleanupClosePushL( session );
+            TThreadId threadId;
+                session.CreateDocument( KNullDesC, TUid::Uid(iMusicStoreUID), threadId );
+            CleanupStack::PopAndDestroy(&session);
+                }
+            }
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPlayerCategoryView::DoFindInMusicShopL
+// Handle find in music shop event
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoFindInMusicShopL( const TDesC& aSongName,
+                                                const TDesC& aArtistName,
+                                                const TDesC& aAlbumName )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoFindInMusicShopL" );
+    CMPXFindInMShop* finder = CMPXFindInMShop::NewL();
+    CleanupStack::PushL( finder );
+    HBufC* url = NULL;
+    url = finder->CreateSearchURLL( aSongName,
+                                     aArtistName,
+                                     aAlbumName,
+                                     KNullDesC,     // Composer - Not used
+                                     KNullDesC );   // Genre - Not used
+    CleanupStack::PushL(url);   // the pointer will be poped
+    RProperty::Set( TUid::Uid(iMusicStoreUID),
+                    KMShopCategoryId,
+                    KFindInMShopKeyValid );  // Set Key to Valid
+
+    RProperty::Set( TUid::Uid(iMusicStoreUID),
+                    KMShopCategoryName,
+                    *url );
+
+    LaunchMusicShopL();
+
+
+    if(url)
+        {
+        CleanupStack::PopAndDestroy(url);
+        }
+
+    CleanupStack::PopAndDestroy( finder ); // finder
+    REComSession::FinalClose();
+    }
+
+
+// ----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::SetParamL
+// Set the parameter passed in from viewframework to the current select index
+// ----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::SetParamL( const TDesC* aParam )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::SetParamL" );
+    delete iCurrentSelectedIndex;
+    iCurrentSelectedIndex = NULL;
+    iCurrentSelectedIndex = aParam->AllocL();    //  aParam = L"0" for 1st item
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPlayerCategoryView::DoGetSongMediaPropertyL
+// Handle find in music shop event
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::DoGetSongMediaPropertyL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::DoGetSongMediaPropertyL" );
+
+    if ( iCurrentSelectedIndex )
+        {
+        TLex currentSelectedIndexLex( iCurrentSelectedIndex->Des() );
+        TInt lexToInt = NULL;
+        if ( currentSelectedIndexLex.Val( lexToInt ) == KErrNone )
+            {
+            // Get media property for the current song
+            CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( cpath );
+
+            cpath->Set( lexToInt );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            // to get EMPXMediaGeneralTitle
+            attrs.Append( KMPXMediaGeneralTitle );
+            // to get EMPXMediaMusicArtist and EMPXMediaMusicAlbum
+            attrs.Append( KMPXMediaMusicArtist );
+            attrs.Append( KMPXMediaMusicAlbum );
+
+            // Call MediaL and handle callback at HandleCollectionMediaL
+            iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PopAndDestroy( cpath );
+            }
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::HandleFindAllL
+// Handle callback for "find" operation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleFindAllL(
+    const CMPXMedia& aResults,
+    TBool aComplete,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleFindAllL" );
+    if ( aError == KErrNone )
+        {
+        switch ( iCurrentFindAllLOp )
+            {
+            case EMPXOpFindAllLAlbumArtistAddToNewPlaylist:
+                {
+                iNumSongAddedToPlaylist = aResults.ValueTObjectL<TInt>(
+                    KMPXMediaArrayCount );
+                TBool ret = iCommonUiHelper->CreatePlaylistL(
+                    aResults, this, this );
+                if ( !ret )
+                    {
+                    iAddingToNewPlaylist = EFalse;
+                    }
+                break;
+                }
+            case EMPXOpFindAllLAlbumArtistAddToSavedPlaylist:
+                {
+                if ( !iUserPlaylists )
+                    {
+                    MPX_DEBUG1( "CMPXCollectionViewHgImp::HandleFindAllL Null iUserPlaylists" );
+                    User::Leave( KErrArgument );
+                    }
+                iNumSongAddedToPlaylist = aResults.ValueTObjectL<TInt>(
+                    KMPXMediaArrayCount );
+                MPX_TRAPD( err, iCommonUiHelper->AddToSavedPlaylistL(
+                    *iUserPlaylists, aResults, this, this ) );
+                if ( err != KErrNone )
+                    {
+                    HandleError( err );
+                    }
+                break;
+                }
+            case EMPXOpFindAllLRenameAlbum:
+            case EMPXOpFindAllLRenameArtist:
+            case EMPXOpFindAllLRenameGenre:
+            case EMPXOpFindAllLRenameComposer:
+                {
+                const CMPXMediaArray* mediaArray =
+                    aResults.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+                User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+
+                iSetMediaLCount = mediaArray->Count();
+                iInvalidFileExist = EFalse;
+                TInt invalidItemCount( 0 );
+                MPX_DEBUG2( "CMPXCollectionViewHgImp::HandleFindAllL Rename song count = %d", iSetMediaLCount );
+                iIsWaitNoteCanceled = EFalse;
+                HBufC* waitNoteString( NULL );
+                if ( iSetMediaLCount > 1 )
+                    {
+                    // multiple item
+                    waitNoteString = StringLoader::LoadLC(
+                        R_MPX_COLLECTION_NOTE_UPDATING_MULTIPLE_ITEMS,
+                        iSetMediaLCount );
+                    }
+                else
+                    {
+                    // single item
+                    waitNoteString = StringLoader::LoadLC(
+                        R_MPX_COLLECTION_NOTE_UPDATING_ITEM );
+                    }
+                HandleCommandL( EMPXCmdIgnoreExternalCommand );
+                iCommonUiHelper->ShowWaitNoteL( *waitNoteString,
+                    R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP, EFalse, this );
+                CleanupStack::PopAndDestroy( waitNoteString );
+
+                TPtrC art( KNullDesC );
+                if ( (iCurrentFindAllLOp == EMPXOpFindAllLRenameAlbum || iCurrentFindAllLOp == EMPXOpFindAllLRenameArtist )&&
+                        iContainer )
+                    {
+                    CMPXCommonListBoxArrayBase* listboxArray(
+                        iContainer->ListBoxArray() );
+                    TInt currentIndex( iContainer->CurrentLbxItemIndex() );
+                    const CMPXMedia& currentMedia( listboxArray->MediaL( currentIndex ) );
+                    if ( currentMedia.IsSupported( KMPXMediaMusicAlbumArtFileName ) )
+                        {
+                        art.Set( currentMedia.ValueText( KMPXMediaMusicAlbumArtFileName ) );
+                        }
+                    }
+
+                CMPXMediaArray* entryArray = CMPXMediaArray::NewL();
+                CleanupStack::PushL( entryArray );
+                TUid collectionId( KNullUid );
+                for ( TInt i = 0; i < iSetMediaLCount && !iIsWaitNoteCanceled; i++ )
+                    {
+                    CMPXMedia* media( mediaArray->AtL( i ) );
+                    TUint flags( 0 );
+                    if( media->IsSupported( KMPXMediaGeneralFlags ) )
+                        {
+                        flags = media->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+                        }
+                    const TDesC& songUri =
+                        media->ValueText( KMPXMediaGeneralUri );
+                    TBool fileExist( ConeUtils::FileExists( songUri ) );
+                    if (!(flags & KMPXMediaGeneralFlagsIsInvalid)
+                     && !(flags & KMPXMediaGeneralFlagsIsCorrupted)
+                     && fileExist )
+                        {
+                        CMPXMedia* entry = CMPXMedia::NewL();
+                        CleanupStack::PushL( entry );
+                        entry->SetTextValueL( KMPXMediaGeneralUri, songUri );
+                        TMPXItemId id( media->ValueTObjectL<TMPXItemId>(
+                                        KMPXMediaGeneralId ) );
+                        collectionId = media->ValueTObjectL<TUid>(
+                                             KMPXMediaGeneralCollectionId );
+                        entry->SetTObjectValueL<TMPXItemId>(
+                            KMPXMediaGeneralId, id );
+                        entry->SetTObjectValueL<TUid>(
+                            KMPXMediaGeneralCollectionId, collectionId );
+                        entry->SetTObjectValueL<TMPXGeneralType>(
+                            KMPXMediaGeneralType, EMPXItem );
+                        entry->SetTObjectValueL<TMPXGeneralCategory>(
+                            KMPXMediaGeneralCategory, EMPXSong );
+
+                        TPtrC ptr( songUri );
+                        MPX_DEBUG3( "CMPXCollectionViewHgImp::HandleFindAllL setting item id 0x%x, uri %S", id.iId1, &ptr );
+                        switch ( iCurrentFindAllLOp )
+                            {
+                            case EMPXOpFindAllLRenameAlbum:
+                                {
+                                if ( art.Compare( KNullDesC ) != 0 &&
+                                        art.Compare(
+                                            media->ValueText( KMPXMediaMusicAlbumArtFileName ) ) == 0 )
+                                    {
+                                    entry->SetTextValueL(
+                                        KMPXMediaMusicAlbumArtFileName,
+                                        art );
+                                    }
+                                entry->SetTextValueL(
+                                    KMPXMediaMusicAlbum, *iNewName );
+                                break;
+                                }
+                            case EMPXOpFindAllLRenameArtist:
+                                {
+                                if ( art.Compare( KNullDesC ) != 0 &&
+                                        art.Compare(
+                                            media->ValueText( KMPXMediaMusicAlbumArtFileName ) ) == 0 )
+                                    {
+                                    entry->SetTextValueL(
+                                        KMPXMediaMusicAlbumArtFileName,
+                                        art );
+                                    }
+                                entry->SetTextValueL(
+                                    KMPXMediaMusicArtist, *iNewName );
+                                break;
+                                }
+                            case EMPXOpFindAllLRenameGenre:
+                                {
+                                entry->SetTextValueL(
+                                    KMPXMediaMusicGenre, *iNewName );
+                                break;
+                                }
+                            case EMPXOpFindAllLRenameComposer:
+                                {
+                                entry->SetTextValueL(
+                                    KMPXMediaMusicComposer, *iNewName );
+                                break;
+                                }
+                            default:
+                                {
+                                // should not reach here
+                                ASSERT( 0 );
+                                break;
+                                }
+                            }
+                        if ( (iCurrentFindAllLOp == EMPXOpFindAllLRenameAlbum || iCurrentFindAllLOp == EMPXOpFindAllLRenameArtist) &&
+                                art.Compare( KNullDesC ) != 0 &&
+                                art.Compare(
+                                    media->ValueText( KMPXMediaMusicAlbumArtFileName ) ) == 0 )
+                            {
+                            entryArray->InsertL( entry, 0 );  // ownership xfer
+                            }
+                        else
+                            {
+                            entryArray->AppendL( entry );  // ownership xfer
+                            }
+                        CleanupStack::Pop( entry );
+                        }
+                    else
+                        {
+                        iInvalidFileExist = ETrue;
+                        invalidItemCount++;
+                        if ( !fileExist )
+                            {
+                            UpdateDatabaseFlagL( KErrNotFound, *media,
+                                KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse );
+                            }
+                        }
+                    }
+                // Package array of items to set
+                //
+                CMPXMedia* setData = CMPXMedia::NewL();
+                CleanupStack::PushL( setData );
+                setData->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup );
+                setData->SetCObjectValueL( KMPXMediaArrayContents, entryArray );
+
+                // Generate the command
+                //
+                CMPXCommand* command = CMPXCommand::NewL();
+                CleanupStack::PushL( command );
+                command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId,
+                                                          KMPXCommandIdCollectionSet );
+                command->SetTObjectValueL<TInt>( KMPXCommandGeneralCollectionId,
+                                                 collectionId.iUid);
+                command->SetCObjectValueL( KMPXCommandColSetMedia, setData );
+
+                iCollectionUtility->Collection().CommandL( *command );
+
+                // Cleanup
+                CleanupStack::PopAndDestroy( command );
+                CleanupStack::PopAndDestroy( setData );
+                CleanupStack::PopAndDestroy( entryArray );
+
+                iSetMediaLCount = 1;  // 1 async set
+                MPX_DEBUG3( "CMPXCollectionViewHgImp::HandleFindAllL valid items = %d, invalid items = %d", iSetMediaLCount, invalidItemCount );
+                if ( iSetMediaLCount == 0 )
+                    {
+                    // if all items are invalid, display note
+                    // now instead of waiting for callback
+                    HandleRenameOpCompleteL();
+                    }
+                break;
+                }
+            case EMPXOpFindAllLPlaylistTracksCount:
+                {
+                TInt trackCount = aResults.ValueTObjectL<TInt>( KMPXMediaArrayCount );
+                MPX_DEBUG2( "CMPXCollectionViewHgImp:: playlist tracks count = %d", trackCount );
+                if ( trackCount == 0 )
+                    {
+                    // empty playlist, display info note
+                    HBufC* string = StringLoader::LoadLC(
+                        R_MPX_COLLECTION_NOTE_EMPTY_PLAYLIST );
+                    iCommonUiHelper->DisplayInfoNoteL( *string );
+                    CleanupStack::PopAndDestroy( string );
+                    }
+                else
+                    {
+                    HandleCommandL( EMPXCmdForcePlay );
+                    }
+                break;
+                }
+            case EMPXOpFindAllLUpnp:
+                {
+                if ( iUpnpFrameworkSupport )
+                    {
+                    DoHandleCopyToRemoteL( aResults, aComplete );
+                    }
+                break;
+                }
+            case EMPXOpFindAllLUpnpPlayback:
+                {
+                if ( iUpnpFrameworkSupport )
+                    {
+                    TInt trackCount = aResults.ValueTObjectL<TInt>( KMPXMediaArrayCount );
+                    MPX_DEBUG2( "CMPXCollectionViewHgImp:: playlist tracks count = %d", trackCount );
+                    if ( trackCount > 0 )
+                        {
+                        TInt currentListBoxItemIndex(
+                            iContainer->CurrentLbxItemIndex() );
+                        if ( currentListBoxItemIndex >= 0 )
+                            {
+                            GetCurrentPlayerDetails();
+
+                            // Needed to reset the status of iPreservedState
+                            if ( EPbStateStopped == iPlaybackUtility->StateL() )
+                                {
+                                iPlaybackUtility->CommandL(EPbCmdResetPreserveState);
+                                }
+                            if(iCollectionCacheReady)
+                                {
+                                iCollectionUtility->Collection().OpenL(
+                                                currentListBoxItemIndex,
+                                                EMPXOpenPlaylistOnly);
+								iFirstIncrementalBatch = ETrue;
+                                }
+                            }
+                        }
+                    else
+                        {
+                        // empty playlist, display info note
+                        HBufC* string = StringLoader::LoadLC(
+                            R_MPX_COLLECTION_NOTE_EMPTY_PLAYLIST );
+                        iCommonUiHelper->DisplayInfoNoteL( *string );
+                        CleanupStack::PopAndDestroy( string );
+                        }
+                    }
+                break;
+                }
+            default:
+                {
+                // should not reach here
+                break;
+                }
+            }
+        }
+    else
+        {
+        HandleError( aError );
+        }
+    iCurrentFindAllLOp = EMPXOpFindAllLIdle;
+
+    if ( !iUpnpFrameworkSupport )
+        {
+        // Remove compilation warnings
+        (void)aComplete;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::HandleViewActivation
+// Handle view activation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleViewActivation(
+    const TUid& aCurrentViewType,
+    const TUid& /*aPreviousViewType*/ )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::HandleViewActivation" );
+
+    if ( aCurrentViewType.iUid == KMPXPluginTypeCollectionUid )
+        {
+        if( iAddingSong )
+            {
+            iAddingSong = EFalse;
+            TRAP_IGNORE( GetDurationL() );
+            TRAP_IGNORE( UpdateNaviPaneL() );
+            }
+        if( iInAlbumArtDialog )
+            {
+            iInAlbumArtDialog = EFalse;
+            TRAP_IGNORE( UpdateTitlePaneL() );
+            }
+        if( iInSongDetails )
+            {
+            iInSongDetails = EFalse;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::HandleViewUpdate
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleViewUpdate(
+    TUid /* aViewUid */,
+    MMPXViewActivationObserver::TViewUpdateEvent /* aUpdateEvent */,
+    TBool /* aLoaded */,
+    TInt /* aData */)
+    {
+    // Do nothing, this should be handled by the AppUI
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::HandleViewActivation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleViewActivation(const TVwsViewId& aNewlyActivatedViewId,
+                                                 const TVwsViewId& /*aViewIdToBeDeactivated */)
+    {
+    if( aNewlyActivatedViewId.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) &&
+        aNewlyActivatedViewId.iViewUid == Id() )
+        {
+        TRAP_IGNORE( UpdateNaviPaneL() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::HandleViewDeactivation
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,
+                                                   const TVwsViewId& /*aNewlyActivatedViewId*/)
+    {
+    if( aViewIdToBeDeactivated.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) &&
+        aViewIdToBeDeactivated.iViewUid == Id() )
+        {
+        if( iContainer )
+            {
+            if ( iNaviPane && iNaviDecorator )
+                {
+                if (iNaviPane->Top() == iNaviDecorator) // Only pop if it's the top, don't pop when it's behind a dialog
+                    iNaviPane->Pop( iNaviDecorator );
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::FillAiwParameters
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::FillAiwParametersL(
+    CAiwGenericParamList& aParamList )
+    {
+    CMPXCommonListBoxArrayBase* array( iContainer->ListBoxArray() );
+    const CMPXMedia& media = array->MediaL(
+        iContainer->CurrentLbxItemIndex() );
+    TPtrC location( media.ValueText(KMPXMediaGeneralUri) );
+    TPtrC mimeType( media.ValueText(KMPXMediaGeneralMimeType) );
+
+    if ( !location.Length() )
+        {
+        if ( media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) == KMPXInvalidItemId )
+            {
+            // highlighted item is not yet available
+            MPX_DEBUG1( "CMPXCollectionViewHgImp::FillAiwParametersL item not yet fetched" );
+            User::Leave( KMPXErrDataNotReady );
+            }
+        else
+            {
+            TMPXItemId id(
+                    media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+            CMPXMedia* criteria = CMPXMedia::NewL();
+            CleanupStack::PushL( criteria );
+            criteria->SetTObjectValueL<TMPXGeneralType>(
+                KMPXMediaGeneralType, EMPXItem );
+            criteria->SetTObjectValueL<TMPXGeneralCategory>(
+                KMPXMediaGeneralCategory, EMPXSong );
+            criteria->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL( attrs );
+            attrs.Append( KMPXMediaGeneralUri );
+            attrs.Append( KMPXMediaGeneralMimeType );
+
+            CMPXMedia* songInfo = iCollectionUtility->Collection().FindAllL( *criteria,
+                                                             attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PushL( songInfo );
+
+            const CMPXMediaArray* mediaArray(
+                songInfo->Value<CMPXMediaArray>( KMPXMediaArrayContents ) );
+            User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+
+            if ( mediaArray->Count() > 0 )
+                {
+                CMPXMedia* si( mediaArray->AtL( 0 ) );
+                location.Set( si->ValueText(KMPXMediaGeneralUri) );
+                mimeType.Set( si->ValueText(KMPXMediaGeneralMimeType) );
+                }
+            CleanupStack::PopAndDestroy( songInfo );
+            CleanupStack::PopAndDestroy( criteria );
+            }
+        }
+
+    TAiwVariant varMime(mimeType);
+    if ( !mimeType.Length() && ( iMediaRecognizer ) )
+        {
+        varMime.Set(iMediaRecognizer->MimeTypeL(location));
+        }
+    TAiwGenericParam paramMime(EGenericParamMIMEType, varMime);
+    aParamList.Reset();
+    aParamList.AppendL(paramMime);
+    TAiwVariant varFile(location);
+    TAiwGenericParam paramFile(EGenericParamFile, varFile);
+    aParamList.AppendL(paramFile);
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::GetUint32Presentation
+//
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::GetUint32Presentation( TUint32& aResult,
+                                                   const TDesC8& aBuf,
+                                                   TInt aOffset )
+    {
+    aResult = 0;
+    const TInt KProEngByteLength( 8 );
+    const TInt length( aBuf.Length() );
+    const TInt maxBitShift( KProEngByteLength * ( length - 1 ) );
+
+    for( TInt i( 0 ); i<length; ++i )
+        {
+        aResult |= ( aBuf[aOffset + i] <<
+                   ( maxBitShift - ( KProEngByteLength * i ) ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::LaunchMusicShopL
+// Launch music shop application
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::LaunchOperatorJavaMusicShopL(TUid aUid)
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::LaunchOperatorMusicShopL" );
+    TThreadId threadId;
+    RApaLsSession apaSession;
+    User::LeaveIfError( apaSession.Connect() );
+    CleanupClosePushL( apaSession );
+    apaSession.StartDocument(_L(""), aUid, threadId);
+    CleanupStack::PopAndDestroy( &apaSession ); // close apaSession
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::LaunchMusicShopL
+// Launch music shop application
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::LaunchOperatorNativeMusicShopL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::LaunchMusicShopL" );
+
+    TApaTaskList tasList( iCoeEnv->WsSession() );
+    TApaTask task = tasList.FindApp( TUid::Uid(iOperatorNativeMusicStoreUID) );
+
+    if ( task.Exists() )
+        {
+        task.BringToForeground();
+        }
+    else
+        {
+        RApaLsSession session;
+        if ( KErrNone == session.Connect() )
+            {
+            CleanupClosePushL( session );
+            TThreadId threadId;
+            session.CreateDocument( KNullDesC, TUid::Uid(iOperatorNativeMusicStoreUID), threadId );
+            CleanupStack::PopAndDestroy(&session);
+            }
+        }
+    }
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::LaunchOperatorURLMusicShopL
+// Launch music shop URL application
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::LaunchOperatorURLMusicShopL()
+    {
+    MPX_FUNC( "CMPXCollectionViewHgImp::LaunchOperatorURLMusicShopL" );
+    const TUid KOSSBrowserUidValue = {0x10008D39}; // 0x1020724D for S60 3rd Ed
+    TUid id(KOSSBrowserUidValue);
+    TApaTaskList taskList(CEikonEnv::Static()->WsSession());
+    TApaTask task = taskList.FindApp(id);
+
+    if ( task.Exists() )
+        {
+        task.BringToForeground();
+        if ( iOperatorMusicStoreURI->Length() != NULL )
+            {
+            TBuf8<KMPXMaxHistoryLength> tempUrl;
+            tempUrl.Copy(iOperatorMusicStoreURI->Des());
+            task.SendMessage(TUid::Uid(0), tempUrl);
+            }
+        }
+    else
+        {
+        RApaLsSession apaLsSession;
+        if ( KErrNone == apaLsSession.Connect() )
+            {
+            CleanupClosePushL( apaLsSession );
+            TThreadId threadId;
+
+ 			apaLsSession.StartDocument(*iOperatorMusicStoreURI, KOSSBrowserUidValue, threadId);
+         	CleanupStack::PopAndDestroy(&apaLsSession);
+            }
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::StoreListboxItemIndexL
+// Stores the current list box item index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::StoreListboxItemIndexL()
+	{
+    TInt currentIndex( iContainer->CurrentLbxItemIndex() );
+
+	CMPXCommand* command = CMPXCommand::NewL();
+	CleanupStack::PushL( command );
+	command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId,
+											  KMPXCommandIdCollectionSelect );
+	command->SetTObjectValueL( KMPXCommandCollectionSelectIndex, currentIndex );
+	command->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+	iCollectionUtility->Collection().CommandL( *command );
+	CleanupStack::PopAndDestroy( command );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::ChangeCbaVisibility
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::ChangeCbaVisibility( TBool aVisible )
+    {
+    CEikButtonGroupContainer* cba = Cba();
+    if( cba )
+		{
+        cba->MakeVisible( aVisible );
+		cba->DrawDeferred();
+		}
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::OpenAllSongsL
+// Open the collection at all songs level.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::OpenAllSongsL()
+	{
+	CMPXCollectionPath* path = iCollectionUiHelper->MusicAllSongsPathL();
+	CleanupStack::PushL( path );
+	iCollectionUtility->Collection().OpenL( *path );
+	CleanupStack::PopAndDestroy( path );
+	}
+
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::OpenArtistAlbumsL
+// Open the collection at artist & albums level.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::OpenArtistAlbumsL()
+	{
+	CMPXCollectionPath* path = iCollectionUiHelper->MusicMenuPathL();
+	CleanupStack::PushL( path );
+	path->AppendL(KMPXCollectionArtistAlbum);
+	iCollectionUtility->Collection().OpenL( *path );
+	CleanupStack::PopAndDestroy( path );
+	}
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::OpenPlaylistsL
+// Open the collection at playlists level.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::OpenPlaylistsL()
+	{
+	CMPXCollectionPath* path = iCollectionUiHelper->MusicPlaylistPathL();
+	CleanupStack::PushL( path );
+	iCollectionUtility->Collection().OpenL( *path );
+	CleanupStack::PopAndDestroy( path );
+	}
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::OpenGenreL
+// Open the collection at genre level.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::OpenGenreL()
+	{
+	CMPXCollectionPath* path = iCollectionUiHelper->MusicMenuPathL();
+	CleanupStack::PushL( path );
+	path->AppendL(KMPXCollectionGenre); // Genre
+	iCollectionUtility->Collection().OpenL( *path );
+	CleanupStack::PopAndDestroy( path );
+	}
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewHgImp::OpenPodcastsL
+// Open the collection at podcasts level.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgImp::OpenPodcastsL()
+	{
+	CMPXCollectionPath* path = iCollectionUiHelper->PodCastMenuPathL();
+	CleanupStack::PushL( path );
+	iCollectionUtility->Collection().OpenL( *path );
+	CleanupStack::PopAndDestroy( path );
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhglistboxarray.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1136 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listbox array for collection view container
+*
+*/
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include <gulicon.h>
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <aknconsts.h>
+#include <AknIconArray.h>
+#include <avkon.mbg>
+#include <f32file.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxmedia.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediaarray.h>
+#include <mpxlog.h>
+#include <mpxcollectionviewhg.mbg>
+#include <mpxcollectionpath.h>  // TMPXItemId
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxcollectionviewhg.rsg>
+#include <mpxuser.h>
+
+#include <mpxcommonuihelper.h>
+#include "mpxcollectionviewhg.hrh"
+#include "mpxcommoncontainer.hrh"
+#include "mpxcommonlistboxarrayobserver.h"
+#include "mpxcollectionviewhglistboxarray.h"
+
+// CONSTANTS
+_LIT( KMPXCommonListboxFormatString, "%d\t%S" );
+_LIT( KMPXTab, "\t" );
+_LIT( KMPXCollectionViewIconFile, "mpxcollectionviewhg.mbm" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXCollectionViewListBoxArray* CMPXCollectionViewListBoxArray::NewL()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::NewL" );
+    CMPXCollectionViewListBoxArray* self =
+        new ( ELeave ) CMPXCollectionViewListBoxArray();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::CMPXCollectionViewListBoxArray
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXCollectionViewListBoxArray::CMPXCollectionViewListBoxArray() :
+    CMPXCommonListBoxArrayBase()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CMPXCollectionViewListBoxArray::~CMPXCollectionViewListBoxArray()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::~CMPXCollectionViewListBoxArray" );
+    delete iUnknown;
+    delete iMediaOwned;
+    }
+
+// -----------------------------------------------------------------------------
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::ConstructL()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::ConstructL" );
+    iUnknown = StringLoader::LoadL(R_MPX_QTN_MP_UNKNOWN );
+    iMMCDrive = CMPXCommonUiHelper::MMCDriveNumber();
+    }
+
+// ---------------------------------------------------------------------------
+// Sets playback status
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewListBoxArray::SetPlaybackStatusByIdL(
+    TMPXItemId aId, TMPXPlaybackState aStatus, TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::SetPlaybackStatusByIdL" );
+    // fix crash when click back too quick after play a song
+    // aIndex < 0 means no icon to place, iMedia->Count() == 0 means no song, don't search
+    if ( iMedia == NULL || aIndex < 0 || iMedia->Count() == 0)
+        {
+        return SetPlaybackStatusByIndex( KErrNotFound, aStatus );
+        }
+
+    TInt index( KErrNotFound );
+    TInt count( iMedia->Count() );
+    // Search start from aIndex, then aIndex-1, aIndex+1, aIndex-2, aIndex+2
+    // until the boundary reach then search for the rest
+    if ( aIndex > count - 1 ) // remove song before the last
+        {
+        aIndex = count - 1;
+        }
+    CMPXMedia* origMedia( iMedia->AtL( aIndex ) );
+    TMPXItemId id( origMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+    if ( id == aId )
+        {
+        index = aIndex;
+        }
+    else
+        {
+        TInt upBound( ( count - 1 ) - aIndex );
+        TInt loBound( aIndex - 0 );
+        TInt biBound( Min( upBound, loBound ) );
+        for ( TInt i = 1; i <= biBound; i++ )
+            {
+            CMPXMedia* entry( iMedia->AtL( aIndex - i ) );
+            TMPXItemId id( entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+            if ( id == aId )
+                {
+                index = aIndex - i;
+                break;
+                }
+
+            entry = iMedia->AtL( aIndex + i );
+            id = entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+            if ( id == aId )
+                {
+                index = aIndex + i;
+                break;
+                }
+            }
+        if ( index == KErrNotFound && upBound != loBound ) // still not found search for the rest
+            {
+            TInt begin( ( loBound > upBound ) ? 0 : aIndex + biBound + 1 );
+            TInt end( ( loBound>upBound ) ? aIndex - biBound : count );
+            for ( TInt i = begin; i < end; i++ )
+                {
+                CMPXMedia* entry( iMedia->AtL( i ) );
+                TMPXItemId id( entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                if ( id == aId )
+                    {
+                    index = i;
+                    break;
+                    }
+                }
+            }
+        }
+    return SetPlaybackStatusByIndex( index, aStatus );
+    }
+
+// ---------------------------------------------------------------------------
+// Activates reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::ActivateReorderMode( TBool aEnable )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::ActivateReorderMode" );
+    iReorderActivated = aEnable;
+    if ( !iMediaOwned && aEnable )
+        {
+        // make a copy of the current array so that any modification to the array
+        // does not pollute the master copy
+        MPX_TRAPD( error, iMediaOwned = CMPXMediaArray::NewL() );
+        if ( error == KErrNone )
+            {
+            TInt count( iMedia->Count() );
+            TRAP_IGNORE(
+                for ( TInt i = 0; i < count; i++ )
+                    {
+                    CMPXMedia* entry( iMedia->AtL( i ) );
+                    iMediaOwned->AppendL( *entry );
+                    } );
+            // no need to delete iMedia, we don't own it
+            // iMedia might get reset before we have a chance to delete it
+            // keep a copy of the pointer so that we can delete
+            iMedia = iMediaOwned;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set reorder mode
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::SetReorderGrabbedMode(
+    TBool aEnable, TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::SetReorderGrabbedMode" );
+    iReorder = aEnable;
+    iOriginalIndex = aIndex;
+    iMovedIndex = aIndex;
+    if ( aEnable && aIndex == iIndex )
+        {
+        // if the item currently being moved is now playing
+        // manually move the icon after it's complete, and before the result
+        // is saved to db
+        iMoveNowPlaying = ETrue;
+        }
+    else
+        {
+        iMoveNowPlaying = EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Move current reorder index
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::MoveReorderIndex( TInt aDirection )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::MoveReorderIndex" );
+    if ( iReorder )
+        {
+        if ( ( aDirection == 1 ) && ( iMovedIndex < MdcaCount() - 1 ) )
+            {
+            iMovedIndex++;
+            }
+        else if ( ( aDirection == -1 ) && ( iMovedIndex > 0 ) )
+            {
+            iMovedIndex--;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set current reorder index
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::SetReorderIndex( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::SetReorderIndex" );
+    iMovedIndex = aIndex;
+    }
+
+// ---------------------------------------------------------------------------
+// Confirm reorder
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::ConfirmReorderL()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::ConfirmReorderL" );
+    CMPXMedia* origMedia( iMedia->AtL( iOriginalIndex ) );
+    CMPXMedia* entry( CMPXMedia::NewL( *origMedia ) );
+    iMedia->Remove( iOriginalIndex );
+    iMedia->Insert( entry, iMovedIndex ); // iMedia takes ownership
+    if ( iMoveNowPlaying )
+        {
+        iIndex = iMovedIndex;
+        iMoveNowPlaying = EFalse;
+        }
+    iOriginalIndex = KErrNotFound;
+    iMovedIndex = KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// Cancel reorder
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::CancelReorder()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::CancelReorder" );
+    iOriginalIndex = KErrNotFound;
+    iMovedIndex = KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets original index of currently selected item
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewListBoxArray::GetOriginalIndex() const
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::GetOriginalIndex" );
+    return iOriginalIndex;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the index for the song that's currently playing
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewListBoxArray::GetPlaybackIndex() const
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::GetPlaybackIndex" );
+    return iIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// Indicates if Unknown entry exists in this view
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewListBoxArray::IsCategoryUnknownExist() const
+    {
+    return iIsUnknownExist;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if the current item is a broken link
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewListBoxArray::IsItemBrokenLinkL( TInt aIndex ) const
+    {
+    TBool ret( EFalse );
+    if ( iMedia )
+        {
+        CMPXMedia* entry( iMedia->AtL( aIndex ) );
+        TUint flags( 0 );
+        if( entry->IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+            ret = ( ( flags ) & ( KMPXMediaGeneralFlagsIsInvalid ) );
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if the current item is corrupted
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewListBoxArray::IsItemCorruptedL( TInt aIndex ) const
+    {
+    TBool ret( EFalse );
+    if ( iMedia )
+        {
+        CMPXMedia* entry( iMedia->AtL( aIndex ) );
+        TUint flags( 0 );
+        if( entry->IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+            ret = ( ( flags ) & ( KMPXMediaGeneralFlagsIsCorrupted ) );
+            }
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::IndicationIconIndices
+// Get array of indicator icon indices at the specified view index
+// Only used when using Hitchcock container.
+// -----------------------------------------------------------------------------
+//
+RArray<TInt> CMPXCollectionViewListBoxArray::IndicatorIconIndicesL(
+    TInt aIndex )
+    {
+    RArray<TInt> iconIndices;
+
+    TInt index( GetArrayIndexForListBoxIndex( aIndex ) );
+    CMPXMedia* entry( iMedia->AtL( index ) );
+
+    TMPXGeneralType type( EMPXNoType );
+    if ( entry->IsSupported( KMPXMediaGeneralType ) )
+        {
+        type = entry->ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+        }
+    TMPXGeneralCategory category( EMPXNoCategory );
+    if ( entry->IsSupported( KMPXMediaGeneralCategory ) )
+        {
+        category = entry->ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+        }
+    TUint flags(0);
+    if ( entry->IsSupported( KMPXMediaGeneralFlags ) )
+        {
+        flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+        }
+
+    // reorder icon
+    if ( ( iReorder ) && ( aIndex == iMovedIndex ) )
+        {
+        iconIndices.Append( GetReorderIcon() );
+        }
+    else if ( !iReorderActivated )
+        {
+        // playback status icon
+        if ( iIndex == index )
+            {
+            switch ( iPbState )
+                {
+                case EPbStatePlaying:
+                    {
+                    iconIndices.Append( EMPXClvIconPlay );
+                    break;
+                    }
+                case EPbStatePaused:
+                    {
+                    iconIndices.Append( EMPXClvIconPause );
+                    break;
+                    }
+                default:
+                    {
+                    // other playback states, not handled
+                    break;
+                    }
+                }
+            }
+        }
+
+    if ( category == EMPXSong && type == EMPXItem )
+        {
+        if ( flags & KMPXMediaGeneralFlagsIsInvalid )
+            {
+            iconIndices.Append( EMPXClvIconBrokenTrack );
+            }
+        else if ( flags & KMPXMediaGeneralFlagsIsCorrupted )
+            {
+            iconIndices.Append( EMPXClvIconCorruptTrack );
+            }
+        else if ( flags & KMPXMediaGeneralFlagsIsDrmLicenceInvalid )
+            {
+            iconIndices.Append( EMPXClvIconDrmExpired );
+            }
+        }
+    else if ( category == EMPXPlaylist )
+        {
+        if ( flags & KMPXMediaGeneralFlagsIsInvalid )
+            {
+            iconIndices.Append( EMPXClvIconBrokenPlaylist );
+            }
+        }
+
+    TInt driveNum = ( ( flags ) & ( KMPXMediaGeneralFlagsDriveInfo ) );
+    if ( driveNum == iMMCDrive )
+        {
+        // The MMC icon is displayed in the first Indicator slot
+        iconIndices.Append( EMPXClvIconMMC );
+        }
+
+    return iconIndices;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::MdcaPoint
+// indexes into a descriptor array.
+// -----------------------------------------------------------------------------
+//
+TPtrC CMPXCollectionViewListBoxArray::MdcaPoint( TInt aIndex ) const
+    {
+    //MPX_FUNC( "CMPXCollectionViewListBoxArray::MdcaPoint" );
+    //MPX_DEBUG2( "CMPXCollectionViewListBoxArray::MdcaPoint media count %d", iMedia->Count() );
+    TPtrC item( KNullDesC );
+    TRAP_IGNORE( item.Set( GetMdcaPointL( aIndex ) ) );
+    return item;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::CreateIconArrayL
+// creates icon array.
+// -----------------------------------------------------------------------------
+//
+CAknIconArray* CMPXCollectionViewListBoxArray::CreateIconArrayL()
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::CreateIconArrayL" );
+    TParse mbmFileName;
+    mbmFileName.Set( KMPXCollectionViewIconFile,
+                     &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( mbmFileName.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+    // Prepare icon array for listbox
+    CAknIconArray* iconArray = new ( ELeave ) CAknIconArray( 27 ); // magic: array granularity
+#else
+    // Prepare icon array for listbox
+    CAknIconArray* iconArray = new ( ELeave ) CAknIconArray( 26 ); // magic: array granularity
+#endif
+
+    // Update the enums when this list is updated
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMarkedAdd,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        KAvkonBitmapFile,
+        EMbmAvkonQgn_indi_marked_add,
+        EMbmAvkonQgn_indi_marked_add_mask);
+   AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropEmpty,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        KAvkonBitmapFile,
+        EMbmAvkonQgn_prop_empty,
+        EMbmAvkonQgn_prop_empty_mask);
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupSongs,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_prop_mup_songs,
+        EMbmMpxcollectionviewhgQgn_prop_mup_songs_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupArtist,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_prop_mup_artist,
+        EMbmMpxcollectionviewhgQgn_prop_mup_artist_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupAlbum,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_prop_mup_album,
+        EMbmMpxcollectionviewhgQgn_prop_mup_album_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupPlaylist,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_prop_mup_playlist,
+        EMbmMpxcollectionviewhgQgn_prop_mup_playlist_mask);
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupPlaylist,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_lst_userplayl,
+        EMbmMpxcollectionviewhgQgn_graf_mup_lst_userplayl_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupPlaylistAuto,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_prop_mup_playlist_auto,
+        EMbmMpxcollectionviewhgQgn_prop_mup_playlist_auto_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupGenre,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_prop_mup_genre,
+        EMbmMpxcollectionviewhgQgn_prop_mup_genre_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupComposer,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_prop_mup_composer,
+        EMbmMpxcollectionviewhgQgn_prop_mup_composer_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnMenuFolderApps,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_menu_folder_apps,
+        EMbmMpxcollectionviewhgQgn_menu_folder_apps_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropMupAudio,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_prop_mup_audio,
+        EMbmMpxcollectionviewhgQgn_prop_mup_audio_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_lst_corrupttrack,
+        EMbmMpxcollectionviewhgQgn_graf_mup_lst_corrupttrack_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_lst_brokentrack,
+        EMbmMpxcollectionviewhgQgn_graf_mup_lst_brokentrack_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_lst_brokenplayl,
+        EMbmMpxcollectionviewhgQgn_graf_mup_lst_brokenplayl_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDNone,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_lst_drm_exp,
+        EMbmMpxcollectionviewhgQgn_graf_mup_lst_drm_exp_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropUnknown,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_prop_unknown,
+        EMbmMpxcollectionviewhgQgn_prop_unknown_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_indi_mmc_add,
+        EMbmMpxcollectionviewhgQgn_indi_mmc_add_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupPlay,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_play,
+        EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_play_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupPause,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_pause,
+        EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_pause_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupForwAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_indi_mup_forw_add,
+        EMbmMpxcollectionviewhgQgn_indi_mup_forw_add_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupRewAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_indi_mup_rew_add,
+        EMbmMpxcollectionviewhgQgn_indi_mup_rew_add_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_down,
+        EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_down_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_up,
+        EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_up_mask );
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_updown,
+        EMbmMpxcollectionviewhgQgn_graf_mup_adtl_reorder_updown_mask );
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupDlstPodcast,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_dlst_podcast,
+        EMbmMpxcollectionviewhgQgn_graf_mup_dlst_podcast_mask );
+#endif
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupRandom,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_shuffle,
+        EMbmMpxcollectionviewhgQgn_graf_mup_npv_icon_shuffle_mask );
+
+    return iconArray;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::AppendMediaL
+// Appends media array to the current array
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::AppendMediaL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::AppendMediaL" );
+    if ( iMediaOwned )
+        {
+        delete iMediaOwned;
+        iMediaOwned = NULL;
+        }
+    CMPXCommonListBoxArrayBase::AppendMediaL( aMedia );
+    iIsUnknownExist = EFalse;
+
+    if ( iMedia )
+        {
+        TInt entriesCount( iMedia->Count() );
+        if ( entriesCount > 0 )
+            {
+            // check if the last entry is "unknown" entry
+            // if the last entry has a length of 0, then it's
+            // "unknown" category and needs to be localized
+            CMPXMedia* origMedia( iMedia->AtL( entriesCount - 1 ) );
+            if ( origMedia->ValueText(
+                KMPXMediaGeneralTitle ).Length() == 0 )
+                {
+                iIsUnknownExist = ETrue;
+                }
+            }
+        }
+    if ( iContainerMedia )
+        {
+        if ( iContainerMedia->IsSupported( KMPXMediaGeneralTitle ) )
+            {
+            if ( iContainerMedia->ValueText(
+                KMPXMediaGeneralTitle ).Length() == 0 )
+                {
+                TMPXGeneralCategory containerCategory(
+                    iContainerMedia->ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory ) );
+                HBufC* text( NULL );
+                switch ( containerCategory )
+                    {
+                    case EMPXArtist:
+                        {
+                        text = StringLoader::LoadLC(
+                            R_MPX_QTN_NMP_UNKNOWN_ARTIST );
+                        break;
+                        }
+                    case EMPXAlbum:
+                        {
+                        text = StringLoader::LoadLC(
+                            R_MPX_QTN_MUS_TITLE_UNKNOWN_ALBUM );
+                        break;
+                        }
+                    case EMPXGenre:
+                        {
+                        text = StringLoader::LoadLC(
+                            R_MPX_QTN_MUS_TITLE_UNKNOWN_GENRE );
+                        break;
+                        }
+                    case EMPXComposer:
+                        {
+                        text = StringLoader::LoadLC(
+                            R_MPX_QTN_MUS_TITLE_UNKNOWN_COMPOSER );
+                        break;
+                        }
+                    default:
+                        {
+                        text = StringLoader::LoadLC(
+                            R_MPX_QTN_MP_UNKNOWN );
+                        break;
+                        }
+                    }
+                iContainerMedia->SetTextValueL(
+                    KMPXMediaGeneralTitle, *text );
+                CleanupStack::PopAndDestroy( text );
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Append icon to array
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewListBoxArray::AppendColorIconToArrayL(
+    CAknIconArray* aArray,
+    const TAknsItemID& aID,
+    const TAknsItemID& aColorId,
+    TInt aColorIndex,
+    const TDesC& aMbmFile,
+    TInt aBitmapId,
+    TInt aMaskId )
+    {
+    MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
+
+    CFbsBitmap* bitmap( NULL );
+    CFbsBitmap* mask( NULL );
+
+    if ( aColorId == KAknsIIDNone )
+        {
+        // do not use theme color, use the default color from the file
+        AknsUtils::CreateIconLC( skin, aID,
+            bitmap, mask, aMbmFile, aBitmapId, aMaskId );
+        }
+    else
+        {
+        // use theme color
+        AknsUtils::CreateColorIconLC( skin, aID, aColorId, aColorIndex,
+            bitmap, mask, aMbmFile, aBitmapId, aMaskId, KRgbBlack );
+        }
+
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+    icon->SetBitmapsOwnedExternally( EFalse );
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop( 2 ); // mask, bitmap
+
+    CleanupStack::PushL( icon );
+    aArray->AppendL( icon );
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop( icon );
+    }
+
+// -----------------------------------------------------------------------------
+// Maps list box index to array index in reorder mode
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewListBoxArray::GetArrayIndexForListBoxIndex(
+    TInt aIndex ) const
+    {
+    TInt index( aIndex );
+
+    if ( ( iReorder ) && ( iOriginalIndex != iMovedIndex ) )
+        {
+        if ( iMovedIndex > iOriginalIndex )
+            {
+            // moved down
+            if ( aIndex < iOriginalIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex > iMovedIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex < iMovedIndex )
+                {
+                // between original index and moved index
+                index = aIndex + 1;
+                }
+            else if ( aIndex == iMovedIndex )
+                {
+                index = iOriginalIndex;
+                }
+            }
+        else
+            {
+            // moved up
+            if ( aIndex > iOriginalIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex < iMovedIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex > iMovedIndex )
+                {
+                // between original index and moved index
+                index = aIndex - 1;
+                }
+            else if ( aIndex == iMovedIndex )
+                {
+                index = iOriginalIndex;
+                }
+            }
+        }
+
+    return index;
+    }
+
+// -----------------------------------------------------------------------------
+// Get reorder icon
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewListBoxArray::GetReorderIcon() const
+    {
+    TInt icon( EMPXClvIconNone );
+
+    // Determine the icon to display
+    if ( iReorder )
+        {
+        if ( iMovedIndex == 0 )
+            {
+            icon = EMPXClvIconReorderDown;
+            }
+        else if ( MdcaCount() - 1 == iMovedIndex )
+            {
+            icon = EMPXClvIconReorderUp;
+            }
+        else
+            {
+            icon = EMPXClvIconReorderUpDown;
+            }
+        }
+    return icon;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewListBoxArray::GetMdcaPointL
+// indexes into a descriptor array.
+// -----------------------------------------------------------------------------
+//
+TPtrC CMPXCollectionViewListBoxArray::GetMdcaPointL( TInt aIndex ) const
+    {
+    TInt index( GetArrayIndexForListBoxIndex( aIndex ) );
+    TPtrC item( KNullDesC );
+    CMPXMedia* entry( iMedia->AtL( index ) );
+    if( entry->IsSupported( KMPXMediaGeneralTitle ) )
+        {
+        TPtrC title( entry->ValueText( KMPXMediaGeneralTitle ) );
+        if ( IsCategoryUnknownExist() && aIndex== MdcaCount() - 1 && title.Length()==0 )
+            {
+            title.Set( *iUnknown );
+            }
+
+        TMPXGeneralType type( EMPXNoType );
+        if( entry->IsSupported( KMPXMediaGeneralType ) )
+            {
+            type = entry->ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+            }
+        TMPXGeneralCategory category( EMPXNoCategory );
+        if( entry->IsSupported( KMPXMediaGeneralCategory ) )
+            {
+            category = entry->ValueTObjectL<TMPXGeneralCategory>(
+                        KMPXMediaGeneralCategory );
+            }
+        TUint flags(0);
+        if( entry->IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+            }
+        //MPX_DEBUG3( "CMPXCollectionViewListBoxArray::MdcaPoint (%d) Name: %S", aIndex, &title );
+        //MPX_DEBUG4( "CMPXCollectionViewListBoxArray::MdcaPoint (%d) Type: %d, Category: %d", aIndex, type, category );
+        TInt iconID( EMPXClvIconNone );
+        switch( category )
+            {
+            case EMPXSong:
+                {
+                if ( type == EMPXGroup )
+                    {
+                    iconID = EMPXClvIconSongs;
+                    }
+                else
+                    {
+                    TUint flags(0);
+                    if( entry->IsSupported( KMPXMediaGeneralFlags ) )
+                        {
+                        flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+                        }
+                    if ( flags & KMPXMediaGeneralFlagsIsInvalid )
+                        {
+                        iconID = EMPXClvIconBrokenTrack;
+                        }
+                    else if ( flags & KMPXMediaGeneralFlagsIsCorrupted )
+                        {
+                        iconID = EMPXClvIconCorruptTrack;
+                        }
+                    else if ( flags & KMPXMediaGeneralFlagsIsDrmLicenceInvalid )
+                        {
+                        iconID = EMPXClvIconDrmExpired;
+                        }
+                    else
+                        {
+                        iconID = EMPXClvIconAudio;
+                        }
+                    }
+                break;
+                }
+            case EMPXArtist:
+                {
+                iconID = EMPXClvIconArtist;
+                break;
+                }
+            case EMPXAlbum:
+                {
+                iconID = EMPXClvIconAlbum;
+                if ( entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
+                    iContainerMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) )
+                    {
+                    // if id == containerid, "all" under artist/album
+                    iconID = EMPXClvIconSongs;
+                    }
+                break;
+                }
+            case EMPXPlaylist:
+                {
+                if ( flags & KMPXMediaGeneralFlagsIsInvalid )
+                    {
+                    iconID = EMPXClvIconBrokenPlaylist;
+                    }
+                else
+                    {
+                    if ( type == EMPXGroup )
+                        {
+                        iconID = EMPXClvIconPlaylist;
+                        }
+                    else
+                        {
+                        iconID = EMPXClvIconUserPlaylist;
+                        }
+                    if ( type == EMPXItem )
+                        {
+                        if ( entry->IsSupported(
+                            KMPXMediaGeneralNonPermissibleActions ) )
+                            {
+                            // check for auto playlist and display a different icon
+                            TMPXGeneralNonPermissibleActions attr(
+                                entry->ValueTObjectL<TMPXGeneralNonPermissibleActions>(
+                                    KMPXMediaGeneralNonPermissibleActions ) );
+                            if ( attr & EMPXWrite )
+                                {
+                                iconID = EMPXClvIconPlaylistAuto;
+                                }
+                            }
+                        }
+                    }
+                break;
+                }
+            case EMPXGenre:
+                {
+                iconID = EMPXClvIconGenre;
+                break;
+                }
+            case EMPXComposer:
+                {
+                iconID = EMPXClvIconComposer;
+                break;
+                }
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+            case EMPXPodcast:
+                {
+                iconID = EMPXClvIconPodcasts;
+                break;
+                }
+#endif
+            case EMPXFile:
+                {
+                // a group of files is a folder
+                iconID = EMPXClvIconFolder;
+                break;
+                }
+
+            default:
+                {
+                // unknown folder icon
+                iconID = EMPXClvIconUnknowFile;
+                break;
+                }
+            }
+        TPtr ptr = iItem->Des();
+        ptr.Zero();
+
+        ptr.Format( KMPXCommonListboxFormatString, iconID, &title );
+
+        iconID = EMPXClvIconNone;
+        // reorder icon
+        if ( ( iReorder ) && ( aIndex == iMovedIndex ) )
+            {
+            iconID = GetReorderIcon();
+            }
+        else if ( !iReorderActivated )
+            {
+            // playback status icon
+            if ( iIndex == index )
+                {
+                switch ( iPbState )
+                    {
+                    case EPbStatePlaying:
+                        {
+                        iconID = EMPXClvIconPlay;
+                        break;
+                        }
+                    case EPbStatePaused:
+                        {
+                        iconID = EMPXClvIconPause;
+                        break;
+                        }
+                    case EPbStateSeekingForward:
+                        {
+                        iconID = EMPXClvIconForward;
+                        break;
+                        }
+                    case EPbStateSeekingBackward:
+                        {
+                        iconID = EMPXClvIconRewind;
+                        break;
+                        }
+                    default:
+                        {
+                        // other playback states, not handled
+                        break;
+                        }
+                    }
+                }
+            }
+        else
+            {
+            // Do nothing
+            }
+
+        if ( iconID != EMPXClvIconNone )
+            {
+            ptr.Append( KMPXTab );
+            ptr.AppendNum( iconID );
+            }
+
+        // mmc icon
+        TInt driveNum = ( ( flags ) & ( KMPXMediaGeneralFlagsDriveInfo ) );
+        if ( driveNum == iMMCDrive )
+            {
+            ptr.Append( KMPXTab );
+            ptr.AppendNum( EMPXClvIconMMC );
+            }
+
+        item.Set( *iItem );
+        }
+    return item;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets playback status
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCollectionViewListBoxArray::SetPlaybackStatusByIndex(
+    TInt aIndex, TMPXPlaybackState aStatus )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::SetPlaybackStatusByIndex" );
+    TInt ret( iIndex );
+    iIndex = aIndex;
+
+    // Not to display seeking icons for seeking mode
+    if ( aStatus != EPbStateSeekingForward &&
+        aStatus != EPbStateSeekingBackward )
+        {
+        iPbState = aStatus;
+        }
+    return ret;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgplaylisthelper.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,477 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper to construct a collection playlist.
+*
+*/
+
+
+// INCLUDE FILES
+#include <bldvariant.hrh>
+#include <s32file.h>
+#include <e32math.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessagedefs.h>
+#include <mpxcollectionopenutility.h>
+#include <mpxconstants.h>
+
+#include "mpxcollectionviewhgplaylisthelper.h"
+#include "mpxlog.h"
+
+// CONSTANTS
+const TInt KIncrementalFetchCount = 400;
+const TInt KIncrementalNullOffset = 0;
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionViewHgPlaylistHelper* CMPXCollectionViewHgPlaylistHelper::NewL(
+	MMPXPlaybackUtility* aPlaybackUtility,
+	MMPXCollectionUiHelper* aCollectionUiHelper)
+    {
+    CMPXCollectionViewHgPlaylistHelper* self = NewLC(aPlaybackUtility, aCollectionUiHelper);
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionViewHgPlaylistHelper* CMPXCollectionViewHgPlaylistHelper::NewLC(
+	MMPXPlaybackUtility* aPlaybackUtility,
+	MMPXCollectionUiHelper* aCollectionUiHelper )
+    {
+    CMPXCollectionViewHgPlaylistHelper* self =
+    	new (ELeave) CMPXCollectionViewHgPlaylistHelper(aPlaybackUtility,
+                                                         aCollectionUiHelper);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionViewHgPlaylistHelper::CMPXCollectionViewHgPlaylistHelper(
+	MMPXPlaybackUtility* aPlaybackUtility,
+	MMPXCollectionUiHelper* aCollectionUiHelper )
+	: iPlaybackUtility(aPlaybackUtility),
+	  iCollectionUiHelper( aCollectionUiHelper ),
+	  iPathInitialized(0),
+	  iIsInitializing(EFalse),
+	  iInitCanceled(EFalse),
+	  iLoadSavedPath(EFalse),
+	  iEnableShuffle(EFalse)
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionViewHgPlaylistHelper::~CMPXCollectionViewHgPlaylistHelper()
+    {
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+
+    delete iIncOpenUtil;
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::ConstructL()
+    {
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeIsolated );
+    iIncOpenUtil = CMPXCollectionOpenUtility::NewL( this, KMcModeIsolated );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Create the default path and load it in collection
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::LoadDefaultPathL( TInt aDelay )
+    {
+    MPX_DEBUG1("CMPXCollectionViewHgPlaylistHelper::LoadDefaultPathL");
+    CMPXCollectionPath* cpath = iCollectionUiHelper->CreateDefaultPlaylistPathLC();
+
+    if (!iIsInitializing)
+        {
+        // Get incremental utility to open the path
+        //
+        DoIncrementalOpenL( *cpath, KIncrementalNullOffset, aDelay );
+
+        iPathInitialized = EFalse;
+        iIsInitializing = ETrue;
+        iInitCanceled = EFalse;
+        iDefaultPath = ETrue;
+        iSelectionId = KMPXInvalidItemId;
+        }
+    CleanupStack::PopAndDestroy( cpath );
+    }
+
+// ---------------------------------------------------------------------------
+// Create playlist from default path.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::InitPlaylistL(TBool aEnableShuffle)
+    {
+    MPX_DEBUG1("CMPXCollectionViewHgPlaylistHelper::InitPlaylistL");
+    CMPXCollectionPath* cpath = iCollectionUiHelper->CreateDefaultPlaylistPathLC();
+
+    if (!iIsInitializing)
+        {
+        // Get incremental utility to open the path
+        //
+        DoIncrementalOpenL( *cpath, KIncrementalNullOffset, 0 );
+
+        iPathInitialized = EFalse;
+        iIsInitializing = ETrue;
+        iInitCanceled = EFalse;
+        iDefaultPath = ETrue;
+        iSelectionId = KMPXInvalidItemId;
+        iEnableShuffle = aEnableShuffle;
+        }
+    CleanupStack::PopAndDestroy( cpath );
+    }
+
+// ---------------------------------------------------------------------------
+// Create playlist from provided path
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::InitPlaylistL(CMPXCollectionPath& aPath, TBool aEnableShuffle)
+    {
+    MPX_DEBUG1("CMPXCollectionViewHgPlaylistHelper::InitPlaylistL");
+
+    if (!iIsInitializing)
+        {
+		if (aEnableShuffle)
+			{
+			TTime time;
+			time.UniversalTime();
+			TInt64 seed = time.Int64();
+			TInt randIndex = Math::Rand(seed) % aPath.Count();
+			aPath.Set(randIndex);
+			}
+
+        CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL( aPath );
+        CleanupStack::PushL( playlist );
+
+        playlist->SetShuffleEnabledL( aEnableShuffle );
+        iPlaybackUtility->SetL( EPbPropertyRandomMode, aEnableShuffle );
+        iPlaybackUtility->InitL( *playlist, ETrue );
+        CleanupStack::PopAndDestroy( playlist );
+
+		//iPlaybackUtility->SetL( EPbPropertyRandomMode, aEnableShuffle );
+		//iCollectionUtility->Collection().OpenL(aPath);
+
+        iPathInitialized = ETrue;
+        iInitCanceled = EFalse;
+        iDefaultPath = EFalse;
+        iSelectionId = KMPXInvalidItemId;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Check the initialized flag
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewHgPlaylistHelper::Initialized()
+    {
+    return iPathInitialized;
+    }
+
+// ---------------------------------------------------------------------------
+// Check the iIsInitializing flag
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCollectionViewHgPlaylistHelper::IsInitializing()
+    {
+    return iIsInitializing;
+    }
+
+// ---------------------------------------------------------------------------
+// Set the initialized flag
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::SetInitialized( TBool aInit )
+    {
+    iPathInitialized = aInit;
+    iIsInitializing = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Cancels the initialize operation
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::CancelInit()
+    {
+    iInitCanceled = ETrue;
+    SetInitialized( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handle media properties.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::HandleCollectionMediaL(
+    const CMPXMedia& /*aMedia*/,
+    TInt /*aError*/ )
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handle collection message.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::HandleCollectionMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handles the collection entries being opened.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::HandleOpenL(
+    const CMPXMedia& /* aEntries */,
+    TInt /* aIndex */,
+    TBool /* aComplete */,
+    TInt aError )
+    {
+    // OpenL() callback from trying to open the default Music Menu -> All Songs
+    // or from opening a container
+    //
+    MPX_DEBUG1("CMPXCollectionViewHgPlaylistHelper::HandleOpenL -- Passing path to playback engine");
+
+    // Stop the incremental open algorithm. We are only interested in fetcing
+    // a single block containing the item we want to play. This will speed up the
+    // initalization procedure. Once the playlist is created, the playlist
+    // takes over the rest of the incremental open operation
+    //
+    iIncOpenUtil->Stop();
+    if ( aError == KErrNone )
+        {
+
+        CMPXCollectionPath* cPath = iIncOpenUtil->PathL();
+        CleanupStack::PushL( cPath );
+		InitPlaybackEngineL( *cPath );
+        CleanupStack::PopAndDestroy( cPath );
+        iIsInitializing = EFalse;
+        iPathInitialized = ETrue;
+        iInitCanceled = EFalse;
+        }
+    else
+        {
+        if( iDefaultPath )
+            {
+            MPX_DEBUG1("CMPXCollectionViewHgPlaylistHelper::HandleOpenL - Failed to open default path");
+            // Failed to open default path, set to initialized
+            // "No songs view"
+            //
+            iDefaultPath = EFalse;
+            iPathInitialized = ETrue;
+            iIsInitializing = EFalse;
+            }
+        else
+            {
+            MPX_DEBUG1("CMPXCollectionViewHgPlaylistHelper::HandleOpenL - Opening default Path");
+            iIsInitializing = EFalse;
+            // Try opening default
+            LoadDefaultPathL();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handles the item being opened.
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::HandleOpenL(
+    const CMPXCollectionPlaylist& aPlaylist,
+    TInt aError )
+    {
+    MPX_FUNC("CMPXCollectionViewHgPlaylistHelper::HandleOpenL");
+    if( aError == KErrNone )
+        {
+        if ( !iInitCanceled )
+            {
+            MPX_DEBUG1( "CMPXCollectionViewHgPlaylistHelper::HandleOpenL - Opening playlist" );
+
+            // toggle repeat and shuffle to off if podcast playlist
+            if(KMPXUidPodcastDBPlugin == TUid::Uid((TInt)aPlaylist.Path().Id(0)))
+                {
+                CMPXCollectionPlaylist* tmp =
+                                CMPXCollectionPlaylist::NewL( aPlaylist );
+                CleanupStack::PushL( tmp );
+                tmp->SetRepeatEnabled( EFalse );
+                tmp->SetShuffleEnabledL( EFalse );
+                iPlaybackUtility->InitL( *tmp, EFalse );
+                CleanupStack::PopAndDestroy( tmp );
+                }
+            else
+                {
+                iPlaybackUtility->InitL( aPlaylist, EFalse );
+                }
+            }
+        else
+            {
+            MPX_DEBUG1( "CMPXCollectionViewHgPlaylistHelper::HandleOpenL - Init canceled, do nothing" );
+            }
+        }
+    else
+        {
+        if( iDefaultPath )
+            {
+            // Failed to open default path, set to initialized
+            // "No songs view"
+            //
+            iDefaultPath = EFalse;
+            iPathInitialized = ETrue;
+            iIsInitializing = EFalse;
+            }
+        else
+            {
+            // Try opening default
+            LoadDefaultPathL();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Initialize the playback engine with a collection path
+// ---------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::InitPlaybackEngineL( CMPXCollectionPath& aPath )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgPlaylistHelper::InitPlaybackEngineL" );
+
+    if( !iInitCanceled )
+        {
+        aPath.Remove(0); // we want to remove index 0 which is shuffle item
+        TTime time;
+        time.UniversalTime();
+        TInt64 seed = time.Int64();
+        TInt randIndex = Math::Rand(seed) % aPath.Count();
+        aPath.Set(randIndex);
+        CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL( aPath );
+        CleanupStack::PushL( playlist );
+        playlist->SetShuffleEnabledL( ETrue );
+        iPlaybackUtility->SetL( EPbPropertyRandomMode, iEnableShuffle );
+        iPlaybackUtility->InitL( *playlist, ETrue );
+        CleanupStack::PopAndDestroy( playlist );
+        }
+    else
+        {
+        iIsInitializing = EFalse;
+        iPathInitialized = ETrue;
+        iInitCanceled = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle playback message
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgPlaylistHelper::DoHandlePlaybackMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        MPX_DEBUG2( "CMPXCollectionViewHgPlaylistHelper::DoHandlePlaybackMessageL(%d)", event );
+
+        switch ( event )
+            {
+            default:
+                {
+                // ignore other messages
+                break;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle collection message
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::DoHandleCollectionMessageL(
+	const CMPXMessage& /*aMessage*/ )
+    {
+    MPX_FUNC( "CMPXCollectionViewHgPlaylistHelper::DoHandleCollectionMessageL" );
+
+    }
+
+// -----------------------------------------------------------------------------
+// Start the incremental reading operation at an offset
+// -----------------------------------------------------------------------------
+//
+void CMPXCollectionViewHgPlaylistHelper::DoIncrementalOpenL( CMPXCollectionPath& aPath,
+                                          TInt aIndex,
+                                          TInt aDelay )
+    {
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    TArray<TMPXAttribute> ary = attrs.Array();
+    iIncOpenUtil->Stop();
+    iIncOpenUtil->SetDelay( aDelay );
+    iIncOpenUtil->StartL( aPath, ary, KIncrementalFetchCount,
+                          aIndex, CMPXCollectionOpenUtility::EFetchNormal );
+    CleanupStack::PopAndDestroy( &attrs );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/collectionviewhg/src/mpxcollectionviewhgtnloader.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,244 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Thumbnail loader implementation
+*
+*/
+
+
+#include <thumbnaildata.h>
+#include <AknIconUtils.h>
+#include "mpxcollectionviewhgtnloader.h"
+#include "mpxlog.h"
+
+_LIT( KMPXAlbumMimeType, "audio/mpeg3" );
+
+
+// -----------------------------------------------------------------------------
+// CODEScrollerTNLoader::NewL()
+// -----------------------------------------------------------------------------
+//
+CMpxTNLoader* CMpxTNLoader::NewL (
+        MMpxTNLoaderObserver& aObserver, TThumbnailSize aSize )
+    {
+    CMpxTNLoader* self = new (ELeave) CMpxTNLoader(aObserver, aSize );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMpxTNLoader:~CMpxTNLoader()
+// -----------------------------------------------------------------------------
+//
+CMpxTNLoader::~CMpxTNLoader ( )
+    {
+    // cancel outstanding requests
+    if(iTnEngine)
+        {
+//        CancelAll();
+        }
+
+    iLoading.ResetAndDestroy();
+    delete iTnEngine;
+
+    if( iAsyncCallBack )
+        iAsyncCallBack->Cancel();
+
+    delete iAsyncCallBack;
+    }
+
+TInt CMpxTNLoader::LoadThumbnail( TAny* aSelf )
+    {
+    CMpxTNLoader* self = (CMpxTNLoader*)aSelf;
+    self->LoadNextTN();
+    return KErrNone;
+    }
+
+void CMpxTNLoader::LoadNextTN()
+    {
+    if( iLoading.Count() > 0 )
+        {
+        TInt index = iLoading[0]->iIndex;
+        if( index >= 0 && iLoading[0]->iId == 0)
+            {
+            CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC(iLoading[0]->iFileName, KMPXAlbumMimeType);
+            TRAPD(err, iLoading[0]->iId = iTnEngine->GetThumbnailL( *source, NULL, 0 ); )
+        	MPX_DEBUG4( "GetThumbnailL: %d [%d,%d]", err, index, iLoading[0]->iId);
+			CleanupStack::PopAndDestroy(source);
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMpxTNLoader::ThumbnailPreviewReady()
+// -----------------------------------------------------------------------------
+//
+void CMpxTNLoader::ThumbnailPreviewReady (MThumbnailData& /*aThumbnail*/,
+        TThumbnailRequestId /*aId*/ )
+    {
+    // Previews not currently used
+    }
+
+// -----------------------------------------------------------------------------
+// CMpxTNLoader::ThumbnailReady()
+// -----------------------------------------------------------------------------
+//
+void CMpxTNLoader::ThumbnailReady (TInt aError,
+        MThumbnailData& aThumbnail, TThumbnailRequestId aId )
+    {
+    TInt index = FindLoadingById(aId, ETrue);
+	MPX_DEBUG4( "ThumbnailReady: %d [%d,%d]", aError, index, aId );
+
+    if( index != KErrNotFound )
+        {
+        CFbsBitmap* bitmap = (aError == KErrNone ? aThumbnail.DetachBitmap() : NULL);
+
+        TRAP_IGNORE(iObserver.TNReadyL(aError, bitmap, NULL, index));
+
+        if( iLoading.Count() > 0 )
+            {
+            if(!iAsyncCallBack->IsActive())
+                iAsyncCallBack->CallBack();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMpxTNLoader::CMpxTNLoader()
+// -----------------------------------------------------------------------------
+//
+CMpxTNLoader::CMpxTNLoader (MMpxTNLoaderObserver& aObserver, TThumbnailSize aSize )
+: iObserver( aObserver ), iSize(aSize)
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMpxTNLoader::ConstructL()
+// -----------------------------------------------------------------------------
+//
+void CMpxTNLoader::ConstructL ()
+    {
+    iTnEngine = CThumbnailManager::NewL( *this );
+    iTnEngine->SetFlagsL( CThumbnailManager::EDefaultFlags );
+    iTnEngine->SetQualityPreferenceL( CThumbnailManager::EOptimizeForQuality );
+    iTnEngine->SetThumbnailSizeL( iSize );
+    TCallBack callback(CMpxTNLoader::LoadThumbnail, this);
+    iAsyncCallBack = new (ELeave) CAsyncCallBack( CActive::EPriorityStandard );
+    iAsyncCallBack->Set(callback);
+    }
+
+// -----------------------------------------------------------------------------
+// CMpxTNLoader::FindLoading()
+// -----------------------------------------------------------------------------
+//
+TInt CMpxTNLoader::FindLoadingById(TThumbnailRequestId aId, TBool aRemove)
+    {
+    TInt index = KErrNotFound;
+    for(TInt i = 0; i < iLoading.Count(); ++i)
+        {
+        if(iLoading[i]->iId == aId)
+            {
+            index = iLoading[i]->iIndex;
+            if(aRemove)
+                {
+                delete iLoading[i];
+                iLoading.Remove(i);
+                }
+            break;
+            }
+        }
+    return index;
+    }
+
+// -----------------------------------------------------------------------------
+// CMpxTNLoader::FindLoading()
+// -----------------------------------------------------------------------------
+//
+TInt CMpxTNLoader::FindLoadingByIndex(TInt aIndex, TBool aRemove)
+    {
+    TInt index = KErrNotFound;
+    for(TInt i = 0; i < iLoading.Count(); ++i)
+        {
+        if(iLoading[i]->iIndex == aIndex)
+            {
+            index = i;
+            if(aRemove)
+                {
+                delete iLoading[i];
+                iLoading.Remove(i);
+                }
+            break;
+            }
+        }
+    return index;
+    }
+
+// -----------------------------------------------------------------------------
+// CMpxTNLoader::LoadThumbL()
+// -----------------------------------------------------------------------------
+//
+void CMpxTNLoader::LoadThumbL( TInt aIndex, const TDesC& aFileName )
+    {
+    if( FindLoadingByIndex(aIndex) == KErrNotFound )
+        {
+        iLoading.Append( new (ELeave) TLoadingTN( 0, aIndex, aFileName ) );
+        if( !iAsyncCallBack->IsActive() )
+            iAsyncCallBack->CallBack();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMpxTNLoader::CancelThumb()
+// -----------------------------------------------------------------------------
+//
+void CMpxTNLoader::CancelThumb( TInt aIndex )
+    {
+    TInt loadingIndex = FindLoadingByIndex( aIndex );
+    if(loadingIndex != KErrNotFound)
+        {
+        // Current thumbnail manager has bugs in thumbnail request cancelation.
+        // There is a fix coming in near future but until that we cannot cancel requests
+        // since after that we dont get any thumbnails from server.
+//        if( iLoading[loadingIndex]->iId != 0 )
+//            {
+//            RDebug::Print(_L("!!CANCEL REQUEST!!"));
+//            iTnEngine->CancelRequest( iLoading[loadingIndex]->iId );
+//            }
+        delete iLoading[loadingIndex];
+        iLoading.Remove(loadingIndex);
+        }
+    }
+
+void CMpxTNLoader::CancelAll()
+    {
+    iLoading.ResetAndDestroy();
+    return;
+    // Current thumbnail manager has bugs in thumbnail request cancelation.
+    // There is a fix coming in near future but until that we cannot cancel requests
+    // since after that we dont get any thumbnails from server.
+    while ( iLoading.Count() > 0 )
+        {
+        if( iLoading[0]->iId != 0 )
+            iTnEngine->CancelRequest( iLoading[0]->iId );
+        delete iLoading[0];
+        iLoading.Remove(0);
+        }
+    }
+
+void CMpxTNLoader::SetSizeL( TThumbnailSize aSize )
+    {
+    iTnEngine->SetThumbnailSizeL( aSize );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/bwinscw/mpxcommoncontainerU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,15 @@
+EXPORTS
+	??0CMPXCommonListBoxArrayBase@@QAE@XZ @ 1 NONAME ; CMPXCommonListBoxArrayBase::CMPXCommonListBoxArrayBase(void)
+	??1CMPXCommonListBoxArrayBase@@UAE@XZ @ 2 NONAME ; CMPXCommonListBoxArrayBase::~CMPXCommonListBoxArrayBase(void)
+	?AppendMediaL@CMPXCommonListBoxArrayBase@@UAEXABVCMPXMedia@@@Z @ 3 NONAME ; void CMPXCommonListBoxArrayBase::AppendMediaL(class CMPXMedia const &)
+	?ConstructListBoxArrayL@CMPXCommonListBoxArrayBase@@QAEXXZ @ 4 NONAME ; void CMPXCommonListBoxArrayBase::ConstructListBoxArrayL(void)
+	?ContainerMedia@CMPXCommonListBoxArrayBase@@QAEABVCMPXMedia@@XZ @ 5 NONAME ; class CMPXMedia const & CMPXCommonListBoxArrayBase::ContainerMedia(void)
+	?CreateIconArrayL@CMPXCommonListBoxArrayBase@@UAEPAVCAknIconArray@@XZ @ 6 NONAME ; class CAknIconArray * CMPXCommonListBoxArrayBase::CreateIconArrayL(void)
+	?MdcaCount@CMPXCommonListBoxArrayBase@@MBEHXZ @ 7 NONAME ; int CMPXCommonListBoxArrayBase::MdcaCount(void) const
+	?MediaArray@CMPXCommonListBoxArrayBase@@QAEABVCMPXMediaArray@@XZ @ 8 NONAME ; class CMPXMediaArray const & CMPXCommonListBoxArrayBase::MediaArray(void)
+	?MediaL@CMPXCommonListBoxArrayBase@@QAEABVCMPXMedia@@H@Z @ 9 NONAME ; class CMPXMedia const & CMPXCommonListBoxArrayBase::MediaL(int)
+	?NewL@CMPXCommonContainerFactory@@SAPAVMMPXCommonContainer@@XZ @ 10 NONAME ; class MMPXCommonContainer * CMPXCommonContainerFactory::NewL(void)
+	?RemoveObserver@CMPXCommonListBoxArrayBase@@QAEXXZ @ 11 NONAME ; void CMPXCommonListBoxArrayBase::RemoveObserver(void)
+	?ResetMediaArrayL@CMPXCommonListBoxArrayBase@@QAEXXZ @ 12 NONAME ; void CMPXCommonListBoxArrayBase::ResetMediaArrayL(void)
+	?SetObserver@CMPXCommonListBoxArrayBase@@QAEXPAVMMPXCommonListBoxArrayObserver@@@Z @ 13 NONAME ; void CMPXCommonListBoxArrayBase::SetObserver(class MMPXCommonListBoxArrayObserver *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/data/mpxcommoncontainer.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxcommoncontainer
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MXCC // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+
+#include <mpxcommoncontainer.loc>
+#include "mpxcommoncontainer.hrh"
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// -----------------------------------------------------------------------------
+//    
+//    r_mpx_common_container_lbx
+//    common container's listbox resource.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_mpx_common_container_lbx
+    {
+    flags = EAknListBoxMarkableList;
+    }
+
+
+// ---------------------------------------------------------------------------
+// r_mpx_commoncontainer_details_number_of_songs
+// Details text for multiple items
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_commoncontainer_details_number_of_songs
+    {
+    buf = qtn_vmp_detail_n_songs;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_commoncontainer_details_one_song
+// Details text for single item
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_commoncontainer_details_one_song
+    {
+    buf = qtn_vmp_detail_1_song;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_commoncontainer_details_one_album
+// Details text for single item
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_commoncontainer_details_one_album
+    {
+    buf = qtn_vmp_collection_detail_1_album;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_commoncontainer_details_number_of_episodes
+// Details text for multiple items
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_commoncontainer_details_number_of_episodes
+    {
+    buf = qtn_vmp_num_episode;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_commoncontainer_details_one_episode
+// Details text for single item
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_commoncontainer_details_one_episode
+    {
+    buf = qtn_vmp_one_episode;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_commoncontainer_unknown
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_commoncontainer_unknown
+    {
+    buf = qtn_vmp_unknown;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/eabi/mpxcommoncontainerU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,22 @@
+EXPORTS
+	_ZN26CMPXCommonContainerFactory4NewLEv @ 1 NONAME
+	_ZN26CMPXCommonListBoxArrayBase10MediaArrayEv @ 2 NONAME
+	_ZN26CMPXCommonListBoxArrayBase11SetObserverEP30MMPXCommonListBoxArrayObserver @ 3 NONAME
+	_ZN26CMPXCommonListBoxArrayBase12AppendMediaLERK9CMPXMedia @ 4 NONAME
+	_ZN26CMPXCommonListBoxArrayBase14ContainerMediaEv @ 5 NONAME
+	_ZN26CMPXCommonListBoxArrayBase14RemoveObserverEv @ 6 NONAME
+	_ZN26CMPXCommonListBoxArrayBase16CreateIconArrayLEv @ 7 NONAME
+	_ZN26CMPXCommonListBoxArrayBase16ResetMediaArrayLEv @ 8 NONAME
+	_ZN26CMPXCommonListBoxArrayBase22ConstructListBoxArrayLEv @ 9 NONAME
+	_ZN26CMPXCommonListBoxArrayBase6MediaLEi @ 10 NONAME
+	_ZN26CMPXCommonListBoxArrayBaseC2Ev @ 11 NONAME
+	_ZN26CMPXCommonListBoxArrayBaseD0Ev @ 12 NONAME
+	_ZN26CMPXCommonListBoxArrayBaseD1Ev @ 13 NONAME
+	_ZN26CMPXCommonListBoxArrayBaseD2Ev @ 14 NONAME
+	_ZNK26CMPXCommonListBoxArrayBase9MdcaCountEv @ 15 NONAME
+	_ZTI26CMPXCommonListBoxArrayBase @ 16 NONAME ; #<TI>#
+	_ZTV26CMPXCommonListBoxArrayBase @ 17 NONAME ; #<VT>#
+	_ZThn4_N26CMPXCommonListBoxArrayBaseD0Ev @ 18 NONAME ; #<thunk>#
+	_ZThn4_N26CMPXCommonListBoxArrayBaseD1Ev @ 19 NONAME ; #<thunk>#
+	_ZThn4_NK26CMPXCommonListBoxArrayBase9MdcaCountEv @ 20 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxcommoncontainer.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxcommoncontainer.loc	APP_LAYER_LOC_EXPORT_PATH(mpxcommoncontainer.loc)
+
+PRJ_MMPFILES
+mpxcommoncontainer.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/group/mpxcommoncontainer.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxcommonconatiner.
+*
+*/
+
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxcommoncontainer.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC69
+EPOCALLOWDLLDATA
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+MACRO __ENABLE_MSK
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+MACRO __HG_COLLECTIONVIEW
+#define __HG_COLLECTIONVIEW
+MACRO HG_MP_LOC_AVAILABLE
+
+SOURCEPATH      ../src
+SOURCE          mpxcommoncontainer.cpp
+//SOURCE          mpxcommoncontainerhitchcockimp.cpp
+//SOURCE          mpxcommoncontainertexturemanager.cpp
+SOURCE          mpxcommoncontainermediahelper.cpp
+#ifdef __HG_COLLECTIONVIEW
+SOURCE          mpxcommoncontainerhgimp.cpp
+SOURCE          mpxcommoncontainertexturemanager2.cpp
+#else //__HG_COLLECTIONVIEW
+SOURCE          mpxcommoncontaineravkonimp.cpp
+#endif //__HG_COLLECTIONVIEW
+SOURCE          mpxcommonlistboxarraybase.cpp
+
+START RESOURCE  ../data/mpxcommoncontainer.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+OS_LAYER_LIBC_SYSTEMINCLUDE
+OS_LAYER_GLIB_SYSTEMINCLUDE 
+OS_LAYER_STDCPP_SYSTEMINCLUDE 
+SYSTEMINCLUDE 	/epoc32/include/stdapis/sys
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         eikctl.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         featmgr.lib
+LIBRARY         cdlengine.lib
+LIBRARY         estor.lib
+LIBRARY         fbscli.lib
+LIBRARY         aknicon.lib
+//for handling the Ustring memory leak  
+LIBRARY         libc.lib
+LIBRARY         libglib.lib
+//LIBRARY         alfwidgetmodel.lib
+LIBRARY         egul.lib 		// CGulIcon
+LIBRARY         libpthread.lib
+//LIBRARY         mulutility.lib
+LIBRARY         commonengine.lib
+LIBRARY         thumbnailmanager.lib	// Album art
+
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxcommon.lib
+
+LIBRARY         fepbase.lib               // MCoeFepObserver
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         ws32.lib
+LIBRARY         form.lib
+#ifdef __HG_COLLECTIONVIEW
+LIBRARY        	aknskins.lib
+LIBRARY         ganes.lib
+LIBRARY        	aknskinsrv.lib
+LIBRARY         bitgdi.lib
+#endif //__HG_COLLECTIONVIEW
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontaineravkonimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,464 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX common container definition for AVKON platform.
+*
+*/
+
+
+
+#ifndef CMPXCOMMONCONTAINERAVKONIMP_H
+#define CMPXCOMMONCONTAINERAVKONIMP_H
+
+
+// INCLUDES
+#include "mpxcommoncontainer.h"
+
+
+// FORWARD DECLARATIONS
+class CAknSearchField;
+class CAknListBoxFilterItems;
+class CMPXLbxExtendedFeatures;
+class MEikCommandObserver;
+class CEikMenuPane;
+class CEikTextListBox;
+class MEikListBoxObserver;
+class CAknIconArray;
+class CMPXCommonListBoxArrayBase;
+
+// CLASS DECLARATION
+
+/**
+ *  Container class for AVKON common container.
+ *  The view class should implement the following virtual function
+ *  from MEikCommandObserver 
+ *
+ *  virtual void ProcessCommandL(TInt aCommandId);
+ *
+ *  common container uses this to pass commands back to the view class
+ *  the commands supported are defined in mpxcommoncontainer.hrh
+ *
+ *  view container class owns this class to access List box commands, receive
+ *  CoeControl events and GetHelpContext(). The view container class should
+ *  implement the following virtual functions from MViewContainer
+ *
+ *  virtual void HandleKeyEvent();
+ *  virtual void HandleHelpContent();
+ *
+ *  common container uses this to pass CoeControl events back to the view
+ *  container class. 
+ *
+ *  view class should handle the following commands in ProcessCommandL
+ *  from MEikCommandObserver: 
+ *  
+ *  EMPXCmdCommonDelete  // delete key pressed
+ *  EMPXCmdCommonResourceChange  // resource change
+ *
+ *  @lib mpxcommoncontainer.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXCommonContainerAvkonImp )
+    : public CCoeControl
+    , public MMPXCommonContainer
+    {
+public:
+
+    /**
+     * default C++ constructor.
+     */
+    CMPXCommonContainerAvkonImp();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCommonContainerAvkonImp();
+
+
+// from base class MMPXCommonContainer
+
+    /**
+     * Return Coe Control
+     *
+     * @since 3.2
+     */
+    CCoeControl* CoeControl();
+
+    /**
+     * Set View Container
+     *
+     * @since 3.2
+     */
+    void SetViewContainer( MMPXViewContainer* aViewContainer );
+
+    /**
+     * Set command observer for container
+     *
+     * @since 3.2
+     */
+    void SetCommandObserver( MEikCommandObserver* aCommandObserver );
+
+    /**
+     * Set list box observer for container
+     *
+     * @since 3.2
+     */
+    void SetListBoxObserver( MEikListBoxObserver* aObserver );
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since 3.1
+     */
+    void UpdateLayout();
+
+    /**
+     * Returns list box array, ownership not transfered
+     *
+     * @since 3.1
+     * @return A pointer to the list box array
+     */
+    CMPXCommonListBoxArrayBase* ListBoxArray() const;
+    
+    /**
+     * Sets up the listbox array, ownership not transferred
+     */
+    void SetListBoxArrayL( CMPXCommonListBoxArrayBase* aListBoxArray );
+
+    /**
+     * Return number of listbox items shown in the current listbox.
+     *
+     * @since 3.1
+     * @return The number of items shown in the list box
+     */
+    TInt CurrentListItemCount() const;
+
+    /**
+     * Return total number of listbox items in the listbox.
+     *
+     * @since 3.1
+     * @return Total items in the list box
+     */
+    TInt TotalListItemCount() const;
+
+    /**
+     * Gets top listbox item index (relative to the original listbox).
+     * @return Top listbox item index
+     *
+     * @since 3.1
+     */
+    TInt TopLbxItemIndex() const;
+    
+    /**
+     * Gets bottom listbox item index (relative to the original listbox).
+     * @return Bottom listbox item index
+     *
+     * @since 3.1
+     */
+    TInt BottomLbxItemIndex() const;
+
+    /**
+     * Gets current listbox item index (relative to the original listbox).
+     * @return Current listbox item index
+     *
+     * @since 3.1
+     */
+    TInt CurrentLbxItemIndex() const;
+
+    /**
+     * Get current selected listbox items indices (relative to the original
+     * listbox). Ownership not transferred.
+     *
+     * @since 3.1
+     * @return Current listbox item indices
+     */
+    const CArrayFix<TInt>* CurrentSelectionIndicesL() const;
+    
+    /**
+     * Sewt current selected listbox items indices
+     *
+     * @since 3.1
+     * @param aIndices Array of selection indices, ownership not transfered
+     */
+    void SetCurrentSelectionIndicesL( CArrayFix<TInt>* aIndices ) const;
+
+    /**
+     * Set top listbox item index.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxTopItemIndex( TInt aIndex );
+
+    /**
+     * Set current listbox item index.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxCurrentItemIndex( TInt aIndex );
+
+    /**
+     * Set current listbox item index and highlight it.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxCurrentItemIndexAndDraw( TInt aIndex );
+
+    /**
+     * Clear listbox selection.
+     *
+     * @since 3.1
+     */
+    void ClearLbxSelection();
+
+    /**
+     * Sets list box backround text. This text is visible if the list box 
+     * has no items.
+     *
+     * @param aText The text for the empty list box background.
+     * @since 3.2
+     */
+	void SetLbxEmptyTextL( const TDesC& aText );
+
+    /**
+     * Draws list box item index
+     *
+     * @since 3.2
+     */
+    void DrawLbxItem( TInt aIndex );
+    
+    /**
+     * Set Find box's focus.
+     *
+     * @since 3.1
+     * @param aFocus ETrue if set focus on FindBox. Otherwise, EFalse.
+     */
+    void SetFindBoxFocus( TBool aFocus );
+
+    /**
+     * Handle listbox item addition.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemAdditionL();
+    
+    /**
+     * Handle listbox item addition, preserving the current display index.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemAdditionPreserveIndexL();
+    
+    /**
+     * Handle listbox item removal.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemRemovalL();
+
+    /**
+     * Show/hide find box
+     *
+     * @since 3.1
+     * @param aIsVisible ETrue to set findbox visible. Otherwise, EFalse
+     */
+    void SetFindBoxVisibilityL( TBool aIsVisible );
+
+    /**
+     * Determine find box visibility
+     *
+     * @since 3.1
+     * @return ETrue if find box is currently visible, EFalse otherwise
+     */
+    TBool FindBoxVisibility();
+
+    /**
+     * Restore the PopupCBA of find box
+     */
+    void RestoreFindBoxPopupCBA();
+    
+    /**
+     * Calculate the top index of the visible items
+     *
+     * @since 3.1
+     * @param aBottomIndex the bottom index of the visible items
+     * @return top index
+     */
+    TInt CalculateTopIndex( TInt aBottomIndex );
+
+    /**
+     * Creates the container
+     *
+     * @since 3.1
+     * @param aCollectionType collection type
+     */
+    void ConstructContainerL( TMPXCommonContainerCollectionType aCollectionType );
+
+    /**
+     * Enable/disable find box     
+     * 
+     * @since 3.1
+     * @aEnable ETrue to enable find box, EFalse to disable
+     */
+    void EnableFindBox( TBool aEnable );
+    
+    /**
+     * Enable/disable marking     
+     * 
+     * @since 3.1
+     * @aEnable ETrue to enable marking, EFalse to disable
+     */
+    void EnableMarking( TBool aEnable );
+
+    /**
+     * Custom handling of commands for markable lists.
+     */
+    void HandleMarkableListProcessCommandL( TInt aCommand );
+
+    /**
+     * Custom handling of menu pane for markable lists
+     */
+    void HandleMarkableListDynInitMenuPane(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+        
+    /**
+     * Handle listbox array events
+     *
+     *  @param aEvent list box event
+     */
+    void HandleListBoxArrayEventL( 
+        MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent );
+
+    /**
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse HandleKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+    
+    /**
+     * Activate the container
+     */
+    void ActivateContainerL();
+
+    /**
+     * Deactivate the container
+     */
+    void DeactivateContainerL();
+
+    /**
+     * Checks whether the container is active
+     */
+    TBool IsContainerActive();
+
+// from base class CCoeControl
+
+    /**
+     * From CCoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+    
+    /**
+     * From CCoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+    
+    /**
+     * From CCoeControl.
+     * Responds to changes to the size and position of the contents of this 
+     * control.
+     */
+    void SizeChanged();
+
+    /**
+     * From CCoeControl.
+     * Gets the number of controls contained in a compound control.
+     *
+     * @return The number of component controls contained by this control.
+     */
+    TInt CountComponentControls() const;
+
+    /**
+     * From CCoeControl.
+     * Gets an indexed component of a compound control.
+     *
+     * @param aIndex The index of the control.
+     * @return The component control with an index of aIndex.
+     */
+    CCoeControl* ComponentControl( TInt aIndex ) const;
+
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );
+    
+private:
+
+    /**
+     * Create list box 
+     */
+    void CreateListBoxL();
+    
+    /**
+     * Constructs Find box.
+     *
+     * @param aIsFindPopup ETrue if findbox is a popup type.
+     *                     EFalse if finsbox is a fixed type.
+     */
+    void ConstructFindBoxL( TBool aIsFindPopup );
+
+    /**
+     * Creates icon array, populates iIconArray to be used by listbox
+     */   
+    void CreateIconArrayL();
+    
+protected: // data
+
+    CAknIconArray*              iIconArray;  
+
+    MMPXViewContainer*          iViewContainer;    // not owned
+    MEikCommandObserver*        iView;          // not owned
+    MEikListBoxObserver*        iListBoxObserver; // not owned
+    CEikTextListBox*            iListBox;       // owned
+    CMPXLbxExtendedFeatures*    iLbxExtFeat;    // owned    
+    CMPXCommonListBoxArrayBase* iListBoxArray;  // not owned
+    
+    CAknSearchField*            iFindBox;  // owned
+    CAknListBoxFilterItems*     iFindBoxFilterItems; // not owned
+    TBool                       iIsFindPopup;    
+    TBool                       iIsFindEnabled;
+    TBool                       iIsMarkingEnabled;
+    TInt                        iResourceOffset; // must be freed
+    TBool                       iContainerActive;
+    };
+
+#endif  // CMPXCOMMONCONTAINERAVKONIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainerfilteredlist.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class for providing list filtering.
+*
+*/
+
+
+#ifndef CMPXCOMMONCONTAINERFILTEREDLIST_H
+#define CMPXCOMMONCONTAINERFILTEREDLIST_H
+
+// INCLUDES
+
+#include <coemain.h>
+
+// FORWARD DECLARATIONS
+
+class CMPXMedia;
+class CMPXMediaArray;
+class TMPXItemId;
+
+// CLASS DECLARATION
+
+/**
+ * Class for providing list filtering.
+ *
+ */
+NONSHARABLE_CLASS( CMPXCommonContainerFilteredList ) :
+        public CBase
+    {
+public: // Constructing and destructing.
+
+    /**
+     * Two-phased constructor.
+     *
+     * @return New object.
+     */
+    static CMPXCommonContainerFilteredList* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @return New object.
+     */
+    static CMPXCommonContainerFilteredList* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCommonContainerFilteredList();
+
+public: // Data changes.
+
+    /**
+     * Replaces media list with new one.
+     *
+     * @param aMediaList New media list.
+     */
+    void ReplaceMediaListL( const CMPXMediaArray& aMediaList );
+
+    /**
+     * Call when filtering word changes. Causes filtered list to be updated.
+     * Calling with zero-length filtering word stops filtering.
+     *
+     * @param aWord New filtering word.
+     */
+    void SetFilteringWordL( const TDesC& aWord );
+
+    /**
+     * Checks if full or filtered data is currently shown.
+     *
+     * @return ETrue if filtered data is shown.
+     */
+    TBool IsFiltering();
+
+public: // Data fetching and status information.
+
+    /**
+     * Checks if media list exists.
+     *
+     * @return ETrue if media list exists.
+     */
+    TBool HasMediaList();
+
+    /**
+     * Returns count of filtered media items.
+     *
+     * @return Count of filtered items.
+     */
+    TInt FilteredCount();
+
+    /**
+     * Checks that given filtered index is valid.
+     *
+     * @return ETrue if filtered index is valid.
+     */
+    TBool IsFilteredIndexValid( TInt aFilteredIndex );
+
+    /**
+     * Translates filtered index to real index of media list.
+     *
+     * @param aFilteredIndex Filtered index.
+     * @return Real index.
+     */
+    TInt FilteredIndexToRealIndex( TInt aFilteredIndex );
+
+private:
+
+    /**
+     * Constructor.
+     */
+    CMPXCommonContainerFilteredList();
+
+    /**
+     * Updates internal filtering based on new filtering word.
+     *
+     * @param aWord New filtering word.
+     */
+    void ReAdjustFilteringL( const TDesC& aWord );
+
+private:
+
+    /**
+     * Array of medias.
+     * Own.
+     */
+    CMPXMediaArray* iMediaList;
+
+    /**
+     * Array of real indexes that together are the filtered list.
+     * Own.
+     */
+    RArray<TInt> iFilteredMediaList;
+
+    /**
+     * Internal flag for indicating if data is being filtered.
+     */
+    TBool iFiltering;
+
+    /**
+     * Filtering word used for current filtering.
+     * Own.
+     */
+    HBufC* iFilteringWord;
+    };
+
+#endif // CMPXCOMMONCONTAINERFILTEREDLIST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainerhgimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,701 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX common container definition for hg lib.
+*
+*/
+
+
+
+#ifndef CMPXCOMMONCONTAINERHGIMP_H
+#define CMPXCOMMONCONTAINERHGIMP_H
+
+
+// INCLUDES
+#include <e32hashtab.h>
+#include <ganes/HgScrollBufferObserverIface.h>
+#include <ganes/HgSelectionObserverIface.h>
+#include <ganes/HgItem.h>
+#include <thumbnailmanager.h>
+#include <thumbnailmanagerobserver.h>
+
+#include <mpxattribute.h>
+#include "mpxcommoncontainer.h"
+
+
+// FORWARD DECLARATIONS
+class MEikCommandObserver;
+class CEikMenuPane;
+class MEikListBoxObserver;
+class CAknIconArray;
+class CMPXCommonListBoxArrayBase;
+class CMPXMediaArray;
+class CAknSearchField;
+class MCoeControlObserver;
+class CMPXCommonContainerMediaHelper;
+class CMPXCommonContainerTextureManager2;
+class CMPXCommonUiHelper;
+class CHgScroller;
+class CHgScrollerWithTitle;
+class CAknsBasicBackgroundControlContext;
+
+//Albumart request queue
+struct TAlbumArtRequest
+	{
+  TInt        iIndex;
+	HBufC*		iAlbumArtUri;
+  TSglQueLink iLink;
+	};
+
+
+// CLASS DECLARATION
+
+/**
+ *  Container class for Hg common container.
+ *  The view class should implement the following virtual function
+ *  from MEikCommandObserver
+ *
+ *  virtual void ProcessCommandL(TInt aCommandId);
+ *
+ *  common container uses this to pass commands back to the view class
+ *  the commands supported are defined in mpxcommoncontainer.hrh
+ *
+ *  view container class owns this class to access List widget commands, receive
+ *  CoeControl events and GetHelpContext(). The view container class should
+ *  implement the following virtual functions from MViewContainer
+ *
+ *  virtual void HandleKeyEvent();
+ *  virtual void HandleHelpContent();
+ *
+ *  common container uses this to pass CoeControl events back to the view
+ *  container class.
+ *
+ *  view class should handle the following commands in ProcessCommandL
+ *  from MEikCommandObserver:
+ *
+ *  EMPXCmdCommonDelete  // delete key pressed
+ *  EMPXCmdCommonResourceChange  // resource change
+ *  EMPXCmdCommonEnterKey  // enter key pressed
+ *
+ *  @lib mpxcommoncontainer.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXCommonContainerHgImp )
+    : public CCoeControl
+    , public MCoeControlObserver
+    , public MMPXCommonContainer
+	, public MHgScrollBufferObserver
+	, public MHgSelectionObserver
+    , public MThumbnailManagerObserver
+    {
+public:
+
+    /**
+     * default C++ constructor.
+     */
+    CMPXCommonContainerHgImp();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCommonContainerHgImp();
+
+
+// from base class MMPXCommonContainer
+
+    /**
+     * Return Coe Control
+     *
+     * @since 3.2
+     */
+    CCoeControl* CoeControl();
+
+    /**
+     * Set View Container
+     *
+     * @since 3.2
+     */
+    void SetViewContainer( MMPXViewContainer* aViewContainer );
+
+    /**
+     * Set command observer for container
+     *
+     * @since 3.2
+     */
+    void SetCommandObserver( MEikCommandObserver* aCommandObserver );
+
+    /**
+     * Set list box observer for container
+     *
+     * @since 3.2
+     */
+    void SetListBoxObserver( MEikListBoxObserver* aObserver );
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since 3.1
+     */
+    void UpdateLayout();
+
+    /**
+     * Returns list box array, ownership not transfered
+     *
+     * @since 3.1
+     * @return A pointer to the list box array
+     */
+    CMPXCommonListBoxArrayBase* ListBoxArray() const;
+
+    /**
+     * Sets up the listbox array, ownership not transferred
+     */
+    void SetListBoxArrayL( CMPXCommonListBoxArrayBase* aListBoxArray );
+
+    /**
+     * Return number of listbox items shown in the current listbox.
+     *
+     * @since 3.1
+     * @return The number of items shown in the list box
+     */
+    TInt CurrentListItemCount() const;
+
+    /**
+     * Return total number of listbox items in the listbox.
+     *
+     * @since 3.1
+     * @return Total items in the list box
+     */
+    TInt TotalListItemCount() const;
+
+    /**
+     * Gets top listbox item index (relative to the original listbox).
+     * @return Top listbox item index
+     *
+     * @since 3.1
+     */
+    TInt TopLbxItemIndex() const;
+
+    /**
+     * Gets bottom listbox item index (relative to the original listbox).
+     * @return Bottom listbox item index
+     *
+     * @since 3.1
+     */
+    TInt BottomLbxItemIndex() const;
+
+    /**
+     * Gets current listbox item index (relative to the original listbox).
+     * @return Current listbox item index
+     *
+     * @since 3.1
+     */
+    TInt CurrentLbxItemIndex() const;
+
+    /**
+     * Get current selected listbox items indices (relative to the original
+     * listbox). Ownership not transferred.
+     *
+     * @since 3.1
+     * @return Current listbox item indices
+     */
+    const CArrayFix<TInt>* CurrentSelectionIndicesL() const;
+
+    /**
+     * Sewt current selected listbox items indices
+     *
+     * @since 3.1
+     * @param aIndices Array of selection indices, ownership not transfered
+     */
+    void SetCurrentSelectionIndicesL( CArrayFix<TInt>* aIndices ) const;
+
+    /**
+     * Set top listbox item index.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxTopItemIndex( TInt aIndex );
+
+    /**
+     * Set current listbox item index.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxCurrentItemIndex( TInt aIndex );
+
+    /**
+     * Set current listbox item index and highlight it.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxCurrentItemIndexAndDraw( TInt aIndex );
+
+    /**
+     * Clear listbox selection.
+     *
+     * @since 3.1
+     */
+    void ClearLbxSelection();
+
+    /**
+     * Sets list box backround text. This text is visible if the list box
+     * has no items.
+     *
+     * @param aText The text for the empty list box background.
+     * @since 3.2
+     */
+	void SetLbxEmptyTextL( const TDesC& aText );
+
+    /**
+     * Draws list box item index
+     *
+     * @since 3.2
+     */
+    void DrawLbxItem( TInt aIndex );
+
+    /**
+     * Set Find box's focus.
+     *
+     * @since 3.1
+     * @param aFocus ETrue if set focus on FindBox. Otherwise, EFalse.
+     */
+    void SetFindBoxFocus( TBool aFocus );
+
+    /**
+     * Handle listbox item addition.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemAdditionL();
+
+    /**
+     * Handle listbox item addition, preserving the current display index.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemAdditionPreserveIndexL();
+
+    /**
+     * Handle listbox item removal.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemRemovalL();
+
+    /**
+     * Show/hide find box
+     *
+     * @since 3.1
+     * @param aIsVisible ETrue to set findbox visible. Otherwise, EFalse
+     */
+    void SetFindBoxVisibilityL( TBool aIsVisible );
+
+    /**
+     * Determine find box visibility
+     *
+     * @since 3.1
+     * @return ETrue if find box is currently visible, EFalse otherwise
+     */
+    TBool FindBoxVisibility();
+
+    /**
+     * Restore the PopupCBA of find box
+     */
+    void RestoreFindBoxPopupCBA();
+
+    /**
+     * Calculate the top index of the visible items
+     *
+     * @since 3.1
+     * @param aBottomIndex the bottom index of the visible items
+     * @return top index
+     */
+    TInt CalculateTopIndex( TInt aBottomIndex );
+
+    /**
+     * Creates the container
+     *
+     * @since 3.1
+     * @param aRect the rectangle that defines the control's extent.
+     */
+    void ConstructContainerL( TMPXCommonContainerCollectionType /*aCollectionTyp*/ );
+
+    /**
+     * Enable/disable find box
+     *
+     * @since 3.1
+     * @aEnable ETrue to enable find box, EFalse to disable
+     */
+    void EnableFindBox( TBool aEnable );
+
+    /**
+     * Enable/disable marking
+     *
+     * @since 3.1
+     * @aEnable ETrue to enable marking, EFalse to disable
+     */
+    void EnableMarking( TBool aEnable );
+
+    /**
+     * Custom handling of commands for markable lists.
+     */
+    void HandleMarkableListProcessCommandL( TInt aCommand );
+
+    /**
+     * Custom handling of menu pane for markable lists
+     */
+    void HandleMarkableListDynInitMenuPane(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+
+    /**
+     * Handle listbox array events
+     *
+     *  @param aEvent list box event
+     */
+    void HandleListBoxArrayEventL(
+        MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent );
+
+    /**
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse HandleKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * Activate the container
+     */
+    void ActivateContainerL();
+
+// from base class CCoeControl
+
+    /**
+     * From CCoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CCoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );
+
+    /**
+     * From CoeControl.
+     * Draw this application's view to the screen
+     *
+     * @param aRect the rectangle of this view that needs updating
+     */
+    void Draw( const TRect& aRect ) const;
+
+    /**
+     * From CoeControl.
+     * Get the control input capabilities
+     */
+	TCoeInputCapabilities InputCapabilities() const;
+
+// from base class MCoeControlObserver
+
+    /**
+    * From MCoeControlObserver, Acts upon changes in the hosted control's state.
+    * This class's implementation is trivial and should be able to be safely
+    * re-implemented in directly client-derived classes. For non-base setting
+    * page classes, a call to the base class should be made.
+    * @param aControl Control that caused the event. (not used in default implementation)
+    * @param aEventType Type of the event.
+    */
+    void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
+
+
+// from base class MHgScrollBufferObserver
+
+    /**
+     * from MHgScrollBufferObserver
+     * Buffer position changed.
+     * The items between the aBufferStart and aBufferEnd should be loaded as soon as possible.
+     *
+     * @param aBufferStart The index of the first item in buffer.
+     * @param aBufferEnd The index of the last item in buffer.
+     * @param aDirection report direction of scrolling
+     */
+    void Request(TInt aBufferStart, TInt aBufferEnd, THgScrollDirection aDirection);
+
+// from base class MHgBufferOwner
+
+    /**
+     * from MHgBufferOwner
+     *
+     *
+     */
+    void Release(TInt aReleaseStart, TInt aReleaseEnd);
+
+
+// from base class MHgSelectionObserver
+
+    /**
+     * Handle selection.
+     *
+     * @param aIndex Selected item index.
+     */
+    void HandleSelectL( TInt aIndex );
+
+    /**
+     * Handle opening.
+     *
+     * @param aIndex Opened item index.
+     */
+    void HandleOpenL( TInt aIndex );
+
+public: // from base class MThumbnailManagerObserver
+
+    /**
+     * From MThumbnailManagerObserver
+     * Preview thumbnail generation or loading is complete.
+     *
+     * @param aThumbnail     An object representing the resulting thumbnail.
+     * @param aId            Request ID for the operation
+     */
+    void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId );
+
+    /**
+     * From MThumbnailManagerObserver
+     * Final thumbnail bitmap generation or loading is complete.
+     *
+     * @param aError         Error code.
+     * @param aThumbnail     An object representing the resulting thumbnail.
+     * @param aId            Request ID for the operation.
+     */
+    void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId );
+
+    TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
+
+
+private:
+
+    /**
+     * Create list box
+     */
+    void CreateListBoxL( TInt count );
+
+    /**
+     * Create list box with Title
+     */
+    void CreateListBoxWithTitleL( TInt count );
+
+
+    /**
+     * Creates icon array, populates iIconArray to be used by listbox
+     */
+    void CreateIconArrayL();
+
+    /**
+     * Sets default icon for HgList
+     */
+    void SetDefaultIconL();
+
+    /**
+     * Sets default icon for list item
+     */
+    void SetDefaultIconL(TInt aIndex);
+
+    /*
+	 * Adds detail to the list item at the specified index
+     */
+    void AddDetailToDisplayedItemL( CHgItem* aVisualItem, CMPXMedia* aMedia, TInt aIndex);
+    void AddThumbnailToDisplayedItemL( CHgItem* aVisualItem, CMPXMedia* aMedia, TInt aIndex);
+    void SetTitleL( CHgItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailCountL( CHgItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailArtistL( CHgItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailAlbumL( CHgItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailDurationL( CHgItem* aVisualItem, CMPXMedia* aMedia );
+    void UpdateTimeIndicatorsL( TDes& aBuf, TInt aDuration );
+    void SetDetailIndicatorL( CHgItem* aVisualItem, TInt aIndex );
+    void SetDetailIconL( CHgItem* aVisualItem, TInt aIndex );
+    void SetDetailThumbnailL( CMPXMedia* aMedia, TInt aIndex = 0 );
+
+    /**
+     * Set the collection context
+     */
+    void SetCollectionContextL();
+
+    void ProvideDataL( TInt aStart, TInt aEnd );
+
+    void SetScrollbarType();
+
+    void CancelTNRequest();
+
+    /**
+      * Save the selected album item
+      *
+      */
+    void SaveSelectedAlbumItemL();
+
+    /**
+     * Write the album name, artist name and album art in media data to file
+     *
+     * @param aMedia         the selected media data in Album view
+     */
+    void WriteToStreamFileL( const CMPXMedia* aMedia );
+
+    /**
+     * Read the album name, artist name and album art from file
+     *
+     * @param aMedia         the media data will be returned
+     */
+    void ReadFromStreamFileL( CMPXMedia* aMedia );
+
+    /**
+     * Refresh list as needed
+     */
+    void RefreshL(TInt aIndex);
+
+    /**
+     * Refresh list as needed
+     */
+    void RefreshNoThumbnailL(TInt aIndex);
+    
+	/**
+	* Clean AlbumArt request Queue
+	*/
+    void CleanAlbumArtReqQueue();
+
+    /**
+     * Handle requests in visible area
+     * @param aBufferStart  the starting buffer index
+     * @param aBufferEnd  the ending buffer index
+     */
+    void ProvideDataIntersectL(TInt aBufferStart, TInt aBufferEnd);
+
+    /**
+     * Refresh list as needed
+     * @param aBufferStart  the starting buffer index
+     * @param aBufferEnd  the ending buffer index
+     */
+    void ProvideDataDifferenceL(TInt aBufferStart, TInt aBufferEnd);
+    void ProvideDataWithoutThumbnailsL(const CMPXMediaArray& aMediaArray, TInt aStartIndex = 0);
+
+private: // data
+
+    /**
+     * Context of collection view. It's the exact location within collection navigation
+     * based on category type + category.
+     */
+    enum TContext
+        {
+        EContextUnknown,
+        EContextGroupCollection,
+        EContextGroupArtist,
+        EContextGroupAlbum,
+        EContextGroupPlaylist,
+        EContextGroupSong,
+        EContextGroupPodcast,
+        EContextGroupGenre,
+        EContextGroupComposer,
+        EContextItemArtist,
+        EContextItemAlbum,
+        EContextItemPlaylist,
+        EContextItemSong,
+        EContextItemPodcast,
+        EContextItemGenre,
+        EContextItemComposer
+        };
+
+    enum TDefaultIcon
+        {
+        EMPXDefaultIconNotSet = -1,
+        EMPXDefaultIconArtist,
+        EMPXDefaultIconAlbum,
+        EMPXDefaultIconPlaylist,
+        EMPXDefaultIconSongs,
+        EMPXDefaultIconPodcasts,
+        EMPXDefaultIconGenre,
+        EMPXDefaultIconComposer,
+        EMPXDefaultTitleIconPodcasts,
+        EMPXDefaultIconEmpty
+        };
+
+    MMPXViewContainer*          iViewContainer;         // Not owned
+    MEikCommandObserver*        iView;                  // Not owned
+    MEikListBoxObserver*        iListBoxObserver;       // Not owned
+    CMPXCommonListBoxArrayBase* iListBoxArray;          // Owned
+    CArrayFixFlat<TInt>*        iListSelections;        // Owned
+    CAknIconArray*              iIconArray;             // Owned
+
+    CMPXCommonContainerTextureManager2*  iTextureManager;// Owned
+	CMPXCommonUiHelper*         iCommonUiHelper;        // Owned
+
+    CHgScroller* 				iListWidget;  		    // Owned
+    CHgScroller* 				iPrevListWidget;  		    // Owned
+    CHgScrollerWithTitle*       iScrollerWithTitle;
+    CThumbnailManager*          iThumbnailManager;      // Owned
+
+    TContext                    iContext;
+    TContext                    iPrevContext;
+    TInt                        iResourceOffset;        // Must be freed
+    TBool                       iIsMarkingEnabled;
+	TInt						iTopIndex;
+	TInt						iBottomIndex;
+	TSize						iImageSize;
+    CAknsBasicBackgroundControlContext* iBgContext; 	// Owned
+
+    typedef RHashMap<TInt, TInt> RThumbnailReqHashMap;
+    RThumbnailReqHashMap iThumbnailReqHashMap;
+
+    HBufC* iEpisodeTitle;
+    HBufC* iAlbumTitle;
+    HBufC* iSongTitle;
+
+    TBool iPodcastContext;
+    TBool iTitleSet;
+    TDefaultIcon iCurrentDefaultIcon;
+    TFileName iSelectedAlbumItemFileName;
+    CMPXMedia* iSelectedMediaInAlbumView;
+    // Queue for Albumart asynchronous requests
+    TSglQue<TAlbumArtRequest>   iRequestQueue;
+    TAlbumArtRequest*           iAlbumArtRequest;
+    TInt                        iRequestCount;
+    TInt  iQueueCounter;
+    
+    THgScrollDirection iDirection;
+    RArray<TBool>  iThumbnailReqMap;
+    TInt  iLastValidMediaItemIndex;
+    TInt iRequestStart;
+    TInt iRequestEnd;
+
+    };
+
+#endif  // CMPXCOMMONCONTAINERHGIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainerhitchcockimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,681 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX common container definition for Hitchcock platform.
+*
+*/
+
+
+
+#ifndef CMPXCOMMONCONTAINERHITCHCOCKIMP_H
+#define CMPXCOMMONCONTAINERHITCHCOCKIMP_H
+
+
+// INCLUDES
+#include <alf/alfenv.h>
+#include <alf/ialfwidgeteventhandler.h>
+#include <mul/mulevent.h>
+#include <mul/mulvisualitem.h>      // For Visual Item
+#include <mul/imulmodelprovider.h>
+
+#include <thumbnailmanager.h>
+#include <thumbnailmanagerobserver.h>
+
+#include <mpxattribute.h>
+#include "mpxcommoncontainer.h"
+#include "mpxcommoncontainersearchfieldwrapper.h"
+
+// FORWARD DECLARATIONS
+namespace Alf
+    {
+    class IMulListWidget;
+    class IMulModel;
+    class IAlfViewWidget;
+    class MulVisualItem;
+    }
+class CAlfEnv;
+class MEikCommandObserver;
+class CEikMenuPane;
+class MEikListBoxObserver;
+class CAknIconArray;
+class CMPXCommonListBoxArrayBase;
+class CMPXMediaArray;
+class CAknSearchField;
+class MCoeControlObserver;
+class CMPXCommonContainerMediaHelper;
+class CMPXCommonContainerTextureManager;
+class CMPXCommonUiHelper;
+class CMPXCommonContainerFilteredList;
+
+// CLASS DECLARATION
+
+/**
+ *  Container class for Hitchcok common container.
+ *  The view class should implement the following virtual function
+ *  from MEikCommandObserver 
+ *
+ *  virtual void ProcessCommandL(TInt aCommandId);
+ *
+ *  common container uses this to pass commands back to the view class
+ *  the commands supported are defined in mpxcommoncontainer.hrh
+ *
+ *  view container class owns this class to access List widget commands, receive
+ *  CoeControl events and GetHelpContext(). The view container class should
+ *  implement the following virtual functions from MViewContainer
+ *
+ *  virtual void HandleKeyEvent();
+ *  virtual void HandleHelpContent();
+ *
+ *  common container uses this to pass CoeControl events back to the view
+ *  container class. 
+ *
+ *  view class should handle the following commands in ProcessCommandL
+ *  from MEikCommandObserver: 
+ *  
+ *  EMPXCmdCommonDelete  // delete key pressed
+ *  EMPXCmdCommonResourceChange  // resource change
+ *  EMPXCmdCommonEnterKey  // enter key pressed
+ *
+ *  @lib mpxcommoncontainer.lib
+ *  @since S60 v3.1
+ */
+NONSHARABLE_CLASS( CMPXCommonContainerHitchcockImp )
+    : public CCoeControl
+    , public MCoeControlObserver
+    , public MMPXCommonContainer
+    , public IAlfWidgetEventHandler
+    , public Alf::IMulModelProvider
+    , public MThumbnailManagerObserver
+    , public MMPXCommonContainerSearchFieldObserver
+    {
+public:
+
+    /**
+     * default C++ constructor.
+     */
+    CMPXCommonContainerHitchcockImp();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCommonContainerHitchcockImp();
+
+
+// from base class MMPXCommonContainer
+
+    /**
+     * Return Coe Control
+     *
+     * @since 3.2
+     */
+    CCoeControl* CoeControl();
+
+    /**
+     * Set View Container
+     *
+     * @since 3.2
+     */
+    void SetViewContainer( MMPXViewContainer* aViewContainer );
+
+    /**
+     * Set command observer for container
+     *
+     * @since 3.2
+     */
+    void SetCommandObserver( MEikCommandObserver* aCommandObserver );
+
+    /**
+     * Set list box observer for container
+     *
+     * @since 3.2
+     */
+    void SetListBoxObserver( MEikListBoxObserver* aObserver );
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since 3.1
+     */
+    void UpdateLayout();
+
+    /**
+     * Returns list box array, ownership not transfered
+     *
+     * @since 3.1
+     * @return A pointer to the list box array
+     */
+    CMPXCommonListBoxArrayBase* ListBoxArray() const;
+    
+    /**
+     * Sets up the listbox array, ownership not transferred
+     */
+    void SetListBoxArrayL( CMPXCommonListBoxArrayBase* aListBoxArray );
+
+    /**
+     * Return number of listbox items shown in the current listbox.
+     *
+     * @since 3.1
+     * @return The number of items shown in the list box
+     */
+    TInt CurrentListItemCount() const;
+
+    /**
+     * Return total number of listbox items in the listbox.
+     *
+     * @since 3.1
+     * @return Total items in the list box
+     */
+    TInt TotalListItemCount() const;
+
+    /**
+     * Gets top listbox item index (relative to the original listbox).
+     * @return Top listbox item index
+     *
+     * @since 3.1
+     */
+    TInt TopLbxItemIndex() const;
+    
+    /**
+     * Gets bottom listbox item index (relative to the original listbox).
+     * @return Bottom listbox item index
+     *
+     * @since 3.1
+     */
+    TInt BottomLbxItemIndex() const;
+
+    /**
+     * Gets current listbox item index (relative to the original listbox).
+     * @return Current listbox item index
+     *
+     * @since 3.1
+     */
+    TInt CurrentLbxItemIndex() const;
+
+    /**
+     * Get current selected listbox items indices (relative to the original
+     * listbox). Ownership not transferred.
+     *
+     * @since 3.1
+     * @return Current listbox item indices
+     */
+    const CArrayFix<TInt>* CurrentSelectionIndicesL() const;
+    
+    /**
+     * Sewt current selected listbox items indices
+     *
+     * @since 3.1
+     * @param aIndices Array of selection indices, ownership not transfered
+     */
+    void SetCurrentSelectionIndicesL( CArrayFix<TInt>* aIndices ) const;
+
+    /**
+     * Set top listbox item index.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxTopItemIndex( TInt aIndex );
+
+    /**
+     * Set current listbox item index.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxCurrentItemIndex( TInt aIndex );
+
+    /**
+     * Set current listbox item index and highlight it.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    void SetLbxCurrentItemIndexAndDraw( TInt aIndex );
+
+    /**
+     * Clear listbox selection.
+     *
+     * @since 3.1
+     */
+    void ClearLbxSelection();
+
+    /**
+     * Sets list box backround text. This text is visible if the list box 
+     * has no items.
+     *
+     * @param aText The text for the empty list box background.
+     * @since 3.2
+     */
+	void SetLbxEmptyTextL( const TDesC& aText );
+
+    /**
+     * Draws list box item index
+     *
+     * @since 3.2
+     */
+    void DrawLbxItem( TInt aIndex );
+    
+    /**
+     * Set Find box's focus.
+     *
+     * @since 3.1
+     * @param aFocus ETrue if set focus on FindBox. Otherwise, EFalse.
+     */
+    void SetFindBoxFocus( TBool aFocus );
+
+    /**
+     * Handle listbox item addition.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemAdditionL();
+    
+    /**
+     * Handle listbox item addition, preserving the current display index.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemAdditionPreserveIndexL();
+    
+    /**
+     * Handle listbox item removal.
+     *
+     * @since 3.1
+     */
+    void HandleLbxItemRemovalL();
+
+    /**
+     * Show/hide find box
+     *
+     * @since 3.1
+     * @param aIsVisible ETrue to set findbox visible. Otherwise, EFalse
+     */
+    void SetFindBoxVisibilityL( TBool aIsVisible );
+
+    /**
+     * Determine find box visibility
+     *
+     * @since 3.1
+     * @return ETrue if find box is currently visible, EFalse otherwise
+     */
+    TBool FindBoxVisibility();
+
+    /**
+     * Restore the PopupCBA of find box
+     */
+    void RestoreFindBoxPopupCBA();
+
+    /**
+     * Calculate the top index of the visible items
+     *
+     * @since 3.1
+     * @param aBottomIndex the bottom index of the visible items
+     * @return top index
+     */
+    TInt CalculateTopIndex( TInt aBottomIndex );
+
+    /**
+     * Creates the container
+     *
+     * @since 3.1
+     * @param aCollectionType collection type
+     */
+    void ConstructContainerL( TMPXCommonContainerCollectionType aCollectionType );
+
+    /**
+     * Enable/disable find box     
+     * 
+     * @since 3.1
+     * @aEnable ETrue to enable find box, EFalse to disable
+     */
+    void EnableFindBox( TBool aEnable );
+    
+    /**
+     * Enable/disable marking     
+     * 
+     * @since 3.1
+     * @aEnable ETrue to enable marking, EFalse to disable
+     */
+    void EnableMarking( TBool aEnable );
+
+    /**
+     * Custom handling of commands for markable lists.
+     */
+    void HandleMarkableListProcessCommandL( TInt aCommand );
+
+    /**
+     * Custom handling of menu pane for markable lists
+     */
+    void HandleMarkableListDynInitMenuPane(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+        
+    /**
+     * Handle listbox array events
+     *
+     *  @param aEvent list box event
+     */
+    void HandleListBoxArrayEventL( 
+        MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent );
+
+    /**
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse HandleKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+    
+    /**
+     * Activate the container
+     */
+    void ActivateContainerL();
+
+    /**
+     * Deactivate the container
+     */
+    void DeactivateContainerL();
+
+    /**
+     * Checks whether the container is active
+     */
+    TBool IsContainerActive();
+
+// from base class CCoeControl
+
+    /**
+     * From CCoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+    
+    /**
+     * From CCoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+    
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );
+    
+    /**
+     * From CoeControl.
+     * Draw this application's view to the screen
+     *
+     * @param aRect the rectangle of this view that needs updating
+     */
+    void Draw( const TRect& aRect ) const;
+    
+// from base class MCoeControlObserver
+
+    /**
+    * From MCoeControlObserver, Acts upon changes in the hosted control's state.
+    * This class's implementation is trivial and should be able to be safely 
+    * re-implemented in directly client-derived classes. For non-base setting
+    * page classes, a call to the base class should be made.
+    * @param aControl Control that caused the event. (not used in default implementation)
+    * @param aEventType Type of the event. 
+    */
+    void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
+
+// from base class IAlfWidgetEventHandler
+
+    /**
+     * From IAlfWidgetEventHandler
+     * Indicates whether event is accepted
+     *
+     * @param aControl widget control
+     * @param aEvent the ALF event
+     */
+    bool accept( CAlfWidgetControl& aControl, const TAlfEvent& aEvent ) const;
+
+    /**
+     * From IAlfWidgetEventHandler
+     * Sets the active states of the event handler
+     *
+     * @param aStates active states
+     */
+    void setActiveStates( unsigned int aStates );
+
+    /**
+     * From IAlfWidgetEventHandler
+     * Performs the appropriate action for the ALF event
+     *
+     * @param aControl widget control
+     * @param aEvent the ALF event.
+     * @return TRUE if event consumed
+     */
+    AlfEventStatus offerEvent( CAlfWidgetControl& aControl, const TAlfEvent& aEvent );
+
+    /**
+     * From IAlfWidgetEventHandler
+     * Make event handler interface using the specified type
+     * @param aType
+     */
+    IAlfInterfaceBase* makeInterface( const IfId& aType );
+
+    /**
+     * From IAlfWidgetEventHandler
+     * Sets the event handler data
+     *
+     * @param aData event handler initialization data
+     */
+    void setEventHandlerData(const AlfWidgetEventHandlerInitData& aData);
+
+    /**
+     * From IAlfWidgetEventHandler
+     * Returns pointer to the event handler data
+     */
+    AlfWidgetEventHandlerInitData* eventHandlerData();
+
+    /**
+     * From IAlfWidgetEventHandler
+     * Returns the type of EventHandler.
+     * @see IAlfWidgetEventHandler::AlfEventHandlerType
+     *
+     * @return The type of event handler.
+     */
+    AlfEventHandlerType eventHandlerType();
+
+    /**
+     * From IAlfWidgetEventHandler
+     * Returns information about the phase in the event handling cycle in
+     * which the event hadler will be executed.
+     * @see IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase
+     *
+     * @return Event handler execution phase.
+     */
+    AlfEventHandlerExecutionPhase eventExecutionPhase();
+
+public: // from base class IMulModelProvider
+
+    void ProvideData( int aStartIndex, int aCount, MulDataPath aPath );
+
+public: // from base class MThumbnailManagerObserver
+
+    /**
+     * From MThumbnailManagerObserver
+     * Preview thumbnail generation or loading is complete.
+     *
+     * @param aThumbnail     An object representing the resulting thumbnail.
+     * @param aId            Request ID for the operation
+     */
+    void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId );
+
+    /**
+     * From MThumbnailManagerObserver
+     * Final thumbnail bitmap generation or loading is complete.
+     *
+     * @param aError         Error code.
+     * @param aThumbnail     An object representing the resulting thumbnail.
+     * @param aId            Request ID for the operation.
+     */
+    void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId );
+
+public: // from base class MMPXCommonContainerSearchFieldObserver
+
+    /**
+     * From MMPXCommonContainerSearchFieldObserver
+     * Call when filtering word changes. Causes filtering to be updated.
+     * Calling with zero-length filtering word stops filtering.
+     *
+     * @param aWord New filtering word.
+     */
+    void NewFilteringWordL( const TDesC& aWord );
+
+private:
+
+    /**
+     * Create list box
+     */
+    void CreateListBoxL();
+
+    /**
+     * Constructs Find box.
+     *
+     * @param aIsFindPopup ETrue if findbox is a popup type.
+     *                     EFalse if finsbox is a fixed type.
+     */
+    void ConstructFindBoxL( TBool aIsFindPopup );
+
+    /**
+     * Creates icon array, populates iIconArray to be used by listbox
+     */
+    void CreateIconArrayL();
+
+    /**
+     * Creates the display item from the media
+     */
+    MulVisualItem* CreateDisplayedItemL( TInt aIndex );
+
+    /**
+     * Adds detail to the list item at the specified index
+     */
+    void AddDetailToDisplayedItemL( MulVisualItem* aVisualItem, CMPXMedia* aMedia, TInt aIndex );
+
+    void SetTitleL( MulVisualItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailCountL( MulVisualItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailArtistL( MulVisualItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailAlbumL( MulVisualItem* aVisualItem, CMPXMedia* aMedia );
+    void SetDetailDurationL( MulVisualItem* aVisualItem, CMPXMedia* aMedia );
+    void UpdateTimeIndicatorsL( TDes& aBuf, TInt aDuration );
+    void SetDetailIndicatorL( MulVisualItem* aVisualItem, TInt aIndex );
+    void SetDetailIconL( MulVisualItem* aVisualItem, TInt aIndex );
+    void SetDetailThumbnailL( MulVisualItem* aVisualItem, CMPXMedia* aMedia, TInt aIndex );
+
+    /**
+     * Set the collection context
+     */
+    void SetCollectionContextL();
+
+    /**
+     * Opens search field.
+     */
+    void ActivateSearchFieldL();
+
+    /**
+     * Closes search field, if open.
+     */
+    void DeactivateSearchField();
+
+private: // data
+
+    /**
+     * Context of collection view. It's the exact location within collection navigation
+     * based on category type + category.
+     */
+    enum TContext
+        {
+        EContextUnknown,
+        EContextGroupCollection,
+        EContextGroupArtist,
+        EContextGroupAlbum,
+        EContextGroupPlaylist,
+        EContextGroupSong,
+        EContextGroupPodcast,
+        EContextGroupGenre,
+        EContextGroupComposer,
+        EContextItemArtist,
+        EContextItemAlbum,
+        EContextItemPlaylist,
+        EContextItemSong,
+        EContextItemPodcast,
+        EContextItemGenre,
+        EContextItemComposer
+        };
+
+    struct TThumnailReq
+        {
+        TThumbnailRequestId iReqId;
+        TInt                iIndex;
+        };
+
+    MMPXViewContainer*          iViewContainer;         // Not owned
+    MEikCommandObserver*        iView;                  // Not owned
+    MEikListBoxObserver*        iListBoxObserver;       // Not owned
+    CMPXCommonListBoxArrayBase* iListBoxArray;          // Owned
+    CArrayFixFlat<TInt>*        iListSelections;        // Owned
+    CAknIconArray*              iIconArray;             // Owned
+
+//    CAknSearchField*            iFindBox;  // Owned
+
+    CMPXCommonContainerTextureManager*  iTextureManager;// Owned
+	CMPXCommonUiHelper*         iCommonUiHelper;        // Owned
+
+    CAlfEnv*                    iEnv;                   // Not owned
+    IMulListWidget*             iListWidget;            // Not owned
+    IMulModel*                  iWidgetModel;           // Not owned
+    IAlfViewWidget*             iViewWidget;            // Not owned
+
+    CThumbnailManager*          iThumbnailManager;      // Owned
+    RArray<TThumnailReq>        iThumbnailReqArray;     // Owned
+
+    CMPXCommonContainerSearchFieldWrapper* iSearchFieldWrapper;  // Owned
+    CMPXCommonContainerFilteredList* iFilteredList;     // Owned
+
+    TContext                    iContext;
+    TInt                        iResourceOffset;        // Must be freed
+
+    TBool                       iIsFindPopup;
+    TBool                       iIsFindEnabled;
+    TBool                       iIsMarkingEnabled;
+
+	TInt						iTopIndex;
+	TInt						iBottomIndex;
+	TInt						iIconHeight;
+	TInt						iIconWidth;
+	TInt						iIndicatorHeight;
+	TInt						iIndicatorWidth;
+
+    TBool                       iAlfEnvCreated;
+    TMPXCommonContainerCollectionType  iCollectionType;
+    TBool                       iContainerActive;
+    };
+
+#endif  // CMPXCOMMONCONTAINERHITCHCOCKIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainermediahelper.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX common container Media helper.
+*
+*/
+
+
+
+#ifndef CMPXCOMMONCONTAINERMEDIAHELPER_H
+#define CMPXCOMMONCONTAINERMEDIAHELPER_H
+
+#include <e32base.h>
+#include <mpxcollectionobserver.h>
+
+// FORWARD DECLARATIONS
+class MMPXCommonContainer;
+class MMPXCollectionUtility;
+
+/**
+*  Helper class to retrieve media for clients
+*/
+NONSHARABLE_CLASS( CMPXCommonContainerMediaHelper )
+    : public CBase
+    , public MMPXCollectionObserver
+    {
+public:
+
+    /**
+    * Two-phased constructor
+    */
+    static CMPXCommonContainerMediaHelper* NewL(
+        MMPXCommonContainer* aCommonContainer );
+
+    /**
+    * Destructor.
+    */
+    virtual ~CMPXCommonContainerMediaHelper();
+
+private: // constructors
+
+    /**
+    * Constructor.
+    */
+    CMPXCommonContainerMediaHelper( MMPXCommonContainer* aCommonContainer );
+
+    /**
+    * Symbian OS constructor.
+    */
+    void ConstructL();
+
+public: // New Methods
+
+    /**
+    * Retrieves the media given the current path, and upon return,
+    * either calls back the observer, or broadcasts the message to
+    * the given client list
+    *
+    * @param aCmd CMPXCommand containing the attributes and attribute spec
+    *             Ownership of aAttrs is passed to this method
+    */
+    void MediaL(
+        const TMPXItemId& aItemId,
+        RArray<TMPXAttribute> aAttrs,
+        CMPXMedia* aAttrSpecs );
+
+    /**
+    * Updates the specified media with the results from the search
+    * criteria
+    *
+    * @param aMedia Media to be updated
+    * @param aSearchAttrs Media search attributes
+    * @param aSearchAttrSpecs Media search attribute specs
+    */
+    void UpdateMediaL(
+        CMPXMedia* aMedia,
+        RArray<TMPXAttribute> aSearchAttrs,
+        CMPXMedia* aSearchAttrSpecs );
+
+    /**
+    * Cancels all outstanding requests
+    */
+    void CancelRequests();
+
+private: // From base classes
+
+	/**
+    *  From MMPXCollectionObserver
+    */
+    void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
+
+    /**
+    *  From MMPXCollectionObserver
+    */
+    void HandleOpenL(
+        const CMPXMedia& aEntries,
+        TInt aIndex,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+    *  From MMPXCollectionObserver
+    */
+    void HandleOpenL(
+        const CMPXCollectionPlaylist& aPlaylist,
+        TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     */
+    void HandleCommandComplete(
+        CMPXCommand* aCommandResult,
+        TInt aError );
+
+    /**
+    *  From MMPXCollectionMediaObserver
+    */
+    void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError);
+
+private: // data
+
+    MMPXCommonContainer*    iCommonContainer;
+    MMPXCollectionUtility*  iCollectionUtility;
+    };
+
+#endif // CMPXCOMMONCONTAINERMEDIAHELPER_H
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainersearchfield.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,375 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class that implements Search Field feature.
+*
+*/
+
+
+#ifndef CMPXCOMMONCONTAINERSEARCHFIELD_H
+#define CMPXCOMMONCONTAINERSEARCHFIELD_H
+
+// INCLUDE FILES
+#include <coecntrl.h>
+#include <eikedwin.h>
+#include <Avkon.mbg>
+
+// FORWARD DECLARATION
+class CAknInputFrame;
+class CMPXCommonContainerSearchField;
+class CMPXCommonContainerSearchFieldWrapper;
+
+// CLASS DECLARATION
+
+/**
+ * Class for handling key events. Has higher priority than FEP,
+ * to be able to catch up/down key event and forward them to Search
+ * Field's editor.
+ */
+NONSHARABLE_CLASS( CMPXCommonContainerSearchFieldKeyHandler ) :
+                           public CCoeControl,
+                           public MEikEdwinObserver
+    {
+    public:
+
+        /**
+         * public constructor.
+         *
+         * @param aSearchField Reference to Search Field that key events are controlled.
+         */
+        CMPXCommonContainerSearchFieldKeyHandler( CMPXCommonContainerSearchField& aSearchField );
+
+        /**
+         * Catches key events before FEP could do it.
+         *
+         * @param aKeyEvent Key event.
+         * @param aType Key event type.
+         * @return Response whether key was handled or not.
+         */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+        /**
+         * Catches EEventTextUpdate event.
+         *
+         * @param aEdwin Pointer to editor.
+         * @param aEventType Editor event type.
+         */
+        void HandleEdwinEventL( CEikEdwin* aEdwin, TEdwinEvent aEventType );
+
+        /**
+         * Put control to control stack or remove it from there.
+         *
+         * @param aEnable ETrue puts control to the control stack with higher
+         *        priority than FEP has. EFalse removes control from the stack.
+         */
+        void EnableL( TBool aEnable );
+
+        /**
+         * Resets key handling situation by setting iFirstKeyEvent to ETrue.
+         */
+        void Reset();
+
+    /**
+     * Get LeftRightEvent.
+     */
+    TBool IsLeftRightEvent();
+
+    /**
+     * SetFirstKey.
+     */
+    void SetFirstKeyEvent( TBool aFirstKeyEvent );
+
+    protected:
+
+        /**
+         * Key event catching enable flag.
+         */
+        TBool iEnabled;
+
+        /**
+         * Only first key event is catched.
+         */
+        TBool iFirstKeyEvent;
+
+        /**
+         * Flag for LeftRightEvent.
+         */
+        TBool iLeftRightEvent;
+
+        /**
+         * Search Field control of which key events are catched.
+         */
+        CMPXCommonContainerSearchField& iSearchField;
+    };
+
+/**
+ * Search Field class for component.
+ *
+ */
+NONSHARABLE_CLASS( CMPXCommonContainerSearchField ) : public CCoeControl,
+                                         public MCoeControlObserver,
+                                         public MCoeFepObserver
+    {
+    public:
+
+        /**
+         * Two-phased constructor. Leaves on failure.
+         *
+         * @param aParent Parent control.
+         * @param aFindKeywordMode ETrue if the pane is a find keyword pane.
+         * @return The constructed Search Field control.
+         */
+        static CMPXCommonContainerSearchField* NewL( CMPXCommonContainerSearchFieldWrapper* aParent,
+                                        TBool aFindKeywordMode = ETrue );
+
+        /**
+         * Destructor.
+         */
+        virtual ~CMPXCommonContainerSearchField();
+
+        /**
+         * Shows or hides to Search Field.
+         *
+         * @param ETrue to set visible
+         */
+        void MakeVisibleL( TBool aVisible );
+
+        /**
+         * Non-leaving version of MakeVisibleL.
+         *
+         * @param ETrue to set visible
+         */
+		void MakeVisible( TBool aVisible );
+
+        /**
+         * Called to handle change in Search Field size.
+         */
+        void HandleFindSizeChanged();
+
+        /**
+         * Enable key event handler.
+         *
+         * @param aEnable ETrue to enable.
+         */
+        void EnableKeyEventHandlerL( TBool aEnable );
+
+    public:	// From MCoeControlObserver
+
+        /**
+         * Handle control event.
+         *
+         * @param aControl The control.
+         * @param aEventType Event type.
+         */
+	    void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
+
+    public: // From CCoeControl
+
+        /**
+         * Handles key event.
+         *
+         * @param aKeyEvent The key event.
+         * @param aType Key event type.
+         * @return Response whether event was consumed.
+         */
+        TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+        /**
+         * HandlePointerEventL, from CCoeControl.
+         *
+         * @param aPointerEvent Pointer event.
+         */
+        void HandlePointerEventL( const TPointerEvent& aPointerEvent );
+
+        /**
+         * Count component controls.
+         *
+         * @return Number of component controls
+         */
+        TInt CountComponentControls() const;
+
+        /**
+         * Get a component control by index.
+         *
+         * @param aIndex Index of component control to be returned
+         * @return Component control or NULL
+         */
+        CCoeControl* ComponentControl( TInt aIndex ) const;
+
+        /**
+         * Sets the OrdinalPosition of Search Field.
+         *
+         * @param aPos The OrdinalPosition
+         */
+        void SetOrdinalPosition( TInt aPos );
+
+    public: // Text manipulation.
+
+        /**
+         * Lengt of the text in the editor.
+         *
+         * @return The text length
+         */
+        TInt TextLength() const;
+
+        /**
+         * Get text from the editor.
+         *
+         * @return text from the editor
+         */
+        HBufC* GetTextLC() const;
+
+        /**
+         * Set text.
+         *
+         * @param aTxt Text to set, appended if needed.
+         */
+        void SetTextL( const TDesC& aTxt );
+
+        /**
+         * Selects all text in the editor, see CEikEdwin's SelectAllL().
+         */
+        void SelectAllL();
+
+        /**
+         * Set info text.
+         *
+         * @param aText Text to be displayed as info
+         */
+        void SetInfoTextL( const TDesC& aText );
+
+        /**
+         * Perform clipboard functionality.
+         *
+         * @param aClipboardFunc Function to perform.
+         */
+        void ClipboardL( CEikEdwin::TClipboardFunc aClipboardFunc );
+
+        /**
+         * Returns editor control of Search Field.
+         *
+         * @return Editor control.
+         */
+        CEikEdwin* Editor() const;
+
+        /**
+         * Checks if client's keyword needs updating, and updates if needed.
+         */
+        void UpdateFindKeywordL();
+
+    public: // Observer support.
+
+        /**
+         * Handles resource change.
+         *
+         * @param aType Type of resource change.
+         */
+		void HandleResourceChange( TInt aType );
+
+        /**
+         * Handles the completion of a FEP transaction.
+         */
+		void HandleCompletionOfTransactionL();
+
+        /**
+         * Handles the start of a FEP transaction.
+         */
+		void HandleStartOfTransactionL();
+
+    protected: // Construction.
+
+        /**
+         * Constructor.
+         *
+         * @param aFindKeywordMode ETrue if the pane is a find keyword pane.
+         */
+        CMPXCommonContainerSearchField( TBool aFindKeywordMode );
+
+        /**
+         * Second-phase constructor. Leaves on failure.
+         *
+         * @param aParent Parent control.
+         */
+        void ConstructL( CMPXCommonContainerSearchFieldWrapper* aParent );
+
+    protected: // From CCoeControl.
+
+        /**
+         * Handle size change, layout and draw components.
+         */
+        void SizeChanged();
+
+        /**
+         * Handle focus change.
+         *
+         * @param aDrawNow ETrue if immediate draw is needed.
+         */
+        void FocusChanged( TDrawNow aDrawNow );
+
+    private:
+
+        /**
+        * Set the text and redraw.
+        *
+        * @param aTxt Text to set.
+        */
+        void DoSetTextL( const TDesC& aTxt );
+
+        /**
+         * Activates virtual keyboard.
+         */
+        void ActivateVkbL();
+
+    protected: // Data.
+
+        /**
+         * Pointer to parent (control).
+         * Not own.
+         */
+        CMPXCommonContainerSearchFieldWrapper* iParent;
+
+        /**
+         * If the control is in find keyword pane mode.
+         */
+		TBool iFindKeywordMode;
+
+		/**
+		 * HandleFEPFind.
+		 */
+		TBool iHandleFEPFind;
+
+		/**
+		 * The previously typed text into iEditor.
+		 */
+		HBufC* iPrevKeyword;
+
+		/**
+		 * Editor.
+		 * Own.
+		 */
+        CEikEdwin* iEditor;
+
+        /**
+         * Input frame.
+         * Own.
+         */
+        CAknInputFrame* iInputFrame;
+
+        /**
+         * Key handler.
+         * Own.
+         */
+        CMPXCommonContainerSearchFieldKeyHandler *iSearchFieldKeyHandler;
+    };
+
+#endif // CMPXCOMMONCONTAINERSEARCHFIELD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainersearchfieldwrapper.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wrapper class for Search Field. Handles search field .
+*                activation, deactivation and size. Wrapper is a window owning
+*                control.
+*
+*/
+
+
+#ifndef CMPXCOMMONCONTAINERSEARCHFIELDWRAPPER_H
+#define CMPXCOMMONCONTAINERSEARCHFIELDWRAPPER_H
+
+#include <coecntrl.h>
+
+class CMPXCommonContainerSearchField;
+
+/**
+ * Class for handling Search Field events.
+ */
+NONSHARABLE_CLASS( MMPXCommonContainerSearchFieldObserver )
+    {
+
+    public:
+
+    /**
+     * Call when filtering word changes. Causes filtering to be updated.
+     * Calling with zero-length filtering word stops filtering.
+     *
+     * @param aWord New filtering word.
+     */
+    virtual void NewFilteringWordL( const TDesC& aWord ) = 0;
+    };
+
+/**
+ * Window owning control for wrapping CMPXCommonContainerSearchField.
+ *
+ */
+NONSHARABLE_CLASS( CMPXCommonContainerSearchFieldWrapper ) : public CCoeControl
+    {
+public:
+    /**
+     * Creates Search Field Wrapper.
+     *
+     * @param aObserver Observer
+     */
+    static CMPXCommonContainerSearchFieldWrapper* NewL( MMPXCommonContainerSearchFieldObserver* aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCommonContainerSearchFieldWrapper();
+
+    /**
+     * Checks if Search Field is active.
+     *
+     * @return ETrue if Search Field is active / visible.
+     */
+    TBool IsSearchFieldActive();
+
+    /**
+     * Activates Search Field.
+     */
+    void ActivateSearchFieldL();
+
+    /**
+     * Deactivates Search Field, if active / visible.
+     */
+    void DeactivateSearchField();
+
+    /**
+     * Returns rectangle that list (widget) should use.
+     *
+     * @param aSearchVisible ETrue if Search Field is visible, list's
+     *    rectangle is smaller in this case.
+     * @param aClientRect component's view's client rectangle.
+     * @return Rectangle for list (widget).
+     */
+    TRect GetListRect( TBool aSearchVisible, TRect aClientRect );
+
+    /**
+     * Returns rectangle that Search Field should use.
+     *
+     * @param aSearchVisible ETrue if Search Field is visible.
+     * @param aClientRect component's view's client rectangle.
+     * @return Rectangle for Search Field.
+     */
+    TRect GetSearchFieldRect( TBool aSearchVisible, TRect aClientRect );
+
+    /**
+     * Called by CMPXCommonContainerSearchField when Find key word changes.
+     *
+     * @param aFindWord New Find key word.
+     */
+    void FindKeywordL( const TDesC& aFindWord );
+
+    /**
+     * Returns view's client rectangle.
+     *
+     * @return View's client rectangle.
+     */
+    TRect& ClientRect();
+
+    /**
+     * Call when view's client rectangle changes.
+     *
+     * @param aClientRect New size of view's client rectangle.
+     */
+    void SetClientRect( const TRect& aClientRect );
+
+public: // From CCoeControl
+
+    /**
+     * From CCoeControl
+     */
+    CCoeControl *ComponentControl( TInt aIndex ) const;
+
+    /**
+     * From CCoeControl
+     */
+    TInt CountComponentControls() const;
+
+    /**
+     * From CCoeControl
+     */
+    void SizeChanged();
+
+protected:
+
+        /**
+         * Constructor.
+         *
+         * @param aObserver Observer
+         */
+        CMPXCommonContainerSearchFieldWrapper( MMPXCommonContainerSearchFieldObserver* aObserver );
+
+    /**
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+
+protected:
+
+    /**
+     * Search field bserver.
+     * Not own.
+     */
+    MMPXCommonContainerSearchFieldObserver* iObserver;
+
+    /**
+     * Pointer to the actual Search Field component.
+     * Own.
+     */
+    CMPXCommonContainerSearchField* iSearchField;
+
+    /**
+     * View's client rectangle.
+     */
+    TRect iClientRect;
+    };
+
+#endif // CMPXCOMMONCONTAINERSEARCHFIELDWRAPPER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainertexturemanager.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,148 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX common container Alf Texture manager.
+*
+*/
+
+
+
+#ifndef CMPXCOMMONCONTAINERTEXTUREMANAGER_H
+#define CMPXCOMMONCONTAINERTEXTUREMANAGER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <alf/alfbitmapprovider.h>
+#include <mpxitemid.h>
+#include "mpxcommoncontainer.h"
+
+// CONSTANTS
+const TInt KMPXFirstAlfThumbnailTextureId = 0x20000001;
+const TInt KMPXLastAlfThumbnailTextureId = 0x30000000;
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+class CAlfTexture;
+class CAlfTextureManager;
+
+// CLASS DECLARATION
+
+/**
+ *  Texture manager for common container.
+ *
+ *  @lib mpxcommoncontainer.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CMPXCommonContainerTextureManager )
+    : public CBase
+    , public MAlfBitmapProvider
+    {
+public:
+    
+    enum TMPXTextureType
+        {
+        EMPXTextureNone,
+        EMPXTextureImage,
+        EMPXTextureIcon
+        };
+    
+    /**
+     * default C++ constructor.
+     */
+    CMPXCommonContainerTextureManager(
+        CAlfTextureManager& aTextureManager );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCommonContainerTextureManager();
+
+    /**
+     * Creates texture from the specified bitmap and mask
+     *
+     * @param aIndex container item index
+     * @param aItemId container item id
+     * @param aBitmap a bitmap
+     * @param aMask a bitmap mask
+     */
+	CAlfTexture& CreateTextureL( TInt aIndex, TMPXItemId aItemId,
+	    CFbsBitmap* aBitmap, CFbsBitmap* aMask );
+	    
+    /**
+     * Creates icon texture from the specified bitmap and mask
+     * (not cached)
+     *
+     * @param aBitmap a bitmap
+     * @param aMask a bitmap mask
+     */
+	CAlfTexture& CreateIconTextureL( TInt aIconIndex, CFbsBitmap* aBitmap, CFbsBitmap* aMask );
+	    
+    /**
+     * Returns texture for the specified item
+     *
+     * @param aItemId container item id
+     * @return Texture Id for the item, KErrNotFound if non-existent
+     */
+	TInt TextureId( TMPXItemId aItemId ) const;
+
+    /**
+     * Returns texture for the specified icon
+     *
+     * @param aIconIndex container item id
+     * @return Texture Id for the item, KErrNotFound if non-existent
+     */
+	TInt IconTextureId( TInt aIconIndex ) const;
+
+    /**
+     * Removes the cached texture information
+     *
+     * @param aId container item id
+     */
+    void ClearCache( TMPXTextureType aType=EMPXTextureNone );
+    
+private:
+
+// from base class MAlfBitmapProvider
+
+    /**
+     * Callback with texture id when a texture is created
+     *
+     * @param aId container item id
+     * @param aBitmap a bitmap
+     * @param aMask a bitmap mask
+     */
+    void ProvideBitmapL( TInt aId, CFbsBitmap*& aBitmap, CFbsBitmap*& aBitmapMask);
+    
+private: // data
+    
+    struct TMPXTextureItem
+        {
+        TMPXTextureType iType;
+        TInt            iItemIndex;
+        TMPXItemId      iItemId;
+        TInt            iTextureId;
+        CFbsBitmap*     iBitmap;
+        CFbsBitmap*     iMask;
+        };
+
+    CAlfTextureManager&         iTextureManager;    // not owned
+    MMPXCommonContainer*        iCommonContainer;   // not owned
+    TMPXTextureItem             iTextureItem;
+    RArray<TMPXTextureItem>     iTextureArray;      // owned
+    RArray<TMPXTextureItem>     iIconTextureArray;  // owned
+    };
+
+#endif  // CMPXCOMMONCONTAINERTEXTUREMANAGER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/inc/mpxcommoncontainertexturemanager2.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX common container HG Texture manager.
+*
+*/
+
+
+
+#ifndef CMPXCOMMONCONTAINERTEXTUREMANAGER2_H
+#define CMPXCOMMONCONTAINERTEXTUREMANAGER2_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxitemid.h>
+#include <gulicon.h>
+#include <e32hashtab.h>
+
+#include "mpxcommoncontainer.h"
+
+// CONSTANTS
+
+// FORWARD DECLARATIONS
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+/**
+ *  Texture manager for common container.
+ *
+ *  @lib mpxcommoncontainer.lib
+ *  @since S60 v3.2
+ */
+NONSHARABLE_CLASS( CMPXCommonContainerTextureManager2 )
+    : public CBase
+    {
+public:
+    
+    /**
+     * default C++ constructor.
+     */
+    CMPXCommonContainerTextureManager2();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCommonContainerTextureManager2();
+
+    /**
+     * Creates texture from the specified bitmap.
+     *
+     * @param aIndex container item index
+     * @param aItemId container item id
+     * @param aBitmap a bitmap
+     */
+	void CreateTextureL( TInt aIndex, TMPXItemId aItemId, CFbsBitmap* bitmap );
+	    
+	    
+    /**
+     * Returns texture for the specified item
+     *
+     * @param aItemId container item id
+     * @return ETrue for the item, EFalse if non-existent
+     */
+	TBool TextureExist( TMPXItemId aItemId ) const;
+
+    /**
+     * Called with array index when a bitmap is needed
+     *
+     * @param aId container item id
+     */
+    CFbsBitmap* ProvideBitmapL( TInt aIndex );
+
+    /**
+     * Removes the cached texture information
+     *
+     */
+    void ClearCache();
+    
+    
+private: // data
+    
+    typedef RHashMap<TInt, CFbsBitmap*> RTextureMap;
+    RTextureMap  iTextureMap;
+    typedef RHashMap<TInt32, TInt> RTextureIndex;
+    RTextureIndex iTextureIndexMap;
+    };
+
+#endif  // CMPXCOMMONCONTAINERTEXTUREMANAGER2_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/loc/mpxcommoncontainer.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxcommoncontainer
+*
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Antriksh list details text to show the number of items in the collection
+// d:For the case there is more than 1 song in the collection
+// l:list_logical_template_3_detail
+// r:5.1
+//
+#define qtn_vmp_detail_n_songs "%N songs"
+
+// d:Antriksh list details text to show the number of items in the collection
+// d:For the case there's only 1 song in the collection
+// l:list_logical_template_3_detail
+// r:5.1
+//
+#define qtn_vmp_detail_1_song "1 song"
+
+// d:Antriksh list details text to show the number of items in the collection
+// d:For the case there's only 1 album in the collection
+// l:list_logical_template_3_detail
+// r:5.1
+//
+#define qtn_vmp_collection_detail_1_album "1 album"
+
+// d:Antriksh list details text to show the number of items in the collection
+// d:For the case there is more than 1 podcast episode in the collection
+// l:list_logical_template_3_detail
+// r:5.1
+//
+#define qtn_vmp_num_episode "%N episodes"
+
+// d:Antriksh list details text to show the number of items in the collection
+// d:For the case there's only 1 podcast episode in the collection
+// l:list_logical_template_3_detail
+// r:5.1
+//
+#define qtn_vmp_one_episode "1 episode"
+
+// d:Antriksh list title text when title is unknown
+// l:list_logical_template_3_title
+// r:5.1
+//
+#define qtn_vmp_unknown "Unknown"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Factory function to create the common container
+*
+*/
+
+
+
+#include <e32base.h>
+#include "mpxcommoncontainer.h"
+#include "mpxcommoncontaineravkonimp.h"
+
+#ifdef __HG_COLLECTIONVIEW
+#include "mpxcommoncontainerhgimp.h"
+#endif //__HG_COLLECTIONVIEW
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two Phased Constructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C MMPXCommonContainer* CMPXCommonContainerFactory::NewL()
+    {
+#ifdef __HG_COLLECTIONVIEW
+    return new (ELeave) CMPXCommonContainerHgImp();
+#else
+    return new (ELeave) CMPXCommonContainerAvkonImp();
+#endif // __ENABLE_HITCHCOCK_UI
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontaineravkonimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,938 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of common container for AVKON platform.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <barsread.h>
+#include <stringloader.h>
+#include <akniconarray.h>
+#include <gulicon.h>
+#include <featmgr.h>
+#include <aknsfld.h>
+#include <aknutils.h>
+#include <aknlists.h>
+#include <aknconsts.h>
+#include <avkon.mbg>
+#include <eikclbd.h>
+#include <eikcmobs.h>
+#include <bautils.h>
+
+#include <data_caging_path_literals.hrh>
+#include <mpxcommoncontainer.rsg>
+#include <mpxlog.h>
+#include <mpxuser.h>
+
+#include "mpxcommonlistboxarraybase.h"
+#include "mpxcommoncontaineravkonimp.h"
+#include "mpxcommoncontainer.hrh"
+#include <mpxlbxextendedfeatures.h>
+
+// CONSTANTS
+const TInt KMPXFindboxTextLimit = 40;
+
+_LIT( KMPXCommonContainerRscPath, "mpxcommoncontainer.rsc" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXCommonContainerAvkonImp::CMPXCommonContainerAvkonImp() :
+    iIsFindEnabled( ETrue ),
+    iIsMarkingEnabled( ETrue ),
+    iContainerActive( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCommonContainerAvkonImp::~CMPXCommonContainerAvkonImp()
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::~CMPXCommonContainerAvkonImp" );    
+    
+    FeatureManager::UnInitializeLib();        
+        
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+        
+    delete iListBox;
+    delete iFindBox;
+    delete iLbxExtFeat;
+    }
+
+// ---------------------------------------------------------------------------
+// Return Coe Control
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CMPXCommonContainerAvkonImp::CoeControl()
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::CoeControl" );
+    return this;
+    }
+
+// ---------------------------------------------------------------------------
+// Set View Container
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SetViewContainer(
+    MMPXViewContainer* aViewContainer )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::SetViewContainer" );
+    iViewContainer = aViewContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// Set command observer for the container
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SetCommandObserver(    
+    MEikCommandObserver* aCommandObserver )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::SetCommandObserver" );
+    iView = aCommandObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SetListBoxObserver(
+    MEikListBoxObserver* aListBoxObserver )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::SetListBoxObserver" );
+    iListBoxObserver = aListBoxObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::UpdateLayout()
+    {        
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::UpdateLayout" );
+    }
+
+// -----------------------------------------------------------------------------
+// Returns a pointer to the listboxarray
+// -----------------------------------------------------------------------------
+//
+CMPXCommonListBoxArrayBase* CMPXCommonContainerAvkonImp::ListBoxArray() const
+    {
+    ASSERT( iListBoxArray );
+    return iListBoxArray;
+    }
+
+// -----------------------------------------------------------------------------
+// Sets listbox array
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SetListBoxArrayL(
+    CMPXCommonListBoxArrayBase* aListBoxArray )
+    {
+    iListBoxArray = aListBoxArray;
+    if ( iListBoxArray )
+        {
+        CTextListBoxModel* listboxModel = iListBox->Model();
+        listboxModel->SetItemTextArray( iListBoxArray );
+        listboxModel->SetOwnershipType( ELbmOwnsItemArray );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Return number of listbox items shown in the current listbox.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerAvkonImp::CurrentListItemCount() const
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::CurrentListItemCount" );
+    ASSERT( iFindBoxFilterItems );
+    return iFindBoxFilterItems->FilteredNumberOfItems();
+    }
+
+// -----------------------------------------------------------------------------
+// Return total number of listbox items in the listbox.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerAvkonImp::TotalListItemCount() const
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::TotalListItemCount" );
+    ASSERT( iFindBoxFilterItems );
+    return iFindBoxFilterItems->NonFilteredNumberOfItems();
+    }
+
+// -----------------------------------------------------------------------------
+// Gets top listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerAvkonImp::TopLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::TopLbxItemIndex" );
+    ASSERT( iListBox );
+    ASSERT( iFindBoxFilterItems );
+    TInt topItem( iListBox->TopItemIndex() );
+
+    // Make sure there's at least one item in the listbox
+    if ( iFindBoxFilterItems->FilteredNumberOfItems() )
+        {
+        // Get the real listbox index
+        topItem = iFindBoxFilterItems->FilteredItemIndex( topItem );
+        }
+    return topItem;
+    }
+    
+// -----------------------------------------------------------------------------
+// Gets bottom listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerAvkonImp::BottomLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::BottomLbxItemIndex" );
+    ASSERT( iListBox );
+    ASSERT( iFindBoxFilterItems );
+    TInt bottomItem( iListBox->BottomItemIndex() );
+
+    // Make sure there's at least one item in the listbox
+    if ( iFindBoxFilterItems->FilteredNumberOfItems() )
+        {
+        // Get the real listbox index
+        bottomItem = iFindBoxFilterItems->FilteredItemIndex( bottomItem );
+        }
+    return bottomItem;
+    }    
+
+// -----------------------------------------------------------------------------
+// Gets current listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerAvkonImp::CurrentLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::CurrentLbxItemIndex" );    
+    ASSERT( iListBox );
+    ASSERT( iFindBoxFilterItems );
+    TInt currentItem( iListBox->CurrentItemIndex() );
+
+    // Make sure there's at least one item in the listbox
+    if ( iFindBoxFilterItems->FilteredNumberOfItems() )
+        {
+        // Get the real listbox index
+        currentItem = iFindBoxFilterItems->FilteredItemIndex( currentItem );
+        }
+    return currentItem;
+    }
+
+// -----------------------------------------------------------------------------
+// Get current selected listbox items indices (relative to the original listbox)
+// -----------------------------------------------------------------------------
+//
+const CArrayFix<TInt>* CMPXCommonContainerAvkonImp::
+    CurrentSelectionIndicesL() const
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::CurrentSelectionIndicesL" );
+    ASSERT( iListBox );
+    ASSERT( iFindBoxFilterItems );
+    const CArrayFix<TInt>* selectionArray( iListBox->SelectionIndexes() );
+
+    if ( iFindBoxFilterItems->FilteredNumberOfItems() )
+        {
+        // Get the real listbox indices
+        iFindBoxFilterItems->SelectionIndexes()->Reset();
+        iFindBoxFilterItems->UpdateSelectionIndexesL();
+        selectionArray = iFindBoxFilterItems->SelectionIndexes();
+        }
+    return selectionArray;
+    }
+
+// -----------------------------------------------------------------------------
+// Get current selected listbox items indices (relative to the original listbox)
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SetCurrentSelectionIndicesL(
+    CArrayFix<TInt>* aIndices ) const
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::SetCurrentSelectionIndicesL" );    
+    ASSERT( iListBox );
+    iListBox->SetSelectionIndexesL( aIndices ); // ownership not transfered
+    }
+
+// -----------------------------------------------------------------------------
+// Set top listbox item index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SetLbxTopItemIndex( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::SetLbxTopItemIndex" );
+    ASSERT( iListBox );
+    ASSERT( iFindBoxFilterItems );
+    TInt index( iFindBoxFilterItems->VisibleItemIndex( aIndex ) );
+    if ( index == KErrNotFound )
+        {
+        index = 0;
+        }
+    iListBox->SetTopItemIndex( index );
+    }
+
+// -----------------------------------------------------------------------------
+// Set current listbox item index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SetLbxCurrentItemIndex( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::SetLbxCurrentItemIndex" );
+    ASSERT( iListBox );
+    ASSERT( iFindBoxFilterItems );
+    TInt index( iFindBoxFilterItems->VisibleItemIndex( aIndex ) );
+    if ( index == KErrNotFound )
+        {
+        index = 0;
+        }
+    iListBox->SetCurrentItemIndex( index );
+    }
+
+// -----------------------------------------------------------------------------
+// Set current listbox item index and highlight it.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SetLbxCurrentItemIndexAndDraw( 
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::SetLbxCurrentItemIndexAndDraw" );
+    ASSERT( iListBox );
+    ASSERT( iFindBoxFilterItems );
+    TInt index( iFindBoxFilterItems->VisibleItemIndex( aIndex ) );
+    if ( index == KErrNotFound )
+        {
+        index = 0;
+        }
+    iListBox->SetCurrentItemIndexAndDraw( index );
+    }
+
+// -----------------------------------------------------------------------------
+// Clear listbox selection.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::ClearLbxSelection()
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::ClearLbxSelection" );
+    ASSERT( iListBox );
+    ASSERT( iFindBoxFilterItems );
+    iListBox->ClearSelection();
+    iFindBoxFilterItems->SelectionIndexes()->Reset();
+    }
+
+// -----------------------------------------------------------------------------
+// Sets the text for an empty list box
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SetLbxEmptyTextL( const TDesC& aText )
+    {
+    ASSERT( iListBox );
+    iListBox->View()->SetListEmptyTextL( aText );
+    }
+
+// -----------------------------------------------------------------------------
+// Draws a list box item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::DrawLbxItem( TInt aIndex )
+    {
+    ASSERT( iListBox );
+    TInt topIndex( TopLbxItemIndex() );
+    TInt bottomIndex( BottomLbxItemIndex() );
+    if ( aIndex >= topIndex && aIndex <= bottomIndex )
+        {
+        iListBox->DrawItem( aIndex );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Set Find box's focus.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SetFindBoxFocus( TBool aFocus )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::SetFindBoxFocus" );
+    ASSERT( iFindBox );
+    if ( aFocus )
+        {
+        iFindBox->MakeVisible( ETrue );
+        }
+    iFindBox->SetFocus( aFocus );
+    }
+
+// -----------------------------------------------------------------------------
+// Handle listbox item addition.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::HandleLbxItemAdditionL()
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::HandleLbxItemAdditionL" );
+    ASSERT( iListBox );
+    ASSERT( iFindBoxFilterItems );
+    iFindBoxFilterItems->HandleItemArrayChangeL();
+    iListBox->HandleItemAdditionL();
+    }
+    
+// -----------------------------------------------------------------------------
+// Handle listbox item addition, preserving the current display index
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::HandleLbxItemAdditionPreserveIndexL()
+    {        
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::HandleLbxItemAdditionPreserveIndexL" );
+    TInt currentItem( CurrentLbxItemIndex() );
+    TInt currentBottomIndex( BottomLbxItemIndex() );
+    TInt topIndex( CalculateTopIndex( currentBottomIndex ) );
+    HandleLbxItemAdditionL();
+    if ( currentItem > 0 )
+        {
+        // only redraw if the selected index is > 0, since 
+        // HandleLbxItemAdditionL already redraws it and set index
+        // to 0
+        SetLbxTopItemIndex( topIndex );
+        SetLbxCurrentItemIndexAndDraw( currentItem );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle listbox item removal.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::HandleLbxItemRemovalL()
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::HandleLbxItemRemovalL" );
+    ASSERT( iListBox );
+    iListBox->HandleItemRemovalL();
+    }
+    
+// -----------------------------------------------------------------------------
+// Show/hide find box.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SetFindBoxVisibilityL( TBool aIsVisible )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::SetFindBoxVisibilityL" );
+    ASSERT( iListBox );
+    ASSERT( iFindBox );
+    if (aIsVisible != iFindBox->IsVisible())
+        {
+        iFindBox->MakeVisible( aIsVisible );
+        iFindBox->SetFocus( aIsVisible );
+        if ( !aIsVisible )
+            {
+            iFindBox->ResetL();
+            iFindBoxFilterItems->HandleOfferkeyEventL();
+            iListBox->SetFocus( ETrue );
+            }
+        SizeChanged();
+        DrawDeferred();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Determine find box visibility
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCommonContainerAvkonImp::FindBoxVisibility()
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::FindBoxVisibility" );
+    ASSERT( iFindBox );
+    return iFindBox->IsVisible();
+    }
+
+// -----------------------------------------------------------------------------
+// Restore the PopupCBA of find box
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::RestoreFindBoxPopupCBA()
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::RestoreFindBoxPopupCBA" );
+    ASSERT( iFindBox );
+    iFindBox->SetFocus( ETrue );
+    iFindBox->SetFocus( EFalse );
+    }
+    
+// -----------------------------------------------------------------------------
+// Calculate the top index of the visible items
+// -----------------------------------------------------------------------------
+//    
+TInt CMPXCommonContainerAvkonImp::CalculateTopIndex( TInt aBottomIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::CalculateTopIndex" );
+    ASSERT( iListBox );
+    TInt numItems( iListBox->View()->NumberOfItemsThatFitInRect( 
+        iListBox->View()->ViewRect() ) - 1 ); // to make it 0 based
+    return ( ( aBottomIndex > numItems ) ? aBottomIndex - numItems : 0 );
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::ConstructContainerL( TMPXCommonContainerCollectionType /*aCollectionType*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::ConstructContainerL" );    
+    
+    CCoeEnv* coeEnv( iEikonEnv );
+    TParse parse;
+    parse.Set( KMPXCommonContainerRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );    
+    
+    CreateWindowL();
+    
+    CreateListBoxL();
+    
+    FeatureManager::InitializeLibL();
+    
+    ConstructFindBoxL( ETrue );                
+    }
+
+// ---------------------------------------------------------------------------
+// Enable/disable find box  
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::EnableFindBox( TBool aEnable )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::EnableFindBox" );    
+    iIsFindEnabled = aEnable;
+    if ( !aEnable )
+        {
+        TRAP_IGNORE(SetFindBoxVisibilityL( EFalse ));
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// Enable/disable marking  
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::EnableMarking( TBool aEnable )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::EnableMarking" );    
+    iIsMarkingEnabled = aEnable;
+    }
+    
+// ---------------------------------------------------------------------------
+// Custom handling of commands for markable lists.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::HandleMarkableListProcessCommandL( TInt aCommand )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::HandleMarkableListProcessCommandL" );
+    ASSERT( iListBox );
+
+    // Handle in helper function
+    AknSelectionService::HandleMarkableListProcessCommandL(
+        aCommand,
+        iListBox );
+    }
+
+// ---------------------------------------------------------------------------
+// Custom handling of menu pane for markable lists
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::HandleMarkableListDynInitMenuPane(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::HandleMarkableListDynInitMenuPane" );
+    ASSERT( iListBox );
+    
+    // Handle in helper function
+    AknSelectionService::HandleMarkableListDynInitMenuPane(
+        aResourceId,
+        aMenuPane,
+        iListBox );
+    }
+    
+// ---------------------------------------------------------------------------
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXCommonContainerAvkonImp::HandleKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    ASSERT( iListBox );
+    ASSERT( iFindBox );
+    MPX_DEBUG5( "CMPXCommonContainerAvkonImp::HandleKeyEventL(iCode=%d, iScanCode=%d, iModifiers=0x%x, aType=%d)", 
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iModifiers, aType );
+
+    TKeyResponse response( EKeyWasNotConsumed );
+
+    // Pass the key event to the common container components
+    if ( iIsFindEnabled &&
+        ( ( iFindBox->IsVisible() ) || 
+            ( aKeyEvent.iCode != EKeyBackspace ) ) )
+        {
+        TBool needRefresh( EFalse );
+
+        if ( aKeyEvent.iCode == EKeyBackspace && 
+            iFindBox->TextLength() == 0 )
+            {
+            // dismiss find box
+            SetFindBoxVisibilityL( EFalse );
+            response = EKeyWasConsumed;
+            }
+        else
+            {
+            // Offers the key event to find box.
+            response = AknFind::HandleFindOfferKeyEventL( 
+                aKeyEvent, aType, this, iListBox, iFindBox, iIsFindPopup, 
+                needRefresh );
+            }        
+
+        if ( response == EKeyWasConsumed )
+            {
+            if ( needRefresh )
+                {
+                SizeChanged();
+                DrawNow();
+                }
+            // If it's consumed by the findbox, there's no need to check
+            // with listbox.
+            return response;
+            }
+        }
+    if ( ( aKeyEvent.iCode != EKeyLeftArrow ) && 
+        ( aKeyEvent.iCode != EKeyRightArrow ) &&
+        ( aKeyEvent.iCode != EKeyBackspace ) )
+        {            
+        // now it's iListBox's job to process the key event            
+        if ( !iIsMarkingEnabled && 
+            ( aKeyEvent.iCode == EKeyUpArrow || 
+                aKeyEvent.iCode == EKeyDownArrow ||
+                aKeyEvent.iCode == EKeyOK ) )
+            {
+            // if marking is not enabled, check if this is marking command 
+            if ( aKeyEvent.iModifiers & EModifierLeftShift ||
+                aKeyEvent.iModifiers & EModifierRightShift ||
+                aKeyEvent.iModifiers & EModifierShift )
+                {
+                // strip the marking command, and let list box handle it
+                TKeyEvent modKeyEvent( aKeyEvent );
+                modKeyEvent.iModifiers &= ~EModifierLeftShift;
+                modKeyEvent.iModifiers &= ~EModifierRightShift;
+                modKeyEvent.iModifiers &= ~EModifierShift;
+                response = iLbxExtFeat->HandleLbxKeyEventL( modKeyEvent, aType );                    
+                }
+            else
+                {
+                // not marking command
+                response = iLbxExtFeat->HandleLbxKeyEventL( aKeyEvent, aType );
+                }
+            }
+        else // marking is enabled
+            {
+            response = iLbxExtFeat->HandleLbxKeyEventL( aKeyEvent, aType );
+    
+#ifdef __ENABLE_MSK
+            // check for marking command 
+            if ( ( aKeyEvent.iModifiers & EModifierLeftShift ||
+                aKeyEvent.iModifiers & EModifierRightShift ||
+                aKeyEvent.iModifiers & EModifierShift ||
+                aKeyEvent.iScanCode == EStdKeyDevice3 ||
+                iIsFindPopup ) && aType == EEventKeyUp )
+                {
+                // Update the middle softkey for marking commands
+                iView->ProcessCommandL( EMPXCmdCommonUpdateMiddleSoftKey );
+                }
+#endif // __ENABLE_MSK
+            }
+        }
+        
+    if ( response == EKeyWasNotConsumed && 
+         aType == EEventKey && 
+         aKeyEvent.iCode == EKeyBackspace && iView )
+        {
+        iView->ProcessCommandL( EMPXCmdCommonDelete );
+        response = EKeyWasConsumed;
+        }
+    
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// Activate container
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::ActivateContainerL()
+    {
+    // Activate the container via Coe Control
+    CCoeControl::ActivateL();
+    iContainerActive = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// Deactivate container
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::DeactivateContainerL()
+    {
+    iContainerActive = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Return container state
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCommonContainerAvkonImp::IsContainerActive()
+    {
+    return iContainerActive;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCommonListBoxArrayObserver
+// Handle listbox array events.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::HandleListBoxArrayEventL( 
+    MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::HandleListBoxArrayEventL" );
+    if ( aEvent == MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventIconArrayChange )
+        {
+        delete iIconArray;
+        iIconArray = NULL;
+        CreateIconArrayL();
+        static_cast<CEikColumnListBox*>( iListBox )->ItemDrawer()->ColumnData()->
+            SetIconArray( iIconArray );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Responds to changes to the size and position of the contents of this 
+// control.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::SizeChanged()
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::SizeChanged" );
+
+    if ( iIsFindPopup )
+        {
+        AknFind::HandlePopupFindSizeChanged( 
+            this, 
+            static_cast<CAknColumnListBox*>( iListBox ), 
+            iFindBox );                
+        }
+    else
+        {
+        AknFind::HandleFixedFindSizeChanged( 
+            this, 
+            static_cast<CAknColumnListBox*>( iListBox ), 
+            iFindBox );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the number of controls contained in a compound control.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerAvkonImp::CountComponentControls() const
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::CountComponentControls" );
+    ASSERT( iListBox );
+    ASSERT( iFindBox );
+    return 2; // number of components
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets an indexed component of a compound control.
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CMPXCommonContainerAvkonImp::ComponentControl( TInt aIndex ) const
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::ComponentControl" );
+    CCoeControl* control( NULL );
+    switch ( aIndex )
+        {
+        case 0:
+            {
+            control = iListBox; // Returns the pointer to listbox object.            
+            break;
+            }        
+        case 1:
+            {
+            control = iFindBox; // Returns the pointer to findbox object.
+            break;
+            }
+        default:
+            {
+            MPX_DEBUG1( "CMPXCommonContainerAvkonImp::ComponentControl out of range" );
+            ASSERT( 0 );
+            break;
+            }
+        }
+    return control;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXCommonContainerAvkonImp::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    ASSERT( iViewContainer );
+    MPX_DEBUG5( "CMPXCommonContainerAvkonImp::OfferKeyEventL(iCode=%d, iScanCode=%d, iModifiers=0x%x, aType=%d)", 
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iModifiers, aType );
+
+    // Let the view container handle the key event.
+    return iViewContainer->HandleKeyEventL( aKeyEvent, aType );
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::GetHelpContext( 
+    TCoeHelpContext& aContext ) const
+    {
+    ASSERT( iViewContainer );
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::GetHelpContext" );
+    // Let the view container handle the help context retrieval
+    iViewContainer->HandleHelpContext( aContext );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::HandleResourceChange( TInt aType )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::HandleResourceChange" );
+    CCoeControl::HandleResourceChange( aType );
+    
+    TRAP_IGNORE(
+        if ( aType == KAknsMessageSkinChange )
+            {
+            delete iIconArray;
+            iIconArray = NULL;
+            CreateIconArrayL();          
+            static_cast<CEikColumnListBox*>( iListBox )->ItemDrawer()->ColumnData()->
+                SetIconArray( iIconArray );
+            }
+        else if ( aType == KEikDynamicLayoutVariantSwitch && iView )
+            {                        
+            iView->ProcessCommandL( EMPXCmdCommonResourceChange );
+            } );    
+    }
+
+// ---------------------------------------------------------------------------
+// Create list box
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::CreateListBoxL()
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::CreateListBox" );
+    
+    iListBox = new ( ELeave ) CAknSingleGraphicStyleListBox();    
+    iListBox->SetContainerWindowL( *this ); 
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( 
+        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+
+    TResourceReader reader;
+    iCoeEnv->CreateResourceReaderLC( reader, R_MPX_COMMON_CONTAINER_LBX );
+    // construct's iListBox from resource file
+    iListBox->ConstructFromResourceL( reader );
+    CleanupStack::PopAndDestroy(); // reader
+    
+    // Enable Marquee
+    CEikColumnListBox* eikListbox = static_cast<CEikColumnListBox*>( iListBox );
+    eikListbox->EnableExtendedDrawingL();
+    eikListbox->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+    eikListbox->ItemDrawer()->ColumnData()->SetMarqueeParams(
+        KMaxTInt, 6, 1000000); // Magic: loop forever, other params as default
+
+    iListBox->SetListBoxObserver( iListBoxObserver );
+
+    // Speed Scrolling
+    delete iLbxExtFeat;
+    iLbxExtFeat = NULL;
+    iLbxExtFeat = CMPXLbxExtendedFeatures::NewL( iListBox, ETrue );
+    iLbxExtFeat->EnableSpeedScrollL( ETrue );
+    
+    }
+
+// -----------------------------------------------------------------------------
+// Constructs Find box.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::ConstructFindBoxL( TBool aIsFindPopup )
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::ConstructFindBoxL" );
+    CAknFilteredTextListBoxModel* lbxModel = 
+        static_cast<CAknFilteredTextListBoxModel*>( iListBox->Model() );
+
+    iIsFindPopup = aIsFindPopup;
+
+    CAknSearchField::TSearchFieldStyle flag( 
+        iIsFindPopup ? CAknSearchField::EPopup : CAknSearchField::ESearch );
+
+    iFindBox = CAknSearchField::NewL( 
+        *this, flag, NULL, KMPXFindboxTextLimit );
+    lbxModel->CreateFilterL( iListBox, iFindBox );
+    iFindBoxFilterItems = lbxModel->Filter();
+
+    // Limit Japanese input modes
+    if ( FeatureManager::FeatureSupported( KFeatureIdJapanese ) )
+        {
+        CEikEdwin& findEditor = iFindBox->Editor();
+       
+        findEditor.SetAknEditorInputMode( EAknEditorKatakanaInputMode );
+       
+        findEditor.SetAknEditorAllowedInputModes(
+            EAknEditorKatakanaInputMode |
+            EAknEditorHalfWidthTextInputMode |
+            EAknEditorNumericInputMode );
+        }
+
+    if ( iIsFindPopup )
+        {
+        SetFindBoxVisibilityL( EFalse );
+        }
+
+    }
+
+// -----------------------------------------------------------------------------
+// Creates icon array, populates iIconArray to be used by listbox
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerAvkonImp::CreateIconArrayL()
+    {
+    if ( iListBoxArray )
+        {
+        iIconArray = iListBoxArray->CreateIconArrayL();
+        }
+    }   
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainerfilteredlist.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,261 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class for providing list filtering.
+*
+*/
+
+
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include "mpxcommoncontainerfilteredlist.h"
+
+// CONSTANTS
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CMPXCommonContainerFilteredList* CMPXCommonContainerFilteredList::NewL()
+    {
+    CMPXCommonContainerFilteredList* self =
+        CMPXCommonContainerFilteredList::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CMPXCommonContainerFilteredList* CMPXCommonContainerFilteredList::NewLC()
+    {
+    CMPXCommonContainerFilteredList* self =
+        new (ELeave) CMPXCommonContainerFilteredList();
+    CleanupStack::PushL( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CMPXCommonContainerFilteredList::CMPXCommonContainerFilteredList()
+ :  iFiltering( EFalse )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+CMPXCommonContainerFilteredList::~CMPXCommonContainerFilteredList()
+    {
+    iFilteredMediaList.Reset();
+    delete iFilteringWord;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerFilteredList::ReplaceMediaListL( const CMPXMediaArray& aMediaList )
+    {
+    iMediaList = const_cast<CMPXMediaArray*>(&aMediaList);
+
+    if ( iFiltering )
+        {
+        HBufC* tempWord = iFilteringWord;
+        CleanupStack::PushL( tempWord );
+        iFilteringWord = NULL;
+
+        ReAdjustFilteringL( *tempWord );
+
+        CleanupStack::PopAndDestroy( tempWord );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerFilteredList::SetFilteringWordL( const TDesC& aWord )
+    {
+    if ( aWord.Length() > 0 )
+        {
+        if ( HasMediaList() )
+            {
+            ReAdjustFilteringL( aWord );
+            iFiltering = ETrue;
+            }
+        }
+    else
+        {
+        iFilteredMediaList.Reset();
+        delete iFilteringWord;
+        iFilteringWord = NULL;
+        iFiltering = EFalse;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCommonContainerFilteredList::IsFiltering()
+    {
+    return iFiltering;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCommonContainerFilteredList::HasMediaList()
+    {
+    return iMediaList != NULL;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerFilteredList::FilteredCount()
+    {
+    if ( HasMediaList() )
+        {
+        if ( iFiltering )
+            {
+            return iFilteredMediaList.Count();
+            }
+        else
+            {
+            return iMediaList->Count();
+            }
+        }
+
+    return 0;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCommonContainerFilteredList::IsFilteredIndexValid( TInt aFilteredIndex )
+    {
+    if ( HasMediaList() && aFilteredIndex >= 0 )
+        {
+        if ( iFiltering )
+            {
+            if ( aFilteredIndex < iFilteredMediaList.Count() )
+                {
+                return ETrue;
+                }
+            }
+        else
+            {
+            if ( aFilteredIndex < iMediaList->Count() )
+                {
+                return ETrue;
+                }
+            }
+        }
+
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerFilteredList::FilteredIndexToRealIndex( TInt aFilteredIndex )
+    {
+    TInt realIndex( KErrNotFound );
+
+    if ( HasMediaList() )
+        {
+        if ( iFiltering )
+            {
+            if ( aFilteredIndex < iFilteredMediaList.Count() )
+                {
+                realIndex = iFilteredMediaList[aFilteredIndex];
+                }
+            }
+        else
+            {
+            if ( aFilteredIndex < iMediaList->Count() )
+                {
+                realIndex = aFilteredIndex;
+                }
+            }
+        }
+
+    return realIndex;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerFilteredList::ReAdjustFilteringL( const TDesC& aWord )
+    {
+    CMPXMedia* media = NULL;
+
+    // If user added more letters to filtering, update from existing set.
+    if ( iFilteringWord &&
+         iFilteringWord->Length() < aWord.Length() )
+        {
+        TInt ri( KErrNotFound );
+
+        for ( TInt fi = 0; fi < iFilteredMediaList.Count(); fi++ )
+            {
+            ri = iFilteredMediaList[fi];
+            if ( ri < iMediaList->Count() )
+                {
+                media = (*iMediaList)[ri];
+
+                if ( media->IsSupported( KMPXMediaGeneralTitle ) )
+                    {
+                    if ( media->ValueText( KMPXMediaGeneralTitle ).FindF( aWord ) == KErrNotFound )
+                        {
+                        iFilteredMediaList.Remove( fi );
+                        fi--;
+                        }
+                    }
+                }
+            }
+        }
+    // If there is no filtering, or user removed letters, create a new filtering set.
+    else
+        {
+        iFilteredMediaList.Reset();
+
+        for ( TInt ri = 0; ri < iMediaList->Count(); ri++ )
+            {
+            media = (*iMediaList)[ri];
+
+            if ( media->IsSupported( KMPXMediaGeneralTitle ) )
+                {
+                if ( media->ValueText( KMPXMediaGeneralTitle ).FindF( aWord ) != KErrNotFound )
+                    {
+                    iFilteredMediaList.AppendL( ri );
+                    }
+                }
+            }
+        }
+
+    delete iFilteringWord;
+    iFilteringWord = NULL;
+    iFilteringWord = aWord.AllocL();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainerhgimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2659 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Application UI class required by AVKON application architecture.
+*
+*/
+
+// INCLUDE FILES
+#include <barsread.h>
+#include <StringLoader.h>
+#include <AknIconArray.h>
+#include <gulicon.h>
+#include <featmgr.h>
+#include <aknsfld.h>
+#include <AknUtils.h>
+#include <aknlists.h>
+#include <aknconsts.h>
+#include <avkon.mbg>
+#include <eikclbd.h>
+#include <eikcmobs.h>
+#include <bautils.h>
+#include <AknsBasicBackgroundControlContext.h>
+#include <s32file.h>
+
+#include <ganes/HgDoubleGraphicList.h>
+#include <ganes/HgSingleGraphicList.h>
+#include <ganes/HgItem.h>
+#include <ganes/HgScrollerWithTitle.h>
+
+#include <data_caging_path_literals.hrh>
+#include <mpxlog.h>
+#include <mpxuser.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxcommonuihelper.h>
+#include <mpxpodcastdefs.h>
+
+#include <mpxcommoncontainer.rsg>
+#include <mpxcollectionview.rsg>
+
+#include "mpxcommonlistboxarraybase.h"
+#include "mpxcommoncontainermediahelper.h"
+#include "mpxcommoncontainertexturemanager2.h"
+#include "mpxcommoncontainerhgimp.h"
+#include "mpxcommoncontainer.hrh"
+
+#include <thumbnaildata.h>
+#include <thumbnailobjectsource.h>
+#include <aknview.h>
+
+
+// CONSTANTS
+_LIT( KMPXCommonContainerRscPath, "mpxcommoncontainer.rsc" );
+
+const TInt KMPXListSelectionCount = 5;
+const TInt KMPXMinSecSeparatorIndex = 2;
+const TInt KOneHourInSeconds = 3600;
+const TInt KMPXTimeIndicatorLength = 16;
+const TInt KMPXListBufferSize = 400;
+const TInt KMPXMaxFileLength = 256;
+const TReal KIconFactor = 0.7;
+const int KMaxThumbnailReq = 100;
+
+_LIT( KMPXDash, " - " );
+#ifdef HG_MP_LOC_AVAILABLE
+_LIT( KMPXSpace, " ");
+#endif //HG_MP_LOC_AVAILABLE
+_LIT( KMPXZeroDurationMark, "--");
+//_LIT( KMPXAlbumMimeType, "image/jpeg" );
+_LIT( KMPXAlbumMimeType, "audio/mpeg3" );
+
+//#ifndef HG_MP_LOC_AVAILABLE
+_LIT( KUnknown, "Unknown" );
+_LIT( KSong, " song" );
+_LIT( KSongs, " songs" );
+_LIT( KEpisode, " episode" );
+_LIT( KEpisodes, " episodes" );
+_LIT( KAlbum, " album" );
+_LIT( KAlbums, " albums" );
+_LIT( KSongDash, " song - " );
+_LIT( KSongsDash, " songs - " );
+//#endif //HG_MP_LOC_AVAILABLE
+
+_LIT( KMPXDriveC, "c:" );
+_LIT( KMPXSelectedAlbumItemFileName, "mpxalbumitem.dat");
+
+#define DSA_PARAM NULL
+//#define DSA_PARAM &iEikonEnv->WsSession()
+
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXCommonContainerHgImp::CMPXCommonContainerHgImp() :
+    iContext( EContextUnknown ),
+    iTopIndex( 0 ),
+    iBottomIndex( KErrNotFound ),
+    iCurrentDefaultIcon( EMPXDefaultIconNotSet ),
+    iRequestCount( 0 ),
+    iAlbumArtRequest(NULL),
+    iRequestQueue(_FOFF( TAlbumArtRequest, iLink )),
+    iQueueCounter(0)
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCommonContainerHgImp::~CMPXCommonContainerHgImp()
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::~CMPXCommonContainerHgImp" );
+
+    delete iEpisodeTitle;
+    delete iSongTitle;
+    delete iAlbumTitle;
+
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+    delete iListSelections;
+    delete iListBoxArray;
+    delete iIconArray;
+    if ( iScrollerWithTitle )
+        {
+//	    delete iListWidget;
+        delete iScrollerWithTitle;
+        if ( iPrevListWidget )
+            {
+	        delete iPrevListWidget;
+            }
+        }
+    else
+        {
+	    delete iListWidget;
+	    }
+ ///   delete iTextureManager;
+    delete iCommonUiHelper;
+    CancelTNRequest();
+    iThumbnailReqHashMap.Close();
+    iThumbnailReqMap.Close();
+    delete iThumbnailManager;
+    delete iBgContext;
+    delete iSelectedMediaInAlbumView;
+    CleanAlbumArtReqQueue();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Return Coe Control
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CMPXCommonContainerHgImp::CoeControl()
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::CoeControl" );
+    return this;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Set View Container
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetViewContainer(
+    MMPXViewContainer* aViewContainer )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetViewContainer" );
+    iViewContainer = aViewContainer;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Set command observer for the container
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetCommandObserver(
+    MEikCommandObserver* aCommandObserver )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetCommandObserver" );
+    iView = aCommandObserver;
+    }
+
+
+// ---------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetListBoxObserver(
+    MEikListBoxObserver* aListBoxObserver )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetListBoxObserver" );
+    iListBoxObserver = aListBoxObserver;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::UpdateLayout()
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::UpdateLayout" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// Returns a pointer to the listboxarray
+// -----------------------------------------------------------------------------
+//
+CMPXCommonListBoxArrayBase* CMPXCommonContainerHgImp::ListBoxArray() const
+    {
+    return iListBoxArray;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Sets listbox array
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetListBoxArrayL(
+    CMPXCommonListBoxArrayBase* aListBoxArray )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetListBoxArrayL" );
+    iListBoxArray = aListBoxArray;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Return number of listbox items shown in the current listbox.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHgImp::CurrentListItemCount() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::CurrentListItemCount" );
+    TInt count = 0;
+    if ( iListWidget )
+        {
+        count = iListWidget->ItemCount();
+        }
+    return count;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Return total number of listbox items in the listbox.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHgImp::TotalListItemCount() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::TotalListItemCount" );
+    TInt count = 0;
+    if ( iListBoxArray )
+        {
+        count = iListBoxArray->MediaArray().Count();
+        }
+    return count;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Gets top listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHgImp::TopLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::TopLbxItemIndex" );
+    return iTopIndex;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Gets bottom listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHgImp::BottomLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::BottomLbxItemIndex" );
+    return iBottomIndex;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Gets current listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHgImp::CurrentLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::CurrentLbxItemIndex" );
+	TInt index( KErrNotFound );
+    if ( iListWidget )
+		{
+		const TInt count = CurrentListItemCount();
+		if ( count > 0 )
+			{
+			index = iListWidget->SelectedIndex();
+			}
+		}
+    return index;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Get current selected listbox items indices (relative to the original listbox)
+// -----------------------------------------------------------------------------
+//
+const CArrayFix<TInt>* CMPXCommonContainerHgImp::CurrentSelectionIndicesL() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::CurrentSelectionIndicesL" );
+    if ( iListWidget )
+		{
+		iListSelections->Reset();
+		RArray<TInt> selectionArray;
+        CleanupClosePushL( selectionArray );
+		iListWidget->GetMarkedItemsL(selectionArray);
+		int count = selectionArray.Count();
+		for( int i = 0; i < count; i++ )
+			{
+			iListSelections->AppendL( selectionArray[i] );
+			}
+        CleanupStack::PopAndDestroy( &selectionArray );
+		}
+    return iListSelections;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set current selected listbox items indices (relative to the original listbox)
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetCurrentSelectionIndicesL(
+    CArrayFix<TInt>* aIndices ) const
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetCurrentSelectionIndicesL" );
+    TInt count = aIndices->Count();
+    if ( count > 0 && iListWidget )
+        {
+        for( TInt i = 0; i < count; i++ )
+            {
+            iListWidget->Mark( (*aIndices)[i] );
+            }
+        iListWidget->RefreshScreen( (*aIndices)[0] );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set top listbox item index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetLbxTopItemIndex( TInt /*aIndex*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetLbxTopItemIndex" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set current listbox item index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetLbxCurrentItemIndex( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetLbxCurrentItemIndex" );
+    if ( iListWidget )
+        {
+        iListWidget->SetSelectedIndex( aIndex );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set current listbox item index and highlight it.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetLbxCurrentItemIndexAndDraw(
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetLbxCurrentItemIndexAndDraw" );
+	SetLbxCurrentItemIndex(aIndex);
+    }
+
+
+// -----------------------------------------------------------------------------
+// Clear listbox selection.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::ClearLbxSelection()
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::ClearLbxSelection" );
+    if ( iListWidget )
+        {
+        iListWidget->UnMarkAll();
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Sets the text for an empty list box
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetLbxEmptyTextL( const TDesC& aText )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetLbxEmptyTextL" );
+
+    if ( iListWidget && aText != KNullDesC )
+        {
+        iListWidget->SetEmptyTextL( aText );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Draws a list box item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::DrawLbxItem( TInt aIndex )
+    {
+    MPX_DEBUG2( "CMPXCommonContainerHgImp::DrawLbxItem (aIndex=%d)", aIndex );
+    if ( iListWidget && iBottomIndex > 0 )
+        {
+        CHgItem* item = &iListWidget->ItemL(aIndex);
+        SetDetailIndicatorL(item, aIndex);
+        iListWidget->RefreshScreen(aIndex);
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set Find box's focus.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetFindBoxFocus( TBool /*aFocus*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetFindBoxFocus" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// Handle listbox item addition.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::HandleLbxItemAdditionL()
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::HandleLbxItemAdditionL" );
+    SetCollectionContextL();
+    iLastValidMediaItemIndex = 0;
+    if ( iListWidget )
+        {
+        const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+        const TInt count( mediaArray.Count() );
+        MPX_DEBUG2( "CMPXCommonContainerHgImp::HandleLbxItemAdditionL count=%d", count);
+        HandleLbxItemRemovalL();
+
+		iThumbnailReqMap.Reset();
+		for ( TInt i = 0; i < count; i++ )
+			{
+    		iThumbnailReqMap.Append( EFalse );
+			}
+
+        if ( iContext == EContextItemAlbum && iContext != iPrevContext )
+            {
+            // Save previous list so won't cause flickering when back.
+            // If album view comes back again, we don't want to delete
+            // title_list so skip this block for the same album track view.
+            //iListWidget->SetFlags( CHgScroller::EHgScrollerScreenFreeze );
+            iListWidget->Reset();
+            iListWidget->SetFocus(EFalse);
+            // this is needed to make list passive when we switch to list with title
+            iListWidget->DisableScrollBuffer();
+            iPrevListWidget = iListWidget;
+            iListWidget = NULL;
+            CreateListBoxWithTitleL( count );
+            ProvideDataWithoutThumbnailsL(mediaArray);
+            iListWidget->SetFocus(ETrue);
+            }
+        else
+            {
+            if ( iScrollerWithTitle && iContext != EContextItemAlbum )
+                {
+                // Delete title_list when you are not in album_track view
+                delete iScrollerWithTitle;
+                iScrollerWithTitle = NULL;
+                iListWidget = iPrevListWidget;
+                // this is needed to make list active when we switch from list with title
+                iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
+                iListWidget->Reset();
+                iListWidget->SetFocus(ETrue);
+           	    iListWidget->ResizeL( count );
+                ProvideDataWithoutThumbnailsL(mediaArray);
+                }
+            else
+                {
+				TInt index = iListWidget->SelectedIndex();
+        	    iListWidget->Reset();
+            	if ( count )
+            	    {
+            	    iListWidget->ResizeL( count );
+            	    ProvideDataWithoutThumbnailsL(mediaArray);
+                    iListWidget->SetSelectedIndex( index );
+            	    }
+            	else
+            	    {
+            	    iListWidget->RefreshScreen(0);
+            	    }
+            	}
+    	    }
+        SetDefaultIconL();
+	    SetScrollbarType();
+    	}
+    }
+
+
+// -----------------------------------------------------------------------------
+// Handle listbox item addition, preserving the current display index
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::HandleLbxItemAdditionPreserveIndexL()
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::HandleLbxItemAdditionPreserveIndexL" );
+    HandleLbxItemAdditionL();
+    }
+
+
+// -----------------------------------------------------------------------------
+// Handle listbox item removal.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::HandleLbxItemRemovalL()
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::HandleLbxItemRemovalL" );
+    iTopIndex = 0;
+    iBottomIndex = KErrNotFound;
+    if ( iContext != iPrevContext )
+        {
+        CancelTNRequest();
+        iThumbnailReqHashMap.Close();
+        iThumbnailReqMap.Close();
+        CleanAlbumArtReqQueue();
+        iRequestCount = 0;
+
+	    }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Show/hide find box.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetFindBoxVisibilityL( TBool /*aIsVisible*/ )
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// Determine find box visibility
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCommonContainerHgImp::FindBoxVisibility()
+    {
+    return EFalse;
+    }
+
+
+// -----------------------------------------------------------------------------
+// Restore the PopupCBA of find box
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::RestoreFindBoxPopupCBA()
+    {
+    }
+
+
+// -----------------------------------------------------------------------------
+// Calculate the top index of the visible items
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHgImp::CalculateTopIndex( TInt /*aBottomIndex*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::CalculateTopIndex" );
+    return 0;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::ConstructContainerL( TMPXCommonContainerCollectionType /*aCollectionType*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::ConstructContainerL" );
+
+
+    CCoeEnv* coeEnv( iEikonEnv );
+    TParse parse;
+    parse.Set( KMPXCommonContainerRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+#ifdef HG_MP_LOC_AVAILABLE
+    iAlbumTitle = StringLoader::LoadL( R_MPX_COMMONCONTAINER_DETAILS_ONE_ALBUM );
+    iEpisodeTitle = StringLoader::LoadL( R_MPX_COMMONCONTAINER_DETAILS_ONE_EPISODE );
+    iSongTitle = StringLoader::LoadL( R_MPX_COMMONCONTAINER_DETAILS_ONE_SONG );
+#endif //HG_MP_LOC_AVAILABLE
+
+
+    CreateWindowL();
+    TRect mainPane( 0,0,0,0 );
+    iBgContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgScreen, mainPane, ETrue);
+    iBgContext->SetRect(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
+
+    // Common methods used for 2-line list support
+    iCommonUiHelper = CMPXCommonUiHelper::NewL();
+    iListSelections = new (ELeave) CArrayFixFlat<TInt>( KMPXListSelectionCount );
+  ////  iTextureManager = new (ELeave) CMPXCommonContainerTextureManager2();
+
+    //Album art request queue
+    //iRequestQueue = new TSglQue<TAlbumArtRequest>(_FOFF(TAlbumArtRequest, iLink));
+    iThumbnailManager = CThumbnailManager::NewL( *this );
+    iThumbnailManager->SetFlagsL( CThumbnailManager::EDefaultFlags );
+    iThumbnailManager->SetQualityPreferenceL( CThumbnailManager::EOptimizeForQuality );
+    iThumbnailManager->SetThumbnailSizeL( EAudioListThumbnailSize );
+
+    iImageSize = CHgDoubleGraphicList::PreferredImageSize();
+
+    TFileName pathWithoutDrive;
+    iEikonEnv->FsSession().PrivatePath( pathWithoutDrive );
+    iSelectedAlbumItemFileName.Copy( KMPXDriveC );
+    iSelectedAlbumItemFileName.Append( pathWithoutDrive );
+    iSelectedAlbumItemFileName.Append( KMPXSelectedAlbumItemFileName );
+
+
+    CreateListBoxL( 0 );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Enable/disable find box
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::EnableFindBox( TBool /*aEnable*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::EnableFindBox" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Enable/disable marking
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::EnableMarking( TBool /*aEnable*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::EnableMarking" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Custom handling of commands for markable lists.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::HandleMarkableListProcessCommandL(
+    TInt aCommand )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::HandleMarkableListProcessCommandL" );
+
+	if ( iListWidget )
+		{
+		switch ( aCommand )
+			{
+			case EAknCmdMark:
+				iListWidget->Mark(iListWidget->SelectedIndex());
+				break;
+			case EAknCmdUnmark:
+				iListWidget->UnMark(iListWidget->SelectedIndex());
+			    break;
+			case EAknMarkAll:
+				iListWidget->MarkAll();
+				break;
+			case EAknUnmarkAll:
+				iListWidget->UnMarkAll();
+				break;
+			}
+        iListWidget->RefreshScreen(iListWidget->SelectedIndex());
+		}
+    }
+
+
+// ---------------------------------------------------------------------------
+// Custom handling of menu pane for markable lists
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::HandleMarkableListDynInitMenuPane(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::HandleMarkableListDynInitMenuPane" );
+
+    if ( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST )
+        {
+        TInt currentItem = CurrentLbxItemIndex();
+        if ( currentItem == KErrNotFound )
+            {
+            aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue );
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EAknCmdEditListMenu, EFalse );
+            }
+        }
+    else if ( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION )
+        {
+        CurrentSelectionIndicesL();
+        TInt currentItem = CurrentLbxItemIndex();
+        if ( currentItem != KErrNotFound )
+            {
+            TBool currentItemMarked = EFalse;
+            for( int i = 0; i < iListSelections->Count(); i++ )
+                {
+                if ( currentItem == iListSelections->At(i) )
+                    {
+                    currentItemMarked = ETrue;
+                    break;
+                    }
+                }
+
+            aMenuPane->SetItemDimmed( EAknCmdMark, currentItemMarked );
+            aMenuPane->SetItemDimmed( EAknCmdUnmark, !currentItemMarked );
+            aMenuPane->SetItemDimmed( EAknMarkAll, iListSelections->Count() == iListWidget->ItemCount() );
+            aMenuPane->SetItemDimmed( EAknUnmarkAll, iListSelections->Count() == 0 );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXCommonContainerHgImp::HandleKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG5( "CMPXCommonContainerHgImp::HandleKeyEventL(iCode=%d, iScanCode=%d, iModifiers=0x%x, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iModifiers, aType );
+
+    TKeyResponse response( EKeyWasNotConsumed );
+    if ( aKeyEvent.iCode == EKeyOK || aKeyEvent.iCode == EKeyEnter )
+        {
+        if( CurrentLbxItemIndex() >= 0 )
+            {
+            SaveSelectedAlbumItemL();
+            }
+        // Handle enter key pressed
+        iView->ProcessCommandL( EMPXCmdCommonEnterKey );
+        }
+    if ( iListWidget )
+        {
+        iListWidget->OfferKeyEventL( aKeyEvent, aType );
+        }
+
+    if ( response == EKeyWasNotConsumed &&
+         aType == EEventKey &&
+         aKeyEvent.iCode == EKeyBackspace && iView )
+        {
+        iView->ProcessCommandL( EMPXCmdCommonDelete );
+        response = EKeyWasConsumed;
+        }
+
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// Activate container
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::ActivateContainerL()
+    {
+    // Nothing to do
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MMPXCommonListBoxArrayObserver
+// Handle listbox array events.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::HandleListBoxArrayEventL(
+    MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::HandleListBoxArrayEventL" );
+    if ( aEvent == MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventIconArrayChange )
+        {
+        delete iIconArray;
+        iIconArray = NULL;
+        CreateIconArrayL();
+        }
+    else if ( aEvent == MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventMediaArrayChange )
+        {
+
+		// Update list widget with new items in the media array.
+        // We start the update from last valid media item index.
+		if ( iListWidget )
+			{
+			ProvideDataWithoutThumbnailsL(iListBoxArray->MediaArray(), iLastValidMediaItemIndex);
+
+            if ( ( iLastValidMediaItemIndex >= iRequestStart )
+                 && ( iLastValidMediaItemIndex >= iRequestEnd )
+                 && ( iRequestStart != iRequestEnd ) )
+                {
+                Request( iRequestStart, iRequestEnd, EHgBufferReset );
+                }
+
+			iListWidget->RefreshScreen(iListWidget->FirstIndexOnScreen());
+			}
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXCommonContainerHgImp::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    ASSERT( iViewContainer );
+    MPX_DEBUG5( "CMPXCommonContainerHgImp::OfferKeyEventL(iCode=%d, iScanCode=%d, iModifiers=0x%x, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iModifiers, aType );
+
+	// Let the view container handle the key event.
+	return iViewContainer->HandleKeyEventL( aKeyEvent, aType );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    ASSERT( iViewContainer );
+    MPX_FUNC( "CMPXCommonContainerHgImp::GetHelpContext" );
+    // Let the view container handle the help context retrieval
+    if ( iViewContainer )
+        {
+        iViewContainer->HandleHelpContext( aContext );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::HandleResourceChange( TInt aType )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::HandleResourceChange" );
+    CCoeControl::HandleResourceChange( aType );
+
+    TRAP_IGNORE(
+        if ( aType == KAknsMessageSkinChange )
+            {
+            iListWidget->SetDefaultIconL(NULL);
+            delete iIconArray;
+            iIconArray = NULL;
+            CreateIconArrayL();
+			iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
+            }
+        else if ( aType == KEikDynamicLayoutVariantSwitch )
+            {
+            TRect clientRect = ((CAknView*)iView)->ClientRect();
+            iBgContext->SetRect(CEikonEnv::Static()->EikAppUi()->ApplicationRect());
+            if ( iScrollerWithTitle )
+                {
+            	iScrollerWithTitle->InitScreenL(clientRect);
+            	iPrevListWidget->InitScreenL(clientRect);
+                }
+            else
+                {
+            	iListWidget->InitScreenL(clientRect);
+                }
+            SetScrollbarType();
+            }
+        );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Draw this application's view to the screen
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::Draw(const TRect& /*aRect*/) const
+    {
+    // Do nothing so that list model will be drawn by hg list
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MCoeControlObserver
+// Handle control event
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::HandleControlEventL(
+    CCoeControl* /*aControl*/,
+    TCoeEvent /*aEventType*/ )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Provide control input capabilities
+// ---------------------------------------------------------------------------
+//
+TCoeInputCapabilities CMPXCommonContainerHgImp::InputCapabilities() const
+	{
+	if( iListWidget )
+		{
+		return iListWidget->InputCapabilities();
+		}
+	return CCoeControl::InputCapabilities();
+	}
+
+
+// ---------------------------------------------------------------------------
+// From MHgSelectionObserver
+// Handle Item Selection
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::HandleSelectL( TInt /*aIndex*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::HandleSelect" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MHgSelectionObserver
+// Handle Item opened
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::HandleOpenL( TInt /*aIndex*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::HandleOpenL" );
+
+    SaveSelectedAlbumItemL();
+	iView->ProcessCommandL( EMPXCmdCommonEnterKey );
+    }
+
+
+// -----------------------------------------------------------------------------
+// Provides the data to the model
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::Request(
+	TInt aBufferStart,
+	TInt aBufferEnd,
+	THgScrollDirection aDirection )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::Request" );
+   	MPX_DEBUG3( "CMPXCommonContainerHgImp::Request aBufferStart = %d, aBufferEnd = %d",
+            aBufferStart, aBufferEnd );
+
+	// This should not happen but if not handled, bad things will happen.
+	if ( aBufferStart < 0 || aBufferEnd < 0 )
+   	    return;
+
+  
+  
+    //iBottomIndex = aBufferEnd;
+
+    if ( aBufferStart > iLastValidMediaItemIndex || aBufferEnd > iLastValidMediaItemIndex )
+		{
+		// We cannot provide data for the requested range at this time.
+		// Remember the request so we can handle it when there's enough data.
+		iRequestStart = aBufferStart;
+    	iRequestEnd = aBufferEnd;
+    	return;
+		}
+    iDirection = aDirection;
+
+    for ( TInt i = aBufferStart; i <= aBufferEnd; i++ )
+        {
+        iThumbnailReqMap[ i ] = EFalse;
+        }
+
+
+    if ( aDirection == EHgBufferReset  || aDirection == EHgBufferScrollDown || aDirection == EHgBufferScrollUp)
+        {
+        // For index range in visible-area
+        ProvideDataIntersectL(aBufferStart, aBufferEnd);
+        // For index range elsewhere
+        ProvideDataDifferenceL(aBufferStart, aBufferEnd);
+       }
+    else
+        {
+        ProvideDataL(aBufferStart, aBufferEnd);
+        }
+
+	//RefreshL(aBufferStart);
+    // When in main collection view, list can be refresh
+    // without waiting on thumbnails since this list doesn't
+    // require thumbnails.
+    if ( iContext == EContextGroupCollection ||
+         iContext == EContextGroupPlaylist ||
+         iContext == EContextGroupGenre ||
+         iContext == EContextGroupComposer )
+        {
+        iListWidget->RefreshScreen( aBufferStart );
+        }
+    iTopIndex = aBufferStart;
+    iBottomIndex = aBufferEnd;    
+    }
+
+// -----------------------------------------------------------------------------
+// Check if request range also covers the visible area and provide data
+// to it first.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::ProvideDataIntersectL(
+	TInt aBufferStart,
+	TInt aBufferEnd )
+    {
+    TInt firstOnScreen = iListWidget->FirstIndexOnScreen();
+    TInt lastOnScreen = firstOnScreen + iListWidget->ItemsOnScreen();
+
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+
+    for ( TInt i = firstOnScreen; i <= lastOnScreen; i++)
+        {
+        for ( TInt j = aBufferStart; j <= aBufferEnd; j++)
+            {
+            if ( i == j )
+                {
+                // Just get the exiting item and update the fields + icon.
+                CHgItem* item = &iListWidget->ItemL(i);
+
+                CMPXMedia* currentMedia( mediaArray.AtL( i ) );
+
+                // Add detailed text to the list item, if available
+                AddDetailToDisplayedItemL( item, currentMedia, i );
+                AddThumbnailToDisplayedItemL( item, currentMedia, i );
+                break;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handles request range outside of visible area.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::ProvideDataDifferenceL(
+	TInt aBufferStart,
+	TInt aBufferEnd)
+    {
+    TBool found = EFalse;
+    TInt firstOnScreen = iListWidget->FirstIndexOnScreen();
+    TInt lastOnScreen = firstOnScreen + iListWidget->ItemsOnScreen();
+
+    if (aBufferStart == firstOnScreen && aBufferEnd == lastOnScreen)
+        return;
+
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+    for ( TInt i = aBufferStart; i <= aBufferEnd; i++)
+        {
+        found = EFalse;
+        // look for index in visible range
+        for ( TInt j = firstOnScreen; j <= lastOnScreen; j++)
+            {
+            if ( i == j )
+                {
+                found = ETrue;
+                break;
+                }
+            }
+        if (!found)
+            {
+            // Just get the exiting item and update the fields + icon.
+            CHgItem* item = &iListWidget->ItemL(i);
+
+            CMPXMedia* currentMedia( mediaArray.AtL( i ) );
+
+            // Add detailed text to the list item, if available
+            AddDetailToDisplayedItemL( item, currentMedia, i );
+            AddThumbnailToDisplayedItemL( item, currentMedia, i );
+            }
+        }
+    }
+// -----------------------------------------------------------------------------
+// CMPXCommonContainerHgImp::ProvideDataWithouThumbnailsL
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::ProvideDataWithoutThumbnailsL(
+	const CMPXMediaArray& aMediaArray,
+	TInt aStartIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::ProvideDataWithouThumbnailsL" );
+
+    for ( TInt i = aStartIndex; i < aMediaArray.Count() ; i++ )
+        {
+        CMPXMedia* currentMedia( aMediaArray.AtL( i ) );
+
+		if ( currentMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) ==
+			KMPXInvalidItemId )
+			{
+		
+			break;
+			}
+
+        // Just get the exiting item and update the fields + icon.
+        CHgItem* item = &iListWidget->ItemL(i);
+        SetTitleL( item, currentMedia );
+        AddDetailToDisplayedItemL( item, currentMedia, i );
+		iLastValidMediaItemIndex = i;
+	
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonContainerHgImp::ProvideDataL
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::ProvideDataL( TInt aStart, TInt aEnd )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::ProvideDataL" );
+   	MPX_DEBUG3( "CMPXCommonContainerHgImp::ProvideDataL aStart = %d, aEnd = %d",
+            aStart, aEnd );
+   	if ( aStart < 0 ) aStart = 0;
+   	if ( aEnd < 0 ) aEnd = 0;
+
+	const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+    for ( TInt i = aStart; i <= aEnd ; i++ )
+        {
+        // Just get the exiting item and update the fields + icon.
+        CHgItem* item = &iListWidget->ItemL(i);
+
+        CMPXMedia* currentMedia( mediaArray.AtL( i ) );
+
+        // Add detailed text to the list item, if available
+        AddDetailToDisplayedItemL( item, currentMedia, i );
+        AddThumbnailToDisplayedItemL( item, currentMedia, i );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonContainerHgImp::Release
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::Release(TInt aReleaseStart, TInt aReleaseEnd)
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::Release" );
+
+    TInt queuecount=0;
+
+  	if (iQueueCounter !=0)
+		{
+		for (TInt i=0; i<iQueueCounter; i++ )
+			{
+          	iAlbumArtRequest = iRequestQueue.First();
+          	iRequestQueue.Remove(*iAlbumArtRequest);
+
+          	if ( (iAlbumArtRequest->iIndex) >= aReleaseStart
+               &&  (iAlbumArtRequest->iIndex) <=aReleaseEnd )
+				{
+               	delete iAlbumArtRequest->iAlbumArtUri;  //not sure needed or not
+               	delete iAlbumArtRequest;
+               	}
+			else
+				{
+				iRequestQueue.AddLast(*iAlbumArtRequest);
+				++queuecount;
+				}
+			}
+		iQueueCounter = queuecount;
+       }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Preview thumbnail generation or loading is complete.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::ThumbnailPreviewReady(
+	MThumbnailData& /*aThumbnail*/,
+	TThumbnailRequestId /*aId*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::ThumbnailPreviewReady" );
+    // Not used
+    }
+
+
+// -----------------------------------------------------------------------------
+// Final thumbnail bitmap generation or loading is complete.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::ThumbnailReady(
+	TInt aError, MThumbnailData& aThumbnail,
+	TThumbnailRequestId aId )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::ThumbnailReady" );
+    MPX_DEBUG2( "CMPXCommonContainerHgImp::ThumbnailReady error = %d", aError);
+   
+    TInt index = 0;
+    // Find the index
+    const TInt *ret = iThumbnailReqHashMap.Find( (TInt)aId);
+     if ( ret )
+		 {
+		 index = *ret;
+		 }
+
+    if ( aError == KErrNone && ret )
+        {
+            const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+            CMPXMedia* currentMedia( mediaArray.AtL( index ) );
+            if ( currentMedia->IsSupported( KMPXMediaGeneralId ) )
+                {
+                CFbsBitmap* bmap = aThumbnail.DetachBitmap();
+                if ( bmap )
+                    {
+                    CGulIcon* icon = CGulIcon::NewL(bmap, NULL);
+
+                    if ( iScrollerWithTitle && !iTitleSet )
+                        {
+                        iScrollerWithTitle->TitleItem().SetIcon(icon);
+                        iScrollerWithTitle->MakeVisible(ETrue);
+                        iListWidget->MakeVisible( ETrue );
+
+                        iScrollerWithTitle->DrawNow();
+                        iTitleSet = ETrue;
+                        }
+                    else
+                        {
+                        iListWidget->ItemL(index).SetIcon(icon);
+                        iThumbnailReqMap[index] = ETrue;
+                        RefreshL(index);
+                        }
+                    }
+				}
+			iThumbnailReqHashMap.Remove( (TInt)aId);
+
+			// if request queue is not empty, we can send one or more requests
+			if ( !iRequestQueue.IsEmpty() )
+				{
+				iAlbumArtRequest = iRequestQueue.First();
+				iRequestQueue.Remove(*iAlbumArtRequest);
+				--iQueueCounter;
+				TInt index = iAlbumArtRequest->iIndex;
+
+				const TDesC&   albumArtUri = *(iAlbumArtRequest->iAlbumArtUri);
+
+				CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( albumArtUri, KMPXAlbumMimeType );
+
+				delete iAlbumArtRequest->iAlbumArtUri;
+				delete iAlbumArtRequest;
+				// Using negative index as priority will ensure that thumbnail requests
+				// are processed in the order they were requested.
+				TInt ret = NULL;
+				TInt reqId;
+				TRAPD(err, reqId = (TInt) iThumbnailManager->GetThumbnailL( *source, (TAny*)ret, -index ));
+				if ( err == KErrNone)
+					{
+					iThumbnailReqHashMap.InsertL( reqId, index );
+					}
+				CleanupStack::PopAndDestroy( source );
+				}
+			 else
+				{
+				//request queue is empty, decrease outstanding requests count
+			iRequestCount--;
+			}
+		}
+
+	else
+		{
+
+		 if ( ret )
+			 {
+			 index = *ret;
+			 iThumbnailReqHashMap.Remove( (TInt)aId);
+			 }
+		else
+			{
+			return;
+			}
+
+		//no albumart supported
+		SetDefaultIconL(index);
+        if ( iScrollerWithTitle && !iTitleSet )
+            {
+            iScrollerWithTitle->MakeVisible(ETrue);
+            iListWidget->MakeVisible( ETrue );
+            iScrollerWithTitle->DrawNow();
+            iTitleSet = ETrue;
+            }
+        else
+            {
+            iThumbnailReqMap[index] = ETrue;
+            RefreshL(index);
+            }
+    	}
+
+    }
+
+// ---------------------------------------------------------------------------
+// Refresh for item without thumbnail
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::RefreshNoThumbnailL(TInt aIndex)
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::RefreshNoThumbnail" );
+
+    if ( iScrollerWithTitle && !iTitleSet )
+        {
+        iScrollerWithTitle->MakeVisible(ETrue);
+        iListWidget->MakeVisible( ETrue );
+        iScrollerWithTitle->DrawNow();
+        iTitleSet = ETrue;
+        }
+    else
+        {
+        RefreshL(aIndex);
+        }
+    }
+// ---------------------------------------------------------------------------
+// Refresh list as needed.
+// This function tries to determine the best time to refresh the screen as to
+// avoid too many redraws. In some cases, multiple refresh is unavoidable.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::RefreshL(TInt aIndex)
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::Refresh" );
+
+	TInt mediaCount = iListBoxArray->MediaArray().Count();
+
+	TInt firstOnScreen = iListWidget->FirstIndexOnScreen();
+	TInt lastOnScreen = firstOnScreen + iListWidget->ItemsOnScreen();
+
+	if (lastOnScreen > (mediaCount - 1))
+		lastOnScreen = mediaCount - 1;
+
+	// Refresh screen if the item is within view and no more thumbnails expected.
+	if ( aIndex >= firstOnScreen && aIndex <= lastOnScreen )
+		{
+		TBool canRefresh(ETrue);
+		for (TInt i= firstOnScreen; i <= lastOnScreen; i++)
+			{
+			if ( !iThumbnailReqMap[i] )
+				{
+				canRefresh = EFalse;
+				break;
+				}
+			}
+		if ( canRefresh )
+		  {
+			iListWidget->RefreshScreen( firstOnScreen );
+		}
+    }
+    }
+// ---------------------------------------------------------------------------
+// Create list box
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::CreateListBoxL(TInt count)
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::CreateListBox" );
+
+    TRect clientRect = ((CAknView*)iView)->ClientRect();
+    iListWidget = CHgDoubleGraphicList::NewL (
+    		clientRect,
+    		count,
+    		NULL,
+    		DSA_PARAM );
+    iListWidget->SetMopParent(this);
+    iListWidget->SetSelectionObserver(*this);
+    iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
+    iListWidget->SetFocus(ETrue);
+    iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
+    iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Create list box with Title
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::CreateListBoxWithTitleL( TInt count )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::CreateListBoxWithTitleL" );
+
+    TRect clientRect = ((CAknView*)iView)->ClientRect();
+    iScrollerWithTitle = CHgScrollerWithTitle::NewL (
+            clientRect,
+            count,
+            CHgScrollerWithTitle::EHgScrollerDoubleTextList,
+            NULL);
+
+    if ( iSelectedMediaInAlbumView )
+        {
+        delete iSelectedMediaInAlbumView;
+        iSelectedMediaInAlbumView = NULL;
+        }
+
+    iSelectedMediaInAlbumView = CMPXMedia::NewL();
+
+    ReadFromStreamFileL( iSelectedMediaInAlbumView );
+
+    CHgItem *item = &iScrollerWithTitle->TitleItem();
+    SetDetailAlbumL( item, iSelectedMediaInAlbumView );
+    SetDetailArtistL( item, iSelectedMediaInAlbumView );
+    SetDetailIconL( item, 1 );
+
+
+    iTitleSet = EFalse;
+
+    iScrollerWithTitle->SetMopParent(this);
+    iScrollerWithTitle->SetFocus(ETrue);
+    iScrollerWithTitle->InitScreenL( clientRect );
+    iScrollerWithTitle->MakeVisible(EFalse);
+
+    iListWidget = &iScrollerWithTitle->Scroller();
+    iListWidget->SetSelectionObserver(*this);
+    iListWidget->EnableScrollBufferL(*this, KMPXListBufferSize, KMPXListBufferSize/4);
+    iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
+    iListWidget->MakeVisible(EFalse);
+    }
+
+
+// -----------------------------------------------------------------------------
+// Creates icon array, populates iIconArray to be used by listbox
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::CreateIconArrayL()
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::CreateIconArrayL" );
+    if ( iListBoxArray )
+        {
+        iIconArray = iListBoxArray->CreateIconArrayL();
+        }
+    SetDefaultIconL();
+    }
+// -----------------------------------------------------------------------------
+// Sets default icon to the HgList
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetDefaultIconL()
+	{
+
+	TDefaultIcon defaultIcon( EMPXDefaultIconEmpty );
+	TInt iconIndex( EMPXClvIconEmpty );
+
+	switch( iContext )
+		{
+		case EContextGroupArtist:
+		case EContextItemArtist:
+		case EContextGroupAlbum:
+			{
+			break;
+			}
+		case EContextGroupPodcast:
+		case EContextItemPodcast:
+			{
+			defaultIcon = EMPXDefaultTitleIconPodcasts;
+			iconIndex = EMPXPodClvIconTitle; // Podcast default icon
+			break;
+			}
+		case EContextGroupPlaylist:
+			{
+			defaultIcon = EMPXDefaultIconPlaylist;
+			iconIndex = EMPXClvIconPlaylist;
+			break;
+			}
+		case EContextGroupGenre:
+			{
+			defaultIcon = EMPXDefaultIconGenre;
+			iconIndex = EMPXClvIconGenre;
+			break;
+			}
+		case EContextGroupComposer:
+			{
+			defaultIcon = EMPXDefaultIconComposer;
+			iconIndex = EMPXClvIconComposer;
+			break;
+			}
+		case EContextItemComposer:
+		case EContextGroupSong:
+		case EContextItemSong:
+		case EContextItemPlaylist:
+		case EContextItemGenre:
+		case EContextItemAlbum:
+		case EContextGroupCollection:
+		case EContextUnknown:
+		default:
+			{
+			// no default icon for main menu items
+			break;
+			}
+		}
+
+	if ( iListWidget )
+		{
+
+		CGulIcon* icon = (*iIconArray)[iconIndex];
+    	CFbsBitmap* bitmap = icon->Bitmap();
+    	CFbsBitmap* mask = icon->Mask();
+
+     	TSize size(iImageSize.iWidth, iImageSize.iHeight);
+	    AknIconUtils::SetSize( bitmap, size );
+	    AknIconUtils::SetSize( mask, size );
+
+		CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
+		iconCopy->SetBitmapsOwnedExternally(ETrue);
+
+		iListWidget->SetDefaultIconL(iconCopy);
+		iCurrentDefaultIcon = defaultIcon;
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// Sets default icon to list item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetDefaultIconL(TInt aIndex)
+	{
+
+	TDefaultIcon defaultIcon( EMPXDefaultIconNotSet );
+	TInt iconIndex( EMPXClvIconNone );
+
+	switch( iContext )
+		{
+		case EContextGroupArtist:
+		case EContextItemArtist:
+		    {
+		    defaultIcon = EMPXDefaultIconArtist;
+		    iconIndex = EMPXClvIconArtist;
+		    break;
+		    }
+		case EContextGroupAlbum:
+			{
+			defaultIcon = EMPXDefaultIconAlbum;
+			iconIndex = EMPXClvIconAlbum;
+			break;
+			}
+		case EContextGroupPodcast:
+		case EContextItemPodcast:
+			{
+			defaultIcon = EMPXDefaultTitleIconPodcasts;
+			iconIndex = EMPXPodClvIconTitle; // Podcast default icon
+			break;
+			}
+		case EContextItemComposer:
+		case EContextGroupSong:
+		case EContextItemSong:
+		case EContextItemPlaylist:
+		case EContextItemGenre:
+		case EContextItemAlbum:
+			{
+			defaultIcon = EMPXDefaultIconSongs;
+			iconIndex = EMPXClvIconSongs;
+			break;
+			}
+		default:
+			{
+			break;
+			}
+		}
+
+	if ( iListWidget && defaultIcon != EMPXDefaultIconNotSet )
+		{
+
+
+		CGulIcon* icon = (*iIconArray)[iconIndex];
+    	CFbsBitmap* bitmap = icon->Bitmap();
+    	CFbsBitmap* mask = icon->Mask();
+
+     	TSize size(iImageSize.iWidth, iImageSize.iHeight);
+	    AknIconUtils::SetSize( bitmap, size );
+	    AknIconUtils::SetSize( mask, size );
+
+		CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
+		iconCopy->SetBitmapsOwnedExternally(ETrue);
+        iListWidget->ItemL(aIndex).SetIcon(iconCopy);
+		}
+	}
+
+
+// -----------------------------------------------------------------------------
+// Adds detail to the list item at the specified index
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::AddDetailToDisplayedItemL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia,
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::AddDetailToDisplayedItemL" );
+
+    switch ( iContext )
+        {
+        case EContextGroupCollection:
+            {
+            SetDetailIconL( aVisualItem, aIndex );
+            SetDetailCountL( aVisualItem, aMedia );
+            break;
+            }
+        case EContextGroupArtist:
+            {
+            SetDetailCountL( aVisualItem, aMedia );
+            break;
+            }
+        case EContextGroupAlbum:
+        	{
+        	SetDetailArtistL( aVisualItem, aMedia );
+            break;
+            }
+        case EContextGroupPlaylist:
+            {
+            SetDetailDurationL( aVisualItem, aMedia );
+            SetDetailIndicatorL( aVisualItem, aIndex );
+          //  SetDetailIconL( aVisualItem, EMPXDefaultIconPlaylist ); // playlist icon
+            break;
+            }
+        case EContextItemAlbum:
+            {
+            SetDetailIndicatorL( aVisualItem, aIndex );
+            break;
+            }
+        case EContextGroupSong:
+        case EContextItemPlaylist:
+        case EContextItemGenre:
+        case EContextItemComposer:
+        	{
+            SetDetailArtistL( aVisualItem, aMedia );
+            SetDetailIndicatorL( aVisualItem, aIndex );
+            break;
+            }
+        case EContextGroupPodcast:
+            {
+            SetDetailCountL( aVisualItem, aMedia );
+          //  SetDetailIconL( aVisualItem, EMPXDefaultTitleIconPodcasts );
+            break;
+            }
+        case EContextGroupGenre:
+            {
+          //  SetDetailIconL( aVisualItem, EMPXDefaultIconGenre ); //genre icon
+            SetDetailCountL( aVisualItem, aMedia );
+            break;
+            }
+        case EContextGroupComposer:
+            {
+           // SetDetailIconL( aVisualItem, EMPXDefaultIconComposer ); //composer icon
+            SetDetailCountL( aVisualItem, aMedia );
+            break;
+            }
+        case EContextItemArtist:
+        	{
+            SetDetailCountL(aVisualItem, aMedia);
+            break;
+            }
+        case EContextItemSong:
+        	{
+            SetDetailAlbumL( aVisualItem, aMedia );
+            SetDetailIndicatorL( aVisualItem, aIndex );
+            break;
+            }
+        case EContextItemPodcast:
+        	{
+            SetDetailIndicatorL( aVisualItem, aIndex );
+            break;
+            }
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// Adds thumbnail to the list item at the specified index
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::AddThumbnailToDisplayedItemL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia,
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::AddThumbnailToDisplayedItemL" );
+
+
+    switch ( iContext )
+        {
+        case EContextGroupCollection:
+             {
+
+             SetDetailIconL( aVisualItem, aIndex );
+             break;
+             }
+        case EContextGroupAlbum:
+        case EContextGroupArtist:
+        case EContextGroupSong:
+        case EContextItemPlaylist:
+        case EContextItemGenre:
+        case EContextItemComposer:
+        case EContextItemArtist:
+        case EContextItemSong:
+        case EContextItemPodcast:
+            {
+            SetDetailThumbnailL( aMedia, aIndex );
+            break;
+            }
+        case EContextItemAlbum:
+        	{
+            // This is needed for this context because we want the album art
+            // thumbnail to be in list title area.
+            SetDetailThumbnailL( iSelectedMediaInAlbumView, aIndex );
+            break;
+			}
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Set title to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetTitleL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetTitleL" );
+	if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) )
+		{
+		const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle );
+#ifdef HG_MP_LOC_AVAILABLE
+        HBufC* unknownText =
+                StringLoader::LoadLC( R_MPX_COMMONCONTAINER_UNKNOWN );
+		if ( title.Compare( KNullDesC ) != 0 )
+			{
+    		aVisualItem->SetTitleL( title );
+			}
+	    else
+	        {
+    		aVisualItem->SetTitleL( *unknownText );
+	        }
+        CleanupStack::PopAndDestroy( unknownText );
+#else //HG_MP_LOC_AVAILABLE
+		TBuf<KMPXMaxFileLength> titleText( KUnknown );
+		if ( title.Compare( KNullDesC ) != 0 )
+			{
+			titleText.Copy(title.Left(titleText.MaxLength()));
+			}
+		aVisualItem->SetTitleL( titleText );
+#endif //HG_MP_LOC_AVAILABLE
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Count to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetDetailCountL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailCountL" );
+	if ( aMedia->IsSupported( KMPXMediaGeneralCount ) )
+		{
+		TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
+
+#ifdef HG_MP_LOC_AVAILABLE
+        if ( iContext == EContextGroupPodcast )
+			{
+			if ( count > 1 )
+			    {
+                HBufC* episodesTitle = StringLoader::LoadLC( R_MPX_COMMONCONTAINER_DETAILS_NUMBER_OF_EPISODES, count );
+                TPtr ptr = episodesTitle->Des();
+                AknTextUtils::LanguageSpecificNumberConversion( ptr );
+                aVisualItem->SetTextL( ptr );
+                CleanupStack::PopAndDestroy( episodesTitle );
+			    }
+			else
+			    {
+        		aVisualItem->SetTextL( *iEpisodeTitle );
+			    }
+			}
+        else if ( iContext == EContextGroupArtist )
+			{
+			if ( count > 1 )
+			    {
+                HBufC* albumsTitle = StringLoader::LoadLC( R_MPX_COMMONCONTAINER_DETAILS_NUMBER_OF_SONGS, // mod by anjokela
+                    count );
+                TPtr ptr = albumsTitle->Des();
+                AknTextUtils::LanguageSpecificNumberConversion( ptr );
+                aVisualItem->SetTextL( ptr );
+                CleanupStack::PopAndDestroy( albumsTitle );
+			    }
+			else
+			    {
+        		aVisualItem->SetTextL( *iSongTitle ); // mod by anjokela
+			    }
+			}
+		else
+			{
+			if ( count > 1 )
+			    {
+                HBufC* songsTitle = StringLoader::LoadLC( R_MPX_COMMONCONTAINER_DETAILS_NUMBER_OF_SONGS, count );
+                TPtr ptr = songsTitle->Des();
+                AknTextUtils::LanguageSpecificNumberConversion( ptr );
+        		aVisualItem->SetTextL( ptr );
+                CleanupStack::PopAndDestroy( songsTitle );
+			    }
+			else
+			    {
+        		aVisualItem->SetTextL( *iSongTitle );
+			    }
+			}
+#else //HG_MP_LOC_AVAILABLE
+
+        TBuf<10> temp;
+        temp.AppendNum( count );
+        AknTextUtils::LanguageSpecificNumberConversion( temp );
+
+		TBuf<KMPXMaxFileLength> detailText;
+        detailText.Append( temp );
+        if ( iContext == EContextGroupPodcast )
+			{
+			detailText.Append( (count > 1 ) ? KEpisodes() : KEpisode() );
+			}
+        else if ( iContext == EContextGroupArtist )
+			{
+			detailText.Append( (count > 1 ) ? KAlbums() : KAlbum() );
+			}
+		else
+			{
+			detailText.Append( (count > 1 ) ? KSongs() : KSong() );
+			}
+		aVisualItem->SetTextL( detailText );
+#endif //HG_MP_LOC_AVAILABLE
+
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Artist to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetDetailArtistL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailArtistL" );
+	if ( aMedia->IsSupported( KMPXMediaMusicArtist ) )
+		{
+		// AK - Needs to be localized
+		TBuf<KMPXMaxFileLength> detailText;
+		const TDesC& artist = aMedia->ValueText( KMPXMediaMusicArtist );
+		if ( artist.Compare( KNullDesC ) != 0 )
+			{
+			detailText.Copy(artist.Left(detailText.MaxLength()));
+	        aVisualItem->SetTextL( detailText );
+			}
+	    else
+	        {
+            HBufC* unknownText =
+                StringLoader::LoadLC( R_MPX_COMMONCONTAINER_UNKNOWN );
+    		aVisualItem->SetTextL( *unknownText );
+            CleanupStack::PopAndDestroy( unknownText );
+            }
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Album to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetDetailAlbumL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailAlbumL" );
+	if ( aMedia->IsSupported( KMPXMediaMusicAlbum ) )
+		{
+		TBuf<KMPXMaxFileLength> detailText;
+		const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbum );
+		if ( album.Compare( KNullDesC ) != 0 )
+			{
+			detailText.Copy( album.Left(detailText.MaxLength()));
+			if ( iScrollerWithTitle )
+			    {
+    	        aVisualItem->SetTitleL( detailText );
+			    }
+			else
+			    {
+    	        aVisualItem->SetTextL( detailText );
+			    }
+			}
+	    else
+	        {
+            HBufC* unknownText =
+                StringLoader::LoadLC( R_MPX_COMMONCONTAINER_UNKNOWN );
+    		aVisualItem->SetTextL( *unknownText );
+            CleanupStack::PopAndDestroy( unknownText );
+            }
+		}
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set Detail - Count + Duration to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetDetailDurationL(
+    CHgItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailDurationL" );
+    if ( iContext == EContextGroupPlaylist &&
+         aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
+	     aMedia->IsSupported( KMPXMediaGeneralCount ) )
+		{
+		// AK - Needs to be localized
+		TBuf<KMPXMaxFileLength> detailText;
+		TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
+   		TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
+
+#ifdef HG_MP_LOC_AVAILABLE
+    	if ( count > 1 || count == 0 )
+    	    {
+            HBufC* songsTitle = StringLoader::LoadLC( R_MPX_COMMONCONTAINER_DETAILS_NUMBER_OF_SONGS, count );
+    	    detailText.Append(*songsTitle);
+    	    detailText.Append(KMPXDash);
+            UpdateTimeIndicatorsL(detailText, duration);
+    		aVisualItem->SetTextL( detailText );
+            CleanupStack::PopAndDestroy( songsTitle );
+    	    }
+    	else
+    	    {
+    	    detailText.Append(*iSongTitle);
+    	    detailText.Append(KMPXDash);
+            UpdateTimeIndicatorsL(detailText, duration);
+    		aVisualItem->SetTextL( detailText );
+    	    }
+#else //HG_MP_LOC_AVAILABLE
+		TBuf<10> temp;
+		temp.AppendNum( count );
+        AknTextUtils::LanguageSpecificNumberConversion( temp );
+        detailText.Append( temp );
+		detailText.Append( (count > 1 ) ? KSongsDash() : KSongDash() );
+        UpdateTimeIndicatorsL(detailText, duration);
+        aVisualItem->SetTextL( detailText );
+#endif //HG_MP_LOC_AVAILABLE
+		}
+    else if ( iContext == EContextItemPodcast &&
+         aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
+         aMedia->IsSupported( KMPXMediaGeneralSize ) )
+        {
+        TBuf<KMPXMaxFileLength> detailText;
+        TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
+        UpdateTimeIndicatorsL(detailText, duration);
+        detailText.Append( KMPXDash() );
+
+        TInt size( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralSize ) );
+        HBufC* sizeBuf = iCommonUiHelper->UnitConversionL( size, ETrue );
+        TPtr sizePtr( sizeBuf->Des() );
+        detailText.Append( sizePtr );
+        delete sizeBuf;
+
+        aVisualItem->SetTextL( detailText );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Format the duration to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::UpdateTimeIndicatorsL(
+    TDes& aBuf,
+    TInt aDuration )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::UpdateTimeIndicatorsL" );
+    TInt durationInSeconds = aDuration;
+    if ( durationInSeconds > 0 )
+        {
+        durationInSeconds /= 1000;   // MilliSeconds to second conversion
+        }
+    else if ( durationInSeconds < 0 )
+        {
+        durationInSeconds = 0;
+        }
+    if ( durationInSeconds == 0 )
+        {
+        TLocale locale;
+        TBuf<KMPXTimeIndicatorLength> pos;
+        TChar separator = locale.TimeSeparator( KMPXMinSecSeparatorIndex );
+        aBuf.Append(KMPXZeroDurationMark);
+        aBuf.Append( separator );
+        aBuf.Append(KMPXZeroDurationMark);
+        }
+    else
+        {
+        CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode = CMPXCommonUiHelper::EMPXDuratAuto;
+        if ( durationInSeconds > KOneHourInSeconds )
+            {
+            durationMode = CMPXCommonUiHelper::EMPXDuratHMS;
+            }
+        // Convert ellapsed time to texts
+        HBufC* position = iCommonUiHelper->DisplayableDurationL( durationInSeconds, durationMode );
+        aBuf.Append(position->Des());
+        delete position;
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set Detail - Indicator to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetDetailIndicatorL(
+    CHgItem* aVisualItem,
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailIndicatorL" );
+    // Get icon indices
+    RArray<TInt> iconIndices = iViewContainer->IndicatorsL( aIndex );
+    CleanupClosePushL( iconIndices );
+
+    const TInt iconCount = iconIndices.Count();
+    TInt flags = aVisualItem->Flags() & CHgItem::EHgItemFlagMarked;
+    aVisualItem->ClearFlags(aVisualItem->Flags());
+    if ( iconCount > 0 )
+    	{
+        TInt iconId = 0;
+		for ( TInt iconIndex = 0; iconIndex < iconCount; iconIndex++ )
+			{
+			iconId = iconIndices[iconIndex];
+			if ( !iPodcastContext )
+			    {
+                switch (iconId)
+                    {
+                    case EMPXClvIconMMC:
+                        {
+                        flags |= CHgItem::EHgItemFlagsMmc;
+                        break;
+                        }
+                    case EMPXClvIconPlay:
+                        {
+                        flags |= CHgItem::EHgItemFlagsPlaybackIndicator;
+                        break;
+                        }
+                    case EMPXClvIconPause:
+                        {
+                        flags |= CHgItem::EHgItemFlagsPauseIndicator;
+                        break;
+                        }
+                    case EMPXClvIconBrokenTrack:
+                        {
+                        flags |= CHgItem::EHgItemFlagsBrokenTrackIndicator;
+                        break;
+                        }
+                    case EMPXClvIconCorruptTrack:
+                        {
+                        flags |= CHgItem::EHgItemFlagsCorruptedTrackIndicator;
+                        break;
+                        }
+                    case EMPXClvIconDrmExpired:
+                        {
+                        flags |= CHgItem::EHgItemFlagsDrmRightsExpired;
+                        break;
+                        }
+                    case EMPXClvIconBrokenPlaylist:
+                        {
+                        flags |= CHgItem::EHgItemFlagsBrokenPlaylistIndicator;
+                        break;
+                        }
+                    case EMPXClvIconReorderDown:
+                        {
+                    	flags |= CHgItem::EHgItemFlagsMoveDownIndicator;
+                    	break;
+                        }
+                    case EMPXClvIconReorderUp:
+                        {
+                    	flags |= CHgItem::EHgItemFlagsMoveUpIndicator;
+                    	break;
+                        }
+                    case EMPXClvIconReorderUpDown:
+                        {
+                    	flags |= CHgItem::EHgItemFlagsMoveUpDownIndicator;
+                    	break;
+                        }
+                    }
+			    }
+            else // podcast icons
+                {
+                switch (iconId)
+                    {
+                    case EMPXPodClvIconMMC:
+                        {
+                        flags |= CHgItem::EHgItemFlagsMmc;
+                        break;
+                        }
+                    case EMPXPodClvIconPlay:
+                        {
+                        flags |= CHgItem::EHgItemFlagsPlaybackIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconPause:
+                        {
+                        flags |= CHgItem::EHgItemFlagsPauseIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconBroken:
+                        {
+                        flags |= CHgItem::EHgItemFlagsBrokenTrackIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconCorrupt:
+                        {
+                        flags |= CHgItem::EHgItemFlagsCorruptedTrackIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconNew:
+                        {
+                        flags |= CHgItem::EHgItemFlagsNewPodcastIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconCompplay:
+                        {
+                        flags |= CHgItem::EHgItemFlagsCompletelyPlayedPodcastIndicator;
+                        break;
+                        }
+                    case EMPXPodClvIconPartplay:
+                        {
+                        flags |= CHgItem::EHgItemFlagsPlayedPodcastIndicator;
+                        break;
+                        }
+                    }
+                }
+			}
+		}
+    aVisualItem->SetFlags( flags );
+    CleanupStack::PopAndDestroy();
+    }
+
+
+// -----------------------------------------------------------------------------
+// Set Detail - Icon to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetDetailIconL(
+    CHgItem* aVisualItem,
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetDetailIconL" );
+
+    TInt iconIndex = aIndex;
+    switch ( aIndex )
+        {
+        case 0:
+            iconIndex = EMPXClvIconArtist;
+            break;
+        case 1:
+            iconIndex = EMPXClvIconAlbum;
+            break;
+        case 2:
+            iconIndex = EMPXClvIconPlaylist;
+            break;
+        case 3:
+            iconIndex = EMPXClvIconSongs;
+            break;
+        case 4:
+            iconIndex = EMPXClvIconPodcasts;
+            break;
+        case 5:
+            iconIndex = EMPXClvIconGenre;
+            break;
+        case 6:
+            iconIndex = EMPXClvIconComposer;
+            break;
+        case 7: //EMPXDefaultTitleIconPodcasts
+            iconIndex = 10;
+            break;
+		}
+
+    CGulIcon* icon = (*iIconArray)[iconIndex];
+
+	CFbsBitmap* bitmap = icon->Bitmap();
+	CFbsBitmap* mask = icon->Mask();
+
+	TSize size(iImageSize.iWidth, iImageSize.iHeight);
+    if ( iContext == EContextGroupCollection )
+        { // shrink smaller to look same as in Antriksh
+        size.iWidth = iImageSize.iWidth * KIconFactor;
+        size.iHeight = iImageSize.iHeight * KIconFactor;
+        }
+
+    AknIconUtils::SetSize( bitmap, size );
+    AknIconUtils::SetSize( mask, size );
+
+    CGulIcon* iconCopy = CGulIcon::NewL(bitmap, mask);
+	iconCopy->SetBitmapsOwnedExternally(ETrue);
+    aVisualItem->SetIcon( iconCopy );
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Thumbnail to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetDetailThumbnailL(
+    CMPXMedia* aMedia,
+    TInt aIndex )
+    {
+	  MPX_FUNC("CMPXCommonContainerHgImp::SetDetailThumbnailL(CMPXMedia* aMedia,TInt aIndex)");
+    TMPXItemId currentId( aMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+
+    if ( currentId == KMPXInvalidItemId )
+        {
+        return;
+        }
+
+	if ( aMedia->IsSupported( KMPXMediaMusicAlbumArtFileName ) )
+		{
+		const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbumArtFileName );
+		#ifdef _DEBUG
+		RDebug::RawPrint(album);
+		#endif
+		if ( album.Compare( KNullDesC ) != 0 )
+			{
+			//send request only when under TNM max loads
+
+			if ( iRequestCount < KMaxThumbnailReq )
+				{
+				CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( album, KMPXAlbumMimeType );
+				TInt reqId;
+				TInt ret = NULL;
+				// Set priority based on the index so that the smaller indexes are loaded first.
+				TRAPD(err, reqId = (TInt) iThumbnailManager->GetThumbnailL( *source, (TAny*)ret, -aIndex));
+				iRequestCount++;
+
+				if ( err == KErrNone)
+					  {
+					  iThumbnailReqHashMap.InsertL( reqId, aIndex );
+					  }
+				CleanupStack::PopAndDestroy( source );
+				}
+				 //can not send request since max TNM load, add album art requests to queue
+			else
+				{
+				TAlbumArtRequest* albumArtRequest = NULL;
+
+				TRAPD(err,  albumArtRequest = new (ELeave) TAlbumArtRequest;);
+				if ( err != KErrNone )
+					{
+					return;
+					}
+				albumArtRequest->iIndex = aIndex;
+				albumArtRequest->iAlbumArtUri = album.AllocL();
+
+				// Outstanding request exits; add it to the queue
+				iRequestQueue.AddLast(*albumArtRequest);
+				++iQueueCounter;
+
+				}
+			}
+		else
+			{
+			//no albumart
+			SetDefaultIconL(aIndex);
+    		iThumbnailReqMap[aIndex] = ETrue;
+    		RefreshNoThumbnailL(aIndex);
+			}
+		}
+	else
+	    {
+		// no album art supported
+        SetDefaultIconL(aIndex);
+    	iThumbnailReqMap[aIndex] = ETrue;
+        RefreshNoThumbnailL(aIndex);
+	    }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Sets the current category.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetCollectionContextL()
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetCollectionContextL" );
+
+    const CMPXMedia& media = iListBoxArray->ContainerMedia();
+
+    TMPXGeneralType containerType( EMPXNoType );
+    if ( media.IsSupported( KMPXMediaGeneralType ) )
+        {
+        containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+        }
+
+    TMPXGeneralCategory containerCategory( EMPXNoCategory );
+    if ( media.IsSupported( KMPXMediaGeneralCategory ) )
+        {
+        containerCategory = media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+        }
+    MPX_DEBUG3( "CMPXCommonContainerHgImp::SetCollectionContextL container type = %d, category = %d",
+            containerType, containerCategory );
+
+    iPodcastContext = EFalse;
+    TMPXPodcastCategory podcastCategory( EMPXUnknown );
+    if ( media.IsSupported( KMPXMediaPodcastType ) )
+        {
+        iPodcastContext = ETrue;
+        if ( media.IsSupported( KMPXMediaPodcastCategoryGroup ) )
+            {
+            podcastCategory = media.ValueTObjectL<TMPXPodcastCategory>( KMPXMediaPodcastCategoryGroup );
+            }
+        }
+    MPX_DEBUG3( "CMPXCommonContainerHitchcockImp::SetCollectionContextL container podcast = %d, category = %d",
+            iPodcastContext, podcastCategory );
+
+    iPrevContext = iContext;
+
+    iListWidget->ClearFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
+    if ( !iPodcastContext )
+        {
+        if ( containerType == EMPXGroup )
+            {
+            switch (containerCategory)
+                {
+                case EMPXCollection:
+                    iContext = EContextGroupCollection;
+                    iListWidget->SetFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
+                    break;
+                case EMPXArtist:
+                    iContext = EContextGroupArtist;
+                    break;
+                case EMPXAlbum:
+                    iContext = EContextGroupAlbum;
+                    break;
+                case EMPXPlaylist:
+                    iContext = EContextGroupPlaylist;
+                    break;
+                case EMPXSong:
+                    iContext = EContextGroupSong;
+                    break;
+                case EMPXGenre:
+                    iContext = EContextGroupGenre;
+                    break;
+                case EMPXComposer:
+                    iContext = EContextGroupComposer;
+                    break;
+                default:
+                    User::Leave(KErrNotSupported);
+                    break;
+                }
+            }
+        else if ( containerType == EMPXItem )
+            {
+            switch (containerCategory)
+                {
+                case EMPXArtist:
+                    iContext = EContextItemArtist;
+                    break;
+                case EMPXAlbum:
+                    iContext = EContextItemAlbum;
+                    break;
+                case EMPXPlaylist:
+                    iContext = EContextItemPlaylist;
+                    break;
+                case EMPXSong:
+                    iContext = EContextItemSong;
+                    break;
+                case EMPXGenre:
+                    iContext = EContextItemGenre;
+                    break;
+                case EMPXComposer:
+                    iContext = EContextItemComposer;
+                    break;
+                default:
+                    User::Leave(KErrNotSupported);
+                    break;
+                }
+            }
+        }
+    else
+        {
+        if ( (containerType == EMPXGroup) && (podcastCategory == EMPXTitle) )
+            {
+            iContext = EContextGroupPodcast;
+            iListWidget->SetFlags( CHgScroller::EHgScrollerKeyMarkingDisabled );
+            }
+        else if ( (containerType == EMPXItem) && (podcastCategory == EMPXEpisode) )
+            {
+            iContext = EContextItemPodcast;
+            }
+        else
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonContainerHgImp::MopSupplyObject
+// -----------------------------------------------------------------------------
+//
+TTypeUid::Ptr CMPXCommonContainerHgImp::MopSupplyObject( TTypeUid aId )
+	{
+    MPX_FUNC( "CMPXCommonContainerHgImp::MopSupplyObject" );
+	return MAknsControlContext::SupplyMopObject(aId, iBgContext );
+	}
+
+// -----------------------------------------------------------------------------
+// CMPXCommonContainerHgImp::SetScrollbarType
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHgImp::SetScrollbarType()
+    {
+    MPX_FUNC( "CMPXCommonContainerHgImp::SetScrollbarType" );
+
+    if ( iContext == EContextGroupCollection ||
+         iContext == EContextGroupPlaylist ||
+         iContext == EContextItemAlbum ||
+         iContext == EContextItemPlaylist )
+        {
+        iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerScrollBar );
+        }
+    else
+        {
+        iListWidget->SetScrollBarTypeL( CHgScroller::EHgScrollerLetterStripLite );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Clears the TN request if any
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerHgImp::CancelTNRequest()
+    {
+    MPX_FUNC("CMPXCommonContainerHgImp::CancelTNRequest");
+
+    if ( iThumbnailReqHashMap.Count() == 0 )
+        {
+        return;
+        }
+
+	THashMapIter<TInt, TInt> iter(iThumbnailReqHashMap);
+	TInt* id = iter.CurrentValue();
+    if (id && *id >= 0)
+        {
+        iThumbnailManager->CancelRequest((TThumbnailRequestId)id);
+        }
+	while ( TInt const* id = iter.NextValue() )
+		{
+		iThumbnailManager->CancelRequest((TThumbnailRequestId)*id);
+		}
+    }
+
+// ----------------------------------------------------------------------------
+// Save the selected album item
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerHgImp::SaveSelectedAlbumItemL()
+    {
+    if ( iContext == EContextGroupAlbum || iContext == EContextItemArtist )
+        {
+        const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+
+        if ( iSelectedMediaInAlbumView )
+            {
+            delete iSelectedMediaInAlbumView;
+            iSelectedMediaInAlbumView = NULL;
+            }
+
+        iSelectedMediaInAlbumView = CMPXMedia::NewL( *mediaArray.AtL( CurrentLbxItemIndex() ) );
+
+        if ( iSelectedMediaInAlbumView->IsSupported( KMPXMediaGeneralTitle ) )
+            {
+            const TDesC& title = iSelectedMediaInAlbumView->ValueText( KMPXMediaGeneralTitle );
+            if ( title == KNullDesC )
+                {
+                // Cannot use reference to KNullDesC, must
+                // use the literal directly.
+                iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicAlbum, KNullDesC );
+                }
+            else
+                {
+                iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicAlbum, title );
+                }
+            }
+
+        if ( iContext == EContextItemArtist )
+            {
+            const CMPXMedia& containerMedia = iListBoxArray->ContainerMedia();
+            const TDesC& artist = containerMedia.ValueText( KMPXMediaGeneralTitle );
+
+            HBufC* unknownArtistText =
+                    StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_ARTIST );
+
+            if ( artist != unknownArtistText->Des() )
+                {
+                iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicArtist, artist );
+                }
+            else
+                {
+                iSelectedMediaInAlbumView->SetTextValueL( KMPXMediaMusicArtist, KNullDesC );
+                }
+
+            CleanupStack::PopAndDestroy( unknownArtistText );
+            }
+
+        WriteToStreamFileL( iSelectedMediaInAlbumView );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Write the album name, artist name and album art in media data to file
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerHgImp::WriteToStreamFileL( const CMPXMedia* aMedia )
+   {
+    MPX_FUNC( "CMPXCommonContainerHgImp::WriteToStreamFileL" );
+
+    CCoeEnv* coeEnv( iEikonEnv );
+    RFs& fs = coeEnv->FsSession();
+    fs.MkDirAll( iSelectedAlbumItemFileName );
+    TParse parsedName;
+
+    fs.Parse( iSelectedAlbumItemFileName, parsedName );
+    CFileStore* store( NULL );
+    MPX_TRAPD( error, store = CDirectFileStore::ReplaceL(fs,
+                                                 parsedName.FullName(),
+                                                 EFileWrite); );
+
+    if ( error == KErrNone )
+        {
+        CleanupStack::PushL( store );
+        store->SetTypeL( KDirectFileStoreLayoutUid );
+
+        RStoreWriteStream wstream;
+        TStreamId stream = wstream.CreateLC( *store );
+        store->SetRootL( stream );
+
+        if ( aMedia->IsSupported( KMPXMediaMusicAlbum ) )
+            {
+            const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbum );
+            wstream << album;
+            }
+        else
+            {
+            wstream << KNullDesC;
+            }
+
+        if ( aMedia->IsSupported( KMPXMediaMusicAlbumArtFileName ) )
+            {
+            const TDesC& art = aMedia->ValueText( KMPXMediaMusicAlbumArtFileName );
+            wstream << art;
+            }
+        else
+            {
+            wstream << KNullDesC;
+            }
+
+        if ( aMedia->IsSupported( KMPXMediaMusicArtist ) )
+            {
+            const TDesC& artist = aMedia->ValueText( KMPXMediaMusicArtist );
+            wstream << artist;
+            }
+        else
+            {
+            wstream << KNullDesC;
+            }
+
+        wstream.CommitL();
+        CleanupStack::PopAndDestroy( &wstream );
+        CleanupStack::PopAndDestroy( store );
+        }
+    else
+        {
+        fs.Delete( iSelectedAlbumItemFileName );
+        }
+   }
+
+// ----------------------------------------------------------------------------
+// Read the album name, artist name and album art from file
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerHgImp::ReadFromStreamFileL( CMPXMedia* aMedia )
+    {
+    MPX_FUNC("CMPXCommonContainerHgImp::ReadFromStreamFileL");
+
+    CCoeEnv* coeEnv( iEikonEnv );
+    RFs& fs = coeEnv->FsSession();
+    fs.MkDirAll( iSelectedAlbumItemFileName );
+    TParse parsedName;
+
+    fs.Parse( iSelectedAlbumItemFileName, parsedName );
+    CFileStore* store( NULL );
+    MPX_TRAPD( error, store = CDirectFileStore::OpenL(fs,
+                                                 parsedName.FullName(),
+                                                 EFileRead ); );
+    if ( error == KErrNone )
+        {
+        CleanupStack::PushL( store );
+
+        RStoreReadStream stream;
+        stream.OpenLC( *store, store->Root() );
+
+        TBuf<KMPXMaxFileLength> album( KNullDesC );
+        stream >> album;
+        aMedia->SetTextValueL( KMPXMediaMusicAlbum, album );
+
+        TBuf<KMPXMaxFileLength> art( KNullDesC );
+        stream >> art;
+        aMedia->SetTextValueL( KMPXMediaMusicAlbumArtFileName, art );
+
+        TBuf<KMPXMaxFileLength> artist( KNullDesC );
+        stream >> artist;
+        aMedia->SetTextValueL( KMPXMediaMusicArtist, artist );
+
+        CleanupStack::PopAndDestroy( &stream );
+        CleanupStack::PopAndDestroy( store );
+        }
+    else
+        {
+        aMedia->SetTextValueL( KMPXMediaMusicAlbum, KNullDesC );
+        aMedia->SetTextValueL( KMPXMediaMusicAlbumArtFileName, KNullDesC );
+        aMedia->SetTextValueL( KMPXMediaMusicArtist, KNullDesC );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// Clean Albumart request queue
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerHgImp::CleanAlbumArtReqQueue()
+    {
+    MPX_FUNC("CMPXCommonContainerHgImp::CleanAlbumArtReqQueue");
+    while ( !iRequestQueue.IsEmpty() )
+        {
+        iAlbumArtRequest = iRequestQueue.First();
+        iRequestQueue.Remove(*iAlbumArtRequest);
+        delete iAlbumArtRequest->iAlbumArtUri;  //not sure needed or not
+        delete iAlbumArtRequest;
+        }
+        iQueueCounter = 0;
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainerhitchcockimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1981 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of common container for the
+*                Hitchcock platform.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <barsread.h>
+#include <stringloader.h>
+#include <akniconarray.h>
+#include <gulicon.h>
+#include <featmgr.h>
+#include <aknsfld.h>
+#include <aknutils.h>
+#include <aknlists.h>
+#include <aknconsts.h>
+#include <avkon.mbg>
+#include <eikclbd.h>
+#include <eikcmobs.h>
+#include <bautils.h>
+#include <glib/gstring.h> //for handling the Ustring memory leak
+#include <aknview.h>
+
+// Uiaccelerator Includes
+#include <alf/alfcontrolgroup.h>
+#include <alf/alfdisplay.h>
+#include <alf/alfenv.h>
+#include <alf/alfroster.h>
+#include <alf/alfwidgetcontrol.h>   // To get CAlfControl from CAlfWidgetControl
+#include <alf/alfwidgetenvextension.h>
+
+#include <alf/ialfviewwidget.h>
+#include <alf/ialfcontainerwidget.h>
+#include <alf/ialfmap.h>
+#include <alf/ialfwidgetfactory.h>  // Widget factory
+#include <osn/ustring.h>          // ustring
+#include <osn/osnnew.h>
+#include <osn/alfptrvector.h>
+
+// MUL Includes
+#include <mul/imulwidget.h>             // For Templates
+#include <mul/imullistwidget.h>         // List widget
+#include <mul/imulmodel.h>              // Data model
+#include <mul/mulvisualitem.h>          // For Visual Item
+#include <mul/imulwidgetdef.h>
+
+#include <data_caging_path_literals.hrh>
+#include <mpxlog.h>
+#include <mpxuser.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxpodcastdefs.h>
+#include <mpxcommonuihelper.h>
+
+#include <mpxcommoncontainer.rsg>
+
+#include "mpxcommonlistboxarraybase.h"
+#include "mpxcommoncontainermediahelper.h"
+#include "mpxcommoncontainertexturemanager.h"
+#include "mpxcommoncontainerhitchcockimp.h"
+#include "mpxcommoncontainerfilteredlist.h"
+#include "mpxcommoncontainer.hrh"
+
+#include <thumbnaildata.h>
+#include <thumbnailobjectsource.h>
+
+using namespace Alf;
+//using namespace mulvisualitem;
+
+// CONSTANTS
+//const TInt KMPXFindboxTextLimit = 40;
+const TInt KMPXListSelectionCount = 5;
+const TInt KListControlGroupIdMusic = 270531711;  // Need to be unique. Using music collection dll UID.
+const TInt KListControlGroupIdPodcast = 270531738;  // Need to be unique. Using podcast collection dll UID.
+
+const TInt KMPXMinSecSeparatorIndex = 2;
+const TInt KOneHourInSeconds = 3600;
+const TInt KMPXTimeIndicatorLength = 16;
+_LIT( KMPXDash, " - " );
+_LIT( KMPXZeroDurationMark, "--");
+_LIT( KMPXAlbumMimeType, "image/jpeg" );
+
+// AK - Temporary Begin - These need to be localized
+_LIT( KUnknown, "Unknown" );
+_LIT( KSong, " song" );
+_LIT( KSongs, " songs" );
+_LIT( KEpisode, " episode" );
+_LIT( KEpisodes, " episodes" );
+_LIT( KAlbum, " album" );
+_LIT( KAlbums, " albums" );
+_LIT( KSongDash, " song - " );
+_LIT( KSongsDash, " songs - " );
+// AK - Temporary End
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXCommonContainerHitchcockImp::CMPXCommonContainerHitchcockImp() :
+    iContext( EContextUnknown ),
+    iIsFindEnabled( EFalse ),
+    iIsMarkingEnabled( ETrue ),
+    iTopIndex( KErrNotFound ),
+    iBottomIndex( KErrNotFound ),
+    iAlfEnvCreated( EFalse ),
+    iContainerActive( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXCommonContainerHitchcockImp::~CMPXCommonContainerHitchcockImp()
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::~CMPXCommonContainerHitchcockImp" );
+
+    FeatureManager::UnInitializeLib();
+
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+
+    if ( iListWidget )
+        {
+        iListWidget->RemoveEventHandler(*this);
+        }
+//    delete iEnv;
+
+    delete iListSelections;
+    delete iListBoxArray;
+    delete iIconArray;
+
+    if ( iTextureManager )
+        {
+        iTextureManager->ClearCache();
+        }
+    delete iTextureManager;
+    delete iCommonUiHelper;
+
+    delete iThumbnailManager;
+    iThumbnailReqArray.Close();
+
+    delete iFilteredList;
+    delete iSearchFieldWrapper;
+    }
+
+// ---------------------------------------------------------------------------
+// Return Coe Control
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CMPXCommonContainerHitchcockImp::CoeControl()
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::CoeControl" );
+    return this;
+    }
+
+// ---------------------------------------------------------------------------
+// Set View Container
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetViewContainer(
+    MMPXViewContainer* aViewContainer )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::SetViewContainer" );
+    iViewContainer = aViewContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// Set command observer for the container
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetCommandObserver(
+    MEikCommandObserver* aCommandObserver )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::SetCommandObserver" );
+    iView = aCommandObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ constructor can NOT contain any code that might leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetListBoxObserver(
+    MEikListBoxObserver* aListBoxObserver )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::SetListBoxObserver" );
+    iListBoxObserver = aListBoxObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::UpdateLayout()
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::UpdateLayout" );
+    }
+
+// -----------------------------------------------------------------------------
+// Returns a pointer to the listboxarray
+// -----------------------------------------------------------------------------
+//
+CMPXCommonListBoxArrayBase* CMPXCommonContainerHitchcockImp::ListBoxArray() const
+    {
+    return iListBoxArray;
+    }
+
+// -----------------------------------------------------------------------------
+// Sets listbox array
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetListBoxArrayL(
+    CMPXCommonListBoxArrayBase* aListBoxArray )
+    {
+    iListBoxArray = aListBoxArray;
+    }
+
+// -----------------------------------------------------------------------------
+// Return number of listbox items shown in the current listbox.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHitchcockImp::CurrentListItemCount() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::CurrentListItemCount" );
+    TInt count = 0;
+    if ( iWidgetModel )
+        {
+        count = iWidgetModel->Count();
+        }
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// Return total number of listbox items in the listbox.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHitchcockImp::TotalListItemCount() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::TotalListItemCount" );
+    TInt count = 0;
+    if ( iWidgetModel )
+        {
+        count = iWidgetModel->Count();
+        }
+    return count;
+    }
+
+// -----------------------------------------------------------------------------
+// Gets top listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHitchcockImp::TopLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::TopLbxItemIndex" );
+    return iTopIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// Gets bottom listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHitchcockImp::BottomLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::BottomLbxItemIndex" );
+    return iBottomIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// Gets current listbox item index (relative to the original listbox).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHitchcockImp::CurrentLbxItemIndex() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::CurrentLbxItemIndex" );
+    const TInt count = CurrentListItemCount();
+    TInt index( KErrNotFound );
+    if( count > 0 )
+        {
+        index = iWidgetModel->Highlight();
+        if ( iFilteredList )
+            {
+            index = iFilteredList->FilteredIndexToRealIndex(index);
+            }
+        }
+    return index;
+    }
+
+// -----------------------------------------------------------------------------
+// Get current selected listbox items indices (relative to the original listbox)
+// -----------------------------------------------------------------------------
+//
+const CArrayFix<TInt>* CMPXCommonContainerHitchcockImp::
+    CurrentSelectionIndicesL() const
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::CurrentSelectionIndicesL" );
+    iListSelections->Reset();
+    if ( iWidgetModel )
+        {
+        std::vector<int> itemsSelected = iWidgetModel->MarkedIndices();
+        int count = itemsSelected.size();
+        if ( iFilteredList )
+            {
+            for( int i = 0; i < count; i++ )
+                {
+                TInt index = iFilteredList->FilteredIndexToRealIndex( static_cast<TInt>( itemsSelected[i] ) );
+                iListSelections->AppendL( index );
+                }
+            }
+        else
+            {
+            for( int i = 0; i < count; i++ )
+                {
+                iListSelections->AppendL( static_cast<TInt>( itemsSelected[i] ) );
+                }
+            }
+        }
+    return iListSelections;
+    }
+
+// -----------------------------------------------------------------------------
+// Get current selected listbox items indices (relative to the original listbox)
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetCurrentSelectionIndicesL(
+    CArrayFix<TInt>* aIndices ) const
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::SetCurrentSelectionIndicesL" );
+    TInt count = aIndices->Count();
+    if ( count > 0 && iWidgetModel )
+        {
+        std::vector<int> itemsToSelect;
+        for( TInt i = 0; i < count; i++ )
+            {
+            itemsToSelect.push_back( (*aIndices)[i] );
+            }
+        iWidgetModel->SetMarkedIndices(MulWidgetDef::EMulMark, itemsToSelect);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Set top listbox item index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetLbxTopItemIndex( TInt /*aIndex*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::SetLbxTopItemIndex" );
+    // Not required for Hitchcock
+    }
+
+// -----------------------------------------------------------------------------
+// Set current listbox item index.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetLbxCurrentItemIndex( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::SetLbxCurrentItemIndex" );
+    if ( iWidgetModel )
+        {
+        iWidgetModel->SetHighlight( aIndex );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Set current listbox item index and highlight it.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetLbxCurrentItemIndexAndDraw(
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::SetLbxCurrentItemIndexAndDraw" );
+    if ( iWidgetModel )
+        {
+        if ( (aIndex >= 0) && (aIndex < iWidgetModel->Count()) )
+            {
+            iWidgetModel->SetHighlight( aIndex );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Clear listbox selection.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::ClearLbxSelection()
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::ClearLbxSelection" );
+    if ( iWidgetModel )
+        {
+        iWidgetModel->SetMarkedIndices(MulWidgetDef::EMulUnmarkAll);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Sets the text for an empty list box
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetLbxEmptyTextL( const TDesC& aText )
+    {
+    if ( aText == KNullDesC )
+        {
+        return;
+        }
+    if ( iListWidget )
+        {
+        HBufC8* buf = MPXUser::Alloc8ZL( aText );
+        TPtr8 ptr( buf->Des() );
+        UString emptyText( (char*)ptr.PtrZ() );
+        CleanupStack::PushL( buf );
+        iListWidget->SetEmptyText( emptyText );
+        CleanupStack::PopAndDestroy( buf );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Draws a list box item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::DrawLbxItem( TInt aIndex )
+    {
+    MPX_DEBUG2( "CMPXCommonContainerHitchcockImp::DrawLbxItem (aIndex=%d)", aIndex );
+
+    // Just inform the model about the update. Model will request for data if necessary.
+    // Ignore if find box is activated
+    if ( iWidgetModel && !FindBoxVisibility() )
+        {
+        TInt count = iWidgetModel->Count();
+        if ( aIndex >= 0 && aIndex < count )
+            {
+            iWidgetModel->Update(aIndex, 1);
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Set Find box's focus.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetFindBoxFocus( TBool /*aFocus*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::SetFindBoxFocus" );
+    // Not used
+    }
+
+// -----------------------------------------------------------------------------
+// Handle listbox item addition.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::HandleLbxItemAdditionL()
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::HandleLbxItemAdditionL" );
+    const char* KLoadNameModel("mulmodel");
+    HandleLbxItemRemovalL();
+    IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv);
+    iWidgetModel = widgetFactory.createModel<IMulModel>( KLoadNameModel );
+    iWidgetModel->SetDataProvider(*this);
+    SetCollectionContextL();
+
+    TInt count = 0;
+    if ( iFilteredList )
+        {
+        iFilteredList->ReplaceMediaListL( iListBoxArray->MediaArray() );
+        count = iFilteredList->FilteredCount();
+        }
+    else
+        {
+        count = iListBoxArray->MediaArray().Count();
+        }
+    if ( count > 0 )
+        {
+        iWidgetModel->Insert(0, count);
+        }
+    if ( iListWidget )
+        {
+        iListWidget->SetModel( iWidgetModel->Accessor() );
+        }
+    else
+        {
+        // Create list widget. CAlfEnv owns widget
+        MPX_DEBUG1("CMPXCommonContainerHitchcockImp - Create List widget.");
+        const char* KLoadNameList("mullistwidget");
+        const char* KListWidgetName("mpxmullistwidget");
+        const char* KListWidgetNamePod("mpxmullistwidgetpod");
+
+        // Create view widget. CAlfEnv owns widget
+        if ( iCollectionType == MMPXCommonContainer::EMPXCommonContainerMusic )
+            {
+            iListWidget = widgetFactory.createWidget<IMulListWidget>(KLoadNameList, KListWidgetName, *iViewWidget, NULL );
+            }
+        else if ( iCollectionType == MMPXCommonContainer::EMPXCommonContainerPodcast )
+            {
+            iListWidget = widgetFactory.createWidget<IMulListWidget>(KLoadNameList, KListWidgetNamePod, *iViewWidget, NULL );
+            }
+
+        iListWidget->AddEventHandler(*this);
+        iListWidget->SetModel( iWidgetModel->Accessor() );
+
+        // This will set icon area background to transparent
+        iListWidget->SetVisualColor(IMulWidget::EThumbnailBackgroundBrush, TRgb(0xFFFFFFFF, 255));
+
+        // Enable multiselect and cyclic scrolling
+        iListWidget->SetFlags( IMulMultiItemWidget::EMulWidgetFlagCyclic |
+                IMulMultiItemWidget::EMulWidgetFlagFastScroll | IMulMultiItemWidget::EMulWidgetFlagNaviScroll |
+                IMulMultiItemWidget::EMulWidgetMarkingMode |
+                IMulMultiItemWidget::EMulWidgetTitleMarqueeOn );
+
+        // Fetch icon and indicator sizes
+        iListWidget->GetIconSize( mulwidget::KTemplate3, mulvisualitem::KMulIcon1, iIconHeight, iIconWidth );
+        iListWidget->GetIconSize( mulwidget::KTemplate3, mulvisualitem::KMulIndicator1, iIndicatorHeight, iIndicatorWidth );
+        iThumbnailManager->SetThumbnailSizeL( TSize(iIconHeight, iIconWidth) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle listbox item addition, preserving the current display index
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::HandleLbxItemAdditionPreserveIndexL()
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::HandleLbxItemAdditionPreserveIndexL" );
+    HandleLbxItemAdditionL();
+    }
+
+// -----------------------------------------------------------------------------
+// Handle listbox item removal.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::HandleLbxItemRemovalL()
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::HandleLbxItemRemovalL" );
+    iTopIndex = iBottomIndex = KErrNotFound;
+    if ( iTextureManager )
+        {
+        // Enabling the following will free up the memory, but not clearing the cache
+        // will improve performance when we come back to the list again.
+        // iTextureManager->ClearCache(CMPXCommonContainerTextureManager::EMPXTextureImage);
+        }
+    iThumbnailReqArray.Reset();
+    }
+
+// -----------------------------------------------------------------------------
+// Show/hide find box.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetFindBoxVisibilityL( TBool aIsVisible )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::SetFindBoxVisibilityL" );
+    if ( aIsVisible )
+        {
+        if ( !FindBoxVisibility() )
+            {
+            iSearchFieldWrapper = CMPXCommonContainerSearchFieldWrapper::NewL(this);
+            iFilteredList = CMPXCommonContainerFilteredList::NewL();
+            iFilteredList->ReplaceMediaListL( iListBoxArray->MediaArray() );
+            }
+        ActivateSearchFieldL();
+        }
+    else
+        {
+        if ( FindBoxVisibility() )
+            {
+            TInt index = iWidgetModel->Highlight();
+            if ( index != KErrNotFound )
+                {
+                index = iFilteredList->FilteredIndexToRealIndex(index);
+                }
+
+            DeactivateSearchField();
+
+            delete iFilteredList;
+            iFilteredList = NULL;
+            delete iSearchFieldWrapper;
+            iSearchFieldWrapper = NULL;
+
+            // Restore original list
+            TInt count = iListBoxArray->MediaArray().Count();
+
+            if( count > 0)
+            	{
+            	iWidgetModel->Refresh( count );
+            	if ( index != KErrNotFound )
+                	{
+                	iWidgetModel->SetHighlight( index );
+                	}
+				}
+            iThumbnailReqArray.Reset();
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Determine find box visibility
+// -----------------------------------------------------------------------------
+//
+TBool CMPXCommonContainerHitchcockImp::FindBoxVisibility()
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::FindBoxVisibility" );
+    TBool visible = EFalse;
+    if ( iSearchFieldWrapper )
+        {
+        visible = iSearchFieldWrapper->IsSearchFieldActive();
+        }
+    return visible;
+    }
+
+// -----------------------------------------------------------------------------
+// Restore the PopupCBA of find box
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::RestoreFindBoxPopupCBA()
+    {
+    MPX_FUNC( "CMPXCommonContainerAvkonImp::RestoreFindBoxPopupCBA" );
+    // Not required for Hitchcock
+    }
+
+// -----------------------------------------------------------------------------
+// Calculate the top index of the visible items
+// -----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerHitchcockImp::CalculateTopIndex( TInt /*aBottomIndex*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::CalculateTopIndex" );
+    // Not required for Hitchcock
+    return 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::ConstructContainerL( TMPXCommonContainerCollectionType aCollectionType )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::ConstructContainerL" );
+
+	/*
+    CCoeEnv* coeEnv( iEikonEnv );
+    TParse parse;
+    parse.Set( KMPXCollectionRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+	*/
+
+    iCollectionType = aCollectionType;
+    CreateWindowL();
+    CreateListBoxL();
+    FeatureManager::InitializeLibL();
+    ConstructFindBoxL( ETrue );
+
+    // Common methods used for 2-line list support
+    iCommonUiHelper = CMPXCommonUiHelper::NewL();
+    iListSelections = new (ELeave) CArrayFixFlat<TInt>( KMPXListSelectionCount );
+    iTextureManager = new (ELeave) CMPXCommonContainerTextureManager( iEnv->TextureManager() );
+
+    iThumbnailManager = CThumbnailManager::NewL( *this );
+    iThumbnailManager->SetFlagsL( CThumbnailManager::EDefaultFlags );
+    iThumbnailManager->SetQualityPreferenceL( CThumbnailManager::EOptimizeForQuality );
+    //iThumbnailManager->SetThumbnailSizeL( TSize(iIconHeight, iIconWidth) );
+    }
+
+// ---------------------------------------------------------------------------
+// Enable/disable find box
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::EnableFindBox( TBool aEnable )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::EnableFindBox" );
+    iIsFindEnabled = aEnable;
+    }
+
+// ---------------------------------------------------------------------------
+// Enable/disable marking
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::EnableMarking( TBool aEnable )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::EnableMarking" );
+    iIsMarkingEnabled = aEnable;
+    if( iListWidget )
+		{
+		if( iIsMarkingEnabled )
+			{
+			iListWidget->SetFlags( IMulMultiItemWidget::EMulWidgetMarkingMode );
+			}
+		else
+			{
+			iListWidget->ClearFlags( IMulMultiItemWidget::EMulWidgetMarkingMode );
+			}
+		}
+    }
+
+// ---------------------------------------------------------------------------
+// Custom handling of commands for markable lists.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::HandleMarkableListProcessCommandL(
+    TInt aCommand )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::HandleMarkableListProcessCommandL" );
+
+	if ( iWidgetModel )
+		{
+		switch ( aCommand )
+			{
+			case EAknCmdMark:
+				{
+				std::vector<int> itemIndex;
+				int highlight = iWidgetModel->Highlight();
+				itemIndex.push_back( highlight);
+				iWidgetModel->SetMarkedIndices(MulWidgetDef::EMulMark, itemIndex);
+				}
+				break;
+			case EAknCmdUnmark:
+			    {
+			    std::vector<int> itemIndex;
+				int highlight = iWidgetModel->Highlight();
+				itemIndex.push_back(highlight);
+				//mark the selected item
+				iWidgetModel->SetMarkedIndices(MulWidgetDef::EMulUnmark, itemIndex);
+			    }
+			    break;
+			case EAknMarkAll:
+				iWidgetModel->SetMarkedIndices(MulWidgetDef::EMulMarkAll);
+				break;
+			case EAknUnmarkAll:
+				iWidgetModel->SetMarkedIndices(MulWidgetDef::EMulUnmarkAll);
+				break;
+			}
+		}
+    }
+
+// ---------------------------------------------------------------------------
+// Custom handling of menu pane for markable lists
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::HandleMarkableListDynInitMenuPane(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::HandleMarkableListDynInitMenuPane" );
+
+    if ( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST )
+        {
+        TInt currentItem = CurrentLbxItemIndex();
+        if ( currentItem == KErrNotFound )
+            {
+            aMenuPane->SetItemDimmed( EAknCmdEditListMenu, ETrue );
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EAknCmdEditListMenu, EFalse );
+            }
+        }
+    else if ( aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST_IMPLEMENTATION )
+        {
+        TInt currentItem = CurrentLbxItemIndex();
+        if ( currentItem != KErrNotFound )
+            {
+            TBool currentItemMarked = EFalse;
+            std::vector<int> itemsSelected = iWidgetModel->MarkedIndices();
+            int markedCount = itemsSelected.size();
+            for( int i = 0; i < markedCount; i++ )
+                {
+                if ( currentItem == itemsSelected[i] )
+                    {
+                    currentItemMarked = ETrue;
+                    break;
+                    }
+                }
+            TInt totalCount = iWidgetModel->Count();
+            aMenuPane->SetItemDimmed( EAknCmdMark, currentItemMarked );
+            aMenuPane->SetItemDimmed( EAknCmdUnmark, !currentItemMarked );
+            aMenuPane->SetItemDimmed( EAknMarkAll, markedCount == totalCount );
+            aMenuPane->SetItemDimmed( EAknUnmarkAll, markedCount == 0 );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXCommonContainerHitchcockImp::HandleKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG5( "CMPXCommonContainerHitchcockImp::HandleKeyEventL(iCode=%d, iScanCode=%d, iModifiers=0x%x, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iModifiers, aType );
+
+    if ( iSearchFieldWrapper && aType == EEventKeyUp )
+        {
+#ifdef __ENABLE_MSK
+        // Update the middle softkey for marking commands
+        iView->ProcessCommandL( EMPXCmdCommonUpdateMiddleSoftKey );
+#endif // __ENABLE_MSK
+        }
+    if ( iSearchFieldWrapper && aType == EEventKey )
+        {
+        if ( iSearchFieldWrapper->IsSearchFieldActive() )
+            {
+            if ( iSearchFieldWrapper->OfferKeyEventL( aKeyEvent, aType ) == EKeyWasConsumed )
+                {
+                return EKeyWasConsumed;
+                }
+            }
+        }
+    // TODO: Temporary test code, what key codes should start find?
+    else if ( ( aKeyEvent.iScanCode >= 48  && aKeyEvent.iScanCode <= 57 ) ||
+              ( aKeyEvent.iScanCode >= 65  && aKeyEvent.iScanCode <= 90 ) ||
+              ( aKeyEvent.iScanCode >= 121 && aKeyEvent.iScanCode <= 127 ) ||
+              ( aKeyEvent.iScanCode == 5 ) || ( aKeyEvent.iScanCode == 125 ) ||
+              ( aKeyEvent.iScanCode == 127 ) || ( aKeyEvent.iScanCode == 130 ) ||
+              ( aKeyEvent.iScanCode == 133 ) || ( aKeyEvent.iScanCode == 135 ) )
+        {
+        if ( iContext != EContextGroupCollection )
+            {
+            iView->ProcessCommandL( EMPXCmdCommonFind );
+            return EKeyWasConsumed;
+            }
+        }
+
+    TKeyResponse response( EKeyWasNotConsumed );
+    if ( aKeyEvent.iCode == EKeyOK )
+        {
+        // Handle enter key pressed
+        iView->ProcessCommandL( EMPXCmdCommonEnterKey );
+        }
+
+    if ( response == EKeyWasNotConsumed &&
+         aType == EEventKey &&
+         aKeyEvent.iCode == EKeyBackspace && iView )
+        {
+        iView->ProcessCommandL( EMPXCmdCommonDelete );
+        response = EKeyWasConsumed;
+        }
+
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// Activate container
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::ActivateContainerL()
+    {
+    TRect clientRect = ((CAknView*)iView)->ClientRect();
+    iViewWidget->setRect( clientRect );
+    iViewWidget->show(true);
+    iContainerActive = ETrue;
+    if( iListWidget )
+    	{
+		iListWidget->ShowWidget(true);
+		}
+    }
+
+// ---------------------------------------------------------------------------
+// Deactivate container
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::DeactivateContainerL()
+    {
+    iViewWidget->show(false);
+    if ( iListWidget )
+        {
+        iListWidget->SetModel(NULL);
+        iWidgetModel = NULL;
+        iListWidget->ShowWidget(false);
+        }
+    iContainerActive = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Return container state
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCommonContainerHitchcockImp::IsContainerActive()
+    {
+    return iContainerActive;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCommonListBoxArrayObserver
+// Handle listbox array events.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::HandleListBoxArrayEventL(
+    MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::HandleListBoxArrayEventL" );
+    if ( aEvent == MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventIconArrayChange )
+        {
+        delete iIconArray;
+        iIconArray = NULL;
+        CreateIconArrayL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXCommonContainerHitchcockImp::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG5( "CMPXCommonContainerHitchcockImp::OfferKeyEventL(iCode=%d, iScanCode=%d, iModifiers=0x%x, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aKeyEvent.iModifiers, aType );
+    MPX_DEBUG3("CMPXCommonContainerHitchcockImp::OfferKeyEventL, iType=%d, iActive=%d", iCollectionType, iContainerActive);
+    if ( iWidgetModel )
+        {
+        TAlfEvent event( iEnv->PrimaryDisplay(), aKeyEvent, aType );
+        if ( iListWidget->control()->processEvent( event ) == EEventHandled )
+            {
+            return EKeyWasConsumed;
+            }
+        else
+            {
+            // Let the view container handle the key event.
+            return iViewContainer->HandleKeyEventL( aKeyEvent, aType );
+            }
+        }
+    return EKeyWasNotConsumed;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::GetHelpContext" );
+    // Let the view container handle the help context retrieval
+    if ( iViewContainer )
+        {
+        iViewContainer->HandleHelpContext( aContext );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::HandleResourceChange( TInt aType )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::HandleResourceChange" );
+    CCoeControl::HandleResourceChange( aType );
+
+    if ( aType == KAknsMessageSkinChange )
+        {
+        delete iIconArray;
+        iIconArray = NULL;
+        TRAP_IGNORE(CreateIconArrayL());
+        }
+    else if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        TRect clientRect = ((CAknView*)iView)->ClientRect();
+        if ( FindBoxVisibility() )
+            {
+            TRect clientRect = ((CAknView*)iView)->ClientRect();
+            iViewWidget->setRect(
+                    iSearchFieldWrapper->GetListRect( ETrue, clientRect ) );
+            iSearchFieldWrapper->SetRect(
+                    iSearchFieldWrapper->GetSearchFieldRect( ETrue, clientRect ) );
+            }
+        else
+            {
+            iViewWidget->setRect( clientRect );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Draw this application's view to the screen
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::Draw(const TRect& /*aRect*/) const
+    {
+    // Do nothing so that list model will be drawn by Hitchcock framework
+    }
+
+// ---------------------------------------------------------------------------
+// From MCoeControlObserver
+// Handle control event
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::HandleControlEventL(
+    CCoeControl* /*aControl*/,
+    TCoeEvent /*aEventType*/ )
+    {
+    // Not used
+    }
+
+// ---------------------------------------------------------------------------
+// From IAlfWidgetEventHandler
+// Indicates whether event is accepted
+// ---------------------------------------------------------------------------
+//
+bool CMPXCommonContainerHitchcockImp::accept(
+    CAlfWidgetControl& /*aControl*/,
+    const TAlfEvent& /*aEvent*/ ) const
+    {
+    return true;
+    }
+
+// ---------------------------------------------------------------------------
+// From IAlfWidgetEventHandler
+// Sets the active states of the event handler
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::setActiveStates( unsigned int /*aStates*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From IAlfWidgetEventHandler
+// Performs the appropriate action for the ALF event
+// ---------------------------------------------------------------------------
+//
+AlfEventStatus CMPXCommonContainerHitchcockImp::offerEvent(
+    CAlfWidgetControl& /*aControl*/,
+    const TAlfEvent& aEvent )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::offerEvent" );
+
+    AlfEventStatus status = EEventNotHandled;
+
+    if( aEvent.IsCustomEvent() )
+        {
+        uint eventID = aEvent.CustomParameter();
+
+        switch( eventID )
+            {
+            case ETypeMark:
+                {
+                switch( aEvent.CustomEventData() )
+                    {
+                    case EMarkStart:
+                    case EMarkStop :
+                        {
+                        status = EEventConsumed;
+                        }
+                        break;
+                    default:
+                        break;
+                    }
+                break;
+                }
+            case ETypeHighlight:
+                {
+                if( iWidgetModel && ( iWidgetModel->Count() > 0 ) )
+                    {
+                    status = EEventConsumed;
+                    }
+                break;
+                }
+            case ETypeSelect:
+                {
+                //Handling for this needs to be done, once it is implemented in widget
+                if( iWidgetModel && ( iWidgetModel->Count() > 0 ) )
+                    {
+                    // Handle enter key pressed
+                    iView->ProcessCommandL( EMPXCmdCommonEnterKey );
+                    status = EEventConsumed;
+                    }
+                break;
+                }
+            default:
+                status = EEventNotHandled;
+                break;
+            }
+        }
+
+    return status;
+    }
+
+// ---------------------------------------------------------------------------
+// From IAlfWidgetEventHandler
+// Make event handler interface using the specified type
+// ---------------------------------------------------------------------------
+//
+IAlfInterfaceBase* CMPXCommonContainerHitchcockImp::makeInterface(
+    const IfId& /*aType*/ )
+    {
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// From IAlfWidgetEventHandler
+// Sets the event handler data
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::setEventHandlerData(
+    const AlfWidgetEventHandlerInitData& /*aData*/ )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From IAlfWidgetEventHandler
+// Returns pointer to the event handler data
+// ---------------------------------------------------------------------------
+//
+AlfWidgetEventHandlerInitData*
+    CMPXCommonContainerHitchcockImp::eventHandlerData()
+   {
+   return NULL;
+   }
+
+// ---------------------------------------------------------------------------
+// From IAlfWidgetEventHandler
+// Sets the event handler data
+// ---------------------------------------------------------------------------
+//
+IAlfWidgetEventHandler::AlfEventHandlerType CMPXCommonContainerHitchcockImp::eventHandlerType()
+    {
+    return IAlfWidgetEventHandler::EPresentationEventHandler;
+    }
+
+// ---------------------------------------------------------------------------
+// From IAlfWidgetEventHandler
+// Sets the event handler data
+// ---------------------------------------------------------------------------
+//
+IAlfWidgetEventHandler::AlfEventHandlerExecutionPhase CMPXCommonContainerHitchcockImp::eventExecutionPhase()
+    {
+    return EBubblingPhaseEventHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// Provides the data to the model
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::ProvideData(
+    int aStartIndex,
+    int aCount,
+    MulDataPath /*aPath*/ )
+    {
+    TInt numOfItems = 0;
+    if ( iFilteredList )
+        {
+        numOfItems = iFilteredList->FilteredCount();
+        }
+    else
+        {
+        numOfItems = iListBoxArray->MediaArray().Count();
+        }
+
+    for ( int i = 0; i <  aCount ; ++i )
+        {
+        int index = aStartIndex+i;
+        if ( index >= 0 && index < numOfItems )
+            {
+            MulVisualItem* tempItem = CreateDisplayedItemL(index );
+            if ( tempItem )
+                {
+                auto_ptr<MulVisualItem> dataItem ( new (EMM) MulVisualItem(*tempItem));
+                iWidgetModel->SetData(index, dataItem);
+                delete tempItem;
+                }
+            }
+        }
+    iTopIndex = aStartIndex;
+    iBottomIndex = aStartIndex + aCount - 1;
+    }
+
+// -----------------------------------------------------------------------------
+// Preview thumbnail generation or loading is complete.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::ThumbnailPreviewReady( MThumbnailData& /*aThumbnail*/, TThumbnailRequestId /*aId*/ )
+    {
+    // Not used
+    }
+
+// -----------------------------------------------------------------------------
+// Final thumbnail bitmap generation or loading is complete.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId )
+    {
+    if ( aError == KErrNone && iContainerActive )
+        {
+        // Find the index
+        TInt index = KErrNotFound;
+        TInt count = iThumbnailReqArray.Count();
+        for ( TInt i = 0; i < count; i++ )
+            {
+            TThumnailReq req = iThumbnailReqArray[i];
+            if ( req.iReqId == aId )
+                {
+                index = req.iIndex;
+                break;
+                }
+            }
+
+        if ( index != KErrNotFound )
+            {
+            const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+            TInt realIndex = index;
+            if ( iFilteredList )
+                {
+                realIndex = iFilteredList->FilteredIndexToRealIndex(index);
+                }
+            CMPXMedia* currentMedia( mediaArray.AtL( realIndex ) );
+            if ( currentMedia->IsSupported( KMPXMediaGeneralId ) )
+                {
+                TMPXItemId currentId( currentMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                CFbsBitmap* bitmap = aThumbnail.DetachBitmap();
+
+                // Create the texture. The texture id will be
+                // set synchronously when the texture manager is notified
+                CAlfTexture& texture = iTextureManager->CreateTextureL(
+                                        realIndex, currentId, bitmap, NULL );
+                TInt textureId = texture.Id();
+                //iWidgetModel->Update(index, 1);
+                MulVisualItem* visualItem = new (EMM) MulVisualItem();
+                visualItem->SetAttribute( mulvisualitem::KMulIcon1, textureId, 0 );
+                iWidgetModel->SetData(index, auto_ptr<MulVisualItem>(visualItem) );
+                }
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// Create list box
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::NewFilteringWordL( const TDesC& aWord )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::NewFilteringWordL" );
+    if ( iFilteredList->HasMediaList() )
+        {
+        iFilteredList->SetFilteringWordL( aWord );
+        TInt filteredCount = iFilteredList->FilteredCount();
+        if ( filteredCount > 0 )
+            {
+            TInt index = iWidgetModel->Highlight();
+            if ( index >=  filteredCount )
+                {
+                iWidgetModel->SetHighlight( 0 );
+                }
+            iWidgetModel->Refresh( filteredCount );
+            }
+        else
+            {
+            TInt widgetCount = iWidgetModel->Count();
+            if ( widgetCount > 0 )
+                {
+                iWidgetModel->Remove( 0, widgetCount );
+                }
+            }
+        iThumbnailReqArray.Reset();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Create list box
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::CreateListBoxL()
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::CreateListBox" );
+    const char* KLoadNameList("mullistwidget");
+    const char* KLoadNameModel("mulmodel");
+    const char* KListViewNameMusic("mpxmullistviewmusic");
+    const char* KListViewNamePodcast("mpxmullistviewpodcast");
+
+    if ( iAlfEnvCreated )
+        {
+        return;
+        }
+    iAlfEnvCreated = ETrue;
+
+    TRect clientRect = ((CAknView*)iView)->ClientRect();
+
+    // Creating the Alf Environment
+    // Should be the first thing to be done before widgets can be created
+    iEnv = CAlfEnv::Static();
+
+    // This api will force glib to use the normal malloc for
+    // memory allocation,preventing ustring memory leak.
+    g_setenv("G_SLICE","always-malloc",1);
+
+    // Creating the Alf Display
+    // Display is needed to show anything related to Alf
+    // Avkon perceives the Alf Display as one CoeControl.
+    // It can't see widgets inside the Display
+    CAlfDisplay& disp = iEnv->NewDisplayL( clientRect, CAlfEnv::ENewDisplayAsCoeControl );
+    disp.SetClearBackgroundL( CAlfDisplay::EClearWithSkinBackground );
+
+    try
+        {
+        // Get widget factory from CAlfEnv
+        // Factory is then used to create the individual widgets & data model
+        IAlfWidgetFactory& widgetFactory = AlfWidgetEnvExtension::widgetFactory(*iEnv);
+
+        // Create view widget. CAlfEnv owns widget
+        if ( !iViewWidget && iCollectionType == MMPXCommonContainer::EMPXCommonContainerMusic )
+            {
+            iViewWidget = widgetFactory.createViewWidget(KListViewNameMusic, KListControlGroupIdMusic);
+            }
+        else if ( !iViewWidget && iCollectionType == MMPXCommonContainer::EMPXCommonContainerPodcast )
+            {
+            iViewWidget = widgetFactory.createViewWidget(KListViewNamePodcast, KListControlGroupIdPodcast);
+            }
+        else
+            {
+            User::Leave(KErrArgument);
+            }
+        }
+    catch (...)
+        {
+        User::Leave(KErrGeneral);
+        }
+    SizeChanged();
+    }
+
+// -----------------------------------------------------------------------------
+// Constructs Find box.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::ConstructFindBoxL( TBool /*aIsFindPopup*/ )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::ConstructFindBoxL" );
+    // Not used
+    }
+
+// -----------------------------------------------------------------------------
+// Creates icon array, populates iIconArray to be used by listbox
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::CreateIconArrayL()
+    {
+    if ( iListBoxArray )
+        {
+        iIconArray = iListBoxArray->CreateIconArrayL();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Creates the display item from the media
+// -----------------------------------------------------------------------------
+//
+MulVisualItem* CMPXCommonContainerHitchcockImp::CreateDisplayedItemL(
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::CreateDisplayedItemL" );
+
+    MulVisualItem* visualItem = new (EMM) MulVisualItem();
+
+    const CMPXMediaArray& mediaArray = iListBoxArray->MediaArray();
+    CMPXMedia* currentMedia = NULL;
+    if ( iFilteredList )
+        {
+        TInt realIndex = iFilteredList->FilteredIndexToRealIndex(aIndex);
+        currentMedia = mediaArray.AtL( realIndex );
+        }
+    else
+        {
+        currentMedia = mediaArray.AtL( aIndex );
+        }
+
+    SetTitleL( visualItem, currentMedia );
+    // Add detailed text to the list item, if available
+    AddDetailToDisplayedItemL( visualItem, currentMedia, aIndex );
+
+    return visualItem;
+    }
+
+// -----------------------------------------------------------------------------
+// Adds detail to the list item at the specified index
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::AddDetailToDisplayedItemL(
+    MulVisualItem* aVisualItem,
+    CMPXMedia* aMedia,
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::AddDetailToDisplayedItemL" );
+
+    switch ( iContext )
+        {
+        case EContextGroupCollection:
+            SetDetailIconL(aVisualItem, aIndex);
+            break;
+        case EContextGroupArtist:
+            SetDetailCountL(aVisualItem, aMedia);
+            break;
+        case EContextGroupAlbum:
+        	SetDetailArtistL(aVisualItem, aMedia);
+        	SetDetailThumbnailL(aVisualItem, aMedia, aIndex);
+            break;
+        case EContextGroupPlaylist:
+            SetDetailDurationL(aVisualItem, aMedia);
+            SetDetailIndicatorL(aVisualItem, aIndex);
+            break;
+        case EContextGroupSong:
+        case EContextItemAlbum:
+        case EContextItemPlaylist:
+        case EContextItemGenre:
+        case EContextItemComposer:
+            SetDetailArtistL(aVisualItem, aMedia);
+            SetDetailIndicatorL(aVisualItem, aIndex);
+            SetDetailThumbnailL(aVisualItem, aMedia, aIndex);
+            break;
+        case EContextGroupPodcast:
+            SetDetailCountL(aVisualItem, aMedia);
+            break;
+        case EContextGroupGenre:
+            SetDetailCountL(aVisualItem, aMedia);
+            break;
+        case EContextGroupComposer:
+            SetDetailCountL(aVisualItem, aMedia);
+            break;
+        case EContextItemArtist:
+            SetDetailCountL(aVisualItem, aMedia);
+            SetDetailThumbnailL(aVisualItem, aMedia, aIndex);
+            break;
+        case EContextItemSong:
+            SetDetailAlbumL(aVisualItem, aMedia);
+            SetDetailIndicatorL(aVisualItem, aIndex);
+            SetDetailThumbnailL(aVisualItem, aMedia, aIndex);
+            break;
+        case EContextItemPodcast:
+            SetDetailDurationL(aVisualItem, aMedia);
+            SetDetailIndicatorL(aVisualItem, aIndex);
+            SetDetailThumbnailL(aVisualItem, aMedia, aIndex);
+            break;
+		}
+	}
+
+// -----------------------------------------------------------------------------
+// Set title to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetTitleL(
+    MulVisualItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+	if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) )
+		{
+		// AK - Needs to be localized
+		TFileName titleText( KUnknown );
+		const TDesC& title = aMedia->ValueText( KMPXMediaGeneralTitle );
+		if ( title.Compare( KNullDesC ) != 0 )
+			{
+			titleText.Copy(title.Left(titleText.MaxLength()));
+			}
+		aVisualItem->SetAttribute( mulvisualitem::KMulTitle, titleText, 0);
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Count to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetDetailCountL(
+    MulVisualItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+	if ( aMedia->IsSupported( KMPXMediaGeneralCount ) )
+		{
+		// AK - Needs to be localized
+		TFileName detailText;
+		TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
+        TBuf<10> temp;
+        temp.AppendNum( count );
+        AknTextUtils::LanguageSpecificNumberConversion( temp );
+        detailText.Append( temp );
+
+        if ( iContext == EContextGroupPodcast )
+			{
+			detailText.Append( (count > 1 ) ? KEpisodes() : KEpisode() );
+			}
+        else if ( iContext == EContextGroupArtist )
+			{
+			detailText.Append( (count > 1 ) ? KAlbums() : KAlbum() );
+			}
+		else
+			{
+			detailText.Append( (count > 1 ) ? KSongs() : KSong() );
+			}
+		aVisualItem->SetAttribute( mulvisualitem::KMulDetail, detailText, 0);
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Artist to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetDetailArtistL(
+    MulVisualItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+	if ( aMedia->IsSupported( KMPXMediaMusicArtist ) )
+		{
+		// AK - Needs to be localized
+		TFileName detailText;
+		const TDesC& artist = aMedia->ValueText( KMPXMediaMusicArtist );
+		if ( artist.Compare( KNullDesC ) != 0 )
+			{
+			detailText.Copy(artist.Left(detailText.MaxLength()));
+	        aVisualItem->SetAttribute( mulvisualitem::KMulDetail, detailText, 0);
+			}
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Album to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetDetailAlbumL(
+    MulVisualItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+	if ( aMedia->IsSupported( KMPXMediaMusicAlbum ) )
+		{
+		// AK - Needs to be localized
+		TFileName detailText;
+		const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbum );
+		if ( album.Compare( KNullDesC ) != 0 )
+			{
+			detailText.Copy(album.Left(detailText.MaxLength()));
+	        aVisualItem->SetAttribute( mulvisualitem::KMulDetail, detailText, 0);
+			}
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Count + Duration to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetDetailDurationL(
+    MulVisualItem* aVisualItem,
+    CMPXMedia* aMedia )
+    {
+    if ( iContext == EContextGroupPlaylist &&
+         aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
+	     aMedia->IsSupported( KMPXMediaGeneralCount ) )
+		{
+		// AK - Needs to be localized
+		TBuf<85> detailText;
+		TInt count( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCount ) );
+		TBuf<10> temp;
+		temp.AppendNum( count );
+        AknTextUtils::LanguageSpecificNumberConversion( temp );
+        detailText.Append( temp );
+		detailText.Append( (count > 1 ) ? KSongsDash() : KSongDash() );
+
+		TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
+        UpdateTimeIndicatorsL(detailText, duration);
+		aVisualItem->SetAttribute( mulvisualitem::KMulDetail, detailText, 0);
+		}
+    else if ( iContext == EContextItemPodcast &&
+         aMedia->IsSupported( KMPXMediaGeneralDuration ) &&
+         aMedia->IsSupported( KMPXMediaGeneralSize ) )
+        {
+        TBuf<85> detailText;
+        TInt duration = aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
+        UpdateTimeIndicatorsL(detailText, duration);
+        detailText.Append( KMPXDash() );
+
+        TInt size( aMedia->ValueTObjectL<TInt>( KMPXMediaGeneralSize ) );
+        HBufC* sizeBuf = iCommonUiHelper->UnitConversionL( size );
+        TPtr sizePtr( sizeBuf->Des() );
+        detailText.Append( sizePtr );
+        delete sizeBuf;
+
+        aVisualItem->SetAttribute( mulvisualitem::KMulDetail, detailText, 0);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Format the duration to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::UpdateTimeIndicatorsL(
+    TDes& aBuf,
+    TInt aDuration )
+    {
+    TInt durationInSeconds = aDuration;
+    if ( durationInSeconds > 0 )
+        {
+        durationInSeconds /= 1000;   // MilliSeconds to second conversion
+        }
+    else if ( durationInSeconds < 0 )
+        {
+        durationInSeconds = 0;
+        }
+    if ( durationInSeconds == 0 )
+        {
+        TLocale locale;
+        TBuf<KMPXTimeIndicatorLength> pos;
+        TChar separator = locale.TimeSeparator( KMPXMinSecSeparatorIndex );
+        aBuf.Append(KMPXZeroDurationMark);
+        aBuf.Append( separator );
+        aBuf.Append(KMPXZeroDurationMark);
+        }
+    else
+        {
+        CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode = CMPXCommonUiHelper::EMPXDuratAuto;
+        if ( durationInSeconds > KOneHourInSeconds )
+            {
+            durationMode = CMPXCommonUiHelper::EMPXDuratHMS;
+            }
+        // Convert ellapsed time to texts
+        HBufC* position = iCommonUiHelper->DisplayableDurationL( durationInSeconds, durationMode );
+        aBuf.Append(position->Des());
+        delete position;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Indicator to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetDetailIndicatorL(
+    MulVisualItem* aVisualItem,
+    TInt aIndex )
+    {
+    // Reset the indicators
+    aVisualItem->SetAttribute( mulvisualitem::KMulIndicator1, -1, 0 );
+    aVisualItem->SetAttribute( mulvisualitem::KMulIndicator2, -1, 0 );
+
+    // Get icon indices
+    TInt realIndex = aIndex;
+    if ( iFilteredList )
+        {
+		realIndex = iFilteredList->FilteredIndexToRealIndex(aIndex);
+        }
+    RArray<TInt> iconIndices = iViewContainer->IndicatorsL( realIndex );
+    CleanupClosePushL( iconIndices );
+
+    TInt iconCount = iconIndices.Count();
+    if ( iconCount > 2 )
+        {
+        // Restrict max number of icons to 2
+        iconCount = 2;
+        }
+    if ( iconCount > 0 )
+    	{
+		for ( TInt iconIndex = 0; iconIndex < iconCount; iconIndex++ )
+			{
+			TInt index = iconIndices[iconIndex];
+			TInt textureIndex = index;
+			if ( iContext == EContextGroupPodcast || iContext == EContextItemPodcast )
+			    {
+			    // Shift the range for podcast icons to avoid textureId
+			    // clash with collection icons
+			    textureIndex += 100;
+			    }
+
+			// Check if texture already exists for the icon
+			TInt textureId( iTextureManager->IconTextureId( textureIndex ) );
+			if ( textureId == KErrNotFound )
+				{
+				CGulIcon* icon = (*iIconArray)[index];
+				CFbsBitmap* bitmap = icon->Bitmap();
+				CFbsBitmap* mask = icon->Mask();
+
+				if( bitmap && mask )
+					{
+					// Need to set the size of the bitmap used in CGulIcon to enable display
+					AknIconUtils::SetSize( bitmap, TSize(iIndicatorHeight, iIndicatorWidth) );
+					AknIconUtils::SetSize( mask, TSize(iIndicatorHeight, iIndicatorWidth) );
+
+					// Bitmap ownership is transferred to the texture manager.
+					CFbsBitmap* bitmapTemp = new (ELeave) CFbsBitmap();
+					CFbsBitmap* maskTemp = new (ELeave) CFbsBitmap();
+					bitmapTemp->Duplicate( bitmap->Handle() );
+					maskTemp->Duplicate( mask->Handle() );
+
+					// Create the texture. The texture id will be
+					// set synchronously when the texture manager is notified
+					CAlfTexture& texture = iTextureManager->CreateIconTextureL(
+					        textureIndex, bitmapTemp, maskTemp );
+					textureId = texture.Id();
+					}
+				}
+
+			// Set the texture id
+            switch ( iconIndex )
+                {
+                case 0:
+                    aVisualItem->SetAttribute( mulvisualitem::KMulIndicator1, textureId, 0 );
+                    break;
+                case 1:
+                    aVisualItem->SetAttribute( mulvisualitem::KMulIndicator2, textureId, 0 );
+                    break;
+                }
+			}
+		}
+    CleanupStack::PopAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Icon to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetDetailIconL(
+    MulVisualItem* aVisualItem,
+    TInt aIndex )
+    {
+    // Get icon indices
+    TInt iconIndex = aIndex;
+     switch ( aIndex )
+        {
+        case 0:
+            iconIndex = EMPXClvIconArtist;
+            break;
+        case 1:
+            iconIndex = EMPXClvIconAlbum;
+            break;
+        case 2:
+            iconIndex = EMPXClvIconPlaylist;
+            break;
+        case 3:
+            iconIndex = EMPXClvIconSongs;
+            break;
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        case 4:
+            iconIndex = EMPXClvIconPodcasts;
+            break;
+#endif
+        case 5:
+            iconIndex = EMPXClvIconGenre;
+            break;
+        case 6:
+            iconIndex = EMPXClvIconComposer;
+            break;
+        }
+
+    // Check if texture already exists for the icon
+    TInt textureId( iTextureManager->IconTextureId( iconIndex ) );
+    if ( textureId == KErrNotFound )
+        {
+        CGulIcon* icon = (*iIconArray)[iconIndex];
+        CFbsBitmap* bitmap = icon->Bitmap();
+        CFbsBitmap* mask = icon->Mask();
+
+        if( bitmap && mask )
+            {
+			// Need to set the size of the bitmap used in CGulIcon to enable display
+			AknIconUtils::SetSize( bitmap, TSize(iIconHeight, iIconWidth) );
+    		AknIconUtils::SetSize( mask, TSize(iIconHeight, iIconWidth) );
+
+            // Bitmap ownership is transferred to the texture manager.
+            CFbsBitmap* bitmapTemp = new (ELeave) CFbsBitmap();
+            CFbsBitmap* maskTemp = new (ELeave) CFbsBitmap();
+            bitmapTemp->Duplicate( bitmap->Handle() );
+            maskTemp->Duplicate( mask->Handle() );
+
+            // Create the texture. The texture id will be
+            // set synchronously when the texture manager is notified
+            CAlfTexture& texture = iTextureManager->CreateIconTextureL(
+                    iconIndex, bitmapTemp, maskTemp );
+            textureId = texture.Id();
+            }
+        }
+
+    // Set the texture id
+    aVisualItem->SetAttribute( mulvisualitem::KMulIcon1, textureId, 0 );
+    }
+
+// -----------------------------------------------------------------------------
+// Set Detail - Thumbnail to the visual item
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetDetailThumbnailL(
+    MulVisualItem* aVisualItem,
+    CMPXMedia* aMedia,
+    TInt aIndex )
+    {
+    TMPXItemId currentId( aMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+    // Check if texture already exists for the thumbnail
+    TInt textureId( iTextureManager->TextureId( currentId ) );
+    if ( textureId != KErrNotFound )
+        {
+        // Set the texture id
+        aVisualItem->SetAttribute( mulvisualitem::KMulIcon1, textureId, 0 );
+        }
+    else
+        {
+        if ( aMedia->IsSupported( KMPXMediaMusicAlbumArtFileName ) )
+            {
+            const TDesC& album = aMedia->ValueText( KMPXMediaMusicAlbumArtFileName );
+            if ( album.Compare( KNullDesC ) != 0 )
+                {
+                CThumbnailObjectSource* source = CThumbnailObjectSource::NewLC( album, KMPXAlbumMimeType );
+                TInt ret = NULL;
+                TThumnailReq req;
+                req.iIndex = aIndex;
+                // Set priority based on the index so that the smaller indexes are loaded first
+                req.iReqId = iThumbnailManager->GetThumbnailL( *source, (TAny*)ret, -aIndex );
+                iThumbnailReqArray.AppendL(req);
+                CleanupStack::PopAndDestroy( source );
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Sets the current category.
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::SetCollectionContextL()
+    {
+    MPX_FUNC( "CMPXCommonContainerHitchcockImp::SetCollectionContextL" );
+
+    const CMPXMedia& media = iListBoxArray->ContainerMedia();
+
+    TMPXGeneralType containerType( EMPXNoType );
+    if ( media.IsSupported( KMPXMediaGeneralType ) )
+        {
+        containerType = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+        }
+
+    TMPXGeneralCategory containerCategory( EMPXNoCategory );
+    if( media.IsSupported( KMPXMediaGeneralCategory ) )
+        {
+        containerCategory = media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+        }
+    MPX_DEBUG3( "CMPXCommonContainerHitchcockImp::SetCollectionContextL container type = %d, category = %d",
+            containerType, containerCategory );
+
+    TBool isPodcast = EFalse;
+    TMPXPodcastCategory podcastCategory( EMPXUnknown );
+    if ( media.IsSupported( KMPXMediaPodcastType ) )
+        {
+        isPodcast = ETrue;
+        if( media.IsSupported( KMPXMediaPodcastCategoryGroup ) )
+            {
+            podcastCategory = media.ValueTObjectL<TMPXPodcastCategory>( KMPXMediaPodcastCategoryGroup );
+            }
+        }
+    MPX_DEBUG3( "CMPXCommonContainerHitchcockImp::SetCollectionContextL container podcast = %d, category = %d",
+            isPodcast, podcastCategory );
+
+    if ( !isPodcast )
+        {
+        if ( containerType == EMPXGroup )
+            {
+            switch (containerCategory)
+                {
+                case EMPXCollection:
+                    iContext = EContextGroupCollection;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate3 );
+                    break;
+                case EMPXArtist:
+                    iContext = EContextGroupArtist;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate2 );
+                    break;
+                case EMPXAlbum:
+                    iContext = EContextGroupAlbum;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate6 );
+                    break;
+                case EMPXPlaylist:
+                    iContext = EContextGroupPlaylist;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate2 );
+                    break;
+                case EMPXSong:
+                    iContext = EContextGroupSong;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate3 );
+                    break;
+                case EMPXGenre:
+                    iContext = EContextGroupGenre;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate2 );
+                    break;
+                case EMPXComposer:
+                    iContext = EContextGroupComposer;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate2 );
+                    break;
+                default:
+                    User::Leave(KErrNotSupported);
+                    break;
+                }
+            }
+        else if ( containerType == EMPXItem )
+            {
+            switch (containerCategory)
+                {
+                case EMPXArtist:
+                    iContext = EContextItemArtist;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate6 );
+                    break;
+                case EMPXAlbum:
+                    iContext = EContextItemAlbum;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate3 );
+                    break;
+                case EMPXPlaylist:
+                    iContext = EContextItemPlaylist;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate3 );
+                    break;
+                case EMPXSong:
+                    iContext = EContextItemSong;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate3 );
+                    break;
+                case EMPXGenre:
+                    iContext = EContextItemGenre;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate3 );
+                    break;
+                case EMPXComposer:
+                    iContext = EContextItemComposer;
+                    iWidgetModel->SetTemplate( mulwidget::KTemplate3 );
+                    break;
+                default:
+                    User::Leave(KErrNotSupported);
+                    break;
+                }
+            }
+        }
+    else
+        {
+        if ( (containerType == EMPXGroup) && (podcastCategory == EMPXTitle) )
+            {
+            iContext = EContextGroupPodcast;
+            iWidgetModel->SetTemplate( mulwidget::KTemplate2 );
+            }
+        else if ( (containerType == EMPXItem) && (podcastCategory == EMPXEpisode) )
+            {
+            iContext = EContextItemPodcast;
+            iWidgetModel->SetTemplate( mulwidget::KTemplate3 );
+            }
+        else
+            {
+            User::Leave(KErrNotSupported);
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::ActivateSearchFieldL()
+    {
+    if ( ! iSearchFieldWrapper->IsSearchFieldActive() )
+        {
+        TRect clientRect = ((CAknView*)iView)->ClientRect();
+        iSearchFieldWrapper->ActivateSearchFieldL();
+
+        iViewWidget->setRect(
+            iSearchFieldWrapper->GetListRect( ETrue, clientRect ) );
+        iSearchFieldWrapper->SetRect(
+            iSearchFieldWrapper->GetSearchFieldRect( ETrue, clientRect ) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonContainerHitchcockImp::DeactivateSearchField()
+    {
+    TRect clientRect = ((CAknView*)iView)->ClientRect();
+    iViewWidget->setRect(
+        iSearchFieldWrapper->GetListRect( EFalse, clientRect ) );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainermediahelper.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of MPX common container Media helper.
+*
+*/
+
+
+#include <mpxcollectionpath.h>
+#include <mpxcollectionutility.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxlog.h>
+#include "mpxcommoncontainer.h"
+#include "mpxcommoncontainermediahelper.h"
+
+// CONSTANTS
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor
+// ----------------------------------------------------------------------------
+//
+CMPXCommonContainerMediaHelper* CMPXCommonContainerMediaHelper::NewL( 
+    MMPXCommonContainer* aCommonContainer )
+    {    
+    CMPXCommonContainerMediaHelper* self = 
+        new (ELeave) CMPXCommonContainerMediaHelper( aCommonContainer );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Constructor. 
+// ----------------------------------------------------------------------------
+//
+CMPXCommonContainerMediaHelper::CMPXCommonContainerMediaHelper(
+    MMPXCommonContainer* aCommonContainer )
+    : iCommonContainer( aCommonContainer )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// 2nd phase constructor. 
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerMediaHelper::ConstructL()
+    {
+    iCollectionUtility = MMPXCollectionUtility::NewL( this );
+
+#ifdef __USE_MESSAGE_SUBSCRIPTION
+    // This class does not care about collection messages
+    iCollectionUtility->Collection().ClearSubscriptionsL();
+#endif
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXCommonContainerMediaHelper::~CMPXCommonContainerMediaHelper()
+    {
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+    }
+    
+// ----------------------------------------------------------------------------
+// Retrieves the media given the current path, and upon return,
+// either calls back the observer, or broadcasts the message to 
+// the given client list
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerMediaHelper::MediaL( 
+    const TMPXItemId& aItemId, 
+    RArray<TMPXAttribute> aAttrs,
+    CMPXMedia* aAttrSpecs )
+    {
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::MediaL(): Entering");
+
+    CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();  
+    CleanupStack::PushL( cPath );
+    cPath->Set( aItemId );
+    iCollectionUtility->Collection().MediaL( *cPath, aAttrs.Array(), aAttrSpecs );
+    CleanupStack::PopAndDestroy( cPath );
+
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::MediaL(): Exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Updates the specified media with the results from the search
+// criteria
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerMediaHelper::UpdateMediaL( 
+    CMPXMedia* aMedia, 
+    RArray<TMPXAttribute> aSearchAttrs,
+    CMPXMedia* aSearchAttrSpecs )
+    {
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::UpdateMediaL(): Entering");
+
+    CMPXMedia* mediaQuery = CMPXMedia::NewL();
+    CleanupStack::PushL( mediaQuery );
+    mediaQuery->SetTObjectValueL(KMPXMediaGeneralType, EMPXGroup);        
+    mediaQuery->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, EMPXSong);
+    TMPXItemId mediaId = *aMedia->Value<TMPXItemId>( KMPXMediaGeneralId );
+    mediaQuery->SetTObjectValueL(KMPXMediaGeneralId, mediaId );
+    mediaQuery->SetTObjectValueL(KMPXMediaGeneralContainerId, mediaId );
+    mediaQuery->SetCObjectValueL<CMPXAttributeSpecs>(
+        KMPXCommandMediaAttributeSpecs, aSearchAttrSpecs );
+
+    // Find the attributes associated with the media
+    CMPXMedia* queryResult = iCollectionUtility->Collection().FindAllL( 
+        *mediaQuery, aSearchAttrs.Array() );
+    CleanupStack::PopAndDestroy( mediaQuery );
+    
+    CleanupStack::PushL( queryResult );
+    
+    // update media with the query results
+    const CMPXMediaArray* medias =
+        queryResult->Value<CMPXMediaArray>(KMPXMediaArrayContents);
+    User::LeaveIfNull(const_cast<CMPXMediaArray*>(medias));
+    
+    aMedia->SetCObjectValueL(
+        KMPXMediaArrayContents, const_cast<CMPXMediaArray*>(medias));
+    aMedia->SetTObjectValueL(
+        KMPXMediaArrayCount, medias->Count());
+        
+    CleanupStack::PopAndDestroy( queryResult );
+
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::UpdateMediaL(): Exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Cancels all outstanding requests
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerMediaHelper::CancelRequests()
+    {
+    MPX_FUNC_EX("CMPXCommonContainerMediaHelper::CancelRequests()");
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Collection().CancelRequest();
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerMediaHelper::HandleCollectionMessage( 
+    CMPXMessage* /*aMsg*/,
+    TInt /*aErr*/)
+    {
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::HandleCollectionMessageL(CMPXMessage): Entering");
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::HandleCollectionMessageL(CMPXMessage): Exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerMediaHelper::HandleOpenL( 
+    const CMPXMedia& /*aEntries*/,
+    TInt /*aIndex*/, 
+    TBool /*aComplete*/, 
+    TInt /*aError*/ )
+    {
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::HandleOpenL(): Entering");
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::HandleOpenL(): Exiting");
+    }
+    
+// ----------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerMediaHelper::HandleOpenL( 
+    const CMPXCollectionPlaylist& /*aPlaylist*/,
+    TInt /*aError*/ )
+    {
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::HandleOpenL(): Entering");
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::HandleOpenL(): Exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerMediaHelper::HandleCommandComplete( 
+    CMPXCommand* /*aCommandResult*/, 
+    TInt /*aError*/ )
+    {
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::HandleCommandComplete(): Entering");
+    MPX_DEBUG1("CMPXCommonContainerMediaHelper::HandleCommandComplete(): Exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// From MMPXCollectionMediaObserver
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerMediaHelper::HandleCollectionMediaL(
+    const CMPXMedia& aMedia, 
+    TInt aError )    
+    {
+    MPX_FUNC_EX("CMPXCommonContainerMediaHelper::HandleCollectionMediaL");
+    MPX_DEBUG2("CMPXCommonContainerMediaHelper::HandleCollectionMediaL(): error %d", aError);
+
+    if( aError == KErrNone )
+        {
+        // Find the media in the common container
+        if( aMedia.IsSupported( KMPXMediaGeneralId ) )
+            {
+            const TMPXItemId mediaId( 
+                aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+
+            const CMPXMediaArray& mediaArray = 
+                iCommonContainer->ListBoxArray()->MediaArray();
+            const TInt count( mediaArray.Count() );
+            
+            for( TInt index = 0; index < count; index++ )
+                {
+                CMPXMedia* media( mediaArray.AtL( index ) );
+                if( media->IsSupported( KMPXMediaGeneralId ) )
+                    {
+                    TMPXItemId containerId(
+                        media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                    if ( mediaId == containerId )
+                        {
+                        // Update the list box item
+                        *media = aMedia;
+                        // Refresh the list box item
+                        iCommonContainer->DrawLbxItem( index );
+                        break;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainersearchfield.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,688 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class that implements Search Field feature.
+*
+*/
+
+
+// INCLUDE FILES
+#include <eikmenub.h>
+#include <eikdef.h>
+#include <akninfrm.h>
+#include <eikon.rsg>
+#include <eikenv.h>
+#include <txtglobl.h>
+#include <gulfont.h>
+#include <txtfrmat.h>
+#include <eikgted.h>
+#include <aknconsts.h>
+#include <akneditstateindicator.h>
+#include <aknslistboxbackgroundcontrolcontext.h>
+#include <aknlayout2def.h>
+#include <aknlayout2scalabledef.h>
+#include <aknlayoutscalable_avkon.cdl.h>
+#include <featmgr.h>
+#include <fepbase.h>
+#include <aknutils.h>
+#include "mpxcommoncontainersearchfieldwrapper.h"
+#include "mpxcommoncontainersearchfield.h"
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CMPXCommonContainerSearchField* CMPXCommonContainerSearchField::NewL(
+    CMPXCommonContainerSearchFieldWrapper* aParent,
+    TBool aFindKeywordMode )
+    {
+    CMPXCommonContainerSearchField* self = new (ELeave) CMPXCommonContainerSearchField( aFindKeywordMode );
+    CleanupStack::PushL( self );
+
+    self->ConstructL( aParent );
+    self->MakeVisibleL( EFalse );
+    self->SetFocus( EFalse );
+
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::MakeVisibleL( TBool aVisible )
+    {
+    if ( aVisible )
+        {
+        HandleFindSizeChanged();
+        SetTextL( KNullDesC );
+        }
+
+    // if ( AknLayoutUtils::PenEnabled() )
+        // {
+        // Note, commented out, caused LSK and RSK problems.
+        // SetPointerCapture( aVisible );
+        // Note, commented out, activated Virtual KeyBoard right away.
+        // if ( aVisible )
+            // {
+            // ActivateVkbL();
+            // }
+        // }
+
+    CCoeControl::MakeVisible( aVisible );
+
+    iSearchFieldKeyHandler->Reset();
+    iSearchFieldKeyHandler->EnableL( aVisible );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::MakeVisible( TBool aVisible )
+    {
+    TRAP_IGNORE( MakeVisibleL( aVisible ) );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CMPXCommonContainerSearchField::~CMPXCommonContainerSearchField()
+    {
+    delete iSearchFieldKeyHandler;
+    delete iEditor;
+    delete iInputFrame;
+	delete iPrevKeyword;
+	CCoeEnv::Static()->RemoveFepObserver(
+	    static_cast<MCoeFepObserver &>( *this ) );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+CMPXCommonContainerSearchField::CMPXCommonContainerSearchField( TBool aFindKeywordMode )
+ :  iFindKeywordMode( aFindKeywordMode ),
+    iHandleFEPFind( ETrue )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::ConstructL( CMPXCommonContainerSearchFieldWrapper* aParent )
+    {
+    CreateWindowL();
+
+    SetMopParent( aParent );
+    iParent = aParent;
+
+    iEditor = new (ELeave) CEikGlobalTextEditor;
+
+    iInputFrame = CAknInputFrame::NewL( iEditor,
+                                        EFalse,
+                                        KAvkonBitmapFile,
+                                        EMbmAvkonQgn_indi_find_glass,
+                                        EMbmAvkonQgn_indi_find_glass_mask,
+                                        CAknInputFrame::EPopupLayout );
+    iInputFrame->SetContainerWindowL( *this );
+
+    AknEditUtils::ConstructEditingL ( iEditor,
+                                      40, // TODO
+                                      1,
+                                      EAknEditorCharactersLowerCase,
+                                      EAknEditorAlignRight,
+                                      EFalse,
+                                      ETrue,
+                                      EFalse );
+    iEditor->SetContainerWindowL( *this );
+    iEditor->SetObserver( this );
+    iEditor->SetBorder( TGulBorder::ENone );
+    iEditor->SetAknEditorCase( EAknEditorLowerCase );
+    iEditor->SetAknEditorInputMode( EAknEditorTextInputMode );
+
+    // Disallow chinese input.
+    if ( FeatureManager::FeatureSupported( KFeatureIdAvkonApac ) )
+        {
+        iEditor->SetAknEditorAllowedInputModes( EAknEditorTextInputMode |
+                                                EAknEditorNumericInputMode );
+        }
+
+    // Find keyword should use EAknEditorFlagDefault since in find
+    // input we allow all types of input.
+   	iEditor->SetAknEditorFlags( ( ( iFindKeywordMode ) ?
+   	                                    EAknEditorFlagDefault :
+   	                                    EAknEditorFlagLatinInputModesOnly ) |
+   	                            EAknEditorFlagUseSCTNumericCharmap );
+    iEditor->SetAknEditorPermittedCaseModes( EAknEditorUpperCase |
+                                             EAknEditorLowerCase );
+
+    iSearchFieldKeyHandler = new (ELeave) CMPXCommonContainerSearchFieldKeyHandler( *this );
+
+    /* TODO?
+    iAvkonAppUi->AddToStackL( iSearchFieldKeyHandler,
+                              ECoeStackPriorityFep + 1,
+                              ECoeStackFlagRefusesFocus );
+    */
+
+    iEditor->SetEdwinObserver( iSearchFieldKeyHandler );
+	iEditor->SetSkinBackgroundControlContextL( NULL );
+
+	CCoeEnv::Static()->AddFepObserverL(
+	    static_cast<MCoeFepObserver &>( *this ) );
+
+	iPrevKeyword = KNullDesC().AllocL();
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::SetOrdinalPosition( TInt aPos )
+    {
+    Window().SetOrdinalPosition( aPos );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::HandleFindSizeChanged()
+    {
+    if ( IsVisible() )
+        {
+        TRect searchRect = iParent->GetSearchFieldRect( ETrue,
+                                                        iParent->ClientRect() );
+        AknLayoutUtils::LayoutControl( this,
+                                       searchRect,
+                                       AknLayout::popup_find_window() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::EnableKeyEventHandlerL( TBool aEnable )
+    {
+    iSearchFieldKeyHandler->EnableL( aEnable );
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::HandleControlEventL( CCoeControl* /*aControl*/,
+                                             TCoeEvent aEventType )
+    {
+	if ( iFindKeywordMode )
+		{
+	    if ( iEditor->AknEditorCurrentInputMode() == EAknEditorCalculatorNumberModeKeymap
+            // When the user copies and paste's content to the find dialog, the editor
+            // is in Text Input mode, The engine should still get the find keyword request
+            || iEditor->AknEditorCurrentInputMode() == EAknEditorTextInputMode )
+	    	{
+		    if ( aEventType == MCoeControlObserver::EEventStateChanged )
+		        {
+		        HBufC* newText = GetTextLC();
+		        if ( ! newText )
+		            {
+		            newText = KNullDesC().AllocLC();
+		            }
+
+		        if ( iPrevKeyword->Compare( *newText ) != 0 )
+		        	{
+		            delete iPrevKeyword;
+		            iPrevKeyword = newText;
+		            CleanupStack::Pop( newText );
+
+					iParent->FindKeywordL( *newText );
+
+					iHandleFEPFind = EFalse;
+		        	}
+				else
+					{
+					CleanupStack::PopAndDestroy( newText );
+					}
+		        }
+	    	}
+		}
+
+    if ( aEventType == EEventRequestFocus )
+        {
+        FocusChanged( EDrawNow );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CMPXCommonContainerSearchField::OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                                TEventCode aType )
+    {
+    // Escape key event handling.
+    if ( aType == EEventKey && aKeyEvent.iCode == EKeyEscape )
+        {
+        // TODO: Check that closing Search Field goes ok with this case.
+
+        CCoeEnv::Static()->AppUi()->RemoveFromStack( this );
+        MakeVisible( EFalse );
+        SetFocus( EFalse );
+        return EKeyWasConsumed;
+        }
+
+	if ( aType == EEventKey )
+		{
+		/* TODO: This feature not needed?
+		// Handle up and down arow keys to search for next and previous keywords.
+		if ( aKeyEvent.iCode == EKeyUpArrow )
+			{
+			// Find previous keyword.
+			iParent->FindKeywordL( NULL, EFalse );
+			iHandleFEPFind = EFalse;
+			return EKeyWasConsumed;
+			}
+		if ( aKeyEvent.iCode == EKeyDownArrow )
+			{
+			// Find next keyword.
+			iParent->FindKeywordL( NULL, ETrue );
+			iHandleFEPFind = EFalse;
+			return EKeyWasConsumed;
+			}
+		*/
+		}
+
+	return iEditor->OfferKeyEventL( aKeyEvent, aType );
+	}
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::HandlePointerEventL( const TPointerEvent& aPointerEvent )
+    {
+    if ( ! AknLayoutUtils::PenEnabled() )
+        {
+        return;
+        }
+
+    // Pointer is inside the Search Field.
+    if ( Rect().Contains( aPointerEvent.iPosition ) )
+        {
+        iSearchFieldKeyHandler->EnableL( ETrue );
+        iEditor->HandlePointerEventL( aPointerEvent );
+        iSearchFieldKeyHandler->SetFirstKeyEvent( EFalse );
+        }
+    else
+        {
+        // Pointer outside of control, close control?
+        }
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerSearchField::CountComponentControls() const
+    {
+    return 2; // iEditor and iInputFrame.
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+CCoeControl* CMPXCommonContainerSearchField::ComponentControl( TInt aIndex ) const
+    {
+    switch ( aIndex )
+        {
+        case 0:
+            {
+			return iInputFrame;
+            }
+        case 1:
+            {
+            return iEditor;
+            }
+        default:
+            {
+            return NULL;
+            }
+        }
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::SizeChanged()
+    {
+    iInputFrame->SetRect( Rect() );
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::FocusChanged( TDrawNow aDrawNow )
+    {
+    // this is a workaround
+    TRAP_IGNORE( iSearchFieldKeyHandler->EnableL( IsFocused() ) );
+    CCoeControl::FocusChanged( aDrawNow );
+    iEditor->SetFocus( IsFocused() );
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerSearchField::TextLength() const
+    {
+    return iEditor->TextLength();
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXCommonContainerSearchField::GetTextLC() const
+    {
+    HBufC *retVal = NULL;
+
+    if ( TextLength() || iFindKeywordMode )
+        {
+        retVal = HBufC::NewLC( TextLength() + 1 );
+        TPtr ptr = retVal->Des();
+        iEditor->GetText( ptr );
+        ptr.ZeroTerminate();
+        }
+
+    return retVal;
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::SetTextL( const TDesC& aTxt )
+    {
+    iEditor->SetTextL( &aTxt );
+
+    TInt curPos = TextLength();
+    iEditor->SetSelectionL( curPos, curPos );
+	iEditor->DrawNow();
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::SelectAllL()
+    {
+    iEditor->SelectAllL();
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::SetInfoTextL( const TDesC& aText )
+    {
+    iInputFrame->SetInfoTextL( aText );
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::ClipboardL( CEikEdwin::TClipboardFunc aClipboardFunc )
+    {
+    iEditor->ClipboardL( aClipboardFunc );
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+CEikEdwin* CMPXCommonContainerSearchField::Editor() const
+    {
+    return iEditor;
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+CMPXCommonContainerSearchFieldKeyHandler::CMPXCommonContainerSearchFieldKeyHandler( CMPXCommonContainerSearchField& aSearchField )
+ :  iEnabled( EFalse ),
+    iFirstKeyEvent( ETrue ),
+    iLeftRightEvent ( EFalse ),
+    iSearchField( aSearchField )
+    {
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CMPXCommonContainerSearchFieldKeyHandler::OfferKeyEventL( const TKeyEvent& aKeyEvent,
+                                                          TEventCode aType )
+    {
+    TKeyResponse response( EKeyWasNotConsumed );
+    iLeftRightEvent = EFalse;
+
+    if ( iEnabled && aType == EEventKey )
+        {
+        switch( aKeyEvent.iCode )
+            {
+            case EKeyUpArrow:
+            case EKeyDownArrow:
+                {
+                iFirstKeyEvent = EFalse;
+                break;
+                }
+
+            case EKeyLeftArrow:
+            case EKeyRightArrow:
+                {
+                iFirstKeyEvent = EFalse;
+                iLeftRightEvent = ETrue;
+
+				// Below added to compensate for a weird key event situation:
+				//   For some reason the CMPXCommonContainerSearchField::OfferKeyEventL function
+				//   is not being called for an EEventKey when you press the left/right
+				//   arrows in the menupane produced to paste previously used special
+				//   chars (this is brought up by pressing the pen button on the phone).
+				//   This only happens when the cursor is in the first or last position in
+				//   the Search Field with text in it.
+				//   Therefore, in this particular scenario, we need to process the EEventKey
+				//   here since we will not be able to in CMPXCommonContainerSearchField::OfferKeyEventL
+                // TODO if ( CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->IsFocused())
+		        // TODO    {
+		        // TODO    response = CBrowserAppUi::Static()->ContentView()->MenuBar()->MenuPane()->OfferKeyEventL( aKeyEvent, aType );
+		        // TODO    }
+                break;
+                }
+
+            case EKeyBackspace:
+            case EKeyDelete:
+                {
+                if ( iFirstKeyEvent )
+                    {
+                    iFirstKeyEvent = EFalse;
+                    iCoeEnv->SimulateKeyEventL( aKeyEvent, aType );
+                    response = EKeyWasConsumed;
+                    }
+                break;
+                }
+
+            default:
+                {
+                if ( iFirstKeyEvent )
+                    {
+                    if ( TChar( aKeyEvent.iCode ).IsPrint() )
+                        {
+                        iFirstKeyEvent = EFalse;
+                        response = EKeyWasConsumed;
+                        iCoeEnv->SimulateKeyEventL( aKeyEvent, aType );
+                        }
+                    }
+                break;
+                }
+            }
+        }
+
+    return response;
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchFieldKeyHandler::HandleEdwinEventL( CEikEdwin* /*aEdwin*/,
+                                                     TEdwinEvent aEventType )
+    {
+    if ( aEventType == EEventTextUpdate )
+        {
+        // if text changed in the editor we don't have to handle clear key anymore.
+        iFirstKeyEvent = EFalse;
+
+        // For some reason typing letters on the qwerty keyboard of one product
+        // does not trigger the HandleCompletionOfTransactionL() or the
+        // HandleControlEventL(). Therefore we must check the text here.
+        iSearchField.UpdateFindKeywordL();
+        }
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchFieldKeyHandler::EnableL( TBool aEnable )
+    {
+    iEnabled = aEnable;
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchFieldKeyHandler::Reset()
+    {
+    iFirstKeyEvent = ETrue;
+    }
+	
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool CMPXCommonContainerSearchFieldKeyHandler::IsLeftRightEvent()
+    {
+    return iLeftRightEvent;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchFieldKeyHandler::SetFirstKeyEvent( TBool aFirstKeyEvent )
+    {
+    iFirstKeyEvent = aFirstKeyEvent;
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::HandleResourceChange( TInt aType )
+	{
+	CCoeControl::HandleResourceChange( aType );
+	}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::HandleStartOfTransactionL()
+	{
+	}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::HandleCompletionOfTransactionL()
+	{
+	if ( iParent && iFindKeywordMode && this->IsVisible() && iHandleFEPFind )
+		{
+		UpdateFindKeywordL();
+		}
+
+    iHandleFEPFind = ETrue;
+	}
+
+// ----------------------------------------------------------------------------
+// Simulates pointer event to force VKB.
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::ActivateVkbL()
+    {
+    if ( iEditor && iEditor->TextView() )
+        {
+        // Make sure observer is set.
+        iCoeEnv->SyncNotifyFocusObserversOfChangeInFocus();
+
+       	// First get point at cursor location.
+        TInt pos = iEditor->CursorPos();
+       	CTextView* textView = iEditor->TextView();
+       	TPoint curPos;
+       	textView->DocPosToXyPosL( pos, curPos );
+
+       	TPointerEvent pe;
+       	pe.iPosition = curPos;
+
+       	pe.iType = TPointerEvent::EButton1Down;
+       	iEditor->HandlePointerEventL( pe );
+
+        // VKB will only activate is nothing selected
+        iEditor->SetSelectionL( pos, pos );
+
+       	pe.iType = TPointerEvent::EButton1Up;
+       	iEditor->HandlePointerEventL( pe );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+//
+// ----------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchField::UpdateFindKeywordL()
+    {
+    HBufC* newKeyword = GetTextLC();
+
+    if ( newKeyword->Compare( *iPrevKeyword ) != 0 )
+        {
+        delete iPrevKeyword;
+        iPrevKeyword = newKeyword;
+        CleanupStack::Pop( newKeyword );
+
+        iParent->FindKeywordL( *newKeyword );
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy( newKeyword );
+        }
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainerssearchfieldwrapper.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,240 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wrapper class for Search Field. Handles search field
+*                activation, deactivation and size. Wrapper is a window owning
+*                control.
+*
+*/
+
+
+#include <aknutils.h>
+#include <aknlayoutscalable_avkon.cdl.h>
+#include "mpxcommoncontainersearchfieldwrapper.h"
+#include "mpxcommoncontainersearchfield.h"
+
+// CONSTANTS
+_LIT( KMPXCommonContainerPanic, "MPX Common Container" );
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+CMPXCommonContainerSearchFieldWrapper::CMPXCommonContainerSearchFieldWrapper(
+    MMPXCommonContainerSearchFieldObserver* aObserver )
+    : iObserver( aObserver )
+    {
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+CMPXCommonContainerSearchFieldWrapper* CMPXCommonContainerSearchFieldWrapper::NewL(
+    MMPXCommonContainerSearchFieldObserver* aObserver )
+    {
+    CMPXCommonContainerSearchFieldWrapper* self
+        = new (ELeave) CMPXCommonContainerSearchFieldWrapper( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchFieldWrapper::ConstructL()
+    {
+    CreateWindowL();
+    iSearchField = CMPXCommonContainerSearchField::NewL( this );
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+CMPXCommonContainerSearchFieldWrapper
+        ::~CMPXCommonContainerSearchFieldWrapper()
+    {
+    if ( iSearchField )
+        {
+        if ( IsSearchFieldActive() )
+            {
+            CCoeEnv::Static()->AppUi()->RemoveFromStack( iSearchField );
+            }
+        }
+    delete iSearchField;
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+TBool CMPXCommonContainerSearchFieldWrapper::IsSearchFieldActive()
+    {
+    return iSearchField->IsVisible();
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchFieldWrapper::ActivateSearchFieldL()
+    {
+    MakeVisible( ETrue );
+    CCoeEnv::Static()->AppUi()->RemoveFromStack( iSearchField );
+    CCoeEnv::Static()->AppUi()->AddToStackL( iSearchField,
+            ECoeStackPriorityMenu );
+    iSearchField->ActivateL();
+    iSearchField->MakeVisible( ETrue );
+    iSearchField->SetFocus( ETrue );
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchFieldWrapper::DeactivateSearchField()
+    {
+    iSearchField->MakeVisible( EFalse );
+    iSearchField->SetFocus( EFalse );
+    MakeVisible( EFalse );
+    CCoeEnv::Static()->AppUi()->RemoveFromStack( iSearchField );
+    TRAP_IGNORE( FindKeywordL( KNullDesC ) );
+    }
+
+// --------------------------------------------------------------------------
+// Returns rectangle for list, based on view's client rectangle. Handles both
+// the case when Search Field is visible and the case when it's invisible.
+// --------------------------------------------------------------------------
+//
+TRect CMPXCommonContainerSearchFieldWrapper::GetListRect(
+        TBool aSearchVisible, TRect aClientRect )
+    {
+    TRect listRect = aClientRect;
+
+    SetClientRect( aClientRect ); // Update stored client rect.
+
+    if ( aSearchVisible )
+        {
+        TAknWindowLineLayout layout =
+            AknLayoutScalable_Avkon::popup_find_window().LayoutLine();
+
+        // Height of list is reduced from bottom with size of Search Field.
+        listRect.iBr.iY -= layout.iH;
+
+        __ASSERT_DEBUG( listRect.iBr.iY > 0 && layout.iH > 0,
+                        User::Panic( KMPXCommonContainerPanic, 1 ) );
+        }
+
+    return listRect;
+    }
+
+// --------------------------------------------------------------------------
+// Returns rectangle for Search Field, based on view's client rectangle.
+// Handles both the case when Search Field is visible and the case when it's
+// invisible.
+// --------------------------------------------------------------------------
+//
+TRect CMPXCommonContainerSearchFieldWrapper::GetSearchFieldRect(
+        TBool aSearchVisible, TRect aClientRect )
+    {
+    TRect searchRect = TRect( 0, 0, 0, 0 );
+
+    SetClientRect( aClientRect ); // Update stored client rect.
+
+    if ( aSearchVisible )
+        {
+        TAknWindowLineLayout layout =
+            AknLayoutScalable_Avkon::popup_find_window().LayoutLine();
+
+        // TopLeft of Search Field is based on list's bottom, see GetListRect
+        searchRect.iTl.iX = aClientRect.iTl.iX;
+        searchRect.iTl.iY = aClientRect.iBr.iY - layout.iH;
+
+        // BottomRight of Search Field is at the end of client rectangle.
+        searchRect.iBr.iX = aClientRect.iBr.iX;
+        searchRect.iBr.iY = aClientRect.iBr.iY;
+
+        __ASSERT_DEBUG( searchRect.iTl.iX < searchRect.iBr.iX &&
+                        searchRect.iTl.iY < searchRect.iBr.iY &&
+                        searchRect.iBr.iX > 0 &&
+                        searchRect.iBr.iY > 0 &&
+                        layout.iH > 0,
+                        User::Panic( KMPXCommonContainerPanic, 2 ) );
+        }
+
+    return searchRect;
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchFieldWrapper::FindKeywordL(
+        const TDesC& aFindWord )
+    {
+    if ( iObserver )
+        {
+        iObserver->NewFilteringWordL( aFindWord );
+        }
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+CCoeControl *CMPXCommonContainerSearchFieldWrapper::ComponentControl(
+        TInt /*aIndex*/ ) const
+    {
+    return iSearchField;
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+TInt CMPXCommonContainerSearchFieldWrapper::CountComponentControls() const
+    {
+    return 1;
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+TRect& CMPXCommonContainerSearchFieldWrapper::ClientRect()
+    {
+    return iClientRect;
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchFieldWrapper::SetClientRect(
+        const TRect& aClientRect )
+    {
+    iClientRect = aClientRect;
+    }
+
+// --------------------------------------------------------------------------
+//
+// --------------------------------------------------------------------------
+//
+void CMPXCommonContainerSearchFieldWrapper::SizeChanged()
+    {
+    iSearchField->HandleFindSizeChanged();
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainertexturemanager.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,210 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of MPX common container Texture Manager.
+*
+*/
+
+
+#include <alf/alftexturemanager.h>
+#include <fbs.h>
+#include <mpxlog.h>
+#include "mpxcommoncontainertexturemanager.h"
+
+// CONSTANTS
+
+// ----------------------------------------------------------------------------
+// Constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCommonContainerTextureManager::CMPXCommonContainerTextureManager(
+    CAlfTextureManager& aTextureManager )
+    : iTextureManager( aTextureManager )
+    {
+    // Set the TextureId range. Now we can set our own ID outside this Range
+    iTextureManager.SetAutomaticTextureIdRange(
+        KMPXFirstAlfThumbnailTextureId,
+        KMPXLastAlfThumbnailTextureId);
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXCommonContainerTextureManager::~CMPXCommonContainerTextureManager()
+    {
+    iTextureArray.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// Creates texture from the specified bitmap and mask
+// ----------------------------------------------------------------------------
+CAlfTexture& CMPXCommonContainerTextureManager::CreateTextureL(
+    TInt aItemIndex,
+    TMPXItemId aItemId,
+    CFbsBitmap* aBitmap,
+    CFbsBitmap* aMask )
+    {
+    MPX_DEBUG1("CMPXCommonContainerTextureManager::CreateTextureL(): Entering");
+
+    // store the bitmaps and the item id for the ProvideBitmapL callback
+    iTextureItem.iType = EMPXTextureImage;
+    iTextureItem.iItemIndex = aItemIndex;
+    iTextureItem.iItemId = aItemId;
+    
+    // store the bitmaps for the ProvideBitmapL callback
+    iTextureItem.iBitmap = aBitmap;
+    iTextureItem.iMask = aMask;
+
+    /// @todo if CreateTextureL leaves, we may need to delete
+    // iBitmap and iMask as we transfer their
+    // ownership to Alf and if a leave occurs the ownership transfer
+    // might have not yet happened
+    CAlfTexture& texture = iTextureManager.CreateTextureL(
+        KAlfAutoGeneratedTextureId,
+        this,
+        EAlfTextureFlagDefault );
+
+    MPX_DEBUG1("CMPXCommonContainerTextureManager::CreateTextureL(): Exiting");
+    return texture;
+    }
+
+// ----------------------------------------------------------------------------
+// Creates icon texture from the specified bitmap and mask (not cached)
+// ----------------------------------------------------------------------------
+CAlfTexture& CMPXCommonContainerTextureManager::CreateIconTextureL(
+    TInt aIconIndex,
+    CFbsBitmap* aBitmap,
+    CFbsBitmap* aMask )
+    {
+    MPX_DEBUG1("CMPXCommonContainerTextureManager::CreateTextureL(): Entering");
+
+    // save the icon index
+    iTextureItem.iType = EMPXTextureIcon;
+    iTextureItem.iItemIndex = aIconIndex;
+    
+    // store the bitmaps for the ProvideBitmapL callback
+    iTextureItem.iBitmap = aBitmap;
+    iTextureItem.iMask = aMask;
+
+    /// @todo if CreateTextureL leaves, we may need to delete
+    // iBitmap and iMask as we transfer their
+    // ownership to Alf and if a leave occurs the ownership transfer
+    // might have not yet happened
+    CAlfTexture& texture = iTextureManager.CreateTextureL(
+        KAlfAutoGeneratedTextureId,
+        this,
+        EAlfTextureFlagDefault );
+
+    MPX_DEBUG1("CMPXCommonContainerTextureManager::CreateTextureL(): Exiting");
+    return texture;
+    }
+
+// ----------------------------------------------------------------------------
+// Updates the specified media with the results from the search
+// criteria
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerTextureManager::ProvideBitmapL(
+    TInt aId,
+    CFbsBitmap*& aBitmap,
+    CFbsBitmap*& aBitmapMask)
+    {
+    MPX_DEBUG1("CMPXCommonContainerTextureManager::ProvideBitmapL(): Entering");
+
+    // store the ID
+	iTextureItem.iTextureId = aId;
+    // give the bitmaps to Alf, it takes ownership
+    aBitmap = iTextureItem.iBitmap;
+    aBitmapMask = iTextureItem.iMask;
+
+    // cache the texture item
+    if( iTextureItem.iType == EMPXTextureImage )
+        {
+        iTextureArray.AppendL( iTextureItem );
+        }
+    else // EMPXTextureIcon
+        {
+        iIconTextureArray.AppendL( iTextureItem );        
+        }
+    
+    MPX_DEBUG1("CMPXCommonContainerTextureManager::ProvideBitmapL(): Exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Returns the texture id for the specified item
+// ----------------------------------------------------------------------------
+TInt CMPXCommonContainerTextureManager::TextureId( TMPXItemId aItemId ) const
+    {
+    MPX_FUNC("CMPXCommonContainerTextureManager::TextureId()");
+
+    TInt textureId( KErrNotFound );
+
+    // Search for the texture id in the cache
+    const TInt count( iTextureArray.Count() );
+    for( TInt index = 0; index < count; index++ )
+        {
+        if( iTextureArray[index].iItemId == aItemId )
+            {
+            textureId = iTextureArray[index].iTextureId;
+            break;
+            }
+        }
+    
+    return textureId;
+    }
+
+// ----------------------------------------------------------------------------
+// Returns the texture id for the specified icon
+// ----------------------------------------------------------------------------
+TInt CMPXCommonContainerTextureManager::IconTextureId( TInt aIconIndex ) const
+    {
+    MPX_FUNC("CMPXCommonContainerTextureManager::IconTextureId()");
+    
+    TInt textureId( KErrNotFound );
+    
+    // Search for the texture id in the cache
+    const TInt count( iIconTextureArray.Count() );
+    for( TInt index = 0; index < count; index++ )
+        {
+        if( iIconTextureArray[index].iItemIndex == aIconIndex )
+            {
+            textureId = iIconTextureArray[index].iTextureId;
+            break;
+            }
+        }
+    
+    return textureId;
+    }
+
+// ----------------------------------------------------------------------------
+// Clears the texture cache array
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerTextureManager::ClearCache( TMPXTextureType aType )
+    {
+    MPX_FUNC("CMPXCommonContainerTextureManager::ClearCache");
+    switch ( aType )
+        {
+        case EMPXTextureImage:
+            iTextureArray.Reset();
+            break;
+        case EMPXTextureIcon:
+            iIconTextureArray.Reset();
+            break;
+        case EMPXTextureNone:
+            iTextureArray.Reset();
+            iIconTextureArray.Reset();
+            break;
+        }
+    }
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/src/mpxcommoncontainertexturemanager2.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Application UI class required by AVKON application architecture.
+*
+*/
+
+#include <fbs.h>
+#include <mpxlog.h>
+#include "mpxcommoncontainertexturemanager2.h"
+
+// CONSTANTS
+
+// ----------------------------------------------------------------------------
+// Constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXCommonContainerTextureManager2::CMPXCommonContainerTextureManager2()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXCommonContainerTextureManager2::~CMPXCommonContainerTextureManager2()
+    {
+    ClearCache();
+    }
+
+// ----------------------------------------------------------------------------
+// Creates texture from the specified bitmap
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerTextureManager2::CreateTextureL(
+        TInt aItemIndex, TMPXItemId aItemId, CFbsBitmap* aBitmap )
+    {
+    MPX_FUNC("CMPXCommonContainerTextureManager2::CreateTextureL()");
+    if ( iTextureMap.Find(aItemIndex) )
+        {
+        CFbsBitmap* const* item  = iTextureMap.Find(aItemIndex);
+        delete *item;
+        }
+    iTextureMap.InsertL( aItemIndex, aBitmap );
+    iTextureIndexMap.InsertL( (TInt32)aItemId, aItemIndex );
+    }
+
+// ----------------------------------------------------------------------------
+// Returns the texture id for the specified item
+// ----------------------------------------------------------------------------
+TBool CMPXCommonContainerTextureManager2::TextureExist( TMPXItemId aItemId ) const
+    {
+    MPX_FUNC("CMPXCommonContainerTextureManager2::TextureExist()");
+
+    const TInt *ret = iTextureIndexMap.Find( (TInt32)aItemId );
+    if ( ret )
+        return ETrue;
+    else
+        return EFalse;
+    }
+
+
+// ----------------------------------------------------------------------------
+// Clears the texture cache array
+// ----------------------------------------------------------------------------
+void CMPXCommonContainerTextureManager2::ClearCache()
+    {
+    MPX_FUNC("CMPXCommonContainerTextureManager2::ClearCache");
+
+	THashMapIter<TInt, CFbsBitmap*> iter(iTextureMap);
+	CFbsBitmap* const* bitmap2 = iter.CurrentValue();
+    if (bitmap2)
+        {
+        delete bitmap2;
+        }
+	while ( CFbsBitmap* const* bitmap = iter.NextValue() )
+		{
+		delete *bitmap;
+		iter.RemoveCurrent();
+		}
+   	iTextureMap.Close();
+    iTextureIndexMap.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// Returns the bitmap
+// ----------------------------------------------------------------------------
+CFbsBitmap* CMPXCommonContainerTextureManager2::ProvideBitmapL( TInt aIndex )
+    {
+    MPX_FUNC("CMPXCommonContainerTextureManager2::ProvideBitmapL()");
+    
+    CFbsBitmap* const* item  = iTextureMap.Find(aIndex);
+    
+    if ( item )
+        {
+        return *item;
+        }
+    else
+        {
+        return NULL;
+        }
+    }
+
+//End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commoncontainer/src/mpxcommonlistboxarraybase.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listbox array for common container
+*
+*/
+
+
+// INCLUDE FILES
+#include <mpxmedia.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediaarray.h>
+#include <mpxlog.h>
+
+#include <mpxcollectionpath.h>  // TMPXItemId
+#include <mpxmediageneraldefs.h>
+
+#include "mpxcommonlistboxarrayobserver.h"
+#include "mpxcommonlistboxarraybase.h"
+
+// CONSTANTS
+const TInt KMPXMaxStringSize = 300;
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::CMPXCommonListBoxArrayBase
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXCommonListBoxArrayBase::CMPXCommonListBoxArrayBase() :
+    iPbState( EPbStateNotInitialised ),
+    iIndex( KErrNotFound )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXCommonListBoxArrayBase::~CMPXCommonListBoxArrayBase()
+    {
+    MPX_DEBUG1( "CMPXCommonListBoxArrayBase::~CMPXCommonListBoxArrayBase START" );
+    delete iItem;
+    delete iContainerMedia;
+    MPX_DEBUG1( "CMPXCommonListBoxArrayBase::~CMPXCommonListBoxArrayBase END" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::ConstructListBoxArrayL
+// Construct the array
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonListBoxArrayBase::ConstructListBoxArrayL()
+    {
+    MPX_FUNC( "CMPXCommonListBoxArrayBase::ConstructListBoxArrayL" );
+    delete iItem;
+    iItem = NULL;
+    iItem = HBufC::NewL( KMPXMaxStringSize );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::AppendMediaL
+// Appends media array to the current array
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonListBoxArrayBase::AppendMediaL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCommonListBoxArrayBase::AppendMediaL" );
+    delete iContainerMedia;
+    iContainerMedia=NULL;
+    iContainerMedia=CMPXMedia::NewL(aMedia);
+    iMedia=const_cast<CMPXMediaArray*>(iContainerMedia->Value<CMPXMediaArray>( KMPXMediaArrayContents ) );
+    MPX_DEBUG2( "CMPXCommonListBoxArrayBase::AppendMediaL media count %d", iMedia->Count() );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::ResetMediaArray
+// Resets media array.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonListBoxArrayBase::ResetMediaArrayL()
+    {
+    MPX_FUNC( "CMPXCommonListBoxArrayBase::ResetMediaArray" );
+    delete iContainerMedia;
+    iContainerMedia = NULL;
+    iMedia = NULL;
+    iIndex = KErrNotFound;
+    iPbState = EPbStateNotInitialised;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::MediaArray
+// Gets media array.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const CMPXMediaArray& CMPXCommonListBoxArrayBase::MediaArray()
+    {
+    MPX_FUNC( "CMPXCommonListBoxArrayBase::MediaArray" );
+    ASSERT( iMedia );
+    return *iMedia;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::MediaL
+// Get the media at index.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const CMPXMedia& CMPXCommonListBoxArrayBase::MediaL( TInt aIndex )
+    {
+    MPX_FUNC( "CMPXCommonListBoxArrayBase::MediaL" );
+    ASSERT( iMedia );
+    if ( ( iMedia->Count() < aIndex + 1 ) || ( aIndex  < 0 ) )
+        {
+        MPX_DEBUG3( "CMPXCommonListBoxArrayBase::MediaL KErrArgument aIndex = %d, iMedia->Count() = %d", aIndex, iMedia->Count() );
+        User::Leave( KErrArgument );
+        }
+    return *( iMedia->AtL( aIndex ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::ContainerMedia
+// Get the container media.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C const CMPXMedia& CMPXCommonListBoxArrayBase::ContainerMedia()
+    {
+    MPX_FUNC( "CMPXCommonListBoxArrayBase::ContainerMedia" );
+    return *iContainerMedia;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::SetObserver
+// Set observer
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonListBoxArrayBase::SetObserver(
+    MMPXCommonListBoxArrayObserver* aObserver)
+    {
+    MPX_FUNC( "CMPXCommonListBoxArrayBase::SetObserver" );
+    ASSERT( !iObserver );
+    iObserver = aObserver;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::RemoveObserver
+// Remove observer
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonListBoxArrayBase::RemoveObserver()
+    {
+    MPX_FUNC( "CMPXCommonListBoxArrayBase::RemoveObserver" );
+    iObserver = NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::CreateIconArrayL
+// creates icon array.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CAknIconArray* CMPXCommonListBoxArrayBase::CreateIconArrayL()
+    {
+    MPX_FUNC( "CMPXCommonListBoxArrayBase::CreateIconArrayL" );
+    return NULL;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::MdcaCount
+// Returns the number of descriptor elements in a descriptor.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXCommonListBoxArrayBase::MdcaCount() const
+    {
+    MPX_DEBUG2( "CMPXCommonListBoxArrayBase::MdcaCount count = %d", iMedia ? iMedia->Count() : 0 );
+    return ( iMedia ? iMedia->Count() : 0 );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/bwinscw/mpxcommonplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,112 @@
+EXPORTS
+	?DoHandleMediaL@CMPXCommonPlaybackViewImp@@MAEXABVCMPXMedia@@H@Z @ 1 NONAME ; void CMPXCommonPlaybackViewImp::DoHandleMediaL(class CMPXMedia const &, int)
+	?DialogDismissedL@CMPXCommonPlaybackViewImp@@MAEXH@Z @ 2 NONAME ; void CMPXCommonPlaybackViewImp::DialogDismissedL(int)
+	?SetProcessPriority@CMPXCommonPlaybackViewImp@@MAEXXZ @ 3 NONAME ; void CMPXCommonPlaybackViewImp::SetProcessPriority(void)
+	?SetRepeatMode@CMPXCommonPlaybackViewContainer@@UAEXHH@Z @ 4 NONAME ; void CMPXCommonPlaybackViewContainer::SetRepeatMode(int, int)
+	?CreateColorIconL@CMPXCommonPlaybackViewLayout@@IAEPAVCGulIcon@@PAVMAknsSkinInstance@@ABVTAknsItemID@@1HABVTDesC16@@HH@Z @ 5 NONAME ; class CGulIcon * CMPXCommonPlaybackViewLayout::CreateColorIconL(class MAknsSkinInstance *, class TAknsItemID const &, class TAknsItemID const &, int, class TDesC16 const &, int, int)
+	?ConstructL@CMPXCommonPlaybackViewContainer@@UAEXABVTRect@@@Z @ 6 NONAME ; void CMPXCommonPlaybackViewContainer::ConstructL(class TRect const &)
+	?UpdateTimeIndicatorsL@CMPXCommonPlaybackViewContainer@@UAEXHH@Z @ 7 NONAME ; void CMPXCommonPlaybackViewContainer::UpdateTimeIndicatorsL(int, int)
+	?DisplayConfirmionNoteL@CMPXCommonPlaybackViewImp@@MAEXH@Z @ 8 NONAME ; void CMPXCommonPlaybackViewImp::DisplayConfirmionNoteL(int)
+	?HandlePlaybackMessage@CMPXCommonPlaybackViewImp@@MAEXPAVCMPXMedia@@H@Z @ 9 NONAME ; void CMPXCommonPlaybackViewImp::HandlePlaybackMessage(class CMPXMedia *, int)
+	?CreateBackgroundImagesL@CMPXCommonPlaybackViewContainer@@MAEXXZ @ 10 NONAME ; void CMPXCommonPlaybackViewContainer::CreateBackgroundImagesL(void)
+	?HandleSettingChange@CMPXCommonPlaybackViewImp@@MAEXABVTUid@@K@Z @ 11 NONAME ; void CMPXCommonPlaybackViewImp::HandleSettingChange(class TUid const &, unsigned long)
+	?HandleForegroundEventL@CMPXCommonPlaybackViewImp@@MAEXH@Z @ 12 NONAME ; void CMPXCommonPlaybackViewImp::HandleForegroundEventL(int)
+	?HandleErrorL@CMPXCommonPlaybackViewImp@@MAEXH@Z @ 13 NONAME ; void CMPXCommonPlaybackViewImp::HandleErrorL(int)
+	?GetCurrentPlayerDetails@CMPXCommonPlaybackViewImp@@MAEXXZ @ 14 NONAME ; void CMPXCommonPlaybackViewImp::GetCurrentPlayerDetails(void)
+	?UpdateDurationLabelL@CMPXCommonPlaybackViewContainer@@UAEXH@Z @ 15 NONAME ; void CMPXCommonPlaybackViewContainer::UpdateDurationLabelL(int)
+	?RedrawRect@CMPXCommonPlaybackViewContainer@@MBEXABVTRect@@AAVCBitmapContext@@@Z @ 16 NONAME ; void CMPXCommonPlaybackViewContainer::RedrawRect(class TRect const &, class CBitmapContext &) const
+	?DoHandleStateChangedL@CMPXCommonPlaybackViewImp@@MAEXW4TMPXPlaybackState@@H@Z @ 17 NONAME ; void CMPXCommonPlaybackViewImp::DoHandleStateChangedL(enum TMPXPlaybackState, int)
+	?DisplayInfoNoteL@CMPXCommonPlaybackViewImp@@MAEXH@Z @ 18 NONAME ; void CMPXCommonPlaybackViewImp::DisplayInfoNoteL(int)
+	?RequestMediaL@CMPXCommonPlaybackViewImp@@MAEXH@Z @ 19 NONAME ; void CMPXCommonPlaybackViewImp::RequestMediaL(int)
+	?HandleStatusPaneSizeChange@CMPXCommonPlaybackViewImp@@MAEXXZ @ 20 NONAME ; void CMPXCommonPlaybackViewImp::HandleStatusPaneSizeChange(void)
+	?UpdateTrackInfoL@CMPXCommonPlaybackViewImp@@MAEXPBVCMPXMedia@@@Z @ 21 NONAME ; void CMPXCommonPlaybackViewImp::UpdateTrackInfoL(class CMPXMedia const *)
+	?PrepareMediaForPlaylistLC@CMPXCommonPlaybackViewImp@@MAEPAVCMPXMedia@@ABV2@@Z @ 22 NONAME ; class CMPXMedia * CMPXCommonPlaybackViewImp::PrepareMediaForPlaylistLC(class CMPXMedia const &)
+	?ExtractAlbumArtCompleted@CMPXCommonPlaybackViewContainer@@UAEXPAVCFbsBitmap@@H@Z @ 23 NONAME ; void CMPXCommonPlaybackViewContainer::ExtractAlbumArtCompleted(class CFbsBitmap *, int)
+	?HandleViewActivation@CMPXCommonPlaybackViewImp@@MAEXABVTUid@@0@Z @ 24 NONAME ; void CMPXCommonPlaybackViewImp::HandleViewActivation(class TUid const &, class TUid const &)
+	?IsCommandSupportedL@CMPXCommonPlaybackViewImp@@MAEHXZ @ 25 NONAME ; int CMPXCommonPlaybackViewImp::IsCommandSupportedL(void)
+	?GetIndicatorIconMaskL@CMPXCommonPlaybackViewLayout@@UAEPAVCGulIcon@@W4TMPXPbvIndicator@@@Z @ 26 NONAME ; class CGulIcon * CMPXCommonPlaybackViewLayout::GetIndicatorIconMaskL(enum TMPXPbvIndicator)
+	?GetButtonBitmapsL@CMPXCommonPlaybackViewLayout@@UAEXW4TMPXPbvButton@@HAAPAVCFbsBitmap@@1@Z @ 27 NONAME ; void CMPXCommonPlaybackViewLayout::GetButtonBitmapsL(enum TMPXPbvButton, int, class CFbsBitmap * &, class CFbsBitmap * &)
+	?UpdateBackgroundSkinControlContext@CMPXCommonPlaybackViewContainer@@MAEXABVTRect@@@Z @ 28 NONAME ; void CMPXCommonPlaybackViewContainer::UpdateBackgroundSkinControlContext(class TRect const &)
+	?HandleOpenL@CMPXCommonPlaybackViewImp@@MAEXABVCMPXCollectionPlaylist@@H@Z @ 29 NONAME ; void CMPXCommonPlaybackViewImp::HandleOpenL(class CMPXCollectionPlaylist const &, int)
+	?GetTextVariant@CMPXCommonPlaybackViewLayout@@IAE?AW4TMPXPbvLayoutVariants@@W4TMPXPbvTextIndicator@@@Z @ 30 NONAME ; enum TMPXPbvLayoutVariants CMPXCommonPlaybackViewLayout::GetTextVariant(enum TMPXPbvTextIndicator)
+	??1CMPXCommonPlaybackViewContainer@@UAE@XZ @ 31 NONAME ; CMPXCommonPlaybackViewContainer::~CMPXCommonPlaybackViewContainer(void)
+	?SetRealAudioMode@CMPXCommonPlaybackViewContainer@@UAEXH@Z @ 32 NONAME ; void CMPXCommonPlaybackViewContainer::SetRealAudioMode(int)
+	?DetermineLayoutVariant@CMPXCommonPlaybackViewLayout@@IAE?AW4TMPXPbvLayoutVariants@@XZ @ 33 NONAME ; enum TMPXPbvLayoutVariants CMPXCommonPlaybackViewLayout::DetermineLayoutVariant(void)
+	?SetMode@CMPXCommonPlaybackViewContainer@@UAEXW4TMPXPbvPlaybackMode@@@Z @ 34 NONAME ; void CMPXCommonPlaybackViewContainer::SetMode(enum TMPXPbvPlaybackMode)
+	?AddPlayersNamesToMenuL@CMPXCommonPlaybackViewImp@@MAEXAAVCEikMenuPane@@@Z @ 35 NONAME ; void CMPXCommonPlaybackViewImp::AddPlayersNamesToMenuL(class CEikMenuPane &)
+	?DynInitMenuPaneL@CMPXCommonPlaybackViewImp@@MAEXHPAVCEikMenuPane@@@Z @ 36 NONAME ; void CMPXCommonPlaybackViewImp::DynInitMenuPaneL(int, class CEikMenuPane *)
+	?HandlePropertyL@CMPXCommonPlaybackViewImp@@MAEXW4TMPXPlaybackProperty@@HH@Z @ 37 NONAME ; void CMPXCommonPlaybackViewImp::HandlePropertyL(enum TMPXPlaybackProperty, int, int)
+	?SkipOnErrorL@CMPXCommonPlaybackViewImp@@MAEXHH@Z @ 38 NONAME ; void CMPXCommonPlaybackViewImp::SkipOnErrorL(int, int)
+	?HandleOpenL@CMPXCommonPlaybackViewImp@@MAEXABVCMPXMedia@@HHH@Z @ 39 NONAME ; void CMPXCommonPlaybackViewImp::HandleOpenL(class CMPXMedia const &, int, int, int)
+	?LayoutLabel@CMPXCommonPlaybackViewLayout@@UAEXPAVCEikLabel@@ABVTRect@@W4TMPXPbvTextIndicator@@HH@Z @ 40 NONAME ; void CMPXCommonPlaybackViewLayout::LayoutLabel(class CEikLabel *, class TRect const &, enum TMPXPbvTextIndicator, int, int)
+	?RefreshProgressBar@CMPXCommonPlaybackViewContainer@@MAEXXZ @ 41 NONAME ; void CMPXCommonPlaybackViewContainer::RefreshProgressBar(void)
+	?HandleLayoutChange@CMPXCommonPlaybackViewImp@@MAEXXZ @ 42 NONAME ; void CMPXCommonPlaybackViewImp::HandleLayoutChange(void)
+	?IsUpnpVisible@CMPXCommonPlaybackViewImp@@MAEHXZ @ 43 NONAME ; int CMPXCommonPlaybackViewImp::IsUpnpVisible(void)
+	?CountComponentControls@CMPXCommonPlaybackViewContainer@@MBEHXZ @ 44 NONAME ; int CMPXCommonPlaybackViewContainer::CountComponentControls(void) const
+	?DoHandlePropertyL@CMPXCommonPlaybackViewImp@@MAEXW4TMPXPlaybackProperty@@HH@Z @ 45 NONAME ; void CMPXCommonPlaybackViewImp::DoHandlePropertyL(enum TMPXPlaybackProperty, int, int)
+	?DrawIndicator@CMPXCommonPlaybackViewContainer@@MBEXAAVCBitmapContext@@ABVTRect@@1PBVCGulIcon@@H@Z @ 46 NONAME ; void CMPXCommonPlaybackViewContainer::DrawIndicator(class CBitmapContext &, class TRect const &, class TRect const &, class CGulIcon const *, int) const
+	?ExtractAlbumArtStarted@CMPXCommonPlaybackViewContainer@@UAEXXZ @ 47 NONAME ; void CMPXCommonPlaybackViewContainer::ExtractAlbumArtStarted(void)
+	?UpdateDownloadStateLabelL@CMPXCommonPlaybackViewImp@@MAEXXZ @ 48 NONAME ; void CMPXCommonPlaybackViewImp::UpdateDownloadStateLabelL(void)
+	?SetFMTXMode@CMPXCommonPlaybackViewContainer@@MAEXH@Z @ 49 NONAME ; void CMPXCommonPlaybackViewContainer::SetFMTXMode(int)
+	?ProcessCommandL@CMPXCommonPlaybackViewImp@@MAEXH@Z @ 50 NONAME ; void CMPXCommonPlaybackViewImp::ProcessCommandL(int)
+	?LaunchMusicSettingsL@CMPXCommonPlaybackViewImp@@MAEXXZ @ 51 NONAME ; void CMPXCommonPlaybackViewImp::LaunchMusicSettingsL(void)
+	?GetNewSongPosition@CMPXCommonPlaybackViewContainer@@UAEHXZ @ 52 NONAME ; int CMPXCommonPlaybackViewContainer::GetNewSongPosition(void)
+	?UpdateMiddleSoftKeyDisplayL@CMPXCommonPlaybackViewImp@@IAEXXZ @ 53 NONAME ; void CMPXCommonPlaybackViewImp::UpdateMiddleSoftKeyDisplayL(void)
+	?SizeChanged@CMPXCommonPlaybackViewContainer@@MAEXXZ @ 54 NONAME ; void CMPXCommonPlaybackViewContainer::SizeChanged(void)
+	?HandleOperationCompleteL@CMPXCommonPlaybackViewImp@@MAEXW4TCHelperOperation@@HPAX@Z @ 55 NONAME ; void CMPXCommonPlaybackViewImp::HandleOperationCompleteL(enum TCHelperOperation, int, void *)
+	?LaunchFMTransmitterL@CMPXCommonPlaybackViewImp@@MAEXXZ @ 56 NONAME ; void CMPXCommonPlaybackViewImp::LaunchFMTransmitterL(void)
+	?UpdateViewL@CMPXCommonPlaybackViewImp@@MAEXXZ @ 57 NONAME ; void CMPXCommonPlaybackViewImp::UpdateViewL(void)
+	?FreeIcons@CMPXCommonPlaybackViewContainer@@IAEXXZ @ 58 NONAME ; void CMPXCommonPlaybackViewContainer::FreeIcons(void)
+	?HandleSubPlayerNamesL@CMPXCommonPlaybackViewImp@@MAEXVTUid@@PBVMDesC16Array@@HH@Z @ 59 NONAME ; void CMPXCommonPlaybackViewImp::HandleSubPlayerNamesL(class TUid, class MDesC16Array const *, int, int)
+	?UpdateLabelL@CMPXCommonPlaybackViewContainer@@UAEXW4TMPXPbvTextIndicator@@ABVTDesC16@@@Z @ 60 NONAME ; void CMPXCommonPlaybackViewContainer::UpdateLabelL(enum TMPXPbvTextIndicator, class TDesC16 const &)
+	?DoDeactivate@CMPXCommonPlaybackViewImp@@MAEXXZ @ 61 NONAME ; void CMPXCommonPlaybackViewImp::DoDeactivate(void)
+	?HandleCommandComplete@CMPXCommonPlaybackViewImp@@MAEXPAVCMPXMedia@@H@Z @ 62 NONAME ; void CMPXCommonPlaybackViewImp::HandleCommandComplete(class CMPXMedia *, int)
+	?HandleButtonCommandL@CMPXCommonPlaybackViewContainer@@MAEXH@Z @ 63 NONAME ; void CMPXCommonPlaybackViewContainer::HandleButtonCommandL(int)
+	?OfferKeyEventL@CMPXCommonPlaybackViewContainer@@UAE?AW4TKeyResponse@@ABUTKeyEvent@@W4TEventCode@@@Z @ 64 NONAME ; enum TKeyResponse CMPXCommonPlaybackViewContainer::OfferKeyEventL(struct TKeyEvent const &, enum TEventCode)
+	?SetRandomMode@CMPXCommonPlaybackViewContainer@@UAEXH@Z @ 65 NONAME ; void CMPXCommonPlaybackViewContainer::SetRandomMode(int)
+	?HandleCollectionMessage@CMPXCommonPlaybackViewImp@@MAEXPAVCMPXMedia@@H@Z @ 66 NONAME ; void CMPXCommonPlaybackViewImp::HandleCollectionMessage(class CMPXMedia *, int)
+	?ComponentControl@CMPXCommonPlaybackViewContainer@@MBEPAVCCoeControl@@H@Z @ 67 NONAME ; class CCoeControl * CMPXCommonPlaybackViewContainer::ComponentControl(int) const
+	?UpdateTrackPosInPlaylistL@CMPXCommonPlaybackViewImp@@MAEXXZ @ 68 NONAME ; void CMPXCommonPlaybackViewImp::UpdateTrackPosInPlaylistL(void)
+	?LaunchEqualizerL@CMPXCommonPlaybackViewImp@@MAEXXZ @ 69 NONAME ; void CMPXCommonPlaybackViewImp::LaunchEqualizerL(void)
+	?HandleAllTracksInvalidL@CMPXCommonPlaybackViewImp@@MAEXXZ @ 70 NONAME ; void CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL(void)
+	?AddToNewPlaylistL@CMPXCommonPlaybackViewImp@@MAEXXZ @ 71 NONAME ; void CMPXCommonPlaybackViewImp::AddToNewPlaylistL(void)
+	?IndicatorLayout@CMPXCommonPlaybackViewLayout@@UAE?AVTRect@@ABV2@W4TMPXPbvIndicator@@@Z @ 72 NONAME ; class TRect CMPXCommonPlaybackViewLayout::IndicatorLayout(class TRect const &, enum TMPXPbvIndicator)
+	?UpdateTrackPlaybackPositionL@CMPXCommonPlaybackViewImp@@MAEXHH@Z @ 73 NONAME ; void CMPXCommonPlaybackViewImp::UpdateTrackPlaybackPositionL(int, int)
+	?UpdateTitlePaneL@CMPXCommonPlaybackViewImp@@MAEXXZ @ 74 NONAME ; void CMPXCommonPlaybackViewImp::UpdateTitlePaneL(void)
+	?HandlePointerEventL@CMPXCommonPlaybackViewContainer@@MAEXABUTPointerEvent@@@Z @ 75 NONAME ; void CMPXCommonPlaybackViewContainer::HandlePointerEventL(struct TPointerEvent const &)
+	?DoActivateL@CMPXCommonPlaybackViewImp@@MAEXABVTVwsViewId@@VTUid@@ABVTDesC8@@@Z @ 76 NONAME ; void CMPXCommonPlaybackViewImp::DoActivateL(class TVwsViewId const &, class TUid, class TDesC8 const &)
+	?SelectNewPlayerL@CMPXCommonPlaybackViewImp@@MAEXH@Z @ 77 NONAME ; void CMPXCommonPlaybackViewImp::SelectNewPlayerL(int)
+	?DoHandlePlaybackMessageL@CMPXCommonPlaybackViewImp@@MAEXABVCMPXMedia@@@Z @ 78 NONAME ; void CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL(class CMPXMedia const &)
+	?UpdateButtons@CMPXCommonPlaybackViewContainer@@UAEXW4TMPXPlaybackState@@@Z @ 79 NONAME ; void CMPXCommonPlaybackViewContainer::UpdateButtons(enum TMPXPlaybackState)
+	?ButtonLayout@CMPXCommonPlaybackViewLayout@@UAE?AVTRect@@ABV2@H@Z @ 80 NONAME ; class TRect CMPXCommonPlaybackViewLayout::ButtonLayout(class TRect const &, int)
+	?UpdateProgressBarGraphics@CMPXCommonPlaybackViewContainer@@MAEXXZ @ 81 NONAME ; void CMPXCommonPlaybackViewContainer::UpdateProgressBarGraphics(void)
+	?UpdateFMTransmitterInfoL@CMPXCommonPlaybackViewImp@@MAEXH@Z @ 82 NONAME ; void CMPXCommonPlaybackViewImp::UpdateFMTransmitterInfoL(int)
+	?HandleMediaL@CMPXCommonPlaybackViewImp@@MAEXABVCMPXMedia@@H@Z @ 83 NONAME ; void CMPXCommonPlaybackViewImp::HandleMediaL(class CMPXMedia const &, int)
+	?UpdateAlbumArtL@CMPXCommonPlaybackViewImp@@MAEXPBVCMPXMedia@@@Z @ 84 NONAME ; void CMPXCommonPlaybackViewImp::UpdateAlbumArtL(class CMPXMedia const *)
+	?HandlePSEvent@CMPXCommonPlaybackViewImp@@MAEXVTUid@@H@Z @ 85 NONAME ; void CMPXCommonPlaybackViewImp::HandlePSEvent(class TUid, int)
+	?HandleViewUpdate@CMPXCommonPlaybackViewImp@@MAEXVTUid@@W4TViewUpdateEvent@MMPXViewActivationObserver@@HH@Z @ 86 NONAME ; void CMPXCommonPlaybackViewImp::HandleViewUpdate(class TUid, enum MMPXViewActivationObserver::TViewUpdateEvent, int, int)
+	?HandleCommandL@CMPXCommonPlaybackViewImp@@MAEXH@Z @ 87 NONAME ; void CMPXCommonPlaybackViewImp::HandleCommandL(int)
+	??1CMPXCommonPlaybackViewImp@@UAE@XZ @ 88 NONAME ; CMPXCommonPlaybackViewImp::~CMPXCommonPlaybackViewImp(void)
+	?HandleForegroundEventL@CMPXCommonPlaybackViewContainer@@UAEXH@Z @ 89 NONAME ; void CMPXCommonPlaybackViewContainer::HandleForegroundEventL(int)
+	?UpdateLabelColorsL@CMPXCommonPlaybackViewContainer@@MAEXXZ @ 90 NONAME ; void CMPXCommonPlaybackViewContainer::UpdateLabelColorsL(void)
+	?IsEmbedded@CMPXCommonPlaybackViewImp@@MBEHXZ @ 91 NONAME ; int CMPXCommonPlaybackViewImp::IsEmbedded(void) const
+	?SimpleEmbeddedMode@CMPXCommonPlaybackViewImp@@MBEHXZ @ 92 NONAME ; int CMPXCommonPlaybackViewImp::SimpleEmbeddedMode(void) const
+	?UpdateToolbar@CMPXCommonPlaybackViewImp@@IAEXXZ @ 93 NONAME ; void CMPXCommonPlaybackViewImp::UpdateToolbar(void)
+	?UpdateLayout@CMPXCommonPlaybackViewContainer@@UAEXXZ @ 94 NONAME ; void CMPXCommonPlaybackViewContainer::UpdateLayout(void)
+	?ButtonLayout@CMPXCommonPlaybackViewLayout@@UAE?AVTRect@@ABV2@@Z @ 95 NONAME ; class TRect CMPXCommonPlaybackViewLayout::ButtonLayout(class TRect const &)
+	?UpdatePlaybackState@CMPXCommonPlaybackViewImp@@MAEXW4TMPXPlaybackState@@@Z @ 96 NONAME ; void CMPXCommonPlaybackViewImp::UpdatePlaybackState(enum TMPXPlaybackState)
+	?HandleResourceChange@CMPXCommonPlaybackViewContainer@@UAEXH@Z @ 97 NONAME ; void CMPXCommonPlaybackViewContainer::HandleResourceChange(int)
+	?AddPlayerNameToMenuL@CMPXCommonPlaybackViewImp@@MAEXAAVCEikMenuPane@@HAAVMMPXPlayerManager@@AAW4TMPXPlaybackPlayerType@@ABVTDesC16@@@Z @ 98 NONAME ; void CMPXCommonPlaybackViewImp::AddPlayerNameToMenuL(class CEikMenuPane &, int, class MMPXPlayerManager &, enum TMPXPlaybackPlayerType &, class TDesC16 const &)
+	?Draw@CMPXCommonPlaybackViewContainer@@MBEXABVTRect@@@Z @ 99 NONAME ; void CMPXCommonPlaybackViewContainer::Draw(class TRect const &) const
+	?ConstructL@CMPXCommonPlaybackViewImp@@MAEXXZ @ 100 NONAME ; void CMPXCommonPlaybackViewImp::ConstructL(void)
+	?DoLayoutLabelL@CMPXCommonPlaybackViewLayout@@IAEXPAVCEikLabel@@ABVTRect@@HHH@Z @ 101 NONAME ; void CMPXCommonPlaybackViewLayout::DoLayoutLabelL(class CEikLabel *, class TRect const &, int, int, int)
+	?HandleViewActivation@CMPXCommonPlaybackViewImp@@MAEXABVTVwsViewId@@0@Z @ 102 NONAME ; void CMPXCommonPlaybackViewImp::HandleViewActivation(class TVwsViewId const &, class TVwsViewId const &)
+	?AddToSavedPlaylistL@CMPXCommonPlaybackViewImp@@MAEXXZ @ 103 NONAME ; void CMPXCommonPlaybackViewImp::AddToSavedPlaylistL(void)
+	?CreateLabelsL@CMPXCommonPlaybackViewContainer@@MAEXXZ @ 104 NONAME ; void CMPXCommonPlaybackViewContainer::CreateLabelsL(void)
+	?CreateIconsL@CMPXCommonPlaybackViewContainer@@MAEXXZ @ 105 NONAME ; void CMPXCommonPlaybackViewContainer::CreateIconsL(void)
+	?UpdateSoftkeyColors@CMPXCommonPlaybackViewContainer@@UAEXXZ @ 106 NONAME ; void CMPXCommonPlaybackViewContainer::UpdateSoftkeyColors(void)
+	?StartMarquee@CMPXCommonPlaybackViewContainer@@UAEXW4TMPXPbvTextIndicator@@@Z @ 107 NONAME ; void CMPXCommonPlaybackViewContainer::StartMarquee(enum TMPXPbvTextIndicator)
+	?GetIndicatorVariant@CMPXCommonPlaybackViewLayout@@IAE?AW4TMPXPbvLayoutVariants@@W4TMPXPbvIndicator@@@Z @ 108 NONAME ; enum TMPXPbvLayoutVariants CMPXCommonPlaybackViewLayout::GetIndicatorVariant(enum TMPXPbvIndicator)
+	?HandleCollectionMediaL@CMPXCommonPlaybackViewImp@@MAEXABVCMPXMedia@@H@Z @ 109 NONAME ; void CMPXCommonPlaybackViewImp::HandleCollectionMediaL(class CMPXMedia const &, int)
+	?GetHelpContext@CMPXCommonPlaybackViewContainer@@UBEXAAVTCoeHelpContext@@@Z @ 110 NONAME ; void CMPXCommonPlaybackViewContainer::GetHelpContext(class TCoeHelpContext &) const
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/data/mpxcommonplaybackview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2459 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxcommonplaybackview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MCPV // 4 letter ID
+
+// INCLUDES
+#include <e32keys.h>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <aknsconstants.hrh>
+#include <bldvariant.hrh>
+#include <mpxcommonplaybackview.mbg>
+
+#include <AiwCommon.hrh>
+#include <AiwCommon.rh>
+#include <mpxcommonui.loc>
+#include <mpxcommonplaybackview.loc>
+#include "mpxcommonplaybackview.hrh"
+#include "mpxcommonplaybackviewui.rh"
+
+#include <data_caging_paths_strings.hrh>
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_view
+// Playback view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_mpx_playback_view
+    {
+    menubar = r_mpx_playback_view_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    toolbar = r_mpx_pbv_touch_toolbar;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_view_menubar
+// Playback view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_playback_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_playback_view_menu;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_view_menu
+// Playback view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_playback_view_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdGotoMusicMenu;
+            txt = qtn_mus_options_music_menu;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdRandom;
+            txt = qtn_mus_options_shuffle;
+            cascade = r_mpx_playback_random_sub_menu; 
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdRepeat;
+            txt = qtn_mus_option_repeat;
+            cascade = r_mpx_playback_repeat_sub_menu; 
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdFMTransmitter;
+            txt = qtn_nmp_go_to_fm_transmitter;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdUpnpPlayVia;
+            txt = qtn_mp_options_player;
+            cascade = r_mpx_playback_play_via_sub_menu; 
+            },
+#if defined(__EQUALIZER) && defined(__AUDIO_EFFECTS_API)
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdEqualizer;
+            txt = qtn_mus_options_equalizer;
+            },
+#endif
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdOpenMusicSettings;
+            txt = qtn_nmp_options_audio_settings;
+            },
+
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdAddToPlaylist;
+            txt = qtn_mus_options_add_to_pl;
+            cascade = r_mpx_pbv_add_to_pl_sub_menu;
+            },
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdUseAsCascade;
+            txt = qtn_mus_options_use_tone_as;
+            cascade = r_mpx_use_as_cascade;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_repeat_sub_menu
+// Playback view Repeat sub menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_playback_repeat_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdRepeatOff;
+            txt = qtn_nmp_options_repeat_subm_off;
+            flags = EEikMenuItemRadioStart;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdRepeatAll;
+            txt = qtn_nmp_repeat_subm_all;
+            flags = EEikMenuItemRadioMiddle;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdRepeatOne;
+            txt = qtn_nmp_repeat_subm_song;
+            flags = EEikMenuItemRadioEnd;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_random_sub_menu
+// Playback view Random sub menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_playback_random_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdRandomOff;
+            txt = qtn_nmp_options_random_subm_off;
+            flags = EEikMenuItemRadioEnd;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdRandomOn; 
+            txt = qtn_nmp_options_random_subm_on; 
+            flags = EEikMenuItemRadioStart;
+            }
+        };
+    }
+    
+// ---------------------------------------------------------------------------
+// r_mpx_playback_play_via_sub_menu
+// Playback view UPnP Play Via sub menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_playback_play_via_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdUpnpPlayViaLocal;
+            txt = qtn_nmp_options_player_device;
+            flags = EEikMenuItemRadioStart;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdUpnpPlayViaRemotePlayer;
+            txt = qtn_nmp_options_player_homenet;
+            flags = EEikMenuItemRadioEnd;
+            }
+        };
+    }    
+
+// -----------------------------------------------------------------------------
+//    r_mpx_add_to_pl_sub_menu
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_pbv_add_to_pl_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdAddToSavedPlaylist;
+            txt = qtn_nmp_sub_add_to_playlist_saved;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdAddToNewPlaylist;
+            txt = qtn_nmp_sub_add_to_playlist_new; 
+            }
+        };
+    }
+
+//------------------------------------------------------------------------------
+//
+//      r_mpx_aiw_assign_interest
+//      AIW interest criteria for "Use tone as" menu
+//
+//------------------------------------------------------------------------------
+//
+RESOURCE AIW_INTEREST r_mpx_aiw_assign_interest
+    {
+    items=
+        {
+        AIW_CRITERIA_ITEM
+            {
+            id = EMPXPbvCmdAiwCmdAssign;
+            serviceCmd = KAiwCmdAssign;
+            contentType = "*";
+            serviceClass = KAiwClassMenu;
+            }
+        };
+    }    
+
+//----------------------------------------------------
+//
+//    r_mplayer_use_as_cascade
+//
+//----------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_use_as_cascade
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdAiwCmdAssign;
+            txt = "";
+            }
+        };
+    }
+// ---------------------------------------------------------------------------
+// r_mpx_playbackview_title
+// Title for Playback view. Only used in landscape orientation.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_playbackview_title
+    {
+    buf = qtn_nmp_title_now_playing;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_no_tracks_label
+// Label for No tracks.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_pbv_no_tracks_label
+    {
+    buf = qtn_rp_nowplaying_empty;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_unknown_artist_label
+// Text to show when artist information is not available.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_pbv_unknown_artist_label
+    {
+    buf = qtn_nmp_unknown_artist;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_song_opening_label
+// Text used when song is opening.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_pbv_song_opening_label
+    {
+    buf = qtn_nmp_nowplaying_song_opening;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_playlist_item_counter_label
+// Text used for showing track position in the playlist.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_pbv_playlist_item_counter_label
+    {
+    buf = qtn_rp_nr_of_tracks;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_pbv_track_duration_format
+// Format used for track duration.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_pbv_track_duration_format
+    {
+    buf = qtn_nmp_nowplaying_song_duration;
+    }
+
+// -----------------------------------------------------------------------------
+//    r_mpx_wait_upnp_loading_song
+//    Text used in wait note while loading a song to remote player.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_wait_upnp_loading_song
+    {
+    buf = qtn_nmp_wait_loading_items;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_note_remote_connection_failed
+// Text used when a remote connection failed and player reverts to Local
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_note_remote_connection_failed
+    {
+    buf = qtn_nmp_note_remote_connection_failed;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_media_keys_not_supported
+// Display when media keys aren't supported by player
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_media_keys_not_supported
+    {
+    buf = qtn_nmp_note_no_media_key;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_generic_confirmation_query
+//    Generic confirmation query dialog.
+//
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_generic_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+
+// ***********************************************************
+// *** Rocker Key Sound setting                            ***
+// ***********************************************************
+
+// -----------------------------------------------------------------------------
+// r_mpx_pbv_left_right_keys_silent
+// Disable left right keys sounds while seeking
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SKEY_LIST r_mpx_pbv_left_right_keys_silent
+    {
+    list=
+        {
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyLeftArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeLong;
+            },
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyLeftArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeRepeat;
+            },
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyRightArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeLong;
+            },
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyRightArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeRepeat;
+            }
+        };
+    }
+
+// ***********************************************************
+// *** Layouts for lowest portrait with Rocker key mapping ***
+// ***********************************************************
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_track_value_layout
+// Label layout for track name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_value_layout
+    {
+    font = EAknLogicalFontTitleFont; C = 0; l = 6; r = 6; B = 88; W = 164; J = ELayoutAlignCenter;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_artist_value_layout
+// Label layout for artist name.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_artist_value_layout
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 6; r = 6; B = 104; W = 164; J = ELayoutAlignCenter;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_track_pos_layout
+// Label layout for track position.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_pos_layout
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 105; r = 6; B = 35; W = 65; J = ELayoutAlignRight;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_track_dur_layout
+// Label layout for track duration.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_dur_layout
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 6; r = 6; B = 118; W = 164; J = ELayoutAlignCenter;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_elapsed_time_layout
+// Label layout for elasped time value.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 6; r = 88; B = 118; W = 82; J = ELayoutAlignLeft;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_remaining_time_layout
+// Label layout for remaining time value.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 88; r = 6; B = 118; W = 82; J = ELayoutAlignRight;
+    }
+        
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_empty_state_txt_layout
+// Label layout for empty state.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_empty_state_txt_layout
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 6; r = 6; B = 88; W = 164; J = ELayoutAlignCenter;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_download_state_layout
+// Label layout for progressive download state.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_download_state_layout
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 6; r = 6; B = 141; W = 164; J = ELayoutAlignCenter;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_progress_bar_pane_layout
+// Pane layout for progress bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_pane_layout
+    {
+    l = 6; t = 121; W = 164; H = 8;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_progress_bar_background_layout
+// Image layout for progress bar background.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_background_layout
+    {
+    l = 0; t = 0; W = 164; H = 8;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_playback_progress_bar_layout
+// Image layout for playback progress bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_progress_bar_layout
+    {
+    l = 2; t = 2; W = 160; H = 4;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_download_progress_bar_layout
+// Image layout for download progress bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_download_progress_bar_layout
+    {
+    l = 2; t = 2; W = 160; H = 4;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_playback_indi_layout
+// Image layout for playback indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_indi_layout
+    {
+    l = 151; t = 6; W = 0; H = 0;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_shuffle_indi_layout
+// Image layout for shuffle indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_shuffle_indi_layout
+    {
+    l = 151; t = 6; W = 19; H = 15;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_repeat_indi_layout
+// Image layout for repeat indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_repeat_indi_layout
+    {
+    l = 128; t = 6; W = 19; H = 15;
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_real_indi_layout
+// Image layout for Real Player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_real_indi_layout
+    {
+    l = 105; t = 6; W = 19; H = 15;
+    }
+#endif
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_album_art_icon_layout
+// Image layout for album art icon.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_album_art_icon_layout
+    {
+    l = 11; t = 4; W = 87; H = 78;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_rocker_layout
+//    Image layout for rocker mapping.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_rocker_layout
+    {
+    l = 56; t = 135; W = 74; H = 29;
+    }
+
+
+// **************************************************************
+// *** Layouts for lowest portrait without Rocker key mapping ***
+// **************************************************************
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_value_layout_without_rocker
+//    Label layout for track name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_value_layout_without_rocker
+    {
+    font = EAknLogicalFontTitleFont; C = 0; l = 6; r = 6; B = 108; W = 164; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_artist_value_layout_without_rocker
+//    Label layout for artist name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_artist_value_layout_without_rocker
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 6; r = 6; B = 124; W = 164; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_pos_layout_without_rocker
+//    Label layout for track position.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_pos_layout_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 105; r = 6; B = 35; W = 65; J = ELayoutAlignRight;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_dur_layout_without_rocker
+//    Label layout for track duration.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_dur_layout_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 6; r = 6; B = 138; W = 164; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_without_rocker
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 6; r = 88; B = 138; W = 82; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_without_rocker
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 88; r = 6; B = 138; W = 82; J = ELayoutAlignRight;
+    }  
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_empty_state_txt_layout_without_rocker
+//    Label layout for empty state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_empty_state_txt_layout_without_rocker
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 6; r = 6; B = 98; W = 164; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_download_state_layout_without_rocker
+//    Label layout for progressive download state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_download_state_layout_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 6; r = 6; B = 166; W = 164; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_pane_layout_without_rocker
+//    Pane layout for progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_pane_layout_without_rocker
+    {
+    l = 6; t = 141; W = 164; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_background_layout_without_rocker
+//    Image layout for progress bar background.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_background_layout_without_rocker
+    {
+    l = 0; t = 0; W = 164; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_playback_progress_bar_layout_without_rocker
+//    Image layout for playback progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_progress_bar_layout_without_rocker
+    {
+    l = 2; t = 2; W = 160; H = 4;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_download_progress_bar_layout_without_rocker
+//    Image layout for download progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_download_progress_bar_layout_without_rocker
+    {
+    l = 2; t = 2; W = 160; H = 4;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_playback_indi_layout_without_rocker
+//    Image layout for playback indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_indi_layout_without_rocker
+    {
+    l = 151; t = 6; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_shuffle_indi_layout_without_rocker
+//    Image layout for shuffle indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_shuffle_indi_layout_without_rocker
+    {
+    l = 128; t = 6; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_repeat_indi_layout_without_rocker
+//    Image layout for repeat indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_repeat_indi_layout_without_rocker
+    {
+    l = 105; t = 6; W = 19; H = 15;
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_real_indi_layout_without_rocker
+// Image layout for Real Player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_real_indi_layout_without_rocker
+    {
+    l = 83; t = 6; W = 19; H = 15;
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_album_art_icon_layout_without_rocker
+//    Image layout for album art icon.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_album_art_icon_layout_without_rocker
+    {
+    l = 6; t = 6; W = 82; H = 82;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_playback_rocker_layout_without_rocker
+//    Image layout for rocker mapping.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_rocker_layout_without_rocker
+    {
+    l = 0; t = 142; W = 0; H = 0;
+    }
+
+
+// *************************************************************
+// *** Layouts for double portrait ***
+// *************************************************************
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_value_layout_double_portrait
+//    Label layout for track name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_value_layout_double_portrait
+    {
+    font = EAknLogicalFontTitleFont; C = 215; l = 10; r = 10; B = 226; W = 332; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_artist_value_layout_double_portrait
+//    Label layout for artist name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_artist_value_layout_double_portrait
+    {
+    font = EAknLogicalFontPrimaryFont; C = 215; l = 10; r = 10; B = 258; W = 332; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_pos_layout_double_portrait
+//    Label layout for track position.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_pos_layout_double_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 214; r = 10; B = 68; W = 128; J = ELayoutAlignRight;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_dur_layout_double_portrait
+//    Label layout for track duration.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_dur_layout_double_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 10; r = 12; B = 312; W = 332; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_double_portrait
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_double_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 10; r = 266; B = 312; W = 76; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_double_portrait
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_double_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 266; r = 10; B = 312; W = 76; J = ELayoutAlignRight;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_empty_state_txt_layout_double_portrait
+//    Label layout for empty state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_empty_state_txt_layout_double_portrait
+    {
+    font = EAknLogicalFontPrimaryFont; C = 215; l = 10; r = 10; B = 238; W = 332; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_download_state_layout_double_portrait
+//    Label layout for progressive download state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_download_state_layout_double_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 10; r = 10; B = 365; W = 332; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_pane_layout_double_portrait
+//    Pane layout for progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_pane_layout_double_portrait
+    {
+    l = 10; t = 276; W = 332; H = 16;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_background_layout_double_portrait
+//    Image layout for progress bar background.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_background_layout_double_portrait
+    {
+    l = 0; t = 0; W = 332; H = 16;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_playback_progress_bar_layout_double_portrait
+//    Image layout for playback progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_progress_bar_layout_double_portrait
+    {
+    l = 4; t = 4; W = 324; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_download_progress_bar_layout_double_portrait
+//    Image layout for download progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_download_progress_bar_layout_double_portrait
+    {
+    l = 4; t = 4; W = 324; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_playback_indi_layout_double_portrait
+//    Image layout for playback indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_indi_layout_double_portrait
+    {
+    l = 304; t = 10; W = 38; H = 30;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_shuffle_indi_layout_double_portrait
+//    Image layout for shuffle indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_shuffle_indi_layout_double_portrait
+    {
+    l = 260; t = 10; W = 38; H = 30;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_repeat_indi_layout_double_portrait
+//    Image layout for repeat indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_repeat_indi_layout_double_portrait
+    {
+    l = 216; t = 10; W = 38; H = 30;
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_real_indi_layout_double_portrait
+// Image layout for Real Player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_real_indi_layout_double_portrait
+    {
+    l = 172; t = 10; W = 19; H = 15;
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_album_art_icon_layout_double_portrait
+//    Image layout for album art icon.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_album_art_icon_layout_double_portrait
+    {
+    l = 10; t = 10; W = 174; H = 174;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_rocker_layout_double_portrait
+//    Image layout for rocker mapping.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_rocker_layout_double_portrait
+    {
+    l = 244; t = 80; W = 98; H = 98;
+    }
+
+
+// *********************************************************
+// *** Layouts for Qvga portrait with Rocker key mapping ***
+// *********************************************************
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_value_layout_qvga_portrait
+//    Label layout for track name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_value_layout_qvga_portrait
+    {
+    font = EAknLogicalFontTitleFont; C = 0; l = 15; r = 15; B = 151; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_artist_value_layout_qvga_portrait
+//    Label layout for artist name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_artist_value_layout_qvga_portrait
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 15; r = 15; B = 171; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_pos_layout_qvga_portrait
+//    Label layout for track position.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_pos_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 150; r = 15; B = 43; W = 75; J = ELayoutAlignRight;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_dur_layout_qvga_portrait
+//    Label layout for track duration.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_dur_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 15; B = 202; W = 210; J = ELayoutAlignCenter;
+    }
+
+#if defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS) || defined(__JAPANESE)
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_portrait
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 125; B = 208; W = 100; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_portrait
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 125; r = 15; B = 208; W = 100; J = ELayoutAlignRight;
+    }
+#else
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_portrait
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 125; B = 202; W = 100; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_portrait
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 125; r = 15; B = 202; W = 100; J = ELayoutAlignRight;
+    }
+#endif // defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS) || defined(__JAPANESE)
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_empty_state_txt_layout_qvga_portrait
+//    Label layout for empty state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_empty_state_txt_layout_qvga_portrait
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 15; r = 15; B = 144; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_download_state_layout_qvga_portrait
+//    Label layout for progressive download state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_download_state_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 15; B = 220; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_pane_layout_qvga_portrait
+//    Pane layout for progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_pane_layout_qvga_portrait
+    {
+    l = 15; t = 177; W = 210; H = 10;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_background_layout_qvga_portrait
+//    Image layout for progress bar background.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_background_layout_qvga_portrait
+    {
+    l = 0; t = 0; W = 210; H = 10;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_playback_progress_bar_layout_qvga_portrait
+//    Image layout for playback progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_progress_bar_layout_qvga_portrait
+    {
+    l = 2; t = 2; W = 206; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_download_progress_bar_layout_qvga_portrait
+//    Image layout for download progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_download_progress_bar_layout_qvga_portrait
+    {
+    l = 2; t = 2; W = 206; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_playback_indi_layout_qvga_portrait
+//    Image layout for playback indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_indi_layout_qvga_portrait
+    {
+    l = 207; t = 8; W = 0; H = 0;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_shuffle_indi_layout_qvga_portrait
+//    Image layout for shuffle indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_shuffle_indi_layout_qvga_portrait
+    {
+    l = 206; t = 8; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_repeat_indi_layout_qvga_portrait
+//    Image layout for repeat indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_repeat_indi_layout_qvga_portrait
+    {
+    l = 183; t = 8; W = 19; H = 15;
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_real_indi_layout_qvga_portrait
+// Image layout for Real Player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_real_indi_layout_qvga_portrait
+    {
+    l = 160; t = 8; W = 19; H = 15;
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_album_art_icon_layout_qvga_portrait
+//    Image layout for album art icon.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_album_art_icon_layout_qvga_portrait
+    {
+    l = 15; t = 8; W = 115; H = 115;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_rocker_layout_qvga_portrait
+//    Image layout for rocker mapping.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_rocker_layout_qvga_portrait
+    {
+    l = 70; t = 221; W = 100; H = 45;
+    }
+
+
+// ***********************************************************
+// *** Layouts for Qvga portrait without Rocker key maping ***
+// ***********************************************************
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_value_layout_qvga_portrait_without_rocker
+//    Label layout for track name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_value_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontTitleFont; C = 0; l = 15; r = 15; B = 165; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_artist_value_layout_qvga_portrait_without_rocker
+//    Label layout for artist name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_artist_value_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 15; r = 15; B = 191; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_pos_layout_qvga_portrait_without_rocker
+//    Label layout for track position.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_pos_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 150; r = 15; B = 43; W = 75; J = ELayoutAlignRight;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_dur_layout_qvga_portrait_without_rocker
+//    Label layout for track duration.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_dur_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 15; B = 235; W = 210; J = ELayoutAlignCenter;
+    }
+
+#if defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS) || defined(__JAPANESE)
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_portrait_without_rocker
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 125; B = 241; W = 100; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_portrait_without_rocker
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 125; r = 15; B = 241; W = 100; J = ELayoutAlignRight;
+    }
+#else
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_portrait_without_rocker
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 125; B = 235; W = 100; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_portrait_without_rocker
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 125; r = 15; B = 235; W = 100; J = ELayoutAlignRight;
+    }
+#endif // defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS) || defined(__JAPANESE)
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_empty_state_txt_layout_qvga_portrait_without_rocker
+//    Label layout for empty state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_empty_state_txt_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 15; r = 15; B = 143; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_download_state_layout_qvga_portrait_without_rocker
+//    Label layout for progressive download state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_download_state_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 15; B = 260; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_pane_layout_qvga_portrait_without_rocker
+//    Pane layout for progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_pane_layout_qvga_portrait_without_rocker
+    {
+    l = 15; t = 207; W = 210; H = 10;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_background_layout_qvga_portrait_without_rocker
+//    Image layout for progress bar background.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_background_layout_qvga_portrait_without_rocker
+    {
+    l = 0; t = 0; W = 210; H = 10;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_playback_progress_bar_layout_qvga_portrait_without_rocker
+//    Image layout for playback progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_progress_bar_layout_qvga_portrait_without_rocker
+    {
+    l = 2; t = 2; W = 206; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_download_progress_bar_layout_qvga_portrait_without_rocker
+//    Image layout for download progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_download_progress_bar_layout_qvga_portrait_without_rocker
+    {
+    l = 2; t = 2; W = 206; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_playback_indi_layout_qvga_portrait_without_rocker
+//    Image layout for playback indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_indi_layout_qvga_portrait_without_rocker
+    {
+    l = 210; t = 8; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_shuffle_indi_layout_qvga_portrait_without_rocker
+//    Image layout for shuffle indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_shuffle_indi_layout_qvga_portrait_without_rocker
+    {
+    l = 187; t = 8; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_repeat_indi_layout_qvga_portrait_without_rocker
+//    Image layout for repeat indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_repeat_indi_layout_qvga_portrait_without_rocker
+    {
+    l = 164; t = 8; W = 19; H = 15;
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_real_indi_layout_qvga_portrait_without_rocker
+// Image layout for Real Player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_real_indi_layout_qvga_portrait_without_rocker
+    {
+    l = 141; t = 8; W = 19; H = 15;
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_album_art_icon_layout_qvga_portrait_without_rocker
+//    Image layout for album art icon.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_album_art_icon_layout_qvga_portrait_without_rocker
+    {
+    l = 15; t = 8; W = 115; H = 115;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_rocker_layout_qvga_portrait_without_rocker
+//    Image layout for rocker mapping.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_rocker_layout_qvga_portrait_without_rocker
+    {
+    l = 0; t = 221; W = 0; H = 0;
+    }
+
+
+// **********************************************************
+// *** Layouts for Qvga Landscape with Rocker key mapping ***
+// **********************************************************
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_value_layout_qvga_landscape
+//    Label layout for track name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_value_layout_qvga_landscape
+    {
+    font = EAknLogicalFontTitleFont; C = 0; l = 15; r = 15; B = 150; W = 290; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_artist_value_layout_qvga_landscape
+//    Label layout for artist name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_artist_value_layout_qvga_landscape
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 15; r = 15; B = 168; W = 290; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_pos_layout_qvga_landscape
+//    Label layout for track position.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_pos_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 15; B = 186; W = 290; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_dur_layout_qvga_landscape
+//    Label layout for track duration.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_dur_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 150; r = 15; B = 35; W = 155; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_landscape
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 150; r = 96; B = 35; W = 74; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_landscape
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 231; r = 15; B = 35; W = 74; J = ELayoutAlignRight;
+    }  
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_empty_state_txt_layout_qvga_landscape
+//    Label layout for empty state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_empty_state_txt_layout_qvga_landscape
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 15; r = 15; B = 150; W = 290; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_download_state_layout_qvga_landscape
+//    Label layout for progressive download state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_download_state_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 150; r = 15; B = 71; W = 155; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_pane_layout_qvga_landscape
+//    Pane layout for progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_pane_layout_qvga_landscape
+    {
+    l = 150; t = 43; W = 155; H = 10;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_background_layout_qvga_landscape
+//    Image layout for progress bar background.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_background_layout_qvga_landscape
+    {
+    l = 0; t = 0; W = 155; H = 10;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_playback_progress_bar_layout_qvga_landscape
+//    Image layout for playback progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_progress_bar_layout_qvga_landscape
+    {
+    l = 2; t = 2; W = 151; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_download_progress_bar_layout_qvga_landscape
+//    Image layout for download progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_download_progress_bar_layout_qvga_landscape
+    {
+    l = 2; t = 2; W = 151; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_playback_indi_layout_qvga_landscape
+//    Image layout for playback indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_indi_layout_qvga_landscape
+    {
+    l = 207; t = 8; W = 0; H = 0;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_shuffle_indi_layout_qvga_landscape
+//    Image layout for shuffle indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_shuffle_indi_layout_qvga_landscape
+    {
+    l = 286; t = 6; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_repeat_indi_layout_qvga_landscape
+//    Image layout for repeat indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_repeat_indi_layout_qvga_landscape
+    {
+    l = 259; t = 6; W = 19; H = 15;
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_real_indi_layout_qvga_landscape
+// Image layout for Real Player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_real_indi_layout_qvga_landscape
+    {
+    l = 232; t = 6; W = 19; H = 15;
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_album_art_icon_layout_qvga_landscape
+//    Image layout for album art icon.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_album_art_icon_layout_qvga_landscape
+    {
+    l = 15; t = 6; W = 115; H = 115;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_rocker_layout_qvga_landscape
+//    Image layout for rocker mapping.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_rocker_layout_qvga_landscape
+    {
+    l = 213; t = 81; W = 100; H = 45;
+    }
+
+
+// *************************************************************
+// *** Layouts for Qvga Landscape without Rocker key mapping ***
+// *************************************************************
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_value_layout_qvga_landscape_without_rocker
+//    Label layout for track name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_value_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontTitleFont; C = 215; l = 15; r = 15; B = 150; W = 290; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_artist_value_layout_qvga_landscape_without_rocker
+//    Label layout for artist name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_artist_value_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontPrimaryFont; C = 215; l = 15; r = 15; B = 168; W = 290; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_pos_layout_qvga_landscape_without_rocker
+//    Label layout for track position.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_pos_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 15; r = 15; B = 186; W = 290; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_dur_layout_qvga_landscape_without_rocker
+//    Label layout for track duration.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_dur_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 150; r = 15; B = 35; W = 155; J = ELayoutAlignRight;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_landscape_without_rocker
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 150; r = 96; B = 35; W = 74; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_landscape_without_rocker
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 231; r = 15; B = 35; W = 74; J = ELayoutAlignRight;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_empty_state_txt_layout_qvga_landscape_without_rocker
+//    Label layout for empty state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_empty_state_txt_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontPrimaryFont; C = 215; l = 15; r = 15; B = 106; W = 290; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_download_state_layout_qvga_landscape_without_rocker
+//    Label layout for progressive download state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_download_state_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 150; r = 15; B = 71; W = 155; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_pane_layout_qvga_landscape_without_rocker
+//    Pane layout for progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_pane_layout_qvga_landscape_without_rocker
+    {
+    l = 150; t = 43; W = 155; H = 10;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_background_layout_qvga_landscape_without_rocker
+//    Image layout for progress bar background.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_background_layout_qvga_landscape_without_rocker
+    {
+    l = 0; t = 0; W = 155; H = 10;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_playback_progress_bar_layout_qvga_landscape_without_rocker
+//    Image layout for playback progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_progress_bar_layout_qvga_landscape_without_rocker
+    {
+    l = 2; t = 2; W = 151; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_download_progress_bar_layout_qvga_landscape_without_rocker
+//    Image layout for download progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_download_progress_bar_layout_qvga_landscape_without_rocker
+    {
+    l = 2; t = 2; W = 151; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_playback_indi_layout_qvga_landscape_without_rocker
+//    Image layout for playback indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_indi_layout_qvga_landscape_without_rocker
+    {
+    l = 286; t = 6; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_shuffle_indi_layout_qvga_landscape_without_rocker
+//    Image layout for shuffle indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_shuffle_indi_layout_qvga_landscape_without_rocker
+    {
+    l = 259; t = 6; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_repeat_indi_layout_qvga_landscape_without_rocker
+//    Image layout for repeat indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_repeat_indi_layout_qvga_landscape_without_rocker
+    {
+    l = 232; t = 6; W = 19; H = 15;
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_real_indi_layout_qvga_landscape_without_rocker
+// Image layout for Real Player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_real_indi_layout_qvga_landscape_without_rocker
+    {
+    l = 205; t = 6; W = 19; H = 15;
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_album_art_icon_layout_qvga_landscape_without_rocker
+//    Image layout for album art icon.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_album_art_icon_layout_qvga_landscape_without_rocker
+    {
+    l = 15; t = 6; W = 115; H = 115;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_rocker_layout_qvga_landscape_without_rocker
+//    Image layout for rocker mapping.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_rocker_layout_qvga_landscape_without_rocker
+    {
+    l = 149; t = 60; W = 0; H = 0;
+    }
+    
+RESOURCE AVKON_BUTTONS r_mpx_pbv_rocker_avkon_buttons
+    {
+    buttons = 
+        {
+        //Play
+        AVKON_BUTTON
+            {
+            flags=KAknButtonNoFrame|KAknButtonNoClear|KAknButtonHitTest|KAknButtonNoFramePressEvent|KAknButtonRequestExitOnButtonUpEvent;
+            states =
+                {
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_play; 
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_play_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_play_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_play_dimmed_mask;
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_play_focused;
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_play_focused_mask;
+                    extension = r_mpx_pbv_rocker_avkon_buttons_play_extension;
+                    },
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_play; 
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_play_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_play_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_play_dimmed_mask;
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_play_focused;
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_play_focused_mask;
+                    extension = r_mpx_pbv_rocker_avkon_buttons_play_extension;
+                    }
+                };
+            },
+        //Pause
+        AVKON_BUTTON
+            {
+            flags=KAknButtonNoFrame|KAknButtonNoClear|KAknButtonHitTest|KAknButtonNoFramePressEvent|KAknButtonRequestExitOnButtonUpEvent;
+            states =
+                {
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause; 
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause_dimmed_mask;
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause_focused;
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause_focused_mask;
+                    extension = r_mpx_pbv_rocker_avkon_buttons_pause_extension;
+                    },
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause; 
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause_dimmed_mask;
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause_focused;
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_pause_focused_mask;
+                    extension = r_mpx_pbv_rocker_avkon_buttons_pause_extension;
+                    }
+                };
+            },
+        //FF
+        AVKON_BUTTON
+            {
+            // Original flags for fast forward
+            flags=KAknButtonNoFrame|KAknButtonNoClear|KAknButtonHitTest|KAknButtonNoFramePressEvent|KAknButtonReportOnLongPress|KAknButtonRequestExitOnButtonUpEvent;
+            //flags=KAknButtonNoFrame|KAknButtonNoClear|KAknButtonHitTest|KAknButtonNoFramePressEvent|KAknButtonRequestExitOnButtonUpEvent|KAknButtonKeyRepeat;
+            states =
+                {
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward; 
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward_dimmed_mask;
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward_focused;
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward_focused_mask;
+                    extension = r_mpx_pbv_rocker_avkon_buttons_forward_extension;
+                    },
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward; 
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward_dimmed_mask;
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward_focused;
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_forward_focused_mask;
+                    extension = r_mpx_pbv_rocker_avkon_buttons_forward_extension;
+                    }
+                };
+            },
+        // FR
+        AVKON_BUTTON
+            {
+            flags=KAknButtonNoFrame|KAknButtonNoClear|KAknButtonHitTest|KAknButtonNoFramePressEvent|KAknButtonReportOnLongPress|KAknButtonRequestExitOnButtonUpEvent;
+            states =
+                {
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind; 
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind_dimmed_mask;
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind_focused;
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind_focused_mask;
+                    extension = r_mpx_pbv_rocker_avkon_buttons_rewind_extension;
+                    },
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind; 
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind_dimmed_mask;
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind_focused;
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_rewind_focused_mask;
+                    extension = r_mpx_pbv_rocker_avkon_buttons_rewind_extension;
+                    }
+                };
+            }
+        };
+    }
+    
+    RESOURCE AVKON_BUTTONS r_mpx_pbv_rocker_volume_avkon_buttons
+    {
+    buttons = 
+        {
+        // Volumn Down
+        AVKON_BUTTON
+            {
+            flags=KAknButtonNoFrame|KAknButtonNoClear|KAknButtonHitTest|KAknButtonNoFramePressEvent|KAknButtonRequestExitOnButtonUpEvent|KAknButtonKeyRepeat;
+            //flags=KAknButtonNoFrame|KAknButtonNoClear|KAknButtonHitTest|KAknButtonNoFramePressEvent|KAknButtonReportOnLongPress|KAknButtonRequestExitOnButtonUpEvent;
+            states =
+                {
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down; 
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down_dimmed_mask;
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down_focused;
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down_focused_mask;
+                    extension=r_mpx_pbv_rocker_volume_avkon_buttons_down_extension;
+                    },
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down; 
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down_dimmed_mask;
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down_focused;
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_down_focused_mask;
+                    extension=r_mpx_pbv_rocker_volume_avkon_buttons_down_extension;
+                    }
+                };
+            },
+        // Volumn UP
+        AVKON_BUTTON
+            {
+            // original flags for volume
+            flags=KAknButtonNoFrame|KAknButtonNoClear|KAknButtonHitTest|KAknButtonNoFramePressEvent|KAknButtonRequestExitOnButtonUpEvent|KAknButtonKeyRepeat;
+            //flags=KAknButtonNoFrame|KAknButtonNoClear|KAknButtonHitTest|KAknButtonNoFramePressEvent|KAknButtonReportOnLongPress|KAknButtonRequestExitOnButtonUpEvent;
+            states =
+                {
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up; 
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up_dimmed_mask;
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up_focused;
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up_focused_mask;
+                    extension=r_mpx_pbv_rocker_volume_avkon_buttons_up_extension;
+                    },
+                AVKON_BUTTON_STATE
+                    {
+                    bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                    press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up; 
+                    press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up_mask;
+                    dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up_dimmed;
+                    dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up_dimmed_mask;
+                    bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up_focused;
+                    bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_volume_up_focused_mask;
+                    extension=r_mpx_pbv_rocker_volume_avkon_buttons_up_extension;
+                    }
+                };
+            }
+        };
+    }
+    
+RESOURCE AVKON_BUTTON r_mpx_pbv_rocker_stop_avkon_button
+    {
+    //Stop
+    flags=KAknButtonNoFrame|KAknButtonNoClear|KAknButtonHitTest|KAknButtonNoFramePressEvent|KAknButtonRequestExitOnButtonUpEvent;
+    states =
+        {
+        AVKON_BUTTON_STATE
+            {
+            bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+            bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop; 
+            bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop_mask;
+            dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop_dimmed;
+            dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop_dimmed_mask;
+            press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop_focused;
+            press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop_focused_mask;
+            extension = r_mpx_pbv_rocker_stop_avkon_button_extension;
+            },
+        AVKON_BUTTON_STATE
+            {
+            bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+            press_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop; 
+            press_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop_mask;
+            dim_bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop_dimmed;
+            dim_bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop_dimmed_mask;
+            bmpid=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop_focused;
+            bmpmask=EMbmMpxcommonplaybackviewQgn_indi_mup4_stop_focused_mask;
+            extension = r_mpx_pbv_rocker_stop_avkon_button_extension;
+            }
+        };
+    }
+//----------------------------------------------------
+//   
+//    r_mpx_pbv_touch_toolbar
+//
+//----------------------------------------------------
+//
+RESOURCE AVKON_TOOLBAR r_mpx_pbv_touch_toolbar
+    {
+    flags = KAknToolbarFixed|KAknToolbarTransparent|KAknToolbarWithoutCba;
+    items =
+        {
+        TBAR_CTRL
+            {
+            type = EAknCtButton;
+            id = EMPXPbvCmdPreviousListItem;
+            control = AVKON_BUTTON
+                {
+                flags = KAknButtonReportOnLongPress;
+                states =
+                    {
+                    AVKON_BUTTON_STATE
+                        {
+                        bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                        bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev; 
+                        bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev_mask;
+                        dim_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev_dimmed;
+                        dim_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev_dimmed_mask;
+                        press_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev_focused;
+                        press_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev_focused_mask;
+                        extension = r_mpx_pbv_touch_toolbar_prev_button_state_extension;
+                        }
+                    };            
+                };
+            },
+            
+        TBAR_CTRL
+            {
+            type = EAknCtButton;
+              id = EMPXPbvCmdPlayPause;
+            control = AVKON_BUTTON
+                {
+                flags = 0;
+                states =
+                    {
+                    AVKON_BUTTON_STATE
+                        {
+                        bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                        bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause; 
+                        bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause_mask;
+                        dim_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause_dimmed;
+                        dim_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause_dimmed_mask;
+                        press_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause_focused;
+                        press_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause_focused_mask;
+                        extension = r_mpx_pbv_touch_toolbar_pause_button_state_extension;
+                        },                 
+                    AVKON_BUTTON_STATE
+                        {
+                        bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                        bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2; 
+                        bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2_mask;
+                        dim_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2_dimmed;
+                        dim_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2_dimmed_mask;
+                        press_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2_focused;
+                        press_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2_focused_mask;
+                        extension = r_mpx_pbv_touch_toolbar_play_button_state_extension;
+                        }                 
+                    };            
+                };
+            },
+        TBAR_CTRL
+            {
+            type = EAknCtButton;
+            id = EMPXPbvCmdNextListItem;
+            control = AVKON_BUTTON
+                {
+                flags = KAknButtonReportOnLongPress;
+                states =
+                    {
+                    AVKON_BUTTON_STATE
+                        {
+                        bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+                        bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next; 
+                        bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next_mask;
+                        dim_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next_dimmed;
+                        dim_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next_dimmed_mask;
+                        press_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next_focused;
+                        press_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next_focused_mask;
+                        extension = r_mpx_pbv_touch_toolbar_next_button_state_extension;
+                        }                 
+                    };            
+                };
+            }
+        };    
+    }
+
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mpx_pbv_touch_toolbar_prev_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric; 
+    bmbSkinIdMinor = EAknsMinorGenericQgnPropImageTbPrev;
+    dimSkinIdMajor = EAknsMajorGeneric;
+    dimSkinIdMinor = EAknsMinorGenericQgnPropImageTbPrevDimmed;
+    pressSkinIdMajor = EAknsMajorGeneric;
+    pressSkinIdMinor = EAknsMinorGenericQgnPropImageTbPrevFocused;
+    }
+    
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mpx_pbv_touch_toolbar_next_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric; 
+    bmbSkinIdMinor = EAknsMinorGenericQgnPropImageTbNext;    
+    dimSkinIdMajor = EAknsMajorGeneric;
+    dimSkinIdMinor = EAknsMinorGenericQgnPropImageTbNextDimmed;
+    pressSkinIdMajor = EAknsMajorGeneric;
+    pressSkinIdMinor = EAknsMinorGenericQgnPropImageTbNextFocused;   
+    }    
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mpx_pbv_touch_toolbar_play_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric; 
+    bmbSkinIdMinor = EAknsMinorGenericQgnPropImageTbPlay2;    
+    dimSkinIdMajor = EAknsMajorGeneric;
+    dimSkinIdMinor = EAknsMinorGenericQgnPropImageTbPlay2Dimmed;
+    pressSkinIdMajor = EAknsMajorGeneric;
+    pressSkinIdMinor = EAknsMinorGenericQgnPropImageTbPlay2Focused;  
+    }
+    
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mpx_pbv_touch_toolbar_pause_button_state_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric; 
+    bmbSkinIdMinor = EAknsMinorGenericQgnPropImageTbPause;    
+    dimSkinIdMajor = EAknsMajorGeneric;
+    dimSkinIdMinor = EAknsMinorGenericQgnPropImageTbPauseDimmed;
+    pressSkinIdMajor = EAknsMajorGeneric;
+    pressSkinIdMinor = EAknsMinorGenericQgnPropImageTbPauseFocused;    
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mpx_pbv_rocker_avkon_buttons_play_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric; 
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiMup4Play;
+    dimSkinIdMajor = EAknsMajorGeneric;
+    dimSkinIdMinor = EAknsMinorGenericQgnIndiMup4PlayDimmed;
+    pressSkinIdMajor = EAknsMajorGeneric;
+    pressSkinIdMinor = EAknsMinorGenericQgnIndiMup4PlayFocused;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mpx_pbv_rocker_stop_avkon_button_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric; 
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiMup4Stop;
+    dimSkinIdMajor = EAknsMajorGeneric;
+    dimSkinIdMinor = EAknsMinorGenericQgnIndiMup4StopDimmed;
+    pressSkinIdMajor = EAknsMajorGeneric;
+    pressSkinIdMinor = EAknsMinorGenericQgnIndiMup4StopFocused;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mpx_pbv_rocker_avkon_buttons_pause_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric; 
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiMup4Pause;
+    dimSkinIdMajor = EAknsMajorGeneric;
+    dimSkinIdMinor = EAknsMinorGenericQgnIndiMup4PauseDimmed;
+    pressSkinIdMajor = EAknsMajorGeneric;
+    pressSkinIdMinor = EAknsMinorGenericQgnIndiMup4PauseFocused;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mpx_pbv_rocker_avkon_buttons_forward_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric; 
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiMup4Forward;
+    dimSkinIdMajor = EAknsMajorGeneric;
+    dimSkinIdMinor = EAknsMinorGenericQgnIndiMup4ForwardDimmed;
+    pressSkinIdMajor = EAknsMajorGeneric;
+    pressSkinIdMinor = EAknsMinorGenericQgnIndiMup4ForwardFocused;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mpx_pbv_rocker_avkon_buttons_rewind_extension
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric; 
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiMup4Rewind;
+    dimSkinIdMajor = EAknsMajorGeneric;
+    dimSkinIdMinor = EAknsMinorGenericQgnIndiMup4RewindDimmed;
+    pressSkinIdMajor = EAknsMajorGeneric;
+    pressSkinIdMinor = EAknsMinorGenericQgnIndiMup4RewindFocused;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mpx_pbv_rocker_volume_avkon_buttons_down_extension
+	{
+    bmbSkinIdMajor = EAknsMajorGeneric; 
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiMup4VolumeDown;
+    dimSkinIdMajor = EAknsMajorGeneric;
+    dimSkinIdMinor = EAknsMinorGenericQgnIndiMup4VolumeDownDimmed;
+    pressSkinIdMajor = EAknsMajorGeneric;
+    pressSkinIdMinor = EAknsMinorGenericQgnIndiMup4VolumeDownFocused;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION  r_mpx_pbv_rocker_volume_avkon_buttons_up_extension
+	{
+    bmbSkinIdMajor = EAknsMajorGeneric; 
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiMup4VolumeUp;
+    dimSkinIdMajor = EAknsMajorGeneric;
+    dimSkinIdMinor = EAknsMinorGenericQgnIndiMup4VolumeUpDimmed;
+    pressSkinIdMajor = EAknsMajorGeneric;
+    pressSkinIdMinor = EAknsMinorGenericQgnIndiMup4VolumeUpFocused;
+    }
+// ---------------------------------------------------------------------------
+// r_mpx_request_rejected
+// Error note when tapping on the progress bar in remote mode.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_request_rejected
+    {
+    buf = text_request_rejected;
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/data/mpxcommonplaybackviewui.rh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Resource header for project mpxcommonplaybackviewui
+*
+*/
+
+
+#ifndef __MPXCOMMONPLAYBACKVIEWUI_BUTTON_RH__
+#define __MPXCOMMONPLAYBACKVIEW_BUTTON_RH__
+
+STRUCT AVKON_BUTTONS
+	{
+	STRUCT buttons[];
+	}
+
+#endif __MPXCOMMONPLAYBACKVIEW_BUTTON_RH__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/data/mpxfmtx.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,176 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project FM TX features within 
+*				 mpxcommonplaybackview
+*
+*/
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    FMTX // 4 letter ID
+
+// INCLUDES
+#include <e32keys.h>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+
+#include <mpxcommonplaybackview.loc>
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------------------------
+// r_mpx_fm_frequency_label
+// Label for FM Transmitter frequency
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_fm_frequency_label
+    {
+    buf = qtn_nmp_display_fm_freq;
+    }
+
+// ***********************************************************
+// *** Layouts for lowest portrait with Rocker key mapping ***
+// ***********************************************************
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_fm_frequency_value_layout
+// Label layout for fm frequency.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_fm_frequency_value_layout
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 105; r = 6; B = 56; W = 82; J = ELayoutAlignRight;
+    }
+    
+// **************************************************************
+// *** Layouts for lowest portrait without Rocker key mapping ***
+// **************************************************************
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_fm_frequency_value_layout_without_rocker
+// Label layout for fm frequency.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_fm_frequency_value_layout_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 105; r = 6; B = 56; W = 65; J = ELayoutAlignRight;
+    }  
+    
+// *************************************************************
+// *** Layouts for double portrait ***
+// *************************************************************
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_fm_frequency_value_layout_double_portrait
+// Label layout for fm frequency.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_fm_frequency_value_layout_double_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 214; r = 10; B = 89; W = 128; J = ELayoutAlignRight;
+    }      
+    
+// *********************************************************
+// *** Layouts for Qvga portrait with Rocker key mapping ***
+// *********************************************************
+#if defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS)
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_fm_frequency_value_layout_qvga_portrait
+// Label layout for fm frequency.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_fm_frequency_value_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 134; r = 15; B = 66; W = 97; J = ELayoutAlignRight;
+    }  
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_fm_frequency_value_layout_qvga_portrait
+// Label layout for fm frequency.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_fm_frequency_value_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 150; r = 15; B = 66; W = 81; J = ELayoutAlignRight;
+    }    
+#endif  
+    
+// ***********************************************************
+// *** Layouts for Qvga portrait without Rocker key maping ***
+// ***********************************************************
+#if defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS)
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_fm_frequency_value_layout_qvga_portrait_without_rocker
+// Label layout for fm frequency.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_fm_frequency_value_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 134; r = 15; B = 66; W = 97; J = ELayoutAlignRight;
+    }   
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_fm_frequency_value_layout_qvga_portrait_without_rocker
+// Label layout for fm frequency.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_fm_frequency_value_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 150; r = 15; B = 66; W = 81; J = ELayoutAlignRight;
+    }   
+#endif 
+    
+// **********************************************************
+// *** Layouts for Qvga Landscape with Rocker key mapping ***
+// **********************************************************
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_fm_frequency_value_layout_qvga_landscape
+// Label layout for fm frequency.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_fm_frequency_value_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 205; r = 15; B = 186; W = 100; J = ELayoutAlignRight;
+    }   
+    
+// *************************************************************
+// *** Layouts for Qvga Landscape without Rocker key mapping ***
+// *************************************************************
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_fm_frequency_value_layout_qvga_landscape_without_rocker
+// Label layout for fm frequency.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_fm_frequency_value_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 205; r = 15; B = 186; W = 100; J = ELayoutAlignRight;
+    }
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/data/mpxunifiedcommonplaybackview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1338 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxcommonplaybackview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MCPV // 4 letter ID
+
+// INCLUDES
+#include <e32keys.h>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+#include <mpxcommonplaybackview.mbg>
+
+#include <mpxcommonui.loc>
+#include <mpxcommonplaybackview.loc>
+#include "mpxcommonplaybackview.hrh"
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_view
+// Playback view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_mpx_playback_view
+    {
+    menubar = r_mpx_playback_view_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_view_menubar
+// Playback view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_playback_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_playback_view_menu;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_view_menu
+// Playback view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_playback_view_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdGotoMusicMenu;
+            txt = qtn_mus_options_music_menu;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdRandom;
+            txt = qtn_mus_options_shuffle;
+            cascade = r_mpx_playback_random_sub_menu; 
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdRepeat;
+            txt = qtn_mus_option_repeat;
+            cascade = r_mpx_playback_repeat_sub_menu; 
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdFMTransmitter;
+            txt = qtn_nmp_go_to_fm_transmitter;
+            },
+//#ifdef __UPNP_FRAMEWORK_2_0_
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdUpnpPlayVia;
+            txt = qtn_mp_options_player;
+            cascade = r_mpx_playback_play_via_sub_menu; 
+            },
+//#endif //__UPNP_FRAMEWORK_2_0_
+#if defined(__EQUALIZER) && defined(__AUDIO_EFFECTS_API)
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdEqualizer;
+            txt = qtn_mus_options_equalizer;
+            },
+#endif
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdOpenMusicSettings;
+            txt = qtn_nmp_options_audio_settings;
+            },
+          
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdAddToPlaylist;
+            txt = qtn_mus_options_add_to_pl;
+            cascade = r_mpx_pbv_add_to_pl_sub_menu;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_repeat_sub_menu
+// Playback view Repeat sub menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_playback_repeat_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdRepeatOff;
+            txt = qtn_nmp_options_repeat_subm_off;
+            flags = EEikMenuItemRadioStart;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdRepeatAll;
+            txt = qtn_nmp_repeat_subm_all;
+            flags = EEikMenuItemRadioMiddle;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdRepeatOne;
+            txt = qtn_nmp_repeat_subm_song;
+            flags = EEikMenuItemRadioEnd;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_random_sub_menu
+// Playback view Random sub menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_playback_random_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdRandomOff;
+            txt = qtn_nmp_options_random_subm_off;
+            flags = EEikMenuItemRadioEnd;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdRandomOn; 
+            txt = qtn_nmp_options_random_subm_on; 
+            flags = EEikMenuItemRadioStart;
+            }
+        };
+    }
+    
+// ---------------------------------------------------------------------------
+// r_mpx_playback_play_via_sub_menu
+// Playback view UPnP Play Via sub menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_playback_play_via_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdUpnpPlayViaLocal;
+            txt = qtn_nmp_options_player_device;
+            flags = EEikMenuItemRadioStart;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdUpnpPlayViaRemotePlayer;
+            txt = qtn_nmp_options_player_homenet;
+            flags = EEikMenuItemRadioEnd;
+            }
+        };
+    }    
+
+// -----------------------------------------------------------------------------
+//    r_mpx_add_to_pl_sub_menu
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_pbv_add_to_pl_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdAddToSavedPlaylist;
+            txt = qtn_nmp_sub_add_to_playlist_saved;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdAddToNewPlaylist;
+            txt = qtn_nmp_sub_add_to_playlist_new; 
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_playbackview_title
+// Title for Playback view. Only used in landscape orientation.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_playbackview_title
+    {
+    buf = qtn_nmp_title_now_playing;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_no_tracks_label
+// Label for No tracks.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_pbv_no_tracks_label
+    {
+    buf = qtn_rp_nowplaying_empty;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_unknown_artist_label
+// Text to show when artist information is not available.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_pbv_unknown_artist_label
+    {
+    buf = qtn_nmp_unknown_artist;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_song_opening_label
+// Text used when song is opening.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_pbv_song_opening_label
+    {
+    buf = qtn_nmp_nowplaying_song_opening;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_playlist_item_counter_label
+// Text used for showing track position in the playlist.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_pbv_playlist_item_counter_label
+    {
+    buf = qtn_rp_nr_of_tracks;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_pbv_track_duration_format
+// Format used for track duration.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_pbv_track_duration_format
+    {
+    buf = qtn_nmp_nowplaying_song_duration;
+    }
+
+// -----------------------------------------------------------------------------
+//    r_mpx_wait_upnp_loading_song
+//    Text used in wait note while loading a song to remote player.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_wait_upnp_loading_song
+    {
+    buf = qtn_nmp_wait_loading_items;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_note_remote_connection_failed
+// Text used when a remote connection failed and player reverts to Local
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_note_remote_connection_failed
+    {
+    buf = qtn_nmp_note_remote_connection_failed;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_media_keys_not_supported
+// Display when media keys aren't supported by player
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_media_keys_not_supported
+    {
+    buf = qtn_nmp_note_no_media_key;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_generic_confirmation_query
+//    Generic confirmation query dialog.
+//
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_generic_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+
+// ***********************************************************
+// *** Rocker Key Sound setting                            ***
+// ***********************************************************
+
+// -----------------------------------------------------------------------------
+// r_mpx_pbv_left_right_keys_silent
+// Disable left right keys sounds while seeking
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_SKEY_LIST r_mpx_pbv_left_right_keys_silent
+    {
+    list=
+        {
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyLeftArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeLong;
+            },
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyLeftArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeRepeat;
+            },
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyRightArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeLong;
+            },
+        AVKON_SKEY_INFO 
+            {
+            key = EStdKeyRightArrow; 
+            sid = EAvkonSIDNoSound; 
+            type = ESKeyTypeRepeat;
+            }
+        };
+    }
+
+
+// *********************************************************
+// *** Layouts for Qvga portrait with Rocker key mapping ***
+// *********************************************************
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_value_layout_qvga_portrait
+//    Label layout for track name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_value_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 15; B = 186; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_artist_value_layout_qvga_portrait
+//    Label layout for artist name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_artist_value_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 15; B = 207; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_pos_layout_qvga_portrait
+//    Label layout for track position.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_pos_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 4; r = 166; B = 12; W = 70; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_dur_layout_qvga_portrait
+//    Label layout for track duration.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_dur_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 3; r = 3; B = 230; W = 234; J = ELayoutAlignCenter;
+    }
+
+#if defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS) || defined(__JAPANESE)
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_portrait
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 3; r = 181; B = 242; W = 56; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_portrait
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 181; r = 3; B = 242; W = 56; J = ELayoutAlignRight;
+    }
+#else
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_portrait
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 3; r = 181; B = 242; W = 56; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_portrait
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 181; r = 3; B = 242; W = 56; J = ELayoutAlignRight;
+    }
+#endif // defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS) || defined(__JAPANESE)
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_empty_state_txt_layout_qvga_portrait
+//    Label layout for empty state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_empty_state_txt_layout_qvga_portrait
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 15; r = 15; B = 144; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_download_state_layout_qvga_portrait
+//    Label layout for progressive download state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_download_state_layout_qvga_portrait
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 15; B = 220; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_pane_layout_qvga_portrait
+//    Pane layout for progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_pane_layout_qvga_portrait
+    {
+    l = 25; t = 220; W = 190; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_background_layout_qvga_portrait
+//    Image layout for progress bar background.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_background_layout_qvga_portrait
+    {
+    l = 0; t = 0; W = 190; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_playback_progress_bar_layout_qvga_portrait
+//    Image layout for playback progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_progress_bar_layout_qvga_portrait
+    {
+    l = 1; t = 1; W = 188; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_download_progress_bar_layout_qvga_portrait
+//    Image layout for download progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_download_progress_bar_layout_qvga_portrait
+    {
+    l = 1; t = 1; W = 188; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_playback_indi_layout_qvga_portrait
+//    Image layout for playback indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_indi_layout_qvga_portrait
+    {
+    l = 219; t = 3; W = 0; H = 0;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_shuffle_indi_layout_qvga_portrait
+//    Image layout for shuffle indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_shuffle_indi_layout_qvga_portrait
+    {
+    l = 199; t = 3; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_repeat_indi_layout_qvga_portrait
+//    Image layout for repeat indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_repeat_indi_layout_qvga_portrait
+    {
+    l = 180; t = 3; W = 19; H = 15;
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_real_indi_layout_qvga_portrait
+// Image layout for Real Player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_real_indi_layout_qvga_portrait
+    {
+    l = 160; t = 8; W = 19; H = 15;
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_album_art_icon_layout_qvga_portrait
+//    Image layout for album art icon.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_album_art_icon_layout_qvga_portrait
+    {
+    l = 45; t = 22; W = 150; H = 150;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_rocker_layout_qvga_portrait
+//    Image layout for rocker mapping.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_rocker_layout_qvga_portrait
+    {
+    l = 65; t = 239; W = 111; H = 22;
+    }
+
+
+// ***********************************************************
+// *** Layouts for Qvga portrait without Rocker key maping ***
+// ***********************************************************
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_value_layout_qvga_portrait_without_rocker
+//    Label layout for track name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_value_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 15; B = 202; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_artist_value_layout_qvga_portrait_without_rocker
+//    Label layout for artist name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_artist_value_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 15; B = 223; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_pos_layout_qvga_portrait_without_rocker
+//    Label layout for track position.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_pos_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 4; r = 166; B = 12; W = 70; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_dur_layout_qvga_portrait_without_rocker
+//    Label layout for track duration.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_dur_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 3; r = 3; B = 250; W = 234; J = ELayoutAlignCenter;
+    }
+
+#if defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS) || defined(__JAPANESE)
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_portrait_without_rocker
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 3; r = 181; B = 258; W = 56; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_portrait_without_rocker
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 181; r = 3; B = 258; W = 56; J = ELayoutAlignRight;
+    }
+#else
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_portrait_without_rocker
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 3; r = 181; B = 258; W = 56; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_portrait_without_rocker
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 181; r = 3; B = 258; W = 56; J = ELayoutAlignRight;
+    }
+#endif // defined(__CHINESE_PRC_FONTS) || defined(__CHINESE_TAIWAN_HK_FONTS) || defined(__JAPANESE)
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_empty_state_txt_layout_qvga_portrait_without_rocker
+//    Label layout for empty state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_empty_state_txt_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 15; r = 15; B = 143; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_download_state_layout_qvga_portrait_without_rocker
+//    Label layout for progressive download state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_download_state_layout_qvga_portrait_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 15; r = 15; B = 260; W = 210; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_pane_layout_qvga_portrait_without_rocker
+//    Pane layout for progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_pane_layout_qvga_portrait_without_rocker
+    {
+    l = 25; t = 236; W = 190; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_background_layout_qvga_portrait_without_rocker
+//    Image layout for progress bar background.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_background_layout_qvga_portrait_without_rocker
+    {
+    l = 0; t = 0; W = 190; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_playback_progress_bar_layout_qvga_portrait_without_rocker
+//    Image layout for playback progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_progress_bar_layout_qvga_portrait_without_rocker
+    {
+    l = 1; t = 1; W = 188; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_download_progress_bar_layout_qvga_portrait_without_rocker
+//    Image layout for download progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_download_progress_bar_layout_qvga_portrait_without_rocker
+    {
+    l = 1; t = 1; W = 188; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_playback_indi_layout_qvga_portrait_without_rocker
+//    Image layout for playback indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_indi_layout_qvga_portrait_without_rocker
+    {
+    l = 219; t = 3; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_shuffle_indi_layout_qvga_portrait_without_rocker
+//    Image layout for shuffle indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_shuffle_indi_layout_qvga_portrait_without_rocker
+    {
+    l = 199; t = 3; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_repeat_indi_layout_qvga_portrait_without_rocker
+//    Image layout for repeat indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_repeat_indi_layout_qvga_portrait_without_rocker
+    {
+    l = 180; t = 3; W = 19; H = 15;
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_real_indi_layout_qvga_portrait_without_rocker
+// Image layout for Real Player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_real_indi_layout_qvga_portrait_without_rocker
+    {
+    l = 141; t = 8; W = 19; H = 15;
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_album_art_icon_layout_qvga_portrait_without_rocker
+//    Image layout for album art icon.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_album_art_icon_layout_qvga_portrait_without_rocker
+    {
+    l = 37; t = 22; W = 166; H = 166;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_rocker_layout_qvga_portrait_without_rocker
+//    Image layout for rocker mapping.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_rocker_layout_qvga_portrait_without_rocker
+    {
+    l = 0; t = 239; W = 0; H = 0;
+    }
+
+
+// **********************************************************
+// *** Layouts for Qvga Landscape with Rocker key mapping ***
+// **********************************************************
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_value_layout_qvga_landscape
+//    Label layout for track name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_value_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 167; r = 11; B = 23; W = 148; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_artist_value_layout_qvga_landscape
+//    Label layout for artist name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_artist_value_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 167; r = 32; B = 44; W = 148; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_pos_layout_qvga_landscape
+//    Label layout for track position.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_pos_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 167; r = 83; B = 188; W = 70; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_dur_layout_qvga_landscape
+//    Label layout for track duration.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_dur_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 213; r = 51; B = 169; W = 56; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_landscape
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 167; r = 97; B = 157; W = 56; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_landscape
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 259; r = 5; B = 157; W = 56; J = ELayoutAlignRight;
+    }  
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_empty_state_txt_layout_qvga_landscape
+//    Label layout for empty state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_empty_state_txt_layout_qvga_landscape
+    {
+    font = EAknLogicalFontPrimaryFont; C = 0; l = 15; r = 15; B = 150; W = 290; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_download_state_layout_qvga_landscape
+//    Label layout for progressive download state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_download_state_layout_qvga_landscape
+    {
+    font = EAknLogicalFontSecondaryFont; C = 0; l = 150; r = 15; B = 71; W = 155; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_pane_layout_qvga_landscape
+//    Pane layout for progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_pane_layout_qvga_landscape
+    {
+    l = 167; t = 165; W = 148; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_background_layout_qvga_landscape
+//    Image layout for progress bar background.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_background_layout_qvga_landscape
+    {
+    l = 0; t = 0; W = 148; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_playback_progress_bar_layout_qvga_landscape
+//    Image layout for playback progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_progress_bar_layout_qvga_landscape
+    {
+    l = 1; t = 1; W = 146; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_download_progress_bar_layout_qvga_landscape
+//    Image layout for download progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_download_progress_bar_layout_qvga_landscape
+    {
+    l = 1; t = 1; W = 146; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_playback_indi_layout_qvga_landscape
+//    Image layout for playback indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_indi_layout_qvga_landscape
+    {
+    l = 5; t = 178; W = 0; H = 0;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_shuffle_indi_layout_qvga_landscape
+//    Image layout for shuffle indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_shuffle_indi_layout_qvga_landscape
+    {
+    l = 24; t = 178; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_repeat_indi_layout_qvga_landscape
+//    Image layout for repeat indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_repeat_indi_layout_qvga_landscape
+    {
+    l = 43; t = 178; W = 19; H = 15;
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_real_indi_layout_qvga_landscape
+// Image layout for Real Player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_real_indi_layout_qvga_landscape
+    {
+    l = 232; t = 6; W = 19; H = 15;
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_album_art_icon_layout_qvga_landscape
+//    Image layout for album art icon.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_album_art_icon_layout_qvga_landscape
+    {
+    l = 0; t = 11; W = 162; H = 162;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_rocker_layout_qvga_landscape
+//    Image layout for rocker mapping.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_rocker_layout_qvga_landscape
+    {
+    l = 199; t = 88; W = 116; H = 22;
+    }
+
+
+// *************************************************************
+// *** Layouts for Qvga Landscape without Rocker key mapping ***
+// *************************************************************
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_value_layout_qvga_landscape_without_rocker
+//    Label layout for track name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_value_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 167; r = 11; B = 23; W = 148; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_artist_value_layout_qvga_landscape_without_rocker
+//    Label layout for artist name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_artist_value_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 167; r = 32; B = 44; W = 148; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_pos_layout_qvga_landscape_without_rocker
+//    Label layout for track position.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_pos_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 167; r = 83; B = 188; W = 70; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_track_dur_layout_qvga_landscape_without_rocker
+//    Label layout for track duration.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_track_dur_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 213; r = 51; B = 169; W = 56; J = ELayoutAlignRight;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_elapsed_time_layout_qvga_landscape_without_rocker
+//    Label layout for elasped time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_elapsed_time_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 167; r = 97; B = 157; W = 56; J = ELayoutAlignLeft;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_remaining_time_layout_qvga_landscape_without_rocker
+//    Label layout for remaining time value.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_remaining_time_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 259; r = 5; B = 157; W = 56; J = ELayoutAlignRight;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_empty_state_txt_layout_qvga_landscape_without_rocker
+//    Label layout for empty state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_empty_state_txt_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontPrimaryFont; C = 215; l = 15; r = 15; B = 106; W = 290; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_download_state_layout_qvga_landscape_without_rocker
+//    Label layout for progressive download state.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_LABEL r_mpx_pbv_download_state_layout_qvga_landscape_without_rocker
+    {
+    font = EAknLogicalFontSecondaryFont; C = 215; l = 150; r = 15; B = 71; W = 155; J = ELayoutAlignCenter;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_pane_layout_qvga_landscape_without_rocker
+//    Pane layout for progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_pane_layout_qvga_landscape_without_rocker
+    {
+    l = 167; t = 165; W = 148; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_progress_bar_background_layout_qvga_landscape_without_rocker
+//    Image layout for progress bar background.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_progress_bar_background_layout_qvga_landscape_without_rocker
+    {
+    l = 0; t = 0; W = 148; H = 8;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_playback_progress_bar_layout_qvga_landscape_without_rocker
+//    Image layout for playback progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_progress_bar_layout_qvga_landscape_without_rocker
+    {
+    l = 1; t = 1; W = 146; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pbv_download_progress_bar_layout_qvga_landscape_without_rocker
+//    Image layout for download progress bar.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_download_progress_bar_layout_qvga_landscape_without_rocker
+    {
+    l = 1; t = 1; W = 146; H = 6;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_playback_indi_layout_qvga_landscape_without_rocker
+//    Image layout for playback indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_playback_indi_layout_qvga_landscape_without_rocker
+    {
+    l = 5; t = 178; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_shuffle_indi_layout_qvga_landscape_without_rocker
+//    Image layout for shuffle indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_shuffle_indi_layout_qvga_landscape_without_rocker
+    {
+    l = 24; t = 178; W = 19; H = 15;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_repeat_indi_layout_qvga_landscape_without_rocker
+//    Image layout for repeat indicator.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_repeat_indi_layout_qvga_landscape_without_rocker
+    {
+    l = 43; t = 178; W = 19; H = 15;
+    }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_real_indi_layout_qvga_landscape_without_rocker
+// Image layout for Real Player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_real_indi_layout_qvga_landscape_without_rocker
+    {
+    l = 205; t = 6; W = 19; H = 15;
+    }
+#endif
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_album_art_icon_layout_qvga_landscape_without_rocker
+//    Image layout for album art icon.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_album_art_icon_layout_qvga_landscape_without_rocker
+    {
+    l = 0; t = 11; W = 162; H = 162;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_pbv_rocker_layout_qvga_landscape_without_rocker
+//    Image layout for rocker mapping.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_rocker_layout_qvga_landscape_without_rocker
+    {
+    l = 199; t = 88; W = 0; H = 0;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/eabi/mpxcommonplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,150 @@
+EXPORTS
+	_ZN25CMPXCommonPlaybackViewImp10ConstructLEv @ 1 NONAME
+	_ZN25CMPXCommonPlaybackViewImp11DoActivateLERK10TVwsViewId4TUidRK6TDesC8 @ 2 NONAME
+	_ZN25CMPXCommonPlaybackViewImp11HandleOpenLERK22CMPXCollectionPlaylisti @ 3 NONAME
+	_ZN25CMPXCommonPlaybackViewImp11HandleOpenLERK9CMPXMediaiii @ 4 NONAME
+	_ZN25CMPXCommonPlaybackViewImp11UpdateViewLEv @ 5 NONAME
+	_ZN25CMPXCommonPlaybackViewImp12DoDeactivateEv @ 6 NONAME
+	_ZN25CMPXCommonPlaybackViewImp12HandleErrorLEi @ 7 NONAME
+	_ZN25CMPXCommonPlaybackViewImp12HandleMediaLERK9CMPXMediai @ 8 NONAME
+	_ZN25CMPXCommonPlaybackViewImp12SkipOnErrorLEii @ 9 NONAME
+	_ZN25CMPXCommonPlaybackViewImp13HandlePSEventE4TUidi @ 10 NONAME
+	_ZN25CMPXCommonPlaybackViewImp13IsUpnpVisibleEv @ 11 NONAME
+	_ZN25CMPXCommonPlaybackViewImp13RequestMediaLEi @ 12 NONAME
+	_ZN25CMPXCommonPlaybackViewImp13UpdateToolbarEv @ 13 NONAME
+	_ZN25CMPXCommonPlaybackViewImp14DoHandleMediaLERK9CMPXMediai @ 14 NONAME
+	_ZN25CMPXCommonPlaybackViewImp14HandleCommandLEi @ 15 NONAME
+	_ZN25CMPXCommonPlaybackViewImp15HandlePropertyLE20TMPXPlaybackPropertyii @ 16 NONAME
+	_ZN25CMPXCommonPlaybackViewImp15ProcessCommandLEi @ 17 NONAME
+	_ZN25CMPXCommonPlaybackViewImp15UpdateAlbumArtLEPK9CMPXMedia @ 18 NONAME
+	_ZN25CMPXCommonPlaybackViewImp16DialogDismissedLEi @ 19 NONAME
+	_ZN25CMPXCommonPlaybackViewImp16DisplayInfoNoteLEi @ 20 NONAME
+	_ZN25CMPXCommonPlaybackViewImp16DynInitMenuPaneLEiP12CEikMenuPane @ 21 NONAME
+	_ZN25CMPXCommonPlaybackViewImp16HandleViewUpdateE4TUidN26MMPXViewActivationObserver16TViewUpdateEventEii @ 22 NONAME
+	_ZN25CMPXCommonPlaybackViewImp16LaunchEqualizerLEv @ 23 NONAME
+	_ZN25CMPXCommonPlaybackViewImp16SelectNewPlayerLEi @ 24 NONAME
+	_ZN25CMPXCommonPlaybackViewImp16UpdateTitlePaneLEv @ 25 NONAME
+	_ZN25CMPXCommonPlaybackViewImp16UpdateTrackInfoLEPK9CMPXMedia @ 26 NONAME
+	_ZN25CMPXCommonPlaybackViewImp17AddToNewPlaylistLEv @ 27 NONAME
+	_ZN25CMPXCommonPlaybackViewImp17DoHandlePropertyLE20TMPXPlaybackPropertyii @ 28 NONAME
+	_ZN25CMPXCommonPlaybackViewImp18HandleLayoutChangeEv @ 29 NONAME
+	_ZN25CMPXCommonPlaybackViewImp18SetProcessPriorityEv @ 30 NONAME
+	_ZN25CMPXCommonPlaybackViewImp19AddToSavedPlaylistLEv @ 31 NONAME
+	_ZN25CMPXCommonPlaybackViewImp19HandleSettingChangeERK4TUidm @ 32 NONAME
+	_ZN25CMPXCommonPlaybackViewImp19IsCommandSupportedLEv @ 33 NONAME
+	_ZN25CMPXCommonPlaybackViewImp19UpdatePlaybackStateE17TMPXPlaybackState @ 34 NONAME
+	_ZN25CMPXCommonPlaybackViewImp20AddPlayerNameToMenuLER12CEikMenuPaneiR17MMPXPlayerManagerR22TMPXPlaybackPlayerTypeRK7TDesC16 @ 35 NONAME
+	_ZN25CMPXCommonPlaybackViewImp20HandleViewActivationERK10TVwsViewIdS2_ @ 36 NONAME
+	_ZN25CMPXCommonPlaybackViewImp20HandleViewActivationERK4TUidS2_ @ 37 NONAME
+	_ZN25CMPXCommonPlaybackViewImp20LaunchFMTransmitterLEv @ 38 NONAME
+	_ZN25CMPXCommonPlaybackViewImp20LaunchMusicSettingsLEv @ 39 NONAME
+	_ZN25CMPXCommonPlaybackViewImp21DoHandleStateChangedLE17TMPXPlaybackStatei @ 40 NONAME
+	_ZN25CMPXCommonPlaybackViewImp21HandleCommandCompleteEP9CMPXMediai @ 41 NONAME
+	_ZN25CMPXCommonPlaybackViewImp21HandlePlaybackMessageEP9CMPXMediai @ 42 NONAME
+	_ZN25CMPXCommonPlaybackViewImp21HandleSubPlayerNamesLE4TUidPK12MDesC16Arrayii @ 43 NONAME
+	_ZN25CMPXCommonPlaybackViewImp22AddPlayersNamesToMenuLER12CEikMenuPane @ 44 NONAME
+	_ZN25CMPXCommonPlaybackViewImp22DisplayConfirmionNoteLEi @ 45 NONAME
+	_ZN25CMPXCommonPlaybackViewImp22HandleCollectionMediaLERK9CMPXMediai @ 46 NONAME
+	_ZN25CMPXCommonPlaybackViewImp22HandleForegroundEventLEi @ 47 NONAME
+	_ZN25CMPXCommonPlaybackViewImp23GetCurrentPlayerDetailsEv @ 48 NONAME
+	_ZN25CMPXCommonPlaybackViewImp23HandleAllTracksInvalidLEv @ 49 NONAME
+	_ZN25CMPXCommonPlaybackViewImp23HandleCollectionMessageEP9CMPXMediai @ 50 NONAME
+	_ZN25CMPXCommonPlaybackViewImp24DoHandlePlaybackMessageLERK9CMPXMedia @ 51 NONAME
+	_ZN25CMPXCommonPlaybackViewImp24HandleOperationCompleteLE17TCHelperOperationiPv @ 52 NONAME
+	_ZN25CMPXCommonPlaybackViewImp24UpdateFMTransmitterInfoLEi @ 53 NONAME
+	_ZN25CMPXCommonPlaybackViewImp25PrepareMediaForPlaylistLCERK9CMPXMedia @ 54 NONAME
+	_ZN25CMPXCommonPlaybackViewImp25UpdateDownloadStateLabelLEv @ 55 NONAME
+	_ZN25CMPXCommonPlaybackViewImp25UpdateTrackPosInPlaylistLEv @ 56 NONAME
+	_ZN25CMPXCommonPlaybackViewImp26HandleStatusPaneSizeChangeEv @ 57 NONAME
+	_ZN25CMPXCommonPlaybackViewImp27UpdateMiddleSoftKeyDisplayLEv @ 58 NONAME
+	_ZN25CMPXCommonPlaybackViewImp28UpdateTrackPlaybackPositionLEii @ 59 NONAME
+	_ZN25CMPXCommonPlaybackViewImpD0Ev @ 60 NONAME
+	_ZN25CMPXCommonPlaybackViewImpD1Ev @ 61 NONAME
+	_ZN25CMPXCommonPlaybackViewImpD2Ev @ 62 NONAME
+	_ZN28CMPXCommonPlaybackViewLayout11LayoutLabelEP9CEikLabelRK5TRect20TMPXPbvTextIndicatorii @ 63 NONAME
+	_ZN28CMPXCommonPlaybackViewLayout12ButtonLayoutERK5TRect @ 64 NONAME
+	_ZN28CMPXCommonPlaybackViewLayout12ButtonLayoutERK5TRecti @ 65 NONAME
+	_ZN28CMPXCommonPlaybackViewLayout14DoLayoutLabelLEP9CEikLabelRK5TRectiii @ 66 NONAME
+	_ZN28CMPXCommonPlaybackViewLayout14GetTextVariantE20TMPXPbvTextIndicator @ 67 NONAME
+	_ZN28CMPXCommonPlaybackViewLayout15IndicatorLayoutERK5TRect16TMPXPbvIndicator @ 68 NONAME
+	_ZN28CMPXCommonPlaybackViewLayout16CreateColorIconLEP17MAknsSkinInstanceRK11TAknsItemIDS4_iRK7TDesC16ii @ 69 NONAME
+	_ZN28CMPXCommonPlaybackViewLayout17GetButtonBitmapsLE13TMPXPbvButtoniRP10CFbsBitmapS3_ @ 70 NONAME
+	_ZN28CMPXCommonPlaybackViewLayout19GetIndicatorVariantE16TMPXPbvIndicator @ 71 NONAME
+	_ZN28CMPXCommonPlaybackViewLayout21GetIndicatorIconMaskLE16TMPXPbvIndicator @ 72 NONAME
+	_ZN28CMPXCommonPlaybackViewLayout22DetermineLayoutVariantEv @ 73 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer10ConstructLERK5TRect @ 74 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer11SetFMTXModeEi @ 75 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer11SizeChangedEv @ 76 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer12CreateIconsLEv @ 77 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer12StartMarqueeE20TMPXPbvTextIndicator @ 78 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer12UpdateLabelLE20TMPXPbvTextIndicatorRK7TDesC16 @ 79 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer12UpdateLayoutEv @ 80 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer13CreateLabelsLEv @ 81 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer13SetRandomModeEi @ 82 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer13SetRepeatModeEii @ 83 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer13UpdateButtonsE17TMPXPlaybackState @ 84 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer14OfferKeyEventLERK9TKeyEvent10TEventCode @ 85 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer16SetRealAudioModeEi @ 86 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer18GetNewSongPositionEv @ 87 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer18RefreshProgressBarEv @ 88 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer18UpdateLabelColorsLEv @ 89 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer19HandlePointerEventLERK13TPointerEvent @ 90 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer19UpdateSoftkeyColorsEv @ 91 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer20HandleButtonCommandLEi @ 92 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer20HandleResourceChangeEi @ 93 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer20UpdateDurationLabelLEi @ 94 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer21UpdateTimeIndicatorsLEii @ 95 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer22ExtractAlbumArtStartedEv @ 96 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer22HandleForegroundEventLEi @ 97 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer23CreateBackgroundImagesLEv @ 98 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer24ExtractAlbumArtCompletedEP10CFbsBitmapi @ 99 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer25UpdateProgressBarGraphicsEv @ 100 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer34UpdateBackgroundSkinControlContextERK5TRect @ 101 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer7SetModeE19TMPXPbvPlaybackMode @ 102 NONAME
+	_ZN31CMPXCommonPlaybackViewContainer9FreeIconsEv @ 103 NONAME
+	_ZN31CMPXCommonPlaybackViewContainerD0Ev @ 104 NONAME
+	_ZN31CMPXCommonPlaybackViewContainerD1Ev @ 105 NONAME
+	_ZN31CMPXCommonPlaybackViewContainerD2Ev @ 106 NONAME
+	_ZNK25CMPXCommonPlaybackViewImp10IsEmbeddedEv @ 107 NONAME
+	_ZNK25CMPXCommonPlaybackViewImp18SimpleEmbeddedModeEv @ 108 NONAME
+	_ZNK31CMPXCommonPlaybackViewContainer10RedrawRectERK5TRectR14CBitmapContext @ 109 NONAME
+	_ZNK31CMPXCommonPlaybackViewContainer13DrawIndicatorER14CBitmapContextRK5TRectS4_PK8CGulIconi @ 110 NONAME
+	_ZNK31CMPXCommonPlaybackViewContainer14GetHelpContextER15TCoeHelpContext @ 111 NONAME
+	_ZNK31CMPXCommonPlaybackViewContainer16ComponentControlEi @ 112 NONAME
+	_ZNK31CMPXCommonPlaybackViewContainer22CountComponentControlsEv @ 113 NONAME
+	_ZNK31CMPXCommonPlaybackViewContainer4DrawERK5TRect @ 114 NONAME
+	_ZTI25CMPXCommonPlaybackViewImp @ 115 NONAME
+	_ZTI28CMPXCommonPlaybackViewLayout @ 116 NONAME
+	_ZTI31CMPXCommonPlaybackViewContainer @ 117 NONAME
+	_ZTV25CMPXCommonPlaybackViewImp @ 118 NONAME
+	_ZTV28CMPXCommonPlaybackViewLayout @ 119 NONAME
+	_ZTV31CMPXCommonPlaybackViewContainer @ 120 NONAME
+	_ZThn100_N25CMPXCommonPlaybackViewImp20HandleViewActivationERK10TVwsViewIdS2_ @ 121 NONAME
+	_ZThn108_N25CMPXCommonPlaybackViewImp24HandleOperationCompleteLE17TCHelperOperationiPv @ 122 NONAME
+	_ZThn112_N25CMPXCommonPlaybackViewImp13HandlePSEventE4TUidi @ 123 NONAME
+	_ZThn116_N25CMPXCommonPlaybackViewImp19HandleSettingChangeERK4TUidm @ 124 NONAME
+	_ZThn120_N25CMPXCommonPlaybackViewImp16DialogDismissedLEi @ 125 NONAME
+	_ZThn124_N25CMPXCommonPlaybackViewImp16HandleViewUpdateE4TUidN26MMPXViewActivationObserver16TViewUpdateEventEii @ 126 NONAME
+	_ZThn124_N25CMPXCommonPlaybackViewImp20HandleViewActivationERK4TUidS2_ @ 127 NONAME
+	_ZThn128_N25CMPXCommonPlaybackViewImp11HandleOpenLERK22CMPXCollectionPlaylisti @ 128 NONAME
+	_ZThn128_N25CMPXCommonPlaybackViewImp11HandleOpenLERK9CMPXMediaiii @ 129 NONAME
+	_ZThn128_N25CMPXCommonPlaybackViewImp21HandleCommandCompleteEP9CMPXMediai @ 130 NONAME
+	_ZThn128_N25CMPXCommonPlaybackViewImp22HandleCollectionMediaLERK9CMPXMediai @ 131 NONAME
+	_ZThn128_N25CMPXCommonPlaybackViewImp23HandleCollectionMessageEP9CMPXMediai @ 132 NONAME
+	_ZThn12_N25CMPXCommonPlaybackViewImp15ProcessCommandLEi @ 133 NONAME
+	_ZThn12_N25CMPXCommonPlaybackViewImp16DynInitMenuPaneLEiP12CEikMenuPane @ 134 NONAME
+	_ZThn4_N28CMPXCommonPlaybackViewLayout11LayoutLabelEP9CEikLabelRK5TRect20TMPXPbvTextIndicatorii @ 135 NONAME
+	_ZThn4_N28CMPXCommonPlaybackViewLayout12ButtonLayoutERK5TRect @ 136 NONAME
+	_ZThn4_N28CMPXCommonPlaybackViewLayout12ButtonLayoutERK5TRecti @ 137 NONAME
+	_ZThn4_N28CMPXCommonPlaybackViewLayout15IndicatorLayoutERK5TRect16TMPXPbvIndicator @ 138 NONAME
+	_ZThn4_N28CMPXCommonPlaybackViewLayout17GetButtonBitmapsLE13TMPXPbvButtoniRP10CFbsBitmapS3_ @ 139 NONAME
+	_ZThn4_N28CMPXCommonPlaybackViewLayout21GetIndicatorIconMaskLE16TMPXPbvIndicator @ 140 NONAME
+	_ZThn52_N31CMPXCommonPlaybackViewContainer22ExtractAlbumArtStartedEv @ 141 NONAME
+	_ZThn52_N31CMPXCommonPlaybackViewContainer24ExtractAlbumArtCompletedEP10CFbsBitmapi @ 142 NONAME
+	_ZThn56_N31CMPXCommonPlaybackViewContainer20HandleButtonCommandLEi @ 143 NONAME
+	_ZThn80_N25CMPXCommonPlaybackViewImp21HandlePlaybackMessageEP9CMPXMediai @ 144 NONAME
+	_ZThn84_N25CMPXCommonPlaybackViewImp12HandleMediaLERK9CMPXMediai @ 145 NONAME
+	_ZThn84_N25CMPXCommonPlaybackViewImp15HandlePropertyLE20TMPXPlaybackPropertyii @ 146 NONAME
+	_ZThn84_N25CMPXCommonPlaybackViewImp21HandleSubPlayerNamesLE4TUidPK12MDesC16Arrayii @ 147 NONAME
+	_ZThn96_N25CMPXCommonPlaybackViewImp18HandleLayoutChangeEv @ 148 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxcommonplaybackview.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxcommonplaybackview.loc	APP_LAYER_LOC_EXPORT_PATH(mpxcommonplaybackview.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxcommonplaybackview.mif
+OPTION HEADERFILE mpxcommonplaybackview.mbg
+OPTION SOURCEFILE iconlist.txt
+END
+
+PRJ_MMPFILES
+mpxcommonplaybackview.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,52 @@
+/c8,8 qgn_graf_mup_npv_icon_pause.svg
+/c8,8 qgn_graf_mup_npv_icon_play.svg
+/c8,8 qgn_graf_mup_npv_icon_repeat.svg
+/c8,8 qgn_graf_mup_npv_icon_repeatone.svg
+/c8,8 qgn_graf_mup_npv_icon_shuffle.svg
+/c8,8 qgn_graf_mup_npv_prbar_bgd.svg
+/c8,8 qgn_graf_mup_npv_prbar_top_play.svg
+/c8,8 qgn_graf_mup_npv_prbar_mid_download.svg
+/c16,8 qgn_indi_mup_default_album.svg
+/c8,8 qgn_indi_mup_rp.svg
+
+/c8,8 qgn_graf_mup_icon_upnp_remote.svg
+/c8,8 qgn_indi_mup_repeat.svg
+/c8,8 qgn_indi_mup_repeat_one.svg
+/c8,8 qgn_indi_mup_random.svg
+/c8,8 qgn_indi_mup_stop.svg
+/c8,8 qgn_indi_mup_pause.svg
+/c8,8 qgn_indi_mup_play.svg
+/c8,8 qgn_indi_mup4_forward.svg
+/c8,8 qgn_indi_mup4_forward_focused.svg
+/c8,8 qgn_indi_mup4_forward_dimmed.svg
+/c8,8 qgn_indi_mup4_pause.svg
+/c8,8 qgn_indi_mup4_pause_focused.svg
+/c8,8 qgn_indi_mup4_pause_dimmed.svg
+/c8,8 qgn_indi_mup4_rewind.svg
+/c8,8 qgn_indi_mup4_rewind_focused.svg
+/c8,8 qgn_indi_mup4_rewind_dimmed.svg
+/c8,8 qgn_indi_mup4_play.svg
+/c8,8 qgn_indi_mup4_play_focused.svg
+/c8,8 qgn_indi_mup4_play_dimmed.svg
+/c8,8 qgn_indi_mup4_stop.svg
+/c8,8 qgn_indi_mup4_stop_focused.svg
+/c8,8 qgn_indi_mup4_stop_dimmed.svg
+/c8,8 qgn_indi_mup4_volume_down.svg
+/c8,8 qgn_indi_mup4_volume_down_focused.svg
+/c8,8 qgn_indi_mup4_volume_down_dimmed.svg
+/c8,8 qgn_indi_mup4_volume_up.svg
+/c8,8 qgn_indi_mup4_volume_up_focused.svg
+/c8,8 qgn_indi_mup4_volume_up_dimmed.svg
+
+/c8,8 qgn_prop_image_tb_next.svg
+/c8,8 qgn_prop_image_tb_next_dimmed.svg
+/c8,8 qgn_prop_image_tb_next_focused.svg
+/c8,8 qgn_prop_image_tb_pause.svg
+/c8,8 qgn_prop_image_tb_pause_dimmed.svg
+/c8,8 qgn_prop_image_tb_pause_focused.svg
+/c8,8 qgn_prop_image_tb_play2.svg
+/c8,8 qgn_prop_image_tb_play2_dimmed.svg
+/c8,8 qgn_prop_image_tb_play2_focused.svg
+/c8,8 qgn_prop_image_tb_prev.svg
+/c8,8 qgn_prop_image_tb_prev_dimmed.svg
+/c8,8 qgn_prop_image_tb_prev_focused.svg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/group/mpxcommonplaybackview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxcommonplaybackview.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+#include "../../../../../inc/musicplayerbldvariant.hrh"
+
+TARGET          mpxcommonplaybackview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC6A
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+#ifdef IAD_INCLUDE_UPNP 
+MACRO UPNP_INCLUDED
+#endif
+
+MACRO __ENABLE_MSK
+//MACRO __MUSIC_VISUALIZATION
+MACRO CAMESE_IN_DRM_UTILITY
+
+#ifdef IAD_INCLUDE_BACKSTEPPING
+MACRO BACKSTEPPING_INCLUDED
+#endif // IAD_INCLUDE_BACKSTEPPING
+
+SOURCEPATH      ../src
+SOURCE          mpxbutton.cpp
+SOURCE          mpxbuttonmanager.cpp
+SOURCE          mpxcommonplaybackviewcontainer.cpp
+SOURCE          mpxcommonplaybackviewimp.cpp
+SOURCE          mpxcommonplaybackviewlayout.cpp
+SOURCE          mpxplaybackviewinfolabel.cpp
+#ifdef __ENABLE_UNIFIED_NOW_PLAYING_VIEW
+START RESOURCE  ../data/mpxunifiedcommonplaybackview.rss
+#else
+START RESOURCE  ../data/mpxcommonplaybackview.rss
+#endif // __ENABLE_UNIFIED_NOW_PLAYING_VIEW
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+TARGET          mpxcommonplaybackview
+LANGUAGE_IDS 
+END // RESOURCE
+START RESOURCE  ../data/mpxfmtx.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib         
+LIBRARY         apgrfx.lib // For FF_FMTX
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         ws32.lib
+LIBRARY         fbscli.lib
+LIBRARY         bitgdi.lib
+LIBRARY         gdi.lib
+LIBRARY         egul.lib
+LIBRARY         eikctl.lib
+LIBRARY         eiksrv.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknicon.lib
+LIBRARY         featmgr.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknskinsrv.lib
+LIBRARY         commonengine.lib
+LIBRARY         centralrepository.lib
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         cdlengine.lib
+LIBRARY         estor.lib
+#ifdef IAD_INCLUDE_UPNP
+LIBRARY    	upnpcommand.lib
+#endif
+
+LIBRARY         eikdlg.lib
+
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcollectionhelper.lib
+LIBRARY         servicehandler.lib  // AIW
+LIBRARY         playbackhelper.lib // CMediaRecognizer
+LIBRARY         touchfeedback.lib
+#ifdef IAD_INCLUDE_BACKSTEPPING
+LIBRARY         mpxbacksteppingutility.lib 
+#endif // IAD_INCLUDE_BACKSTEPPING
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/group/mpxcommonplaybackviewicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxcommonplaybackview
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxcommonplaybackview.mif
+HEADERFILENAME=$(HEADERDIR)/mpxcommonplaybackview.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/inc/mpxbuttonmanager.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Button state manager for common playback view
+*
+*/
+
+
+
+#ifndef CMPXBUTTONMANAGER_H
+#define CMPXBUTTONMANAGER_H
+
+//  INCLUDES
+#include <coecntrl.h>
+#include <AknUtils.h>
+
+#include "mpxbutton.h"
+#include "mpxplaybackframeworkdefs.h"
+
+//  FORWARD DECLARATIONS
+class CWindowGc;
+class MAknsControlContext;
+class MMPXPlaybackViewLayout;
+
+class CAknButton;
+class CAknViewAppUi;
+class CGulIcon;
+// CLASS DECLARATION
+
+/**
+*  Button state manager for playback view.
+*
+*  @lib mpxplaybackview.dll
+*  @since S60 v3.0
+*/
+NONSHARABLE_CLASS( CMPXButtonManager ) :public CCoeControl,
+                                        public MCoeControlObserver,
+                                        public MCoeControlBackground
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        * since 5.0
+        * @param aObserver          Observer to receive commands from button
+        *                           pushes.
+        * @param aLayout            Layout for this view
+        * @param aContainer			Container for this control
+        */
+        static CMPXButtonManager* NewL(
+            MMPXButtonCmdObserver* aObserver,
+            MMPXPlaybackViewLayout* aLayout,
+            const CCoeControl &aContainer);
+        /**
+        * Destructor.
+        */
+        virtual ~CMPXButtonManager();
+
+    public:
+
+        /**
+        * Update button state based on the state of the engine
+        * @param aState State of the playback engine
+        */
+        void UpdateButtonStates(TMPXPlaybackState aState);
+
+        /**
+        * Handle a key event.
+        * @see CCoeControl::OfferKeyEventL
+        */
+        TKeyResponse OfferKeyEventL(
+            const TKeyEvent& aKeyEvent,
+            TEventCode aType);
+
+        /**
+        * Set parent rectangle for the button layout
+        * @since 3.0
+        * @param aRect Parent rectangle
+        */
+        void SetParentRect(const TRect& aRect);
+
+        /**
+        * Sets to enable/display the button or not
+        */
+        void SetEnabled( TBool aEnabled );
+
+        /**
+         * Handles losing foreground
+         *
+         * @since S60 3.0
+         */
+        void HandleForegroundLostL();
+
+	    /**
+	     * From CCoeControl.
+	     * Gets the number of controls contained in a compound control.
+	     * since 5.0
+	     *
+	     * @return The number of component controls contained by this control.
+	     */
+	    TInt CountComponentControls() const;
+
+	    /**
+	     * From CCoeControl.
+	     * Gets an indexed component of a compound control.
+	     * since 5.0
+	     *
+	     * @param aIndex The index of the control.
+	     * @return The component control with an index of aIndex.
+	     */
+	    CCoeControl* ComponentControl( TInt aIndex ) const;
+
+		/**
+		* From MCoeControlObserver.
+		* To handle the button events.
+		* since 5.0
+		*/
+		void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType );
+
+	    /**
+	     * From CoeControl.
+	     * Handles a change to the control's resources.
+		 * since 5.0
+	     *
+	     * @param aType A message UID value.
+	     */
+	    void HandleResourceChange( TInt aType );
+
+	    void CMPXButtonManager::SizeChanged();
+
+	    /**
+	     * From MCoeControlBackground
+		 * since 5.0
+	     */
+	    void Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const;
+        
+	    /**
+        * restore button state in some special case
+        * @since S60 3.0
+        * @param aState State of the playback engine
+        */
+        void RestoreButtonStates( TMPXPlaybackState aState );
+
+    private:
+        /**
+        * C++ default constructor.
+        */
+        CMPXButtonManager(
+            MMPXButtonCmdObserver* aObserver,
+            MMPXPlaybackViewLayout* aLayout);
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL(const CCoeControl &aContainer);
+
+    private: // New functions
+
+        /**
+        * Create the rocker button using multiple avkon buttons
+        */
+        void CreateRockerAvkonButtonsL(const CCoeControl &aContainer);
+
+        /**
+        * Sets the avkon rocker button state and send observer commands
+        */
+        TKeyResponse SetAvkonButtonState( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+        /**
+        * Callback for long-press timer
+        */
+        static TInt TimerCallback(TAny* aPtr);
+
+        /**
+        * Handle long press event.
+        */
+        void HandleLongPress();
+
+    private:    // Data
+        TRect iParentRect;
+        TInt iButton;
+        MMPXButtonCmdObserver* iObserver;          // not owned
+
+        TBool iIsEmbedded;
+        TBool iProgDownloadMode;
+        TBool iIsCDPreview;
+        TBool iKeyDownEventReceived;
+        MMPXPlaybackViewLayout* iLayout;    // not owned
+        TBool iEnabled;
+        TBool iKeyDownReceived;
+        TBool iIsSeeking;
+        RPointerArray<CAknButton> iAvkonButtons;        // owned
+        TInt iRockerAvkonButtonCount;
+        TBool iVolumeInRocker;
+        TBool iIsTouchUi;
+        TBool iStopInRocker;
+        TBool iIsLongPress;
+        CPeriodic* iLongKeyTimer;
+        TInt iLongPressCommandId;
+    };
+
+#endif      // CMPXBUTTONMANAGER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/loc/mpxcommonplaybackview.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxcommonplaybackview
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Text in title pane
+// d:Player view
+// l:title_pane_t2/opt9
+// r:3.1
+//
+#define qtn_nmp_title_now_playing "Now Playing"
+
+// d:A string in the main pane.
+// d:Shown in player view when playlist is empty.
+// l:main_mup3_pane_t6/opt2
+// r:3.1
+//
+#define qtn_rp_nowplaying_empty "(empty)"
+
+// d:Text in main pane.
+// d:Shown when there's no artist metadata can be found in the track.
+// l:main_mup3_pane_t2
+// r:5.0
+//
+#define qtn_nmp_unknown_artist "Unknown artist"
+
+// d:Text in main pane.
+// d:launching playback of 1 song takes longer than 1 sec
+// l:mup3_progress_pane_t3
+// r:3.1
+//
+#define qtn_nmp_nowplaying_song_opening "Opening ..."
+
+// d:Text in main pane.
+// d:Playlist item counter, which tells the number of current
+// d:clip and the total number of clips in the playlist.
+// l:main_mup3_pane_t5
+//
+#define qtn_rp_nr_of_tracks "%0N/%1N"
+
+// d:A string in the main pane.
+// d:Shown in player view when player is in inactive state.
+// d:%U is the duration of the song
+// l:mup3_progress_pane_t3
+// r:3.1
+//
+#define qtn_nmp_nowplaying_song_duration "(%U)"
+
+// d:A string in the main pane.
+// d:Shown in player view when player FM transmitter is turned on
+// d:%U is the FM frequency in MHz
+// l:mup3_progress_pane_t3
+// r:3.1
+//
+#define qtn_nmp_display_fm_freq "%U MHz"
+
+// d:Options menu item for opening Equalizer
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_options_equalizer "Equalizer"
+
+
+// d:Options menu item.
+// d:Opens Repeat mode sub menu.
+// l:list_single_pane_t1_cp2/opt3
+// r:3.1
+//
+#define qtn_mus_option_repeat "Repeat"
+
+// d:Options sub menu item.
+// d:Enables Repeat mode for repeating one track.
+// l:list_single_popup_submenu_pane_t1/opt1
+// r:3.1
+//
+#define qtn_nmp_repeat_subm_song "Repeat song"
+
+// d:Options sub menu item.
+// d:Enables Repeat mode for repeating all tracks.
+// l:list_single_popup_submenu_pane_t1
+// r:3.1
+//
+#define qtn_nmp_repeat_subm_all "Repeat all"
+
+// d:Options sub menu item.
+// d:Disables Repeat mode.
+// l:list_single_popup_submenu_pane_t1
+// r:3.1
+//
+#define qtn_nmp_options_repeat_subm_off "Off"
+
+// d:Options menu item.
+// d:Opens Random mode sub menu.
+// l:list_single_pane_t1_cp2/opt3
+// r:3.1
+//
+#define qtn_mus_options_shuffle "Shuffle"
+
+// d:Options sub menu item.
+// d:Enables Random mode.
+// l:list_single_popup_submenu_pane_t1
+// r:3.1
+//
+#define qtn_nmp_options_random_subm_on "On"
+
+// d:Options sub menu item.
+// d:Disables Random mode.
+// l:list_single_popup_submenu_pane_t1
+// r:3.1
+//
+#define qtn_nmp_options_random_subm_off "Off"
+
+//d:Command in options list
+//d:Opens use tone as cascade menu
+//l:list_single_pane_t1_cp2/opt3
+//r:3.1
+#define qtn_mus_options_use_tone_as "Use tone as"
+
+// d:Options menu item for opening audio settings list view.
+// d:Now playing view.
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_nmp_options_audio_settings "Audio settings"
+
+// d:Options menu item for opening radio transmitter
+// d:Now playing view.
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_nmp_go_to_fm_transmitter "FM Transmitter"
+
+// d:Options menu item for choosing player
+// l:list_single_pane_t1_cp2/opt3
+// r:3.1
+//
+#define qtn_mp_options_player "Player"
+
+// d:Options submenu item for choosing player
+// l:list_single_popup_submenu_pane_t1/opt1
+// r:3.1
+//
+#define qtn_nmp_options_player_device "Device"
+
+// d:Options submenu item for choosing player
+// l:list_single_popup_submenu_pane_t1/opt1
+// r:3.1
+//
+#define qtn_nmp_options_player_homenet "Home Net"
+
+// d:Options menu item.
+// d:Goes to Music Menu View
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_options_music_menu "Go to Music Menu"
+
+// d:Text for Loading song wait note
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_nmp_wait_loading_items "Loading items to play"
+
+// d:Text for connection to player failed error note
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_remote_connection_failed "Connection with %U failed."
+
+// d:Options menu item.
+// d:Select to go to Podcast Menu view.
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_options_go_to_podcast_menu  "Go to Podcast Menu"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/src/mpxbutton.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,445 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Button class.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <aknappui.h>
+#include    <AknIconArray.h>
+#include    <aknsoundsystem.h>  // CAknKeySoundSystem
+#include    <AknsConstants.h>
+#include    <aknconsts.h>
+#include    <AknsUtils.h>
+#include    <barsread.h>
+#include    <gulicon.h>
+#include    <coedef.h>
+#include    <eiksvdef.h>
+#include    <AknsDrawUtils.h>
+#include    "mpxbutton.h"
+#include    "mpxplaybackviewlayoutinterface.h"
+#include    "mpxcommonplaybackview.hrh"
+#include    "mpxlog.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXButton::CMPXButton
+// -----------------------------------------------------------------------------
+//
+CMPXButton::CMPXButton(
+    TMPXPbvButton aButtonId,
+    MMPXButtonCmdObserver* aObserver,
+    MMPXPlaybackViewLayout* aLayout )
+    : iButtonId( aButtonId ),
+      iCurrentStateIndex( KErrNotFound ),
+      iObserver( aObserver ), 
+      iVisible( ETrue ),
+      iLayout( aLayout )
+    {
+    MPX_FUNC("CMPXButton::CMPXButton()");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::NewLC
+// -----------------------------------------------------------------------------
+//
+CMPXButton* CMPXButton::NewLC(
+    TMPXPbvButton aButtonId,
+    MMPXButtonCmdObserver* aObserver,
+    MMPXPlaybackViewLayout* aLayout )
+    {
+    MPX_FUNC("CMPXButton::NewLC()");
+    CMPXButton* self = new (ELeave) CMPXButton(
+        aButtonId,
+        aObserver,
+        aLayout );
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::NewL
+// -----------------------------------------------------------------------------
+//
+CMPXButton* CMPXButton::NewL(
+    TMPXPbvButton aButtonId,
+    MMPXButtonCmdObserver* aObserver,
+    MMPXPlaybackViewLayout* aLayout )
+    {
+    MPX_FUNC("CMPXButton::NewL()");
+    CMPXButton* self = CMPXButton::NewLC(
+        aButtonId,
+        aObserver,
+        aLayout );
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// Destructor
+CMPXButton::~CMPXButton()
+    {
+    MPX_FUNC("CMPXButton::~CMPXButton()");
+    FreeIcons();
+    iButtonArray.ResetAndDestroy();
+
+    if (iTimer)
+        {
+        iTimer->Cancel();
+        delete iTimer;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CMPXButton::ConstructL()
+    {
+    MPX_FUNC("CMPXButton::ConstructL()");
+    iKeySoundSystem = static_cast<CAknAppUi*>(
+        CEikonEnv::Static()->AppUi())->KeySounds();
+
+    iTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXButton::AddStateL
+// -----------------------------------------------------------------------------
+//
+void CMPXButton::AddStateL(
+    TInt aState,
+    TInt aEnterCommand,
+    TInt aExitCommand,
+    TInt aLongEnterCommand,
+    TInt aLongExitCommand )
+    {
+    MPX_DEBUG1("CMPXButton::AddStateL() entering");
+    TMPXButtonInfo* info = new (ELeave) TMPXButtonInfo;
+    CleanupStack::PushL( info );
+    info->iState = aState;
+    info->iEnterCommand = aEnterCommand;
+    info->iExitCommand = aExitCommand;
+    info->iLongEnterCommand = aLongEnterCommand;
+    info->iLongExitCommand = aLongExitCommand;
+    info->iBitmap = LoadIconL( aState );
+    iButtonArray.AppendL(info);
+    CleanupStack::Pop( info );
+    MPX_DEBUG1("CMPXButton::AddStateL() exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::Id
+// -----------------------------------------------------------------------------
+//
+TMPXPbvButton CMPXButton::Id() const
+    {
+    return iButtonId;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::MakeVisible
+// -----------------------------------------------------------------------------
+//
+void CMPXButton::MakeVisible(
+    TBool aVisible )
+    {
+    iVisible = aVisible;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::IsVisible
+// -----------------------------------------------------------------------------
+//
+TBool CMPXButton::IsVisible() const
+    {
+    return iVisible;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::SetButtonState
+// -----------------------------------------------------------------------------
+//
+void CMPXButton::SetButtonState(
+    TInt aState,
+    TBool aNotifyExit /*=EFalse=*/,
+    TBool aNotifyEnter /*=EFalse*/ )
+    {
+    MPX_DEBUG4("CMPXButton::SetButtonState(%d, %d, %d): entering", aState, aNotifyExit, aNotifyEnter);
+    
+    TInt index( KErrNotFound );
+    TMPXButtonInfo* info( NULL );
+    
+    // Find the new state
+    for (TInt i = 0; i < iButtonArray.Count(); i++)
+        {
+        info = iButtonArray[i];
+        if ( info->iState == aState )
+            {
+            index = i;
+            }
+        }
+    
+    if ( KErrNotFound != index &&
+         iCurrentStateIndex != index )
+        {
+        if ( aNotifyExit || aNotifyEnter )
+            {
+            if ( aNotifyExit )
+                {
+                // Execute the previous state's exit command
+                info = iButtonArray[iCurrentStateIndex];
+                if ( iIsLongPress )
+                    {
+                    if ( info->iLongExitCommand != KErrNone )
+                        {
+                        TRAP_IGNORE(
+                            iObserver->HandleButtonCommandL( info->iLongExitCommand ));
+                        }
+                    }
+                else if ( info->iExitCommand != KErrNone )
+                    {
+                    TRAP_IGNORE(
+                        iObserver->HandleButtonCommandL( info->iExitCommand ));
+                    }
+                // Reset long press flag
+                iIsLongPress = EFalse;
+                }
+                
+            info = iButtonArray[index];
+            if ( aNotifyEnter )
+                {
+                // Now execute the new state's enter command
+                if ( info->iEnterCommand != KErrNone )
+                    {
+                    TRAP_IGNORE( 
+                        iObserver->HandleButtonCommandL( info->iEnterCommand ));
+                    }
+                }
+                
+            // start the timer
+            iTimer->Cancel();
+            if ( info->iLongEnterCommand != KErrNone )
+                {
+                iTimer->Start( KAknKeyboardRepeatInitialDelay,
+                               KAknKeyboardRepeatInitialDelay,
+                               TCallBack(TimerCallback, this ));
+                }
+            }
+
+        iCurrentStateIndex = index;
+        iNeedRedraw = ETrue;
+        }
+    MPX_DEBUG1("CMPXButton::SetButtonState(): exiting");
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPXButton::CurrentState
+// -----------------------------------------------------------------------------
+//
+TInt CMPXButton::CurrentState() const
+    {
+    MPX_DEBUG1("CMPXButton::CurrentState() entering");
+    ASSERT( iCurrentStateIndex < iButtonArray.Count() );
+    TInt state( iButtonArray[iCurrentStateIndex]->iState );
+    MPX_DEBUG2("CMPXButton::CurrentState() exiting: %d", state);
+    return state;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::RedrawRect
+// -----------------------------------------------------------------------------
+//
+void CMPXButton::RedrawRect(
+    CBitmapContext& aGc, 
+    const TRect& aRect ) const
+    {
+    MPX_DEBUG1("CMPXButton::RedrawRect() entering");
+    
+    if (iVisible && aRect.Intersects(iRect))
+        {
+        if (iBackground)
+            {
+            MPX_DEBUG1("CMPXButton::RedrawRect() redrawing background");
+            MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+            AknsDrawUtils::DrawBackground(
+                skin, 
+                iBackground, 
+                NULL, 
+                aGc, 
+                iRect.iTl, 
+                iRect, 
+                KAknsDrawParamDefault );
+            }
+            
+        MPX_DEBUG2("CMPXButton::RedrawRect(): iCurrentStateIndex = %d", iCurrentStateIndex);
+        ASSERT( iCurrentStateIndex < iButtonArray.Count() );
+        TMPXButtonInfo* info( iButtonArray[iCurrentStateIndex] );
+        CGulIcon* icon( info->iBitmap );
+
+        if ( icon )
+            {
+            ASSERT( icon->Bitmap() && icon->Mask() );
+            MPX_DEBUG1("CMPXButton::RedrawRect() redrawing icon");
+            aGc.BitBltMasked(
+                iRect.iTl, // aPoint
+                icon->Bitmap(), // aBitmap
+                TRect(TPoint(), iRect.Size()), // aSourceRect
+                icon->Mask(),
+                EFalse); // aInvertMask
+            }
+        }
+    MPX_DEBUG1("CMPXButton::RedrawRect() exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::ReloadIconsL
+// -----------------------------------------------------------------------------
+//
+void CMPXButton::ReloadIconsL(
+    const TRect& aParentRect )
+    {
+    MPX_DEBUG1("CMPXButton::ReloadIconsL() entering");
+    iParentRect = aParentRect;
+
+    FreeIcons();
+    
+    iRect = iLayout->ButtonLayout( aParentRect );
+    for (TInt i = 0; i < iButtonArray.Count(); i++)
+        {
+        TMPXButtonInfo* info( iButtonArray[i] );
+        info->iBitmap = LoadIconL( info->iState );
+        AknIconUtils::SetSize(
+            info->iBitmap->Bitmap(),
+            iRect.Size() );
+        }    
+    MPX_DEBUG1("CMPXButton::ReloadIconsL() exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::SetBackground
+// -----------------------------------------------------------------------------
+//
+void CMPXButton::SetBackground(
+    MAknsControlContext* aBackground)
+    {
+    ASSERT( aBackground );
+    iBackground = aBackground;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::NeedRedraw
+// -----------------------------------------------------------------------------
+//
+TBool CMPXButton::NeedRedraw() const
+    {
+    return iNeedRedraw;
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPXButton::ClearRedrawFlag
+// -----------------------------------------------------------------------------
+//
+void CMPXButton::ClearRedrawFlag()
+    {
+    iNeedRedraw = EFalse;
+    }
+  
+// -----------------------------------------------------------------------------
+// CMPXButton::LoadIconL
+// -----------------------------------------------------------------------------
+//
+CGulIcon* CMPXButton::LoadIconL(
+    TInt aState )
+    {
+    MPX_DEBUG1("CMPXButton::LoadIconL() entering");
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    iLayout->GetButtonBitmapsL(
+        iButtonId, 
+        aState, 
+        bitmap, 
+        mask);
+    CleanupStack::PushL(bitmap);
+    CleanupStack::PushL(mask);
+
+    CGulIcon* res = CGulIcon::NewL(bitmap, mask);
+    CleanupStack::Pop(2); // bitmap, mask
+    
+    MPX_DEBUG1("CMPXButton::LoadIconL() exiting");
+    return res;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::FreeIcons
+// -----------------------------------------------------------------------------
+//
+void CMPXButton::FreeIcons()
+    {
+    MPX_DEBUG1("CMPXButton::FreeIcons() entering");
+    for ( TInt i = 0; i < iButtonArray.Count(); i++ )
+        {
+        TMPXButtonInfo* info( iButtonArray[i] );
+        delete info->iBitmap;
+        info->iBitmap = NULL;
+        }
+    MPX_DEBUG1("CMPXButton::FreeIcons() exiting");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXButton::HandleKeyRepeat
+// -----------------------------------------------------------------------------
+//
+void CMPXButton::HandleLongPress()
+    {
+    MPX_DEBUG1("CMPXButton::HandleLongPress() entering");
+    
+    iIsLongPress = ETrue;
+    
+    TMPXButtonInfo* info( iButtonArray[iCurrentStateIndex] );
+    if ( info->iLongEnterCommand != KErrNone )
+        {
+        if( !(info->iLongEnterCommand == EMPXPbvCmdIncreaseVolume || 
+              info->iLongEnterCommand == EMPXPbvCmdDecreaseVolume ))
+            {
+            iTimer->Cancel();    
+            }
+        
+        TRAP_IGNORE(iObserver->HandleButtonCommandL( info->iLongEnterCommand ));
+        }
+    
+    MPX_DEBUG1("CMPXButton::HandleLongPress() exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButton::TimerCallback
+// -----------------------------------------------------------------------------
+//
+TInt CMPXButton::TimerCallback(
+    TAny* aPtr )
+    {
+    MPX_DEBUG1("CMPXButton::TimerCallback() entering");
+    static_cast<CMPXButton*>(aPtr)->HandleLongPress();
+    MPX_DEBUG1("CMPXButton::TimerCallback() exiting");
+    return KErrNone;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/src/mpxbuttonmanager.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,748 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Button state manager for playback view
+*
+*/
+
+
+// INCLUDE FILES
+#include <aknbutton.h>
+#include <mpxcommonplaybackview.rsg>
+#include <AknsUtils.h>
+#include <AknsSkinInstance.h>
+#include <AknsDrawUtils.h>
+#include <barsread.h>
+#include <AknDef.h>
+#include <featmgr.h>
+#include <aknconsts.h>
+#include "mpxbuttonmanager.h"
+#include "mpxplaybackviewlayoutinterface.h"
+#include "mpxcommonplaybackview.hrh"
+#include "mpxlog.h"
+
+// CONSTANTS
+
+
+struct TStateAndCommandIds
+    {
+    TInt iState;
+    TInt iEnterCommand;
+    TInt iExitCommand;
+    TInt iLongEnterCommand;
+    TInt iLongExitCommand;
+    };
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXButtonManager::CMPXButtonManager
+// -----------------------------------------------------------------------------
+//
+CMPXButtonManager::CMPXButtonManager(
+    MMPXButtonCmdObserver* aObserver,
+    MMPXPlaybackViewLayout* aLayout )
+    : iObserver(aObserver),
+      iLayout(aLayout),
+      iEnabled(ETrue)
+    {
+    MPX_FUNC("CMPXButtonManager::CMPXButtonManager()");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButtonManager::NewL
+// -----------------------------------------------------------------------------
+//
+CMPXButtonManager* CMPXButtonManager::NewL(
+    MMPXButtonCmdObserver* aObserver,
+    MMPXPlaybackViewLayout* aLayout,
+    const CCoeControl &aContainer)
+    {
+    MPX_FUNC("CMPXButtonManager::NewL()");
+    CMPXButtonManager* self = new (ELeave) CMPXButtonManager(
+        aObserver,
+        aLayout);
+
+    CleanupStack::PushL(self);
+    //self->ConstructL(aRect, aContainer);
+    self->ConstructL(aContainer);
+    CleanupStack::Pop();
+    return self;
+    }
+// -----------------------------------------------------------------------------
+// CMPXButtonManager::~CMPXButtonManager
+// -----------------------------------------------------------------------------
+//
+CMPXButtonManager::~CMPXButtonManager()
+    {
+    MPX_FUNC("CMPXButtonManager::~CMPXButtonManager()");
+//    iButtons.ResetAndDestroy();
+    iAvkonButtons.ResetAndDestroy();
+    if (iLongKeyTimer)
+        {
+        iLongKeyTimer->Cancel();
+        delete iLongKeyTimer;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButtonManager::ConstructL (overloaded for avkon button rocker)
+// -----------------------------------------------------------------------------
+//
+void CMPXButtonManager::ConstructL(const CCoeControl &aContainer)
+    {
+    MPX_FUNC("CMPXButtonManager::ConstructL()");
+    iIsLongPress = EFalse;
+    iVolumeInRocker = (!FeatureManager::FeatureSupported( KFeatureIdSideVolumeKeys ));
+
+    if( AknLayoutUtils::PenEnabled() )
+        {
+            iIsTouchUi = ETrue;
+        }
+    else
+        {
+            iIsTouchUi = EFalse;
+        }
+
+    if (!iVolumeInRocker)
+        {
+            iStopInRocker = ETrue;
+        }
+    else
+        {
+            iStopInRocker = EFalse;
+        }
+
+    if( !iIsTouchUi)
+        {
+        CreateRockerAvkonButtonsL(aContainer);
+        }
+
+    ActivateL();
+
+    iLongKeyTimer = CPeriodic::NewL(CActive::EPriorityStandard);
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButtonManager::UpdateButtonStates
+// -----------------------------------------------------------------------------
+//
+void CMPXButtonManager::UpdateButtonStates( TMPXPlaybackState aState )
+    {
+    MPX_DEBUG2("CMPXButtonManager::UpdateButtonStates(%d) entering", aState);
+    if( !iIsTouchUi && !iIsSeeking )
+        {
+        if (aState == EPbStatePlaying)
+            {
+            // Playing
+            if (iAvkonButtons[EButtonPlay]->IsVisible())
+                {
+                iAvkonButtons[EButtonPlay]->MakeVisible(EFalse);
+                }
+            if (!iAvkonButtons[EButtonPause]->IsVisible())
+                {
+                iAvkonButtons[EButtonPause]->MakeVisible(ETrue);
+                }
+            }
+        else
+            {
+            // Not playing
+            if (!iAvkonButtons[EButtonPlay]->IsVisible())
+                {
+                iAvkonButtons[EButtonPlay]->MakeVisible(ETrue);
+                }
+            if (iAvkonButtons[EButtonPause]->IsVisible())
+                {
+                iAvkonButtons[EButtonPause]->MakeVisible(EFalse);
+                }
+            }
+
+        if (iAvkonButtons[EButtonPlay]->IsVisible())
+            {
+            if (aState == EPbStateNotInitialised &&
+                !iAvkonButtons[EButtonPlay]->IsDimmed())
+                {
+                iAvkonButtons[EButtonPlay]->SetDimmed(ETrue);
+                }
+            if (aState != EPbStateNotInitialised &&
+                iAvkonButtons[EButtonPlay]->IsDimmed())
+                {
+                iAvkonButtons[EButtonPlay]->SetDimmed(EFalse);
+                }
+            }
+
+        for (TInt i = 0; i< iRockerAvkonButtonCount; i++)
+            {
+            iAvkonButtons[i]->SetCurrentState(0, ETrue);
+            }
+        }
+
+    MPX_DEBUG1("CMPXButtonManager::UpdateButtonStates() exiting");
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXButtonManager::OfferKeyEventL
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CMPXButtonManager::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG3("CMPXButtonManager::OfferKeyEventL(%d, %d) entering", aKeyEvent.iScanCode, aType);
+
+    TKeyResponse response( EKeyWasNotConsumed );
+    response = SetAvkonButtonState(aKeyEvent, aType);
+    MPX_DEBUG2("CMPXButtonManager::OfferKeyEventL() exiting %d", response);
+    return response;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButtonManager::SetParentRect
+// -----------------------------------------------------------------------------
+//
+void CMPXButtonManager::SetParentRect(
+    const TRect& aRect )
+    {
+    iParentRect = aRect;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButtonManager::SetEnabled
+// -----------------------------------------------------------------------------
+//
+void CMPXButtonManager::SetEnabled( TBool aEnabled )
+    {
+    MPX_DEBUG2("CMPXButtonManager::SetEnabled(%d) entering", aEnabled);
+    iEnabled = aEnabled;
+    MPX_DEBUG1("CMPXButtonManager::SetEnabled() exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButtonManager::HandleForegroundLostL
+// -----------------------------------------------------------------------------
+//
+void CMPXButtonManager::HandleForegroundLostL()
+    {
+    MPX_FUNC( "CMPXButtonManager::HandleForegroundLostL" );
+    iIsSeeking = EFalse;
+
+ 	if (iIsLongPress)
+		{
+		iIsLongPress = EFalse;
+		iObserver->HandleButtonCommandL(EMPXPbvCmdEndSeek);
+		}
+
+	if(iLongKeyTimer)
+		{
+		iLongKeyTimer->Cancel();
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewContainer::CreateRockerAvkonButtonsL
+// -----------------------------------------------------------------------------
+//
+void CMPXButtonManager::CreateRockerAvkonButtonsL(const CCoeControl &aContainer)
+    {
+    TResourceReader reader;
+    iRockerAvkonButtonCount = 0;
+    CCoeEnv::Static()->CreateResourceReaderLC( reader, R_MPX_PBV_ROCKER_AVKON_BUTTONS );
+    TInt numButtons( reader.ReadInt16() );
+
+    CCoeControl::SetContainerWindowL(aContainer);
+
+    for (TInt i = 0; i < numButtons; i++ )
+        {
+        CAknButton* aknButton = CAknButton::NewL();
+        CleanupStack::PushL( aknButton );
+        aknButton->SetContainerWindowL(*this);
+        aknButton->SetParent( this );
+        aknButton->ConstructFromResourceL( reader );
+        aknButton->SetObserver( this );
+        aknButton->SetLongPressInterval(1000);//KAknKeyboardRepeatInitialDelay / 1000);
+        aknButton->SetKeyRepeatInterval(0, KAknKeyboardRepeatInitialDelay / 1000);
+        aknButton->ActivateL();
+        iAvkonButtons.AppendL( aknButton );
+        CleanupStack::Pop( aknButton );
+        iRockerAvkonButtonCount++;
+        }
+
+    CleanupStack::PopAndDestroy(); // reader;
+
+    TResourceReader reader2;
+    if (iVolumeInRocker)
+        {
+        CCoeEnv::Static()->CreateResourceReaderLC( reader2, R_MPX_PBV_ROCKER_VOLUME_AVKON_BUTTONS );
+        numButtons = reader2.ReadInt16();
+        for (TInt i = 0; i < numButtons; i++ )
+            {
+            CAknButton* aknButton = CAknButton::NewL();
+            CleanupStack::PushL( aknButton );
+            aknButton->SetContainerWindowL( *this );
+            aknButton->SetParent( this );
+            aknButton->ConstructFromResourceL( reader2 );
+            aknButton->SetObserver( this );
+            aknButton->SetLongPressInterval(1000);//KAknKeyboardRepeatInitialDelay / 1000);
+            aknButton->SetKeyRepeatInterval(0, KAknKeyboardRepeatInitialDelay / 1000);
+            aknButton->ActivateL();
+            iAvkonButtons.AppendL( aknButton );
+            CleanupStack::Pop( aknButton );
+            iRockerAvkonButtonCount++;
+            }
+        }
+    else
+        {
+        CCoeEnv::Static()->CreateResourceReaderLC( reader2, R_MPX_PBV_ROCKER_STOP_AVKON_BUTTON );
+        CAknButton* aknButton = CAknButton::NewL();
+        CleanupStack::PushL( aknButton );
+        aknButton->SetContainerWindowL( *this );
+        aknButton->SetParent( this );
+        aknButton->ConstructFromResourceL( reader2 );
+        aknButton->SetObserver( this );
+        aknButton->SetLongPressInterval(1000);//KAknKeyboardRepeatInitialDelay / 1000);
+        aknButton->SetKeyRepeatInterval(0, KAknKeyboardRepeatInitialDelay / 1000);
+        aknButton->ActivateL();
+        iAvkonButtons.AppendL( aknButton );
+        CleanupStack::Pop( aknButton );
+        iRockerAvkonButtonCount++;
+        }
+
+    CleanupStack::PopAndDestroy(); // reader2;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewContainer::SetAvkonButtonState
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CMPXButtonManager::SetAvkonButtonState(const TKeyEvent& aKeyEvent,
+        TEventCode aType)
+    {
+
+    TKeyResponse response = EKeyWasNotConsumed;
+
+    if (aKeyEvent.iScanCode == EStdKeyLeftArrow || aKeyEvent.iCode == EKeyLeftArrow)
+        {    
+        MPX_DEBUG1( "CMPXButtonManager::SetAvkonButtonState LeftArrow" );
+        if (aType == EEventKeyDown)
+            {
+            if (!iIsTouchUi)
+                {
+                iAvkonButtons[EButtonRewind]->SetCurrentState(1, ETrue); 
+                }
+            iLongKeyTimer->Cancel();
+            iLongKeyTimer->Start(KAknKeyboardRepeatInitialDelay,
+                                 KAknKeyboardRepeatInitialDelay,
+                                 TCallBack(TimerCallback, this));
+            iLongPressCommandId = EMPXPbvCmdSeekBackward;
+            iIsSeeking = ETrue;
+            }
+        else if (aType == EEventKeyUp)
+            {
+            if (!iIsTouchUi)
+                {
+                iAvkonButtons[EButtonRewind]->SetCurrentState(0, ETrue);
+                }
+            iLongKeyTimer->Cancel();
+            if (iIsLongPress)
+               {
+               MPX_DEBUG1( "CMPXButtonManager::SetAvkonButtonState LeftArrow long press" );
+               iIsLongPress = EFalse;
+               iObserver->HandleButtonCommandL(EMPXPbvCmdEndSeek);
+               }
+            else
+               {
+               MPX_DEBUG1( "CMPXButtonManager::SetAvkonButtonState LeftArrow short press" );
+               iObserver->HandleButtonCommandL(EMPXPbvCmdPreviousListItem);
+               }
+            iIsLongPress = EFalse;
+            response = EKeyWasConsumed;
+            iIsSeeking = EFalse;
+            }
+        }
+    else if (aKeyEvent.iScanCode == EStdKeyRightArrow || aKeyEvent.iCode == EKeyRightArrow)
+        {
+        if (aType == EEventKeyDown)
+            {
+	    	    if (!iIsTouchUi)
+	    	        {
+                iAvkonButtons[EButtonFastForward]->SetCurrentState(1, ETrue);
+                }
+            iLongKeyTimer->Cancel();
+            iLongKeyTimer->Start(KAknKeyboardRepeatInitialDelay,
+                                 KAknKeyboardRepeatInitialDelay,
+                                 TCallBack(TimerCallback, this));
+            iLongPressCommandId = EMPXPbvCmdSeekForward;
+            iIsSeeking = ETrue;
+            }
+            else if (aType == EEventKeyUp)
+                {
+                if (!iIsTouchUi)
+                    {
+                    iAvkonButtons[EButtonFastForward]->SetCurrentState(0, ETrue);    
+                    }
+                iLongKeyTimer->Cancel();
+                if (iIsLongPress)
+                    {
+                    MPX_DEBUG1( "CMPXButtonManager::SetAvkonButtonState RightArrow long press" );
+                    iIsLongPress = EFalse;
+                    iObserver->HandleButtonCommandL(EMPXPbvCmdEndSeek);
+                    }
+                else
+                    {
+				            MPX_DEBUG1( "CMPXButtonManager::SetAvkonButtonState RightArrow short press" );
+                   iObserver->HandleButtonCommandL(EMPXPbvCmdNextListItem);
+                   }
+                iIsLongPress = EFalse;
+                iIsSeeking = EFalse;
+                response = EKeyWasConsumed;
+                }
+        }
+    else if (aKeyEvent.iScanCode == EStdKeyDevice3 || aKeyEvent.iCode == EKeyDevice3
+            || aKeyEvent.iScanCode == EStdKeyEnter || aKeyEvent.iCode == EKeyEnter)
+   		{
+   		MPX_DEBUG1( "CMPXButtonManager::SetAvkonButtonState EStdKeyDevice3 or EStdKeyEnter pressed" );
+        if (!iIsTouchUi)
+            {
+            if (aType == EEventKeyDown)
+                {
+                iKeyDownEventReceived = ETrue;
+    
+                if (iAvkonButtons[EButtonPause]->IsVisible())
+                    {
+                    iAvkonButtons[EButtonPause]->SetCurrentState(1, ETrue);
+                    }
+                else
+                    {
+                    iAvkonButtons[EButtonPlay]->SetCurrentState(1, ETrue);
+                    }
+                }
+            else if (aType == EEventKeyUp)
+                {
+                if ( iKeyDownEventReceived )
+                    {
+                    if (iAvkonButtons[EButtonPause]->IsVisible())
+                        {
+                        iAvkonButtons[EButtonPause]->SetCurrentState(0, ETrue);
+                        iObserver->HandleButtonCommandL(EMPXPbvCmdPause);
+                        response = EKeyWasConsumed;
+                        }
+                    else
+                        {
+                        iAvkonButtons[EButtonPlay]->SetCurrentState(0, ETrue);
+                        iObserver->HandleButtonCommandL(EMPXPbvCmdPlay);
+                        response = EKeyWasConsumed;
+                        }
+                    }
+                iKeyDownEventReceived= EFalse;
+                }
+            }
+        else  //iIsTouchUi
+            {
+            if (aType == EEventKeyDown)
+                {
+                iKeyDownEventReceived = ETrue;
+                }
+            else if (aType == EEventKeyUp)
+                {
+                if ( iKeyDownEventReceived )
+                    {
+                    iObserver->HandleButtonCommandL(EMPXPbvCmdPlayPause );
+                    response = EKeyWasConsumed;
+                    }
+                iKeyDownEventReceived = EFalse;
+                }
+            }	
+   		}
+    else if (aKeyEvent.iScanCode == EStdKeyDownArrow || aKeyEvent.iCode == EKeyDownArrow)
+        {
+        MPX_DEBUG1( "CMPXButtonManager::SetAvkonButtonState EStdKeyDownArrow pressed" );
+        if (iVolumeInRocker || iStopInRocker)
+           {	
+           if (!iIsTouchUi)
+               {
+            if (aType == EEventKeyDown)
+                {
+                iAvkonButtons[EButtonVolumeDown]->SetCurrentState(1, ETrue);
+                }
+            else if (aType == EEventKeyUp)
+                {
+                iAvkonButtons[EButtonVolumeDown]->SetCurrentState(0, ETrue);
+                if(iVolumeInRocker)
+                    {
+                    iObserver->HandleButtonCommandL(EMPXPbvCmdDecreaseVolume);
+                    }
+                else
+                    {
+                    iObserver->HandleButtonCommandL(EMPXPbvCmdStop);
+                    }
+                response = EKeyWasConsumed;
+                    }
+               }
+		       else //iIsTouchUi
+		           {
+               if (iVolumeInRocker && aType == EEventKeyUp )
+			             {            
+                   iObserver->HandleButtonCommandL(EMPXPbvCmdDecreaseVolume);
+                   }
+               else if (iStopInRocker && aType == EEventKeyUp)
+                   {                 		
+                   iObserver->HandleButtonCommandL(EMPXPbvCmdStop);
+                   }
+               response = EKeyWasConsumed; 
+               }
+		        }
+		    }
+    else if (aKeyEvent.iScanCode == EStdKeyUpArrow || aKeyEvent.iCode == EKeyUpArrow)
+        {
+        MPX_DEBUG1( "CMPXButtonManager::SetAvkonButtonState EStdKeyUpArrow pressed" );
+        if(iVolumeInRocker)
+            {
+	    	    if (!iIsTouchUi)
+                {
+                if (aType == EEventKeyDown)
+                    {
+                    iAvkonButtons[EButtonVolumeUp]->SetCurrentState(1, ETrue);
+                    }
+                else if (aType == EEventKeyUp)
+                    {
+                	  iAvkonButtons[EButtonVolumeUp]->SetCurrentState(0, ETrue);     		
+                	  iObserver->HandleButtonCommandL(EMPXPbvCmdIncreaseVolume);
+                	  response = EKeyWasConsumed;
+                	  }
+                }
+            else //iIsTouchUi
+                {
+                if (aType == EEventKeyUp)
+              	    {
+                    iObserver->HandleButtonCommandL(EMPXPbvCmdIncreaseVolume);
+                	  response = EKeyWasConsumed;   
+                	  }	
+                }
+           }
+        }
+      return response;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPlayerPlaybackContainer::TimerCallback
+// -----------------------------------------------------------------------------
+//
+TInt CMPXButtonManager::TimerCallback(TAny* aPtr)
+    {
+    //HandleLongPress();
+    static_cast<CMPXButtonManager*>(aPtr)->HandleLongPress();
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPlayerPlaybackContainer::HandleLongPress
+// -----------------------------------------------------------------------------
+//
+void CMPXButtonManager::HandleLongPress()
+    {
+    iObserver->HandleButtonCommandL(iLongPressCommandId);
+    iLongKeyTimer->Cancel();
+    iIsLongPress = ETrue;
+    }
+
+// -----------------------------------------------------------------------------
+// void CMPXCommonPlaybackViewContainer::HandleControlEventL
+// ----------------------------------------------------------------------------
+//
+void CMPXButtonManager::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
+    {
+
+    if( AknLayoutUtils::PenEnabled() )
+        {
+        switch( aEventType )
+            {
+            case EEventStateChanged:
+                {
+                if (iVolumeInRocker)
+                {
+                if ( aControl == iAvkonButtons[EButtonVolumeUp] )
+                    {
+                    iAvkonButtons[EButtonVolumeUp]->SetCurrentState(0, ETrue);
+                    iObserver->HandleButtonCommandL(EMPXPbvCmdIncreaseVolume);
+                    }
+                else if ( aControl == iAvkonButtons[EButtonVolumeDown] )
+                    {
+                    iAvkonButtons[EButtonVolumeDown]->SetCurrentState(0, ETrue);
+                    iObserver->HandleButtonCommandL(EMPXPbvCmdDecreaseVolume);
+                    }
+
+                }
+
+                break;
+                }
+            case CAknButton::ELongPressEvent:
+                {
+                if ( aControl == iAvkonButtons[EButtonFastForward] )
+                    {
+                    iIsLongPress = ETrue;
+                    iAvkonButtons[EButtonFastForward]->SetCurrentState(0, ETrue);
+                    iObserver->HandleButtonCommandL(EMPXPbvCmdSeekForward);
+                    }
+                else if ( aControl == iAvkonButtons[EButtonRewind] )
+                    {
+                    iIsLongPress = ETrue;
+                    iAvkonButtons[EButtonRewind]->SetCurrentState(0, ETrue);
+                    iObserver->HandleButtonCommandL(EMPXPbvCmdSeekBackward);
+                    }
+                break;
+                }
+            case MCoeControlObserver::EEventRequestExit:
+                {
+                if ( aControl == iAvkonButtons[EButtonPlay] )
+                    {
+                    iAvkonButtons[EButtonPlay]->SetCurrentState(0, ETrue);
+                    iObserver->HandleButtonCommandL(EMPXPbvCmdPlay);
+                    }
+                else if ( aControl == iAvkonButtons[EButtonPause] )
+                    {
+                    iAvkonButtons[EButtonPause]->SetCurrentState(0, ETrue);
+                    iObserver->HandleButtonCommandL(EMPXPbvCmdPause);
+                    }
+                else if ( aControl == iAvkonButtons[EButtonFastForward] )
+                    {
+                    if (iIsLongPress)
+                        {
+                        iIsLongPress = EFalse;
+                        iAvkonButtons[EButtonFastForward]->SetCurrentState(0, ETrue);
+                        iObserver->HandleButtonCommandL(EMPXPbvCmdEndSeek);
+                        }
+                    else
+                        {
+                        iAvkonButtons[EButtonFastForward]->SetCurrentState(0, ETrue);
+                        iObserver->HandleButtonCommandL(EMPXPbvCmdNextListItem);
+                        }
+                    }
+                else if ( aControl == iAvkonButtons[EButtonRewind] )
+                    {
+                    if (iIsLongPress)
+                        {
+                        iIsLongPress = EFalse;
+                        iAvkonButtons[EButtonRewind]->SetCurrentState(0, ETrue);
+                        iObserver->HandleButtonCommandL(EMPXPbvCmdEndSeek);
+                        }
+                    else
+                        {
+                        iAvkonButtons[EButtonRewind]->SetCurrentState(0, ETrue);
+                        iObserver->HandleButtonCommandL(EMPXPbvCmdPreviousListItem);
+                        }
+                    }
+                else if ( !iVolumeInRocker)
+                    {
+                    if(aControl == iAvkonButtons[EButtonVolumeDown])
+                        {
+                        iAvkonButtons[EButtonVolumeDown]->SetCurrentState(0, ETrue);
+                        iObserver->HandleButtonCommandL(EMPXPbvCmdStop);
+                        }
+                    }
+                break;
+                }
+            default:
+                break;
+            }
+        }
+
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the number of controls contained in a compound control.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXButtonManager::CountComponentControls() const
+    {
+    return iRockerAvkonButtonCount;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets an indexed component of a compound control.
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CMPXButtonManager::ComponentControl( TInt aIndex ) const
+    {
+    ASSERT( aIndex < iRockerAvkonButtonCount );
+    return iAvkonButtons[aIndex];
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+void CMPXButtonManager::HandleResourceChange( TInt aType )
+    {
+
+    if ( aType == KAknsMessageSkinChange )
+        {
+        for (TInt i = 0; i< iRockerAvkonButtonCount; i++)
+            {
+            iAvkonButtons[i]->HandleResourceChange( aType );
+            }
+
+        }
+    }
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a size change
+// ---------------------------------------------------------------------------
+//
+void CMPXButtonManager::SizeChanged()
+    {
+    iParentRect = Rect();
+    TRect rockerRect = iLayout->ButtonLayout(iParentRect);
+    TRect controlButtonRect;
+    for (TInt i = 0; i< iRockerAvkonButtonCount; i++)
+        {
+        controlButtonRect = iLayout->ButtonLayout(rockerRect, i);
+        iAvkonButtons[i]->SetRect( controlButtonRect );
+        }
+    }
+
+void CMPXButtonManager::Draw(CWindowGc& /*aGc*/, const CCoeControl& /*aControl*/, const TRect& /*aRect*/) const
+    {
+	// Do Nothing
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXButtonManager::RestoreButtonStates
+// -----------------------------------------------------------------------------
+//
+void CMPXButtonManager::RestoreButtonStates( TMPXPlaybackState aState )
+    {
+    MPX_DEBUG2("CMPXButtonManager::RestoreButtonStates(%d) entering", aState);    
+    if( !iIsTouchUi)
+        {
+        if (aState == EPbStatePlaying)
+            {
+            // Playing
+            if (!iAvkonButtons[EButtonFastForward]->IsDimmed())
+                {
+                iAvkonButtons[EButtonFastForward]->SetDimmed(ETrue);
+                }
+            if (!iAvkonButtons[EButtonRewind]->IsDimmed())
+                {
+                iAvkonButtons[EButtonRewind]->SetDimmed(ETrue);
+                }
+            }
+        }
+    MPX_DEBUG1("CMPXButtonManager::ResoreButtonStates() exiting");
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1684 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Common Playback view's container.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <eiklabel.h>
+#include <eikimage.h>
+#include <eikprogi.h>
+#include <eikmenub.h>
+#include <eikappui.h>
+#include <eikenv.h>
+#include <aknview.h>
+#include <AknsUtils.h>
+#include <AknDef.h>
+#include <AknsConstants.h>
+#include <AknsSkinInstance.h>
+#include <AknsControlContext.h>
+#include <AknsDrawUtils.h>
+#include <AknsBasicBackgroundControlContext.h>
+#include <barsread.h>
+#include <centralrepository.h>
+#include <StringLoader.h>
+#include <fontids.hrh>
+#include <gulfont.h>
+#include <applayout.cdl.h>
+#include <AknIconArray.h>
+#include <AknIconUtils.h>
+#include <gulicon.h>
+#include <featmgr.h>
+#include <aknnotewrappers.h>
+
+#include <data_caging_path_literals.hrh>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <layoutmetadata.cdl.h>
+#include <avkon.mbg>
+#include <mpxcommonplaybackview.rsg>
+#include <mpxcommonplaybackview.mbg>
+#include <mpxconstants.h>
+#include <mpxfmtx.rsg> // For FF_FMTX
+#include <mpxappui.hrh>
+
+#include "mpxcommonplaybackviewcontainer.h"
+#include "mpxcommonplaybackviewlayout.h"
+#include "mpxcommonplaybackview.hrh"
+#include "mpxplaybackview.hlp.hrh"
+#include "mpxplaybackviewinfolabel.h"
+#include "mpxplaybackviewlayoutinterface.h"
+#include "mpxlayoutswitchobserver.h"
+#include "mpxcommonuihelper.h"
+#include <mpxinternalcrkeys.h>
+#include "mpxbuttonmanager.h"
+#include "mpxlog.h"
+
+#include <touchfeedback.h>
+
+// CONSTANTS
+const TInt KLabelCount = ETextCount;
+const TInt KMPXMinSecSeparatorIndex = 2;
+
+_LIT(KMPXZeroDurationMark, "--");
+
+const TInt KOneHourInSeconds = 3600;
+const TInt KMPXTimeIndicatorLength = 16;
+
+// S60 softkey positions in CBA
+const TInt KMPXCbaLeftSoftkeyPos = 0;
+const TInt KMPXCbaRightSoftkeyPos = 2;
+
+// delay for actual seek operation
+const TInt KSeekDelay = 100000; // 0.1s
+
+const TInt KOneSecondInOneMilliSecond = 1000;
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::ConstructL( const TRect& /*aRect*/ )
+    {
+    MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::ConstructL() entering" );
+
+    CreateWindowL();
+
+    TAknWindowLineLayout screenLayout =
+        AknLayout::screen();
+    TRect screenRect = screenLayout.Rect();
+    iBackground = CAknsBasicBackgroundControlContext::NewL(
+        KAknsIIDQsnBgAreaMainMp, screenRect, EFalse );
+
+	iSeekTimer = CPeriodic::NewL( EPriorityLow );
+
+    TInt flags( 0 );
+    CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
+    User::LeaveIfError( repository->Get( KMPXMPLocalVariation, flags ));
+    delete repository;
+    repository = NULL;
+
+    iEnableMarquee = static_cast<TBool>( flags & KMPXMarqueeArtistName );
+
+    iEnableButtons = static_cast<TBool>( flags & KMPXRockerMappingSupport );
+
+    CreateBackgroundImagesL();
+
+    // Create labels
+    CreateLabelsL();
+    iLabels[ETextPlaylistCount]->MakeVisible( ETrue );
+
+	if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+		{
+    	// By default, FMTX label is displayed
+    	iLabels[ETextFMFrequency]->MakeVisible( ETrue );
+    	SetFMTXMode(ETrue);
+		}
+
+    // Create icons
+    CreateIconsL();
+
+    // Create buttons if enabled
+    if ( iEnableButtons )
+        {
+        TRect rockerParentRect;
+        if ( iCurrentLayout.Width())
+        {
+            rockerParentRect = iCurrentLayout;
+        }
+        else
+        {
+            rockerParentRect = iCurrentLayout;
+        }
+
+        iButtonManager = CMPXButtonManager::NewL(
+            this,
+            iLayout,
+            *this);
+
+        iButtonManager->SetContainerWindowL( *this );
+        iButtonManager->SetMopParent( this );
+        iButtonManager->SetRect(rockerParentRect);
+        }
+
+     // Read time format strings from AVKON resource
+    iMinSecFormatString = StringLoader::LoadL(
+        R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO );
+
+    iShortFormatString =
+        StringLoader::LoadL( R_QTN_TIME_DURAT_SHORT_WITH_ZERO );
+
+    iCommonUiHelper = CMPXCommonUiHelper::NewL();
+
+    // Refresh the progress bar
+    UpdateProgressBarGraphics();
+
+    iMode = EUninitialized;
+    iLabels[ETextDownloadState]->MakeVisible( ETrue );
+    iLabels[ETextArtist]->MakeVisible( EFalse );
+    iLabels[ETextTrack]->MakeVisible( EFalse );
+    iLabels[ETextElapsedTime]->MakeVisible( EFalse );
+    iLabels[ETextRemainingTime]->MakeVisible( EFalse );
+    iDisplayAlbumArt = EFalse;
+    ActivateL();
+
+    iTouchDown = EFalse;
+    iActiveView = ETrue;
+    iPrerollCompleted = EFalse;
+
+	DrawableWindow()->SetPointerGrab( ETrue );
+    EnableDragEvents();
+
+    MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::ConstructL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXCommonPlaybackViewContainer::~CMPXCommonPlaybackViewContainer()
+    {
+    // Pointer events
+    SetGloballyCapturing( EFalse );
+    SetPointerCapture( EFalse );
+
+    FreeIcons();
+    delete iTrackAlbumArt;
+
+    delete iBackground;
+    iLabels.ResetAndDestroy();
+    delete iMinSecFormatString;
+    delete iShortFormatString;
+    delete iCommonUiHelper;
+
+    delete iOffScreenBitmap;
+    delete iOSBitmapContext;
+    delete iOSBitmapDevice;
+
+    delete iButtonManager;
+
+   MTouchFeedback* feedback = MTouchFeedback::Instance();
+   if (feedback)
+       {
+       feedback->RemoveFeedbackForControl(this);
+       }
+
+    if ( iIdle )
+        {
+        iIdle->Cancel();
+        delete iIdle;
+        }
+
+	if ( iSeekTimer )
+		{
+		iSeekTimer->Cancel();
+		delete iSeekTimer;
+		}
+    }
+
+// ---------------------------------------------------------------------------
+// Updates time indicators.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateTimeIndicatorsL(
+    TInt aPlaybackPosInSeconds,
+    TInt aTotalLengthInSeconds )
+    {
+    iTrackTotalLengthInSeconds = aTotalLengthInSeconds;
+    if (!iTouchDown)
+        {
+        if( iDragProgressBar )
+          {
+          TInt expectPlaybackPos = iNewSongPosition / KOneSecondInOneMilliSecond;
+          if( expectPlaybackPos == aPlaybackPosInSeconds )
+              {
+              iDragProgressBar = EFalse;
+              }
+          else
+              {
+              return;
+              }
+          }
+    if ( aTotalLengthInSeconds == 0 )
+        {
+        TLocale locale;
+        TBuf<KMPXTimeIndicatorLength> pos;
+        TChar separator = locale.TimeSeparator( KMPXMinSecSeparatorIndex );
+        pos = KMPXZeroDurationMark;
+        pos.Append( separator );
+        pos += KMPXZeroDurationMark;
+
+        UpdateLabelL( ETextElapsedTime, pos );
+        UpdateLabelL( ETextRemainingTime, pos );
+        }
+    else
+        {
+        CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode =
+            CMPXCommonUiHelper::EMPXDuratAuto;
+        if ( aTotalLengthInSeconds > KOneHourInSeconds )
+            {
+            durationMode = CMPXCommonUiHelper::EMPXDuratHMS;
+            }
+
+        // Convert ellapsed time to texts
+        HBufC* position = iCommonUiHelper->DisplayableDurationL(
+            aPlaybackPosInSeconds,
+            durationMode );
+        CleanupStack::PushL( position );
+
+        TInt remainingTime = aTotalLengthInSeconds - aPlaybackPosInSeconds;
+        if ( remainingTime < 0 )
+            {
+            // Convert all negative value to zero
+            remainingTime = 0;
+            }
+
+        // Convert remaining time to texts
+        HBufC* remaining = iCommonUiHelper->DisplayableDurationL(
+            remainingTime,
+            durationMode );
+        CleanupStack::PushL( remaining );
+
+        UpdateLabelL( ETextElapsedTime, *position );
+        UpdateLabelL( ETextRemainingTime, *remaining );
+
+        CleanupStack::PopAndDestroy( remaining );
+        CleanupStack::PopAndDestroy( position );
+        }
+
+    if ( ( iMode != EUninitialized )
+         || ( iMode == EPlayMode || iMode == EPauseMode ) )
+        {
+        if ( aTotalLengthInSeconds )
+            {
+            TReal t = aTotalLengthInSeconds;
+            iPlaybackRatio = aPlaybackPosInSeconds / t;
+            }
+        RefreshProgressBar();
+        }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates label
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateLabelL(
+    TMPXPbvTextIndicator aLabel,
+    const TDesC& aText )
+    {
+    ASSERT( aLabel >= 0 && aLabel < iLabels.Count() );
+    CMPXPlaybackViewInfoLabel* label = iLabels[aLabel];
+    if(aLabel == ETextDownloadState)
+        {
+        iSliderPaneRect = iLayout->IndicatorLayout( Rect(), ESliderPane );
+        iLayout->LayoutLabel(
+        iLabels[ETextDownloadState], iSliderPaneRect, ETextDownloadState );
+
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+        TRgb color = KRgbBlack;
+
+        AknsUtils::GetCachedColor(
+            skin,
+            color,
+            KAknsIIDQsnTextColors,
+            EAknsCIQsnTextColorsCG50 );
+
+        AknLayoutUtils::OverrideControlColorL(
+            *iLabels[ETextDownloadState],
+            EColorLabelText,
+            color );
+        }
+    if ( label )
+        {
+        TBool needRedraw = EFalse;
+
+        if ( label->FullText() != aText )
+            {
+            needRedraw = ETrue;
+            label->SetLabelTextL( aText);
+            }
+
+        if ( needRedraw && label->IsVisible() )
+            {
+            label->StartMarquee();
+            label->DrawDeferred();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets main pane mode.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::SetMode( TMPXPbvPlaybackMode aMode )
+    {
+    iMode = aMode;
+    iDisplayAlbumArt = ETrue;
+
+    switch ( iMode )
+        {
+	    case EUninitialized:
+	    	{
+	    	// Set label visibility
+	        iLabels[ETextDownloadState]->MakeVisible( ETrue );
+	        iLabels[ETextArtist]->MakeVisible( ETrue );
+	        iLabels[ETextTrack]->MakeVisible( ETrue );
+	        //iLabels[ETextEmpty]->MakeVisible( EFalse );
+	        iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
+	        iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
+        	break;
+        	}
+        case ENoTracksMode:
+            {
+            // Set label visibility
+            iLabels[ETextDownloadState]->MakeVisible( ETrue );
+            iLabels[ETextArtist]->MakeVisible( EFalse );
+            iLabels[ETextTrack]->MakeVisible( EFalse );
+            //iLabels[ETextEmpty]->MakeVisible( ETrue );
+            iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
+            iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
+            iDisplayAlbumArt = EFalse;
+            break;
+            }
+        case EStopMode:
+            {
+            // Fixed the layout for Download label and time label are overlaped in position
+            iLabels[ETextDownloadState]->MakeVisible( EFalse );
+            iLabels[ETextTrack]->MakeVisible( ETrue );
+            iLabels[ETextArtist]->MakeVisible( ETrue );
+            //iLabels[ETextEmpty]->MakeVisible( EFalse );
+            iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
+            iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
+            break;
+            }
+        case EInitialising:
+            {
+            iLabels[ETextDownloadState]->MakeVisible( ETrue );
+            iLabels[ETextTrack]->MakeVisible( ETrue );
+            iLabels[ETextArtist]->MakeVisible( ETrue );
+            //iLabels[ETextEmpty]->MakeVisible( EFalse );
+            iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
+            iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
+            break;
+            }
+        case EMediaKeySkipping:
+            {
+            iLabels[ETextDownloadState]->MakeVisible( ETrue );
+            iLabels[ETextTrack]->MakeVisible( ETrue );
+            iLabels[ETextArtist]->MakeVisible( ETrue );
+            //iLabels[ETextEmpty]->MakeVisible( EFalse );
+            iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
+            iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
+            break;
+            }
+        case EInvalidMode:
+            {
+            iLabels[ETextDownloadState]->MakeVisible( EFalse );
+            iLabels[ETextTrack]->MakeVisible( EFalse );
+            iLabels[ETextArtist]->MakeVisible( EFalse );
+            //iLabels[ETextEmpty]->MakeVisible( EFalse );
+            iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
+            iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
+
+            break;
+            }
+        case EBufferingMode:
+            {
+            // Set label visibility
+            iLabels[ETextDownloadState]->MakeVisible( EFalse );
+            iLabels[ETextArtist]->MakeVisible( ETrue );
+            iLabels[ETextTrack]->MakeVisible( ETrue );
+            //iLabels[ETextEmpty]->MakeVisible( EFalse );
+            iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
+            iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
+            break;
+            }
+        default:
+            {
+            // Set label visibility
+            iLabels[ETextDownloadState]->MakeVisible( EFalse );
+            iLabels[ETextArtist]->MakeVisible( ETrue );
+            iLabels[ETextTrack]->MakeVisible( ETrue );
+            //iLabels[ETextEmpty]->MakeVisible( EFalse );
+            iLabels[ETextElapsedTime]->MakeVisible( ETrue && iPrerollCompleted);
+            iLabels[ETextRemainingTime]->MakeVisible( ETrue && iPrerollCompleted);
+            break;
+            }
+        }
+
+    if ( iMode == EPlayMode )
+        {
+        iLabels[ETextArtist]->StartMarquee();
+        iLabels[ETextTrack]->StartMarquee();
+        }
+    else
+        {
+        iLabels[ETextArtist]->StopMarquee();
+        iLabels[ETextTrack]->StopMarquee();
+        }
+    DrawDeferred();
+    }
+
+// ---------------------------------------------------------------------------
+// Set random mode.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::SetRandomMode( TBool aRandomMode )
+    {
+    iRandomMode = aRandomMode;
+    Window().Invalidate( iRandomIconRect );
+    }
+
+// ---------------------------------------------------------------------------
+// Set repeat mode.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::SetRepeatMode(
+    TBool aRepeatAll,
+    TBool aRepeatOne )
+    {
+    iRepeatAllMode = aRepeatAll;
+    iRepeatOneMode = aRepeatOne;
+    Window().Invalidate( iRepeatIconRect );
+    }
+
+// ---------------------------------------------------------------------------
+// Set RealPlayer mode.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::SetRealAudioMode(
+    TBool aRealAudioMode )
+    {
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    iRealAudioMode = aRealAudioMode;
+    Window().Invalidate( iRealIconRect );
+#else
+    (void) aRealAudioMode;
+    ASSERT( 0 );
+#endif
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewContainer::UpdateButtons
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateButtons(
+    TMPXPlaybackState aState )
+    {
+    if ( iEnableButtons )
+        {
+        iButtonManager->UpdateButtonStates( aState );
+        DrawDeferred();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateLayout()
+    {
+    MPX_FUNC( "CMPXCommonPlaybackViewContainer::UpdateLayout" );
+    TRAP_IGNORE( DoUpdateLayoutL() );
+    }
+
+// ---------------------------------------------------------------------------
+// Updates duration label.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateDurationLabelL(
+    TInt aTotalLengthInSeconds )
+    {
+    HBufC* labelText( NULL );
+    HBufC* duration( NULL );
+
+    if ( aTotalLengthInSeconds == 0 )
+        {
+        TLocale locale;
+        TChar separator = locale.TimeSeparator( KMPXMinSecSeparatorIndex );
+
+        duration = HBufC::NewLC( KMPXTimeIndicatorLength );
+        TPtr durationTPtr( duration->Des() );
+
+        durationTPtr = KMPXZeroDurationMark;
+        durationTPtr.Append( separator );
+        durationTPtr += KMPXZeroDurationMark;
+        }
+    else
+        {
+        // Convert track duration to text
+        duration = iCommonUiHelper->DisplayableDurationL(
+            aTotalLengthInSeconds );
+        CleanupStack::PushL( duration );
+        }
+
+    labelText = StringLoader::LoadLC(
+        R_MPX_PBV_TRACK_DURATION_FORMAT,
+        *duration );
+
+    CleanupStack::PopAndDestroy( labelText );
+    CleanupStack::PopAndDestroy( duration );
+    }
+
+// ---------------------------------------------------------------------------
+// Force softkey label colors to what is specified in skin
+// for Music Player soft keys.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateSoftkeyColors()
+    {
+    CEikButtonGroupContainer* cbgc = CEikButtonGroupContainer::Current();
+    MEikButtonGroup* bg = NULL;
+    if ( cbgc )
+        {
+        bg = cbgc->ButtonGroup();
+        }
+
+    if ( bg )
+        {
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+        TRgb color = KRgbBlack;
+        CCoeControl* lsk = cbgc->ControlOrNull(
+            bg->CommandId( KMPXCbaLeftSoftkeyPos ) );
+        if ( lsk )
+            {
+            // Color is not updated if it not found from the skin
+            if (!AknsUtils::GetCachedColor(
+                skin, color, KAknsIIDQsnTextColors,
+                EAknsCIQsnTextColorsCG47 ) )
+                {
+                TRAP_IGNORE(
+                    AknLayoutUtils::OverrideControlColorL( *lsk,
+                    EColorLabelText,
+                    color ) );
+                }
+            }
+
+        CCoeControl* rsk = cbgc->ControlOrNull(
+            bg->CommandId( KMPXCbaRightSoftkeyPos ) );
+        if ( rsk )
+            {
+            // Color is not updated if it not found from the skin
+            if ( !AknsUtils::GetCachedColor(
+                skin, color, KAknsIIDQsnTextColors,
+                EAknsCIQsnTextColorsCG46 ) )
+                {
+                TRAP_IGNORE(
+                    AknLayoutUtils::OverrideControlColorL( *rsk,
+                    EColorLabelText,
+                    color ) );
+                }
+            }
+        cbgc->DrawDeferred();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handles foreground events
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::HandleForegroundEventL(
+    TBool aForeground )
+    {
+    MPX_FUNC( "CMPXCommonPlaybackViewContainer::HandleForegroundEventL" );
+    if ( !aForeground && iEnableButtons )
+        {
+        // if losing foreground and buttons are enabled
+        iButtonManager->HandleForegroundLostL();
+        }
+
+    if ( !aForeground && iTouchDown )
+        {
+        // Pointer events
+        SetGloballyCapturing( EFalse );
+        SetPointerCapture( EFalse );
+
+        iTouchDown = EFalse;
+        }
+
+	// Special case: if going to background but still partially visible
+	if( iActiveView && !aForeground )
+		{
+		CAknAppUi* appUi = (CAknAppUi*)CEikonEnv::Static()->AppUi();
+		if( !appUi->IsFaded() )
+		    {
+		    iActiveView = EFalse;
+		    }
+		}
+	else
+		{
+		iActiveView = aForeground;
+		}
+
+    RefreshProgressBar();
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXAlbumArtUtilObserver
+// Notify that extraction of album art started.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::ExtractAlbumArtStarted()
+    {
+    MPX_DEBUG1("CMPXCommonPlaybackViewContainer::ExtractAlbumArtStarted(): Entering");
+
+    MPX_DEBUG1("CMPXCommonPlaybackViewContainer::ExtractAlbumArtStarted(): Exiting");
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MMPXAlbumArtUtilObserver
+// Album art is extracted from file and ready to use.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::ExtractAlbumArtCompleted(
+    CFbsBitmap* aBitmap,
+    TInt aErr )
+    {
+    // Here we are making the assumption that if we get an update on album
+    // art, it is Ok to Start displaying the items.
+    iLabels[ETextTrack]->MakeVisible( ETrue );
+    iLabels[ETextArtist]->MakeVisible( ETrue );
+    iLabels[ETextElapsedTime]->MakeVisible( ETrue);
+    iLabels[ETextRemainingTime]->MakeVisible( ETrue);
+    iPrerollCompleted = ETrue;
+
+    MPX_DEBUG3( "CMPXCommonPlaybackViewContainer::ExtractAlbumArtCompleted(bitmap:0x%x, err:%d)",
+        aBitmap, aErr );
+
+    delete iTrackAlbumArt;
+    iTrackAlbumArt = NULL;
+
+    if ( aBitmap && KErrNone == aErr )
+        {
+        iTrackAlbumArt = aBitmap;
+        }
+
+    DrawDeferred(); 
+    //Window().Invalidate( iAlbumArtRect );
+    //Window().Invalidate( iSliderPaneRect );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TKeyResponse CMPXCommonPlaybackViewContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG4( "CMPXCommonPlaybackViewContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+
+    TKeyResponse response = EKeyWasNotConsumed;
+
+    if ( iEnableButtons )
+        {
+        response = iButtonManager->OfferKeyEventL( aKeyEvent, aType );
+        if ( response == EKeyWasConsumed )
+            {
+            CWindowGc& gc = SystemGc();
+            gc.Activate( *DrawableWindow() );
+//            iButtonManager->RedrawIfNeeded(gc);
+            gc.Deactivate();
+            }
+        }
+
+    if ( response == EKeyWasNotConsumed )
+        {
+// TODO
+/*
+        if ( aKeyEvent.iCode == EKeyLeftArrow && !FeatureManager::FeatureSupported(
+                    KFeatureIdSideVolumeKeys ))
+            {
+            iCommandObserver->ProcessCommandL( EMPlayerCmdDecreaseVolume) ;
+            response = EKeyWasConsumed;
+            }
+        else if ( aKeyEvent.iCode == EKeyRightArrow && !FeatureManager::FeatureSupported(
+                    KFeatureIdSideVolumeKeys ))
+            {
+            iCommandObserver->ProcessCommandL( EMPlayerCmdIncreaseVolume );
+            response = EKeyWasConsumed;
+            }
+        else
+            {
+            // Do nothing
+            }
+*/
+        }
+
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType );
+
+    if ( aType == KAknsMessageSkinChange )
+        {
+		iRefreshBackBuffer = ETrue;
+        // Reload icons
+        TRAP_IGNORE(
+            {
+            CreateIconsL();
+            } );
+
+        // Make sure execute layout again
+        iCurrentLayout = TRect();
+        UpdateLayout(); // To make sure AknIconUtils::SetSize() gets called
+        }
+    else if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        iLayoutObserver->HandleLayoutChange();
+        UpdateBackgroundSkinControlContext( Rect() );
+
+        // recreate background image
+        TRAP_IGNORE( CreateBackgroundImagesL() );
+        }
+    else
+        {
+        // pass
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KAppUidMusicPlayerX;
+/*
+    if ( iIsEmbedded )
+        {
+        // TODO: Handle for embedded mode
+        aContext.iContext = KMUS_HLP_PLAYBACK_VIEW;
+        }
+    else
+        {
+        aContext.iContext = KMUS_HLP_PLAYBACK_VIEW;
+        }
+*/
+    }
+
+// ---------------------------------------------------------------------------
+// Starts marquee for a playback label
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::StartMarquee(
+    TMPXPbvTextIndicator aLabel )
+    {
+    MPX_FUNC( "CMPXCommonPlaybackViewContainer::StartMarquee" );
+    ASSERT( aLabel >= 0 && aLabel < iLabels.Count() );
+    CMPXPlaybackViewInfoLabel* label = iLabels[aLabel];
+    if ( label )
+        {
+        if ( label->IsVisible() )
+            {
+            label->StartMarquee();
+            label->DrawDeferred();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Creates background images
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::CreateBackgroundImagesL()
+    {
+
+    CWindowGc& gc( SystemGc() );
+    CGraphicsDevice* device( gc.Device() );
+    TSize size( device->SizeInPixels() );
+    TDisplayMode mode( device->DisplayMode() );
+
+    if( iOffScreenBitmap && 
+		size == iOffScreenBitmap->SizeInPixels() &&
+		mode == iOffScreenBitmap->DisplayMode() )
+    	{
+		// No need to update backbuffer
+    	return;
+    	}
+
+    delete iOffScreenBitmap;
+    iOffScreenBitmap = NULL;
+    delete iOSBitmapContext;
+    iOSBitmapContext = NULL;
+    delete iOSBitmapDevice;
+    iOSBitmapDevice = NULL;
+
+    iOffScreenBitmap = new (ELeave) CFbsBitmap();
+    TInt err( iOffScreenBitmap->Create( size, mode ));
+    if ( KErrNone != err )
+        {
+        delete iOffScreenBitmap;
+        iOffScreenBitmap = NULL;
+        User::Leave( err );
+        }
+
+    iOSBitmapDevice = CFbsBitmapDevice::NewL( iOffScreenBitmap );
+    err = iOSBitmapDevice->CreateContext( iOSBitmapContext );
+    if ( KErrNone != err )
+        {
+        delete iOSBitmapDevice;
+        iOSBitmapDevice = NULL;
+        User::Leave( err );
+        }
+    iRefreshBackBuffer = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// Creates labels.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::CreateLabelsL()
+    {
+    CMPXPlaybackViewInfoLabel* label = NULL;
+
+    for ( TInt index = 0; index < KLabelCount; ++index )
+        {
+        label = new ( ELeave ) CMPXPlaybackViewInfoLabel();
+        CleanupStack::PushL( label );
+        label->SetContainerWindowL( *this );
+        label->SetTextL( KNullDesC );
+        label->ConstructL(
+            iEnableMarquee && ( index == ETextTrack ) );
+
+        label->SetBackground( iBackground );
+        User::LeaveIfError( iLabels.Append( label ) );
+        CleanupStack::Pop( label );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Creates icons.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::CreateIconsL()
+    {
+    FreeIcons();
+
+    // Play/stop/pause icons
+    iPlayIcon =
+        iLayout->GetIndicatorIconMaskL( EIconPlay );
+    iPauseIcon =
+        iLayout->GetIndicatorIconMaskL(EIconPause );
+
+    // Repeat, random, etc
+    iRepeatAllIcon =
+        iLayout->GetIndicatorIconMaskL( EIconRepeatAll );
+    iRepeatOneIcon =
+        iLayout->GetIndicatorIconMaskL( EIconRepeatOne );
+    iRandomIcon =
+        iLayout->GetIndicatorIconMaskL( EIconRandom );
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    iRealIcon =
+        iLayout->GetIndicatorIconMaskL( EIconReal );
+#endif
+
+    // Download slider
+    iDownloadSlider = iLayout->GetIndicatorIconMaskL(
+        EDownloadSlider );
+    iPlaybackSlider = iLayout->GetIndicatorIconMaskL(
+        EPlaybackSlider );
+    iSliderBackground = iLayout->GetIndicatorIconMaskL(
+        ESliderBackground );
+
+    // Default album art
+    iDefaultAlbumArt = iLayout->GetIndicatorIconMaskL(
+        EAlbumArtArea );
+    }
+
+// ---------------------------------------------------------------------------
+// Deletes all icon objects.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::FreeIcons()
+    {
+    delete iPauseIcon;
+    iPauseIcon = NULL;
+    delete iPlayIcon;
+    iPlayIcon = NULL;
+    delete iRandomIcon;
+    iRandomIcon = NULL;
+    delete iRepeatOneIcon;
+    iRepeatOneIcon = NULL;
+    delete iRepeatAllIcon;
+    iRepeatAllIcon = NULL;
+    delete iDownloadSlider;
+    iDownloadSlider = NULL;
+    delete iPlaybackSlider;
+    iPlaybackSlider = NULL;
+    delete iSliderBackground;
+    iSliderBackground = NULL;
+    delete iDefaultAlbumArt;
+    iDefaultAlbumArt = NULL;
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    delete iRealIcon;
+    iRealIcon = NULL;
+#endif
+    }
+
+// ---------------------------------------------------------------------------
+// Draw an icon
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::DrawIndicator(
+    CBitmapContext& aGc,
+    const TRect& aDirtyRect,
+    const TRect& aIndicatorRect,
+    const CGulIcon* aIcon,
+    TBool aInvertMask ) const
+    {
+    if ( aIcon && aIndicatorRect.Intersects( aDirtyRect ) )
+        {
+        aGc.BitBltMasked(
+            aIndicatorRect.iTl,
+            aIcon->Bitmap(),
+            TRect( aIndicatorRect.Size() ),
+            aIcon->Mask(),
+            aInvertMask );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Redraw part of the screen.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::RedrawRect(
+    const TRect& aRect,
+    CBitmapContext& aGc) const
+    {
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    AknsDrawUtils::DrawBackground(
+        skin,
+        iBackground,
+        this,
+        aGc,
+        aRect.iTl,
+        aRect,
+        KAknsDrawParamDefault );
+
+
+    TBool embedded = iEikonEnv->StartedAsServerApp();
+
+    if ( iPrerollCompleted )
+        {
+        if ( iRepeatAllMode && !embedded )
+            {
+            DrawIndicator( aGc, aRect, iRepeatIconRect, iRepeatAllIcon );
+            }
+
+        if ( iRepeatOneMode && !embedded )
+            {
+            DrawIndicator(aGc, aRect, iRepeatIconRect, iRepeatOneIcon);
+            }
+
+        if ( iRandomMode && !embedded )
+            {
+            DrawIndicator(aGc, aRect, iRandomIconRect, iRandomIcon);
+            }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+        if ( iRealAudioMode )
+            {
+            DrawIndicator( aGc, aRect, iRealIconRect, iRealIcon );
+            }
+#endif
+
+        DrawIndicator( aGc, aRect, iSliderBackgroundRect, iSliderBackground );
+        if ( iMode == EPlayMode || iMode == EPauseMode )
+            {
+
+            DrawIndicator( aGc, aRect, TRect(iDownloadSliderRect.iTl,
+                    iDownloadSlider->Bitmap()->SizeInPixels()),
+                    iDownloadSlider );
+            DrawIndicator(aGc, aRect, TRect(iPlaybackSliderRect.iTl,
+                    iPlaybackSlider->Bitmap()->SizeInPixels() ),
+                    iPlaybackSlider );
+            }
+
+        if ( iDisplayAlbumArt && aRect.Intersects( iAlbumArtRect ) )
+            {
+            if ( iTrackAlbumArt )
+                {
+                // Calculating the CenterPoint for Drawing the albumart image 
+                TSize bmpSizeInPixels = iTrackAlbumArt->SizeInPixels();
+                TInt xPos = ( iAlbumArtRect.Width() - bmpSizeInPixels.iWidth )
+                        / 2;
+                TInt yPos =
+                        ( iAlbumArtRect.Height() - bmpSizeInPixels.iHeight )
+                                / 2;
+                TPoint Centerpos = TPoint(xPos, yPos );
+                // bitmap top left corner position
+                Centerpos += iAlbumArtRect.iTl;
+
+                // Draw album art and frame
+                aGc.BitBlt( Centerpos, iTrackAlbumArt);
+                TRgb color = KRgbBlack;
+                AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors,
+                        EAknsCIQsnTextColorsCG50 );
+                TRect imageRect( Centerpos, iTrackAlbumArt->SizeInPixels() );
+                aGc.SetPenStyle( CGraphicsContext::ESolidPen );
+                aGc.SetBrushStyle( CGraphicsContext::ENullBrush );
+                aGc.SetPenColor( color );
+                aGc.DrawRect( imageRect );
+                }
+            else
+                {
+                DrawIndicator( aGc, aRect, iAlbumArtRect, iDefaultAlbumArt );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Update progress bar graphics based on current playback
+// and download position.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateProgressBarGraphics()
+    {
+    TSize downloadBarSize = iDownloadSliderRect.Size();
+    TSize playbackBarSize = iPlaybackSliderRect.Size();
+
+    downloadBarSize.iWidth *= iDownloadRatio;
+    playbackBarSize.iWidth *= iPlaybackRatio;
+
+    AknIconUtils::SetSize(
+        iDownloadSlider->Bitmap(),
+        downloadBarSize,
+        EAspectRatioNotPreserved );
+    AknIconUtils::SetSize(
+        iPlaybackSlider->Bitmap(),
+        playbackBarSize,
+        EAspectRatioNotPreserved );
+    }
+
+// ---------------------------------------------------------------------------
+// Update progress bar graphics and redraw.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::RefreshProgressBar()
+    {
+    UpdateProgressBarGraphics();
+    Window().Invalidate( iSliderPaneRect );
+    }
+
+// ---------------------------------------------------------------------------
+// Update label text color according to skin
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateLabelColorsL()
+    {
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TRgb color = KRgbBlack;
+    // Color is not updated if it not found from the skin
+    AknsUtils::GetCachedColor(
+        skin,
+        color,
+        KAknsIIDQsnTextColors,
+        EAknsCIQsnTextColorsCG50 );
+
+    for ( TInt i = 0; i < iLabels.Count(); i++ )
+        {
+        AknLayoutUtils::OverrideControlColorL(
+            *iLabels[i],
+            EColorLabelText,
+            color );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Update skin control context for background
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::UpdateBackgroundSkinControlContext(
+    const TRect& aRect )
+    {
+    CAknsBasicBackgroundControlContext* background =
+        static_cast<CAknsBasicBackgroundControlContext*>( iBackground );
+
+    if ( Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        TAknWindowLineLayout screenLayout =
+            AknLayout::screen();
+        TRect screenRect = screenLayout.Rect();
+        background->SetBitmap( KAknsIIDQsnBgAreaMainMp );
+        background->SetRect( screenRect );
+        }
+    else
+        {
+        background->SetBitmap( KAknsIIDQsnBgAreaMainMp );
+        background->SetRect( aRect );
+        }
+    iRefreshBackBuffer = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// Set FMTX mode.
+// FMTX label shouldn't appear in some playback views
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::SetFMTXMode(
+    TBool aFMTXMode )
+    {
+	if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+		{
+	    iFMTXMode = aFMTXMode;
+		}
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Responds to changes to the size and position of the contents of this
+// control.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::SizeChanged()
+    {
+    MPX_FUNC("CMPXCommonPlaybackViewContainer::SizeChanged()");
+    UpdateLayout();
+    UpdateSoftkeyColors();
+    UpdateBackgroundSkinControlContext( Rect() );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the number of controls contained in a compound control.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXCommonPlaybackViewContainer::CountComponentControls() const
+    {
+    if(iPrerollCompleted)
+        {
+        return KLabelCount + 1; // ButtonManager
+        }
+    else
+        {
+        return 0;
+        }
+   } 
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets an indexed component of a compound control.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CCoeControl* CMPXCommonPlaybackViewContainer::ComponentControl( TInt aIndex ) const
+    {
+    CCoeControl* control = NULL;
+    if(iPrerollCompleted)
+        {
+        if (aIndex < KLabelCount)
+            {
+            control = iLabels[aIndex];
+            }
+        else
+            {
+            control = iButtonManager;
+            }
+        }
+
+    return control;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Draws the control.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::Draw( const TRect& aRect ) const
+    {
+    if( iActiveView || iRefreshBackBuffer )
+        {
+        if ( iOSBitmapContext )
+            {
+            RedrawRect( aRect, *iOSBitmapContext );
+            iRefreshBackBuffer = EFalse;
+            }
+        }
+
+    // Draw off-screen bitmap to display
+    if ( iOffScreenBitmap )
+        {
+        CWindowGc& gc = SystemGc();
+		gc.BitBlt( TPoint(),iOffScreenBitmap );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewContainer::HandleButtonCommandL
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::HandleButtonCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2("CMPXCommonPlaybackViewContainer::HandleButtonCommandL(%d) entering", aCommand);
+    if ( iCommandObserver )
+        {
+        iCommandObserver->ProcessCommandL( aCommand );
+        }
+    MPX_DEBUG1("CMPXCommonPlaybackViewContainer::HandleButtonCommandL() exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXCommonPlaybackViewContainer::HandlePointerEventL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
+    {
+    MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::HandlePointerEventL" );
+    if(AknLayoutUtils::PenEnabled())
+        {
+        TSize playbackBarSize = iPlaybackSliderRect.Size();
+        TReal width;
+        switch( aPointerEvent.iType )
+            {
+            case TPointerEvent::EButton1Down:
+                {
+                if ( iSliderPaneRect.Contains(aPointerEvent.iPosition) && 
+                        ( iMode == EPlayMode || iMode == EPauseMode ))
+                    {
+                    // Pointer events
+                    SetGloballyCapturing( ETrue );
+                    SetPointerCapture( ETrue );
+
+                    MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::HandlePointerEventL btnDOWN" );
+                    iTouchDown = ETrue;
+                    width = aPointerEvent.iPosition.iX - iSliderBackgroundRect.iTl.iX;
+                    playbackBarSize.iWidth = width;
+                    AknIconUtils::SetSize(
+                        iPlaybackSlider->Bitmap(),
+                        playbackBarSize,
+                        EAspectRatioNotPreserved );
+                    }
+                if ( iAlbumArtRect.Contains(aPointerEvent.iPosition ) )
+                    {                    
+                    MTouchFeedback* feedback = MTouchFeedback::Instance();
+                    if (feedback)
+                        {
+                        feedback->InstantFeedback(ETouchFeedbackBasic);
+                        }                
+                 
+                    if ( iCommandObserver )
+        								{
+                        iCommandObserver->ProcessCommandL( EMPXCmdVolumeChanged );
+                        }
+                    }
+                break;
+                }
+
+            case TPointerEvent::EDrag:
+                {
+                if(iTouchDown && ( iMode == EPlayMode || iMode == EPauseMode ) )
+                    {
+                    MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::HandlePointerEventL ****btnDrag****" );
+
+                    MTouchFeedback* feedback = MTouchFeedback::Instance();
+                    if (feedback)
+                        {
+                        feedback->InstantFeedback(ETouchFeedbackSensitive);
+                        }
+
+                    if (aPointerEvent.iPosition.iX <= iSliderBackgroundRect.iTl.iX)
+                        {
+                        width = 0;
+                        }
+                    else if (aPointerEvent.iPosition.iX >= iSliderBackgroundRect.iBr.iX)
+                        {
+                        width = iSliderBackgroundRect.iBr.iX - iSliderBackgroundRect.iTl.iX;
+                        }
+                    else
+                        {
+                        width = aPointerEvent.iPosition.iX - iSliderBackgroundRect.iTl.iX;
+                        }
+
+                    playbackBarSize.iWidth = width;
+                    AknIconUtils::SetSize(
+                        iPlaybackSlider->Bitmap(),
+                        playbackBarSize,
+                        EAspectRatioNotPreserved );
+
+                    // Update the ellapsed and remaining time texts for user feedback
+                    TReal totalWidth = iPlaybackSliderRect.Width();
+                    TReal ratio = width/totalWidth;
+                    TInt newSongPositionInSec = ratio * iTrackTotalLengthInSeconds;
+                                CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode =
+                    CMPXCommonUiHelper::EMPXDuratAuto;
+                    if ( iTrackTotalLengthInSeconds > KOneHourInSeconds )
+                        {
+                        durationMode = CMPXCommonUiHelper::EMPXDuratHMS;
+                        }
+
+                    // Convert ellapsed time to text
+                    HBufC* position = iCommonUiHelper->DisplayableDurationL(
+                        newSongPositionInSec,
+                        durationMode );
+                    CleanupStack::PushL( position );
+
+                    TInt remainingTime = iTrackTotalLengthInSeconds - newSongPositionInSec;
+                    if ( remainingTime < 0 )
+                        {
+                        remainingTime = 0;
+                        }
+
+                    // Convert remaining time to text
+                    HBufC* remaining = iCommonUiHelper->DisplayableDurationL(
+                        remainingTime,
+                        durationMode );
+                    CleanupStack::PushL( remaining );
+
+                    UpdateLabelL( ETextElapsedTime, *position );
+                    UpdateLabelL( ETextRemainingTime, *remaining );
+                    CleanupStack::PopAndDestroy( remaining );
+                    CleanupStack::PopAndDestroy( position );
+
+                    // Invalidate rect so it will be redrawn immediately
+                    Window().Invalidate( iSliderPaneRect );
+                    }
+                else
+                    {
+                    SetGloballyCapturing( EFalse );
+                    SetPointerCapture( EFalse );
+                    iTouchDown = EFalse;
+                    }
+                break;
+                }
+
+            case TPointerEvent::EButton1Up:
+                {
+                MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::HandlePointerEventL btnUP" );
+                if(iTouchDown)
+                    {
+                    // Pointer events
+                    SetGloballyCapturing( EFalse );
+                    SetPointerCapture( EFalse );
+                    if ( ( iMode == EPlayMode || iMode == EPauseMode ) )
+                        {
+                        iTouchDown = EFalse;
+                        if ( aPointerEvent.iPosition.iX
+                                <= iSliderBackgroundRect.iTl.iX )
+                            {
+                            width = 0;
+                            }
+                        else if ( aPointerEvent.iPosition.iX
+                                >= iSliderBackgroundRect.iBr.iX )
+                            {
+                            width = iSliderBackgroundRect.iBr.iX
+                                    - iSliderBackgroundRect.iTl.iX;
+                            }
+                        else
+                            {
+                            width = aPointerEvent.iPosition.iX
+                                    - iSliderBackgroundRect.iTl.iX;
+                            }
+                        playbackBarSize.iWidth = width;
+                        AknIconUtils::SetSize( iPlaybackSlider->Bitmap(),
+                                playbackBarSize, EAspectRatioNotPreserved );
+
+                        // Set new song position based upon progress bar location
+                        TReal totalWidth = iPlaybackSliderRect.Width();
+                        TReal ratio = width / totalWidth;
+                        iNewSongPosition = (ratio
+                                * iTrackTotalLengthInSeconds) * 1000;
+
+                        // Invalidate rect so it will be redrawn immediately
+					    Window().Invalidate( iSliderPaneRect );
+					    iSeekTimer->Cancel();
+					    iSeekTimer->Start( KSeekDelay, KSeekDelay, TCallBack( CallSetPosition, this ) );
+					    iDragProgressBar = ETrue;
+                        }
+                    }
+                break;
+                }
+
+            default:
+                {
+                MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::HandlePointerEventL default" );
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXCommonPlaybackViewContainer::GetNewSongPosition
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXCommonPlaybackViewContainer::GetNewSongPosition()
+    {
+    return iNewSongPosition;
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXCommonPlaybackViewContainer::SetNewSongPosition
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonPlaybackViewContainer::SetNewSongPosition( const TInt64& aPositon )
+    {
+    iNewSongPosition = aPositon;
+    }
+
+// ---------------------------------------------------------------------------
+// Helper function to set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonPlaybackViewContainer::DoUpdateLayoutL()
+    {
+    TRect myRect = Rect();
+    if ( myRect == iCurrentLayout )
+        {
+        // Layout has not changed, do nothing
+        return;
+        }
+
+    CreateBackgroundImagesL();
+
+    MPX_DEBUG5( "CMPXCommonPlaybackViewContainer::DoUpdateLayoutL() -- new layout: top-left (%d, %d) size (%d, %d)",
+        myRect.iTl.iX, myRect.iTl.iY, myRect.Size().iWidth, myRect.Size().iHeight );
+
+    // Get layout data
+    iSliderPaneRect = iLayout->IndicatorLayout(
+        myRect, ESliderPane );
+    iLayout->LayoutLabel(
+        iLabels[ETextElapsedTime], iSliderPaneRect, ETextElapsedTime );
+    iLayout->LayoutLabel(
+        iLabels[ETextRemainingTime], iSliderPaneRect, ETextRemainingTime );
+    iLayout->LayoutLabel(
+        iLabels[ETextArtist], myRect, ETextArtist );
+    iLayout->LayoutLabel(
+        iLabels[ETextTrack], myRect, ETextTrack );
+    iLayout->LayoutLabel(
+        iLabels[ETextPlaylistCount], myRect, ETextPlaylistCount );
+    //iLayout->LayoutLabel(
+    //    iLabels[ETextEmpty], myRect, ETextEmpty );
+    iLayout->LayoutLabel(
+        iLabels[ETextDownloadState], iSliderPaneRect, ETextDownloadState );
+
+   	if ( iFMTXMode )
+       	{
+       	iLayout->LayoutLabel(
+           	iLabels[ETextFMFrequency], myRect, ETextFMFrequency );
+       	}
+
+    // Check if the artist and title rects intersect, if so move them
+    TRect titleRect = iLabels[ETextTrack]->Rect();
+    TRect artistRect = iLabels[ETextArtist]->Rect();
+    if ( titleRect.Intersects( artistRect ))
+        {
+        TRect intersection = titleRect;
+        intersection.Intersection( artistRect );
+        TInt diff = -(intersection.Height());
+        iLayout->LayoutLabel(
+            iLabels[ETextTrack], myRect, ETextTrack, 0, diff );
+        }
+
+    iIconLayout = iLayout->IndicatorLayout( myRect, EIconPlay );
+    iRandomIconRect = iLayout->IndicatorLayout( myRect, EIconRandom );
+    iRepeatIconRect = iLayout->IndicatorLayout( myRect, EIconRepeatAll );
+    iBackgroundLayout = myRect;
+
+    iDownloadSliderRect = iLayout->IndicatorLayout(
+        iSliderPaneRect, EDownloadSlider );
+    iPlaybackSliderRect = iLayout->IndicatorLayout(
+        iSliderPaneRect, EPlaybackSlider );
+    iSliderBackgroundRect = iLayout->IndicatorLayout(
+        iSliderPaneRect, ESliderBackground );
+
+    iAlbumArtRect = iLayout->IndicatorLayout(
+        myRect, EAlbumArtArea );
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    iRealIconRect = iLayout->IndicatorLayout( myRect, EIconReal );
+#endif
+
+    // Scale icons
+    if ( iPauseIcon )
+        {
+        AknIconUtils::SetSize(
+            iPauseIcon->Bitmap(), iIconLayout.Size() );
+        }
+    if ( iPlayIcon )
+        {
+        AknIconUtils::SetSize(
+            iPlayIcon->Bitmap(), iIconLayout.Size() );
+        }
+    if ( iRandomIcon )
+        {
+        AknIconUtils::SetSize(
+            iRandomIcon->Bitmap(), iRandomIconRect.Size() );
+        }
+    if ( iRepeatAllIcon )
+        {
+        AknIconUtils::SetSize(
+            iRepeatAllIcon->Bitmap(), iRepeatIconRect.Size() );
+        }
+    if ( iRepeatOneIcon )
+        {
+        AknIconUtils::SetSize(
+            iRepeatOneIcon->Bitmap(), iRepeatIconRect.Size() );
+        }
+
+    if ( iSliderBackground )
+        {
+        AknIconUtils::SetSize(
+            iSliderBackground->Bitmap(),
+            iSliderBackgroundRect.Size(),
+            EAspectRatioNotPreserved );
+        UpdateProgressBarGraphics();
+        if ( iMode == EPlayMode || iMode == EPauseMode )
+           {
+            MTouchFeedback* feedback = MTouchFeedback::Instance();
+            if ( feedback )
+                {
+                feedback->SetFeedbackArea( this, 0, iSliderPaneRect,
+                    ETouchFeedbackBasic, ETouchEventStylusDown);
+                }
+           }
+        }
+
+    if ( iDefaultAlbumArt )
+        {
+        AknIconUtils::SetSize(
+            iDefaultAlbumArt->Bitmap(), iAlbumArtRect.Size() );
+        }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    if (iRealIcon)
+        {
+        AknIconUtils::SetSize(
+             iRealIcon->Bitmap(), iRealIconRect.Size() );
+        }
+#endif
+
+    iCurrentLayout = myRect;
+
+    if ( iEnableButtons )
+        {
+        if (iButtonManager)
+            {
+            iButtonManager->SetParentRect( myRect );
+            iButtonManager->SetRect(myRect);
+            }
+        }
+
+    // Update label colors according to skin (ignore the color in layout data)
+    UpdateLabelColorsL();
+
+    // update artist/title labels to use the full length of control
+    // other controls should not have been clipped in the first place
+    if ( iLabels[ ETextTrack ]->FullText().Length() > 0 )
+        {
+        HBufC* title = iLabels[ ETextTrack ]->FullText().AllocLC();
+        iLabels[ ETextTrack ]->SetLabelTextL( *title );
+        CleanupStack::PopAndDestroy( title );
+        }
+    if ( iLabels[ ETextArtist ]->FullText().Length() > 0 )
+        {
+        HBufC* title = iLabels[ ETextArtist ]->FullText().AllocLC();
+        iLabels[ ETextArtist ]->SetLabelTextL( *title );
+        CleanupStack::PopAndDestroy( title );
+        }
+
+    MPX_DEBUG1( "CMPXCommonPlaybackViewContainer::DoUpdateLayoutL() exiting" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewContainer::ReStoreButtons
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonPlaybackViewContainer::RestoreButtons( 
+    TMPXPlaybackState aState )
+    {
+    if ( iEnableButtons )
+        {
+        iButtonManager->RestoreButtonStates( aState );
+        DrawDeferred();
+        }
+    }
+
+TInt CMPXCommonPlaybackViewContainer::CallSetPosition()
+	{
+	TRAP_IGNORE( HandleButtonCommandL( EMPXPbvCmdPosition ) );
+	iSeekTimer->Cancel();
+	return 0;
+	}
+
+TInt CMPXCommonPlaybackViewContainer::CallSetPosition( TAny* aAny )
+	{
+	return ((CMPXCommonPlaybackViewContainer*)aAny)->CallSetPosition();
+	}
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewContainer::AdjustOrdinalPosition
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonPlaybackViewContainer::AdjustOrdinalPosition( TInt aNewOrdinalPosition )
+    {
+    return Window().SetOrdinalPosition( aNewOrdinalPosition );
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3990 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Common Playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <eikmenub.h>
+#include <featmgr.h>
+#include <StringLoader.h>
+#include <eikapp.h>
+#include <AknUtils.h>
+#include <akntitle.h>
+#include <aknnotewrappers.h>
+#include <aknnavi.h>
+#include <hlplch.h>
+#include <bautils.h>
+#include <centralrepository.h>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <bldvariant.hrh>
+#include <caf/caferr.h>
+#include <aknsoundsystem.h>
+#include <AknDlgShut.h>
+#include <ctsydomainpskeys.h>
+#include <aknclearer.h>
+
+
+#include <e32const.h>
+#ifdef UPNP_INCLUDED
+#include <upnpcopycommand.h> 
+#endif
+
+#include <apgcli.h> // For FF_FMTX
+#include <AknWaitDialog.h>
+
+#include <aknSDData.h>
+#include <AknMediatorFacade.h>
+#include "mplayersecondarydisplayapi.h"
+
+#include <data_caging_path_literals.hrh>
+#include <layoutmetadata.cdl.h>
+#include <mpxcommonplaybackview.rsg>
+
+
+#include <mpxfmtx.rsg>
+#include <mpxcommonui.rsg>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessagedefs.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionmessage.h>
+#include <mpxviewutility.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxviewplugin.h>
+#include <mpxviewpluginmanager.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpxsubscription.h>
+#include <mpxuser.h>
+#include <mpxpskeywatcher.h>
+#include <mpxcenrepwatcher.h>
+#include <hwrmfmtx.h> // TFmTxState
+#include <AiwServiceHandler.h>
+#include <mediarecognizer.h>
+#ifdef BACKSTEPPING_INCLUDED
+#include <mpxbacksteppingutility.h>
+#endif // BACKSTEPPING_INCLUDED
+#include <UsbWatcherInternalPSKeys.h>
+#include <usbpersonalityids.h>
+
+#include "mpxconstants.h"
+#include <mpxappui.hrh>
+#include "mpxcommonplaybackview.hrh"
+#include "mpxcommonplaybackviewimp.h"
+#include "mpxcommonplaybackviewcontainer.h"
+#include "mpxcommonplaybackviewlayout.h"
+#include "mpxalbumartutil.h"
+#include "mpxcommonuihelper.h"
+#include <mpxinternalcrkeys.h>
+#include <mpxtlshelper.h>
+#include "mpxlog.h"
+
+#include <akntoolbar.h>
+#include <aknbutton.h>
+#include "mpxviewprivatepskeys.h"
+
+// CONSTANTS
+const TInt KMPXOneSecInMilliSecs( 1000 );
+const TUid KMPXEqualizerViewImplementationId = { 0x101FFC77 };
+const TInt KMPXPostponeForHandleDelayedError( 1000000 ); // 1S
+const TInt KMPXPlaybackViewWindowBackground = -1;
+
+// for freqency display in the format of "XXX.XX"
+const TInt KMPXFMFreqWidth        = 6;
+const TInt KMPXFMFreqDecimalPlace = 2;
+const TInt KMPXOneMhzInOneKhz     = 1000;
+const TUid KFmTxAppUid            = { 0x10282BEF };
+
+#ifdef BACKSTEPPING_INCLUDED
+const TInt KMaxIntLen( 10 );
+_LIT8( KMVPrefix, "MVviewID:" );
+const TInt KMVPrefixLen( 9 );
+#endif // BACKSTEPPING_INCLUDED
+
+// ---------------------------------------------------------------------------
+// NOTE: All the FM Tx related values below originated from the files:
+//       - HWRMFmTx.h
+//       - HWRMFmTxDomainCRKeys.h
+//       - HWRMFmTxDomainPSKeys.h
+//
+//       These values should be kept in sync with the original copies.  The
+//       intention of keeping a copy here is to de-couple the MPX Music Player
+//       from the Hardware Resource Manager who is the owner of the keys, as
+//       FM Tx is not yet available for the platform.  Eventually, this should
+//       be removed as FM Tx becomes part of the platform.
+// ---------------------------------------------------------------------------
+//
+const TUid KCRUidFmTxCenRes = { 0x20008EA6 }; // FM TX Repository ID
+const TUid KPSUidHWRMFmTx   = { 0x101F7A02 }; // FM TX category ID
+
+// FM Tx frequency (kHz) key ID of the FM TX CenRep
+const TUint32 KFmTxCenResKeyFrequency = 0x00000001;
+
+// FM Transmitter status key ID of the FM TX property.
+// Note: This data is interpreted as TFmTxState below
+const TUint32 KHWRMFmTxStatus  = 0x00000001;
+
+_LIT( KMPXCommonPlaybackRscPath, "mpxcommonplaybackview.rsc" );
+
+_LIT( KMPXFMTXRscPath, "mpxfmtx.rsc" );
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+_LIT(KMPXPnRealAudioMimeType, "audio/x-pn-realaudio");
+_LIT(KMPXRealAudioMimeType, "audio/x-realaudio");
+_LIT(KMPXRnRealAudioMimeType, "audio/vnd.rn-realaudio");
+#endif
+
+
+// ======== MEMBER FUNCTIONS ========
+
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::ConstructL()
+    {
+    MPX_FUNC( "CMPXCommonPlaybackViewImp::ConstructL" );
+
+    CCoeEnv* coeEnv = iEikonEnv;
+    TParse parse;
+    parse.Set( KMPXCommonPlaybackRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+	if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+		{
+    	parse.Set( KMPXFMTXRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    	TFileName fmtxResourceFile( parse.FullName() );
+    	User::LeaveIfError( MPXUser::CompleteWithDllPath( fmtxResourceFile ) );
+    	BaflUtils::NearestLanguageFile( coeEnv->FsSession(), fmtxResourceFile );
+    	iFMTXResourceOffset = coeEnv->AddResourceFileL( fmtxResourceFile );
+		}
+
+    // Monitor for view activation
+    AppUi()->AddViewActivationObserverL( this );
+
+    // Get the playback utility instance from engine.
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+    iPlaybackUtility->AddObserverL( *this );
+
+    iMPXUtility = CMPXAlbumArtUtil::NewL();
+
+    iEmbedded = iEikonEnv->StartedAsServerApp();
+
+    // Get an instance of view utility
+    iViewUtility = MMPXViewUtility::UtilityL();
+    iViewUtility->AddObserverL( this );
+
+    TInt flags( 0 );
+    CRepository* repository( CRepository::NewL( KCRUidMPXMPFeatures ));
+    User::LeaveIfError( repository->Get( KMPXMPLocalVariation, flags ));
+    delete repository;
+    repository = NULL;
+
+    iChangeRTForAllProfiles =
+        static_cast<TBool>( flags & KMPXChangeRTForAll );
+
+    // Pre-load Equalizer & Audio Effects views
+    iViewUtility->PreLoadViewL(
+        TUid::Uid( KMPXPluginTypeEqualizerUid ) );
+    iViewUtility->PreLoadViewL(
+        TUid::Uid( KMPXPluginTypeAudioEffectsUid ) );
+
+    iLayout = new (ELeave) CMPXCommonPlaybackViewLayout();
+
+    iCollectionUtility = MMPXCollectionUtility::NewL( this );
+
+#ifdef __USE_MESSAGE_SUBSCRIPTION
+    // Subscribe to only a few messages from collection utility
+    CMPXSubscription* subscription( CMPXSubscription::NewL() );
+    CleanupStack::PushL( subscription );
+    CMPXSubscriptionItem* subItem1( CMPXSubscriptionItem::NewL() );
+    CleanupStack::PushL( subItem1 );
+    subItem1->SetTObjectValueL( KMPXMessageGeneralId, KMPXMessageGeneral );
+    subItem1->SetTObjectValueL( KMPXMessageGeneralEvent, TMPXCollectionMessage::EBroadcastEvent );
+    subItem1->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgDiskRemoved );
+    subscription->AddItemL( *subItem1 );
+    CMPXSubscriptionItem* subItem2( CMPXSubscriptionItem::CopyL( *subItem1 ));
+    CleanupStack::PushL( subItem2 );
+    subItem2->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgUSBMassStorageStart );
+    subscription->AddItemL( *subItem2 );
+    CMPXSubscriptionItem* subItem3( CMPXSubscriptionItem::CopyL( *subItem1 ));
+    CleanupStack::PushL( subItem3 );
+    subItem3->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgUSBMTPStart );
+    subscription->AddItemL( *subItem3 );
+    CMPXSubscriptionItem* subItem4( CMPXSubscriptionItem::CopyL( *subItem1 ));
+    CleanupStack::PushL( subItem4 );
+    subItem4->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgFormatStart );
+    subscription->AddItemL( *subItem4 );
+    CMPXSubscriptionItem* subItem5( CMPXSubscriptionItem::CopyL( *subItem1 ));
+    CleanupStack::PushL( subItem5 );
+    subItem5->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgUSBMassStorageEnd );
+    subscription->AddItemL( *subItem5 );
+    CMPXSubscriptionItem* subItem6( CMPXSubscriptionItem::CopyL( *subItem1 ));
+    CleanupStack::PushL( subItem6 );
+    subItem6->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgUSBMTPEnd );
+    subscription->AddItemL( *subItem6 );
+    CMPXSubscriptionItem* subItem7( CMPXSubscriptionItem::CopyL( *subItem1 ));
+    CleanupStack::PushL( subItem7 );
+    subItem7->SetTObjectValueL( KMPXMessageGeneralType, EMcMsgFormatEnd );
+    subscription->AddItemL( *subItem7 );
+    CMPXSubscriptionItem* subItem8( CMPXSubscriptionItem::NewL() );
+    CleanupStack::PushL( subItem8 );
+    subItem8->SetTObjectValueL( KMPXMessageGeneralId, KMPXMessageGeneral );
+    subItem8->SetTObjectValueL( KMPXMessageGeneralEvent, TMPXCollectionMessage::EPathChanged );
+    subItem8->SetTObjectValueL( KMPXMessageGeneralType, EMcPathChangedByOpen );
+    subItem8->SetTObjectValueL( KMPXMessageGeneralData, EMcItemOpened );
+    subscription->AddItemL( *subItem8 );
+    iCollectionUtility->Collection().AddSubscriptionL( *subscription );
+    CleanupStack::PopAndDestroy( subItem8 );
+    CleanupStack::PopAndDestroy( subItem7 );
+    CleanupStack::PopAndDestroy( subItem6 );
+    CleanupStack::PopAndDestroy( subItem5 );
+    CleanupStack::PopAndDestroy( subItem4 );
+    CleanupStack::PopAndDestroy( subItem3 );
+    CleanupStack::PopAndDestroy( subItem2 );
+    CleanupStack::PopAndDestroy( subItem1 );
+    CleanupStack::PopAndDestroy( subscription );
+#endif
+
+    iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+    iCommonUiHelper = CMPXCommonUiHelper::NewL( iCollectionUtility );
+
+    // initialize FeatureManager
+    FeatureManager::InitializeLibL();
+
+    if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+        {
+        // Since support of FM Tx remains the same within the lifetime of this
+        // view, it is safe to determine whether to create the associated
+        // PS & CR watcher here.
+
+        // create the PS Key watcher to receive notification when FM
+        // transmission status changes
+        iPSKeyWatcher =
+            CMPXPSKeyWatcher::NewL( KPSUidHWRMFmTx, KHWRMFmTxStatus, this );
+
+        // create the Central Repository watcher to receive notification when
+        // the value of the FM Frequency CR key is changed.
+        iCRWatcher = CMPXCenRepWatcher::NewL(
+            KCRUidFmTxCenRes,
+            KFmTxCenResKeyFrequency,
+            this );
+        }
+
+    iStartPlaybackIndex = KErrNotFound;
+    iLastSkipDirection = 1;
+    iSkipBtnPressed = EFalse;
+
+    // Set to EFalse to avoid handling
+    // errors if the view has not been activated
+    // before.
+    iLastPBViewActivated = EFalse;
+
+    iDatabaseNotReady = EFalse;
+    iIgnoredByUsbEvent = EFalse;
+#ifdef _DEBUG
+    iExitOptionHidden = EFalse;
+#else // _DEBUG
+    iExitOptionHidden = iCommonUiHelper->ExitOptionHiddenL() && !iEmbedded;
+#endif // _DEBUG
+
+    // Support for Camese Super Distribution
+#ifdef __CAMESE_SUPERDISTRIBUTION_SUPPORT
+    iCameseSuperDistSupport = ETrue;
+#endif
+    iMediaRecognizer = CMediaRecognizer::NewL();
+    if ( iServiceHandler == NULL)
+        {
+        iServiceHandler = CAiwServiceHandler::NewL();
+        MPX_DEBUG1("CMPXCollectionViewImp::ConstructL() Attaching 'Assign as' menu service...");
+        MPX_TRAP( iErrorAttachAssignMenu, iServiceHandler->AttachMenuL( R_MPX_USE_AS_CASCADE,
+                                                   R_MPX_AIW_ASSIGN_INTEREST ) );
+        }
+#ifdef BACKSTEPPING_INCLUDED
+    // Initialize the Back Stepping Service Utility with the MPX Music Player
+    iBackSteppingUtility = MMPXBackSteppingUtility::UtilityL();
+    iBackSteppingUtility->InitializeL(
+        TUid::Uid( KMusicPlayerAppUidConstant ) );
+#endif // BACKSTEPPING_INCLUDED
+
+#ifdef UPNP_INCLUDED
+    if (!iUpnpCopyCommand )
+        {
+   	    MPX_TRAPD ( error, iUpnpCopyCommand = CUpnpCopyCommand::NewL() );   
+		    if ( error == KErrNone )
+            {
+            iUpnpFrameworkSupport = ETrue;
+            }
+        else
+            {
+            iUpnpFrameworkSupport = EFalse;
+			iUpnpCopyCommand = NULL;
+            }
+        }
+#endif
+    iIsffButtonPressed = EFalse;
+    iDelayedErrorTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXCommonPlaybackViewImp::~CMPXCommonPlaybackViewImp()
+    {
+    MPX_DEBUG1( "CMPXCommonPlaybackViewImp::~CMPXCommonPlaybackViewImp entering" );
+
+    AppUi()->RemoveViewActivationObserver( this );
+
+    delete iMPXUtility;
+    delete iMedia;
+    delete iIdle;
+
+    if ( iServiceHandler )
+        {
+        iServiceHandler->DetachMenu( R_MPX_USE_AS_CASCADE,
+                                 R_MPX_AIW_ASSIGN_INTEREST );
+        delete iServiceHandler;
+        delete iMediaRecognizer;
+        }
+
+    delete iDelayedExit;
+
+    if ( iPSKeyWatcher )
+        {
+        delete iPSKeyWatcher;
+        }
+
+    if ( iCRWatcher )
+        {
+        delete iCRWatcher;
+        }
+
+    if ( iPlaybackUtility )
+        {
+        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+        iPlaybackUtility->Close();
+        }
+
+    if ( iViewUtility )
+        {
+        iViewUtility->RemoveObserver( this );
+        iViewUtility->Close();
+        }
+
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+
+   	if ( iFMTXResourceOffset )
+       	{
+       	iEikonEnv->DeleteResourceFile( iFMTXResourceOffset );
+       	}
+
+#ifdef BACKSTEPPING_INCLUDED
+    if( iBackSteppingUtility )
+        {
+        iBackSteppingUtility->Close();
+        }
+#endif // BACKSTEPPING_INCLUDED
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        }
+    delete iLayout;
+
+    if ( iUpnpFrameworkSupport )
+        {
+        iPlayersList.Close();
+        delete iSubPlayerName;
+#ifdef UPNP_INCLUDED
+        if (iUpnpCopyCommand)
+            {
+            delete iUpnpCopyCommand;
+            }
+#endif
+        }
+    delete iWaitNote;
+
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+
+    if ( iCollectionUiHelper )
+        {
+        iCollectionUiHelper->Close();
+        }
+
+    delete iCommonUiHelper;
+    delete iUserPlaylists;
+
+    if ( iKeySoundDisabled )
+        {
+        iAvkonViewAppUi->KeySounds()->PopContext();
+        }
+
+    // free up the FeatureManager
+    FeatureManager::UnInitializeLib();
+    if(iDelayedErrorTimer)
+    	{
+    	iDelayedErrorTimer->Cancel();
+    	delete iDelayedErrorTimer;
+    	}
+    
+    delete iOldUri;
+    MPX_DEBUG1( "CMPXCommonPlaybackViewImp::~CMPXCommonPlaybackViewImp exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// Updates playback view.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::UpdateViewL()
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateViewL" );
+
+    if ( iContainer && !iSwitchingView )
+        {
+        UpdatePlaybackState( iPlaybackState );
+        UpdateTrackInfoL( iMedia );
+        UpdateTrackPlaybackPositionL( iPosition, iDuration );
+        UpdateTrackPosInPlaylistL();
+        UpdateAlbumArtL( iMedia );
+        UpdateDownloadStateLabelL();
+
+        UpdateFMTransmitterInfoL( ETrue );
+
+        // Retrieve current repeat & random modes
+        iPlaybackUtility->PropertyL( *this, EPbPropertyRandomMode );
+        iPlaybackUtility->PropertyL( *this, EPbPropertyRepeatMode );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates track info field.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::UpdateTrackInfoL(
+    const CMPXMedia* aMedia )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateTrackInfo" );
+
+    if ( iContainer && !iSwitchingView )
+        {
+        if ( aMedia )
+            {
+            if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) )
+                {
+                iContainer->UpdateLabelL(
+                    ETextTrack,
+                    aMedia->ValueText( KMPXMediaGeneralTitle ) );
+                }
+            else if ( aMedia->IsSupported( KMPXMediaGeneralUri ) )
+                {
+                TParsePtrC filePath(
+                    aMedia->ValueText( KMPXMediaGeneralUri ) );
+                iContainer->UpdateLabelL(
+                    ETextTrack, filePath.Name() );
+                }
+            else
+                {
+                iContainer->UpdateLabelL(
+                    ETextTrack, KNullDesC );
+                }
+
+            if ( aMedia->IsSupported( KMPXMediaMusicArtist ) )
+                {
+                const TDesC& artist =
+                    aMedia->ValueText( KMPXMediaMusicArtist );
+                if ( artist != KNullDesC )
+                    {
+                    iContainer->UpdateLabelL(
+                        ETextArtist,
+                        artist );
+                    }
+                else
+                    {
+                    // Display unknown artist as artist
+                    HBufC* unknownArtistText =
+                        StringLoader::LoadLC( R_MPX_PBV_UNKNOWN_ARTIST_LABEL );
+                    iContainer->UpdateLabelL(
+                        ETextArtist, *unknownArtistText );
+                    CleanupStack::PopAndDestroy( unknownArtistText );
+                    }
+                }
+            else
+                {
+                // Display unknown artist as artist
+                HBufC* unknownArtistText =
+                    StringLoader::LoadLC( R_MPX_PBV_UNKNOWN_ARTIST_LABEL );
+                iContainer->UpdateLabelL(
+                    ETextArtist, *unknownArtistText );
+                CleanupStack::PopAndDestroy( unknownArtistText );
+                }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+            if ( iMedia->IsSupported( KMPXMediaGeneralMimeType ) )
+                {
+                // Get mime type
+                const TDesC& mimeType = iMedia->ValueText(
+                    KMPXMediaGeneralMimeType );
+                const TBool realAudioMode =
+                    ( mimeType.Compare( KMPXPnRealAudioMimeType ) == 0 ) ||
+                    ( mimeType.Compare( KMPXRealAudioMimeType ) == 0) ||
+                    ( mimeType.Compare( KMPXRnRealAudioMimeType ) == 0 );
+
+                // Set the real audio mode
+                iContainer->SetRealAudioMode( realAudioMode );
+                }
+#endif
+            }
+        else
+            {
+            // Display nothing if properties is NULL
+            iContainer->UpdateLabelL(
+                ETextTrack, KNullDesC );
+            iContainer->UpdateLabelL(
+                ETextArtist, KNullDesC );
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+            // reset real audio mode
+            iContainer->SetRealAudioMode( EFalse );
+#endif
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Update current playback state.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::UpdatePlaybackState(
+    TMPXPlaybackState aPlaybackState )
+    {
+    MPX_DEBUG2("CMPXCommonPlaybackViewImp::UpdatePlaybackState(%d): Entering", aPlaybackState);
+
+    if ( iContainer && !iSwitchingView )
+        {
+        TMPXPbvPlaybackMode mode( EInvalidMode );
+
+        switch ( aPlaybackState )
+            {
+            case EPbStateNotInitialised:
+                {
+                mode = iPlaybackUtility->Source() ? EUninitialized: ENoTracksMode;
+                break;
+                }
+            case EPbStateInitialising:
+                {
+                mode = EInitialising;
+                break;
+                }
+            case EPbStatePlaying:
+                {
+                mode = EPlayMode;
+                iIgnoredByUsbEvent = EFalse;
+                break;
+                }
+            case EPbStatePaused:
+                {
+                mode = EPauseMode;
+                break;
+                }
+            case EPbStateStopped:
+                {
+                mode = EStopMode;
+                break;
+                }
+            case EPbStateBuffering:
+                {
+                mode = EBufferingMode;
+                break;
+                }
+            default:
+                {
+                // Pass
+                break;
+                }
+            }
+
+        if ( EInvalidMode != mode )
+            {
+            iPlaybackState = aPlaybackState;
+            iContainer->SetMode( mode );
+            }
+
+        iContainer->UpdateButtons( aPlaybackState );
+        }
+    else
+        {
+        // If no container, just need to update state
+        switch ( aPlaybackState )
+            {
+            case EPbStateNotInitialised:
+            case EPbStateInitialising:
+            case EPbStatePlaying:
+            case EPbStatePaused:
+            case EPbStateStopped:
+                {
+                iPlaybackState = aPlaybackState;
+                break;
+                }
+            default:
+                {
+                // Pass
+                // Ignore other state changes such as skipping, etc.
+                break;
+                }
+            }
+        }
+    MPX_DEBUG1("CMPXCommonPlaybackViewImp::UpdatePlaybackState(): Exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Updates track's playback position.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::UpdateTrackPlaybackPositionL(
+    TInt aPos,
+    TInt aDuration )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateTrackPlaybackPosition" );
+
+    if ( iContainer && !iSwitchingView )
+        {
+        if ( aPos > aDuration )
+            {
+            aPos = aDuration;
+            }
+        switch ( iPlaybackState )
+            {
+            case EPbStatePaused:
+            case EPbStatePlaying:
+                {
+                iContainer->UpdateTimeIndicatorsL( aPos, aDuration );
+                break;
+                }
+            case EPbStateStopped:
+            case EPbStateInitialising:
+                {
+                iContainer->UpdateTimeIndicatorsL( aPos, aDuration );
+                } // falls through
+            case EPbStateNotInitialised:
+                {
+                iContainer->UpdateDurationLabelL( aDuration );
+                break;
+                }
+            default:
+                {
+                // Do nothing
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates track's album art.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::UpdateAlbumArtL(
+    const CMPXMedia* aMedia )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateAlbumArt" );
+
+    if ( iContainer && !iSwitchingView )
+        {
+        TInt err( KErrNone );
+        if ( aMedia && aMedia->IsSupported(KMPXMediaGeneralUri))
+            {
+            const TDesC& album = aMedia->ValueText( KMPXMediaGeneralUri );
+            if(!iOldUri || iOldUri->Compare(album)!= 0)
+                {  
+
+                TRect albumArtRect(
+                        iLayout->IndicatorLayout(
+                                ClientRect(), EAlbumArtArea ) );
+
+            MPX_TRAP( err,
+                iMPXUtility->ExtractAlbumArtL(
+                    *aMedia,
+                    *iContainer,
+                    albumArtRect.Size() ); );
+                delete iOldUri;
+                iOldUri = NULL;
+                iOldUri=album.AllocL();
+                } 
+            }
+
+        if (KErrNone != err )
+            {
+            // If error, show default album art
+            MPX_DEBUG2("CMPXCommonPlaybackViewImp::UpdateAlbumArt(): err = %d", err);
+            iContainer->ExtractAlbumArtCompleted( NULL, KErrNone );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates track position in playlist field.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::UpdateTrackPosInPlaylistL()
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateTrackPosInPlaylist" );
+
+    if ( iContainer && !iSwitchingView )
+        {
+        TBool emptyCount( EFalse );
+        TInt count( 0 );
+        TInt index( 0 );
+
+        MMPXSource* s = iPlaybackUtility->Source();
+        if ( s )
+            {
+            CMPXCollectionPlaylist* playlist = s->PlaylistL();
+            if ( playlist )
+                {
+                count = playlist->Count();
+                index = playlist->PathIndex( playlist->Index() );
+                delete playlist;
+                playlist = NULL;
+                }
+            }
+        MPX_DEBUG3("CMPXCommonPlaybackViewImp::UpdateTrackPosInPlaylistL: index = %d, count = %d", index, count );
+
+        // not display for progressive mode & embedded track mode
+        TMPXLaunchMode mode = MPXTlsHelper::LaunchMode();
+
+        if ( count )
+            {
+            if ( EMPXLaunchModeTrack != mode )
+                {
+                // Current index (1-based) if playlist is non-empty
+                // Magic: array granularity
+                CArrayFixFlat<TInt>* params =
+                    new ( ELeave ) CArrayFixFlat<TInt>( 2 );
+                CleanupStack::PushL( params );
+                params->AppendL( index + 1 );
+                params->AppendL( count );
+                HBufC* plcounter = StringLoader::LoadLC(
+                    R_MPX_PBV_PLAYLIST_ITEM_COUNTER_LABEL, *params );
+                iContainer->UpdateLabelL(
+                    ETextPlaylistCount,
+                    *plcounter );
+                CleanupStack::PopAndDestroy( plcounter );
+                CleanupStack::PopAndDestroy( params );
+                //iContainer->UpdateLabelL( ETextEmpty, KNullDesC );
+                }
+            else
+                {
+                emptyCount = ETrue;
+                }
+            }
+        else
+            {
+            emptyCount = ETrue;
+
+            // Display empty state text
+            //HBufC* noTracksText =
+            //    StringLoader::LoadLC( R_MPX_PBV_NO_TRACKS_LABEL );
+            //iContainer->UpdateLabelL(
+             //   ETextEmpty, *noTracksText );
+            //CleanupStack::PopAndDestroy( noTracksText );
+            }
+
+        if ( emptyCount )
+            {
+            // Empty string if playlist is empty
+            iContainer->UpdateLabelL(
+                ETextPlaylistCount,
+                KNullDesC );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates download state label.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::UpdateDownloadStateLabelL()
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateDownloadStateLabelL" );
+    // Do not show opening popup
+    }
+
+// ---------------------------------------------------------------------------
+// Updates Title Pane.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::UpdateTitlePaneL()
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateTitlePaneL" );
+
+    CAknTitlePane* title( static_cast<CAknTitlePane*>
+            ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ))));
+    if ( title )
+        {
+        HBufC* titleText( StringLoader::LoadLC(
+            R_MPX_PLAYBACKVIEW_TITLE ));
+        title->SetTextL( *titleText );
+        CleanupStack::PopAndDestroy( titleText );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates FM Transmitter Info
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::UpdateFMTransmitterInfoL(
+    TBool aForceUpdate )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::UpdateFMTransmitterInfoL" );
+
+    if ( iContainer && !iSwitchingView )
+        {
+        if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+            {
+            // if FM Transmitter is supported feature, retrieve the state of
+            // the FM Transmitter
+            TInt value(EFmTxStateUnknown);
+            TInt freqKHz = 0;
+
+            if ( iPSKeyWatcher->GetValue( value ) == KErrNone )
+                {
+                MPX_DEBUG2( "CMPXCommonPlaybackViewImp::UpdateFMTransmitterInfoL iPSKeyWatcher value %d", value);
+                // EFmTxStatePowerSaveAccessory & EFmTxStatePowerSaveInactivity
+                // are considered as off
+                if ( value == EFmTxStateActive ||
+                     value == EFmTxStateInactive )
+                    {
+                    // if FM Transmitter is turned on, retrieve the frequency
+                    MPX_TRAPD( err, freqKHz = iCRWatcher->CurrentValueL() );
+                    if ( err != KErrNone )
+                        {
+                        freqKHz = 0;
+                        }
+                    }
+                }
+
+            MPX_DEBUG4( "CMPXCommonPlaybackViewImp::UpdateFMTransmitterInfoL iFMTxFreqKHz %d freqKHz %d aForceUpdate %d", iFMTxFreqKHz, freqKHz, aForceUpdate);
+            if ( iFMTxFreqKHz != freqKHz || aForceUpdate )
+                {
+                // if the FM Transmitter state has been changed from one active
+                // to another and it's frequency value changed, or if FM
+                // Transmitter is changed from an active to an inactive state,
+                // or vice versa, update the frequency display and save the new
+                // value
+                iFMTxFreqKHz = freqKHz;
+
+                // Create display string and default it to an empty string
+                RBuf freqTxt;
+                freqTxt.Assign( NULL );
+
+                CleanupClosePushL( freqTxt );
+
+                // display the frequncy if it's a valid value
+                if ( iFMTxFreqKHz > 0 )
+                    {
+                    TReal freqMHz = static_cast<TReal> (iFMTxFreqKHz) /
+                        static_cast<TReal> (KMPXOneMhzInOneKhz);
+
+                    TRealFormat realFormat(
+                        KMPXFMFreqWidth,
+                        KMPXFMFreqDecimalPlace);
+
+                    // display frequecy as : XXX.XX Mhz
+                    TBuf<KMPXFMFreqWidth + 1> freqMHzStr;
+                    TInt err = freqMHzStr.Num( freqMHz, realFormat );
+                    if ( err > 0 )
+                        {
+                        HBufC* labelFormatText = StringLoader::LoadL(
+                            R_MPX_FM_FREQUENCY_LABEL,
+                            freqMHzStr );
+
+                        // ownership transferred
+                        freqTxt.Assign(labelFormatText);
+                        }
+                    }
+
+                iContainer->UpdateLabelL(
+                    ETextFMFrequency, freqTxt );
+
+                CleanupStack::PopAndDestroy( &freqTxt );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC_EX("CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL");
+
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessagePbMediaChanged == id )
+        {
+        MPX_DEBUG1("CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL: PbMediaChanged");
+        if ( aMessage.IsSupported( KMPXMessagePbMedia ) )
+            {
+            CMPXMedia* media( aMessage.Value<CMPXMedia>( KMPXMessagePbMedia ) );
+            User::LeaveIfNull( media );
+            DoHandleMediaL( *media, KErrNone );
+            }
+        }
+    else if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EPropertyChanged:
+                {
+                MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - EPropertyChanged(%d)", type );
+                TMPXPlaybackProperty property(
+                    static_cast<TMPXPlaybackProperty>( type ) );
+                TInt error( KErrNone );
+
+                DoHandlePropertyL( property, data, error );
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - EStateChanged(%d)", type );
+
+                TMPXPlaybackState state =
+                    static_cast<TMPXPlaybackState>( type );
+                if ( ( data == KErrNotSupported ) &&
+                     ( state == EPbStatePaused ) )
+                    {
+                    if ( iLastPBViewActivated )
+                        {
+                        // In UPnP case, this will display an error message
+                        iCommandSender = ECsMediaKey;
+                        IsCommandSupportedL();
+                        }
+                    }
+                else if ( (( data == KErrAccessDenied ) || ( data == KErrDied ) || ( data == KErrInUse )) &&
+                          ( state == EPbStatePaused ))
+                    {
+                    if ( iLastPBViewActivated &&
+                         MPXUser::IsCallOngoing( EPSCTsyCallTypeH324Multimedia ))
+                        {
+                        iCommonUiHelper->HandleErrorL( KMPXErrorVideoCall );
+                        }
+                    }
+                else
+                    {
+                    DoHandleStateChangedL( state, data );
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::EMediaChanged:
+                {
+                MPX_DEBUG1( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - EMediaChanged()");
+                    RequestMediaL();
+                if ( iIdle )
+                    {
+                    if ( iIdle->IsActive() )
+                        {
+                        MPX_DEBUG1( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL() iIdle active, canceling" );
+                        iIdle->Cancel();
+                        }
+                    delete iIdle;
+                    iIdle = NULL;
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::ECommandReceived:
+                {
+                MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - ECommandReceived(%d)", type );
+                break;
+                }
+            case TMPXPlaybackMessage::ESkipping:
+                {
+                MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - ESkipping(%d)", data );
+                if ( iContainer )
+                    {
+                    iContainer->SetMode( EMediaKeySkipping );
+                    }
+                TInt offset( data );
+                if ( offset < 0 )
+                    {
+                    iLastSkipDirection = -1;
+                    }
+                else
+                    {
+                    iLastSkipDirection = 1;
+                    }
+                iSkipping = ETrue;
+                break;
+                }
+            case TMPXPlaybackMessage::ESkipEnd:
+                {
+                MPX_DEBUG1( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - ESkipEnd()");
+                iSkipping = EFalse;
+                break;
+                }
+            case TMPXPlaybackMessage::EPlaylistUpdated:
+                {
+                MPX_DEBUG1( "CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL - EPlaylistUpdated()");
+                // Do not retrive media again if in the middle of handling an error
+                if ( KErrNone == iDelayedError )
+                    {
+                    TBool noTracks( ETrue );
+                    MMPXSource* source = iPlaybackUtility->Source();
+                    if ( source )
+                        {
+                        CMPXCollectionPlaylist* pl( source->PlaylistL() );
+                        if ( pl )
+                            {
+                            CleanupStack::PushL( pl );
+                            if ( pl->Count() > 0 )
+                                {
+                                // Only update media if in foreground
+                                if ( iContainer )
+                                    {
+                                    RequestMediaL();
+                                    }
+                                else
+                                    {
+                                    // If in background, wait for view to be activated
+                                    // before requesting media again
+                                    delete iMedia;
+                                    iMedia = NULL;
+                                    }
+                                noTracks = EFalse;
+                                }
+                            CleanupStack::PopAndDestroy( pl );
+                            }
+                        }
+                    if ( noTracks )
+                        {
+                        delete iMedia;
+                        iMedia = NULL;
+                        iPlaybackState = EPbStateNotInitialised;
+                        UpdateViewL();
+                        }
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::EInitializeComplete:
+                {
+                // Reset flag, done opening new item.
+                MPX_DEBUG1("CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL()");
+                MPX_DEBUG1("    > EInitializeComplete Reset New Item Opened Flag");
+                iNewItemOpened = EFalse;
+                break;
+				}
+            default:
+                {
+                MPX_DEBUG4("CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL(): Ignore message %d %d %d",
+                            aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ), type, data);
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::DoHandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoHandlePropertyL" );
+    MPX_DEBUG4( "HandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError );
+
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty  )
+            {
+            case EPbPropertyPosition:
+                {
+                iPosition = aValue / KMPXOneSecInMilliSecs;
+                if( !iIsTapped )
+                    {
+                    UpdateTrackPlaybackPositionL( iPosition, iDuration );
+                    break;
+                    }
+                else
+                    {
+                    iIsTapped = EFalse;
+                    // retrieve iCurrentPlayerType info
+                    GetCurrentPlayerDetails();
+                    if ( iCurrentPlayerType == EPbRemote )
+                        {
+                        UpdateTrackPlaybackPositionL( iOldPosition, iDuration );
+                        break;
+                        }
+                    else
+                        {
+                        UpdateTrackPlaybackPositionL( iPosition, iDuration );
+                        break;
+                        }
+                    }
+                }
+            case EPbPropertyDuration:
+                {
+                iDuration = aValue / KMPXOneSecInMilliSecs;
+                break;
+                }
+            case EPbPropertyRandomMode:
+                {
+                iRandomMode = aValue;
+                if ( iContainer )
+                    {
+                    iContainer->SetRandomMode( aValue );
+                    }
+                break;
+                }
+            case EPbPropertyRepeatMode:
+                {
+                iRepeatMode = aValue;
+                if ( iContainer )
+                    {
+                    iContainer->SetRepeatMode(
+                        EPbRepeatAll == aValue, EPbRepeatOne == aValue );
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else
+        {
+        HandleErrorL( aError );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aProperties.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::DoHandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoHandleMediaL" );
+    MPX_DEBUG2("CMPXCommonPlaybackViewImp::DoHandleMediaL(): aError = %d", aError);
+
+    delete iMedia;
+    iMedia = NULL;
+    if ( KErrNone == aError )
+        {
+        iMedia = CMPXMedia::NewL( aMedia );
+
+        UpdateTrackPosInPlaylistL();
+        UpdateTrackInfoL( iMedia );
+        UpdateAlbumArtL( iMedia );
+        
+
+        // Update duration if previously not available
+        if ( iMedia->IsSupported( KMPXMediaGeneralDuration ) )
+            {
+            iDuration = iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration ) /
+                KMPXOneSecInMilliSecs;
+            UpdateTrackPlaybackPositionL( iPosition, iDuration );
+            }
+
+        // If there's a delayed error, handle it now
+        // that the media object has arrived
+        if ( iDelayedError != KErrNone )
+            {
+            // if repeat mode is off, delay to handle this error.
+            if ( EPbRepeatOff == iRepeatMode )
+                {
+                // save current index
+                iErrIndex = KErrNotFound;
+                if (iPlaybackUtility)
+                    {
+                    MMPXSource* source( iPlaybackUtility->Source() );
+                    if ( source )
+                        {
+                        CMPXCollectionPlaylist* pl( source->PlaylistL() );
+                        if ( pl )
+                            {
+                            CleanupStack::PushL( pl );
+                            iErrIndex = pl->Index();
+                            CleanupStack::PopAndDestroy( pl );
+                            }
+                        }
+                    }
+                // startup timer for handling delayed error
+                TCallBack cb( HandleDelayedError, this );
+                if (iDelayedErrorTimer->IsActive())
+                    {
+                    iDelayedErrorTimer->Cancel();
+                    }
+                iDelayedErrorTimer->Start( KMPXPostponeForHandleDelayedError,
+                        KMPXPostponeForHandleDelayedError,
+                        cb );
+                // reset iDelayedError
+                iLastDelayedErr = iDelayedError;
+                iDelayedError = KErrNone;
+                }
+            else
+                {
+                // if repeat mode isn't off, handle it at once.
+                if (iDelayedErrorTimer->IsActive())
+                    {
+                    iDelayedErrorTimer->Cancel();
+                    }
+
+                // Copy error code and reset iDelayedError, this is becuase
+                // a media event may be called while handling this error
+                TInt err( iDelayedError );
+                iDelayedError = KErrNone;
+                HandleErrorL( err );
+                }
+            }
+        }
+    else
+        {
+        
+#ifndef CAMESE_IN_DRM_UTILITY		
+        // Check if Camese Support is enabled and
+        // if the error is caused by PV being unable
+        // to retrieve media properties before handling
+        // the error here.
+        if (iCameseSuperDistSupport && aError == KErrPermissionDenied)
+            {
+            // Clear delayed errors.
+            iDelayedError = KErrNone;
+            return;
+            }
+#endif
+        HandleErrorL(aError);
+
+        if ( aError == iDelayedError )
+            {
+            iDelayedError = KErrNone;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::DoHandleStateChangedL(
+    TMPXPlaybackState aState,
+    TInt aData )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoHandleStateChangedL" );
+    MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandleStateChangedL %d", aState );
+    UpdatePlaybackState( aState );
+
+    switch ( aState )
+        {
+        case EPbStateStopped:
+        case EPbStateNotInitialised:
+            {
+            UpdateTrackPlaybackPositionL( 0, iDuration );
+            break;
+            }
+        case EPbStateInitialising:
+            {
+            // Save the start playback index
+            if ( KErrNotFound == iStartPlaybackIndex &&
+                 KErrNotFound != aData )
+                {
+                iStartPlaybackIndex = aData;
+                }
+            UpdateDownloadStateLabelL();
+            iDelayedErrorTimer->Cancel();
+            break;
+            }
+        case EPbStatePlaying:
+        case EPbStatePaused:
+        default:
+            {
+            MPX_PERF_CHECKPT("Playback state changes to Play/Pause");
+            iStartPlaybackIndex = KErrNotFound;
+            iLastSkipDirection = 1;
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get simple embedded mode.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonPlaybackViewImp::SimpleEmbeddedMode() const
+    {
+    return iEmbedded;
+    }
+
+// ---------------------------------------------------------------------------
+// Get embedded status.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonPlaybackViewImp::IsEmbedded() const
+    {
+    return iEmbedded;
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleErrorL( TInt aError )
+    {
+    MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleErrorL(%d): Entering", aError );
+    MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleErrorL iIgnoredByUsbEvent(%d):", iIgnoredByUsbEvent );
+    if ( aError )
+        {
+        TInt currentIndex( KErrNotFound );
+        TInt nextIndex( KErrNotFound );
+        TInt plCount( KErrNotFound );
+        MMPXSource* source( iPlaybackUtility->Source() );
+        if ( source )
+            {
+            CMPXCollectionPlaylist* pl( source->PlaylistL() );
+            if ( pl )
+                {
+                CleanupStack::PushL( pl );
+                currentIndex = pl->Index();
+                if ( iLastSkipDirection < 0 )
+                    {
+                    pl->Previous( ETrue );
+                    }
+                else
+                    {
+                    pl->Next( ETrue );
+                    }
+                nextIndex = pl->Index();
+                plCount = pl->Count();
+                CleanupStack::PopAndDestroy( pl );
+                }
+            }
+
+        // MMF framework will return KErrArgument/KErrCompletion if it reaches
+        // the end of a partially downloaded file.  The downloaded portion of
+        // the file should still be playable in this case.
+        if ( KErrNotFound != nextIndex && !iIgnoredByUsbEvent &&
+        	 KErrDisMounted != aError &&
+            ( ( KErrArgument != aError && KErrCompletion != aError ) ||
+              iPlaybackState != EPbStatePlaying ))
+            {
+            // Check if all tracks are invalid, or if there's only
+            // 1 track in the playlist
+            if ( nextIndex == iStartPlaybackIndex ||
+                 plCount == 1 ||
+                 EPbRepeatOne == iRepeatMode)
+                {
+                aError = KMPXAllTracksInvalid;
+                }
+            }
+
+        // Igore these messages when USB event just happened
+        if (iIgnoredByUsbEvent &&
+            (aError == KErrCANoRights ||
+            aError == KErrPathNotFound ||
+            aError == KErrDisMounted )
+            )
+            {
+            iIgnoredByUsbEvent = EFalse;
+            return;
+            }
+        
+        // else iIgnoredByUsbEvent==EFalse, then furtherly check USB status in central repository.
+        else if ( !iIgnoredByUsbEvent )
+        	{
+            TInt usbStatus;
+            RProperty::Get( KPSUidUsbWatcher, KUsbWatcherSelectedPersonality, usbStatus );
+        
+            if ( KUsbPersonalityIdMS == usbStatus && KErrDisMounted == aError  )
+            	{
+            	// Igore this error when USB is avtive in MassStrorage mode.
+            	return;
+            	}
+            }
+
+        switch ( aError )
+            {
+            case KMPXRightsAboutToExpire:
+            case KErrCANotSupported:
+            case KErrCANoPermission:
+            case KErrCANoRights:
+            case KErrCANoAgent:
+            case KErrCAOutOfRange:
+            case KErrCAPendingRights:
+            case KErrCASizeNotDetermined:
+            case KErrCANewFileHandleRequired:
+            case KErrPermissionDenied:
+                {
+                TBool skip(ETrue);
+
+                if ( iMedia )
+                    {
+                    if ( iMedia->IsSupported( KMPXMediaDrmType ) )
+                        {
+                        TMPXMediaDrmType type(
+                            iMedia->ValueTObjectL<TMPXMediaDrmType>(
+                                KMPXMediaDrmType ) );
+
+                        // Only display DRM error message for WMDRM
+                        // if it's the first song selected
+                        if ( EMPXDrmTypeWMA == type &&
+                             currentIndex == iStartPlaybackIndex)
+                            {
+#ifndef CAMESE_IN_DRM_UTILITY
+                            MPX_DEBUG2("CMPXCommonPlaybackViewImp::HandleErrorL iCameseSuperDistSupport %d", iCameseSuperDistSupport);
+                            // Only handle the error if Camese is disabled.
+                            if (!iCameseSuperDistSupport)
+                                {
+                                MPX_DEBUG2("CMPXCommonPlaybackViewImp::HandleErrorL iNewItemOpened %d", iNewItemOpened);
+                                if (iNewItemOpened)
+                                    {
+                                    iPlaybackUtility->CommandL( EPbCmdStop );
+                                    iCommonUiHelper->HandleErrorL( aError, iMedia );
+                                    // If Camese is off and we
+                                    // received the collection message
+                                    // indicating we are opening a new item,
+                                    // disable skipping on this error.
+                                    // We just stop playback.
+                                    skip = EFalse;
+
+                                    // Reset the Start Playback Index.
+                                    iStartPlaybackIndex = KErrNotFound;
+                                    }
+                                }
+                            else if (iNewItemOpened)
+#else
+                                if (iNewItemOpened)
+#endif
+                                    {
+                                    MPX_DEBUG1("CMPXPlaybackViewImp::HandleErrorL Skip Disabled - New Item");
+
+                                // If Camese is on and we
+                                // received the collection message
+                                // indicating we are opening a new item,
+                                // disable skipping on this error. Camese will handle
+                                // postdelivery in this case.
+                                skip = EFalse;
+
+                                // Reset the Start Playback Index.
+                                iStartPlaybackIndex = KErrNotFound;
+                                }
+                            }
+                        }
+                    }
+
+                if (skip)
+                    {
+                    SkipOnErrorL( currentIndex, plCount );
+                    }
+                break;
+                }
+            case KErrAccessDenied:
+                {
+                // Only display error message if first one selected to play
+                if ( currentIndex == iStartPlaybackIndex )
+                    {
+                    iCommonUiHelper->HandleErrorL( aError, iMedia );
+                    }
+                SkipOnErrorL( currentIndex, plCount );
+                break;
+                }
+            case KErrNotSupported:
+            case KErrCorrupt:
+            case KErrNotFound:
+            case KErrPathNotFound:
+            case KErrDivideByZero:
+            case KErrGeneral: 
+                {
+                // USB dismounts the disk, it cannot find any records
+                if( !iDatabaseNotReady )
+                    {
+                    SkipOnErrorL( currentIndex, plCount );
+                    }
+                break;
+                }
+            case KMPXAllTracksInvalid:
+                {
+                HandleAllTracksInvalidL();
+                break;
+                }
+            case KErrArgument:
+            case KErrCompletion:
+                {
+                TBool skip( ETrue );
+
+                // UI specs say theres two cases where it stops and
+                // does not skip to the next song.
+                // First case is if not repeat all and playback has
+                // reached the end of the list and gone to the first song.
+                // Second case is if not repeat all and the user is skipping
+                // backwards and reached the first song
+                if ( EPbRepeatAll != iRepeatMode &&
+                     0 == currentIndex &&
+                     -1 == iLastSkipDirection)
+                    {
+                    skip = EFalse;
+                    }
+
+                // Skip to next/previous track
+                if ( skip )
+                    {
+                    if ( iLastSkipDirection < 0 )
+                        {
+                        iPlaybackUtility->CommandL( EPbCmdPrevious );
+                        }
+                    else
+                        {
+                        iPlaybackUtility->CommandL( EPbCmdNext );
+                        }
+                    }
+                break;
+                }
+            case KErrDiskFull:
+                {
+                iCommonUiHelper->HandleErrorL( aError, iMedia );
+                break;
+                }
+            default:
+                {
+                iPlaybackUtility->CommandL( EPbCmdStop );
+                iCommonUiHelper->HandleErrorL( aError, iMedia );
+                break;
+                }
+            }
+        }
+
+    // Reset flag after error handling is done.
+    MPX_DEBUG1("CMPXPlaybackViewImp::HandleErrorL()");
+    MPX_DEBUG1("    > Reset New Item Opened Flag");
+    iNewItemOpened = EFalse;
+
+    MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleErrorL: Exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error note for when all tracks are invalid,
+// and goes back to collection list view
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL()
+    {
+    MPX_DEBUG1("CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL: Entering");
+    MPX_DEBUG2("CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL: iDatabaseNotReady (%d)", iDatabaseNotReady);
+
+    iPlaybackUtility->CommandL( EPbCmdStop );
+    UpdatePlaybackState( EPbStateStopped );
+
+    TInt mpxWindowGroupId = CEikonEnv::Static()->RootWin().Identifier();
+
+    // Usb event happened.
+    if (iDatabaseNotReady)
+        {
+        iIgnoredByUsbEvent = ETrue;
+        }
+
+    // Do not display error if view is not active
+    if ( iContainer && !iDatabaseNotReady &&
+         iCommonUiHelper->IsForegroundApplication(mpxWindowGroupId) &&
+         iViewUtility->ActiveViewType() != TUid::Uid( KMPXPluginTypeEqualizerUid ) )
+        {
+        iCommonUiHelper->HandleErrorL( KMPXAllTracksInvalid, iMedia );
+
+        // Check foreground again just in case of user presses end key and switch
+        // to idle application while error notes are showing
+        // do not switch view when USB events ongoing
+        if (!iDatabaseNotReady &&
+         iCommonUiHelper->IsForegroundApplication(mpxWindowGroupId))
+            {
+                HandleCommandL( EAknSoftkeyBack );
+            }
+
+        iStartPlaybackIndex = KErrNotFound;
+        iLastSkipDirection = 1;
+
+        // Reset the playlist to point to the first item
+        // in list, but do not initialize the song for
+        // playback
+        MMPXSource* source( iPlaybackUtility->Source() );
+        if ( source )
+            {
+            CMPXCollectionPlaylist* pl( source->PlaylistL() );
+            if ( pl )
+                {
+                CleanupStack::PushL( pl );
+                pl->SetToFirst();
+                iPlaybackUtility->InitL( *pl, EFalse );
+                CleanupStack::PopAndDestroy( pl );
+                }
+            }
+        }
+
+
+    MPX_DEBUG1("CMPXCommonPlaybackViewImp::HandleAllTracksInvalidL: Exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Checks whether or not to skip to next track on an error
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::SkipOnErrorL(
+    TInt aCurrentIndex,
+    TInt aCount )
+    {
+    MPX_DEBUG3("CMPXCommonPlaybackViewImp::SkipOnErrorL(%d %d): Entering", aCurrentIndex, aCount);
+
+    TBool skip( ETrue );
+    TBool displayError( EFalse );
+
+    // If playlist is invalid, don't skip. Fix for error EJPJ-7CVAJX.
+    if ( aCurrentIndex == KErrNotFound && aCount == KErrNotFound )
+        {
+        skip = EFalse;
+        iCommonUiHelper->HandleErrorL( KErrCorrupt );
+        }
+    // UI specs say theres two cases where it stops and
+    // does not skip to the next song.
+    // First case is if not repeat all and playback has
+    // reached the end of the list and gone to the first song.
+    // Second case is if not repeat all and the user is skipping
+    // backwards and reached the first song
+    else if ( EPbRepeatAll != iRepeatMode )
+        {
+        if ( 0 == aCurrentIndex &&
+             -1 == iLastSkipDirection )
+            {
+            skip = EFalse;
+            displayError = ETrue;
+            }
+        else if ( aCurrentIndex == aCount-1 &&
+                  1 == iLastSkipDirection )
+            {
+            skip = EFalse;
+            displayError = ETrue;
+            }
+        }
+   if ( EPbRepeatAll == iRepeatMode )
+       {
+       if ( aCurrentIndex == aCount-1 &&
+                1 == iLastSkipDirection )
+           {
+           skip = EFalse;
+           displayError = ETrue;
+           }
+        }
+
+    // Skip to next/previous track
+    if ( skip )
+        {
+        if ( iLastSkipDirection < 0 )
+            {
+            iPlaybackUtility->CommandL( EPbCmdPrevious );
+            }
+        else
+            {
+            iPlaybackUtility->CommandL( EPbCmdNext );
+            }
+        }
+
+    // Display error message
+    if ( displayError )
+        {
+        HandleAllTracksInvalidL();
+        }
+
+    MPX_DEBUG1("CMPXCommonPlaybackViewImp::SkipOnErrorL: Exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Function to display information notes
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::DisplayInfoNoteL( TInt aResourceId )
+    {
+    HBufC* text = StringLoader::LoadLC( aResourceId );
+    CAknInformationNote* dlg = new ( ELeave ) CAknInformationNote( ETrue );
+    dlg->ExecuteLD( *text );
+    CleanupStack::PopAndDestroy( text );
+    }
+
+// ---------------------------------------------------------------------------
+// Function to display confirmation notes
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::DisplayConfirmionNoteL( TInt aResourceId )
+    {
+    HBufC* text = StringLoader::LoadLC( aResourceId );
+    CAknConfirmationNote* dlg = new ( ELeave ) CAknConfirmationNote( ETrue );
+    dlg->ExecuteLD( *text );
+    CleanupStack::PopAndDestroy( text );
+    }
+
+// ---------------------------------------------------------------------------
+// Set process priority.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::SetProcessPriority()
+    {
+    RProcess thisProcess;
+    TProcessPriority  pPriority = thisProcess.Priority();
+
+    // Check if playback state is not playing, set to background
+    TMPXPlaybackState state( EPbStateNotInitialised );
+    TRAP_IGNORE( state = iPlaybackUtility->StateL() );
+
+    if ( EPbStatePlaying != state && pPriority == EPriorityHigh )
+        {
+        MPX_DEBUG1( "CMPXCommonPlaybackViewImp::SetProcessPriority -- setting process priority to EPriorityBackground" );
+        thisProcess.SetPriority( EPriorityBackground );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Launch equalizer dialog.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::LaunchEqualizerL()
+    {
+
+    // Activate Equalizer dialog via View Framework
+    iViewUtility->ActivateViewL( TUid::Uid( KMPXPluginTypeEqualizerUid ) );
+
+    iContainer->SetRect( ClientRect() );
+    iContainer->DrawDeferred();
+    iSwitchingView = EFalse;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Launch Music Settings view.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::LaunchMusicSettingsL()
+    {
+    // Activate Audio Effects view via View Framework
+    iViewUtility->ActivateViewL(
+        TUid::Uid( KMPXPluginTypeAudioEffectsUid ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Launch FM Transmitter application
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::LaunchFMTransmitterL()
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::LaunchFMTransmitterL" );
+
+    if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+        {
+        TApaTaskList tasList( iCoeEnv->WsSession() );
+        TApaTask task = tasList.FindApp( KFmTxAppUid );
+        if ( task.Exists() )
+            {
+            task.BringToForeground();
+            }
+        else
+            {
+            RProcess process;
+            TApaAppInfo appInfo;
+            RApaLsSession session;
+            if ( KErrNone == session.Connect() )
+                {
+                CleanupClosePushL( session );
+                TThreadId threadId;
+                session.CreateDocument( KNullDesC, KFmTxAppUid, threadId );
+                CleanupStack::PopAndDestroy(&session);
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Request for the media object
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::RequestMediaL( TBool aDrm /*=EFalse*/ )
+    {
+    MPX_DEBUG1("CMPXCommonPlaybackViewImp::RequestMediaL(): entering");
+
+    MMPXSource* s = iPlaybackUtility->Source();
+    if ( s )
+        {
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        attrs.Append( KMPXMediaGeneralBasic |
+                      KMPXMediaGeneralUri |
+                      KMPXMediaGeneralMimeType |
+                      KMPXMediaGeneralDuration );
+        attrs.Append( KMPXMediaMusicAlbumArtFileName |
+                      KMPXMediaMusicArtist |
+                      KMPXMediaMusicAlbum );
+        if ( aDrm )
+            {
+            attrs.Append( KMPXMediaDrmAll );
+            }
+        else
+            {
+            // If not retrieving all drm attributes, then
+            // minimal is retrieve the protected flag and
+            // automated flag
+            attrs.Append( KMPXMediaDrmProtected |
+                          KMPXMediaDrmCanSetAutomated );
+            }
+        s->MediaL( attrs.Array(), *this );
+        CleanupStack::PopAndDestroy( &attrs );
+        }
+    MPX_DEBUG1("CMPXCommonPlaybackViewImp::RequestMediaL(): exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::PrepareStatusPaneForPlaybackViewL
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonPlaybackViewImp::PrepareStatusPaneForPlaybackViewL()
+    {
+    iPreviousStatusPaneLayout = StatusPane()->CurrentLayoutResId();
+    TInt resId( KErrNone );
+
+    if ( !Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        if ( iPreviousStatusPaneLayout != R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT )
+            {
+            resId = R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT;
+            }
+        }
+
+    if ( KErrNone != resId )
+        {
+        CAknLocalScreenClearer* clearer = CAknLocalScreenClearer::NewLC( ETrue );
+        StatusPane()->SwitchLayoutL( resId );
+        CleanupStack::PopAndDestroy( clearer );
+        }
+    else if ( iContainer )
+        {
+        iContainer->SetRect( ClientRect() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::PrepareStatusPaneForExitingViewL
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonPlaybackViewImp::PrepareStatusPaneForExitingViewL()
+    {
+    MPX_FUNC_EX("CMPXCommonPlaybackViewImp::PrepareStatusPaneForExitingViewL()");
+    if ( StatusPane()->CurrentLayoutResId() !=
+         iPreviousStatusPaneLayout)
+        {
+        StatusPane()->SwitchLayoutL( iPreviousStatusPaneLayout );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    MPX_DEBUG2("-->CMPXCommonPlaybackViewImp::HandlePlaybackMessage(): aError = %d", aError);
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    else if ( aError != KErrNone && iLastPBViewActivated )
+        {
+        TRAP_IGNORE( DoHandleErrorPlaybackMessageL( aError ) );
+        }
+    MPX_DEBUG2("<--CMPXCommonPlaybackViewImp::HandlePlaybackMessage(): aError = %d", aError);
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    TRAP_IGNORE( DoHandlePropertyL( aProperty, aValue, aError ) );
+    }
+
+// ---------------------------------------------------------------------------
+// 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
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleSubPlayerNamesL" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media event.
+// Notes: The client is responsible for delete the object of aProperties.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleMediaL" );
+    TRAP_IGNORE( DoHandleMediaL( aMedia, aError ));
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionMediaObserver
+// Handle extended media properties
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleCollectionMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleCollectionMediaL" );
+    TRAP_IGNORE( DoHandleMediaL( aMedia, aError ));
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Command handling function.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleCommandL(%d) entering", aCommand );
+
+    switch (aCommand)
+        {
+        case EAknCmdHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL(
+                iEikonEnv->WsSession(),
+                AppUi()->AppHelpContextL() );
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            AppUi()->HandleCommandL( EMPXCmdGotoCollection );
+            #ifdef BACKSTEPPING_INCLUDED
+            // let Back Stepping Service handle the event
+            TInt statusInfo( KMPXBackSteppingNotConsumed );
+            if ( iViewUtility &&
+                ( iViewUtility->ActiveViewType() != KNullUid ) )
+                {
+                TInt viewId( iViewUtility->ActiveViewType().iUid );
+                TBuf8<KMVPrefixLen + KMaxIntLen> buf;
+                buf.Copy( KMVPrefix );
+                buf.AppendNum( viewId );
+                statusInfo = iBackSteppingUtility->HandleBackCommandL( buf );
+                MPX_DEBUG3("CMPXCommonPlaybackViewImp::HandleCommandL - viewid=0x%x, statusInfo=%d",
+                     viewId, statusInfo );
+                }
+            if ( statusInfo == KMPXBackSteppingNotConsumed )
+            #endif // BACKSTEPPING_INCLUDED
+                {
+                if ( !iBacking )
+                    {
+                    // event not consumed by Back Stepping utility, handle here
+                    //
+                    // Status pane has to be modified before view gets deactivated
+
+                    MMPXSource* source = iPlaybackUtility->Source();
+                    if ( source )
+                        {
+                        CMPXCollectionPlaylist* playlist = source->PlaylistL();
+                        if ( playlist )
+                            {
+                            CleanupStack::PushL( playlist );
+    						CMPXCollectionPath* browsePath( iCollectionUtility->Collection().PathL() );
+							CleanupStack::PushL( browsePath );
+					        MPX_DEBUG_PATH(*browsePath);
+
+                            if ( playlist->Count() )
+                                {
+                                CMPXCollectionPath* pbPath =
+                                    CMPXCollectionPath::NewL( playlist->Path() );
+                                CleanupStack::PushL( pbPath );
+                                MPX_DEBUG_PATH(*pbPath);
+
+                                TInt playbackPathCount( pbPath->Levels() );
+                                // if both path are at the same level, we need to check further
+                                TBool isEqual( ETrue );
+                                if ( browsePath->Levels() == playbackPathCount )
+                                    {
+                                    // Check id at each level
+                                    for ( TInt i = 0; i < playbackPathCount - 1; i++ )
+                                        {
+                                        if ( browsePath->Id( i ) != pbPath->Id( i ) )
+                                            {
+                                            isEqual = EFalse;
+                                            break;
+                                            }
+                                        }
+                                    }
+                                else
+                                    {
+                                    isEqual = EFalse;
+                                    }
+      
+                                if ( isEqual ) // if they're the same path
+									{
+									pbPath->Back();
+									iViewUtility->PushDefaultHistoryL();
+									iCollectionUtility->Collection().OpenL( *pbPath );
+									}
+								else // we want to reopen the browse path
+									{
+									browsePath->Back();
+									iCollectionUtility->Collection().OpenL( *browsePath );
+									}
+                                CleanupStack::PopAndDestroy( pbPath );
+                                }
+                            else
+                                {
+                                // TO-DO: check if collection is empty, activate
+                                // music main menu? or change ui spec
+                                AppUi()->HandleCommandL( EAknSoftkeyBack );
+                                }
+                            CleanupStack::PopAndDestroy( browsePath );
+                            CleanupStack::PopAndDestroy( playlist );
+                            }
+                        else
+                            {
+                            AppUi()->HandleCommandL( EAknSoftkeyBack );
+                            }
+                        }
+                    else
+                        {
+                        CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+                        CleanupStack::PushL( cpath );
+                        while ( cpath->Levels() > 1 )
+                            {
+                            cpath->Back();
+                            }
+                        iCollectionUtility->Collection().OpenL( *cpath );
+                        CleanupStack::PopAndDestroy( cpath );
+                        }
+                    iBacking = ETrue;
+                    }
+                }
+            break;
+            }
+        case EAknCmdExit:
+        case EAknSoftkeyExit:
+        case EEikCmdExit:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        case EMPXPbvCmdGotoMusicMenu:
+            {
+            AppUi()->HandleCommandL( EMPXCmdGotoCollection );
+            TInt val(0);
+            CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
+            repository->Get( KMPXMPLocalVariation, val );
+            TBool startInAlbumMenu = val&KMPXStartMusicPlayerinArtistsandAlbums ? ETrue : EFalse;
+            delete repository;
+            
+            if ( startInAlbumMenu )
+                {
+                CMPXCollectionPath* cpath = iCollectionUiHelper->MusicMenuPathL();
+                CleanupStack::PushL( cpath );
+                cpath->AppendL(3); // Albums
+                MPX_DEBUG_PATH(*cpath);
+                iCollectionUtility->Collection().OpenL( *cpath );
+                CleanupStack::PopAndDestroy( cpath );                
+                }
+            else
+                {
+                // Handle Goto Music menu
+                CMPXCollectionPath* cpath = iCollectionUiHelper->MusicMenuPathL();
+                CleanupStack::PushL( cpath );
+                MPX_DEBUG_PATH (*cpath);
+                iCollectionUtility->Collection().OpenL( *cpath );
+                CleanupStack::PopAndDestroy( cpath );
+                }
+            // Make sure status pane layout is usual when going
+            // directly to music menu
+            // Status pane has to be modified before view gets deactivated
+            break;
+            }
+        case EMPXPbvCmdPlay:
+            {
+            if ( iEmbedded )
+                {
+                iPlaybackUtility->CommandL( EPbCmdDisableEffect );
+                }
+            iPlaybackUtility->CommandL( EPbCmdPlay );
+            break;
+            }
+        case EMPXPbvCmdStop:
+            {
+            iPlaybackUtility->CommandL( EPbCmdStop );
+            break;
+            }
+        case EMPXPbvCmdPause:
+            {
+            MPX_PERF_CHECKPT("Pause command issued");
+            iPlaybackUtility->CommandL( EPbCmdPause );
+            break;
+            }
+        case EMPXPbvCmdPlayPause:
+            {
+            iPlaybackUtility->CommandL( EPbCmdPlayPause );
+            break;
+            }
+        case EMPXPbvCmdSeekForward:
+            {
+            iSkipBtnPressed = ETrue;
+            iCommandSender = ECsRenderer;
+            if ( IsCommandSupportedL() )
+                {
+                iPlaybackUtility->CommandL( EPbCmdStartSeekForward );
+                if ( !iKeySoundDisabled )
+                    {
+                    iAvkonViewAppUi->KeySounds()->PushContextL(
+                        R_MPX_PBV_LEFT_RIGHT_KEYS_SILENT );
+                    iKeySoundDisabled = ETrue;
+                    }
+                }
+            iUnsupportedNoteDisabled = EFalse;
+            iIsffButtonPressed = ETrue;
+            break;
+            }
+        case EMPXPbvCmdSeekBackward:
+            {
+            iSkipBtnPressed = ETrue;
+            iCommandSender = ECsRenderer;
+            if ( IsCommandSupportedL() )
+                {
+                iPlaybackUtility->CommandL( EPbCmdStartSeekBackward );
+                if ( !iKeySoundDisabled )
+                    {
+                    iAvkonViewAppUi->KeySounds()->PushContextL(
+                        R_MPX_PBV_LEFT_RIGHT_KEYS_SILENT );
+                    iKeySoundDisabled = ETrue;
+                    }
+                }
+            iUnsupportedNoteDisabled = EFalse;
+            iIsffButtonPressed = ETrue;
+            break;
+            }
+        case EMPXPbvCmdEndSeek:
+            {
+            iSkipBtnPressed = EFalse;
+            iIsffButtonPressed = EFalse;
+			iUnsupportedNoteDisabled = EFalse;
+            iPlaybackUtility->CommandL( EPbCmdStopSeeking );
+            if ( iKeySoundDisabled )
+                {
+                iAvkonViewAppUi->KeySounds()->PopContext();
+                iKeySoundDisabled = EFalse;
+                }
+            break;
+            }
+        case EMPXPbvCmdNextListItem:
+            {
+            // When user skips a track, reset the start playback index
+            iStartPlaybackIndex = KErrNotFound;
+            iDelayedErrorTimer->Cancel();
+
+            iPlaybackUtility->CommandL( EPbCmdNext );
+            break;
+            }
+        case EMPXPbvCmdPreviousListItem:
+            {
+            // When user skips a track, reset the start playback index
+            iStartPlaybackIndex = KErrNotFound;
+            iDelayedErrorTimer->Cancel();
+
+            iPlaybackUtility->CommandL( EPbCmdPrevious );
+            break;
+            }
+        case EMPXPbvCmdDecreaseVolume:
+            {
+            iPlaybackUtility->CommandL( EPbCmdDecreaseVolume );
+            break;
+            }
+        case EMPXPbvCmdIncreaseVolume:
+            {
+            iPlaybackUtility->CommandL( EPbCmdIncreaseVolume );
+            break;
+            }
+         case EMPXPbvCmdPosition:
+            {
+            iIsTapped = ETrue;
+            iCommandSender = ECsRenderer;
+            if ( IsCommandSupportedL() && ( iCurrentPlayerType != EPbRemote ) )
+                {
+            TInt newPosition = iContainer->GetNewSongPosition();
+            iPlaybackUtility->SetL( EPbPropertyPosition, newPosition);
+                }
+            else
+                {
+                iUnsupportedNoteDisabled = EFalse;
+                }
+            break;
+            }
+        case EMPXPbvCmdRepeatOne:
+            {
+            iPlaybackUtility->SetL( EPbPropertyRepeatMode, EPbRepeatOne );
+            break;
+            }
+        case EMPXPbvCmdRepeatAll:
+            {
+            iPlaybackUtility->SetL( EPbPropertyRepeatMode, EPbRepeatAll );
+            break;
+            }
+        case EMPXPbvCmdRepeatOff:
+            {
+            iPlaybackUtility->SetL( EPbPropertyRepeatMode, EPbRepeatOff );
+            break;
+            }
+        case EMPXPbvCmdRandomOn:
+            {
+            iPlaybackUtility->SetL( EPbPropertyRandomMode, ETrue );
+            break;
+            }
+        case EMPXPbvCmdRandomOff:
+            {
+            iPlaybackUtility->SetL( EPbPropertyRandomMode, EFalse );
+            break;
+            }
+        case EMPXCmdAfterSaveUseAsCascade:
+            {
+            CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+            MPX_DEBUG1( "Todd CMPXCommonPlaybackViewImp::HandleCommandL aCommand=EMPXCmdAfterSaveUseAsCascade" );
+            FillAiwParametersL(paramList, ETrue);
+            iServiceHandler->ExecuteMenuCmdL(EMPXPbvCmdUseAsCascade, paramList,
+                iServiceHandler->OutParamListL());
+            break;
+            }
+        // The clip was saved before setting clip as profile ringtone
+        case EMPXCmdAfterSaveAiwCmdAssign:
+            {
+            CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+            MPX_DEBUG1( "Todd CMPXCommonPlaybackViewImp::HandleCommandL aCommand=EMPXCmdAfterSaveAiwCmdAssign" );
+            FillAiwParametersL(paramList, ETrue);
+            iServiceHandler->ExecuteMenuCmdL(EMPXPbvCmdAiwCmdAssign, paramList,
+                iServiceHandler->OutParamListL());
+            break;
+            }
+        case EMPXPbvCmdUseAsCascade:
+        case EMPXPbvCmdAiwCmdAssign:
+            {
+            CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+            FillAiwParametersL(paramList, EFalse);
+            iServiceHandler->ExecuteMenuCmdL(aCommand, paramList,
+                iServiceHandler->OutParamListL());
+            break;
+            }
+        case EMPXPbvCmdEqualizer:
+            {
+            LaunchEqualizerL();
+            break;
+            }
+        case EMPXPbvCmdOpenMusicSettings:
+            {
+            LaunchMusicSettingsL();
+            break;
+            }
+
+        case EMPXPbvCmdUpnpPlayViaLocal:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                SelectNewPlayerL( aCommand );
+                }
+            break;
+            }
+        case EMPXPbvCmdFMTransmitter:
+            {
+            LaunchFMTransmitterL();
+            break;
+            }
+        case EMPXPbvCmdAddToSavedPlaylist:
+            {
+            AddToSavedPlaylistL();
+            break;
+            }
+        case EMPXPbvCmdAddToNewPlaylist:
+            {
+            AddToNewPlaylistL();
+            break;
+            }
+        case EMPXCmdNext:
+        case EMPXCmdPrevious:
+            // When user skips a track, reset the start playback index
+            iStartPlaybackIndex = KErrNotFound;
+        case EMPXCmdPlay:
+        case EMPXCmdPause:
+        case EMPXCmdPlayPause:
+        case EMPXCmdStop:
+        case EMPXCmdSeekForward:
+        case EMPXCmdSeekBackward:
+        case EMPXCmdStopSeeking:
+            {
+            // check if current view is empty
+            TInt count( 0 );
+            MMPXSource* s = iPlaybackUtility->Source();
+            if ( s )
+                {
+                CMPXCollectionPlaylist* playlist = s->PlaylistL();
+                if ( playlist )
+                    {
+                    count = playlist->Count();
+                    }
+                delete playlist;
+                }
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+                AppUi()->HandleCommandL( aCommand );
+            count = count; // avoid compilation warning.
+#else
+            if ( count > 0 )
+                {
+                // only handle command if current playlist is not empty
+                AppUi()->HandleCommandL( aCommand );
+                }
+#endif
+            break;
+            }
+        case EMPXCmdVolumeUp:
+        case EMPXCmdVolumeDown:
+        case EMPXCmdVolumeMute:
+        case EMPXCmdVolumeUnMute:
+        case EMPXCmdVolumeChanged:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        default:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                if ( aCommand >= EMPXPbvCmdUpnpPlayViaRemotePlayer )
+                    {
+                    SelectNewPlayerL( aCommand );
+                    }
+                else
+                    {
+                    AppUi()->HandleCommandL( aCommand );
+                    }
+                }
+            else
+                {
+                AppUi()->HandleCommandL( aCommand );
+                }
+            break;
+            }
+        }
+    MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleCommandL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Processes user commands.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::ProcessCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2("CMPXCommonPlaybackViewImp::ProcessCommandL(%d): entering", aCommand);
+    if ( aCommand == EAknCmdExit )
+        {
+        if ( MenuBar() )
+            {
+            MenuBar()->StopDisplayingMenuBar();
+            }
+        HandleCommandL( aCommand );
+        }
+    CAknView::ProcessCommandL( aCommand );
+    MPX_DEBUG1("CMPXCommonPlaybackViewImp::ProcessCommandL(): exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Event handler for status pane size changes.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleStatusPaneSizeChange()
+    {
+    if ( iContainer && !iSwitchingView )
+        {
+        TUid activeView = iViewUtility->ActiveViewImplementationUid();
+        if ( KMPXEqualizerViewImplementationId == activeView )
+            {
+            iContainer->AdjustOrdinalPosition( KMPXPlaybackViewWindowBackground );
+            }
+        else 
+            {
+            iContainer->SetRect( ClientRect() );
+            iContainer->DrawDeferred();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Handles a view activation.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::DoActivateL(
+    const TVwsViewId& /* aPrevViewId */,
+    TUid /* aCustomMessageId */,
+    const TDesC8& /* aCustomMessage */ )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoActivateL()" );
+
+    iSwitchingView = EFalse;
+    iDatabaseNotReady = EFalse;
+	iUnsupportedNoteDisabled = EFalse;
+    delete iOldUri;
+    iOldUri = NULL;
+    CAknToolbar* toolbar = Toolbar();
+    if ( toolbar )
+        {
+        AppUi()->AddToStackL(toolbar, 
+        		ECoeStackPriorityCba,
+                ECoeStackFlagRefusesFocus 
+                | ECoeStackFlagRefusesAllKeys );
+        toolbar->MakeVisible( ETrue );
+        toolbar->HideItemsAndDrawOnlyBackground(EFalse);
+        toolbar->SetToolbarVisibility(ETrue);
+        }
+    PrepareStatusPaneForPlaybackViewL();
+
+    iRandomMode = KErrNotFound;
+    iRepeatMode = KErrNotFound;
+
+    iBacking = EFalse;
+    // Update view
+    // use idle call back since extracting album art binary data is slow
+    if ( iIdle )
+        {
+        if ( iIdle->IsActive() )
+            {
+            MPX_DEBUG1( "CMPXCommonPlaybackViewImp::DoActivateL() iIdle active, canceling" );
+            iIdle->Cancel();
+            }
+        delete iIdle;
+        iIdle = NULL;
+        }
+    iIdle = CIdle::NewL( CActive::EPriorityIdle );
+    iIdle->Start( TCallBack( CMPXCommonPlaybackViewImp::DeferredAlbumArtExtractCallback, this ) );
+
+    // Retrieve current repeat & random modes, fix for EJZU-7NZ9CD 
+    iPlaybackUtility->PropertyL( *this, EPbPropertyRandomMode );
+    iPlaybackUtility->PropertyL( *this, EPbPropertyRepeatMode );
+
+    // Set title
+    // Ignore errors from updating title pane since if that is not
+    // updated, still want to activate view
+    TRAP_IGNORE(
+        {
+        UpdateTitlePaneL();
+        CAknNavigationControlContainer* naviPane(
+            static_cast<CAknNavigationControlContainer*>
+            ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ))));
+        if ( naviPane )
+            {
+            naviPane->PushDefaultL();
+            }
+        } );
+
+    CEikButtonGroupContainer* cba = Cba();
+    if ( cba )
+        {
+        CCoeControl* control = cba->ButtonGroup()->AsControl();
+        static_cast<CEikCba*>( control )->
+            SetSkinBackgroundId( KAknsIIDQsnBgAreaControlMp );
+
+#ifdef __ENABLE_MSK
+        iCommonUiHelper->SetMiddleSoftKeyLabelL(
+            *cba,
+            R_TEXT_SOFTKEY_EMPTY,
+            EAknSoftkeyForwardKeyEvent );
+#endif // __ENABLE_MSK
+        }
+
+    iPlaybackState = iPlaybackUtility->StateL();
+    MPX_DEBUG2("CMPXCommonPlaybackViewImp::DoActivateL(): state = %d", iPlaybackState);
+    if ( iPlaybackState == EPbStateInitialising )
+        {
+        delete iMedia;
+        iMedia = NULL;
+        UpdatePlaybackState( iPlaybackState );
+        UpdateTrackInfoL( iMedia );
+        }
+    else
+        {
+        // reset iNewItemOpened when Playback view is activated when state is
+        //  not initializing (e.g. user pressed Go to Now Playing view)
+        MPX_DEBUG1("CMPXCommonPlaybackViewImp::DoActivateL() reset iNewItemOpened");
+#ifndef CAMESE_IN_DRM_UTILITY
+        if (iCameseSuperDistSupport)
+            {
+            iNewItemOpened = EFalse;
+            }
+#endif
+        if ( iMedia == NULL )
+            {
+            MMPXSource* s = iPlaybackUtility->Source();
+            if (  s )
+                {
+                CMPXCollectionPlaylist* playlist( s->PlaylistL() );
+                if ( playlist )
+                    {
+                    CleanupStack::PushL( playlist );
+                    if ( playlist->Count() > 0 )
+                        {
+                        RequestMediaL();
+                        UpdatePlaybackState( iPlaybackState );
+                        }
+                    else
+                        {
+                        // playlist count is 0, no tracks
+                        iPlaybackState = EPbStateNotInitialised;
+                        }
+                    CleanupStack::PopAndDestroy( playlist );
+                    }
+                else
+                    {
+                    // If empty playlist, then no tracks
+                    iPlaybackState = EPbStateNotInitialised;
+                    }
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// View deactivation function.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::DoDeactivate()
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoDeactivate()" );
+    iMPXUtility->CancelRequest();
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        iBacking = ETrue;
+        }
+    // Hide the toolbar when view is deactivated. Otherwise it may interfere
+    // with other views (e.g. Antriksh based collection view) that doesn't have
+    // toolbar to not draw correctly.
+    CAknToolbar* toolbar = Toolbar();
+    if ( toolbar )
+        {
+        toolbar->HideItemsAndDrawOnlyBackground(ETrue);
+        toolbar->SetToolbarVisibility(EFalse);
+        toolbar->MakeVisible(EFalse);
+        AppUi()->RemoveFromStack( toolbar );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Foreground event handling function.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleForegroundEventL( TBool aForeground )
+    {
+    MPX_DEBUG2( "--->CMPXCommonPlaybackViewImp::HandleForegroundEventL(%d)", aForeground );
+
+#ifdef BACKSTEPPING_INCLUDED
+    TInt statusInfo( KMPXBackSteppingNotConsumed );
+    MPX_DEBUG3("CMPXCommonPlaybackViewImp::HandleForegroundEventL - is in foreground=%d, this view=0x%x",
+        aForeground, Id().iUid );
+    if( aForeground &&
+        iViewUtility &&
+        ( iViewUtility->ActiveViewImplementationUid() != KNullUid ) )
+        {
+        TInt viewId( iViewUtility->ActiveViewType().iUid );
+        TBuf8<KMVPrefixLen + KMaxIntLen> buf;
+        buf.Copy( KMVPrefix );
+        buf.AppendNum( viewId );
+
+        TRAP_IGNORE(
+            statusInfo =
+                iBackSteppingUtility->ForwardActivationEventL( buf, ETrue );
+            );
+        MPX_DEBUG3("CMPXCommonPlaybackViewImp::HandleForegroundEventL - viewId=0x%x, statusInfo=%d", viewId, statusInfo );
+        }
+#endif // BACKSTEPPING_INCLUDED
+
+        // Reset state when view's visibility is changed.
+        iSwitchingView = EFalse;
+
+        CAknView::HandleForegroundEventL( aForeground );
+        if ( iContainer )
+            {
+            iContainer->HandleForegroundEventL( aForeground );
+            if ( aForeground )
+                {
+                if ( iMedia )
+                    {
+                    MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleForegroundEventL iMedia valid" );
+                    MMPXSource* s = iPlaybackUtility->Source();
+                    if ( s && iMedia->IsSupported( KMPXMediaGeneralId ) )
+                        {
+                        CMPXCollectionPlaylist* playlist = s->PlaylistL();
+                        if ( playlist )
+                            {
+                            MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleForegroundEventL playlist valid" );
+                            const CMPXCollectionPath& path = playlist->Path();
+                            TMPXItemId id( path.Id() );
+                            delete playlist;
+                            TMPXItemId cacheId(
+                                iMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+                            if ( id != cacheId )
+                                {
+                                MPX_DEBUG1( "CMPXCommonPlaybackViewImp::HandleForegroundEventL requesting media" );
+                                RequestMediaL();
+                                UpdateTitlePaneL();
+                                }
+                            }
+                        }
+                    }
+
+                iContainer->StartMarquee( ETextTrack );
+                iContainer->StartMarquee( ETextArtist );
+                iContainer->DrawNow();
+                }
+            }
+
+    // to stop seek when music player goes to background.
+    if ( !aForeground && iIsffButtonPressed )
+        {
+        iIsffButtonPressed = EFalse;
+        iContainer->RestoreButtons( iPlaybackState );
+        iPlaybackUtility->CommandL( EPbCmdStopSeeking );
+        }
+
+    MPX_DEBUG1( "<---CMPXCommonPlaybackViewImp::HandleForegroundEventL()" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    TInt usbUnblockingStatus;
+    RProperty::Get( KMPXViewPSUid,
+                    KMPXUSBUnblockingPSStatus, 
+                    usbUnblockingStatus);
+
+    switch ( aResourceId )
+        {
+        case R_MPX_PLAYBACK_VIEW_MENU:
+            {
+            if ( iIsffButtonPressed )
+                {
+                iIsffButtonPressed = EFalse;
+                iContainer->RestoreButtons( iPlaybackState );
+                iPlaybackUtility->CommandL( EPbCmdStopSeeking );
+                }
+            if ( !iMedia )
+                {
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdRandom,
+                    ETrue );
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdRepeat,
+                    ETrue );
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdFMTransmitter,
+                    ETrue );
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdUpnpPlayVia,
+                    ETrue );
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdEqualizer,
+                    ETrue );
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdOpenMusicSettings,
+                    ETrue );
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdAddToPlaylist,
+                    ETrue );
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdUseAsCascade,
+                    ETrue );
+                }
+            else
+                {
+                if ( KErrNotFound == iRandomMode && iEmbedded )
+                    {
+                    aMenuPane->SetItemDimmed(
+                        EMPXPbvCmdRandom,
+                        ETrue );
+                    }
+                if ( KErrNotFound == iRepeatMode && iEmbedded )
+                    {
+                    aMenuPane->SetItemDimmed(
+                        EMPXPbvCmdRepeat,
+                        ETrue );
+                    }
+
+                TBool addToPlDimmed( ETrue );
+                MMPXSource* s( iPlaybackUtility->Source() );
+                if ( s )
+                    {
+                    CMPXCollectionPlaylist* playlist( s->PlaylistL() );
+                    if ( playlist )
+                        {
+                        CleanupStack::PushL( playlist );
+                        TInt count( playlist->Count() );
+                        if ( count > 0 )
+                            {
+                            addToPlDimmed = EFalse;
+                            }
+                        CleanupStack::PopAndDestroy( playlist );
+                        }
+                    }
+                if ( usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive )
+                    {
+                    aMenuPane->SetItemDimmed( EMPXPbvCmdAddToPlaylist, ETrue );
+                    }
+                else
+                    {
+                    aMenuPane->SetItemDimmed( EMPXPbvCmdAddToPlaylist, addToPlDimmed );
+                    }
+                TBool isOfflineMode( EFalse );
+                TBool isFormatNotSupported( EFalse );
+                if ( !isOfflineMode && iMedia )
+                    {
+                    if ( iMedia->IsSupported( KMPXMediaDrmProtected ) )
+                        {
+                        if ( iMedia->ValueTObjectL<TBool>( KMPXMediaDrmProtected ) &&
+                            iMedia->IsSupported( KMPXMediaDrmCanSetAutomated ) )
+                            {
+                            // if it's drm protected, check if
+                            // KMPXMediaDrmCanSetAutomated
+                            isFormatNotSupported = !(
+                                iMedia->ValueTObjectL<TBool>( KMPXMediaDrmCanSetAutomated ) );
+                            }
+                        }
+                    }
+                    aMenuPane->SetItemDimmed(
+                        EMPXPbvCmdUseAsCascade,
+                    !iMedia || isFormatNotSupported ||
+                        iPlaybackState == EPbStateInitialising );
+
+                // if help is not enabled, do not show "help"
+                if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
+                    {
+                    aMenuPane->SetItemDimmed(
+                        EAknCmdHelp,
+                        ETrue );
+                    }
+
+                // Check if FM Transmitter is supported
+                if ( !FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+					{
+					aMenuPane->SetItemDimmed(
+						EMPXPbvCmdFMTransmitter,
+						ETrue );
+					}
+
+
+                if ( iUpnpFrameworkSupport )
+                    {
+                    if ( !iMedia || !IsUpnpVisible() )
+                        {
+                        GetCurrentPlayerDetails();
+                        if ( iCurrentPlayerType == EPbLocal )
+                            {
+                            aMenuPane->SetItemDimmed(
+                                EMPXPbvCmdUpnpPlayVia,
+                                ETrue);
+                            }
+                        }
+                    }
+                else
+                    {
+                    aMenuPane->SetItemDimmed( EMPXPbvCmdUpnpPlayVia, ETrue);
+                    }
+            aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden );
+                if (iServiceHandler->HandleSubmenuL(*aMenuPane))
+                    {
+                    return;
+                    }
+                }
+            break;
+            }
+        case R_MPX_PLAYBACK_PLAY_VIA_SUB_MENU:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                AddPlayersNamesToMenuL( *aMenuPane );
+                }
+            break;
+            }
+        case R_MPX_PLAYBACK_REPEAT_SUB_MENU:
+            {
+            TInt symbolOff = EEikMenuItemSymbolIndeterminate;
+            TInt symbolAll = EEikMenuItemSymbolIndeterminate;
+            TInt symbolOne = EEikMenuItemSymbolIndeterminate;
+
+            if ( EPbRepeatOff == iRepeatMode )
+                {
+                symbolOff = EEikMenuItemSymbolOn;
+                }
+            else if ( EPbRepeatAll == iRepeatMode )
+                {
+                symbolAll = EEikMenuItemSymbolOn;
+                }
+            else
+                {
+                symbolOne = EEikMenuItemSymbolOn;
+                }
+
+            aMenuPane->SetItemButtonState(
+                EMPXPbvCmdRepeatOff,
+                symbolOff );
+            aMenuPane->SetItemButtonState(
+                EMPXPbvCmdRepeatAll,
+                symbolAll );
+            aMenuPane->SetItemButtonState(
+                EMPXPbvCmdRepeatOne,
+                symbolOne );
+            break;
+            }
+        case R_MPX_PLAYBACK_RANDOM_SUB_MENU:
+            {
+            TInt symbolOff = EEikMenuItemSymbolOn;
+            TInt symbolOn = EEikMenuItemSymbolIndeterminate;
+
+            if ( iRandomMode )
+                {
+                symbolOff = EEikMenuItemSymbolIndeterminate;
+                symbolOn = EEikMenuItemSymbolOn;
+                }
+
+            aMenuPane->SetItemButtonState(
+                EMPXPbvCmdRandomOn,
+                symbolOn );
+            aMenuPane->SetItemButtonState(
+                EMPXPbvCmdRandomOff,
+                symbolOff );
+            break;
+            }
+        case R_MPX_PBV_ADD_TO_PL_SUB_MENU:
+            {
+            TBool dim( ETrue );
+            delete iUserPlaylists;
+            iUserPlaylists = NULL;
+            iUserPlaylists = iCommonUiHelper->FindPlaylistsL();
+            if ( iUserPlaylists )
+                {
+                const CMPXMediaArray* mediaArray =
+                    iUserPlaylists->Value<CMPXMediaArray>(
+                    KMPXMediaArrayContents );
+                User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+               
+                TInt entriesCount( mediaArray->Count() );
+                MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DynInitMenuPaneL Entry count = %d", entriesCount );
+                if ( entriesCount > 0 )
+                    {
+                    dim = EFalse;
+                    }
+                }
+            aMenuPane->SetItemDimmed( EMPXPbvCmdAddToSavedPlaylist, dim );
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+    if ( iServiceHandler->IsAiwMenu(aResourceId))
+        {
+        MPX_DEBUG1( "CMPXCollectionViewImp::DynInitMenuPaneL(): Aiw menu for assign" );
+        CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
+        FillAiwParametersL(paramList, EFalse);
+        iServiceHandler->InitializeMenuPaneL(*aMenuPane,
+                                            aResourceId,
+                                            EMPXPbvCmdAiwCmdAssign,
+                                            paramList);
+        MPX_DEBUG1( "CMPXCollectionViewImp::DynInitMenuPaneL(): Aiw menu for assign end" );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXLayoutSwitchObserver
+// Callback function when layout is changed.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleLayoutChange()
+    {
+    iContainer->ExtractAlbumArtCompleted( NULL, KErrNone );
+    if (iContainer && !iSwitchingView)
+        {
+        if ( !Layout_Meta_Data::IsLandscapeOrientation() )
+            {
+            TUid activeView = iViewUtility->ActiveViewImplementationUid();
+            
+            // only switch to flat if current view is not equalizer
+            // since it'll mess up equilizer's screen
+            if ( StatusPane()->CurrentLayoutResId() !=
+                 R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT &&
+                 activeView != KMPXEqualizerViewImplementationId )
+                {
+                TRAP_IGNORE(
+                    StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ));
+                }
+            }
+        else
+            {
+            if ( StatusPane()->CurrentLayoutResId() !=
+                 R_AVKON_STATUS_PANE_LAYOUT_USUAL )
+                {
+                TRAP_IGNORE(
+                    StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ));
+                }
+            }
+
+        iContainer->SetRect( ClientRect() );
+        delete iOldUri;
+        iOldUri = NULL;         
+        // Update album art
+        TRAP_IGNORE( UpdateAlbumArtL( iMedia ));
+        TRAP_IGNORE( UpdateTrackInfoL( iMedia ));
+        iContainer->DrawDeferred();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MCoeViewDeactivationObserver
+// Handles the activation of the view aNewlyActivatedViewId before
+// the old view aViewIdToBeDeactivated is to be deactivated.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleViewActivation(
+    const TVwsViewId& aNewlyActivatedViewId,
+    const TVwsViewId& aViewIdToBeDeactivated )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleViewActivation AV" );
+    // Check if this view is going to be deactivated
+    if ( aViewIdToBeDeactivated.iViewUid == Id() )
+        {
+        if ( aNewlyActivatedViewId.iViewUid != Id() )
+            {
+            iSwitchingView = ETrue;
+            }
+        }
+
+    if ( iPBViewToBeActivated )
+        {
+        iLastPBViewActivated = ( aNewlyActivatedViewId.iViewUid == Id() );
+        MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleViewActivation iLastPBViewActivated %d", iLastPBViewActivated );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXViewActivationObserver
+// Handle view activation.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleViewActivation(
+    const TUid& aCurrentViewType,
+    const TUid& /*aPreviousViewType*/ )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::HandleViewActivation VF" );
+    iPBViewToBeActivated = ( KMPXPluginTypePlaybackUid == aCurrentViewType.iUid );
+    MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleViewActivation iPBViewToBeActivated %d", iPBViewToBeActivated );
+    }
+// ---------------------------------------------------------------------------
+// From MMPXViewActivationObserver
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleViewUpdate(
+    TUid /* aViewUid */,
+    MMPXViewActivationObserver::TViewUpdateEvent /* aUpdateEvent */,
+    TBool /* aLoaded */,
+    TInt /* aData */)
+    {
+    // Do nothing, this should be handled by the AppUI
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPSKeyObserver
+// Handle PS event
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandlePSEvent(
+    TUid aUid,
+    TInt aKey )
+    {
+    MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandlePSEvent %d", aKey );
+
+   	if ( aUid == KPSUidHWRMFmTx && aKey == KHWRMFmTxStatus )
+       	{
+       	// only responds to FM TX key value change
+       	TRAP_IGNORE( UpdateFMTransmitterInfoL() );
+       	}
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCenRepObserver
+// Handle PS event
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleSettingChange(
+    const TUid& aRepositoryUid,
+    TUint32 aSettingId )
+    {
+    MPX_DEBUG2( "CMPXCommonPlaybackViewImp::HandleSettingChange %d", aSettingId );
+
+	if ( aRepositoryUid == KCRUidFmTxCenRes &&
+		 aSettingId == KFmTxCenResKeyFrequency )
+		{
+		// only responds to FM Tx Frequency value change
+		TRAP_IGNORE( UpdateFMTransmitterInfoL() );
+		}
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::IsUpnpVisible
+// Taken from Gallery upnp support implementation
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonPlaybackViewImp::IsUpnpVisible()
+    {
+    MPX_FUNC( "CMPXCommonPlaybackViewImp::IsUpnpVisible" );
+    TBool returnValue = EFalse;
+    
+#ifdef UPNP_INCLUDED
+   	if ( iUpnpCopyCommand && iUpnpFrameworkSupport ) 	  
+        {
+        returnValue = iUpnpCopyCommand->IsAvailableL();   
+        }
+#endif
+    return returnValue; 
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::AddPlayersNamesToMenuL
+// Add all available players names to the Play via submenu
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::AddPlayersNamesToMenuL(
+    CEikMenuPane& aMenuPane )
+    {
+    if ( iUpnpFrameworkSupport )
+        {
+        RArray<TMPXPlaybackPlayerType> playerTypes;
+        CleanupClosePushL(playerTypes);
+
+        MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+        manager.GetPlayerTypesL(playerTypes);
+
+        GetCurrentPlayerDetails();
+
+        TInt countPlayersTypes( playerTypes.Count() );
+        TInt countLocalType( 0 );
+        TInt countRemoteType( 0 );
+
+        if ( countPlayersTypes >= 1 )
+            {
+            iPlayersList.Close();
+
+            for ( TInt i = 0; i < countPlayersTypes; i++)
+                {
+                MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] );
+                switch (playerTypes[i])
+                    {
+                    case EPbLocal:
+                        {
+                        // we only show 1 specific type once in the menu
+                        if ( countLocalType == 0 )
+                            {
+                            AddPlayerNameToMenuL( aMenuPane,
+                                                EMPXPbvCmdUpnpPlayViaLocal,
+                                                manager,
+                                                playerTypes[i] );
+
+                            countLocalType++;
+                            }
+                        break;
+                        }
+                    case EPbRemote:
+                        {
+                        // we only show 1 specific type once in the menu
+                        if ( countRemoteType == 0 )
+                            {
+                            AddPlayerNameToMenuL( aMenuPane,
+                                                EMPXPbvCmdUpnpPlayViaRemotePlayer,
+                                                manager,
+                                                playerTypes[i] );
+                            countRemoteType++;
+                            }
+                        break;
+                        }
+                    default:
+                        {
+                        // default case is handled in the next loop, we want
+                        // to add any "other" player at the end of the list
+                        break;
+                        }
+                    }
+                } // for loop
+
+            for ( TInt i = 0; i < countPlayersTypes; i++)
+                {
+                MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] );
+                // EPbLocal and EPbRemote were already added to the
+                // submenu in the previous loop
+                if ( playerTypes[i] != EPbLocal &&
+                     playerTypes[i] != EPbRemote )
+                    {
+                    // EPbUnknown or else
+                    TBool alreadyInTheList( EFalse );
+
+                    for ( TInt j = 0; j < i; j++)
+                        {
+                        // if the new playertype is already in the list
+                        if ( playerTypes[i] == playerTypes[j] )
+                            {
+                            alreadyInTheList = ETrue;
+                            break;
+                            }
+                        }
+
+                    if ( !alreadyInTheList )
+                        {
+                        HBufC* buf = manager.PlayerTypeDisplayNameL(playerTypes[i]);
+
+                        if ( buf )
+                            {
+                            CleanupStack::PushL(buf);
+                            AddPlayerNameToMenuL( aMenuPane,
+                                                EMPXPbvCmdUpnpPlayViaRemotePlayer,
+                                                manager,
+                                                playerTypes[i],
+                                                *buf );
+                            CleanupStack::PopAndDestroy(buf);
+                            }
+                        // else we don't do anything. other player type is not
+                        // currently supported. Implementation will be finalized
+                        // when the requirement is defined.
+                        }
+                    }
+                }
+            }
+
+        CleanupStack::PopAndDestroy(&playerTypes);
+
+        if ( iPlayersList.Count() <= 1 )
+            {
+            aMenuPane.SetItemDimmed( EMPXPbvCmdUpnpPlayViaRemotePlayer,
+                                      ETrue );
+            }
+        }
+    else
+        {
+        // Remove compilation warnings
+        (void)aMenuPane;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::AddPlayerNameToMenuL
+// Add 1 player name to the submenu
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::AddPlayerNameToMenuL(
+    CEikMenuPane& aMenuPane,
+    TInt aCommandId,
+    MMPXPlayerManager& aPlayerManager,
+    TMPXPlaybackPlayerType& aPlayerType,
+    const TDesC& aMenuText )
+    {
+    if ( iUpnpFrameworkSupport )
+        {
+        RArray<TUid> players;
+        CleanupClosePushL(players);
+        aPlayerManager.GetPlayerListL(players, aPlayerType);
+
+        // For now we only keep the first player we find
+        // Local player is always the first one in the list
+        // Ui spec limitation
+        MPX_DEBUG2( "players[0]: %d", players[0].iUid );
+        if ( aCommandId == EMPXPbvCmdUpnpPlayViaLocal )
+            {
+            iPlayersList.Insert(players[0], 0);
+            }
+        else if ( ( aCommandId == EMPXPbvCmdUpnpPlayViaRemotePlayer ) &&
+                  (iPlayersList.Count() > 1) )
+            {
+            iPlayersList.Insert(players[0], 1);
+            }
+        else
+            {
+            iPlayersList.AppendL(players[0]);
+            }
+        CleanupStack::PopAndDestroy(&players);
+
+        // if the player is of unknown type
+        if ( ( aCommandId != EMPXPbvCmdUpnpPlayViaRemotePlayer ) &&
+             ( aCommandId != EMPXPbvCmdUpnpPlayViaLocal ) )
+            {
+            CEikMenuPaneItem::SData menuItem;
+            menuItem.iText.Copy( aMenuText );
+            menuItem.iCascadeId = 0;
+            menuItem.iFlags = EEikMenuItemRadioEnd;
+
+            menuItem.iCommandId = aCommandId + (iPlayersList.Count() - 1);
+            aCommandId = menuItem.iCommandId;
+
+            aMenuPane.AddMenuItemL( menuItem );
+            }
+
+        if ( iCurrentPlayerType == aPlayerType )
+            {
+            aMenuPane.SetItemButtonState( aCommandId, EEikMenuItemSymbolOn );
+            }
+        }
+    else
+        {
+        // Remove compilation warnings
+        (void)aMenuPane;
+        (void)aCommandId;
+        (void)aPlayerManager;
+        (void)aPlayerType;
+        (void)aMenuText;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::GetCurrentPlayerDetails
+// Retrieves the current player name and type
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::GetCurrentPlayerDetails()
+    {
+    if ( iUpnpFrameworkSupport )
+        {
+
+        MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+        TUid currentlyUsedPlayer;
+        TInt currentlyUsedSubPlayer;
+        iCurrentPlayerType = EPbLocal;
+        delete iSubPlayerName;
+        iSubPlayerName = NULL;
+
+        TRAP_IGNORE( manager.GetSelectionL( iCurrentPlayerType,
+                                            currentlyUsedPlayer,
+                                            currentlyUsedSubPlayer,
+                                            iSubPlayerName) );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::SelectNewPlayerL
+// Selects a new player for audio playback
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::SelectNewPlayerL(
+    TInt aCommand )
+    {
+    if ( iUpnpFrameworkSupport )
+        {
+        MPX_FUNC_EX( "CMPXPlaybackViewImp::SelectNewPlayerL()" );
+        MPX_DEBUG2( "CMPXPlaybackViewImp::SelectNewPlayerL(%d)", aCommand );
+
+        TInt errorSelectPlayer( KErrCancel );
+
+        MMPXSource* source = iPlaybackUtility->Source();
+        CMPXCollectionPlaylist* playlist = NULL;
+        if ( source )
+            {
+            playlist = source->PlaylistL();
+            if ( playlist )
+                {
+                iPlaybackUtility->CommandL(EPbCmdPreserveState);
+                CleanupStack::PushL( playlist );
+                }
+            }
+
+        switch (aCommand)
+            {
+            case EMPXPbvCmdUpnpPlayViaLocal:
+                {
+                // if Local is not already the current player, select it
+                if ( iCurrentPlayerType != EPbLocal )
+                    {
+                    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+                    MPX_TRAP( errorSelectPlayer, manager.ClearSelectPlayersL() );
+                    }
+                break;
+                }
+            default:
+                {
+                if ( aCommand >= EMPXPbvCmdUpnpPlayViaRemotePlayer )
+                    {
+                    HBufC* buf = HBufC::NewLC( KMaxUidName );
+                    buf->Des().AppendNum(
+                         (iPlayersList[aCommand -
+                                       EMPXPbvCmdUpnpPlayViaLocal]).iUid );
+
+                    // ActivateViewL leaves with KErrCancel if the dialog is
+                    // cancelled
+                    // ActivateViewL leaves with KErrInUse if the selected player
+                    // is already the active player
+                    MPX_TRAP(errorSelectPlayer, iViewUtility->ActivateViewL(
+                                    TUid::Uid( KMPXPluginTypeUPnPBrowseDialogUid ),
+                                    buf ));
+                    CleanupStack::PopAndDestroy( buf );
+                    }
+                break;
+                }
+            }
+
+        // A new player was successfully selected, playback view changes
+        if ( errorSelectPlayer == KErrNone )
+            {
+            if ( playlist )
+                {
+                iViewUtility->PushDefaultHistoryL();
+                iPlaybackUtility->InitL( *playlist, ETrue );
+                }
+            }
+
+        if (playlist)
+            {
+            CleanupStack::PopAndDestroy( playlist );
+            }
+        }
+    else
+        {
+        // Remove compilation warnings
+        (void)aCommand;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::AddToSavedPlaylistL
+// Adds current item to a saved playlist
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::AddToSavedPlaylistL()
+    {
+    MPX_DEBUG1("CMPXPlaybackViewImp::AddToSavedPlaylistL(): entering");
+
+    ASSERT( iMedia );
+    if ( !iUserPlaylists )
+        {
+        iUserPlaylists = iCommonUiHelper->FindPlaylistsL();
+        }
+
+    CMPXMedia* media = PrepareMediaForPlaylistLC( *iMedia );
+    MPX_TRAPD( err, iCommonUiHelper->AddToSavedPlaylistL(
+        *iUserPlaylists,
+        *media,
+        this,
+        this ) );
+    CleanupStack::PopAndDestroy( media );
+    if ( KErrNone != err )
+        {
+        HandleErrorL( err );
+        }
+    delete iUserPlaylists;
+    iUserPlaylists = NULL;
+
+    MPX_DEBUG1("CMPXPlaybackViewImp::AddToSavedPlaylistL(): exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::AddToNewPlaylistL
+// Adds current item to a new playlist
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::AddToNewPlaylistL()
+    {
+    MPX_DEBUG1("CMPXPlaybackViewImp::AddToNewPlaylistL(): entering");
+
+    if ( iMedia )
+        {
+        CMPXMedia* media( PrepareMediaForPlaylistLC( *iMedia ));
+        iCommonUiHelper->CreatePlaylistL(
+            *media,
+            this,
+            this );
+        CleanupStack::PopAndDestroy( media );
+        }
+    delete iUserPlaylists;
+    iUserPlaylists = NULL;
+
+    MPX_DEBUG1("CMPXPlaybackViewImp::AddToNewPlaylistL(): exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// PrepareMediaForPlaylistLC
+// Prepares media for adding to a playlist
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXMedia* CMPXCommonPlaybackViewImp::PrepareMediaForPlaylistLC(
+    const CMPXMedia& aMedia )
+    {
+    MPX_DEBUG1("CMPXPlaybackViewImp::PrepareMediaForPlaylistLC() entering");
+
+    CMPXMedia* media = CMPXMedia::NewL();
+    CleanupStack::PushL( media );
+    CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
+    CleanupStack::PushL( mediaArray );
+    CMPXMedia* entry = CMPXMedia::NewL( aMedia );
+    CleanupStack::PushL( entry );
+    mediaArray->AppendL( entry );
+    CleanupStack::Pop( entry );
+    media->SetCObjectValueL(
+        KMPXMediaArrayContents,
+        mediaArray );
+    media->SetTObjectValueL(
+        KMPXMediaArrayCount,
+        mediaArray->Count() );
+    CleanupStack::PopAndDestroy( mediaArray );
+    MPX_DEBUG1("CMPXPlaybackViewImp::PrepareMediaForPlaylistLC() exiting");
+    return media;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::IsCommandSupportedL
+// Check if the command is supported by the remote player
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TBool CMPXCommonPlaybackViewImp::IsCommandSupportedL()
+    {
+    TBool forwardCommand = ETrue;
+    if ( iUpnpFrameworkSupport && IsUpnpVisible() )
+        {
+        // retrieve iCurrentPlayerType info
+        GetCurrentPlayerDetails();
+
+        if ( iCurrentPlayerType != EPbLocal)
+            {
+            // show error note, only in first key press
+		    if( !iUnsupportedNoteDisabled )
+			    {
+			    iUnsupportedNoteDisabled = ETrue;
+			    iOldPosition = iPosition;
+			    if( iContainer && iIsTapped )
+			        {
+			        iContainer->SetNewSongPosition( iPosition * KMPXOneSecInMilliSecs );
+			        }
+			    HBufC* dialogText = NULL;
+			    TBool setText = EFalse;
+                switch ( iCommandSender )
+                    {
+                    case ECsMediaKey:
+                        {
+                        dialogText = StringLoader::LoadLC( R_MPX_MEDIA_KEYS_NOT_SUPPORTED );
+                        setText = ETrue;
+                        break;
+                        }
+                    case ECsRenderer:
+                        {
+                        dialogText = StringLoader::LoadLC( R_MPX_REQUEST_REJECTED );
+                        setText = ETrue;
+                        break;
+                        }
+                    default:
+                        {
+                        break;
+                        }
+                    }
+                
+                if( setText )
+                    {
+                CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+                errNote->SetTimeout(CAknNoteDialog::ELongTimeout);
+                errNote->ExecuteLD( *dialogText );
+                CleanupStack::PopAndDestroy( dialogText );
+                forwardCommand = EFalse;
+                    }
+			    }
+            }
+        }
+    return forwardCommand;
+    }
+
+// ---------------------------------------------------------------------------
+// From MProgressDialogCallback
+// Callback method. Get's called when a dialog is dismissed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::DialogDismissedL( TInt aButtonId )
+    {
+    MPX_DEBUG2("--->CMPXCommonPlaybackViewImp::DialogDismissedL(%d)", aButtonId);
+    switch (aButtonId)
+        {
+        case EAknSoftkeyCancel:
+        case EAknSoftkeyDone:
+            {
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    MPX_DEBUG1("<---CMPXCommonPlaybackViewImp::DialogDismissedL()");
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCHelperObserver
+// Callback method. Get's called when a dialog is dismissed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleOperationCompleteL( TCHelperOperation /*aOperation*/,
+                                                                   TInt aError,
+                                                                   void* aArgument )
+    {
+    MPX_DEBUG2("CMPXPlaybackViewImp::HandleAddCompletedL(%d) entering", aError);
+
+    CMPXMedia* playlist = (CMPXMedia*) aArgument;
+    CleanupStack::PushL( playlist );
+
+    iCommonUiHelper->DismissWaitNoteL();
+    if ( KErrNone == aError )
+        {
+        const TDesC& title( playlist->ValueText( KMPXMediaGeneralTitle ) );
+        HBufC* confirmTxt( StringLoader::LoadLC(
+            R_MPX_QTN_MUS_NOTE_TRACK_ADDED_TO_PL,
+            title ));
+        CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote();
+
+        TMPlayerSecondaryDisplayNote noteId( EMPlayerNoteAddSongToPlaylist );
+        note->PublishDialogL(
+            noteId,
+            KMPlayerNoteCategory );
+        CAknMediatorFacade* covercl( AknMediatorFacade( note ) );
+        if ( covercl )
+            {
+            covercl->BufStream() << title;
+            }
+
+        note->ExecuteLD( *confirmTxt );
+        CleanupStack::PopAndDestroy( confirmTxt );
+        }
+    else
+        {
+        HandleErrorL( aError );
+        }
+    CleanupStack::PopAndDestroy( playlist );
+    MPX_DEBUG1("CMPXPlaybackViewImp::HandleAddCompletedL() exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleCollectionMessage(CMPXMessage* aMsg,
+                                                                 TInt aErr )
+    {
+    TRAP_IGNORE( DoHandleCollectionMessageL( aMsg, aErr ) );
+    }
+
+// -----------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleOpenL(const CMPXMedia& /*aEntries*/, TInt /*aIndex*/,
+                                                     TBool /*aComplete*/, TInt /*aError*/)
+    {
+    // Do Nothing
+    }
+
+// -----------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleOpenL(const CMPXCollectionPlaylist& /*aPlaylist*/,
+                                                     TInt /*aError*/)
+    {
+    // Do Nothing
+    }
+
+// -----------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::HandleCommandComplete(CMPXCommand* /*aCommandResult*/,
+                                                               TInt /*aError*/)
+    {
+    // Do Nothing
+    }
+
+// ----------------------------------------------------------------------------
+// void CMPXCommonPlaybackViewImp::DeferredAlbumArtExtractCallback
+// call back function for deferred view updates.
+// ----------------------------------------------------------------------------
+//
+TInt CMPXCommonPlaybackViewImp::DeferredAlbumArtExtractCallback( TAny* aPtr )
+    {
+    MPX_FUNC( "CMPXCommonPlaybackViewImp::DeferredAlbumArtExtractCallback" );
+    CMPXCommonPlaybackViewImp* self =
+        static_cast<CMPXCommonPlaybackViewImp*>( aPtr );
+    TRAP_IGNORE( self->UpdateViewL() );
+    return KErrNone;
+    }
+
+//----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::DelayedExit
+// call back function for delayed view deactivation
+//----------------------------------------------------------------------------
+//
+TInt CMPXCommonPlaybackViewImp::DelayedExit( TAny* aPtr )
+    {
+    MPX_FUNC( "CMPXCommonPlaybackViewImp::DelayedExit" );
+    CMPXCommonPlaybackViewImp* self =
+        static_cast<CMPXCommonPlaybackViewImp*>( aPtr );
+    TRAP_IGNORE( self->HandleCommandL(EAknSoftkeyBack) );
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback error message.
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonPlaybackViewImp::DoHandleErrorPlaybackMessageL( TInt aError )
+    {
+    MPX_DEBUG2( "CMPXCommonPlaybackViewImp::DoHandleErrorPlaybackMessage(): Handle the error %d", aError);
+
+    // Request media to handle error. We need to do that in
+    // order to request DRM details.
+    iDelayedError = aError;
+    RequestMediaL( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// Handle collection message
+// ---------------------------------------------------------------------------
+//
+void CMPXCommonPlaybackViewImp::DoHandleCollectionMessageL(
+    CMPXMessage* aMsg, TInt /*aErr*/ )
+    {
+    MPX_FUNC_EX( "CMPXCommonPlaybackViewImp::DoHandleCollectionMessageL" );
+    if( aMsg )
+        {
+        TMPXMessageId id( aMsg->ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+        if ( KMPXMessageGeneral == id )
+            {
+            TInt event( aMsg->ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+            TInt op( aMsg->ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+            TInt data( aMsg->ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+
+            if( event == TMPXCollectionMessage::EBroadcastEvent &&
+                op == EMcMsgDiskRemoved &&
+                iContainer &&
+                iViewUtility->ActiveViewType() != TUid::Uid(KMPXPluginTypeWaitNoteDialogUid) )
+                {
+                TRAP_IGNORE( AknDialogShutter::ShutDialogsL( *CEikonEnv::Static() ) );
+                StopDisplayingMenuBar();
+                TRAP_IGNORE( UpdateTitlePaneL() );  // some dialogs change the title. ie equalizer
+                }
+            else if( event == TMPXCollectionMessage::EBroadcastEvent )
+                {
+                if( op == EMcMsgUSBMassStorageStart ||
+                    op == EMcMsgUSBMTPStart ||
+                    op == EMcMsgFormatStart )
+                    {
+                    iDatabaseNotReady = ETrue;
+                    }
+                else if( op == EMcMsgUSBMassStorageEnd ||
+                         op == EMcMsgUSBMTPEnd ||
+                         op == EMcMsgFormatEnd )
+                    {
+                    iDatabaseNotReady = EFalse;
+                    }
+                else if( op == EMcMsgDiskInserted )
+                    {
+                    // Need to reset the prev/next buttons state if they are pressed at the moment.
+                    if (iSkipBtnPressed)
+                        {
+                        if ( AknLayoutUtils::PenEnabled() )
+                            {
+                            if ( Toolbar() )
+                                {
+                                CAknToolbar* toolbar = Toolbar();
+                                CAknButton* skipControl;
+                                skipControl = (CAknButton*)(toolbar->ComponentControl( 0 ));
+                                skipControl->ResetState();
+                                skipControl->DrawNow();
+
+                                skipControl = (CAknButton*)(toolbar->ComponentControl( 2 ));
+                                skipControl->ResetState();
+                                skipControl->DrawNow();
+                                }
+                            }
+                        iSkipBtnPressed = EFalse;
+                        }
+                    }
+                }
+            else if (event == TMPXCollectionMessage::EPathChanged &&
+                     op == EMcPathChangedByOpen &&
+                     data == EMcItemOpened)
+                { // Open new entries
+                MPX_DEBUG1("CMPXPlaybackViewImp::HandleCollectionMessage() New Item Opened");
+                iNewItemOpened = ETrue;
+                delete iMedia;
+                iMedia = NULL;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonPlaybackViewImp::FillAiwParameters
+// -----------------------------------------------------------------------------
+//
+void CMPXCommonPlaybackViewImp::FillAiwParametersL(
+    CAiwGenericParamList& aParamList, TBool aSaved )
+    {
+    TFileName location(NULL);
+    if ( aSaved )
+        {
+        location = MPXTlsHelper::FilePath();
+        }
+
+    if ( !location.Length())
+        {
+        location = iMedia->ValueText( KMPXMediaGeneralUri );
+        }
+
+    MPX_DEBUG1( "Todd CMPXCommonPlaybackViewImp::FillAiwParametersL location=" );
+    #ifdef _DEBUG
+        RDebug::RawPrint(location);
+    #endif
+
+    TPtrC mimeType(iMedia->ValueText( KMPXMediaGeneralMimeType ));
+    MPX_DEBUG1( "Todd CMPXCommonPlaybackViewImp::FillAiwParametersL mime=" );
+    #ifdef _DEBUG
+        RDebug::RawPrint(mimeType);
+    #endif
+    TAiwVariant varMime(mimeType);
+    if ( !mimeType.Length() && ( iMediaRecognizer ) )
+        {
+        varMime.Set(iMediaRecognizer->MimeTypeL(location));
+        }
+    TAiwGenericParam paramMime(EGenericParamMIMEType, varMime);
+    aParamList.Reset();
+    aParamList.AppendL(paramMime);
+    TAiwVariant varFile(location);
+    TAiwGenericParam paramFile(EGenericParamFile, varFile);
+    aParamList.AppendL(paramFile);
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the middle softkey display
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::UpdateMiddleSoftKeyDisplayL()
+    {
+    MPX_FUNC("CMPXCommonPlaybackViewImp::UpdateMiddleSoftKeyDisplayL");
+
+    if (iContainer)
+            {
+        CEikButtonGroupContainer* cba = Cba();
+        if (cba)
+            {
+            MMPXSource* s = iPlaybackUtility->Source();
+            if ( s )
+                {
+                CMPXCollectionPlaylist* playlist = s->PlaylistL();
+                if ( playlist )
+                    {
+                    if ( playlist->Count() > 0 )
+                        {
+                        TMPXPlaybackState state = iPlaybackUtility->StateL();
+
+                        if ((state == EPbStateInitialising) ||(state == EPbStatePlaying))
+                            {
+                            iCommonUiHelper->SetMiddleSoftKeyLabelL( *cba, R_QTN_MSK_PAUSE, EAknSoftkeyForwardKeyEvent);
+                            }
+                        else
+                            {
+                            iCommonUiHelper->SetMiddleSoftKeyLabelL( *cba, R_QTN_MSK_PLAY, EAknSoftkeyForwardKeyEvent);
+                            }
+                        }
+                    delete playlist;
+                    }
+                }
+            MPX_DEBUG1("CMPXCommonPlaybackViewImp::UpdateMiddleSoftKeyDisplayL - new label displayed");
+
+            cba->DrawDeferred();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the middle toolbar button
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewImp::UpdateToolbar()
+    {
+    MPX_FUNC("CMPXCommonPlaybackViewImp::UpdateToolbar");
+
+    if ( AknLayoutUtils::PenEnabled() )
+        {
+        if ( Toolbar() )
+            {
+            CAknToolbar* toolbar = Toolbar();
+            toolbar->SetDimmed( EFalse );
+            CAknButton* rwControl;
+            rwControl = (CAknButton*)(toolbar->ComponentControl( 0 ));
+            CAknButton* pausePlayControl;
+            pausePlayControl = (CAknButton*)(toolbar->ComponentControl( 1 ));
+            CAknButton* fwControl;
+            fwControl = (CAknButton*)(toolbar->ComponentControl( 2 ));                                   
+            MMPXSource* s = iPlaybackUtility->Source();
+            if ( s )
+                {
+                CMPXCollectionPlaylist* playlist = s->PlaylistL();
+                if ( playlist )
+                    {
+                    if ( playlist->Count() > 0 )
+                        {
+                        if( pausePlayControl )
+                        	{
+	                        TMPXPlaybackState state = iPlaybackUtility->StateL();
+	                        if ((state == EPbStateInitialising) || (state == EPbStatePlaying))
+	                           {
+	                           pausePlayControl->SetCurrentState(0, ETrue);
+	                           }
+	                        else
+	                           {
+	                           pausePlayControl->SetCurrentState(1, ETrue);
+	                           }
+                        	}
+
+						if( rwControl && fwControl )
+							{
+							rwControl->SetDimmed( EFalse );
+							rwControl->DrawNow();
+							fwControl->SetDimmed( EFalse );
+							fwControl->DrawNow();
+                    		}
+                        }
+
+                    delete playlist;
+                    }
+                else
+                    {
+                    if( pausePlayControl )
+                    	{
+	                    TMPXPlaybackState state = iPlaybackUtility->StateL();
+	                    if ( ( state == EPbStateInitialising ) ||
+	                           ( state == EPbStatePlaying ) )
+	                        {
+	                        pausePlayControl->SetCurrentState( 0, ETrue );
+	                        }
+	                    else
+	                        {
+	                        pausePlayControl->SetCurrentState( 1, ETrue );
+	                        }
+	                    }
+                    }
+                }
+            else
+                {
+                toolbar->SetDimmed( ETrue );
+                }
+            }
+        }
+    }
+// ----------------------------------------------------------------------------
+// Callback function of timer to handle delayed error
+// ----------------------------------------------------------------------------
+//
+TInt CMPXCommonPlaybackViewImp::HandleDelayedError( TAny* aPtr )
+    {
+    CMPXCommonPlaybackViewImp* pv = reinterpret_cast<CMPXCommonPlaybackViewImp*>( aPtr );
+    pv->iDelayedErrorTimer->Cancel();
+    
+    // compare index
+    if ( pv->iPlaybackUtility )
+    	{
+        MMPXSource* source( pv->iPlaybackUtility->Source() );
+        if ( source )
+    	    {
+            CMPXCollectionPlaylist* pl( source->PlaylistL() );
+        	if ( pl )
+                {
+                CleanupStack::PushL( pl );
+                if ( pv->iErrIndex == pl->Index() )
+                	{
+                	pv->HandleErrorL( pv->iLastDelayedErr );
+                	}
+                CleanupStack::PopAndDestroy( pl );
+                }
+            }
+    	}
+
+    return KErrNone;
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/src/mpxcommonplaybackviewlayout.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,651 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Layout and graphic factory for Common Playback View
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <barsread.h>
+#include <gulicon.h>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <layoutmetadata.cdl.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxcommonplaybackview.rsg>
+#include <mpxcommonplaybackview.mbg>
+#include <mpxfmtx.rsg> // For FF_FMTX
+#include <featmgr.h>
+#include <centralrepository.h>
+#include <mpxinternalcrkeys.h>
+#include <mpxlbxextendedfeatures.h>
+#include <mpxlog.h>
+#include <mpxuser.h>
+
+#include "mpxcommonplaybackviewlayout.h"
+
+using namespace AknLayoutScalable_Apps;
+
+
+// CONSTANTS
+_LIT(KMXPanicCategory, "CMPXCommonPlaybackViewLayout");
+//_LIT(KMpxcommonplaybackviewMbmFile, "mpxcommonplaybackview.mbm");
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Get layout data for a button.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TRect CMPXCommonPlaybackViewLayout::ButtonLayout(
+    const TRect& aParentRect )
+    {
+    TAknLayoutRect res;
+    TAknWindowComponentLayout layoutItem;
+    TBool isLandscape = Layout_Meta_Data::IsLandscapeOrientation();
+    if(!isLandscape)
+        {
+        layoutItem = mup3_rocker_pane(0);
+       }
+    else
+        {
+        layoutItem = mup3_rocker_pane(1);
+        }
+
+    res.LayoutRect( aParentRect, layoutItem.LayoutLine() );
+    return res.Rect();
+    }
+
+// ---------------------------------------------------------------------------
+// Get layout data for an graphical indicator.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TRect CMPXCommonPlaybackViewLayout::IndicatorLayout(
+    const TRect& aParentRect,
+    TMPXPbvIndicator aIndicator )
+    {
+    TAknLayoutRect res;
+
+    TMPXPbvLayoutVariants lafVariant(EPbvUndefinedVariant);
+    lafVariant = GetIndicatorVariant(aIndicator);
+    if (lafVariant == EPbvUndefinedVariant)
+       {
+       // unsupported
+       ASSERT(0);
+       }
+    else
+       {
+       TAknWindowComponentLayout layoutItem;
+       switch ( aIndicator )
+          {
+            case EIconPlay:
+            case EIconPause:
+            case EIconStop:
+                {
+                layoutItem = main_mup3_pane_g5(lafVariant);
+                break;
+                }
+            case EIconRepeatAll:
+            case EIconRepeatOne:
+                {
+                layoutItem = main_mup3_pane_g4(lafVariant);
+                break;
+                }
+            case EIconRandom:
+                {
+                layoutItem = main_mup3_pane_g3(lafVariant);
+                break;
+                }
+            case EAlbumArtArea:
+                {
+                layoutItem = main_mup3_pane_g2(lafVariant);
+                break;
+                }
+            case ESliderPane:
+                {
+                layoutItem = mup3_progress_pane(lafVariant);
+                break;
+                }
+            case ESliderBackground:
+                {
+                layoutItem = mup_progress_pane_cp03();
+                break;
+                }
+            case EPlaybackSlider:
+                {
+                layoutItem = mup_progress_pane_cp03();
+                break;
+                }
+            case EDownloadSlider:
+                {
+                layoutItem = mup_progress_pane_cp03();
+                break;
+                }
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+            case EIconReal:
+                {
+			    if( lafVariant == EPbvPortraitWithRocker )
+					{
+					layoutItem = main_mup3_pane_g8( 0 );
+					}
+				else if( lafVariant == EPbvLandscapeWithRocker )
+					{	
+					layoutItem = main_mup3_pane_g8( 15 );
+				    }
+				else
+                    {
+                    layoutItem = main_mup3_pane_g8( lafVariant );
+                    }
+
+                break;
+                }
+#endif
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                                    User::Panic(KMXPanicCategory, KErrArgument));
+                }
+          }
+
+       res.LayoutRect(aParentRect, layoutItem.LayoutLine());
+       }
+    return res.Rect();
+    }
+
+// ---------------------------------------------------------------------------
+// Set layout data for a text label.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewLayout::LayoutLabel(
+    CEikLabel* aLabel,
+    const TRect& aParentRect,
+    TMPXPbvTextIndicator aText,
+    TInt /*aOffsetx*/, /* =0 */
+    TInt /*aOffsety*/ /* =0 */ )
+    {
+    TMPXPbvLayoutVariants lafVariant(EPbvUndefinedVariant);
+    lafVariant = GetTextVariant(aText);
+    if (lafVariant == EPbvUndefinedVariant)
+        {
+        ASSERT(0);
+        }
+    else
+        {
+        TAknTextComponentLayout layoutItem;
+        switch ( aText )
+            {
+            case ETextTrack:
+                {
+                layoutItem = main_mup3_pane_t1(lafVariant);
+                break;
+                }
+            case ETextArtist:
+                {
+                layoutItem = main_mup3_pane_t2(lafVariant);
+                break;
+                }
+            case ETextPlaylistCount:
+                {
+				if( lafVariant == EPbvLandscapeWithRocker )
+					{
+					lafVariant = (TMPXPbvLayoutVariants)15;
+					}
+                layoutItem = main_mup3_pane_t5(lafVariant);
+                break;
+                }
+            case ETextEmpty:
+                {
+                layoutItem = main_mup3_pane_t6(lafVariant);
+                break;
+                }
+            case ETextElapsedTime:
+                {
+                layoutItem = mup3_progress_pane_t1();
+                break;
+                }
+            case ETextRemainingTime:
+                {
+                layoutItem = mup3_progress_pane_t2();
+                break;
+                }
+            case ETextDownloadState:
+                {
+                layoutItem = mup3_progress_pane_t3();
+                break;
+                }
+            case ETextFMFrequency:
+                {
+                if( lafVariant == EPbvPortraitWithRocker )
+                    {
+                    layoutItem = main_mup3_pane_t7( 15 );
+                    }
+                else if( lafVariant == EPbvLandscapeWithRocker )
+                    {	
+                    layoutItem = main_mup3_pane_t7( 16 );
+                    }
+				else
+					{
+					layoutItem = main_mup3_pane_t7(lafVariant);
+					}					
+				break;
+                }
+            default:
+                {
+                __ASSERT_ALWAYS(EFalse,
+                                    User::Panic(KMXPanicCategory, KErrArgument));
+                }
+            }
+
+        AknLayoutUtils::LayoutLabel(aLabel, aParentRect, layoutItem.LayoutLine());
+
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get the bitmap and mask for a soft button in a given state.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewLayout::GetButtonBitmapsL(
+    TMPXPbvButton /*aButton*/,
+    TInt /*aButtonState*/,
+    CFbsBitmap*& /*aBitmap*/,
+    CFbsBitmap*& /*aMask*/ )
+    {
+// do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Get the bitmap and mask for a given indicator.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CGulIcon* CMPXCommonPlaybackViewLayout::GetIndicatorIconMaskL(
+    TMPXPbvIndicator aIndicator )
+    {
+    TParse parse;
+    parse.Set( KMPXCommonPlaybackViewIconFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    switch ( aIndicator )
+        {
+        case EIconPlay:
+            {
+            return AknsUtils::CreateGulIconL(
+                skin,
+                KAknsIIDQgnIndiMupPlay,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_indi_mup_play,
+                EMbmMpxcommonplaybackviewQgn_indi_mup_play_mask);
+            }
+        case EIconPause:
+            {
+            return AknsUtils::CreateGulIconL(
+                skin,
+                KAknsIIDQgnIndiMupPause,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_indi_mup_pause,
+                EMbmMpxcommonplaybackviewQgn_indi_mup_pause_mask);
+            }
+        case EIconStop:
+            {
+            return AknsUtils::CreateGulIconL(
+                skin,
+                KAknsIIDQgnIndiMupStop,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_indi_mup_stop,
+                EMbmMpxcommonplaybackviewQgn_indi_mup_stop_mask);
+            }
+        case EIconRepeatAll:
+            {
+            return CreateColorIconL(
+                skin,
+                KAknsIIDQgnIndiMupRepeat,
+                KAknsIIDQsnIconColors,
+                EAknsCIQsnIconColorsCG26,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_icon_repeat,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_icon_repeat_mask );
+            }
+        case EIconRepeatOne:
+            {
+            return CreateColorIconL(
+                skin,
+                KAknsIIDQgnIndiMupRepeatOne,
+                KAknsIIDQsnIconColors,
+                EAknsCIQsnIconColorsCG26,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_icon_repeatone,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_icon_repeatone_mask );
+            }
+        case EIconRandom:
+            {
+            return CreateColorIconL(
+                skin,
+                KAknsIIDQgnIndiMupRandom,
+                KAknsIIDQsnIconColors,
+                EAknsCIQsnIconColorsCG26,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_icon_shuffle,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_icon_shuffle_mask );
+            }
+        case ESliderBackground:
+            {
+            return AknsUtils::CreateGulIconL(
+                skin,
+                KAknsIIDQgnGrafMup2BarFrame,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_prbar_bgd,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_prbar_bgd_mask );
+            }
+        case EPlaybackSlider:
+            {
+            return AknsUtils::CreateGulIconL(
+                skin,
+                KAknsIIDQgnGrafMup2BarProgress2,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_prbar_top_play,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_prbar_top_play_mask );
+            }
+        case EDownloadSlider:
+            {
+            return AknsUtils::CreateGulIconL(
+                skin,
+                KAknsIIDQgnGrafMup2BarProgress,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_prbar_mid_download,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_npv_prbar_mid_download_mask );
+            }
+        case EAlbumArtArea:
+            {
+            return AknsUtils::CreateGulIconL(
+                skin,
+                KAknsIIDQgnIndiMupDefaultAlbum,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_indi_mup_default_album,
+                EMbmMpxcommonplaybackviewQgn_indi_mup_default_album_mask );
+            }
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+        case EIconReal:
+            {
+            return AknsUtils::CreateGulIconL(
+                skin,
+                KAknsIIDQgnIndiMupRp,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_indi_mup_rp,
+                EMbmMpxcommonplaybackviewQgn_indi_mup_rp_mask );
+            }
+#endif
+        default:
+            {
+            __ASSERT_ALWAYS(
+                EFalse,
+                User::Panic( KMXPanicCategory, KErrArgument ) );
+            break;
+            }
+        }
+    return NULL; // Not reached
+    }
+
+// ---------------------------------------------------------------------------
+// Create a color-skinned icon.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CGulIcon* CMPXCommonPlaybackViewLayout::CreateColorIconL(
+    MAknsSkinInstance* aSkin,
+    const TAknsItemID& aIconSkinId,
+    const TAknsItemID& aColorId,
+    TInt aColorIndex,
+    const TDesC& aBitmapFilename,
+    TInt aFileBitmapId,
+    TInt aFileMaskId )
+    {
+    CFbsBitmap* icon = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateColorIconLC(
+        aSkin,           // aInstance
+        aIconSkinId,     // aID
+        aColorId,        // aColorID
+        aColorIndex,     // aColorIndex
+        icon,            // aBitmap
+        mask,            // aMask
+        aBitmapFilename, // aFilename
+        aFileBitmapId,   // aFileBitmapId
+        aFileMaskId,     // aFileBitmapId
+        KRgbBlack );     // aDefaultColor
+
+    CGulIcon* res = CGulIcon::NewL( icon, mask );
+    res->SetBitmapsOwnedExternally( EFalse );
+    CleanupStack::Pop(2); // mask, icon
+
+    return res;
+    }
+
+// ---------------------------------------------------------------------------
+// Layouts the label by reading in the resource values
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXCommonPlaybackViewLayout::DoLayoutLabelL(
+    CEikLabel* aLabel,
+    const TRect& aParentRect,
+    TInt aResId,
+    TInt aOffsetx,
+    TInt aOffsety )
+    {
+    TResourceReader reader;
+    CCoeEnv::Static()->CreateResourceReaderLC( reader, aResId );
+
+    // Read the layout from resource file
+    TAknTextComponentLayout textLayout;
+    textLayout.SetFont( reader.ReadInt16() );
+    textLayout.SetC( reader.ReadInt16() );
+    textLayout.Setl( reader.ReadInt16() + aOffsetx );
+    textLayout.Setr( reader.ReadInt16() - aOffsetx );
+    textLayout.Setb( reader.ReadInt16() + aOffsety );
+    textLayout.SetW( reader.ReadInt16() );
+    textLayout.SetJ( reader.ReadInt16() );
+    CleanupStack::PopAndDestroy();  // reader
+
+    AknLayoutUtils::LayoutLabel(
+        aLabel, aParentRect, textLayout.LayoutLine() );
+    }
+
+// ---------------------------------------------------------------------------
+// Get layout data for a button.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TRect CMPXCommonPlaybackViewLayout::ButtonLayout(const TRect& aParentRect,
+                                      TInt aButton)
+    {
+
+
+    TAknLayoutRect res;
+    TAknWindowComponentLayout layoutItem;
+    TInt buttonVariant = 0;
+
+    switch (aButton)
+        {
+        case EButtonPlay:
+        case EButtonPause:
+            {
+            layoutItem = mup3_control_keys_pane_g3(buttonVariant);
+            break;
+            }
+        case EButtonFastForward:
+            {
+            layoutItem = mup3_control_keys_pane_g2(buttonVariant);
+            break;
+            }
+        case EButtonRewind:
+            {
+            layoutItem = mup3_control_keys_pane_g1(buttonVariant);
+            break;
+            }
+        case EButtonStop:
+        case EButtonVolumeDown:
+            {
+            layoutItem = mup3_control_keys_pane_g4(buttonVariant);
+            break;
+            }
+        case EButtonVolumeUp:
+            {
+            layoutItem = mup3_control_keys_pane_g4_copy1(buttonVariant);
+            break;
+            }
+        default:
+            {
+            ASSERT(0);
+            break;
+            }
+        }
+
+    res.LayoutRect( aParentRect, layoutItem.LayoutLine() );
+
+    return res.Rect();
+    }
+
+
+// ---------------------------------------------------------------------------
+//  Determine the layout (touch, non-touch, landscape, portrait, rocker, etc...)
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TMPXPbvLayoutVariants CMPXCommonPlaybackViewLayout::DetermineLayoutVariant()
+    {
+    TMPXPbvLayoutVariants variant(EPbvUndefinedVariant);
+
+    TInt flags( 0 );
+    CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
+    User::LeaveIfError( repository->Get( KMPXMPLocalVariation, flags ));
+    delete repository;
+    repository = NULL;
+    TBool showRockerGraphics = static_cast<TBool>( flags & KMPXRockerMappingSupport );
+
+    TBool isLandscape = Layout_Meta_Data::IsLandscapeOrientation();
+
+    TBool isTouch = AknLayoutUtils::PenEnabled();
+
+    if (isTouch && !isLandscape )
+        {
+        variant = EPbvPortraitNhdTouchWithFM;
+        }
+    else if (isTouch && isLandscape)
+        {
+        variant = EPbvLandscapeNhdTouchWithFM;
+        }
+    else if (!showRockerGraphics && !isLandscape )
+        {
+        variant = EPbvPortraitWithoutRocker;
+        }
+    else if (!showRockerGraphics && isLandscape)
+        {
+        variant = EPbvLandscapeWithoutRocker;
+        }
+    else if (showRockerGraphics && !isLandscape)
+        {
+        variant = EPbvPortraitWithRocker;
+        }
+    else if (showRockerGraphics && isLandscape)
+        {
+        variant = EPbvLandscapeWithRocker;
+        }
+    
+
+    return(variant);
+    }
+
+// ---------------------------------------------------------------------------
+//  Determine the layout variant for a text item
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TMPXPbvLayoutVariants CMPXCommonPlaybackViewLayout::GetTextVariant(TMPXPbvTextIndicator aText)
+    {
+    TMPXPbvLayoutVariants layoutVariant = DetermineLayoutVariant();
+    TMPXPbvLayoutVariants textVariant;
+    switch ( aText )
+        {
+        case ETextTrack:
+        case ETextArtist:
+        case ETextPlaylistCount:
+        case ETextFMFrequency:
+            {
+            textVariant = layoutVariant;
+            break;
+            }
+        case ETextEmpty:
+        case ETextElapsedTime:
+        case ETextRemainingTime:
+        case ETextDownloadState:
+            {
+            textVariant = static_cast<TMPXPbvLayoutVariants> (0);    // always 0 regardless of layout variant
+            break;
+            }
+        default:
+            {
+            textVariant = EPbvUndefinedVariant;
+            }
+        }
+
+    return(textVariant);
+    }
+
+// ---------------------------------------------------------------------------
+// Determine the layout variant type for an indicator item
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TMPXPbvLayoutVariants CMPXCommonPlaybackViewLayout::GetIndicatorVariant(TMPXPbvIndicator aIndicator)
+    {
+    TMPXPbvLayoutVariants layoutVariant = DetermineLayoutVariant();
+    TMPXPbvLayoutVariants indicatorVariant;
+    switch ( aIndicator )
+        {
+        case EAlbumArtArea:
+        case EIconRepeatOne:
+        case EIconRepeatAll:
+        case EIconRandom:
+        case EIconPlay:
+        case EIconStop:
+        case EIconPause:
+        case ESliderPane:
+        case ESliderBackground:
+        case EPlaybackSlider:
+        case EDownloadSlider:
+        case EIconReal:
+            {
+            indicatorVariant = layoutVariant;
+            break;
+            }
+        case EIconFastForward:
+        case EIconRewind:
+        case EIconRemotePlayer:
+        case EBackgroundGraphic:
+            {
+            indicatorVariant = EPbvUndefinedVariant;
+            break;
+            }
+
+        default:
+            {
+            indicatorVariant = EPbvUndefinedVariant;
+            }
+        }
+
+    return(indicatorVariant);
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/commonplaybackview/src/mpxplaybackviewinfolabel.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Text label for Playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include    <AknsSkinInstance.h>
+#include    <AknsDrawUtils.h>
+#include    <AknsUtils.h>
+#include    <AknMarqueeControl.h>
+#include    <AknUtils.h>
+#include    <AknLayoutFont.h>
+
+#include    "mpxplaybackviewinfolabel.h"
+
+// CONSTANTS
+#ifdef _DEBUG
+_LIT( KPanicCat, "CMPXPlaybackViewInfoLabel" );
+#endif
+
+// MODULE DATA STRUCTURES
+enum TPanicCode
+    {
+    ENoPanic = 0,
+    EAlreadyScrolling,
+    ENoTextSet,
+    EFontNotSet
+    };
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewInfoLabel::CMPXPlaybackViewInfoLabel()
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewInfoLabel::ConstructL(TBool aEnableMarqueeSupport)
+    {
+    if ( aEnableMarqueeSupport )
+        {
+        iMarquee = CAknMarqueeControl::NewL();
+        TCallBack callback( RedrawCallback, this );
+        iMarquee->SetRedrawCallBack( callback );
+        iMarquee->SetLoops( 1 );
+        iMarquee->SetContainerWindowL( *this );
+        }
+    }
+    
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewInfoLabel::~CMPXPlaybackViewInfoLabel()
+    {
+    delete iFullText;
+    delete iMarquee;
+    iBackground = NULL;
+    }
+    
+// ---------------------------------------------------------------------------
+// Set background bitmap
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewInfoLabel::SetBackground(
+    MAknsControlContext* aBackground )
+    {
+    iBackground = aBackground;
+    }
+
+// ---------------------------------------------------------------------------
+// Redraw rectangle
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewInfoLabel::RedrawRect( const TRect& aRect ) const
+    {
+    if ( aRect.Intersects( Rect() ) )
+        {
+        CWindowGc& gc = SystemGc();
+        if ( iBackground )
+            {
+            MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+            AknsDrawUtils::Background( skin, iBackground, gc, Rect() );
+            }
+
+        CGraphicsContext::TTextAlign align=iAlignment.TextAlign();
+
+        // Get baseline for current font
+        TInt baselineOffset = 0;
+        if ( iMarquee )
+            {
+            const CAknLayoutFont* layoutFont = 
+                CAknLayoutFont::AsCAknLayoutFontOrNull( Font() );
+            if ( layoutFont )
+                {
+                baselineOffset= layoutFont->TextPaneTopToBaseline();
+                }
+            }
+
+        gc.UseFont( Font() );
+        gc.SetPenColor( iEikonEnv->ControlColor( EColorLabelText,*this ) );
+
+        // Draw marquee, if supported and necessary
+        if ( !iMarquee || !iMarquee->IsMarqueeOn() || iMarquee->DrawText(
+            gc,              // aGc
+            Rect(),          // aTextRect
+            FullText(),      // aText
+            baselineOffset,  // aBaselineOffset
+            align,           // aAlign
+            *Font() ) )      // aFont
+            {
+            // Marquee is not enabled or all the loops have been executed
+            // -> the text needs to be drawn here
+            CEikLabel::Draw( aRect );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Start marquee scrolling if supported and needed.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewInfoLabel::StartMarquee()
+    {
+    if ( iMarquee )
+        {
+        TBool need = NeedToScroll();
+        if ( need && !iMarquee->IsMarqueeOn() )
+            {
+            iMarquee->Reset();
+            }
+        iMarquee->EnableMarquee( need );
+        if ( need )
+            {
+            iMarquee->Start();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Stop marquee scrolling.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewInfoLabel::StopMarquee()
+    {
+    if ( iMarquee )
+        {
+        iMarquee->EnableMarquee( EFalse );
+        iMarquee->Stop();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get the full unclipped text for the label
+// ---------------------------------------------------------------------------
+//
+const TDesC& CMPXPlaybackViewInfoLabel::FullText() const
+    {
+    if ( iFullText )
+        {
+        return *iFullText;
+        }
+    else
+        {
+        return *Text();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set label text and clip if necessary.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewInfoLabel::SetLabelTextL( const TDesC& aText )
+    {
+    if ( iMarquee )
+        {
+        delete iFullText;
+        iFullText = NULL;
+        iFullText = aText.AllocL();
+        }
+
+    // magic: allocate 3 chars more (make sure "..." fits).
+    HBufC* buf = HBufC::NewLC( aText.Length() + 3 );
+    *buf = aText;
+    TPtr ptr( buf->Des() );
+    AknTextUtils::ClipToFit( ptr,
+                             *Font(),
+                             Rect().Width() );
+    SetTextL( *buf );
+    CleanupStack::PopAndDestroy( buf );
+    }
+
+// ---------------------------------------------------------------------------
+// Check if scrolling is needed.
+// ---------------------------------------------------------------------------
+//
+TBool CMPXPlaybackViewInfoLabel::NeedToScroll() const
+    {
+    __ASSERT_DEBUG( iFont, User::Panic( KPanicCat, EFontNotSet ) );
+
+    TBool need( EFalse );
+    if ( iFullText && iFont->TextWidthInPixels( *iFullText ) > Size().iWidth )
+        {
+        need = ETrue;
+        }
+    return need;
+    }
+
+// ---------------------------------------------------------------------------
+// Redraw callback for marquee control
+// ---------------------------------------------------------------------------
+//
+TInt CMPXPlaybackViewInfoLabel::RedrawCallback( TAny* aPtr )
+    {
+    CMPXPlaybackViewInfoLabel* self = 
+        static_cast<CMPXPlaybackViewInfoLabel*>( aPtr );
+    CWindowGc& gc = self->SystemGc();
+    gc.Activate( *self->DrawableWindow() );
+    self->Draw( self->Rect() );
+    gc.Deactivate();
+
+    return static_cast<TBool>( ETrue ); // True -> draw again
+    }
+
+// ---------------------------------------------------------------------------
+// Draws the control.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewInfoLabel::Draw( const TRect& aRect ) const
+    {
+    RedrawRect( aRect );
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the number of controls contained in a compound control.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXPlaybackViewInfoLabel::CountComponentControls() const
+    {
+    TInt childCount = 0;
+    if ( iMarquee )
+        {
+        childCount++;
+        }
+    return childCount;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets an indexed component of a compound control.
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CMPXPlaybackViewInfoLabel::ComponentControl(
+    TInt aIndex ) const
+    {
+    ASSERT( aIndex == 0 ); // only 1 control
+    return iMarquee;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/bwinscw/mpxembeddedplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewL@CMPXEmbeddedPlaybackView@@SAPAV1@XZ @ 1 NONAME ; class CMPXEmbeddedPlaybackView * CMPXEmbeddedPlaybackView::NewL(void)
+	?NewLC@CMPXEmbeddedPlaybackView@@SAPAV1@XZ @ 2 NONAME ; class CMPXEmbeddedPlaybackView * CMPXEmbeddedPlaybackView::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/data/mpxembeddedplaybackview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,124 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxembeddedplaybackview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MEPV // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+#include <mpxcommonplaybackview.mbg>
+#include <mpxcommonplaybackview.rsg>
+#include <mpxcommonplaybackview.loc>
+#include <mpxembeddedplaybackview.loc>
+#include "mpxcommonplaybackview.hrh"
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_unknown_title
+// Text to show when podcast title information is not available.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_unknown_title
+    {
+    buf = qtn_nmp_unknown;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_mpx_embedded_playback_view
+// Embedded Playback view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_mpx_embedded_playback_view
+    {
+    menubar = r_mpx_embedded_playback_view_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    toolbar = R_MPX_PBV_TOUCH_TOOLBAR;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_embedded_playback_view_menubar
+// Embedded Playback view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_embedded_playback_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_embedded_playback_view_menu;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_embedded_playback_view_menu
+// Embedded Playback view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_embedded_playback_view_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdSave;
+            txt = qtn_mp_options_save;
+            },
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdUseAsCascade;
+            txt = qtn_mus_options_use_tone_as;
+            cascade = R_MPX_USE_AS_CASCADE;
+            },
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdFMTransmitter;
+            txt = qtn_nmp_go_to_fm_transmitter;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EEikCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/eabi/mpxembeddedplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_ZN24CMPXEmbeddedPlaybackView4NewLEv @ 1 NONAME
+	_ZN24CMPXEmbeddedPlaybackView5NewLCEv @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxembeddedplaybackview.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxembeddedplaybackview.loc	APP_LAYER_LOC_EXPORT_PATH(mpxembeddedplaybackview.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxembeddedplaybackview.mif
+OPTION HEADERFILE mpxembeddedplaybackview.mbg
+OPTION SOURCES -c16,8 qgn_indi_mup_default_album_pcast
+END
+
+PRJ_MMPFILES
+
+
+mpxembeddedplaybackview.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1 @@
+/c16,8 Qgn_indi_mup_default_album_pcast.svg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/group/mpxembeddedplaybackview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxembeddedplaybackview.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxembeddedplaybackview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC79
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxembeddedplaybackviewcontainer.cpp
+SOURCE          mpxembeddedplaybackview.cpp
+SOURCE          mpxembeddedplaybackviewimp.cpp
+SOURCE          mpxembeddedplaybackviewlayout.cpp
+
+START RESOURCE  ../data/mpxembeddedplaybackview.rss
+DEPENDS mpxcommonplaybackview.rsg
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         ws32.lib
+LIBRARY         fbscli.lib
+LIBRARY         bitgdi.lib
+LIBRARY         gdi.lib
+LIBRARY         egul.lib
+LIBRARY         eikctl.lib
+LIBRARY         eiksrv.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknicon.lib
+LIBRARY         featmgr.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknskinsrv.lib
+LIBRARY         commonengine.lib
+LIBRARY         centralrepository.lib
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         cdlengine.lib
+LIBRARY         apgrfx.lib
+
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxmediakeyhandler.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcommonplaybackview.lib
+LIBRARY         mpxcollectionhelper.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/group/mpxembeddedplaybackviewicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxembeddedplaybackview
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxembeddedplaybackview.mif
+HEADERFILENAME=$(HEADERDIR)/mpxembeddedplaybackview.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackview.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxmbeddedplaybackview
+*
+*/
+
+
+
+#ifndef MPXEMBEDDEDPLAYBACKVIEW_HLP_HRH
+#define MPXEMBEDDEDPLAYBACKVIEW_HLP_HRH
+
+_LIT( KMUS_HLP_EMBED_GENERAL, "MUS_HLP_EMBED_GENERAL" );
+_LIT( KMUS_HLP_EMBED_BROWSER, "MUS_HLP_EMBED_BROWSER" );
+_LIT( KMUS_HLP_EMBED_MESSAGING, "MUS_HLP_PLAYBACK_VIEW" );
+
+#endif  // MPXEMBEDDEDPLAYBACKVIEW_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackview.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxembeddedplaybackview
+*
+*/
+
+
+
+#ifndef MPXEMBEDDEDPLAYBACKVIEW_HRH
+#define MPXEMBEDDEDPLAYBACKVIEW_HRH
+
+#define KMPXEmbeddedPlaybackViewId    0x101FFC79
+
+#endif  // MPXEMBEDDEDPLAYBACKVIEW_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,117 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX embedded playback view's container implementation.
+*
+*/
+
+
+
+#ifndef C_CMPXEMBEDDEDPLAYBACKVIEWCONTAINER_H
+#define C_CMPXEMBEDDEDPLAYBACKVIEWCONTAINER_H
+
+
+// INCLUDES
+#include "mpxcommonplaybackviewcontainer.h"
+
+
+// FORWARD DECLARATIONS
+class MMPXLayoutSwitchObserver;
+class MMPXPlaybackViewLayout;
+class CMPXCommonUiHelper;
+
+// CLASS DECLARATION
+
+/**
+ *  Container class for audio view.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXEmbeddedPlaybackViewContainer ) : public CMPXCommonPlaybackViewContainer
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     *
+     * @param aLayoutObserver    Observer to send layout switch events to.
+     * @param aIsEmbedded        ETrue if Music Player is in embedded mode.
+     * @param aLayout            Playback view layout
+     * @param aCommonUiHelper    Instance of common ui helper
+     */
+    CMPXEmbeddedPlaybackViewContainer(
+        MEikCommandObserver* aCommandObserver,
+        MMPXLayoutSwitchObserver* aLayoutObserver,
+        MMPXPlaybackViewLayout* aLayout,
+        CMPXCommonUiHelper* aCommonUiHelper );
+
+    /**
+     * Symbian 2nd phase constructor.
+     * 
+     * @param aRect Frame rectangle for container.
+     */
+    void ConstructL( const TRect& aRect );
+
+    /**
+     * Destructor.
+     */
+    ~CMPXEmbeddedPlaybackViewContainer();
+
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since S60 3.0
+     */
+    void UpdateLayout();
+
+// from base class CMPXCommonPlaybackViewContainer
+    
+    /**
+     * Sets main pane mode.
+     *
+     * @since S60 3.1
+     * @param aMode Playback mode.
+     */
+    void SetMode( TMPXPbvPlaybackMode aMode );
+    
+// from base class CoeControl
+
+    /**
+     * From CoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+    
+private:
+
+    CMPXCommonUiHelper* iCommonUiHelper; // not owned
+    };
+
+#endif  // C_CMPXEMBEDDEDPLAYBACKVIEWCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackviewimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX embeddedplayback view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXEMBEDDEDPLAYBACKVIEWIMP_H
+#define C_CMPXEMBEDDEDPLAYBACKVIEWIMP_H
+
+
+// INCLUDES
+#include <AknProgressDialog.h>  // MProgressDialogCallback
+#include <mpxcollectionhelper.h>
+#include <mpxcollectionuihelper.h>
+#include "mpxembeddedplaybackview.h"
+#include <akntoolbarobserver.h>
+
+// FORWARD DECLARATIONS
+class CMPXEmbeddedPlaybackViewContainer;
+class CMPXEmbeddedPlaybackViewLayout;
+class CAknToolbar;
+
+// CLASS DECLARATION
+
+/**
+ *  MPX playback view.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXEmbeddedPlaybackViewImp ) : public CMPXEmbeddedPlaybackView
+                                           ,public MAknToolbarObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXEmbeddedPlaybackViewImp* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXEmbeddedPlaybackViewImp* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXEmbeddedPlaybackViewImp();
+
+private:
+    enum TMPXNpvSaveMode
+    {
+    EMPXNpvUsePreviousMode = 0,
+    EMPXNpvOpenAfterSave,
+    EMXPNpvExitAppAfterSave,
+    EMPXNpvExitHostAppAfterSave
+    };    
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXEmbeddedPlaybackViewImp();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    
+// from base class CMPXCommonPlaybackViewImp
+
+    /**
+     * Updates the title pane
+     */
+    void UpdateTitlePaneL();
+
+    /**
+     * Updates track info field.
+     *
+     * @param aMedia Media's properties. If NULL, default info will
+     *                    be shown.
+     */
+    void UpdateTrackInfoL( const CMPXMedia* aMedia );
+    
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    virtual void HandleErrorL( TInt aError );
+    
+    /**
+     *  Handle playback property
+     *
+     *  @param aProperty the property
+     *  @param aValue the value of the property
+     *  @param aError error code
+     */
+    virtual void DoHandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue, 
+        TInt aError ); 
+
+// from base class MMPXCHelperEmbeddedOpenObserver
+
+    /**
+    * From MMPXCHelperEmbeddedOpenObserver
+    * Handles errors from opening in embedded mode
+    * @param aErr, error code
+    */
+    void HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory );
+    
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    void DynInitMenuPaneL(
+        TInt aResourceId, 
+        CEikMenuPane* aMenuPane );
+
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Returns views id.
+     *
+     * @since 3.0
+     * @return Views Uid
+     */
+    TUid Id() const;
+
+    /**
+     * From CAknView
+     * Command handling function.
+     *
+     * @since 3.0
+     * @param aCommand Command which is handled
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Handles a view activation.
+     *
+     * @param aPrevViewId Specifies the view previously active.
+     * @param aCustomMessageId Specifies the message type.
+     * @param aCustomMessage The activation message.
+     */
+    void DoActivateL(
+        const TVwsViewId& aPrevViewId,
+        TUid aCustomMessageId,
+        const TDesC8& aCustomMessage );
+
+
+private:    // new methods
+
+    /**
+     *  Handle media properties.
+     *  
+     *  @param aMedia media properties
+     *  @param aError error code    
+     */
+    void DoHandleMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+    /**
+     * Handle saving a file
+     *
+     * @param aMode The action to perform after save is completed
+     */
+    void HandleSaveL( TMPXNpvSaveMode aMode );
+    void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+    /**
+     * From MAknToolbarObserver
+     * Processes user commands.
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void OfferToolbarEventL( TInt aCommandId );
+      
+    /**
+     * From MAknToolbarObserver
+     * Used to change toolbar settings before it is made visible
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolBar );
+
+private:    // data
+    TInt iEmbeddedResourceOffset;
+    CMPXEmbeddedPlaybackViewLayout* iPlaybackViewLayout;    // owned
+    TBool iSaveInProgress;
+    TBool iPrepareToSave;
+    TMPXNpvSaveMode iSaveMode;
+    CAknToolbar* iToolbar; //owned
+    };
+
+#endif  // C_CMPXPLAYBACKVIEWIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/inc/mpxembeddedplaybackviewlayout.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  An interface providing skin and layout data for embedded playback view.
+*
+*/
+
+
+#ifndef C_CMPXEMBEDDEDPLAYBACKVIEWLAYOUT_H
+#define C_CMPXEMBEDDEDPLAYBACKVIEWLAYOUT_H
+
+//  INCLUDES
+#include "mpxcommonuihelper.h"
+#include "mpxcommonplaybackviewlayout.h"
+
+// CLASS DECLARATION
+
+/**
+*  An interface providing skin and layout data for playback view.
+*
+*  @lib mpxplaybackview.dll
+*  @since S60 v3.0
+*/
+NONSHARABLE_CLASS( CMPXEmbeddedPlaybackViewLayout ) : public CMPXCommonPlaybackViewLayout
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXEmbeddedPlaybackViewLayout* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXEmbeddedPlaybackViewLayout* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXEmbeddedPlaybackViewLayout();
+
+    /**
+     * Get the bitmap and mask for a given indicator.
+     *
+     * @since 3.0
+     * @param  aIndicator   Enumeration value identifying the indicator
+     * @return CGulIcon     Indicator graphic and mask. Ownership 
+     *                      transferred to caller.
+     */
+    CGulIcon* GetIndicatorIconMaskL(
+        TMPXPbvIndicator aIndicator );
+        
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXEmbeddedPlaybackViewLayout();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    
+private: // data
+
+    CMPXCommonUiHelper* iCommonUiHelper;    // own    
+    };
+
+#endif  // C_CMPXEMBEDDEDPLAYBACKVIEWLAYOUT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/loc/mpxembeddedplaybackview.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxembeddedplaybackview
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Options menu item.
+// d:Save when launched embedded playback view from Browser or Messaging
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_options_save "Save"
+
+// d:Text in main pane.
+// d:Shown when no title metadata can be found in the track.
+// l:main_mup3_pane_t1
+// r:5.0
+//
+#define qtn_nmp_unknown "Unknown"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/src/mpxembeddedplaybackview.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of EmbeddedPlayback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxembeddedplaybackview.h"
+#include "mpxembeddedplaybackviewimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXEmbeddedPlaybackView* CMPXEmbeddedPlaybackView::NewL()
+    {
+    return CMPXEmbeddedPlaybackViewImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXEmbeddedPlaybackView* CMPXEmbeddedPlaybackView::NewLC()
+    {
+    return CMPXEmbeddedPlaybackViewImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackView::~CMPXEmbeddedPlaybackView()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/src/mpxembeddedplaybackviewcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,156 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Embedded Playback view's container.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <AknDef.h>
+#include <mpxconstants.h>
+
+#include "mpxembeddedplaybackview.hlp.hrh"
+#include "mpxembeddedplaybackviewcontainer.h"
+#include "mpxplaybackviewlayoutinterface.h"
+#include "mpxcommonuihelper.h"
+#include "mpxlog.h"
+
+
+// CONSTANTS
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewContainer::CMPXEmbeddedPlaybackViewContainer(
+    MEikCommandObserver* aCommandObserver,
+    MMPXLayoutSwitchObserver* aLayoutObserver,
+    MMPXPlaybackViewLayout* aLayout,
+    CMPXCommonUiHelper* aCommonUiHelper )
+    {
+    iCommandObserver = aCommandObserver;
+    iLayoutObserver = aLayoutObserver;
+    iMode = EUninitialized;
+    iLayout = aLayout;
+    iCommonUiHelper = aCommonUiHelper;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewContainer::ConstructL( const TRect& aRect )
+    {
+    MPX_DEBUG1( "CMPXEmbeddedPlaybackViewContainer::ConstructL() entering" );
+
+    CMPXCommonPlaybackViewContainer::ConstructL( aRect );
+
+    MPX_DEBUG1( "CMPXEmbeddedPlaybackViewContainer::ConstructL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewContainer::~CMPXEmbeddedPlaybackViewContainer()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewContainer::UpdateLayout()
+    {
+    MPX_DEBUG1( "CMPXEmbeddedPlaybackViewContainer::UpdateLayout() entering" );
+
+    CMPXCommonPlaybackViewContainer::UpdateLayout();
+
+    MPX_DEBUG1( "CMPXEmbeddedPlaybackViewContainer::UpdateLayout() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// sets display mode
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewContainer::SetMode( TMPXPbvPlaybackMode aMode )
+    {
+    MPX_DEBUG1( "CMPXEmbeddedPlaybackViewContainer::SetMode() entering" );
+
+    if ( aMode != ENoTracksMode )
+        {
+        CMPXCommonPlaybackViewContainer::SetMode( aMode );
+        }
+    else
+        {
+        // the only chance this will be ENoTracksMode in embedded view
+        // is when the file is saving (playback engine state change to not initialized)
+        // when that happens, ignore the event so that the view
+        // doesn't go blank
+        MPX_DEBUG1( "CMPXEmbeddedPlaybackViewContainer::SetMode no tracks mode, ignoring" );
+        }
+
+    MPX_DEBUG1( "CMPXEmbeddedPlaybackViewContainer::SetMode() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXEmbeddedPlaybackViewContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG4( "CMPXEmbeddedPlaybackViewContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+
+    return CMPXCommonPlaybackViewContainer::OfferKeyEventL( aKeyEvent, aType );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewContainer::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KAppUidMusicPlayerX;
+    TRAP_IGNORE(
+        {
+        if ( iCommonUiHelper->IsHostBrowserL() )
+            {
+            aContext.iContext = KMUS_HLP_EMBED_BROWSER;
+            }
+        else if ( iCommonUiHelper->IsHostMessagingL() )
+            {
+            aContext.iContext = KMUS_HLP_EMBED_MESSAGING;
+            }
+        else
+            {
+            aContext.iContext = KMUS_HLP_EMBED_GENERAL;
+            }
+        } );
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/src/mpxembeddedplaybackviewimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,762 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <eikmenub.h>
+#include <eikapp.h>
+#include <AknUtils.h>
+#include <akntitle.h>
+#include <apgcli.h>
+#include <bautils.h>
+#include <featmgr.h>
+#include <StringLoader.h>
+#include <aknnotewrappers.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxmedia.h>
+#include <mpxplaybackutility.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxcommonplaybackview.rsg>
+#include <mpxembeddedplaybackview.rsg>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediadrmdefs.h>
+#include "mpxcommonuihelper.h"
+#include <mpxtlshelper.h>
+#include "mpxcommonplaybackview.hrh"
+#include "mpxembeddedplaybackview.hrh"
+#include "mpxembeddedplaybackviewimp.h"
+#include "mpxembeddedplaybackviewcontainer.h"
+#include "mpxembeddedplaybackviewlayout.h"
+#include <mpxappui.hrh>
+#include "mpxlog.h"
+#include <mpxplaybackutility.h>
+#include <akntoolbar.h>
+#include <aknbutton.h>
+#include "mpxcommonplaybackview.hrh"
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessage.h>
+#include <mpxuser.h>
+
+// CONSTANTS
+_LIT( KMPXEmbeddedPlaybackRscPath, "mpxembeddedplaybackview.rsc" );
+const TInt KMPXOneSecInMilliSecs( 1000 );
+_LIT(KMPXMusicplayerPrivateFolder, "\\private\\");
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewImp::CMPXEmbeddedPlaybackViewImp()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::ConstructL()
+    {
+    MPX_FUNC( "CMPXEmbeddedPlaybackViewImp::ConstructL" );
+
+    // Load embedded resource
+    CCoeEnv* coeEnv = iEikonEnv;
+    TParse parse;
+    parse.Set( KMPXEmbeddedPlaybackRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iEmbeddedResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    CMPXCommonPlaybackViewImp::ConstructL();
+    BaseConstructL( R_MPX_EMBEDDED_PLAYBACK_VIEW );
+
+    if(AknLayoutUtils::PenEnabled())
+    {
+    CAknView::ShowToolbarOnViewActivation(ETrue);
+    if ( Toolbar() )
+        {
+        iToolbar = Toolbar();
+        iToolbar->SetToolbarObserver( this );
+        }
+    }
+
+    // Override base class setting to allow
+    // embedded playback to properly fetch media properties.
+    iLastPBViewActivated = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewImp* CMPXEmbeddedPlaybackViewImp::NewL()
+    {
+    CMPXEmbeddedPlaybackViewImp* self = CMPXEmbeddedPlaybackViewImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewImp* CMPXEmbeddedPlaybackViewImp::NewLC()
+    {
+    CMPXEmbeddedPlaybackViewImp* self = new ( ELeave ) CMPXEmbeddedPlaybackViewImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewImp::~CMPXEmbeddedPlaybackViewImp()
+    {
+    MPX_DEBUG1( "CMPXEmbeddedPlaybackViewImp::~CMPXEmbeddedPlaybackViewImp entering" );
+
+    if ( iEmbeddedResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iEmbeddedResourceOffset );
+        }
+
+    delete iPlaybackViewLayout;
+
+    MPX_DEBUG1( "CMPXEmbeddedPlaybackViewImp::~CMPXEmbeddedPlaybackViewImp exiting" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Updates Title Pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::UpdateTitlePaneL()
+    {
+    MPX_FUNC( "CMPXEmbeddedPlaybackViewImp::UpdateTitlePaneL" );
+
+    CAknTitlePane* title( static_cast<CAknTitlePane*>
+            ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ))));
+    if ( title )
+        {
+        RProcess process;
+        TApaAppInfo appInfo;
+        RApaLsSession session;
+        User::LeaveIfError( session.Connect() ); // May want to ignore error
+        CleanupClosePushL( session );
+
+        TInt err = session.GetAppInfo( appInfo, MPXTlsHelper::HostUid() );
+        if(!err)
+            {
+            title->SetTextL( appInfo.iCaption );
+            }
+       CleanupStack::PopAndDestroy(); // Close RApaLsSession session
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates track info field.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::UpdateTrackInfoL(
+    const CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXEmbeddedPlaybackViewImp::UpdateTrackInfo" );
+
+    CMPXCommonPlaybackViewImp::UpdateTrackInfoL( aMedia );
+
+    if( iContainer &&
+        aMedia &&
+        iCommonUiHelper->IsHostPodcastingAppL() )
+        {
+        // if embedded view is launched via podcasting app
+        // display episode name and title
+
+        // Set ETextArtist field as Podcast Title
+        if ( aMedia->IsSupported(
+                TMPXAttribute( KMPXMediaIdMusic,
+                               EMPXMediaMusicAlbum )))
+            {
+            HBufC* titleText = aMedia->ValueText(
+                    TMPXAttribute( KMPXMediaIdMusic,
+                                   EMPXMediaMusicAlbum )).AllocL();
+            CleanupStack::PushL(titleText);
+            if ( titleText->Length() > 0)
+                {
+                iContainer->UpdateLabelL( ETextArtist, *titleText );
+                }
+            else
+                {
+                HBufC* unknownText =
+                    StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_TITLE );
+                iContainer->UpdateLabelL(
+                    ETextArtist, *unknownText );
+                CleanupStack::PopAndDestroy( unknownText );
+                }
+            CleanupStack::PopAndDestroy( titleText );
+            }
+        else
+            {
+            HBufC* unknownText =
+                    StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_TITLE );
+            iContainer->UpdateLabelL(
+                ETextArtist, *unknownText );
+            CleanupStack::PopAndDestroy( unknownText );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::HandleErrorL( TInt aError )
+    {
+    if ( aError )
+        {
+        MPX_DEBUG2( "CMPXEmbeddedPlaybackViewImp::HandleErrorL(%d)", aError );
+
+        TBool omaFlag = EFalse;
+        TInt plCount( KErrNotFound );
+        MMPXSource* source = iPlaybackUtility->Source();
+        if ( source )
+            {
+            CMPXCollectionPlaylist* pl( source->PlaylistL() );
+            if ( pl )
+                {
+                CleanupStack::PushL( pl );
+                plCount = pl->Count();
+                CleanupStack::PopAndDestroy( pl );
+                }
+            }
+
+        if ( plCount == 1 )
+            {
+#ifndef CAMESE_IN_DRM_UTILITY
+            // If Camese support is enabled,
+            // check if the song is protected WMA
+            // and let Camese handle it in case it is.
+            if (iCameseSuperDistSupport &&
+                    iMedia)
+                {
+                // Check protection and media type
+                if ( iMedia->IsSupported( KMPXMediaDrmProtected ) &&
+                        iMedia->IsSupported( KMPXMediaDrmType ) )
+                    {
+                    TBool prot( iMedia->ValueTObjectL<TBool>( KMPXMediaDrmProtected ) );
+                    TMPXMediaDrmType type( iMedia->ValueTObjectL<TMPXMediaDrmType>( KMPXMediaDrmType ) );
+
+                    if (prot && (EMPXDrmTypeWMA == type))
+                        {
+                        MPX_DEBUG1( "CMPXEmbeddedPlaybackViewImp::HandleErrorL: Let Camese Handle Error");
+                        // Let Camese Handle errors in this case.
+                        return;
+                        }
+                    if (prot && (EMPXDrmTypeOMA == type))
+                        {
+                        omaFlag = ETrue;
+                        }
+                    }
+                }
+#endif
+            if ( aError == KErrCorrupt || aError == KErrNotSupported )
+                {
+                // special handling is needed for KErrCorrupt/KErrNotSupported with just 1 song
+                iCommonUiHelper->HandleErrorL( aError );
+                }
+            else if (omaFlag)
+                {
+                iCommonUiHelper->HandleErrorL( aError, iMedia );
+                }
+            else
+                {
+                CMPXCommonPlaybackViewImp::HandleErrorL( aError );
+                }
+
+            iPlaybackUtility->CommandL( EPbCmdStop );
+            if( aError != KErrArgument && aError != KErrCompletion )
+                {
+                HandleCommandL( EAknSoftkeyBack );
+                }
+            }
+        else
+            {
+            // let base class handle it
+            CMPXCommonPlaybackViewImp::HandleErrorL( aError );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From base class CMPXCommonPlaybackViewImp
+//
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::DoHandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXEmbeddedPlaybackViewImp::DoHandlePropertyL" );
+    MPX_DEBUG4( "HandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError );
+
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty  )
+            {
+            case EPbPropertyPosition:
+                {
+                TInt duration(aValue / KMPXOneSecInMilliSecs);
+                if( duration > iDuration)
+                    {
+                    HandleCommandL(EMPXCmdStop);
+                    }
+                else
+                    {
+                    CMPXCommonPlaybackViewImp::DoHandlePropertyL(aProperty,
+                        aValue,
+                        aError);
+                    }
+                break;
+                }
+            default:
+                {
+                CMPXCommonPlaybackViewImp::DoHandlePropertyL(aProperty,
+                    aValue,
+                    aError);
+                break;
+                }
+            }
+        }
+    else
+        {
+        HandleErrorL( aError );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCHelperEmbeddedOpenObserver
+// Handles errors from that occured in embedded mode
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::HandleEmbeddedOpenL(
+    TInt aErr,
+    TMPXGeneralCategory /*aCategory*/ )
+    {
+    if ( KErrNone != aErr )
+        {
+        HandleErrorL( aErr );
+
+        // Kill MPX
+        AppUi()->RunAppShutter();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    // Override base menu actions
+    switch ( aResourceId )
+        {
+        case R_MPX_EMBEDDED_PLAYBACK_VIEW_MENU:
+            {
+            if ( iCommonUiHelper->IsHostMessagingL() )
+                {
+                AppUi()->HandleCommandL( EMPXCmdIsFileSaved );
+                }
+            // Disable Save command if not launched from the specified apps
+            if ( !MPXTlsHelper::NeedSave() ||
+                 EPbStateNotInitialised == iPlaybackState ||
+                 EPbStateInitialising == iPlaybackState )
+                {
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdSave,
+                    ETrue);
+                }
+            TBool isOfflineMode( EFalse );
+            TBool isFormatNotSupported( EFalse );
+            if ( !isOfflineMode && iMedia )
+                {
+                if ( iMedia->IsSupported( KMPXMediaDrmProtected ) )
+                    {
+                    if ( iMedia->ValueTObjectL<TBool>( KMPXMediaDrmProtected ) &&
+                        iMedia->IsSupported( KMPXMediaDrmCanSetAutomated ) )
+                        {
+                        // if it's drm protected, check if
+                        // KMPXMediaDrmCanSetAutomated
+                        isFormatNotSupported = !(
+                            iMedia->ValueTObjectL<TBool>( KMPXMediaDrmCanSetAutomated ) );
+                        }
+                    }
+                }
+            if ( isOfflineMode ||
+                 !iMedia ||
+                 isFormatNotSupported )
+                {
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdUseAsCascade,
+                    ETrue );
+                }
+
+            if(iCommonUiHelper->IsHostPodcastingAppL())
+                {
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdUseAsCascade,
+                    ETrue );
+
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdSave,
+                    ETrue);
+                }
+
+			// Check if FM Transmitter is supported
+			if ( !FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+				{
+				aMenuPane->SetItemDimmed(
+					EMPXPbvCmdFMTransmitter,
+					ETrue );
+				}
+            break;
+            }
+        default:
+            {
+            // Call base clase to handle other cases
+            CMPXCommonPlaybackViewImp::DynInitMenuPaneL( aResourceId, aMenuPane );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Returns views id.
+// ---------------------------------------------------------------------------
+//
+TUid CMPXEmbeddedPlaybackViewImp::Id() const
+    {
+    return TUid::Uid( KMPXEmbeddedPlaybackViewId );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Command handling function
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::HandleCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2("CMPXEmbeddedPlaybackViewImp::HandleCommandL(%d): entering", aCommand);
+
+    switch ( aCommand )
+        {
+        case EMPXPbvCmdSave:
+            {
+            HandleSaveL( EMPXNpvOpenAfterSave );
+            break;
+            }
+        case EMPXCmdSaveCancelled:
+            {
+            iSaveInProgress = EFalse;
+            break;
+            }
+        case EMPXCmdSaveComplete:
+            {
+            iSaveInProgress = EFalse;
+            MPXTlsHelper::SetNeedSave( EFalse );
+            break;
+            }
+        case EMPXCmdSaveNotProgress:
+            {
+            iSaveInProgress = EFalse;
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            if ( iCommonUiHelper->IsHostMessagingL() )
+                {
+                AppUi()->HandleCommandL( EMPXCmdIsFileSaved );
+                }
+            // If this was a playlist, transition back to collection view
+            //
+            if( MPXTlsHelper::LaunchMode() == EMPXLaunchModePlaylist )
+                {
+                CMPXCommonPlaybackViewImp::HandleCommandL( aCommand );
+                }
+            // Song Handling, does it need to be saved?
+            //
+            else if ( MPXTlsHelper::NeedSave() )
+                {
+                HandleSaveL( EMXPNpvExitAppAfterSave );
+                }
+            else
+                {
+                // If back command, only shutdown the embedded view
+                AppUi()->RunAppShutter();
+                }
+            break;
+            }
+        case EAknCmdExit:
+        case EAknSoftkeyExit:
+        case EEikCmdExit:
+            {
+            if ( MPXTlsHelper::NeedSave() )
+                {
+                HandleSaveL( EMPXNpvExitHostAppAfterSave );
+                }
+            else
+                {
+                // If exit command, then close host application as well
+                CAknEnv::RunAppShutter();
+                }
+            break;
+            }
+    case EMPXPbvCmdUseAsCascade:
+    case EMPXPbvCmdAiwCmdAssign:
+        {
+        const TDesC& savedpath = MPXTlsHelper::FilePath();
+        const TDesC& mediapath = iMedia->ValueText( KMPXMediaGeneralUri );
+        TFileName fullName(mediapath);
+        TParsePtrC fileParse( fullName );
+        TBool isPrivate = (fileParse.NamePresent() &&
+            !KMPXMusicplayerPrivateFolder().CompareF(
+                fileParse.Path().Left(
+                    KMPXMusicplayerPrivateFolder().Length())));
+
+        if ( iCommonUiHelper->IsHostMessagingL()
+                && mediapath.CompareF(savedpath) && isPrivate )
+            {
+            HandleSaveL( (TMPXNpvSaveMode)aCommand );
+            }
+        else
+            {
+            CMPXCommonPlaybackViewImp::HandleCommandL( aCommand );
+            }
+        break;
+        }
+        default:
+            {
+            CMPXCommonPlaybackViewImp::HandleCommandL( aCommand );
+            break;
+            }
+        }
+
+    MPX_DEBUG1("CMPXEmbeddedPlaybackViewImp::HandleCommandL(): exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Handles a view activation.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::DoActivateL(
+    const TVwsViewId& aPrevViewId,
+    TUid aCustomMessageId,
+    const TDesC8& aCustomMessage )
+    {
+    MPX_FUNC( "CMPXEmbeddedPlaybackViewImp::DoActivateL()" );
+
+    if ( !iContainer )
+        {
+        if ( !iPlaybackViewLayout )
+            {
+            iPlaybackViewLayout = CMPXEmbeddedPlaybackViewLayout::NewL();
+            }
+        iContainer = new ( ELeave ) CMPXEmbeddedPlaybackViewContainer(
+            this,
+            this,
+            iPlaybackViewLayout,
+            iCommonUiHelper );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( ClientRect() );
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    CMPXCommonPlaybackViewImp::DoActivateL( aPrevViewId , aCustomMessageId, aCustomMessage );
+    }
+
+// ---------------------------------------------------------------------------
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aProperties.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::DoHandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC("CMPXEmbeddedPlaybackViewImp::DoHandleMediaL");
+    if ( iPrepareToSave )
+        {
+        delete iMedia;
+        iMedia = NULL;
+        iPrepareToSave = EFalse;
+
+        if ( KErrNone == aError )
+            {
+            iMedia = CMPXMedia::NewL( aMedia );
+            HandleSaveL( EMPXNpvUsePreviousMode );
+            }
+        else
+            {
+            HandleErrorL( aError );
+            }
+        }
+    else
+        {
+        CMPXCommonPlaybackViewImp::DoHandleMediaL( aMedia, aError );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle saving a file
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::HandleSaveL( TMPXNpvSaveMode aMode )
+    {
+    MPX_DEBUG1("CMPXEmbeddedPlaybackViewImp::HandleSaveL(): entering");
+
+    if ( !iSaveInProgress )
+        {
+        if ( aMode != EMPXNpvUsePreviousMode )
+            {
+            iSaveMode = aMode;
+            }
+
+        if ( !iMedia )
+            {
+            iPrepareToSave = ETrue;
+            RequestMediaL();
+            }
+        else
+            {
+            iSaveInProgress = ETrue;
+            TInt cmd( EMPXCmdSaveAndReopen );
+            if ( iSaveMode == EMXPNpvExitAppAfterSave )
+                {
+                cmd = EMPXCmdSaveAndExit;
+                }
+            else if ( iSaveMode == EMPXNpvExitHostAppAfterSave )
+                {
+                cmd = EMPXCmdSaveAndExitHostApp;
+                }
+            else if ( iSaveMode == EMPXPbvCmdUseAsCascade )
+                {
+                cmd = EMPXCmdSaveForUseAsContact;
+                }
+            else if ( iSaveMode == EMPXPbvCmdAiwCmdAssign )
+                {
+                cmd = EMPXCmdSaveForUseAsRingtone;
+                }
+            MPX_TRAPD( err, AppUi()->HandleCommandL( cmd ) );
+            if ( KErrNone != err )
+                {
+                iSaveInProgress = EFalse;
+                HandleErrorL( err );
+                }
+            }
+        }
+
+    MPX_DEBUG1("CMPXEmbeddedPlaybackViewImp::HandleSaveL(): exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_DEBUG1( "CMPXEmbeddedPlaybackViewImp::DoHandlePlaybackMessageL");
+
+    TMPXMessageId id( *aMessage.Value<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( *aMessage.Value<TInt>( KMPXMessageGeneralType ) );
+        TInt data( *aMessage.Value<TInt>( KMPXMessageGeneralData ) );
+        switch ( *aMessage.Value<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EStateChanged:
+                UpdateMiddleSoftKeyDisplayL();
+                UpdateToolbar();
+                break;
+
+            default:
+                break;
+            }
+        }
+    CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL (aMessage);
+    }
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Used to change toolbar settings before toolbar becomes visible
+// -----------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::DynInitToolbarL(TInt aResourceId, CAknToolbar* aToolbar)
+    {
+    if (aResourceId == R_MPX_PBV_TOUCH_TOOLBAR)
+        {
+        // Put initializations here to take effect before toolbar is shown
+        UpdateToolbar();
+        aToolbar->UpdateBackground();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Handles toolbar events
+// -----------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewImp::OfferToolbarEventL( TInt aCommandId )
+    {
+    TInt commandId = aCommandId;
+    TInt eventModifiers = iToolbar->EventModifiers();
+    if ( eventModifiers == CAknToolbar::ELongPress )
+        {
+        if ( aCommandId == EMPXPbvCmdNextListItem )
+            {
+            commandId = EMPXPbvCmdSeekForward;
+            }
+        else if ( aCommandId == EMPXPbvCmdPreviousListItem )
+            {
+            commandId = EMPXPbvCmdSeekBackward;
+            }
+        }
+    else if ( eventModifiers == CAknToolbar::ELongPressEnded )
+        {
+        if ( aCommandId == EMPXPbvCmdNextListItem || aCommandId == EMPXPbvCmdPreviousListItem )
+            {
+            commandId = EMPXPbvCmdEndSeek;
+            }
+        }
+
+    CAknView::ProcessCommandL( commandId );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/embeddedplaybackview/src/mpxembeddedplaybackviewlayout.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Layout and graphic factory for Playback View
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <barsread.h>
+#include <gulicon.h>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <layoutmetadata.cdl.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxembeddedplaybackview.rsg>
+#include <mpxembeddedplaybackview.mbg>
+#include <centralrepository.h>
+#include <mpxinternalcrkeys.h>
+#include <mpxlbxextendedfeatures.h>
+#include <mpxuser.h>
+#include "mpxembeddedplaybackviewlayout.h"
+#include "mpxlog.h"
+
+using namespace AknLayoutScalable_Apps;
+
+// CONSTANTS
+_LIT( KMPXPodcastPlaybackViewIconFile, "mpxembeddedplaybackview.mbm" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewLayout* CMPXEmbeddedPlaybackViewLayout::NewL()
+    {
+    CMPXEmbeddedPlaybackViewLayout* self = CMPXEmbeddedPlaybackViewLayout::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewLayout* CMPXEmbeddedPlaybackViewLayout::NewLC()
+    {
+    CMPXEmbeddedPlaybackViewLayout* self = new ( ELeave ) CMPXEmbeddedPlaybackViewLayout();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewLayout::~CMPXEmbeddedPlaybackViewLayout()
+    {
+    // Do nothing
+    if(iCommonUiHelper)
+        {
+        delete iCommonUiHelper;
+        iCommonUiHelper = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXEmbeddedPlaybackViewLayout::CMPXEmbeddedPlaybackViewLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXEmbeddedPlaybackViewLayout::ConstructL()
+    {
+    MPX_FUNC( "CMPXEmbeddedPlaybackViewLayout::ConstructL" );
+    iCommonUiHelper = CMPXCommonUiHelper::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Get the bitmap and mask for a given indicator.
+// ---------------------------------------------------------------------------
+//
+CGulIcon* CMPXEmbeddedPlaybackViewLayout::GetIndicatorIconMaskL(
+    TMPXPbvIndicator aIndicator )
+    {
+    TParse parse;
+    parse.Set( KMPXPodcastPlaybackViewIconFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    switch ( aIndicator )
+        {
+        case EAlbumArtArea:
+            {
+            if( iCommonUiHelper &&
+                iCommonUiHelper->IsHostPodcastingAppL())
+                {
+                return AknsUtils::CreateGulIconL(
+                    skin,
+                    KAknsIIDNone,
+                    iconFile,
+                    EMbmMpxembeddedplaybackviewQgn_indi_mup_default_album_pcast,
+                    EMbmMpxembeddedplaybackviewQgn_indi_mup_default_album_pcast_mask );
+                }
+            else
+                {
+                return CMPXCommonPlaybackViewLayout::GetIndicatorIconMaskL(
+                aIndicator );
+                }
+            }
+        default:
+            {
+            return CMPXCommonPlaybackViewLayout::GetIndicatorIconMaskL(
+                aIndicator );
+            }
+        }
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/equalizerview/bwinscw/mpxequalizerviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?NewL@CMPXEqualizerView@@SAPAV1@XZ @ 1 NONAME ; class CMPXEqualizerView * CMPXEqualizerView::NewL(void)
+
Binary file mpxplugins/viewplugins/views/equalizerview/data/nullsound.mp3 has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/equalizerview/eabi/mpxequalizerviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_ZN17CMPXEqualizerView4NewLEv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/equalizerview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxequalizerview.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// Empty sound file
+../data/nullsound.mp3 /epoc32/release/winscw/udeb/z/system/data/nullsound.mp3
+../data/nullsound.mp3 /epoc32/data/z/system/data/nullsound.mp3
+
+PRJ_MMPFILES
+mpxequalizerview.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/equalizerview/group/mpxequalizerview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxequalizerview.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxequalizerview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC76
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxequalizerview.cpp
+#if defined(__EQUALIZER) && defined(__AUDIO_EFFECTS_API) 
+SOURCE          mpxequalizerhelper.cpp
+#else
+SOURCE          mpxequalizerhelperstub.cpp
+#endif
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/mmf/common
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         commonengine.lib
+LIBRARY         centralrepository.lib
+LIBRARY         cdlengine.lib
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcommon.lib
+
+#if defined(__EQUALIZER) && defined(__AUDIO_EFFECTS_API)
+LIBRARY         audioequalizerutility.lib
+LIBRARY         equalizer.lib
+LIBRARY         mediaclientaudio.lib
+#endif
+
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/equalizerview/inc/mpxequalizerhelper.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,223 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class for managing equalizer utility instances.
+*
+*/
+
+
+
+#ifndef C_MPXEQUALIZERHELPER_H
+#define C_MPXEQUALIZERHELPER_H
+
+
+//  INCLUDES
+#include <EqualizerPresetsDialog.h>
+#include <mdaaudiosampleplayer.h>
+#include <mpxplaybackobserver.h>
+
+#include "mpxequalizerview.h"
+
+
+// FORWARD DECLARATIONS
+class MMPXPlaybackUtility;
+class CAudioEqualizerUtility;
+class CEqualizerPresetsDialog;
+
+
+// CLASS DECLARATION
+
+/**
+ *  Helper class for managing equalizer utility instances.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXEqualizerHelper ) : public CMPXEqualizerView,
+                                           public MMPXPlaybackObserver,
+                                           public MEqualizerPresetActivationObserver,
+                                           public MMdaAudioPlayerCallback
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXEqualizerHelper* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXEqualizerHelper();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXEqualizerHelper();
+    
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Initialize audio equalizer utility for current active playing track.
+     */
+    void InitializeEqualizerUtilityL();
+
+    /**
+     * Release audio equalizer utility.
+     */
+    void ReleaseEqualizerUtility();
+
+    /**
+     * Get current preset ID.
+     *
+     * @param aPresetId On return, Current preset ID.
+     * @return Index to the preset array if found.
+     *         KErrNotFound if not found.
+     */
+    TInt GetPresetId( TInt& aPresetId );
+
+    /**
+     * Initialize secondary audio equalizer utility
+     * for situations when the engine cannot provide one.
+     */
+    void InitializeBackupEqualizerUtilityL();
+
+    /**
+     * Create secondary audio equalizer utility
+     * based on latest preset settings.
+     */
+    void CreateBackupEqualizerUtility();
+
+    /**
+     * Setup active equalizer utility for equalizer dialog.
+     */
+    void SetupActiveEqualizerUtility();
+
+    /**
+     * Launch equalizer dialog.
+     */
+    void DoLaunchEqualizerDialogL();
+
+    /**
+     *  Handle playback message
+     *
+     *  @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL( 
+        const CMPXMessage& aMessage );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     */
+    void DoHandleStateChangedL(
+        TMPXPlaybackState aState );
+
+// from base class CMPXEqualizerView
+
+    /**
+     * From CMPXEqualizerView
+     * Launch equalizer dialog.
+     *
+     * @since 3.0
+     */
+    void LaunchEqualizerL();
+
+// from base class MMPXPlaybackObserver
+
+    /**
+     * From MMPXPlaybackObserver
+     * Handle playback message
+     * 
+     * @param aMessage playback message
+     * @param aErr system error code.
+     */
+    void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+    
+// from base class MEqualizerPresetActivationObserver
+
+    /**
+     * From MEqualizerPresetActivationObserver
+     * Handle preset id activation from Equalizer dialog.
+     * 
+     * @param aActivatedPreset Current activated preset id.
+     */
+    void HandlePresetActivation( TInt aActivatedPreset );
+
+// from base class MMdaAudioPlayerCallback
+
+    /**
+     * From MMdaAudioPlayerCallback.
+     * Callback when an attempt to open and initialise an audio sample 
+     * has completed.
+     *
+     * @param aError The status of the audio sample after initialisation.
+     * @param aDuration The duration of the audio sample.
+     */
+    void MapcInitComplete(
+        TInt aError,
+        const TTimeIntervalMicroSeconds& aDuration );
+
+    /**
+     * From MMdaAudioPlayerCallback.
+     * Callback when an attempt to playback an audio sample has completed.
+     *
+     * @param aError The status of playback.
+     */
+    void MapcPlayComplete( TInt aError );
+
+private:    // Data
+
+    // Pointer to the equalizer utility we use. 
+    // This is either the equalizer utility provided by Music
+    // Player Engine or iBackupEqualizerUtility.
+    CAudioEqualizerUtility* iEqualizerUtility;          // not owned
+
+    // Play utility used to open the 'null sound' file and
+    // create iBackupEqualizerUtility
+    CMdaAudioPlayerUtility* iPlayUtility;               // owned
+
+    // Equalizer utility for the active playback utility
+    CAudioEqualizerUtility* iAudioEqualizerUtility;     // owned
+
+    // Backup equalizer utility instance used when the equalizer custom
+    // interface cannot be created by using the active play utility
+    CAudioEqualizerUtility* iBackupEqualizerUtility;   // owned
+
+    // Current playback utility
+    MMPXPlaybackUtility* iPlaybackUtility;  // not own, but need to close
+
+    CEqualizerPresetsDialog* iEqDialog;     // not own
+
+    // Should be launch equalizer dialog on open complete callback
+    TBool iLaunchEqualizerOnOpenComplete;
+
+    // iPlayUtility->OpenL() has been called but not yet completed
+    TBool iOpenInProgress;
+    
+    // Used to syncronize backup equalizer creation and dialog launching
+    CActiveSchedulerWait* iWait;
+    };
+
+#endif  // C_MPXEQUALIZERHELPER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/equalizerview/src/mpxequalizerhelper.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,550 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class for managing equalizer utility instances.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AudioEqualizerUtility.h>
+#include <mdaaudiosampleplayer.h>
+#include <centralrepository.h>
+#include <textresolver.h>
+#include <aknnotewrappers.h>
+#include <akntoolbar.h>
+#include <layoutmetadata.cdl.h>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxprivatecrkeys.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxuser.h>
+#include "mpxequalizerhelper.h"
+#include "mpxlog.h"
+#include <aknclearer.h>
+
+
+// CONSTANTS
+// Null file path
+_LIT( KMPXNullSoundPath, "\\system\\data\\nullsound.mp3" );
+const TInt KEqualizerID = 0x101FFC76;
+// Music setting
+const TUid KCRUidMPXMPSettings = {0x101FFCDC};
+const TUint32 KMPXMPEqPresetId = 0x00000001;
+
+const TUid KCRUidOldMPSettings = {0x101F880C};
+const TUint32 KOldMPEqPresetId = 0x00000009;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXEqualizerHelper::CMPXEqualizerHelper()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::ConstructL()
+    {
+    // Get the playback utility instance from engine.
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+    iPlaybackUtility->AddObserverL( *this );
+    iWait = new( ELeave )CActiveSchedulerWait;
+    InitializeBackupEqualizerUtilityL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXEqualizerHelper* CMPXEqualizerHelper::NewL()
+    {
+    CMPXEqualizerHelper* self =
+        new ( ELeave ) CMPXEqualizerHelper();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXEqualizerHelper::~CMPXEqualizerHelper()
+    {
+    delete iAudioEqualizerUtility;
+    delete iBackupEqualizerUtility;
+    iEqualizerUtility = NULL;
+    iEqDialog = NULL;
+
+    if ( iPlayUtility )
+        {
+        if ( iPlaybackUtility )
+            {
+            TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+            }
+        iPlayUtility->Close();
+        }
+    delete iPlayUtility;
+
+    if ( iPlaybackUtility )
+        {
+        iPlaybackUtility->Close();
+        }
+   	delete iWait;
+    iWait = NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// Initialize audio equalizer utility for current active playing track.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::InitializeEqualizerUtilityL()
+    {
+    MPX_FUNC( "CMPXEqualizerHelper::InitializeEqualizerUtilityL" );
+
+    ReleaseEqualizerUtility();
+
+    //CCustomCommandUtility* customCmdUtility =
+    //    CMPXPlaybackCCustomCommandUtility::NewCustomCommandUtilityL(
+    //        *iPlaybackUtility );
+    //CleanupStack::PushL( customCmdUtility );
+
+    //iAudioEqualizerUtility =
+    //    CAudioEqualizerUtility::NewL( customCmdUtility );
+    //MPX_DEBUG2( "--> CAudioEqualizerUtility created ok (0x%08x)",
+    //    iAudioEqualizerUtility );
+
+    //CleanupStack::Pop( customCmdUtility );  // ownership is transferred
+
+    SetupActiveEqualizerUtility();
+
+    TInt ignore( KEqualizerPresetNone );
+    TInt index = GetPresetId( ignore );
+    if ( KErrNotFound != index )
+        {
+        iEqualizerUtility->ApplyPresetL( index );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Release audio equalizer utility.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::ReleaseEqualizerUtility()
+    {
+    MPX_FUNC( "CMPXEqualizerHelper::ReleaseEqualizerUtility" );
+
+    if ( iEqDialog )
+        {
+        // Recreate Backup Equalizer Utility to make sure it can get the
+        // latest presets.
+        if ( !iBackupEqualizerUtility )
+            {
+            CreateBackupEqualizerUtility();
+            }
+
+        MPX_DEBUG2( "--> iEqDialog->SetAudioEqualizerL(0x%08x)",
+            iBackupEqualizerUtility );
+
+        TRAP_IGNORE(
+            iEqDialog->SetAudioEqualizerL( iBackupEqualizerUtility ) );
+        }
+
+    iEqualizerUtility = iBackupEqualizerUtility;
+
+    if ( iAudioEqualizerUtility )
+        {
+        delete iAudioEqualizerUtility;
+        iAudioEqualizerUtility = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get current preset ID.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXEqualizerHelper::GetPresetId( TInt& aPresetId )
+    {
+    MPX_FUNC( "CMPXEqualizerHelper::GetPresetId" );
+
+    // Get preset id from cenrep
+    TInt presetId( KEqualizerPresetNone );
+    TRAP_IGNORE(
+        {
+        CRepository* repository = CRepository::NewL( KCRUidMPXMPSettings );
+        repository->Get( KMPXMPEqPresetId, presetId );
+        delete repository;
+        repository = NULL;
+        } );
+
+    TInt index( KErrNotFound );
+    if ( iEqualizerUtility && presetId != KEqualizerPresetNone )
+        {
+        TArray<TEfAudioEqualizerUtilityPreset> presetArray =
+            iEqualizerUtility->Presets();
+
+        TBool found( EFalse );
+        for ( TInt i = 0; i < presetArray.Count() && found == EFalse; i++ )
+            {
+            if ( presetArray[i].iPresetNameKey ==
+                static_cast<TUint32>( presetId ) )
+                {
+                found = ETrue;
+                index = i;
+                aPresetId = presetId;
+                }
+            }
+        }
+    else
+        {
+        aPresetId = KEqualizerPresetNone;
+        }
+
+    MPX_DEBUG2( "--> Preset id get: %d", presetId );
+    return index;
+    }
+
+// ---------------------------------------------------------------------------
+// Initialize secondary audio equalizer utility for situations when the
+// engine cannot provide one.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::InitializeBackupEqualizerUtilityL()
+    {
+    MPX_FUNC( "CMPXEqualizerHelper::InitializeBackupEqualizerUtilityL()" );
+
+    if ( iOpenInProgress )
+        {
+        // OpenFileL already called
+        return;
+        }
+
+    if ( !iPlayUtility )
+        {
+        iPlayUtility = CMdaAudioPlayerUtility::NewL(
+            *this,
+            EMdaPriorityMin,
+            EMdaPriorityPreferenceNone );
+        }
+
+    TFileName nullSoundPath( KMPXNullSoundPath );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( nullSoundPath ) );
+    iPlayUtility->OpenFileL( nullSoundPath );
+    iOpenInProgress = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// Create secondary audio equalizer utility based on latest preset settings.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::CreateBackupEqualizerUtility()
+    {
+    if ( iPlayUtility )
+        {
+        delete iBackupEqualizerUtility;
+        iBackupEqualizerUtility = NULL;
+        TRAP_IGNORE( iBackupEqualizerUtility =
+            CAudioEqualizerUtility::NewL( *iPlayUtility ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Setup active equalizer utility for equalizer dialog.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::SetupActiveEqualizerUtility()
+    {
+    CAudioEqualizerUtility* oldUtility( iEqualizerUtility );
+
+    // Try to use the real equalizer utility first
+    if ( !iAudioEqualizerUtility && iBackupEqualizerUtility )
+        {
+        iEqualizerUtility = iBackupEqualizerUtility;
+        }
+    else
+        {
+        iEqualizerUtility = iAudioEqualizerUtility;
+        }
+
+    if ( iEqDialog && oldUtility != iEqualizerUtility )
+        {
+        MPX_DEBUG2( "--> iEqDialog->SetAudioEqualizerL(0x%08x)", iEqualizerUtility );
+        TRAP_IGNORE( iEqDialog->SetAudioEqualizerL( iEqualizerUtility ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Launch equalizer dialog.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::DoLaunchEqualizerDialogL()
+    {
+    MPX_FUNC( "CMPXEqualizerHelper::DoLaunchEqualizerDialogL()" );
+
+    __ASSERT_DEBUG(
+        iEqualizerUtility,
+        User::Panic( _L( "CMPXEqualizerHelper" ), KErrArgument ) );
+
+    TInt presetId( KEqualizerPresetNone );
+    GetPresetId( presetId );
+
+    CEqualizerPresetsDialog* dlg = CEqualizerPresetsDialog::NewL(
+        iEqualizerUtility, presetId, *this );
+    iEqDialog = dlg;
+    
+    CAknToolbar* toolbar =
+        static_cast< CAknAppUi* >(CEikonEnv::Static()->AppUi())->CurrentFixedToolbar();
+                     
+    TBool wasToolbarVisible = toolbar->IsVisible();            
+
+    if ( toolbar ) 
+        {
+        toolbar->HideItemsAndDrawOnlyBackground( ETrue );
+        }       
+
+    MPX_TRAPD( err, dlg->ExecuteLD() );
+    iEqDialog = NULL;
+
+    if ( toolbar && wasToolbarVisible ) 
+        {
+        toolbar->HideItemsAndDrawOnlyBackground( EFalse );
+        }
+
+    if ( err )
+        {
+        MPX_DEBUG2( "--> dlg->ExecuteLD() left with %d", err );
+        User::Leave( err );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXEqualizerHelper::DoHandlePlaybackMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                TMPXPlaybackState state(
+                    static_cast<TMPXPlaybackState>(
+                        aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) ) );
+                DoHandleStateChangedL( state );
+                break;
+                }
+            default:
+                {
+                // pass
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::DoHandleStateChangedL(
+    TMPXPlaybackState aState )
+    {
+    switch ( aState )
+        {
+        case EPbStateNotInitialised:
+        case EPbStateStopped:
+        case EPbStatePaused:
+        case EPbStateShuttingDown:
+            {
+            // Need to release Equalizer utility when audio is stopped.
+            // It's because of the limitation in adaptation layer.
+            ReleaseEqualizerUtility();
+            break;
+            }
+        case EPbStatePlaying:
+            {
+            // Need to initialize Equalizer utility when audio is started
+            // playing. It's because of the limitation in adaptation layer.
+            InitializeEqualizerUtilityL();
+            break;
+            }
+        default:
+            {
+            // pass
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXEqualizerView
+// Launch equalizer dialog.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::LaunchEqualizerL()
+    {
+    MPX_FUNC( "CMPXEqualizerHelper::LaunchEqualizerL" );
+
+    if ( iLaunchEqualizerOnOpenComplete )
+        {
+        // Waiting for open complete callback, cannot do anything now
+        return;
+        }
+
+    if ( !iPlayUtility || !iBackupEqualizerUtility )
+        {
+        // Backup equalizer does not exist, must initialize first
+        iLaunchEqualizerOnOpenComplete = ETrue;
+        InitializeBackupEqualizerUtilityL();
+        if( iWait )
+        	{
+        	iWait->Start();
+        	}
+        }
+    else
+        {
+        // Recreate Backup Equalizer Utility to make sure it can get the
+        // latest presets.
+        CreateBackupEqualizerUtility();
+
+        // Setup active equalizer utility and launch the dialog
+        SetupActiveEqualizerUtility();
+        DoLaunchEqualizerDialogL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEqualizerPresetActivationObserver
+// Handle preset id activation from Equalizer dialog.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::HandlePresetActivation(
+    TInt aActivatedPreset )
+    {
+    MPX_DEBUG2("CMPXEqualizerHelper::HandlePresetActivation %i", aActivatedPreset);
+    MPX_FUNC( "CMPXEqualizerHelper::HandlePresetActivation" );
+
+    // Store in CenRep file
+    TRAP_IGNORE(
+        {
+        CRepository* repository = CRepository::NewL( KCRUidMPXMPSettings );
+        TInt err = repository->Set( KMPXMPEqPresetId, aActivatedPreset );
+        delete repository;
+        repository = NULL;
+
+        repository = CRepository::NewL( KCRUidOldMPSettings );
+        err = repository->Set( KOldMPEqPresetId, aActivatedPreset );
+        delete repository;
+        repository = NULL;
+
+        } );
+
+    // Notify playback framework of the change.
+    //
+    TRAP_IGNORE( iPlaybackUtility->CommandL( EPbApplyEffect, KEqualizerID ) );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMdaAudioPlayerCallback
+// Callback when an attempt to open and initialise an audio sample
+// has completed.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::MapcInitComplete(
+    TInt aError,
+    const TTimeIntervalMicroSeconds& /* aDuration */ )
+    {
+    MPX_DEBUG3( "CMPXEqualizerHelper::MapcInitComplete(%d) -- iLaunchEqualizerOnOpenComplete=%d", aError, iLaunchEqualizerOnOpenComplete );
+
+    iOpenInProgress = EFalse;
+    if ( !aError )
+        {
+        // Recreate Backup Equalizer Utility to make sure it can get the
+        // latest presets.
+        CreateBackupEqualizerUtility();
+
+        if ( iBackupEqualizerUtility )
+            {
+            MPX_DEBUG2( "--> iBackupEqualizerUtility=0x%08x, NewL ok", iBackupEqualizerUtility );
+
+            // Setup active equalizer utility
+            SetupActiveEqualizerUtility();
+
+            if ( iLaunchEqualizerOnOpenComplete )
+                {
+                TRAP_IGNORE( DoLaunchEqualizerDialogL() );
+                }
+            }
+        }
+    else
+        {
+        TRAP_IGNORE(
+            {
+            // TextResolver instance for error resolving.
+            CTextResolver* textresolver = CTextResolver::NewLC();
+            // Resolve the error text
+            const TDesC& text =
+                textresolver->ResolveErrorString( aError );
+
+            CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+            dlg->ExecuteLD( text );
+            CleanupStack::PopAndDestroy( textresolver );
+            } );
+        }
+    iLaunchEqualizerOnOpenComplete = EFalse;
+    if( iWait && iWait->IsStarted() )
+		{
+    	iWait->AsyncStop();
+    	}
+    }
+
+// ---------------------------------------------------------------------------
+// From MMdaAudioPlayerCallback
+// Callback when an attempt to playback an audio sample has completed.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::MapcPlayComplete(
+    TInt /* aError */ )
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/equalizerview/src/mpxequalizerhelperstub.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Helper class for managing equalizer utility instances
+*                (stub version).
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <mpxplaybackmessage.h>
+#include <mpxmessagegeneraldefs.h>
+#include "mpxequalizerhelper.h"
+#include "mpxlog.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXEqualizerHelper::CMPXEqualizerHelper()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::ConstructL()
+    {
+    MPX_FUNC("CMPXEqualizerHelper::ConstructL");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXEqualizerHelper* CMPXEqualizerHelper::NewL()
+    {
+    MPX_FUNC("CMPXEqualizerHelper::NewL");
+    CMPXEqualizerHelper* self =
+        new ( ELeave ) CMPXEqualizerHelper();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXEqualizerHelper::~CMPXEqualizerHelper()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Initialize audio equalizer utility for current active playing track.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::InitializeEqualizerUtilityL()
+    {
+    MPX_FUNC("CMPXEqualizerHelper::InitializeEqualizerUtilityL");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Release audio equalizer utility.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::ReleaseEqualizerUtility()
+    {
+    MPX_FUNC("CMPXEqualizerHelper::ReleaseEqualizerUtility");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Get current preset ID.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXEqualizerHelper::GetPresetId( TInt& /* aPresetId */ )
+    {
+    MPX_FUNC("CMPXEqualizerHelper::GetPresetId");
+    return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// Initialize secondary audio equalizer utility for situations when the
+// engine cannot provide one.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::InitializeBackupEqualizerUtilityL()
+    {
+    MPX_FUNC("CMPXEqualizerHelper::InitializeBackupEqualizerUtilityL");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Create secondary audio equalizer utility based on latest preset settings.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::CreateBackupEqualizerUtility()
+    {
+    MPX_FUNC("CMPXEqualizerHelper::CreateBackupEqualizerUtility");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Setup active equalizer utility for equalizer dialog.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::SetupActiveEqualizerUtility()
+    {
+    MPX_FUNC("CMPXEqualizerHelper::SetupActiveEqualizerUtility");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Launch equalizer dialog.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::DoLaunchEqualizerDialogL()
+    {
+    MPX_FUNC("CMPXEqualizerHelper::DoLaunchEqualizerDialogL");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC("CMPXEqualizerHelper::DoHandlePlaybackMessageL");
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                TMPXPlaybackState state(
+                    static_cast<TMPXPlaybackState>(
+                        aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) ) );
+                DoHandleStateChangedL( state );
+                break;
+                }
+            default:
+                {
+                // pass
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::DoHandleStateChangedL(
+    TMPXPlaybackState /* aState */ )
+    {
+    MPX_FUNC("CMPXEqualizerHelper::DoHandleStateChangedL");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CMPXEqualizerView
+// Launch equalizer dialog.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::LaunchEqualizerL()
+    {
+    MPX_FUNC("CMPXEqualizerHelper::LaunchEqualizerL");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    MPX_FUNC("CMPXEqualizerHelper::HandlePlaybackMessage");
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEqualizerPresetActivationObserver
+// Handle preset id activation from Equalizer dialog.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::HandlePresetActivation(
+    TInt /* aActivatedPreset */ )
+    {
+    MPX_FUNC("CMPXEqualizerHelper::HandlePresetActivation");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMdaAudioPlayerCallback
+// Callback when an attempt to open and initialise an audio sample
+// has completed.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::MapcInitComplete(
+    TInt /* aError */,
+    const TTimeIntervalMicroSeconds& /* aDuration */ )
+    {
+    MPX_FUNC("CMPXEqualizerHelper::MapcInitComplete");
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMdaAudioPlayerCallback
+// Callback when an attempt to playback an audio sample has completed.
+// ---------------------------------------------------------------------------
+//
+void CMPXEqualizerHelper::MapcPlayComplete(
+    TInt /* aError */ )
+    {
+    MPX_FUNC("CMPXEqualizerHelper::MapcPlayComplete");
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/equalizerview/src/mpxequalizerview.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Equalizer view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxequalizerview.h"
+#include "mpxequalizerhelper.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXEqualizerView* CMPXEqualizerView::NewL()
+    {
+    return CMPXEqualizerHelper::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXEqualizerView::~CMPXEqualizerView()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Views.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+#include "../../../../inc/musicplayerbldvariant.hrh"
+#include "../commonplaybackview/group/bld.inf"
+#include "../commoncontainer/group/bld.inf"
+
+#include "../mainview/group/bld.inf"
+#include "../playbackview/group/bld.inf"
+#include "../embeddedplaybackview/group/bld.inf"
+#include "../pdplaybackview/group/bld.inf"
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+#include "../pdsbplaybackview/group/bld.inf"
+#endif
+#include "../collectionview/group/bld.inf"
+#include "../collectionviewhg/group/bld.inf"
+#include "../equalizerview/group/bld.inf"
+#include "../audioeffectsview/group/bld.inf"
+#include "../metadataeditordialog/group/bld.inf"
+#include "../albumarteditordialog/group/bld.inf"
+#include "../addtracksdialog/group/bld.inf"
+#include "../waitnotedialog/group/bld.inf"
+
+
+#ifdef IAD_INCLUDE_UPNP
+#include "../upnpbrowsedialog/group/bld.inf"
+#include "../upnpplaybackview/group/bld.inf"
+#include "../upnpplaybackdialog/group/bld.inf"
+#endif
+
+#include "../podcastview/group/bld.inf"
+#include "../podcastplaybackview/group/bld.inf"
+
+PRJ_EXPORTS
+../rom/mpxplaybackview.iby               CORE_APP_LAYER_IBY_EXPORT_PATH(mpxplaybackview.iby)
+../rom/mpxplaybackviewrsc.iby            LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxplaybackviewrsc.iby)
+../rom/mpxaddtracksdialog.iby            CORE_APP_LAYER_IBY_EXPORT_PATH(mpxaddtracksdialog.iby)
+../rom/mpxaddtracksdialogrsc.iby         LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxaddtracksdialogrsc.iby)
+../rom/mpxalbumarteditordialog.iby       CORE_APP_LAYER_IBY_EXPORT_PATH(mpxalbumarteditordialog.iby)
+../rom/mpxalbumarteditordialogrsc.iby    LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxalbumarteditordialogrsc.iby)
+../rom/mpxaudioeffectsview.iby           CORE_APP_LAYER_IBY_EXPORT_PATH(mpxaudioeffectsview.iby)
+../rom/mpxaudioeffectsviewrsc.iby        LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxaudioeffectsviewrsc.iby)
+../rom/mpxcollectionview.iby             CORE_APP_LAYER_IBY_EXPORT_PATH(mpxcollectionview.iby)
+../rom/mpxcollectionviewrsc.iby          LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxcollectionviewrsc.iby)
+../rom/mpxcollectionviewhg.iby           CORE_APP_LAYER_IBY_EXPORT_PATH(mpxcollectionviewhg.iby)
+../rom/mpxcollectionviewhgrsc.iby        LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxcollectionviewhgrsc.iby)
+../rom/mpxcommoncontainer.iby            CORE_APP_LAYER_IBY_EXPORT_PATH(mpxcommoncontainer.iby)
+../rom/mpxcommoncontainerrsc.iby         LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxcommoncontainerrsc.iby)
+../rom/mpxcommonplaybackview.iby         CORE_APP_LAYER_IBY_EXPORT_PATH(mpxcommonplaybackview.iby)
+../rom/mpxcommonplaybackviewrsc.iby      LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxcommonplaybackviewrsc.iby)
+../rom/mpxembeddedplaybackview.iby       CORE_APP_LAYER_IBY_EXPORT_PATH(mpxembeddedplaybackview.iby)
+../rom/mpxembeddedplaybackviewrsc.iby    LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxembeddedplaybackviewrsc.iby)
+../rom/mpxequalizerview.iby              CORE_APP_LAYER_IBY_EXPORT_PATH(mpxequalizerview.iby)
+../rom/mpxmainview.iby                   CORE_APP_LAYER_IBY_EXPORT_PATH(mpxmainview.iby)
+../rom/mpxmainviewrsc.iby                LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxmainviewrsc.iby)
+../rom/mpxmetadataeditordialog.iby       CORE_APP_LAYER_IBY_EXPORT_PATH(mpxmetadataeditordialog.iby)
+../rom/mpxmetadataeditordialogrsc.iby    LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxmetadataeditordialogrsc.iby)
+../rom/mpxpdplaybackview.iby             CORE_APP_LAYER_IBY_EXPORT_PATH(mpxpdplaybackview.iby)
+../rom/mpxpdplaybackviewrsc.iby          LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxpdplaybackviewrsc.iby)
+../rom/mpxpdsbplaybackview.iby           CORE_APP_LAYER_IBY_EXPORT_PATH(mpxpdsbplaybackview.iby)
+../rom/mpxpdsbplaybackviewrsc.iby        LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxpdsbplaybackviewrsc.iby)
+../rom/mpxwaitnotedialog.iby             CORE_APP_LAYER_IBY_EXPORT_PATH(mpxwaitnotedialog.iby)
+../rom/mpxwaitnotedialogrsc.iby          LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxwaitnotedialogrsc.iby)
+../rom/mpxpodcastview.iby                CORE_APP_LAYER_IBY_EXPORT_PATH(mpxpodcastview.iby)
+../rom/mpxpodcastviewrsc.iby             LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxpodcastviewrsc.iby)
+../rom/mpxpodcastplaybackview.iby        CORE_APP_LAYER_IBY_EXPORT_PATH(mpxpodcastplaybackview.iby)
+../rom/mpxpodcastplaybackviewrsc.iby     LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxpodcastplaybackviewrsc.iby)
+#ifdef IAD_INCLUDE_UPNP
+../rom/mpxupnpbrowsedialog.iby           CORE_APP_LAYER_IBY_EXPORT_PATH(mpxupnpbrowsedialog.iby)
+../rom/mpxupnpbrowsedialogrsc.iby        LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxupnpbrowsedialogrsc.iby)
+../rom/mpxupnpplaybackview.iby           CORE_APP_LAYER_IBY_EXPORT_PATH(mpxupnpplaybackview.iby)
+../rom/mpxupnpplaybackviewrsc.iby        LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxupnpplaybackviewrsc.iby)
+../rom/mpxupnpplaybackdialog.iby         CORE_APP_LAYER_IBY_EXPORT_PATH(mpxupnpplaybackdialog.iby)
+../rom/mpxupnpplaybackdialogrsc.iby      LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(mpxupnpplaybackdialogrsc.iby)
+#endif	 // IAD_INCLUDE_UPNP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxbutton.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,271 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Push-button in Common Playback View.
+*
+*/
+
+
+
+#ifndef CMPXBUTTON_H
+#define CMPXBUTTON_H
+
+
+// INCLUDES
+#include "mpxcommonplaybackviewdefs.h"
+
+// FORWARD DECLARATIONS
+class CGulIcon;
+class CWindowGc;
+class CAknKeySoundSystem;
+class MAknsControlContext;
+class MMPXPlaybackViewLayout;
+
+NONSHARABLE_STRUCT( TMPXButtonInfo )
+    {
+    TInt iState;
+    CGulIcon* iBitmap;
+    TInt iEnterCommand;
+    TInt iExitCommand;
+    TInt iLongEnterCommand;
+    TInt iLongExitCommand;
+    };
+
+// CLASS DECLARATION
+
+/**
+ * Observer interface to receive commands from button presses.
+ *
+ *  @lib mpxplaybackview.dll
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( MMPXButtonCmdObserver )
+    {
+    public:
+        /**
+         * Handle a button command.
+         * @param aCommand Command id, as specified in the button constructor.
+         */
+        virtual void HandleButtonCommandL( TInt aCommand ) = 0;
+
+    };
+
+
+/**
+*  Push-button in Playback View. This class encapsulates the graphics,
+*  state (pushed, dimmed, highlighted), and layout information of the button.
+*  The button calls the HandleButtonCommandL() function for the observer
+*  object when it is pushed.
+*
+*  @lib MusicPlayer.app
+*  @since 3.0
+*/
+NONSHARABLE_CLASS( CMPXButton ) : public CBase
+    {
+    public:  // Constructors and destructor
+        /**
+        * Two-phased constructor.
+        * @since 3.0
+        * @param aButtonId   Id for the button (determines layout and graphics)
+        * @param aObserver   Pointer to an object implementing the
+        *                    MMPlayerButtonCmdObserver interface.
+        * @param aLayout     Layout for this view
+        * @return New CMPlayerButton instance.
+        */
+        static CMPXButton* NewL(
+            TMPXPbvButton aButtonId,
+            MMPXButtonCmdObserver* aObserver,
+            MMPXPlaybackViewLayout* aLayout );
+
+        /**
+        * Two-phased constructor.
+        * @since 3.0
+        * @param aButtonId   Id for the button (determines layout and graphics)
+        * @param aObserver   Pointer to an object implementing the
+        *                    MMPlayerButtonCmdObserver interface.
+        * @param aLayout     Layout for this view
+        * @return New CMPlayerButton instance.
+        */
+        static CMPXButton* NewLC(
+            TMPXPbvButton aButtonId,
+            MMPXButtonCmdObserver* aObserver,
+            MMPXPlaybackViewLayout* aLayout );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPXButton();
+
+    public: // New functions
+        
+        /**
+        * Adds a new state to this button
+        * @since 3.0
+        * @param aState         ID of the state
+        * @param aEnterCommand  Command ID to execute when it enters this state
+        * @param aExitCommand   Command ID to execute whne it exits this state
+        * @param aLongEnterCommand  Command ID executes on a long press
+        * @param aLongExitCommand   Command ID to execute after a long press
+        */
+        void AddStateL( 
+            TInt aState,
+            TInt aEnterCommand,
+            TInt aExitCommand,
+            TInt aLongEnterCommand,
+            TInt aLongExitCommand );
+        
+        /**
+        * Get the id of the button.
+        * @since 3.0
+        * @return Button id (as specified in NewL())
+        */
+        TMPXPbvButton Id() const;
+
+        /**
+        * Hide/show this button
+        * @since 3.0
+        * @param aVisible  ETrue if this button is to be visible
+        */
+        void MakeVisible( TBool aVisible );
+
+        /**
+        * Get the visibility status of the button.
+        * @since 3.0
+        * @return ETrue if this button is visible
+        */
+        TBool IsVisible() const;
+        
+        /**
+        * Set the state of this button
+        * @since 3.0
+        * @param aState     New state to set to
+        * @param aNotifyExit Whether or not to notify observer of the
+        *                    exit command of previous state
+        * @param aNotifyEnter Whether or not to notify observer of the
+        *                     enter command of the new state
+        */
+        void SetButtonState( TInt aState,   
+                             TBool aNotifyExit=EFalse,
+                             TBool aNotifyEnter=EFalse );
+                
+        /**
+        * Get the current state of the button
+        * @since 3.0
+        * @return State of the button
+        */
+        TInt CurrentState() const;
+        
+        /**
+        * Draw the button according to its current state.
+        * @since 3.0
+        * @param aGc   Graphics context to draw to
+        * @param aRect Dirty rectangle. Drawing can be clipped inside this
+        *              rectangle.
+        */
+        void RedrawRect(CBitmapContext& aGc, const TRect& aRect) const;
+
+        /**
+        * Reload graphics.
+        * @since 3.0
+        * @param aParentRect New parent rectangle
+        */
+        void ReloadIconsL(const TRect& aParentRect);
+
+        /**
+        * Set background bitmap
+        * @since 3.0
+        * @param aBackground       Pointer to the skin background control
+        *                          context. Ownership not transferred.
+        */
+        void SetBackground(MAknsControlContext* aBackground);
+
+        /**
+        * Get the redraw flag.
+        * @since 3.0
+        * @return ETrue if this button needs to be redrawn
+        */
+        TBool NeedRedraw() const;
+
+        /**
+        * Clear the redraw flag.
+        * @since 3.0
+        */
+        void ClearRedrawFlag();
+
+    private: // New functions
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        /**
+        * C++ constructor
+        */
+        CMPXButton(
+            TMPXPbvButton aButtonId,
+            MMPXButtonCmdObserver* aObserver,
+            MMPXPlaybackViewLayout* aLayout );
+
+        /**
+        * Load the bitmap and mask for given state.
+        * @return CGulIcon containing bitmap and mask
+        */
+        CGulIcon* LoadIconL( TInt aState );
+
+        /**
+        * Free all icons
+        */
+        void FreeIcons();
+
+        /**
+        * Create a more translucent version of the mask to be used
+        * when the button is dimmed.
+        */
+        void CreateTmpDimmedMaskL();
+
+        /**
+        * Handle long press event.
+        */
+        void HandleLongPress();
+
+        /**
+        * Callback for long-press timer
+        */
+        static TInt TimerCallback(TAny* aPtr);
+
+    private:     // Data
+        TMPXPbvButton iButtonId;
+        TInt iCurrentStateIndex;
+        RPointerArray<TMPXButtonInfo> iButtonArray; // owned
+        MMPXButtonCmdObserver* iObserver; // not owned
+        
+        TRect iParentRect;
+        TRect iRect;
+
+        TBool iVisible;
+        TBool iIsLongPress;
+
+        CPeriodic* iTimer; // owned
+
+        MAknsControlContext* iBackground; // not owned
+
+        TBool iNeedRedraw;
+
+        CAknKeySoundSystem* iKeySoundSystem;  // not owned
+        TBool iSelectionKeySilent;
+        MMPXPlaybackViewLayout* iLayout;    // not owned
+    };
+
+#endif      // CMPXBUTTON_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxcbahandler.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX CBA handler
+*
+*/
+
+
+
+#ifndef MMPXCBAHANDLER_H
+#define MMPXCBAHANDLER_H
+
+
+// INCLUDES
+
+#include <e32std.h>
+
+// FORWARD DECLARATIONS
+
+class MMpxCbaHandler
+    {
+public:
+
+    virtual void ChangeCbaVisibility( TBool aVisible ) = 0;
+
+    };
+
+
+#endif  // MMPXCBAHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxcommoncontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,376 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX common container definition.
+*
+*/
+
+
+
+#ifndef MMPXCOMMONCONTAINER_H
+#define MMPXCOMMONCONTAINER_H
+
+
+// INCLUDES
+#include <coecntrl.h>
+#include "mpxcommonlistboxarrayobserver.h"
+#include "mpxcommonlistboxarraybase.h"
+#include "mpxviewcontainer.h"
+
+// FORWARD DECLARATIONS
+class CEikMenuPane;
+class MEikCommandObserver;
+class MEikListBoxObserver;
+class MMPXCommonListBoxArrayObserver;
+
+// CLASS DECLARATION
+
+/**
+ *  Abstract class for common container.
+ *  The view class should implement the following virtual function
+ *  from MEikCommandObserver
+ *
+ *  virtual void ProcessCommandL(TInt aCommandId);
+ *
+ *  common container uses this to pass commands back to the view class
+ *  the commands supported are defined in mpxcommoncontainer.hrh
+ *
+ *  view container class owns this class to access List box commands, receive
+ *  CoeControl events and GetHelpContext(). The view container class should
+ *  implement the following virtual functions from MViewContainer
+ *
+ *  virtual void HandleKeyEvent();
+ *  virtual void HandleHelpContent();
+ *
+ *  common container uses this to pass CoeControl events back to the view
+ *  container class.
+ *
+ *  view class should handle the following commands in ProcessCommandL
+ *  from MEikCommandObserver:
+ *
+ *  EMPXCmdCommonDelete  // delete key pressed
+ *  EMPXCmdCommonResourceChange  // resource change
+ *
+ *  @lib mpxcommoncontainer.lib
+ *  @since S60 v3.1
+ */
+class MMPXCommonContainer
+    {
+public:
+
+    enum TMPXCommonContainerCollectionType
+        {
+        EMPXCommonContainerMusic,
+        EMPXCommonContainerPodcast
+        };
+
+    /**
+     * Destructor.
+     */
+    virtual ~MMPXCommonContainer() {};
+
+    /**
+     * Return Coe Control
+     *
+     * @since 3.2
+     */
+    virtual CCoeControl* CoeControl() = 0;
+
+    /**
+     * Set View Container
+     *
+     * @since 3.2
+     */
+    virtual void SetViewContainer( MMPXViewContainer* aViewContainer ) = 0;
+
+    /**
+     * Set command observer for container
+     *
+     * @since 3.2
+     */
+    virtual void SetCommandObserver(
+        MEikCommandObserver* aCommandObserver ) = 0;
+
+    /**
+     * Set list box observer for container
+     *
+     * @since 3.2
+     */
+    virtual void SetListBoxObserver( MEikListBoxObserver* aObserver ) = 0;
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since 3.1
+     */
+    virtual void UpdateLayout() = 0;
+
+    /**
+     * Returns list box array, ownership not transfered
+     *
+     * @since 3.1
+     * @return A pointer to the list box array
+     */
+    virtual CMPXCommonListBoxArrayBase* ListBoxArray() const = 0;
+
+    /**
+     * Sets list box array, ownership not transfered
+     *
+     * @since 3.1
+     * @param A pointer to the list box array
+     */
+    virtual void SetListBoxArrayL(
+        CMPXCommonListBoxArrayBase* aListBoxArray) = 0;
+
+    /**
+     * Return number of listbox items shown in the current listbox.
+     *
+     * @since 3.1
+     * @return The number of items shown in the list box
+     */
+    virtual TInt CurrentListItemCount() const = 0;
+
+    /**
+     * Return total number of listbox items in the listbox.
+     *
+     * @since 3.1
+     * @return Total items in the list box
+     */
+    virtual TInt TotalListItemCount() const = 0;
+
+    /**
+     * Gets top listbox item index (relative to the original listbox).
+     * @return Top listbox item index
+     *
+     * @since 3.1
+     */
+    virtual TInt TopLbxItemIndex() const = 0;
+
+    /**
+     * Gets bottom listbox item index (relative to the original listbox).
+     * @return Bottom listbox item index
+     *
+     * @since 3.1
+     */
+    virtual TInt BottomLbxItemIndex() const = 0;
+
+    /**
+     * Gets current listbox item index (relative to the original listbox).
+     * @return Current listbox item index
+     *
+     * @since 3.1
+     */
+    virtual TInt CurrentLbxItemIndex() const = 0;
+
+    /**
+     * Get current selected listbox items indices (relative to the original
+     * listbox). Ownership not transferred.
+     *
+     * @since 3.1
+     * @return Current listbox item indices
+     */
+    virtual const CArrayFix<TInt>* CurrentSelectionIndicesL() const = 0;
+
+    /**
+     * Sewt current selected listbox items indices
+     *
+     * @since 3.1
+     * @param aIndices Array of selection indices, ownership not transfered
+     */
+    virtual void SetCurrentSelectionIndicesL( CArrayFix<TInt>* aIndices ) const = 0;
+
+    /**
+     * Set top listbox item index.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    virtual void SetLbxTopItemIndex( TInt aIndex ) = 0;
+
+    /**
+     * Set current listbox item index.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    virtual void SetLbxCurrentItemIndex( TInt aIndex ) = 0;
+
+    /**
+     * Set current listbox item index and highlight it.
+     *
+     * @since 3.1
+     * @param aIndex Actual listbox index.
+     */
+    virtual void SetLbxCurrentItemIndexAndDraw( TInt aIndex ) = 0;
+
+    /**
+     * Clear listbox selection.
+     *
+     * @since 3.1
+     */
+    virtual void ClearLbxSelection() = 0;
+
+    /**
+     * Sets list box backround text. This text is visible if the list box
+     * has no items.
+     *
+     * @param aText The text for the empty list box background.
+     * @since 3.2
+     */
+    virtual void SetLbxEmptyTextL( const TDesC& aText ) = 0;
+
+    /**
+     * Draws list box item index
+     *
+     * @since 3.2
+     */
+    virtual void DrawLbxItem( TInt aIndex ) = 0;
+
+    /**
+     * Set Find box's focus.
+     *
+     * @since 3.1
+     * @param aFocus ETrue if set focus on FindBox. Otherwise, EFalse.
+     */
+    virtual void SetFindBoxFocus( TBool aFocus ) = 0;
+
+    /**
+     * Handle listbox item addition.
+     *
+     * @since 3.1
+     */
+    virtual void HandleLbxItemAdditionL() = 0;
+
+    /**
+     * Handle listbox item addition, preserving the current display index.
+     *
+     * @since 3.1
+     */
+    virtual void HandleLbxItemAdditionPreserveIndexL() = 0;
+
+    /**
+     * Handle listbox item removal.
+     *
+     * @since 3.1
+     */
+    virtual void HandleLbxItemRemovalL() = 0;
+
+    /**
+     * Show/hide find box
+     *
+     * @since 3.1
+     * @param aIsVisible ETrue to set findbox visible. Otherwise, EFalse
+     */
+    virtual void SetFindBoxVisibilityL( TBool aIsVisible ) = 0;
+
+    /**
+     * Determine find box visibility
+     *
+     * @since 3.1
+     * @return ETrue if find box is currently visible, EFalse otherwise
+     */
+    virtual TBool FindBoxVisibility() = 0;
+
+    /**
+     * Restore the PopupCBA of find box
+     */
+    virtual void RestoreFindBoxPopupCBA() = 0;
+
+    /**
+     * Calculate the top index of the visible items
+     *
+     * @since 3.1
+     * @param aBottomIndex the bottom index of the visible items
+     * @return top index
+     */
+    virtual TInt CalculateTopIndex( TInt aBottomIndex ) = 0;
+
+    /**
+     * Creates the container
+     *
+     * @since 3.1
+     * @param aCollectionType collection type
+     */
+    virtual void ConstructContainerL( TMPXCommonContainerCollectionType aCollectionType ) = 0;
+
+    /**
+     * Enable/disable find box
+     *
+     * @since 3.1
+     * @aEnable ETrue to enable find box, EFalse to disable
+     */
+    virtual void EnableFindBox( TBool aEnable ) = 0;
+
+    /**
+     * Enable/disable marking
+     *
+     * @since 3.1
+     * @aEnable ETrue to enable marking, EFalse to disable
+     */
+    virtual void EnableMarking( TBool aEnable ) = 0;
+
+    /**
+     * Custom handling of commands for markable lists.
+     */
+    virtual void HandleMarkableListProcessCommandL( TInt aCommand ) = 0;
+
+    /**
+     * Custom handling of menu pane for markable lists
+     */
+    virtual void HandleMarkableListDynInitMenuPane(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane ) = 0;
+
+
+    /**
+     * Handle listbox array events
+     *
+     *  @param aEvent list box event
+     */
+    virtual void HandleListBoxArrayEventL(
+        MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent ) = 0;
+
+    /**
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    virtual TKeyResponse HandleKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType ) = 0;
+
+    /**
+     * Activate the container
+     */
+    virtual void ActivateContainerL() = 0;
+    };
+
+/**
+ *  Factory class to create the common container
+ *
+ *  @lib mpxcommoncontainer.lib
+ *  @since S60 v3.2
+ */
+class CMPXCommonContainerFactory : CBase
+    {
+public:
+    /**
+    * Factory function to create the common container
+    */
+    IMPORT_C static MMPXCommonContainer* NewL();
+    };
+
+#endif  // MMPXCOMMONCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxcommoncontainer.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxcommoncontainer
+*
+*/
+
+
+
+#ifndef MPXCOMMONCONTAINER_HRH
+#define MPXCOMMONCONTAINER_HRH
+
+// ENUMS    
+/** command ID's */    
+enum TMPXCommonCommandIds
+    {
+    // starts at 0x7000 to avoid conflict with other commands
+    EMPXCmdCommonDelete = 0x7000,
+    EMPXCmdCommonResourceChange,
+    EMPXCmdCommonEnterKey,
+    EMPXCmdCommonUpdateMiddleSoftKey
+    };
+
+// Music collection icon ID's
+enum TMPXCollectionIconIds
+    {
+    EMPXClvIconMarked = 0,
+    EMPXClvIconEmpty,       // 1
+    EMPXClvIconSongs,       // 2
+    EMPXClvIconArtist,      // 3
+    EMPXClvIconAlbum,       // 4
+    EMPXClvIconPlaylist,    // 5
+    EMPXClvIconUserPlaylist,    // 6
+    EMPXClvIconPlaylistAuto,    // 7
+    EMPXClvIconGenre,       // 8
+    EMPXClvIconComposer,    // 9
+    EMPXClvIconFolder,      // 10
+    EMPXClvIconAudio,       // 11
+    EMPXClvIconCorruptTrack,    // 12
+    EMPXClvIconBrokenTrack, // 13
+    EMPXClvIconBrokenPlaylist,  // 14
+    EMPXClvIconDrmExpired,  // 15
+    EMPXClvIconUnknowFile,      // 16
+    EMPXClvIconMMC,     // 17
+    EMPXClvIconPlay,        // 18
+    EMPXClvIconPause,       // 19
+    EMPXClvIconForward,     // 20
+    EMPXClvIconRewind,      // 21
+    EMPXClvIconReorderDown, // 22
+    EMPXClvIconReorderUp,   // 23
+    EMPXClvIconReorderUpDown,   // 24
+    EMPXClvIconPodcasts,    // 25
+    EMPXClvIconShuffle,     // 26
+    EMPXClvIconNone // this has to be the last item in enum
+    };
+    
+// Podcast collection icon ID's
+enum TMPXPodcastCollectionIconIds
+    {
+    EMPXPodClvIconMarked = 0,
+    EMPXPodClvIconEmpty,       // 1
+    EMPXPodClvIconAdded,       // 2
+    EMPXPodClvIconAuto,        // 3
+    EMPXPodClvIconCateg,       // 4
+    EMPXPodClvIconCompplay,    // 5
+    EMPXPodClvIconDate,        // 6
+    EMPXPodClvIconEpisode,     // 7
+    EMPXPodClvIconNew,         // 8
+    EMPXPodClvIconNoplay,      // 9
+    EMPXPodClvIconPartplay,    // 10
+    EMPXPodClvIconTitle,       // 11
+    EMPXPodClvIconFolder,      // 12
+    EMPXPodClvIconUnknowFile,  // 13
+    EMPXPodClvIconPlay,        // 14
+    EMPXPodClvIconPause,       // 15
+    EMPXPodClvIconForward,     // 16
+    EMPXPodClvIconRewind,      // 17
+    EMPXPodClvIconMMC,         // 18
+    EMPXPodClvIconBroken,      // 19
+    EMPXPodClvIconCorrupt,     // 20
+    EMPXPodClvIconNone // this has to be the last item in enum
+    };
+    
+#endif  // MPXCOMMONCONTAINER_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxcommonlistboxarraybase.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,155 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listbox array for common container.
+*
+*/
+
+
+#ifndef CMPXCOMMONLISTBOXARRAY_H
+#define CMPXCOMMONLISTBOXARRAY_H
+
+#include <e32base.h>
+#include <bamdesca.h>
+#include <mpxcommonframeworkdefs.h>
+#include <mpxplaybackframeworkdefs.h>
+
+// FORWARD DECLARATIONS
+class MMPXCommonListBoxArrayObserver;
+class CAknIconArray;
+class CMPXMediaArray;
+class CMPXMedia;
+
+// CLASS DECLARATION
+
+/**
+ *  Listbox array for common container.
+ *  Creates item text descriptors according to the list model.
+ *
+ *  Dervied classes should implement MdcaPoint from MDesCArray
+ *
+ *  @lib mpxcommoncontainer.lib
+ *  @since S60 v3.1
+ */
+class CMPXCommonListBoxArrayBase : public CBase, 
+                                   public MDesCArray
+    {
+public:  // Constructors and destructor
+    
+    /**
+     * C++ constructor.
+     */
+    IMPORT_C CMPXCommonListBoxArrayBase();
+        
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXCommonListBoxArrayBase(); 
+    
+    /**
+     * Construct the array
+     */
+    IMPORT_C void ConstructListBoxArrayL();   
+
+public: // new functions
+
+    /**
+     * Appends media array contained in the media object
+     * to the current array
+     *
+     * @since 3.1
+     * @param aMedia Media object containing the media array to be append
+     */ 
+    IMPORT_C virtual void AppendMediaL( const CMPXMedia& aMedia );
+
+    /**
+     * Resets media array
+     *
+     * @since 3.1
+     */
+    IMPORT_C void ResetMediaArrayL();
+    
+    /**
+     * Get media array
+     *
+     * @since 3.1
+     * @return Media array used by the listbox
+     */
+    IMPORT_C const CMPXMediaArray& MediaArray();
+    
+    /**
+     * Get media at an index
+     *
+     * @since 3.1
+     * @param aIndex index for get media
+     * @return Media object at the given index
+     */
+    IMPORT_C const CMPXMedia& MediaL( TInt aIndex );
+    
+    /**
+     * Get the media object for the container of current level
+     * It does NOT contain the media array
+     *
+     * @since 3.1
+     * @return Media object for the parent container for the current level
+     */
+    IMPORT_C const CMPXMedia& ContainerMedia();
+    
+    /**
+     * Set observer
+     *
+     * @since 3.1
+     * @param aObserver array event observer
+     */
+    IMPORT_C void SetObserver( MMPXCommonListBoxArrayObserver* aObserver);
+    
+    /**
+     * Remove obsever
+     *
+     * @since 3.1
+     */
+    IMPORT_C void RemoveObserver();
+    
+    /**
+     * Creates icon array
+     *
+     * @since 3.1
+     * @return Pointer to the newly created icon array
+     */   
+    IMPORT_C virtual CAknIconArray* CreateIconArrayL();        
+
+protected: // Functions from base classes
+
+    /**
+     * From MDesCArray, returns the number of descriptor elements
+     * in a descriptor
+     *
+     * @since 3.1
+     * @return The number of descriptor elements in a descriptor array.
+     */
+    IMPORT_C TInt MdcaCount() const;
+    
+protected:    // Data
+
+    MMPXCommonListBoxArrayObserver*  iObserver;         // not owned
+    CMPXMediaArray*                  iMedia;            // not owned
+    CMPXMedia*                       iContainerMedia;   // owned
+    HBufC*                           iItem;             // owned
+
+    TMPXPlaybackState                iPbState;
+    TInt                             iIndex;            // Now playing item index
+    };
+
+#endif  // CMPXCOMMONLISTBOXARRAY_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxcommonlistboxarrayobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listbox array observer
+*
+*/
+
+ 
+
+#ifndef MMPXCOMMONLISTBOXARRAYOBSERVER_H
+#define MMPXCOMMONLISTBOXARRAYOBSERVER_H
+
+/**
+ * Interface for getting event callbacks from listbox array 
+ *
+ * @lib mpxcommoncontainer.lib
+ * @since S60 v3.1
+ */
+NONSHARABLE_CLASS( MMPXCommonListBoxArrayObserver )
+    {
+public:
+
+    enum TMPXCommonListBoxArrayEvents
+        {
+        EMPXCommonListBoxArrayEventIconArrayChange,
+        EMPXCommonListBoxArrayEventMediaArrayChange
+        };
+
+    /**
+     * Handle listbox array events
+     *
+     *  @param aEvent list box event
+     */               
+    virtual void HandleListBoxArrayEventL( 
+        TMPXCommonListBoxArrayEvents aEvent ) = 0;   
+    };    
+    
+#endif // MMPXCOMMONLISTBOXARRAYOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxcommonplaybackview.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxcommonplaybackview
+*
+*/
+
+
+
+#ifndef MPXCOMMONPLAYBACKVIEW_HRH
+#define MPXCOMMONPLAYBACKVIEW_HRH
+
+// ENUMS
+
+/** Command ID's. */
+enum TMPXPlaybackViewCommandIds
+    {
+    EMPXPbvCmdPlay = 0x1000,
+    EMPXPbvCmdPause,
+    EMPXPbvCmdStop,
+    EMPXPbvCmdPlayPause,
+    EMPXPbvCmdSeekForward,
+    EMPXPbvCmdSeekBackward,
+    EMPXPbvCmdEndSeek,
+    EMPXPbvCmdNextListItem,
+    EMPXPbvCmdPreviousListItem,
+    EMPXPbvCmdDecreaseVolume,
+    EMPXPbvCmdIncreaseVolume,
+    EMPXPbvCmdRepeat,
+    EMPXPbvCmdRepeatOne,
+    EMPXPbvCmdRepeatAll,
+    EMPXPbvCmdRepeatOff,
+    EMPXPbvCmdRandom,
+    EMPXPbvCmdRandomOn,
+    EMPXPbvCmdRandomOff,
+    EMPXPbvCmdPosition,
+    EMPXPbvCmdSetAsRngTone,
+    EMPXPbvCmdAiwCmdAssign,
+    EMPXPbvCmdUseAsCascade,
+    EMPXPbvCmdFMTransmitter,
+    EMPXPbvCmdEqualizer,
+    EMPXPbvCmdOpenMusicSettings,
+    EMPXPbvCmdGotoMusicMenu,
+    EMPXPbvCmdSave,
+    EMPXPbvCmdAddToPlaylist,
+    EMPXPbvCmdAddToSavedPlaylist,
+    EMPXPbvCmdAddToNewPlaylist,
+    EMPXPbvCmdPauseDownload,
+    EMPXPbvCmdResumeDownload,
+    EMPXPbvCmdCancelDownload,
+    EMPXPbvCmdUpnpPlayVia,
+    EMPXPbvCmdUpnpPlayViaLocal,
+    EMPXPbvCmdUpnpPlayViaRemotePlayer // Should always be the last one in the list
+    };
+
+#endif  // MPXCOMMONPLAYBACKVIEW_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxcommonplaybackviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,482 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Common playback view's container implementation.
+*
+*/
+
+
+
+#ifndef CMPXCOMMONPLAYBACKVIEWCONTAINER_H
+#define CMPXCOMMONPLAYBACKVIEWCONTAINER_H
+
+
+// INCLUDES
+#include <coecntrl.h>
+
+#include "mpxcommonplaybackviewdefs.h"
+#include "mpxalbumartutilobserver.h"
+#include "mpxbutton.h"
+#include "mpxplaybackframeworkdefs.h"
+
+
+// FORWARD DECLARATIONS
+class MEikCommandObserver;
+class MAknsControlContext;
+class CAknIconArray;
+class CMPXPlaybackViewInfoLabel;
+class MMPXLayoutSwitchObserver;
+class CMPXCommonUiHelper;
+class CMPXButtonManager;
+class MMPXPlaybackViewLayout;
+
+// CLASS DECLARATION
+
+/**
+ *  Container class for audio view.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+class CMPXCommonPlaybackViewContainer : public CCoeControl,
+                                                 public MMPXAlbumArtUtilObserver,
+                                                 public MMPXButtonCmdObserver
+    {
+public:
+
+    /**
+     * Symbian 2nd phase constructor.
+     *
+     * @param aRect Frame rectangle for container.
+     */
+    IMPORT_C virtual void ConstructL( const TRect& aRect );
+
+    /**
+     * Destructor.
+     */
+    IMPORT_C virtual ~CMPXCommonPlaybackViewContainer();
+
+    /**
+     * Updates time indicators.
+     *
+     * @since S60 3.0
+     * @param  aPlaybackPosInSeconds, New playback postions
+     * @param  aTotalLengthInSeconds, Clips duration
+     */
+    IMPORT_C virtual void UpdateTimeIndicatorsL(
+        TInt aPlaybackPosInSeconds,
+        TInt aTotalLengthInSeconds );
+
+    /**
+     * Updates label
+     *
+     * @since S60 3.0
+     * @param aLabel Label which is updated
+     * @param aText New text value
+     */
+    IMPORT_C virtual void UpdateLabelL(
+        TMPXPbvTextIndicator aLabel,
+        const TDesC& aText );
+
+    /**
+     * Sets main pane mode.
+     *
+     * @since S60 3.0
+     * @param aMode Playback mode.
+     */
+    IMPORT_C virtual void SetMode( TMPXPbvPlaybackMode aMode );
+
+    /**
+     * Set random mode.
+     *
+     * @since S60 3.0
+     * @param aRandomMode ETrue if random is on.
+     */
+    IMPORT_C virtual void SetRandomMode( TBool aRandomMode );
+
+    /**
+     * Set repeat mode.
+     *
+     * @since S60 3.0
+     * @param aRepeatAll ETrue if repeat all is on.
+     * @param aRepeatOne ETrue if repeat one is on.
+     */
+    IMPORT_C virtual void SetRepeatMode(
+        TBool aRepeatAll,
+        TBool aRepeatOne );
+
+    /**
+     * Set Real Audio mode.
+     *
+     * @since S60 3.2
+     * @param aRealAudioMode ETrue if a Real Audio file is being played.
+     */
+    IMPORT_C virtual void SetRealAudioMode( TBool aRealAudioMode );
+
+    /**
+    * Update buttons according to current state.
+    *
+    * @since 3.0
+    */
+    IMPORT_C virtual void UpdateButtons( TMPXPlaybackState aState );
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since S60 3.0
+     */
+    IMPORT_C virtual void UpdateLayout();
+
+    /**
+     * Updates duration label.
+     *
+     * @since S60 3.0
+     * @param  aTotalLengthInSeconds, Clips duration
+     */
+    IMPORT_C virtual void UpdateDurationLabelL( TInt aTotalLengthInSeconds );
+
+    /**
+     * Force softkey label colors to what is specified in skin
+     * for Music Player soft keys.
+     *
+     * @since S60 3.0
+     */
+    IMPORT_C virtual void UpdateSoftkeyColors();
+
+    /**
+     * Handles foreground events
+     *
+     * @since S60 3.0
+     * @param aForeground ETrue if app is going to foreground, EFalse otherwise
+     */
+    IMPORT_C virtual void HandleForegroundEventL( TBool aForeground );
+
+// from base class MMPXAlbumArtUtilObserver
+
+    /**
+     * From MMPXAlbumArtUtilObserver.
+     * Notify that extraction of album art started.
+     */
+    IMPORT_C virtual void ExtractAlbumArtStarted();
+
+    /**
+     * From MMPXAlbumArtUtilObserver.
+     * Album art is extracted from file and ready to use.
+     *
+     * @param aBitmap a converted image. Ownership is transferred.
+     * @param aErr error code
+     */
+    IMPORT_C virtual void ExtractAlbumArtCompleted(
+        CFbsBitmap* aBitmap,
+        TInt aErr );
+
+// from base class CoeControl
+
+    /**
+     * From CoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    IMPORT_C virtual TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    IMPORT_C virtual void HandleResourceChange( TInt aType );
+
+    /**
+     * From CoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    IMPORT_C virtual void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+    /**
+     * Starts marquee for a playback label
+     *
+     * @param aLabel Label to start marquee
+     */
+    IMPORT_C virtual void StartMarquee( TMPXPbvTextIndicator aLabel );
+
+protected:
+
+    /**
+     * Create background images
+     */
+    IMPORT_C virtual void CreateBackgroundImagesL();
+
+    /**
+     * Creates labels.
+     */
+    IMPORT_C virtual void CreateLabelsL();
+
+    /**
+     * Creates icons.
+     * Any subclass which overrides this must call this base class method
+     * first or else the common icons will not be created.
+     */
+    IMPORT_C virtual void CreateIconsL();
+
+    /**
+     * Deletes all icon objects.
+     */
+    IMPORT_C void FreeIcons();
+
+    /**
+     * Draw an icon
+     *
+     * @since 3.0
+     * @param aGc            Graphics context to draw to
+     * @param aDirtyRect     Part of the screen that needs redrawing
+     * @param aIndicatorRect Position for the icon
+     * @param aIcon          Icon and mask
+     * @param aInvertMask    Invert mask (see CBitmapContext::BitBltMasked)
+     */
+    IMPORT_C virtual void DrawIndicator(
+        CBitmapContext& aGc,
+        const TRect& aDirtyRect,
+        const TRect& aIndicatorRect,
+        const CGulIcon* aIcon,
+        TBool aInvertMask = ETrue ) const;
+
+    /**
+     * Redraw part of the screen to the bitmap context.
+     *
+     * @param aRect Area to be redrawn.
+     * @param aGc Graphics context to draw to.
+     */
+    IMPORT_C virtual void RedrawRect(
+        const TRect& aRect,
+        CBitmapContext& aGc) const;
+
+    /**
+     * Update progress bar graphics based on current playback
+     * and download position.
+     */
+    IMPORT_C virtual void UpdateProgressBarGraphics();
+
+    /**
+     * Update progress bar graphics and redraw.
+     */
+    IMPORT_C virtual void RefreshProgressBar();
+
+    /**
+     * Update label text color according to skin
+     */
+    IMPORT_C virtual void UpdateLabelColorsL();
+
+    /**
+     * Update skin control context for background
+     *
+     * @param aRect Area to be updated.
+     */
+    IMPORT_C virtual void UpdateBackgroundSkinControlContext( const TRect& aRect );
+
+    /**
+     * Set FMTX mode.
+     *
+     * @since S60 3.2
+     * @param aFMTXMode ETrue if the view supports FMTX label.
+     */
+    IMPORT_C virtual void SetFMTXMode( TBool aFMTXMode );
+
+// from base class CoeControl
+
+    /**
+     * From CCoeControl.
+     * Responds to changes to the size and position of the contents of this
+     * control.
+     */
+    IMPORT_C virtual void SizeChanged();
+
+    /**
+     * From CCoeControl.
+     * Gets the number of controls contained in a compound control.
+     *
+     * @return The number of component controls contained by this control.
+     */
+    IMPORT_C virtual TInt CountComponentControls() const;
+
+    /**
+     * From CCoeControl.
+     * Gets an indexed component of a compound control.
+     *
+     * @param aIndex The index of the control.
+     * @return The component control with an index of aIndex.
+     */
+    IMPORT_C virtual CCoeControl* ComponentControl( TInt aIndex ) const;
+
+    /**
+     * From CCoeControl.
+     * Draws the control.
+     *
+     * @param aRect The rectangular region of the control to be drawn.
+     */
+    IMPORT_C virtual void Draw( const TRect& aRect ) const;
+
+// from base class MMPXButtonCmdObserver
+
+    /**
+     * From MMPXButtonCmdObserver
+     * Handle a button command.
+     * @param aCommand Command id, as specified in the button constructor.
+     */
+   IMPORT_C virtual void HandleButtonCommandL( TInt aCommand );
+
+    /**
+     * From CCoeControl.
+     * Handle events from the touch screen
+     * since 5.0
+     */
+    IMPORT_C virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent);
+
+public:
+
+    /**
+     * Gets song position (from touch progress bar)
+     * since 5.0
+     */
+    IMPORT_C virtual TInt GetNewSongPosition();
+    
+    /**
+     * Sets song position (from currently playback position)
+     * since 5.0
+     */
+    void SetNewSongPosition( const TInt64& aPositon );
+
+    /**
+     * Restore Buttons' state in some special case
+     *
+     * @since S60 3.0
+     */
+    void RestoreButtons( TMPXPlaybackState aState );
+
+    TInt CallSetPosition();
+
+    static TInt CallSetPosition( TAny* aAny );
+    
+    /**
+     * Sets the ordinal position of a window.
+     *
+     * @param aNewOrdinalPosition The window's new ordinal position
+     * 
+     * @since S60 3.0
+     */
+    void AdjustOrdinalPosition( TInt aNewOrdinalPosition );
+
+private:
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     */
+    void DoUpdateLayoutL();
+
+ protected:   // data
+
+    MEikCommandObserver* iCommandObserver;  // not owned
+    MMPXLayoutSwitchObserver*    iLayoutObserver;   // not owned
+    RPointerArray<CMPXPlaybackViewInfoLabel> iLabels;   // owned
+
+    CFbsBitmap* iOffScreenBitmap;       // owned
+    CFbsBitGc* iOSBitmapContext;        // owned
+    CFbsBitmapDevice* iOSBitmapDevice;  // owned
+
+    HBufC* iMinSecFormatString;         // owned
+    HBufC* iShortFormatString;          // owned
+
+    CGulIcon* iPlayIcon;                // owned
+    CGulIcon* iPauseIcon;               // owned
+    CGulIcon* iRandomIcon;              // owned
+    CGulIcon* iRepeatOneIcon;           // owned
+    CGulIcon* iRepeatAllIcon;           // owned
+
+    CGulIcon* iDownloadSlider;          // owned
+    CGulIcon* iPlaybackSlider;          // owned
+    CGulIcon* iSliderBackground;        // owned
+
+    CGulIcon* iDefaultAlbumArt;         // owned
+    CFbsBitmap* iTrackAlbumArt;         // owned
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    CGulIcon* iRealIcon;                // owned
+#endif
+
+    MAknsControlContext* iBackground;   // owned
+
+    CMPXCommonUiHelper* iCommonUiHelper;    // owned
+
+    TRect iBackgroundLayout;
+    TRect iIconLayout;
+    TRect iRandomIconRect;
+    TRect iRepeatIconRect;
+    TRect iSliderPaneRect;
+    TRect iSliderBackgroundRect;
+    TRect iPlaybackSliderRect;
+    TRect iDownloadSliderRect;
+    TRect iAlbumArtRect;
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    TRect iRealIconRect;
+#endif
+
+    TMPXPbvPlaybackMode iMode;
+
+    TBool iRepeatAllMode;
+    TBool iRepeatOneMode;
+    TBool iRandomMode;
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    TBool iRealAudioMode;
+#endif
+    TBool iFMTXMode;
+
+    TRect iCurrentLayout;
+
+    // Progress bar position - download
+    TReal iDownloadRatio;
+
+    // Progress bar position - playback
+    TReal iPlaybackRatio;
+
+    TBool iEqualizerEnabled;
+    TBool iEnableButtons;
+    TBool iEnableVolumeIndicator;
+    TBool iEnableMarquee;
+    TBool iDisplayAlbumArt;
+    TBool iPrerollCompleted;
+
+    CMPXButtonManager*  iButtonManager; // owned
+    CIdle* iIdle;
+    TInt iIdleTaskCompleted;
+    MMPXPlaybackViewLayout* iLayout;    // not owned
+    CPeriodic* iSeekTimer;
+
+    TInt iTrackTotalLengthInSeconds;
+    TInt64 iNewSongPosition; // Final position from touch progress bar
+    TBool iTouchDown;        // Flag indicating touch progress bar is in use
+    TBool iActiveView;
+
+    // mutable is used so that conts Draw method can change the state
+    mutable TBool iRefreshBackBuffer; 
+    TBool iDragProgressBar; //Flag drag progress bar
+    };
+
+#endif  // CMPXCOMMONPLAYBACKVIEWCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxcommonplaybackviewdefs.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Common defines and data types for common playback view
+*
+*/
+
+
+
+#ifndef MPXCOMMONPLAYBACKVIEWDEFS_H
+#define MPXCOMMONPLAYBACKVIEWDEFS_H
+
+_LIT(KMPXCommonPlaybackViewIconFile, "mpxcommonplaybackview.mbm");
+
+/**
+ * States for soft buttons in Playback View.
+ * @since 3.0
+ */
+/**
+ * Identifiers for soft buttons in Playback View.
+ * @since 3.0
+ */
+enum TMPXPbvButton
+    {
+    EButtonRocker,
+    EButtonLast         // Should always be the last value
+    };
+
+enum TMPXPbvAvkonButton
+    {
+    EButtonPlay,
+    EButtonPause,
+    EButtonFastForward,
+    EButtonRewind,
+    EButtonVolumeDown,
+    EButtonVolumeUp,
+    EButtonStop,
+    };
+
+/**
+ * Identifiers for different graphical indicators visible in Playback View.
+ * These constants are used by MPXPlaybackViewLayout when getting layout data
+ * (MPXPlaybackViewLayout::IndicatorLayout()) and bitmaps
+ * (MPXPlaybackViewLayout::GetIndicatorIconL()) for the indicators.
+ * @since 3.0
+ */
+enum TMPXPbvIndicator
+    {
+    // Playback status indicators
+    EIconPlay,
+    EIconStop,
+    EIconPause,
+    EIconFastForward,
+    EIconRewind,
+
+    // Mode indicators
+    EIconRepeatOne,
+    EIconRepeatAll,
+    EIconRandom,
+
+    // Background
+    EBackgroundGraphic, // Layout and graphic for skinned background
+
+    // Progressive download
+    ESliderPane,        // Parent pane for download/playback sliders
+    ESliderBackground,  // Background graphic for slider
+    EPlaybackSlider,    // Slider indicating current playback position
+    EDownloadSlider,    // Slider indicating current download position
+
+    EAlbumArtArea,       // Layout for album art, default graphic
+    EIconRemotePlayer    // layout for upnp graphic
+
+    // Playback type indicators
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+    , EIconReal
+#endif
+    };
+
+/**
+ * Identifiers for different text fields visible in Playback View.
+ * @since 3.0
+ */
+enum TMPXPbvTextIndicator
+    {
+    ETextArtist,
+    ETextTrack,
+    ETextPlaylistCount,
+
+    ETextEmpty,
+    ETextElapsedTime,
+    ETextRemainingTime,
+    ETextDownloadState,
+    ETextFMFrequency,
+    ETextCount
+    };
+
+/**
+ * Playback states for Playback View.
+ * @since 3.0
+ */
+enum TMPXPbvPlaybackMode
+    {
+    EInvalidMode = 0,
+    EPlayMode,
+    EStopMode,
+    EPauseMode,
+    ENoTracksMode,
+    EUninitialized,
+    EInitialising,
+    EMediaKeySkipping,
+    EBufferingMode
+    };
+
+enum TMPXPbvLayoutVariants
+    {
+    // Playback status indicators
+    EPbvPortraitWithoutRocker,        // 0
+    EPbvLandscapeWithoutRocker,       // 1
+    EPbvPortraitTouchExpandedCntl,    // 2
+    EPbvLandscapeTouchExpandedCntl,   // 3
+    EPbvPortraitTouchCollapsedCntl,   // 4
+    EPbvLandscapeTouchCollapsedCntl,  // 5
+    EPbvPortraitWithRocker,           // 6
+    EPbvLandscapeWithRocker,          // 7
+    EPbvPortraitTouchFixedCntl,       // 8
+    EPbvLandscapeTouchFixedCntl,      // 9
+    EPbvPortraitNhdTouch,             // 10
+    EPbvLandscapeNhdTouch,            // 11
+    EPbvPortraitNhdTouchWithFM,       // 12
+    EPbvLandscapeNhdTouchWithFM,	  // 13
+	EPbvUndefinedVariant,			  // 14
+    EPbvPortraitWithRockerFM,         // 15
+    EPbvLandscapeWithRockerFM         // 16
+    };
+#endif  // MPXCOMMONPLAYBACKVIEWDEFS_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxcommonplaybackviewlayout.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,191 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  An interface providing skin and layout data for common playback view.
+*
+*/
+
+
+#ifndef CMPXCOMMONPLAYBACKVIEWLAYOUT_H
+#define CMPXCOMMONPLAYBACKVIEWLAYOUT_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <AknUtils.h>
+
+#include "mpxplaybackviewlayoutinterface.h"
+#include "mpxcommonplaybackviewlayout.h"
+#include "mpxcommonplaybackviewdefs.h"
+
+// CLASS DECLARATION
+class MAknsSkinInstance;
+class TAknsItemID;
+
+/**
+*  An interface providing skin and layout data for playback view.
+*
+*  @lib mpxplaybackview.dll
+*  @since S60 v3.0
+*/
+class CMPXCommonPlaybackViewLayout : public CBase,
+                                     public MMPXPlaybackViewLayout
+    {
+public:
+
+    /**
+     * Get layout data for a button.
+     *
+     * @since 3.0
+     * @param aParentRect Parent control's rect
+     * @param aButton Enumeration value identifying the button
+     * @return Layout data
+     */
+    IMPORT_C virtual TRect ButtonLayout(
+        const TRect& aParentRect );
+
+    /**
+     * Get layout data for an graphical indicator.
+     *
+     * @since 3.0
+     * @param aParentRect Parent control's rect
+     * @param  aIndicator Enumeration value identifying the indicator
+     * @return Layout data
+     */
+    IMPORT_C virtual TRect IndicatorLayout(
+        const TRect& aParentRect,
+        TMPXPbvIndicator aIndicator );
+
+    /**
+     * Set layout data for a text label.
+     *
+     * @since 3.0
+     * @param aLabel      Label to set the layout to
+     * @param aParentRect Parent rectangle for layout
+     * @param aIndicator  Enumeration value identifying the indicator,
+     * @param aOffsetx    Offset in x direction to apply to label
+     * @param aOffsety    Offset in y direction to apply to label
+     */
+    IMPORT_C virtual void LayoutLabel(
+        CEikLabel* aLabel,
+        const TRect& aParentRect,
+        TMPXPbvTextIndicator aText,
+        TInt aOffsetx=0,
+        TInt aOffsety=0 );
+
+    /**
+     * Get the bitmap and mask for a soft button in a given state.
+     *
+     * @since 3.0
+     * @param  aButton      Enumeration value identifying the button.
+     * @param  aButtonState State of the button
+     * @param  aBitmap      Reference to a CFbsBitmap pointer to receive
+     *                      the requested bitmap pointer. Ownership is
+     *                      transferred to the caller.
+     * @param  aMask        Reference to a CFbsBitmap pointer to receive
+     *                      the mask of the requested bitmap. Ownership is
+     *                      transferred to the caller.
+     */
+    IMPORT_C virtual void GetButtonBitmapsL(
+        TMPXPbvButton aButton,
+        TInt aButtonState,
+        CFbsBitmap*& aBitmap,
+        CFbsBitmap*& aMask );
+
+    /**
+     * Get the bitmap and mask for a given indicator.
+     *
+     * @since 3.0
+     * @param  aIndicator   Enumeration value identifying the indicator
+     * @return CGulIcon     Indicator graphic and mask. Ownership
+     *                      transferred to caller.
+     */
+    IMPORT_C virtual CGulIcon* GetIndicatorIconMaskL(
+        TMPXPbvIndicator aIndicator );
+
+protected:
+
+    /**
+     * Create a color-skinned icon.
+     *
+     * @param aSkin Pointer to the current skin instance.
+     * @param aIconSkinId Item ID of the masked bitmap to be created.
+     * @param aColorId Item ID of the color table.
+     * @param aColorIndex Index in the color table.
+     * @param aBitmapFilename Filename to be used to construct the item.
+     * @param aFileBitmapId ID of the bitmap in the file.
+     * @param aFileMaskId ID of the mask in the file.
+     */
+    IMPORT_C CGulIcon* CreateColorIconL(
+        MAknsSkinInstance* aSkin,
+        const TAknsItemID& aIconSkinId,
+        const TAknsItemID& aColorId,
+        TInt aColorIndex,
+        const TDesC& aBitmapFilename,
+        TInt aFileBitmapId,
+        TInt aFileMaskId );
+
+    /**
+     * Layouts the label by reading in the resource values
+     *
+     * @param aLabel      Label to set the layout to
+     * @param aParentRect Parent rectangle for layout
+     * @param aResId      Resource ID to read from
+     * @param aOffsetx    Offset in x direction to apply to label
+     * @param aOffsety    Offset in y direction to apply to label
+     */
+    IMPORT_C void DoLayoutLabelL(
+        CEikLabel* aLabel,
+        const TRect& aParentRect,
+        TInt aResId,
+        TInt aOffsetx,
+        TInt aOffsety );
+
+public:
+	/**
+     * Get layout data for a button.
+     * @since 5.0
+     * @param  aButton Enumeration value identifying the button,
+     * @return Layout data
+     */
+    IMPORT_C virtual TRect ButtonLayout(const TRect& aParentRect,
+                                  TInt aButton);
+
+protected:
+	/**
+     * Determine avkon layout variant
+     * @since 5.0
+     * @return layout variant type
+     */
+    IMPORT_C TMPXPbvLayoutVariants DetermineLayoutVariant();
+
+	/**
+     * Get layout data for a text item
+     * @since 5.0
+     * @param  aText Enumeration value identifying the text
+     * @return layout variant id
+     */
+    IMPORT_C TMPXPbvLayoutVariants GetTextVariant(TMPXPbvTextIndicator aText);
+
+	/**
+     * Get layout data for an indicator item
+     * @since 5.0
+     * @param  aIndicator Enumeration value identifying the indicator
+     * @return Layout variant id
+     */
+    IMPORT_C TMPXPbvLayoutVariants GetIndicatorVariant(TMPXPbvIndicator aIndicator);
+
+    };
+
+#endif  // CMPXCOMMONPLAYBACKVIEWLAYOUT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxplaybackview.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxplaybackview
+*
+*/
+
+
+
+#ifndef MPXPLAYBACKVIEW_HLP_HRH
+#define MPXPLAYBACKVIEW_HLP_HRH
+
+_LIT( KMUS_HLP_PLAYBACK_VIEW, "MUS_HLP_PLAYBACK_VIEW" );
+_LIT( KMUS_HLP_EMBED_BROWSER, "MUS_HLP_EMBED_BROWSER" );
+_LIT( KMUS_HLP_EMBED_MESSAGING, "MUS_HLP_EMBED_MESSAGING" );
+_LIT( KMUS_HLP_EMBED_MUSIC_SHOP, "MUS_HLP_EMBED_MUSIC_SHOP" );
+
+#endif  // MPXPLAYBACKVIEW_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxplaybackviewinfolabel.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Text label for Common Playback view.
+*
+*/
+
+
+
+#ifndef CMPXPLAYBACKVIEWINFOLABEL_H
+#define CMPXPLAYBACKVIEWINFOLABEL_H
+
+
+//  INCLUDES
+#include <eiklabel.h>
+
+
+// FORWARD DECLARATIONS
+class MAknsControlContext;
+class CAknMarqueeControl;
+
+
+// CLASS DECLARATION
+
+/**
+ *  Text label for Playback View. Otherwise similar to CEikLabel, but also 
+ *  handles background bitmap drawing and marquee scrolling.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPlaybackViewInfoLabel ) : public CEikLabel
+    {
+public:
+
+    /**
+     * C++ constructor.
+     */
+    CMPXPlaybackViewInfoLabel();
+    
+    /**
+     * Symbian 2nd phase constructor
+     *
+     * @param aEnableMarqueeSupport If true, CAknMarqueeControl is also
+     *                              created to support marquee.
+     */
+    void ConstructL( TBool aEnableMarqueeSupport );
+    
+    /**
+     * Destructor
+     */
+    virtual ~CMPXPlaybackViewInfoLabel();
+    
+    /**
+     * Set background bitmap
+     *
+     * @since S60 3.0
+     * @param aBackground       Pointer to the skin background control
+     *                          context. Ownership not transferred.
+     */
+    void SetBackground( MAknsControlContext* aBackground );
+
+    /**
+     * Redraw rectangle
+     *
+     * @since S60 3.0
+     * @param aRect Dirty rectangle. Drawing can be clipped to this
+     *              rectangle
+     */
+    void RedrawRect( const TRect& aRect ) const;
+
+    /**
+     * Start marquee scrolling if supported and needed.
+     *
+     * @since S60 3.0
+     */
+    void StartMarquee();
+
+    /**
+     * Stop marquee scrolling.
+     *
+     * @since S60 3.0
+     */
+    void StopMarquee();
+
+    /**
+     * Get the full unclipped text for the label
+     *
+     * @since S60 3.0
+     * @return Reference to label text. Must not be stored. 
+     */
+    const TDesC& FullText() const;
+
+    /**
+     * Set label text and clip if necessary.
+     *
+     * @since S60 3.0
+     * @param aText Text for the label
+     */
+    void SetLabelTextL( const TDesC& aText );
+
+private:
+
+    /**
+     * Check if scrolling is needed.
+     *
+     * @return ETrue if marquee is necessary (ie. text length is larger
+     *               that what can be visible at one time.
+     */
+    TBool NeedToScroll() const;
+
+    /**
+     *  Redraw callback for marquee control
+     */
+    static TInt RedrawCallback( TAny* aPtr );
+
+// from base class CCoeControl
+
+    /**
+     * From CCoeControl.
+     * Draws the control.
+     *
+     * @param aRect The rectangular region of the control to be drawn.
+     */
+    void Draw( const TRect& aRect ) const;
+
+    /**
+     * From CCoeControl.
+     * Gets the number of controls contained in a compound control.
+     *
+     * @return The number of component controls contained by this control.
+     */
+    TInt CountComponentControls() const;
+
+    /**
+     * From CCoeControl.
+     * Gets an indexed component of a compound control.
+     *
+     * @param aIndex The index of the control.
+     * @return The component control with an index of aIndex.
+     */
+    CCoeControl* ComponentControl( TInt aIndex ) const;
+
+private:    // Data
+
+    MAknsControlContext* iBackground; // not owned
+    CAknMarqueeControl* iMarquee; // owned
+    HBufC* iFullText; // owned
+    };
+
+#endif  // CMPXPLAYBACKVIEWINFOLABEL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxplaybackviewlayoutinterface.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  An interface providing skin and layout data for common playback view.
+*
+*/
+
+
+#ifndef MMPXCOMMONPLAYBACKVIEWLAYOUT_H
+#define MMPXCOMMONPLAYBACKVIEWLAYOUT_H
+
+//  INCLUDES
+#include <e32base.h>
+#include <AknUtils.h>
+#include "mpxcommonplaybackviewdefs.h"
+
+// CLASS DECLARATION
+
+/**
+*  An interface providing skin and layout data for playback view.
+*
+*  @lib mpxplaybackview.dll
+*  @since S60 v3.0
+*/
+NONSHARABLE_CLASS( MMPXPlaybackViewLayout )
+    {
+public:
+
+    /**
+     * Get layout data for a button.
+     *
+     * @since 3.0
+     * @param aParentRect Parent control's rect
+     * @param aButton Enumeration value identifying the button
+     * @return Layout data
+     */
+    virtual TRect ButtonLayout(
+        const TRect& aParentRect )=0;
+
+    /**
+     * Get layout data for an graphical indicator.
+     *
+     * @since 3.0
+     * @param aParentRect Parent control's rect
+     * @param  aIndicator Enumeration value identifying the indicator
+     * @return Layout data
+     */
+    virtual TRect IndicatorLayout(
+        const TRect& aParentRect,
+        TMPXPbvIndicator aIndicator )=0;
+
+    /**
+     * Set layout data for a text label.
+     *
+     * @since 3.0
+     * @param aLabel      Label to set the layout to
+     * @param aParentRect Parent rectangle for layout
+     * @param aIndicator  Enumeration value identifying the indicator,
+     * @param aOffsetx    Offset in x direction to apply to label
+     * @param aOffsety    Offset in y direction to apply to label
+     */
+    virtual void LayoutLabel(
+        CEikLabel* aLabel, 
+        const TRect& aParentRect, 
+        TMPXPbvTextIndicator aText,
+        TInt aOffsetx=0,
+        TInt aOffsety=0 )=0;
+
+    /**
+     * Get the bitmap and mask for a soft button in a given state.
+     *
+     * @since 3.0
+     * @param  aButton      Enumeration value identifying the button.
+     * @param  aButtonState State of the button
+     * @param  aBitmap      Reference to a CFbsBitmap pointer to receive
+     *                      the requested bitmap pointer. Ownership is
+     *                      transferred to the caller.
+     * @param  aMask        Reference to a CFbsBitmap pointer to receive
+     *                      the mask of the requested bitmap. Ownership is
+     *                      transferred to the caller.
+     */
+    virtual void GetButtonBitmapsL(
+        TMPXPbvButton aButton,
+        TInt aButtonState,
+        CFbsBitmap*& aBitmap,
+        CFbsBitmap*& aMask )=0;
+
+    /**
+     * Get the bitmap and mask for a given indicator.
+     *
+     * @since 3.0
+     * @param  aIndicator   Enumeration value identifying the indicator
+     * @return CGulIcon     Indicator graphic and mask. Ownership 
+     *                      transferred to caller.
+     */
+    virtual CGulIcon* GetIndicatorIconMaskL(
+        TMPXPbvIndicator aIndicator )=0;
+        
+    virtual TRect ButtonLayout(const TRect& aParentRect,
+                                  TInt aButton)=0;
+
+    };
+
+#endif  // C_CMPXCOMMONPLAYBACKVIEWLAYOUT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/inc/mpxviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX View container definition.
+*
+*/
+
+
+
+#ifndef MMPXVIEWCONTAINER_H
+#define MMPXVIEWCONTAINER_H
+
+
+// INCLUDES
+#include <coecntrl.h>
+
+// FORWARD DECLARATIONS
+class CEikMenuPane;
+
+// CLASS DECLARATION
+
+/**
+ *  Abstract class for view container.
+ *  The view container class owns a common container to access List box
+ *  commands, receive CoeControl events and GetHelpContext(). The view 
+ *  container class should implement the following virtual functions:
+ *
+ *  virtual void HandleKeyEvent();
+ *  virtual void HandleHelpContent();
+ *
+ *  common container uses this to pass CoeControl events back to the view
+ *  container class. 
+ *
+ *  The view container class should implement the following virtual function
+ *  from MEikCommandObserver 
+ *
+ *  virtual void ProcessCommandL(TInt aCommandId);
+ *
+ *  common container uses this to pass commands back to the view class
+ *  the commands supported are defined in mpxcommoncontainer.hrh
+ *
+ *  @since S60 v3.2
+ */
+class MMPXViewContainer
+    {
+public:
+
+    /**
+     * Destructor.
+     */
+    virtual ~MMPXViewContainer() {};
+
+    /**
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    virtual TKeyResponse HandleKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType ) = 0;
+    
+    /**
+     * Handles the retrieval of the view container's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    virtual void HandleHelpContext( TCoeHelpContext& aContext ) const = 0;
+
+    /**
+     * Returns the indicators for the specified item within the view container
+     *
+     * @param aIndex specified array index
+     * @return Indicator icon indices
+     */
+    virtual RArray<TInt> IndicatorsL( TInt aIndex ) = 0;
+    };
+
+#endif  // MMPXVIEWCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/bwinscw/mpxmainviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewL@CMPXMainView@@SAPAV1@XZ @ 1 NONAME ; class CMPXMainView * CMPXMainView::NewL(void)
+	?NewLC@CMPXMainView@@SAPAV1@XZ @ 2 NONAME ; class CMPXMainView * CMPXMainView::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/data/mpxmainview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxmainview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MXMV // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+#include <mpxmainview.mbg>
+
+#include <mpxappui.hrh>
+#include <mpxmainview.loc>
+#include "mpxmainview.hrh"
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------------------------
+// r_mpx_main_view
+// main view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_mpx_main_view
+    {
+    menubar = r_mpx_main_view_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_cui_softkeys_options_phone
+// CBA with "Options" and "Phone" Softkey.
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_cui_softkeys_options_phone
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EMPXCmdHideApp;
+            txt = qtn_softkey_hide;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_main_view_menubar
+// main view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_main_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_main_view_menu;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_main_view_menu_2
+// main view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_main_view_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToNowPlaying;
+            txt = qtn_nmp_options_go_to_nowplaying;
+            },
+        MENU_ITEM
+            {
+            command = EMPXMainViewRefresh;
+            txt = qtn_mus_options_update_collection;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//    
+//    r_musicplayer_cui_library_view_lbx
+//    Library view's listbox resource.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE LISTBOX r_mpx_main_view_lbx
+    {
+    flags = EAknListBoxSelectionList;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_mainview_title
+// Title for main view.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_main_view_title
+    {
+    buf = qtn_mus_application_name;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_mpx_refresh_after_sync
+// Text for querying refresh after a usb transfer
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_refresh_after_sync
+    {
+    buf = qtn_nmp_note_library_refresh_sync;
+    }
+
+// -----------------------------------------------------------------------------
+//
+// r_mpx_track_position
+// Text for track position in playlist
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_track_position
+    {
+    buf = qtn_nmp_track_position;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_query_yes_no
+//    Ask the user for a yes/no question
+//
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_query_yes_no
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/eabi/mpxmainviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_ZN12CMPXMainView4NewLEv @ 1 NONAME
+	_ZN12CMPXMainView5NewLCEv @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxmainview.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxmainview.loc	APP_LAYER_LOC_EXPORT_PATH(mpxmainview.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxmainview.mif
+OPTION HEADERFILE mpxmainview.mbg
+OPTION SOURCEFILE iconlist.txt
+END
+
+PRJ_MMPFILES
+mpxmainview.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+/c8,8 qgn_graf_mup_npv_icon_pause
+/c8,8 qgn_graf_mup_npv_icon_play
+/c8,8 qgn_indi_mup_default_album.svg
+/c8,8 qgn_graf_mup_npv_defalbumart_transp
+/c8,8 qgn_indi_mup_default_album_pcast.svg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/group/mpxmainview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxmainview.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../../../inc/musicplayerbldvariant.hrh"
+
+TARGET          mpxmainview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC7C
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+MACRO __ENABLE_MSK
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+#ifdef IAD_INCLUDE_SINGLE_CLICK 
+MACRO SINGLE_CLICK_INCLUDED
+#endif
+
+SOURCEPATH      ../src
+SOURCE          mpxmainviewcontainer.cpp
+SOURCE          mpxmainviewimp.cpp
+SOURCE          mpxmainview.cpp
+
+START RESOURCE  ../data/mpxmainview.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apgrfx.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         aknicon.lib
+LIBRARY         hlplch.lib
+LIBRARY         egul.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknskins.lib
+LIBRARY         commonengine.lib
+LIBRARY         cdlengine.lib
+LIBRARY         estor.lib
+
+LIBRARY         eikdlg.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxcommon.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/group/mpxmainviewicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxmainview
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxmainview.mif
+HEADERFILENAME=$(HEADERDIR)/mpxmainview.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/inc/mpxmainview.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxmainview
+*
+*/
+
+
+
+#ifndef MPXMAINVIEW_HLP_HRH
+#define MPXMAINVIEW_HLP_HRH
+
+_LIT( KMUS_HLP_LIB_LIBRARY_VIEW, "MUS_HLP_LIB_LIBRARY_VIEW" );
+
+#endif  // MPXMAINVIEW_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/inc/mpxmainview.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxmainview
+*
+*/
+
+
+
+#ifndef MPXMAINVIEW_HRH
+#define MPXMAINVIEW_HRH
+
+// ENUMS
+
+/** Main view ID */
+enum TMPXMainViewIds
+    {
+    KMPXMainViewId = 20002
+    };
+
+enum TMPXMainViewIconIds
+    {
+    KMPXMainViewDefaultIcon = 0,
+    KMPXMainViewTransparent,
+    KMPXMainViewPlayIcon,
+    KMPXMainViewPauseIcon,
+    KMPXMainViewDefaultPodcastIcon
+    };
+
+enum TMPXMainViewCommandIds
+    {
+    EMPXMainViewRefresh = 0x1000
+    };
+#endif  // MPXMAINVIEW_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/inc/mpxmainviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX main view's container implementation.
+*
+*/
+
+
+
+#ifndef C_CMPXMAINVIEWCONTAINER_H
+#define C_CMPXMAINVIEWCONTAINER_H
+
+
+// INCLUDES
+#include <coecntrl.h>
+
+
+// FORWARD DECLARATIONS
+class CMPXMainViewImp;
+class CEikTextListBox;
+class CMPXLbxExtendedFeatures;
+class CAknIconArray;
+
+// CLASS DECLARATION
+
+/**
+ *  Container class for main view.
+ *
+ *  @lib mpxmainview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXMainViewContainer ) : public CCoeControl
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     *
+     * @param aView              Parent view.
+     */
+    CMPXMainViewContainer(
+            CMPXMainViewImp* aView );
+
+    /**
+     * Symbian 2nd phase constructor.
+     * 
+     * @param aRect Frame rectangle for container.
+     */
+    void ConstructL( const TRect& aRect );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXMainViewContainer();
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since S60 3.0
+     */
+    void UpdateLayout();    
+
+    /**    
+     *  Returns a pointer to the listbox
+     */
+    CEikTextListBox* ListBox();    
+        
+private:
+    /**
+     * Create list box 
+     *
+     */
+    void CreateListBoxL();
+    
+    /**
+     * Load an icon and append it to an icon array.
+     * @param aArray    pointer to the icon array
+     * @param aID       skin id of the icon
+     * @param aColorId  Item ID of the color table.
+     * @param aColorIndex Index in the color table.
+     * @param aMbmFile  path to the mbm/mif file containing the icon
+     * @param aBitmapId mbm id of the bitmap
+     * @param aMaskId   mbm id of the mask
+     */
+    void AppendIconToArrayL(
+        CAknIconArray* aArray,
+        const TAknsItemID& aID,
+        const TAknsItemID& aColorId,
+        TInt aColorIndex,
+        const TDesC& aMbmFile,
+        TInt aBitmapId,
+        TInt aMaskId );
+
+// from base class CoeControl
+
+    /**
+     * From CCoeControl.
+     * Responds to changes to the size and position of the contents of this 
+     * control.
+     */
+    void SizeChanged();
+
+    /**
+     * From CCoeControl.
+     * Gets the number of controls contained in a compound control.
+     *
+     * @return The number of component controls contained by this control.
+     */
+    TInt CountComponentControls() const;
+
+    /**
+     * From CCoeControl.
+     * Gets an indexed component of a compound control.
+     *
+     * @param aIndex The index of the control.
+     * @return The component control with an index of aIndex.
+     */
+    CCoeControl* ComponentControl( TInt aIndex ) const;    
+
+    /**
+     * From CoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );
+
+    /**
+     * From CoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+ private:   // data
+
+    CMPXMainViewImp*            iView;          // not owned
+    CEikTextListBox*            iListBox;       // owned
+    };
+
+#endif  // C_CMPXMAINVIEWCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/inc/mpxmainviewimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,500 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX main view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXMAINVIEWIMP_H
+#define C_CMPXMAINVIEWIMP_H
+
+
+// INCLUDES
+#include <eikspmod.h>
+#include <eikclb.h>
+#include <mpxplaybackobserver.h>
+#include <mpxcollectionobserver.h>
+#include "mpxwaitnotedefs.h"
+
+#include "mpxmainview.h"
+#include "mpxalbumartutilobserver.h"
+
+// FORWARD DECLARATIONS
+class CMPXMainViewContainer;
+class MMPXViewUtility;
+class MMPXPlaybackUtility;
+class MMPXCollectionUtility;
+class CMPXCommonUiHelper;
+class CMPXAlbumArtUtil;
+class CMPXCollectionPath;
+class CMPXMediaArray;
+class CAknQueryDialog;
+
+// CLASS DECLARATION
+
+/**
+ *  MPX main view.
+ *
+ *  @lib mpxmainview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXMainViewImp ) : public CMPXMainView,
+                                       public MMPXCollectionObserver,
+                                       public MMPXPlaybackObserver,
+                                       public MMPXPlaybackCallback,
+                                       public MEikListBoxObserver,
+                                       public MMPXAlbumArtUtilObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXMainViewImp* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXMainViewImp* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXMainViewImp();
+
+public: // New Functions
+
+    /**
+    * Idle callback function
+    */
+    static TInt IdleCallback( TAny* ptr );
+
+    /**
+    * Idle processing function
+    */
+    void HandleIdleEventL();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXMainViewImp();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    void HandleErrorL( TInt aError );
+
+    /**
+     * Function to display information notes
+     *
+     * @param aResourceId Resource ID of the text string.
+     */
+    void DisplayInfoNoteL( TInt aResourceId );
+
+    /**
+     * Function to display confirmation notes
+     *
+     * @param aResourceId Resource ID of the text string.
+     */
+    void DisplayConfirmionNoteL( TInt aResourceId );
+
+// From MMPXCollectionObserver
+
+    /**
+     * From MMPXCollectionObserver
+     * Handle collection message.
+     *
+     * @param aMessage Collection message
+     * @param aErr system error code.
+     */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d a folder
+     *
+     *  @param aEntries collection entries opened
+     *  @param aIndex focused entry
+     *  @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     *  @param aError error code
+     */
+    void HandleOpenL(
+        const CMPXMedia& aEntries,
+        TInt aIndex,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d an item. Client typically responds by
+     *  'playing' the item
+     *
+     *  @param aPlaylist collection path to item
+     *  @param aError error code
+     */
+    void HandleOpenL(
+        const CMPXCollectionPlaylist& aPlaylist,
+        TInt aError );
+
+    /**
+     *
+     *  From MMPXCollectionObserver
+     *  Handle media properties
+     *  Notes: The client is responsible for delete the object of aProperties
+     *
+     *  @param aMedia media
+     *  @param aError error code
+     */
+    void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+// from base class MMPXPlaybackObserver
+
+    /**
+     * From MMPXPlaybackObserver
+     * Handle playback message
+     *
+     * @param aMessage playback message
+     * @param aErr system error code.
+     */
+    void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+// from base class MMPXPlaybackCallback
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle playback property
+     *
+     * @param aProperty the property
+     * @param aValue the value of the property
+     * @param aError error code
+     */
+    void HandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue,
+        TInt aError );
+
+    /**
+     * 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
+     *
+     * @param aPlayer UID of the subplayer
+     * @param aSubPlayers a list of sub players
+     * @param aComplete ETrue no more sub players. EFalse more subplayer
+     *                  expected
+     * @param aError error code
+     */
+    void HandleSubPlayerNamesL(
+        TUid aPlayer,
+        const MDesCArray* aSubPlayers,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle media properties
+     * Notes: The client is responsible for delete the object of aMedia
+     *
+     * @since 3.0
+     * @param aMedia media
+     * @param aError error code
+     */
+    void HandleMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Returns views id.
+     *
+     * @since 3.0
+     * @return Views Uid
+     */
+    TUid Id() const;
+
+    /**
+     * From CAknView
+     * Command handling function.
+     *
+     * @since 3.0
+     * @param aCommand Command which is handled
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Handles a view activation.
+     *
+     * @param aPrevViewId Specifies the view previously active.
+     * @param aCustomMessageId Specifies the message type.
+     * @param aCustomMessage The activation message.
+     */
+    void DoActivateL(
+        const TVwsViewId& aPrevViewId,
+        TUid aCustomMessageId,
+        const TDesC8& aCustomMessage );
+
+    /**
+     * From CAknView
+     * View deactivation function.
+     */
+    void DoDeactivate();
+
+    /**
+     * From CAknView
+     * Foreground event handling function.
+     *
+     * @param aForeground Indicates the required focus state of the control.
+     */
+    void HandleForegroundEventL( TBool aForeground );
+
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    void DynInitMenuPaneL(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+
+// from MEikListBoxObserver
+
+    /**
+     * Handles listbox events.
+     *
+     * @param aListBox Listbox where the event occurred.
+     * @param aEventType Event type.
+     */
+     void HandleListBoxEventL(
+        CEikListBox* aListBox,
+        TListBoxEvent aEventType );
+
+// from MMPXAlbumArtUtilObserver
+
+    /**
+     * From MMPXAlbumArtUtilObserver.
+     * Notify that extraction of album art started.
+     */
+    void ExtractAlbumArtStarted();
+
+    /**
+     * From MMPXAlbumArtUtilObserver.
+     * Album art is extracted from file and ready to use.
+     *
+     * @param aBitmap a converted image. Ownership is transferred.
+     * @param aErr error code
+     */
+    void ExtractAlbumArtCompleted(
+        CFbsBitmap* aBitmap,
+        TInt aErr );
+
+// New function
+
+    /**
+     *  Handle playback message
+     *
+     *  @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL(
+        const CMPXMessage& aMessage );
+
+    /**
+     *  Handle playback property
+     *
+     *  @param aProperty the property
+     *  @param aValue the value of the property
+     *  @param aError error code
+     */
+    void DoHandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue,
+        TInt aError );
+
+    /**
+     * Handle collection message
+     *
+     * @param aMessage collection message
+     */
+    void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+
+    /**
+     *  Handle media properties.
+     *  Notes: The client is responsible for delete the object of aMedia
+     *
+     *  @param aMedia media properties
+     *  @param aError error code
+     */
+    void DoHandleMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     */
+    void DoHandleStateChangedL(
+        TMPXPlaybackState aState );
+
+    /**
+     * Updates list box
+     *
+     * @param aEntries collection entries opened
+     * @param aIndex focused entry
+     */
+    void UpdateListBoxL(
+        const CMPXMedia& aEntries,
+        TInt aIndex );
+
+    /**
+    * Update the total item count text
+    * @param aMedia, media object containing the information
+    */
+    void UpdateItemCountTotalL( const CMPXMedia& aMedia );
+
+    /**
+     * Updates playback view status
+     *
+     */
+    void UpdatePlaybackViewStatusL();
+
+    /**
+     * Start either the refresh or scanning note
+     */
+    void StartWaitNoteL( TWaitNoteType aNoteType );
+
+    /**
+     * Close the waitnote dialog
+     * @param aSkipCheckIfActive - flags if the method should check if waitnote
+     *                             is the current view
+     */
+    void CloseWaitNoteL(TBool aSkipCheckIfActive = EFalse);
+
+    /**
+     * Handle a broadcast message event
+     * from the collection framework
+     * @arg aEvent, event to handle
+     */
+    void DoHandleBroadcastMsgL( TInt aEvent );
+
+    /**
+     * Handle a corrupt message sent from the collection server
+     */
+    void DoHandleCorruptMsgL();
+
+    /**
+    * Starts the MediaL() calls to update plugin info
+    */
+    void UpdatePluginInfo();
+
+    /**
+    * Send resynchronize collection command to specific collection(s)
+    */
+    void ResynchronizeCollectionL();
+
+    /**
+    * Calls MediaL to retrieve item details
+    */
+    void DoRetrieveDetailsL(TBool aSkipAttribute = EFalse);
+
+    /**
+     * Album art is extracted from file and ready to use.
+     *
+     * @param aBitmap a converted image. Ownership is transferred.
+     * @param aErr error code
+     */
+    void DoExtractAlbumArtCompletedL( CFbsBitmap* aBitmap,
+                                     TInt aErr );
+
+    /**
+    * Sets the default focus
+    * Sets a KMPXCommandIdCollectionSelect command with
+    * selection index of 0
+    */
+    void DoSetDefaultFocusL();
+
+private:    // Data
+
+    CMPXMainViewContainer*      iContainer;  // own
+    MMPXPlaybackUtility*        iPlaybackUtility;
+    MMPXViewUtility*            iViewUtility;
+    MMPXCollectionUtility*      iCollectionUtility;
+    CMPXAlbumArtUtil*           iMPXUtility;
+    CMPXCommonUiHelper*         iCommonUiHelper;
+    TInt                        iResourceOffset;       // must be freed
+    TBool                       iColInitialized;
+
+    // Incremental update to listbox
+    CMPXCollectionPath*         iCurPath;
+    CMPXMediaArray*             iMediaArray;
+    TInt                        iCurPlugin;
+    TBool                       iInitDBNeeded;
+    TBool                       iInitDBCorrupted;
+    TBool                       iDelayedUsbRefresh;
+    TBool                       iOutOfDisk;
+
+    // playback view status
+    HBufC*                      iTitle;
+    TInt                        iDuration;
+    TInt                        iPosition;
+    TInt                        iPlaybackState;
+    TInt                        iAlbumArtIndex;
+
+    // Handlng system events
+    CAknQueryDialog*            iQueryDialog;  // not owned, only for dismissal
+    TInt                        iCurSystemEvent;
+
+    TBool                       iShowPlaybackIndicator;
+    TBool                       iRefreshingCollection;
+    TBool                       iExitOptionHidden;
+    TBool                       iDelayPluginInfoUpdate;
+    TInt                        iCurPlPlayPosition;
+    TInt                        iCurPlTotalCount;
+    CIdle*                      iIdle;
+    TBool                       iDiskDismountDuringFormat;
+    TBool                       iPathCorrupted;
+    };
+
+#endif  // C_CMPXMAINVIEWIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/loc/mpxmainview.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxmainview
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// Title
+
+// d:Text in title pane
+// d:Main view
+// l:title_pane_t2/opt9
+// r:3.1
+//
+#define qtn_mus_application_name "Music player"
+
+// d:Text in main view menu pan to refresh the collection
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_options_update_collection "Refresh"
+
+// d:Dialog shown to query the user if they want to refresh 
+// d:database after a USB session
+// l:popup_note_window/opt1
+// r:3.1
+//
+#define qtn_nmp_note_library_refresh_sync "Music May need to be refreshed due to recent USB sync. Refresh Now?"
+
+
+// d:track position in playlist
+// d:%N current position in track
+// d:%N total number of tracks
+// l:list_double_graphic_pane_t2_cp2 
+// r:3.1
+//
+#define qtn_nmp_track_position "%0N/%1N"
+
+// d:Options menu item for go to now playing.
+// l:list_single_pane_t1_cp2/opt1
+// r:3.1
+//
+#define qtn_nmp_options_go_to_nowplaying "Go to Now Playing"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/src/mpxmainview.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of main view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxmainview.h"
+#include "mpxmainviewimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXMainView* CMPXMainView::NewL()
+    {
+    return CMPXMainViewImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXMainView* CMPXMainView::NewLC()
+    {
+    return CMPXMainViewImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXMainView::~CMPXMainView()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/src/mpxmainviewcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,349 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of main view's container.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <barsread.h>
+#include <StringLoader.h>
+#include <AknIconArray.h>
+#include <gulicon.h>
+#include <aknconsts.h>
+#include <aknlists.h>
+#include <avkon.mbg>
+#include <eikclbd.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxmainview.rsg>
+#include <mpxmainview.mbg>
+#include <mpxconstants.h>
+#include <mpxlog.h>
+#include <mpxuser.h>
+#include "mpxmainviewcontainer.h"
+#include "mpxmainview.hlp.hrh"
+#include "mpxmainview.hrh"
+#include "mpxmainviewimp.h"
+
+// CONSTANTS
+_LIT( KMPXMainViewIconFile, "mpxmainview.mbm" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXMainViewContainer::CMPXMainViewContainer(
+    CMPXMainViewImp* aView ) :
+    iView( aView )
+    {
+    // pass
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewContainer::ConstructL( const TRect& aRect )
+    {
+    MPX_FUNC( "CMPXMainViewContainer::ConstructL()" );
+
+    SetMopParent( iView );
+
+    CreateWindowL();
+
+    SetRect( aRect );
+
+    CreateListBoxL();
+
+    ActivateL();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXMainViewContainer::~CMPXMainViewContainer()
+    {
+    MPX_DEBUG1( "-->CMPXMainViewContainer::~CMPXMainViewContainer" );
+    delete iListBox;
+    MPX_DEBUG1( "<--CMPXMainViewContainer::~CMPXMainViewContainer" );
+    }
+
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewContainer::UpdateLayout()
+    {
+    MPX_FUNC( "CMPXMainViewContainer::UpdateLayout" );
+    }
+
+// -----------------------------------------------------------------------------
+// Returns a pointer to the listbox
+// -----------------------------------------------------------------------------
+//
+CEikTextListBox* CMPXMainViewContainer::ListBox()
+    {
+    return iListBox;
+    }
+
+// ---------------------------------------------------------------------------
+// Create list box
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewContainer::CreateListBoxL()
+    {
+    MPX_FUNC( "CMPXMainViewContainer::CreateListBox" );
+
+    iListBox = new ( ELeave ) CAknDoubleLargeStyleListBox();
+    iListBox->SetContainerWindowL( *this );
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+
+    TResourceReader rReader;
+    iCoeEnv->CreateResourceReaderLC( rReader, R_MPX_MAIN_VIEW_LBX );
+    // construct's iListBox from resource file
+    iListBox->ConstructFromResourceL( rReader );
+    CleanupStack::PopAndDestroy();
+
+    // Enable Marquee
+    CEikFormattedCellListBox* eikListbox =
+        static_cast<CEikFormattedCellListBox*>( iListBox );
+    eikListbox->EnableExtendedDrawingL();
+    eikListbox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue );
+    eikListbox->ItemDrawer()->FormattedCellData()->SetMarqueeParams(
+        KMaxTInt, 6, 1000000, 100000); // Magic: loop forever, other params as default
+
+    iListBox->SetListBoxObserver( iView );
+    iListBox->View()->SetListEmptyTextL( KNullDesC );
+
+    SizeChanged();
+    iListBox->ActivateL();
+
+    // List box icons
+    TParse mbmFileName;
+    mbmFileName.Set( KMPXMainViewIconFile,
+                     &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( mbmFileName.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    // Prepare icon array for listbox
+    CAknIconArray* icons = new ( ELeave )
+        CAknIconArray( 2 ); // magic: array granularity
+    CleanupStack::PushL( icons );
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    CGulIcon* icon = AknsUtils::CreateGulIconL(
+        skin,
+        KAknsIIDNone,
+        iconFile,
+        EMbmMpxmainviewQgn_indi_mup_default_album,
+        EMbmMpxmainviewQgn_indi_mup_default_album_mask );
+    icons->AppendL( icon );
+
+    icon = AknsUtils::CreateGulIconL(
+        skin,
+        KAknsIIDNone,
+        iconFile,
+        EMbmMpxmainviewQgn_graf_mup_npv_defalbumart_transp,
+        EMbmMpxmainviewQgn_graf_mup_npv_defalbumart_transp_mask );
+    icons->AppendL( icon );
+
+    AppendIconToArrayL( icons,
+        KAknsIIDQgnIndiMupPlay,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxmainviewQgn_graf_mup_npv_icon_play,
+        EMbmMpxmainviewQgn_graf_mup_npv_icon_play_mask );
+
+    AppendIconToArrayL( icons,
+        KAknsIIDQgnIndiMupPause,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxmainviewQgn_graf_mup_npv_icon_pause,
+        EMbmMpxmainviewQgn_graf_mup_npv_icon_pause_mask );
+
+    icon = AknsUtils::CreateGulIconL(
+        skin,
+        KAknsIIDNone,
+        iconFile,
+        EMbmMpxmainviewQgn_indi_mup_default_album_pcast,
+        EMbmMpxmainviewQgn_indi_mup_default_album_pcast_mask );
+    icons->AppendL( icon );
+
+    static_cast<CEikFormattedCellListBox*>( iListBox )->ItemDrawer()->
+        FormattedCellData()->SetIconArray( icons );
+    CleanupStack::Pop( icons );
+    }
+
+// -----------------------------------------------------------------------------
+// Append icon to array
+// -----------------------------------------------------------------------------
+//
+void CMPXMainViewContainer::AppendIconToArrayL(
+    CAknIconArray* aArray,
+    const TAknsItemID& aID,
+    const TAknsItemID& aColorId,
+    TInt aColorIndex,
+    const TDesC& aMbmFile,
+    TInt aBitmapId,
+    TInt aMaskId )
+    {
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateColorIconLC(
+        skin,           // aInstance
+        aID,     // aID
+        aColorId,        // aColorID
+        aColorIndex,     // aColorIndex
+        bitmap,            // aBitmap
+        mask,            // aMask
+        aMbmFile, // aFilename
+        aBitmapId,   // aFileBitmapId
+        aMaskId,     // aFileBitmapId
+        KRgbBlack );     // aDefaultColor
+
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+    icon->SetBitmapsOwnedExternally( EFalse );
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop(2); // mask, bitmap
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL( icon );
+    aArray->AppendL( icon );
+
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop();
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Responds to changes to the size and position of the contents of this
+// control.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewContainer::SizeChanged()
+    {
+    MPX_FUNC( "CMPXMainViewContainer::SizeChanged" );
+
+    if ( iListBox )
+        {
+        AknLayoutUtils::LayoutControl( iListBox, Rect(),
+            AKN_LAYOUT_WINDOW_list_gen_pane( 0 ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the number of controls contained in a compound control.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXMainViewContainer::CountComponentControls() const
+    {
+    MPX_FUNC( "CMPXMainViewContainer::CountComponentControls" );
+    TInt count( 0 );
+
+    if ( iListBox )
+        {
+        count++;
+        }
+    return count;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets an indexed component of a compound control.
+// ---------------------------------------------------------------------------
+//
+CCoeControl* CMPXMainViewContainer::ComponentControl( TInt aIndex ) const
+    {
+    MPX_FUNC( "CMPXMainViewContainer::ComponentControl" );
+    CCoeControl* control = NULL;
+    switch ( aIndex )
+        {
+        case 0:
+            {
+            control = iListBox; // Returns the pointer to listbox object.
+            break;
+            }
+        default:
+            {
+            // Exception : Returns NULL. SHOULD NEVER HAPPEN!
+            break;
+            }
+        }
+    return control;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXMainViewContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG4( "CMPXMainViewContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+
+    TKeyResponse response = EKeyWasNotConsumed;
+
+    if ( iListBox )
+        {
+        response = iListBox->OfferKeyEventL( aKeyEvent, aType );
+        }
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewContainer::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType );
+
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+        {
+        SetRect( iView->ClientRect() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewContainer::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KAppUidMusicPlayerX;
+    aContext.iContext = KMUS_HLP_LIB_LIBRARY_VIEW;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/mainview/src/mpxmainviewimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2031 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Main view
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <aknViewAppUi.h>
+#include <eikmenub.h>
+#include <eikfrlb.h>
+#include <eikfrlbd.h>
+#include <featmgr.h>
+#include <StringLoader.h>
+#include <eikapp.h>
+#include <AknUtils.h>
+#include <akntitle.h>
+#include <textresolver.h>
+#include <aknnotewrappers.h>
+#include <aknnavi.h>
+#include <hlplch.h>
+#include <bautils.h>
+#include <eikspmod.h>
+#include <eikclb.h>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <StringLoader.h>
+#include <data_caging_path_literals.hrh>
+#include <bldvariant.hrh>
+#include <layoutmetadata.cdl.h>
+#include <aknSDData.h>
+#include <AknMediatorFacade.h>
+#include <mplayersecondarydisplayapi.h>
+
+#include <mpxplaybackutility.h>
+#include <mpxviewutility.h>
+#include <mpxcollectionutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxviewpluginmanager.h>
+
+#include <mpxcollectionplaylist.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpxmainview.rsg>
+#include <mpxlog.h>
+#include <mpxcollectionpath.h>
+#include <mpxviewplugin.h>
+#include <mpxcollectionplugin.hrh>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxmessagecontainerdefs.h>
+#include <mpxuser.h>
+#include "mpxcommonuihelper.h"
+#include "mpxalbumartutil.h"
+#include "mpxmainview.hrh"
+#include "mpxmainviewimp.h"
+#include "mpxmainviewcontainer.h"
+#include <mpxappui.hrh>
+
+// CONSTANTS
+_LIT( KMPXMainRscPath, "mpxmainview.rsc" );
+_LIT( KMPXTab, "\t" );
+_LIT( KMPXSpace, " " );
+
+const TInt KWaitNoteImpUid = 0x101FFC6C;
+
+// extra size for buffers
+const TInt KMPXDefaultBufferLength = 255;
+const TInt KMPXExtraBufferLength = 50;
+const TInt KSecondInMilliseconds = 1000;
+const TInt KOneHourInSeconds = 3600;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXMainViewImp* CMPXMainViewImp::NewL()
+    {
+    MPX_FUNC( "CMPXMainViewImp::NewL" );
+    CMPXMainViewImp* self = CMPXMainViewImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXMainViewImp* CMPXMainViewImp::NewLC()
+    {
+    CMPXMainViewImp* self = new ( ELeave ) CMPXMainViewImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXMainViewImp::~CMPXMainViewImp()
+    {
+    MPX_DEBUG1( "CMPXMainViewImp::~CMPXMainViewImp entering" );
+
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+
+    if ( iPlaybackUtility )
+        {
+        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+        iPlaybackUtility->Close();
+        }
+
+    if ( iViewUtility )
+        {
+        iViewUtility->Close();
+        }
+
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        }
+
+    delete iMPXUtility;
+    delete iTitle;
+    delete iCommonUiHelper;
+    delete iCurPath;
+    delete iMediaArray;
+    delete iIdle;
+    MPX_DEBUG1( "CMPXMainViewImp::~CMPXMainViewImp exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXMainViewImp::CMPXMainViewImp()
+    {
+    MPX_FUNC( "CMPXMainViewImp::CMPXMainViewImp" );
+    iInitDBNeeded = EFalse;
+    iInitDBCorrupted = EFalse;
+    iCurSystemEvent = KErrNotFound;
+    iShowPlaybackIndicator = EFalse;
+    iColInitialized = EFalse;
+    iRefreshingCollection = EFalse;
+    iCurPlugin = KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::ConstructL()
+    {
+    MPX_FUNC( "CMPXMainViewImp::ConstructL" );
+
+    CCoeEnv* coeEnv = iEikonEnv;
+    TParse parse;
+    parse.Set( KMPXMainRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    BaseConstructL( R_MPX_MAIN_VIEW );
+    iViewUtility = MMPXViewUtility::UtilityL();
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+    iPlaybackUtility->AddObserverL( *this );
+    iCommonUiHelper = CMPXCommonUiHelper::NewL();
+    iMPXUtility = CMPXAlbumArtUtil::NewL();
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
+    iAlbumArtIndex = KMPXMainViewDefaultIcon;
+
+    TMPXPlaybackState state = iPlaybackUtility->StateL();
+    if( state == EPbStatePlaying ||
+        state == EPbStatePaused )
+        {
+        iShowPlaybackIndicator = ETrue;
+        }
+    iIdle = CIdle::NewL( CActive::EPriorityStandard );
+    iTitle = HBufC::NewL( 0 );
+
+#ifdef _DEBUG
+    iExitOptionHidden = EFalse;
+#else // _DEBUG
+    iExitOptionHidden = iCommonUiHelper->ExitOptionHiddenL() &&
+        !iEikonEnv->StartedAsServerApp();
+#endif // _DEBUG
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandleErrorL( TInt aError )
+    {
+    if ( aError )
+        {
+        MPX_DEBUG2( "CMPXMainViewImp::HandleErrorL(%d)", aError );
+
+        // TextResolver instance for error resolving.
+        CTextResolver* textresolver = CTextResolver::NewLC();
+        // Resolve the error text
+        const TDesC& text =
+            textresolver->ResolveErrorString( aError );
+
+        CAknErrorNote* dlg = new ( ELeave ) CAknErrorNote( ETrue );
+        dlg->ExecuteLD( text );
+        CleanupStack::PopAndDestroy( textresolver );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Function to display information notes
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DisplayInfoNoteL( TInt aResourceId )
+    {
+    MPX_FUNC( "CMPXMainViewImp::DisplayInfoNoteL" );
+    HBufC* text = StringLoader::LoadLC( aResourceId );
+    CAknInformationNote* dlg = new ( ELeave ) CAknInformationNote( ETrue );
+    dlg->ExecuteLD( *text );
+    CleanupStack::PopAndDestroy( text );
+    }
+
+// ---------------------------------------------------------------------------
+// Function to display confirmation notes
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DisplayConfirmionNoteL( TInt aResourceId )
+    {
+    MPX_FUNC( "CMPXMainViewImp::DisplayConfirmionNoteL" );
+    HBufC* text = StringLoader::LoadLC( aResourceId );
+    CAknConfirmationNote* dlg = new ( ELeave ) CAknConfirmationNote( ETrue );
+    dlg->ExecuteLD( *text );
+    CleanupStack::PopAndDestroy( text );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection message
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandleCollectionMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d a folder
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandleOpenL(
+    const CMPXMedia& aEntries,
+    TInt aIndex,
+    TBool /*aComplete*/,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXMainViewImp::HandleOpenL 4" );
+    if( aError == KErrNone )
+        {
+        UpdateListBoxL( aEntries, aIndex );
+
+        UpdatePluginInfo();
+        }
+    else if ( aError == KErrCorrupt )
+        {
+        DoHandleCorruptMsgL();
+        }
+    else
+        {
+        HandleErrorL( aError );
+        }
+    MPX_PERF_CHECKPT("MPX Main view displayed");
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d an item. Client typically responds by
+// 'playing' the item
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandleOpenL(
+    const CMPXCollectionPlaylist& /*aPlaylist*/,
+    TInt /*aError*/ )
+    {
+    // Do Nothing: playback/fetch client should handle this stage
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle media properties
+// Notes: The client is responsible for delete the object of aMedia
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandleCollectionMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError)
+    {
+    MPX_FUNC( "CMPXMainViewImp::HandleCollectionMediaL" );
+
+    if (aError == KErrNoMemory)
+        {
+        TRAP_IGNORE(
+                HandleErrorL( aError );
+                AppUi()->HandleCommandL( EEikCmdExit );
+        );
+        User::Exit(KErrNoMemory);
+        return;
+        }
+
+    if (aError == KErrDiskFull)
+        {
+             iOutOfDisk = ETrue;
+             CloseWaitNoteL();
+             iCurPlugin = KErrNotFound;
+             DoRetrieveDetailsL(ETrue);
+        }
+
+    if ( aError != KErrCorrupt )
+        {
+
+        if(!iOutOfDisk)
+            {
+            // Check to see if database has been created for this item
+            //
+            TBool dbCreated = ETrue;
+            if( aMedia.IsSupported(KMPXMediaColDetailDBCreated))
+                {
+                dbCreated = aMedia.ValueTObjectL<TBool>(KMPXMediaColDetailDBCreated);
+                MPX_DEBUG2("CMPXMainViewImp::HandleCollectionMediaL dbcreated %i", dbCreated);
+                }
+            iInitDBNeeded |= !dbCreated;  //lint !e514
+
+            // Check to see if database was corrupted for this item
+            //
+            TBool dbCorrupted = EFalse;
+            if( aMedia.IsSupported(KMPXMediaColDetailDBCorrupted))
+                {
+                dbCorrupted = aMedia.ValueTObjectL<TBool>(KMPXMediaColDetailDBCorrupted);
+                }
+            iInitDBCorrupted |= dbCorrupted;
+            }
+
+        // Update the list box item, iCurPlugin++ because first item is pb state
+        //
+        iCurPlugin++;
+        UpdateItemCountTotalL( aMedia );
+
+
+        // Check to see if we need to do initial scan or refresh due to db corruption
+        //
+        if( iCurPlugin == iCurPath->Count() )
+            {
+            MPX_DEBUG1("CMPXMainViewImp::HandleCollectionMediaL plugins MediaL loaded");
+            if ( !iColInitialized )
+                {
+                CloseWaitNoteL();
+                iColInitialized = ETrue;
+                }
+
+            if( (iInitDBNeeded || iInitDBCorrupted) && !iOutOfDisk )
+                {
+                MPX_DEBUG1("CMPXMainViewImp::HandleCollectionMediaL starting scan");
+                TWaitNoteType noteType = iInitDBCorrupted ? EMPXCorruptScanningNote :
+                                                            EMPXScanningNote;
+
+                StartWaitNoteL( noteType );
+                iInitDBNeeded = EFalse;
+                iInitDBCorrupted = EFalse;
+                iRefreshingCollection = ETrue;
+                iDelayedUsbRefresh = EFalse;
+                }
+            else if( iDelayedUsbRefresh )
+                {
+                DoHandleBroadcastMsgL( EMcMsgUSBMassStorageEnd );
+                }
+            iCurPlugin = KErrNotFound;
+            }
+        else if( iCurPlugin < iCurPath->Count() )  // Fetch next
+            {
+            // Set which plugin
+            iCurPath->Set(iCurPlugin);
+
+            // Fetch the extra data
+            RArray<TMPXAttribute> atts;
+            CleanupClosePushL( atts );
+            if(!iOutOfDisk)
+                {
+                atts.Append(KMPXMediaColDetailDBCreated);
+                atts.Append(KMPXMediaColDetailDBCorrupted);
+                }
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU
+            atts.Append(KMPXMediaGeneralTitle);
+            atts.Append(KMPXMediaGeneralSubTitle);
+            if(!iOutOfDisk)
+                {
+                atts.Append(KMPXMediaGeneralCount);
+                }
+            atts.Append(KMPXMediaGeneralIcon);
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+
+            MPX_DEBUG1("CMPXMainViewImp::HandleCollectionMediaL fetch next");
+            // Only fetch next if we haven't been interrupted by another event
+            //
+            if( iCurSystemEvent == KErrNotFound )
+                {
+                iCollectionUtility->Collection().MediaL(*iCurPath, atts.Array() );
+                }
+            else
+                {
+                // Reset state machine
+                iCurPlugin = KErrNotFound;
+                }
+            CleanupStack::PopAndDestroy( &atts );
+            }
+
+        if ( aError != KErrNone ) //lint !e961
+            {
+            HandleErrorL( aError );
+            }
+        }
+    else
+        {
+        DoHandleCorruptMsgL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    MPX_DEBUG1( "CMPXMainViewImp::HandlePropertyL" );
+    TRAP_IGNORE( DoHandlePropertyL( aProperty, aValue, aError ) );
+    }
+
+// ---------------------------------------------------------------------------
+// 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 CMPXMainViewImp::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle extended media properties.
+// Notes: The client is responsible for delete the object of aProperties.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_DEBUG2( "CMPXMainViewImp::HandleMediaL %i", aError );
+    TRAP_IGNORE( DoHandleMediaL( aMedia, aError ) );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Returns views id.
+// ---------------------------------------------------------------------------
+//
+TUid CMPXMainViewImp::Id() const
+    {
+    return TUid::Uid( KMPXMainViewId );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Command handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandleCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2( "CMPXMainViewImp::HandleCommandL(%d) entering", aCommand );
+
+    switch (aCommand)
+        {
+        case EMPXCmdGoToNowPlaying:
+            {
+            // update view history first
+            iViewUtility->PushDefaultHistoryL();
+            //then open the view first
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        case EMPXMainViewRefresh:
+            {
+            MPX_PERF_CHECKPT("Refresh collection library");
+            // Package the argument from 8bit to 16bit then activate view
+            //
+            StartWaitNoteL( EMPXRefreshingNote );
+            iPlaybackUtility->CommandL( EPbCmdStop );
+            break;
+            }
+        case EAknCmdHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL(
+                iEikonEnv->WsSession(),
+                AppUi()->AppHelpContextL() );
+            break;
+            }
+        case EAknCmdExit:
+        case EAknSoftkeyExit:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        default:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    MPX_DEBUG1( "CMPXMainViewImp::HandleCommandL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Handles a view activation.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoActivateL(
+    const TVwsViewId& /* aPrevViewId */,
+    TUid /* aCustomMessageId */,
+    const TDesC8& /* aCustomMessage */ )
+    {
+    MPX_FUNC( "CMPXMainViewImp::DoActivateL()" );
+    StatusPane()->MakeVisible( ETrue );
+    if ( StatusPane()->CurrentLayoutResId() !=
+         R_AVKON_STATUS_PANE_LAYOUT_USUAL)
+        {
+        StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+        }
+
+    if ( !iContainer )
+        {
+        iContainer = new ( ELeave ) CMPXMainViewContainer( this );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( ClientRect() );
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    // Set title
+    CAknTitlePane* title( NULL );
+
+    TRAP_IGNORE(
+        {
+        title = static_cast<CAknTitlePane*>
+            ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+        } );
+    if ( title )
+        {
+        HBufC* titleText = StringLoader::LoadLC(
+            R_MPX_MAIN_VIEW_TITLE );
+        title->SetTextL( *titleText );
+        CleanupStack::PopAndDestroy( titleText );
+        }
+
+    CEikButtonGroupContainer* cbgc = CEikButtonGroupContainer::Current();
+    if ( cbgc )
+        {
+        if ( iViewUtility->ViewHistoryDepth() == 1 )
+            {
+            cbgc->SetCommandSetL( R_MPX_CUI_SOFTKEYS_OPTIONS_PHONE );
+            }
+        else
+            {
+            cbgc->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+            }
+
+#ifdef __ENABLE_MSK
+        iCommonUiHelper->SetMiddleSoftKeyLabelL(
+            *cbgc,
+            R_QTN_MSK_OPEN,
+            EAknSoftkeyForwardKeyEvent );
+#endif // __ENABLE_MSK
+
+        cbgc->DrawDeferred();
+        }
+
+    iAlbumArtIndex = KMPXMainViewTransparent;
+    iPlaybackState = iPlaybackUtility->StateL();
+    MMPXSource* s = iPlaybackUtility->Source();
+    if ( s )
+        {
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        attrs.Append(
+            TMPXAttribute( KMPXMediaIdGeneral,
+            EMPXMediaGeneralTitle | EMPXMediaGeneralUri ) );
+        attrs.Append(KMPXMediaMusicAlbumArtFileName);
+        s->MediaL( attrs.Array(), *this );
+        CleanupStack::PopAndDestroy( &attrs );
+
+        CMPXCollectionPlaylist* pl = s->PlaylistL();
+        if( pl )
+            {
+            CleanupStack::PushL( pl );
+            iCurPlPlayPosition = pl->Index() + 1; // offset for 0th index
+            iCurPlTotalCount   = pl->Count();
+            CleanupStack::PopAndDestroy( pl );
+            }
+        }
+    UpdatePlaybackViewStatusL();
+
+    if ( iCollectionUtility )
+        {
+        if( iCurSystemEvent == EMcMsgUSBMassStorageStart ||
+            iCurSystemEvent == EMcMsgUSBMTPStart )
+            {
+            // Fix grey out problem by re-starting the note
+            //
+            CMPXViewPlugin* pi =
+                    iViewUtility->ViewPluginManager().PluginL( TUid::Uid(KWaitNoteImpUid) );
+            pi->DeactivateView();
+            DoHandleBroadcastMsgL( iCurSystemEvent );
+            iColInitialized = ETrue;
+            }
+        else if ( !iColInitialized )
+
+            {
+            StartWaitNoteL( EMPXOpeningNote );
+            }
+
+        // Path Depth can be 2 if rapidly pressing back.
+        // In this case, we wait until the collection container opened message
+        // is sent
+        //
+        CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL( cPath );
+        MPX_DEBUG2("CMPXMainViewImp::DoActivateL path depth %i", cPath->Levels());
+        if( cPath->Levels() == 1 )
+            {
+            iCollectionUtility->Collection().OpenL();
+            iPathCorrupted = EFalse;
+            }
+        else
+            {
+            iPathCorrupted = ETrue;
+            }
+        CleanupStack::PopAndDestroy( cPath );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// View deactivation function.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoDeactivate()
+    {
+    MPX_FUNC( "CMPXMainViewImp::DoDeactivate" );
+    if ( iContainer )
+        {
+        AppUi()->RemoveFromStack( iContainer );
+        delete iContainer;
+        iContainer = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Foreground event handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandleForegroundEventL( TBool aForeground )
+    {
+    MPX_FUNC( "CMPXMainViewImp::HandleForegroundEventL" );
+    CAknView::HandleForegroundEventL( aForeground );
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    MPX_FUNC( "CMPXMainViewImp::DynInitMenuPaneL" );
+    switch ( aResourceId )
+        {
+        case R_MPX_MAIN_VIEW_MENU:
+            {
+            aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden );
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+    AknSelectionService::HandleMarkableListDynInitMenuPane(
+        aResourceId,
+        aMenuPane,
+        iContainer->ListBox() );
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikListBoxObserver
+// Handles listbox events.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandleListBoxEventL(
+    CEikListBox* /*aListBox*/,
+    TListBoxEvent aEventType)
+    {
+    MPX_FUNC( "CMPXMainViewImp::HandleListBoxEventL" );
+
+    if ( aEventType == EEventEnterKeyPressed || aEventType == EEventItemDoubleClicked
+#ifdef SINGLE_CLICK_INCLUDED
+        || aEventType == EEventItemSingleClicked    
+#endif
+        )
+        {
+        TInt currentIndex = iContainer->ListBox()->CurrentItemIndex();
+        if ( currentIndex == 0 && iShowPlaybackIndicator ) //lint !e961
+            {
+            MMPXPlayer* player =
+                iPlaybackUtility->PlayerManager().CurrentPlayer();
+            TUid pluginUid( KNullUid );
+            RArray<TUid> array;
+            CleanupClosePushL( array );
+
+            if ( player )
+                {
+                pluginUid = player->UidL();
+                MPX_DEBUG2( "CMPXMainViewImp::HandleListBoxEventL player UID = 0x%x", pluginUid.iUid );
+                array.AppendL( pluginUid );
+                }
+            else
+                {
+                array.AppendL( TUid::Uid( KMPXPluginTypePlaybackUid ) );
+                }
+
+            MMPXSource* source = iPlaybackUtility->Source();
+            if ( source )
+                {
+                CMPXCollectionPlaylist* playlist = source->PlaylistL();
+                if ( playlist )
+                    {
+                    CleanupStack::PushL( playlist );
+                    CMPXCollectionPath* pbPath =
+                        CMPXCollectionPath::NewL( playlist->Path() );
+                    CleanupStack::PushL( pbPath );
+                    if ( pbPath->Levels() > 0 )
+                        {
+                        TMPXItemId cPathUid = pbPath->Id( 0 );
+                        MPX_DEBUG2( "CMPXMainViewImp::HandleListBoxEventL collection uid = 0x%x", cPathUid.iId1 );
+                        array.AppendL( TUid::Uid( cPathUid ) );
+                        }
+                    CleanupStack::PopAndDestroy( pbPath );
+                    CleanupStack::PopAndDestroy( playlist );
+                    }
+                }
+            // Forced jump, clear main view from view history
+            //
+            iViewUtility->PushDefaultHistoryL();
+            iViewUtility->ActivateViewL( array );
+
+            CleanupStack::PopAndDestroy( &array );
+            }
+        else if ( currentIndex > -1 ) //lint !e961
+            {
+            // offset by 1 for playback view
+            TInt offset = iShowPlaybackIndicator ? 1 : 0;
+            iCollectionUtility->Collection().OpenL( currentIndex - offset );
+            }
+        }  //lint !e961
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXAlbumArtUtilObserver
+// Notify that extraction of album art started.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::ExtractAlbumArtStarted()
+    {
+    MPX_DEBUG1("CMPXMainViewImp::ExtractAlbumArtStarted()");
+    iAlbumArtIndex = KMPXMainViewTransparent;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXAlbumArtUtilObserver
+// Album art is extracted from file and ready to use.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::ExtractAlbumArtCompleted(
+    CFbsBitmap* aBitmap, TInt aErr )
+    {
+    TRAP_IGNORE( DoExtractAlbumArtCompletedL( aBitmap, aErr ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXMainViewImp::DoHandlePlaybackMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EPropertyChanged:
+                {
+                TMPXPlaybackProperty property(
+                    static_cast<TMPXPlaybackProperty>( type ) );
+                TInt error( KErrNone );
+
+                DoHandlePropertyL( property, data, error );
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                MPX_DEBUG2( "CMPXMainViewImp::HandlePlaybackMessageL - EStateChanged(%d)", type );
+
+                TMPXPlaybackState state =
+                    static_cast<TMPXPlaybackState>( type );
+
+                DoHandleStateChangedL( state );
+                break;
+                }
+            case TMPXPlaybackMessage::EMediaChanged:
+                {
+                if ( iContainer )
+                    {
+                    MMPXSource* s = iPlaybackUtility->Source();
+                    if ( s )
+                        {
+                        RArray<TMPXAttribute> attrs;
+                        CleanupClosePushL(attrs);
+                        attrs.Append(
+                            TMPXAttribute( KMPXMediaIdGeneral,
+                            EMPXMediaGeneralTitle | EMPXMediaGeneralUri ) );
+                        attrs.Append(KMPXMediaMusicAlbumArtFileName);
+                        s->MediaL( attrs.Array(), *this );
+                        CleanupStack::PopAndDestroy( &attrs );
+
+                        CMPXCollectionPlaylist* pl = s->PlaylistL();
+                        if( pl )
+                            {
+                            CleanupStack::PushL( pl );
+                            iCurPlPlayPosition = pl->Index() + 1; // offset for 0th index
+                            iCurPlTotalCount   = pl->Count();
+                            CleanupStack::PopAndDestroy( pl );
+                            }
+                        }
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::ECommandReceived:
+                {
+                MPX_DEBUG2( "CMPXMainViewImp - ECommandReceived(%d)", type );
+                break;
+                }
+            case TMPXPlaybackMessage::EActivePlayerChanged:
+                {
+                MPX_DEBUG3( "CMPXMainViewImp - EActivePlayerChanged(%d, %d)", type, data );
+                if ( type && data )
+                    {
+                    // binded to active player, change state to active
+                    DoHandleStateChangedL( EPbStatePlaying );
+                    // refresh media property
+                    MMPXSource* s = iPlaybackUtility->Source();
+                    if ( s )
+                        {
+                        RArray<TMPXAttribute> attrs;
+                        CleanupClosePushL(attrs);
+                        attrs.Append(
+                            TMPXAttribute( KMPXMediaIdGeneral,
+                            EMPXMediaGeneralTitle | EMPXMediaGeneralUri ) );
+                        attrs.Append(KMPXMediaMusicAlbumArtFileName);
+                        s->MediaL( attrs.Array(), *this );
+                        CleanupStack::PopAndDestroy( &attrs );
+
+                        CMPXCollectionPlaylist* pl = s->PlaylistL();
+                        if( pl )
+                            {
+                            CleanupStack::PushL( pl );
+                            iCurPlPlayPosition = pl->Index() + 1; // offset for 0th index
+                            iCurPlTotalCount   = pl->Count();
+                            CleanupStack::PopAndDestroy( pl );
+                            }
+                        }
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoHandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXMainViewImp::DoHandlePropertyL" );
+    MPX_DEBUG4( "CMPXMainViewImp::DoHandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError );
+
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty  )
+            {
+            case EPbPropertyPosition:
+                {
+                iPosition = aValue;
+                break;
+                }
+            case EPbPropertyDuration:
+                {
+                iDuration = aValue;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        UpdatePlaybackViewStatusL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle collection messages.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoHandleCollectionMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXCommandHandler::DoHandleCollectionMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt op( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        // End of refresh message, update the list box text
+        //
+        if( event == TMPXCollectionMessage::EBroadcastEvent &&
+            op == EMcMsgRefreshEnd )
+            {
+            MPX_DEBUG1("CMPXMainViewImp::HandleCollectionMessageL - refresh end");
+            iRefreshingCollection = EFalse;
+            iOutOfDisk = data == KErrDiskFull ? ETrue : EFalse;
+
+            if (!iOutOfDisk)
+                {
+                ResynchronizeCollectionL();
+                }
+            else
+                {
+                iCurPlugin = KErrNotFound;
+                iInitDBNeeded = EFalse;
+                iInitDBCorrupted = EFalse;
+                }
+
+            DoRetrieveDetailsL(iOutOfDisk);
+            DoSetDefaultFocusL();
+            }
+        else if(event == TMPXCollectionMessage::EBroadcastEvent &&
+                op == EMcMsgRefreshStart)
+            {
+            iRefreshingCollection = ETrue;
+            }
+        // Handle other broadcast messages
+        //
+        else if( event == TMPXCollectionMessage::EBroadcastEvent )
+            {
+            MPX_DEBUG1("CMPXMainViewImp::HandleCollectionMessageL - broadcast");
+            DoHandleBroadcastMsgL( op );
+            }
+        // if not currently refreshing, the main view should make sure
+        // the collection item counters are always up to date
+        else if( event == TMPXCollectionMessage::EItemChanged &&
+                 !iRefreshingCollection )
+            {
+            MPX_DEBUG1("CMPXMainViewImp::HandleCollectionMessageL - item changed");
+
+            if((op == EMPXItemInserted || op == EMPXItemDeleted) &&
+               (data >> 28 == EMPXCollection)) //lint !e702 only update if collection has changed
+                {
+                // refresh since the podcasting collection has been updated
+                DoRetrieveDetailsL();
+                }
+            // else ignore
+            }
+        // If user rapidly presses back, main view gets activated with a Path of level 2
+        // but the path change to level 1 msg comes later
+        //
+        else if( event == TMPXCollectionMessage::EPathChanged &&
+                 op == EMcPathChangedByOpen &&
+                 data == EMcContainerOpened )
+            {
+            CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( cPath );
+            MPX_DEBUG2("CMPXMainViewImp::HandleCollectionMessageL - Path Changed By Open %i", cPath->Levels() );
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU
+            if( cPath->Levels() == 1 && iContainer )
+                {
+                iCurPlugin = KErrNotFound;
+                iCollectionUtility->Collection().CancelRequest();
+                iCollectionUtility->Collection().OpenL();
+                }
+#else // __ENABLE_PODCAST_IN_MUSIC_MENU
+            if( cPath->Levels() == 2 ) // Music menu
+                {
+                DoRetrieveDetailsL();
+                }
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+
+            CleanupStack::PopAndDestroy( cPath );
+            }
+        else if( event == TMPXCollectionMessage::EFocusChanged &&
+                 iContainer )
+            {
+            TInt offset = iShowPlaybackIndicator ? 1 : 0;
+            iContainer->ListBox()->SetCurrentItemIndex( data + offset );
+            }
+        else if ( event == TMPXCollectionMessage::ECollectionChanged &&
+                  iContainer && iPathCorrupted)
+            {
+            MPX_DEBUG1("CMPXMainViewImp::HandleCollectionMessageL -- Collection changed and Levels 1");
+            CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL( cPath );
+            if( cPath->Levels() == 1 )
+                {
+                iCurPlugin = KErrNotFound;
+                iCollectionUtility->Collection().CancelRequest();
+                iCollectionUtility->Collection().OpenL();
+                iPathCorrupted = EFalse;
+                }
+            CleanupStack::PopAndDestroy( cPath );
+            }
+        }
+    else if( KMPXMessageIdItemChanged == id )
+        {
+        // Loop through messages for arrays.
+        //
+        if (aMessage.IsSupported(KMPXMessageArrayContents))
+            {
+            const CMPXMessageArray* messageArray =
+                        aMessage.Value<CMPXMessageArray>(KMPXMessageArrayContents);
+            User::LeaveIfNull(const_cast<CMPXMessageArray*>(messageArray));
+            
+            for( TInt i=0; i<messageArray->Count(); ++i )
+                  {
+                  HandleCollectionMessage( (*messageArray)[i], KErrNone );
+                  }
+            }
+        // Single item
+        else
+            {
+            MPX_DEBUG1("CMPXScanningWaitDialog::HandleCollectionMessageL KMPXMessageIdItemChanged");
+            TMPXChangeEventType op( aMessage.ValueTObjectL<TMPXChangeEventType>( KMPXMessageChangeEventType ) );
+            TMPXItemId data( aMessage.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId) );
+            if( (op == EMPXItemInserted || op == EMPXItemDeleted) &&
+                (data.iId2 >> 28 == EMPXCollection) &&
+                !iRefreshingCollection ) //lint !e702 only update if collection has changed
+                {
+                // refresh since the podcasting collection has been updated
+                DoRetrieveDetailsL();
+                }
+            }
+        }//lint !e961
+    }
+
+// ---------------------------------------------------------------------------
+// Handle media properties.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoHandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXMainViewImp::DoHandleMediaL" );
+    delete iTitle;
+    iTitle = NULL;
+    iTitle = aMedia.ValueText(KMPXMediaGeneralTitle).AllocL();
+
+    if ( KErrNone == aError )
+        {
+        if ( iContainer )
+            {
+            TInt err( KErrNone );
+            MPX_TRAP( err,
+                iMPXUtility->ExtractAlbumArtL(
+                    aMedia,
+                    *this,
+                    TSize( 50, 50 ) ) );
+            MPX_DEBUG2( "CMPXMainViewImp::DoHandleMediaPropertiesL err = %d", err );
+            if ( err != KErrNone )
+                {
+                iAlbumArtIndex = KMPXMainViewDefaultIcon;
+                }
+            }
+         else
+            {
+            if ( aMedia.IsSupported(KMPXMediaMusicAlbumArtFileName))
+                {
+                iAlbumArtIndex = KMPXMainViewTransparent;
+                }
+            else
+                {
+                iAlbumArtIndex = KMPXMainViewDefaultIcon;
+                }
+            }
+        }
+    else
+        {
+        iAlbumArtIndex = KMPXMainViewDefaultIcon;
+        }
+
+    // check to see if default podcast album art should be displayed instead
+    // of default music album art icon
+    if(iAlbumArtIndex == KMPXMainViewDefaultIcon &&
+       aMedia.IsSupported(KMPXMediaGeneralCategory) &&
+       EMPXPodcast == aMedia.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralCategory))  //lint !e650 !e58
+        {
+        iAlbumArtIndex = KMPXMainViewDefaultPodcastIcon;
+        }
+
+    UpdatePlaybackViewStatusL();
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoHandleStateChangedL(
+    TMPXPlaybackState aState )
+    {
+    MPX_FUNC( "CMPXMainViewImp::DoHandleStateChangedL" );
+
+    // Store a state only if we are not seeking
+    //
+    if( aState != EPbStateSeekingForward &&
+        aState != EPbStateSeekingBackward )
+        {
+        iPlaybackState = aState;
+        }
+    UpdatePlaybackViewStatusL();
+    }
+
+// ---------------------------------------------------------------------------
+// Updates list box
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::UpdateListBoxL(
+    const CMPXMedia& aEntries,
+    TInt aIndex )
+    {
+    MPX_FUNC( "CMPXMainViewImp::UpdateListBox" );
+
+    if ( iContainer )
+        {
+        CDesCArray* array =
+            static_cast<CDesCArray*>(
+            iContainer->ListBox()->Model()->ItemTextArray() );
+
+        // preserve playback status
+        if ( (array->MdcaCount() > 0) && iShowPlaybackIndicator )
+            {
+            HBufC* dataItem = array->MdcaPoint( 0 ).AllocLC();
+            array->Reset();
+            array->AppendL( *dataItem );
+            CleanupStack::PopAndDestroy( dataItem );
+            dataItem = NULL;
+            }
+        else
+            {
+            array->Reset();
+            }
+
+        delete iMediaArray;
+        iMediaArray = NULL;
+        CMPXMediaArray* mediaAry( aEntries.Value<CMPXMediaArray>(KMPXMediaArrayContents) );
+        User::LeaveIfNull( mediaAry );
+        iMediaArray = CMPXMediaArray::NewL( *mediaAry );
+        TInt entriesCount = iMediaArray->Count();
+        CMPXMedia* entry = NULL;
+        for( TInt i=0; i < entriesCount; i++ )
+            {
+            entry = iMediaArray->AtL( i );
+            const TDesC& title = entry->ValueText(KMPXMediaGeneralTitle);
+            MPX_DEBUG2( "CMPXMainViewImp::UpdateListBox Name: %S", &title );
+            MPX_DEBUG3( "CMPXMainViewImp::UpdateListBox Type: %d, Category: %d",
+                        entry->ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType),
+                        entry->ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory));
+            HBufC* dataItem = HBufC::NewLC( title.Length() + KMPXExtraBufferLength );
+            dataItem->Des().Format( _L("0\t%S\t\t\t"), &title );
+            array->AppendL( *dataItem );
+            CleanupStack::PopAndDestroy( dataItem );
+            }
+        iContainer->ListBox()->HandleItemAdditionL();
+        if ( iViewUtility->PreviousViewType().iUid == KMPXPluginTypeCollectionUid )
+            {
+            if ( aIndex < iContainer->ListBox()->Model()->NumberOfItems() )
+                {
+                TInt offset = iShowPlaybackIndicator ? 1 : 0;
+                iContainer->ListBox()->SetCurrentItemIndexAndDraw( aIndex + offset );
+                }
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Function to update the item count at the current item
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::UpdateItemCountTotalL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXMainViewImp::UpdateItemCountTotalL" );
+
+    if( iContainer )
+        {
+        // Offset for icons and array position
+        TInt offset = iShowPlaybackIndicator ? 0 : 1;
+
+        // Listbox descriptor array
+        CDesCArray* array = static_cast<CDesCArray*>(
+                            iContainer->ListBox()->Model()->ItemTextArray() );
+
+        // Number of items
+        if(!aMedia.IsSupported(KMPXMediaGeneralSubTitle) ||
+           !aMedia.IsSupported(KMPXMediaGeneralCount))
+            {
+            User::Leave(KErrArgument);
+            }
+
+        const TDesC& subTitle = aMedia.ValueText(KMPXMediaGeneralSubTitle);
+        const TInt numItems = aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralCount);
+
+        HBufC* formattedSubTitle(NULL);
+
+        if(numItems != 1)
+            {
+            formattedSubTitle = HBufC::NewLC( subTitle.Length() + 7 ); // magic, >>10,000 episodes
+            TPtr ptr = formattedSubTitle->Des();
+            StringLoader::Format(ptr, subTitle, -1, numItems);
+            }
+        else
+            {
+            formattedSubTitle = subTitle.Alloc();
+            CleanupStack::PushL(formattedSubTitle);
+            }
+
+        // Plugin Title
+        const TDesC& title = aMedia.ValueText(KMPXMediaGeneralTitle);
+
+        // Plugin Icon and Mask
+        TIconInfo icon;
+        icon.bmpfile = KNullDesC;
+        CGulIcon* gulicon(NULL);
+        TInt iconIndex(0);
+        if(aMedia.IsSupported(KMPXMediaGeneralIcon))
+            {
+            MPX_DEBUG1("CMPXMainViewImp::UpdateItemCountTotalL - Got an Icon");
+            icon = aMedia.ValueTObjectL<TIconInfo>(KMPXMediaGeneralIcon);
+            // Create the icon
+            MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
+            CFbsBitmap* bmp(NULL);
+            CFbsBitmap* mask(NULL);
+            TParse parse;
+            parse.Set( icon.bmpfile , &KDC_APP_RESOURCE_DIR, NULL);
+            TFileName iconFile( parse.FullName() );
+            User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+            AknsUtils::CreateIconLC(
+                skin,
+                KAknsIIDNone,
+                bmp,
+                mask,
+                iconFile,
+                icon.bitmapId,
+                icon.maskId );
+
+            gulicon = CGulIcon::NewL( bmp, mask );
+            CleanupStack::Pop( 2 ); // bmp, mask
+
+            // Add it to the list
+            CArrayPtr<CGulIcon>* icons = static_cast<CEikFormattedCellListBox*>(
+                    iContainer->ListBox() )->ItemDrawer()->
+                    FormattedCellData()->IconArray();
+            icons->AppendL( gulicon );
+            iconIndex = icons->Count()-1;
+            }
+
+        // Reformat item and insert
+        //
+        MPX_DEBUG1("CMPXMainViewImp::UpdateItemCountTotalL - Updating item");
+        HBufC* dataItem = HBufC::NewLC( title.Length() + formattedSubTitle->Length()
+                                        + KMPXExtraBufferLength );
+        dataItem->Des().Format( _L("%d\t%S\t%S\t\t"), iconIndex, &title, formattedSubTitle );
+        if( array->Count() > (iCurPlugin-offset) )
+            {
+            array->Delete(iCurPlugin-offset);
+            array->InsertL(iCurPlugin-offset, *dataItem);
+            }
+        CleanupStack::PopAndDestroy( dataItem );
+        CleanupStack::PopAndDestroy(formattedSubTitle);
+
+        // Redraw listbox
+        iContainer->ListBox()->DrawDeferred();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates playback view status
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::UpdatePlaybackViewStatusL()
+    {
+    MPX_FUNC( "CMPXMainViewImp::UpdatePlaybackViewStatusL" );
+
+    TBool oldState( iShowPlaybackIndicator );
+    MPX_DEBUG2( "CMPXMainViewImp::UpdatePlaybackViewStatusL iPlaybackState = %d", iPlaybackState );
+
+    if ( iPlaybackState != EPbStateInitialising )
+        {
+        // do not change state if it's in EPbStateInitialising state
+        if( iPlaybackState == EPbStatePlaying ||
+            iPlaybackState == EPbStatePaused ||
+            iPlaybackState == EPbStateSeekingForward ||
+            iPlaybackState == EPbStateSeekingBackward )
+            {
+            iShowPlaybackIndicator = ETrue;
+            }
+        else
+            {
+            // Remove indicator if it was being shown
+            //
+            if( iContainer && iShowPlaybackIndicator )
+                {
+                TInt currentIndex( iContainer->ListBox()->CurrentItemIndex() );
+                MPX_DEBUG2( "CMPXMainViewImp::UpdatePlaybackViewStatusL currentIndex = %d", currentIndex );
+                CDesCArray* array =
+                    static_cast<CDesCArray*>(
+                    iContainer->ListBox()->Model()->ItemTextArray() );
+
+                if ( array->Count() > 0 )
+                    {
+                    array->Delete( 0 );
+                    }
+                iContainer->ListBox()->HandleItemAdditionL();
+                if ( currentIndex > 0 )
+                    {
+                    // to preseve current selection index
+                    currentIndex--;
+                    MPX_DEBUG2( "CMPXMainViewImp::UpdatePlaybackViewStatusL setting index = %d", currentIndex );
+                    iContainer->ListBox()->SetCurrentItemIndexAndDraw( currentIndex );
+                    }
+                }
+            MPX_DEBUG1( "CMPXMainViewImp::UpdatePlaybackViewStatusL dismissing playback indicator" );
+            iShowPlaybackIndicator = EFalse;
+            }
+        }
+    else
+        {
+        MPX_DEBUG1( "CMPXMainViewImp::UpdatePlaybackViewStatusL initializing, state unchanged" );
+        }
+
+    // Show the item only if we want to show indicator
+    //
+    if ( iContainer && iShowPlaybackIndicator )
+        {
+        CDesCArray* array =
+            static_cast<CDesCArray*>(
+            iContainer->ListBox()->Model()->ItemTextArray() );
+
+        TInt playStatusIcon = -1;
+
+        if ( iPlaybackState == EPbStatePlaying )
+            {
+            playStatusIcon = KMPXMainViewPlayIcon;
+            }
+        else if ( iPlaybackState == EPbStatePaused )
+            {
+            playStatusIcon = KMPXMainViewPauseIcon;
+            }
+
+        TInt duration = iPosition; //lint !e961
+        if ( duration > 0 ) //lint !e961
+            {
+            // convert milliseconds to seconds
+            duration = duration / KSecondInMilliseconds;
+            }
+        CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode =
+            CMPXCommonUiHelper::EMPXDuratAuto;
+        if ( duration > KOneHourInSeconds )
+            {
+            durationMode = CMPXCommonUiHelper::EMPXDuratHMS;
+            }
+        HBufC* stringBuf = iCommonUiHelper->DisplayableDurationL(
+            (TInt64)duration, durationMode );
+        CleanupStack::PushL( stringBuf );
+
+        // Only remove the old one if we were previously showing the
+        // playback indicator
+        if ( array->Count() > 0 && oldState)
+            {
+            array->Delete( 0 );
+            }
+        HBufC* dataItem;
+        if ( iTitle )
+            {
+            dataItem = HBufC::NewLC( iTitle->Length() + KMPXExtraBufferLength );
+            }
+        else
+            {
+            dataItem = HBufC::NewLC( KMPXDefaultBufferLength +
+                KMPXExtraBufferLength );
+            }
+        if ( playStatusIcon > -1 )
+            {
+            dataItem->Des().AppendNum( (TInt64)iAlbumArtIndex );
+            dataItem->Des().Append( KMPXTab );
+            dataItem->Des().Append( *iTitle );
+            dataItem->Des().Append( KMPXTab );
+            dataItem->Des().Append( *stringBuf );
+            dataItem->Des().Append( KMPXSpace );
+            dataItem->Des().Append( KMPXSpace );
+
+            CArrayFix< TInt >* intArray =
+                new ( ELeave ) CArrayFixFlat<TInt>( 2 );  // magic number
+            CleanupStack::PushL( intArray );
+            intArray->AppendL( iCurPlPlayPosition );
+            intArray->AppendL( iCurPlTotalCount );
+            HBufC* posString = StringLoader::LoadLC(
+                R_MPX_TRACK_POSITION, *intArray );
+            dataItem->Des().Append( *posString );
+            CleanupStack::PopAndDestroy( posString );
+            CleanupStack::PopAndDestroy( intArray );
+            dataItem->Des().Append( KMPXTab );
+
+            dataItem->Des().Append( KMPXTab );
+            dataItem->Des().AppendNum( (TInt64)playStatusIcon );
+            }
+        else
+            {
+            dataItem->Des().AppendNum( (TInt64)iAlbumArtIndex );
+            dataItem->Des().Append( KMPXTab );
+            dataItem->Des().Append( *iTitle );
+            dataItem->Des().Append( KMPXTab );
+            dataItem->Des().Append( KMPXTab );
+            dataItem->Des().Append( KMPXTab );
+            }
+        array->InsertL( 0, dataItem->Des() );
+        iContainer->ListBox()->HandleItemAdditionL();
+
+        CleanupStack::PopAndDestroy( dataItem );
+        CleanupStack::PopAndDestroy( stringBuf );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Start a refreshing note
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::StartWaitNoteL( TWaitNoteType aNoteType )
+    {
+    CloseWaitNoteL();
+    TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid );
+    TPckg<TWaitNoteType> note = aNoteType;
+    HBufC* arg = MPXUser::AllocL( note );
+    CleanupStack::PushL( arg );
+    iViewUtility->ActivateViewL( waitnoteId, arg );
+    CleanupStack::PopAndDestroy( arg );
+    }
+
+// ---------------------------------------------------------------------------
+// Close waitnote dialog
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::CloseWaitNoteL(TBool aSkipCheckIfActive)
+    {
+    TUid waitnoteId = TUid::Uid( KMPXPluginTypeWaitNoteDialogUid );
+    TUid activeView = iViewUtility->ActiveViewType();
+    if(( activeView == waitnoteId ) || (aSkipCheckIfActive))
+        {
+        CMPXViewPlugin* pi =
+            iViewUtility->ViewPluginManager().PluginL( TUid::Uid(KWaitNoteImpUid) );
+        pi->DeactivateView();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Any processing to handle broadcast events
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoHandleBroadcastMsgL( TInt aEvent )
+    {
+    MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg<--");
+    switch( aEvent )
+        {
+        case EMcMsgFormatStart:
+            {
+            MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg - EMcMsgFormatStart");
+
+            // If we were in MTP sync, we stay in mtp sync mode
+            if( iCurSystemEvent == KErrNotFound )
+                {
+                // Show a formatting wait note
+                iCurSystemEvent = EMcMsgFormatStart;
+                iDiskDismountDuringFormat = EFalse;
+                iPlaybackUtility->CommandL( EPbCmdStop );
+
+                StartWaitNoteL( EMPXFormatScanningNote );
+                }
+            break;
+            }
+        case EMcMsgFormatEnd:
+            {
+            MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg - EMcMsgFormatEnd");
+            if( iCurSystemEvent == EMcMsgFormatStart )
+                {
+                iCurSystemEvent = KErrNotFound;
+
+                if( !iDiskDismountDuringFormat )
+                    {
+                    MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg - Sync db after format");
+                    ResynchronizeCollectionL();
+
+                    if( !iRefreshingCollection )
+                        {
+                        StartWaitNoteL( EMPXScanningNote );
+                        iRefreshingCollection = ETrue;
+                        }
+                    }
+                }
+            break;
+            }
+        case EMcMsgDiskRemoved:
+            {
+            MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg - EMcMsgDiskRemoved");
+            iPlaybackUtility->CommandL( EPbCmdStop );
+
+            // Main view hasn't been activated
+            // Updating the view now causes a blank screen if usb is started
+            //
+            if( iColInitialized )
+                {
+                UpdatePluginInfo();
+                }
+
+            if( iCurSystemEvent == EMcMsgFormatStart )
+                {
+                iDiskDismountDuringFormat = ETrue;
+                }
+            break;
+            }
+        case EMcMsgDiskInserted:
+            {
+            MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg - EMcMsgDiskInserted");
+            // Only show the query if we are not processing a usb event
+            // USB dismounts and re-mounts the drive several times
+            //
+            // Ignore the disk insert during format, after format a fake event will be sent.
+            //
+            if( iCurSystemEvent != EMcMsgUSBMassStorageStart &&
+                iCurSystemEvent != EMcMsgUSBMTPStart &&
+                iCurSystemEvent != EMcMsgFormatStart &&
+                iColInitialized )
+                {
+                if( iQueryDialog )
+                    {
+                    MPX_DEBUG1("Main View -- Dismissing Query");
+                    iQueryDialog->DismissQueryL();
+                    }
+
+                // Always start a refresh
+                //
+                ResynchronizeCollectionL();
+                if( !iRefreshingCollection )
+                    {
+                    StartWaitNoteL( EMPXScanningNote );
+                    iRefreshingCollection = ETrue;
+                    }
+                }
+            break;
+            }
+        case EMcMsgUSBMassStorageEnd:
+            {
+            MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg - EMcMsgUSBMassStorageEnd");
+            // Show query dialog to ask if they want to refresh
+            //
+            MPX_DEBUG2( "CMPXMainViewImp::DoHandleBroadcastMsg - EMcMsgUSBMassStorageEnd iColInitialized = %d", iColInitialized );
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU
+            if( iColInitialized || iDelayPluginInfoUpdate )
+                {
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+                CloseWaitNoteL(ETrue);
+                iDelayPluginInfoUpdate = EFalse;
+                if( iIdle->IsActive() )
+                    {
+                    iIdle->Cancel();
+                    }
+                TCallBack cb( &IdleCallback, this );
+                iIdle->Start( cb );
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU
+                }
+            else
+                {
+                iDelayedUsbRefresh = ETrue;
+                iCurSystemEvent = KErrNotFound;
+                }
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+            break;
+            }
+        case EMcMsgUSBMassStorageStart:
+            {
+            MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg - EMcMsgUSBMassStorageStart");
+            // Close playback framework and start wait note
+            if( iQueryDialog )
+                {
+                MPX_DEBUG1("Main View -- Dismissing Query");
+                iQueryDialog->DismissQueryL();
+                }
+            iCurSystemEvent = EMcMsgUSBMassStorageStart;
+            iPlaybackUtility->CommandL( EPbCmdStop );
+            StartWaitNoteL( EMPXUsbEventNote );
+            break;
+            }
+        case EMcMsgUSBMTPStart:
+            {
+            MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg - EMcMsgUSBMTPStart");
+            // Close playback framework and start wait note
+            if( iQueryDialog )
+                {
+                MPX_DEBUG1("Main View -- Dismissing Query");
+                iQueryDialog->DismissQueryL();
+                }
+            iCurSystemEvent = EMcMsgUSBMTPStart;
+            if( !iColInitialized )
+                {
+                iColInitialized = ETrue;
+                }
+            iPlaybackUtility->CommandL( EPbCmdStop );
+            StartWaitNoteL( EMPXMTPEventNote );
+            break;
+            }
+        case EMcMsgUSBMTPEnd:
+            {
+            MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg EMcMsgUSBMTPEnd");
+            iCurSystemEvent = KErrNotFound;
+            CloseWaitNoteL(ETrue);
+            if( iColInitialized )
+                {
+                ResynchronizeCollectionL();
+                UpdatePluginInfo();
+                }
+            break;
+            }
+        case EMcMsgRefreshEnd: // fall through
+            {
+            MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg - EMcMsgFormatEnd, EMcMsgUSBMTPEnd,EMcMsgRefreshEnd");
+            iCurSystemEvent = KErrNotFound;
+
+            if( iColInitialized )
+                {
+                ResynchronizeCollectionL();
+                UpdatePluginInfo();
+                }
+            break;
+            }
+        case EMcMsgSystemEventMax:
+        case EMcMsgRefreshStart:    // fall through
+            {
+            MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg - EMcMsgSystemEventMax, EMcMsgRefreshStart");
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+     MPX_DEBUG1("CMPXMainViewImp::DoHandleBroadcastMsg -->");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle a corrupt message
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoHandleCorruptMsgL()
+    {
+    // Start the corrupt note. The corrupt note will delete
+    // the old databases and restart everything from SCRATCH
+    //
+    MPX_DEBUG1("CMPXMainViewImp::DoHandleCorruptMsgL <-- starting scan");
+
+    StartWaitNoteL( EMPXCorruptScanningNote );
+    iInitDBNeeded = EFalse;
+    iInitDBCorrupted = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle a corrupt message
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::UpdatePluginInfo()
+    {
+    MPX_DEBUG1("CMPXMainViewImp::UpdatePluginInfo");
+
+    // MediaL on the first selection and only if we are
+    // not currently handling a system event
+    //
+    if( iCurSystemEvent == KErrNotFound )
+        {
+        TRAP_IGNORE( DoRetrieveDetailsL() );
+        }
+    else if ( !iColInitialized )
+        {
+        MPX_DEBUG1( "CMPXMainViewImp::UpdatePluginInfo setting iDelayPluginInfoUpdate" );
+        iDelayPluginInfoUpdate = ETrue;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Resynchronize collection(s)
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::ResynchronizeCollectionL()
+    {
+    MPX_FUNC( "CMPXMainViewImp::ResynchronizeCollectionL" );
+
+    RArray<TUid> ary;
+    CleanupClosePushL( ary );
+
+    // Resynchronize podcast databases
+    ary.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) );
+    TUid collection = iCollectionUtility->CollectionIDL( ary.Array() );
+    TRAP_IGNORE(
+        iCollectionUtility->
+            Collection().CommandL( EMcCmdCollectionInit,
+                                   collection.iUid ) );
+
+    // Resynchronize music collection databases
+    ary.Reset();
+    ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) );
+    collection = iCollectionUtility->CollectionIDL( ary.Array() );
+    iCollectionUtility->Collection().CommandL( EMcCmdCollectionInit,
+                                               collection.iUid );
+
+    CleanupStack::PopAndDestroy( &ary );
+    }
+
+// ---------------------------------------------------------------------------
+// Handle an idle callback event
+// ---------------------------------------------------------------------------
+//
+TInt CMPXMainViewImp::IdleCallback( TAny* ptr )
+    {
+    TRAP_IGNORE( ( (CMPXMainViewImp*) ptr )->HandleIdleEventL() );
+    return 0;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle an idle callback event
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::HandleIdleEventL()
+    {
+    MPX_FUNC( "CMPXMainViewImp::HandleIdleEventL" );
+    TInt event = iDelayedUsbRefresh ? EMcMsgUSBMassStorageStart : iCurSystemEvent;
+    switch( event )
+        {
+        case EMcMsgUSBMassStorageStart:
+            {
+            MPX_DEBUG1("CMPXMainViewImp::HandleIdleEventL -- Mass Storage dialog");
+            iCurSystemEvent = KErrNotFound;
+            iDelayedUsbRefresh = EFalse;
+
+            // Send resyn command
+            ResynchronizeCollectionL();
+
+            HBufC* title = StringLoader::LoadLC( R_MPX_REFRESH_AFTER_SYNC );
+            CAknQueryDialog* query = new( ELeave ) CAknQueryDialog();
+            iQueryDialog = query;
+
+            query->PublishDialogL(
+                EMPlayerNoteUSBSyncRefresh,
+                KMPlayerNoteCategory );
+
+            TInt rtn = query->ExecuteLD( R_MPX_QUERY_YES_NO ,
+                                         *title );
+            CleanupStack::PopAndDestroy( title );
+            iQueryDialog = NULL;  // Dialog destroyed
+
+            if ( rtn == EAknSoftkeyYes )
+                {
+                StartWaitNoteL( EMPXRefreshingNote );
+                }
+            else
+                {
+                MPX_DEBUG1("CMPXMainViewImp::HandleIdleEventL -- refreshing view");
+                UpdatePluginInfo();
+
+                // Refresh the UI view in this case
+                // @todo, refactor all this handling to its own class
+                //
+                MPX_DEBUG1("CMPXMainViewImp::HandleIdleEventL() no refresh selected");
+                if ( !CEikonEnv::Static()->StartedAsServerApp() )
+                    {
+                    CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+                    CleanupStack::PushL( cPath );
+                    if( cPath->Levels() > 1 &&
+                        iViewUtility->ActiveViewType() == TUid::Uid(KMPXPluginTypeCollectionUid) )
+                        {
+                        MPX_DEBUG1("CMPXMainViewImp::HandleIdleEventL() Refreshing UI");
+                        cPath->Back();
+                        iCollectionUtility->Collection().OpenL( *cPath );
+                        }
+                    CleanupStack::PopAndDestroy( cPath );
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Calls MediaL to retrieve item details
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoRetrieveDetailsL(TBool aSkipAttribute)
+    {
+    MPX_DEBUG2("CMPXMainViewImp::DoRetrieveDetailsL %i", iCurPlugin);
+    iDelayPluginInfoUpdate = EFalse;
+    // Make sure we don't overlap 2 sets of MediaL()
+    //
+    if( iCurPlugin == KErrNotFound && iCurSystemEvent == KErrNotFound )
+        {
+        delete iCurPath;
+        iCurPath = NULL;
+
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU
+        iCurPath = iCollectionUtility->Collection().PathL();
+#else
+        // TEMPORARY FIX, hardcode root level collections
+        // This needs to be re-written as a seperate class!
+        //
+        RArray<TMPXItemId> ids;
+        CleanupClosePushL( ids );
+
+        // Root level path
+        iCurPath = CMPXCollectionPath::NewL();
+        ids.AppendL( TMPXItemId(0x101FFC3A) );
+        ids.AppendL( TMPXItemId(0x101FFC3C) );
+        iCurPath->AppendL( ids.Array() );
+
+        CleanupStack::PopAndDestroy( &ids );
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+
+        if( iCurPath->Levels() == 1 && iCurPath->Count() )
+            {
+            iCurPath->SetToFirst();
+            iCurPlugin = 0;
+
+            // Do a MediaL to re-retrieve details
+            //
+            RArray<TMPXAttribute> atts;
+            CleanupClosePushL( atts );
+            if(!aSkipAttribute)
+                {
+                atts.Append(KMPXMediaColDetailDBCreated);
+                atts.Append(KMPXMediaColDetailDBCorrupted);
+                }
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU
+            atts.Append(KMPXMediaGeneralSubTitle);
+            if(!aSkipAttribute)
+                {
+                atts.Append(KMPXMediaGeneralCount);
+                }
+            atts.Append(KMPXMediaGeneralTitle);
+            atts.Append(KMPXMediaGeneralIcon );
+#endif // __ENABLE_PODCAST_IN_MUSIC_MENU
+            iCollectionUtility->Collection().MediaL(*iCurPath, atts.Array() );
+            CleanupStack::PopAndDestroy( &atts );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXAlbumArtUtilObserver
+// Album art is extracted from file and ready to use.
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoExtractAlbumArtCompletedL(
+    CFbsBitmap* aBitmap, TInt aErr )
+    {
+    MPX_DEBUG3( "CMPXMainViewImp::DoExtractAlbumArtCompleted(bitmap:0x%x, err:%d)",
+        aBitmap, aErr );
+
+    if ( !aErr )
+        {
+        if ( iContainer )
+            {
+            CGulIcon* icon = CGulIcon::NewL( aBitmap );
+            CArrayPtr<CGulIcon>* icons = static_cast<CEikFormattedCellListBox*>(
+                iContainer->ListBox() )->ItemDrawer()->
+                FormattedCellData()->IconArray();
+            icons->AppendL( icon );
+            iAlbumArtIndex = icons->Count() - 1;
+
+            MPX_DEBUG2( "CMPXMainViewImp::ExtractAlbumArtCompleted Array icon index = %d", iAlbumArtIndex );
+            TRAP_IGNORE(UpdatePlaybackViewStatusL());
+            }
+        else
+            {
+            delete aBitmap;
+            }
+        }
+    else
+        {
+        iAlbumArtIndex = KMPXMainViewDefaultIcon;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the default focus
+// ---------------------------------------------------------------------------
+//
+void CMPXMainViewImp::DoSetDefaultFocusL()
+    {
+    if( iContainer )
+        {
+        CMPXCommand* cmd = CMPXCommand::NewL();
+        CleanupStack::PushL( cmd );
+
+        // Select item 0
+        //
+        cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId,
+                                     KMPXCommandIdCollectionSelect);
+        cmd->SetTObjectValueL<TInt>( KMPXCommandCollectionSelectIndex, 0 );
+        cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+
+        iCollectionUtility->Collection().CommandL( *cmd );
+        CleanupStack::PopAndDestroy( cmd );
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/bwinscw/mpxmetadataeditordialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	??1CMPXMetadataEditorDialog@@UAE@XZ @ 1 NONAME ; CMPXMetadataEditorDialog::~CMPXMetadataEditorDialog(void)
+	?NewL@CMPXMetadataEditorDialog@@SAPAV1@XZ @ 2 NONAME ; class CMPXMetadataEditorDialog * CMPXMetadataEditorDialog::NewL(void)
+	?SetParamL@CMPXMetadataEditorDialog@@QAEXPBVTDesC16@@@Z @ 3 NONAME ; void CMPXMetadataEditorDialog::SetParamL(class TDesC16 const *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/data/mpxmetadataeditordialog.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1131 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxmetadata editor dialog
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MXMP // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+
+#include <mpxmetadataeditordialog.loc>
+#include "mpxmetadataeditordialog.hrh"
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_song_details_menubar
+//    Menubar for metadata editor dialog
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_cui_song_details_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_cui_song_details_menupane;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// 
+//    r_mpx_cui_song_details_menupane
+//    Menu pane of options command for metadata editor dialog 
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_cui_song_details_menupane
+    {
+    items =
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdSongDetailsChange;
+            txt = qtn_options_change;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdSongDetails;
+            txt = qtn_options_view_file_details;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_mpx_cui_song_details_softkeys_options_empty_done
+// CBA for Song Details view.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_cui_song_details_softkeys_options_empty_done
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt=text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyDone; txt=text_softkey_done; },
+        CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent; txt=text_softkey_empty; }
+        };
+    }
+    
+// ---------------------------------------------------------------------------
+// r_mpx_cui_song_details_softkeys_options_change_done
+// CBA for Song Details view.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_cui_song_details_softkeys_options_change_done
+    {
+    buttons =
+        {
+        CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;},
+        CBA_BUTTON {id=EAknSoftkeyDone; txt=text_softkey_done; },
+        CBA_BUTTON {id=EAknSoftkeyForwardKeyEvent; txt=qtn_msk_change; }
+        };
+    }
+#endif // __ENABLE_MSK
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_song_details_title
+//    Title for metadata editor dialog for tracks.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_song_details_title
+    {
+    buf = qtn_mus_title_details_track;
+    }
+
+#ifdef __ENABLE_MSK
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_song_details_dialog
+//    Dialog for getting the song info
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_cui_song_details_dialog
+    {
+    flags = EAknDialogGenericFullScreen;
+    buttons = r_mpx_cui_song_details_softkeys_options_empty_done;
+    form = r_mpx_cui_song_details_form;
+    }
+    
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_song_details_dialog_no_move_library
+//    Dialog for getting the song info
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_cui_song_details_dialog_no_move_library
+    {
+    flags = EAknDialogGenericFullScreen;
+    buttons = r_mpx_cui_song_details_softkeys_options_empty_done;
+    form = r_mpx_cui_song_details_form_no_move_library;
+    }
+
+#else
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_song_details_dialog
+//    Dialog for getting the song info
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_cui_song_details_dialog
+    {
+    flags = EAknDialogGenericFullScreen;
+    buttons = R_AVKON_SOFTKEYS_OPTIONS_DONE;
+    form = r_mpx_cui_song_details_form;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_song_details_dialog_no_move_library
+//    Dialog for getting the song info
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_cui_song_details_dialog_no_move_library
+    {
+    flags = EAknDialogGenericFullScreen;
+    buttons = R_AVKON_SOFTKEYS_OPTIONS_DONE;
+    form = r_mpx_cui_song_details_form_no_move_library;
+    }
+#endif // __ENABLE_MSK
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_song_details_form
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE FORM r_mpx_cui_song_details_form
+    {
+    flags = EEikFormUseDoubleSpacedFormat;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_song_details_name;
+            id = EMPXMetadataEditorDlgCtrlIdSongName;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_song_details_artist;
+            id = EMPXMetadataEditorDlgCtrlIdArtist;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_song_details_album;
+            id = EMPXMetadataEditorDlgCtrlIdAlbum;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtNumberEditor;
+            prompt = qtn_nmp_song_details_track_number;
+            id = EMPXMetadataEditorDlgCtrlIdTrackNumber;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = NUMBER_EDITOR
+                {
+                min = KMPXSongDetailsTrackNumMin;
+                max = KMPXSongDetailsTrackNumMax;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtNumberEditor;
+            prompt = qtn_nmp_song_details_year;
+            id = EMPXMetadataEditorDlgCtrlIdYear;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = NUMBER_EDITOR
+                {
+                min = KMPXSongDetailsYearMin;
+                max = KMPXSongDetailsYearMax;
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtPopupField;
+            prompt = qtn_nmp_song_details_genre;
+            id = EMPXMetadataEditorDlgCtrlIdGenre;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = POPUP_FIELD
+                {
+                width = KMPXSongDetailsTextMaxLen;
+               // other = qtn_aknexpopfield_list_other;
+                };
+            tooltip = qtn_aknexpopfield_hint_text;
+            },
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_song_details_composer;
+            id = EMPXMetadataEditorDlgCtrlIdComposer;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_song_details_comment;
+            id = EMPXMetadataEditorDlgCtrlIdComment;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtPopupField;
+            prompt = qtn_nmp_episode_details_library;
+            id = EMPXMetadataEditorDlgCtrlIdLibrary;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = POPUP_FIELD
+                {
+                width = KMPXSongDetailsTextMaxLen;
+                // other = qtn_aknexpopfield_list_other;
+                };
+            tooltip = qtn_aknexpopfield_hint_text;
+            }
+        };
+    } 
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_song_details_form_no_move_library
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE FORM r_mpx_cui_song_details_form_no_move_library
+    {
+    flags = EEikFormUseDoubleSpacedFormat;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_song_details_name;
+            id = EMPXMetadataEditorDlgCtrlIdSongName;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_song_details_artist;
+            id = EMPXMetadataEditorDlgCtrlIdArtist;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_song_details_album;
+            id = EMPXMetadataEditorDlgCtrlIdAlbum;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtNumberEditor;
+            prompt = qtn_nmp_song_details_track_number;
+            id = EMPXMetadataEditorDlgCtrlIdTrackNumber;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = NUMBER_EDITOR
+                {
+                min = KMPXSongDetailsTrackNumMin;
+                max = KMPXSongDetailsTrackNumMax;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtNumberEditor;
+            prompt = qtn_nmp_song_details_year;
+            id = EMPXMetadataEditorDlgCtrlIdYear;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = NUMBER_EDITOR
+                {
+                min = KMPXSongDetailsYearMin;
+                max = KMPXSongDetailsYearMax;
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtPopupField;
+            prompt = qtn_nmp_song_details_genre;
+            id = EMPXMetadataEditorDlgCtrlIdGenre;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = POPUP_FIELD
+                {
+                width = KMPXSongDetailsTextMaxLen;
+               // other = qtn_aknexpopfield_list_other;
+                };
+            tooltip = qtn_aknexpopfield_hint_text;
+            },
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_song_details_composer;
+            id = EMPXMetadataEditorDlgCtrlIdComposer;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_song_details_comment;
+            id = EMPXMetadataEditorDlgCtrlIdComment;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_song_details_episode
+//    Title for metadata editor dialog for podcasts.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_song_details_episode
+    {
+    buf = qtn_mus_title_details_episode;
+    }
+
+#ifdef __ENABLE_MSK
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_podcast_details_dialog
+//    Dialog for getting the podcast info
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_cui_podcast_details_dialog
+    {
+    flags = EAknDialogGenericFullScreen;
+    buttons = r_mpx_cui_song_details_softkeys_options_empty_done;
+    form = r_mpx_cui_podcast_details_form;
+    }
+#else
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_podcast_details_dialog
+//    Dialog for getting the podcast info
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_cui_podcast_details_dialog
+    {
+    flags = EAknDialogGenericFullScreen;
+    buttons = R_AVKON_SOFTKEYS_OPTIONS_DONE;
+    form = r_mpx_cui_podcast_details_form;
+    }
+#endif // __ENABLE_MSK
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_podcast_details_form
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE FORM r_mpx_cui_podcast_details_form
+    {
+    flags = EEikFormUseDoubleSpacedFormat;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_episode_details_name;
+            id = EMPXMetadataEditorDlgCtrlIdSongName;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_episode_details_author;
+            id = EMPXMetadataEditorDlgCtrlIdArtist;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_episode_details_title;
+            id = EMPXMetadataEditorDlgCtrlIdAlbum;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },        
+        DLG_LINE
+            {
+            type = EEikCtNumberEditor;
+            prompt = qtn_nmp_song_details_episode_number;
+            id = EMPXMetadataEditorDlgCtrlIdTrackNumber;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = NUMBER_EDITOR
+                {
+                min = KMPXSongDetailsTrackNumMin;
+                max = KMPXSongDetailsTrackNumMax;
+                };
+            },
+        DLG_LINE
+            {
+            type = EEikCtNumberEditor;
+            prompt = qtn_nmp_song_details_year;
+            id = EMPXMetadataEditorDlgCtrlIdYear;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = NUMBER_EDITOR
+                {
+                min = KMPXSongDetailsYearMin;
+                max = KMPXSongDetailsYearMax;
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtPopupField;
+            prompt = qtn_nmp_episode_details_genre;
+            id = EMPXMetadataEditorDlgCtrlIdGenre;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = POPUP_FIELD
+                {
+                width = KMPXSongDetailsTextMaxLen;
+               // other = qtn_aknexpopfield_list_other;
+                };
+            tooltip = qtn_aknexpopfield_hint_text;
+            },                    
+        DLG_LINE
+            {
+            type = EEikCtEdwin;
+            prompt = qtn_nmp_song_details_comment;
+            id = EMPXMetadataEditorDlgCtrlIdComment;
+            itemflags=EEikDlgItemTakesEnterKey| EEikDlgItemOfferAllHotKeys;
+            control = EDWIN
+                {
+                flags = EEikEdwinNoHorizScrolling | EEikEdwinResizable;
+                width = KMPXSongDetailsTextWidth;
+                lines = KMPXSongDetailsTextLines;
+                maxlength = KMPXSongDetailsTextMaxLen;
+                // added to limit expanding in forms.
+                // If you want full screen use 6 here
+                max_view_height_in_lines = 6;
+                // if you have the line above, you must have this. 
+                // It is calculable from LAF
+                base_line_delta = 21;
+                };
+            },
+        DLG_LINE
+            {
+            type = EAknCtPopupField;
+            prompt = qtn_nmp_episode_details_library;
+            id = EMPXMetadataEditorDlgCtrlIdLibrary;
+            itemflags = EEikDlgItemTakesEnterKey | EEikDlgItemOfferAllHotKeys;
+            control = POPUP_FIELD
+                {
+                width = KMPXSongDetailsTextMaxLen;
+                // other = qtn_aknexpopfield_list_other;
+                };
+            tooltip = qtn_aknexpopfield_hint_text;
+            }
+        };
+    } 
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_fd_title
+//    Text used for File Details title.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_fd_title
+    {
+    buf = qtn_mus_title_file_details_track;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_metadataeditor_file_details_row_format
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_metadataeditor_file_details_row_format
+    {
+    buf = "%0U\t%1U"; 
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_metadataeditor_bitrate_txt
+//    File Details Bitrate Text.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_metadataeditor_bitrate_txt
+    {
+    buf = qtn_mp_bitrate_kbps;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_metadataeditor_samplingrate_txt
+//    File details sampling rate text.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_metadataeditor_samplingrate_txt
+    {
+    buf = qtn_mp_sr_value;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_custom_genre_rename_text
+//    Prompt Text for rename genre.
+//
+// -----------------------------------------------------------------------------
+//    
+RESOURCE TBUF r_mpx_cui_custom_genre_rename_text
+    {
+    buf = qtn_nmp_prmpt_custom_genre;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_custom_category_rename_text
+//    Prompt Text for rename category.
+//
+// -----------------------------------------------------------------------------
+//    
+RESOURCE TBUF r_mpx_cui_custom_category_rename_text
+    {
+    buf = qtn_nmp_prmpt_custom_category;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_custom_genre_name_query_dlg
+//    Query dialog for custom genre name.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_cui_custom_genre_name_query_dlg
+    {
+    flags=EGeneralQueryFlags; 
+    buttons = R_AVKON_SOFTKEYS_OK_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control = AVKON_DATA_QUERY
+                {
+                layout = EDataLayout;
+                control = 
+                    EDWIN
+                        {
+                        flags = EEikEdwinNoWrap;
+                        width = KMPXSongDetailsTextMaxLen;
+                        lines = 1;
+                        maxlength = KMPXSongDetailsTextMaxLen;
+                        };
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_custom_genre_prompt_text
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_custom_genre_prompt_text
+    {
+    buf = qtn_nmp_genre_custom_selection;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_podcast_custom_genre_prompt_text
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_podcast_custom_genre_prompt_text
+    {
+    buf = qtn_nmp_genre_custom_podcst_selection;
+    }
+    
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_unknown_genre_text
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_unknown_genre_text
+    {
+    buf = qtn_nmp_genre_unknown;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_genre_selection_music_text
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_genre_selection_music_text
+    {
+    buf = qtn_nmp_genre_selection_music;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_genre_selection_podcast_text
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_genre_selection_podcast_text
+    {
+    buf = qtn_nmp_genre_selection_podcast;
+    }
+
+// -----------------------------------------------------------------------------
+//    
+//    r_mpx_cui_fd_headings_songs
+//    Headings for Songs File Details popup.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_mpx_cui_fd_headings_songs
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_mp_fd_filename;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_format;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_bitrate;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_samplerate;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_size;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_modified;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_copyright;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_url;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//    
+//    r_mpx_cui_fd_headings_podcasts
+//    Headings for Podcast File Details popup.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE ARRAY r_mpx_cui_fd_headings_podcasts
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_mp_fd_filename;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_format;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_bitrate;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_samplerate;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_size;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_last_playback_position;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_published;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_modified;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_copyright;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_url;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_move_to_library_confirmation_query
+//    Confirmation query dialog for move to a different library.
+//
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_cui_move_to_library_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_music_genre_strings
+//    default genre list for music library.
+//
+// -----------------------------------------------------------------------------
+// 
+RESOURCE ARRAY r_mpx_music_genre_strings
+    {
+    items =
+        {
+        LBUF {txt = qtn_nmp_genre_alternative;},
+        LBUF {txt = qtn_nmp_genre_blues;},
+        LBUF {txt = qtn_nmp_genre_classical;},
+        LBUF {txt = qtn_nmp_genre_country;},
+        LBUF {txt = qtn_nmp_genre_dance;},
+        LBUF {txt = qtn_nmp_genre_easylistening;},
+        LBUF {txt = qtn_nmp_genre_electronic;},
+        LBUF {txt = qtn_nmp_genre_folk;},
+        LBUF {txt = qtn_nmp_genre_hiphop;},
+        LBUF {txt = qtn_nmp_genre_jazz;},
+        LBUF {txt = qtn_nmp_genre_latin;},
+        LBUF {txt = qtn_nmp_genre_metal;},
+        LBUF {txt = qtn_nmp_genre_newage;},
+        LBUF {txt = qtn_nmp_genre_other;},
+        LBUF {txt = qtn_nmp_genre_pop;},
+        LBUF {txt = qtn_nmp_genre_rb;},
+        LBUF {txt = qtn_nmp_genre_rap;},
+        LBUF {txt = qtn_nmp_genre_reggae;},
+        LBUF {txt = qtn_nmp_genre_rock;},
+        LBUF {txt = qtn_nmp_genre_soundtrack;},
+        LBUF {txt = qtn_nmp_genre_spoken;},
+        LBUF {txt = qtn_nmp_genre_world;}
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_music_genre_strings_podcast
+//    default genre list for music library, contains podcasting as an item
+//
+// -----------------------------------------------------------------------------
+// 
+RESOURCE ARRAY r_mpx_music_genre_strings_podcast
+    {
+    items =
+        {
+        LBUF {txt = qtn_nmp_genre_alternative;},
+        LBUF {txt = qtn_nmp_genre_blues;},
+        LBUF {txt = qtn_nmp_genre_classical;},
+        LBUF {txt = qtn_nmp_genre_country;},
+        LBUF {txt = qtn_nmp_genre_dance;},
+        LBUF {txt = qtn_nmp_genre_easylistening;},
+        LBUF {txt = qtn_nmp_genre_electronic;},
+        LBUF {txt = qtn_nmp_genre_folk;},
+        LBUF {txt = qtn_nmp_genre_hiphop;},
+        LBUF {txt = qtn_nmp_genre_jazz;},
+        LBUF {txt = qtn_nmp_genre_latin;},
+        LBUF {txt = qtn_nmp_genre_metal;},
+        LBUF {txt = qtn_nmp_genre_newage;},
+        LBUF {txt = qtn_nmp_genre_other;},
+        LBUF {txt = qtn_nmp_genre_podcast;},
+        LBUF {txt = qtn_nmp_genre_pop;},
+        LBUF {txt = qtn_nmp_genre_rb;},
+        LBUF {txt = qtn_nmp_genre_rap;},
+        LBUF {txt = qtn_nmp_genre_reggae;},
+        LBUF {txt = qtn_nmp_genre_rock;},
+        LBUF {txt = qtn_nmp_genre_soundtrack;},
+        LBUF {txt = qtn_nmp_genre_spoken;},
+        LBUF {txt = qtn_nmp_genre_world;}
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_podcast_category_strings
+//    default category list for podcast.
+//
+// -----------------------------------------------------------------------------
+// 
+RESOURCE ARRAY r_mpx_podcast_category_strings
+    {
+    items =
+        {
+        LBUF {txt = qtn_nmp_category_arts;},
+        LBUF {txt = qtn_nmp_category_business;},
+        LBUF {txt = qtn_nmp_category_comedy;},
+        LBUF {txt = qtn_nmp_category_education;},
+        LBUF {txt = qtn_nmp_category_games_hobbies;},
+        LBUF {txt = qtn_nmp_category_government_organizations;},
+        LBUF {txt = qtn_nmp_category_health;},
+        LBUF {txt = qtn_nmp_category_kids_family;},
+        LBUF {txt = qtn_nmp_category_music;},
+        LBUF {txt = qtn_nmp_category_news_politics;},
+        LBUF {txt = qtn_nmp_category_religion_spirituality;},
+        LBUF {txt = qtn_nmp_category_science_medicine;},
+        LBUF {txt = qtn_nmp_category_society_culture;},
+        LBUF {txt = qtn_nmp_category_sports_recreation;},
+        LBUF {txt = qtn_nmp_category_technology;},
+        LBUF {txt = qtn_nmp_category_tv_film;}
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_qtn_nmp_genre_podcast
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_genre_podcast
+    {
+    buf = qtn_nmp_genre_podcast;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_cui_query_move_to_library
+//    confirmation text for move to a different library.
+//
+// -----------------------------------------------------------------------------
+//    
+RESOURCE TBUF r_mpx_cui_query_move_to_library
+    {
+    buf = qtn_nmp_query_move_to_library;
+    }    
+    
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_cui_metadataeditor_playback_complete
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_cui_metadataeditor_playback_complete
+    {
+    
+    buf = qtn_mp_details_playback_complete;
+    }
+        
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/eabi/mpxmetadataeditordialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+	_ZN24CMPXMetadataEditorDialog4NewLEv @ 1 NONAME
+	_ZN24CMPXMetadataEditorDialog9SetParamLEPK7TDesC16 @ 2 NONAME
+	_ZN24CMPXMetadataEditorDialogD0Ev @ 3 NONAME
+	_ZN24CMPXMetadataEditorDialogD1Ev @ 4 NONAME
+	_ZN24CMPXMetadataEditorDialogD2Ev @ 5 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxmetadataeditordialog.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxmetadataeditordialog.loc	APP_LAYER_LOC_EXPORT_PATH(mpxmetadataeditordialog.loc)
+
+PRJ_MMPFILES
+mpxmetadataeditordialog.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/group/mpxmetadataeditordialog.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxmetadataeditordialog.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxmetadataeditordialog.dll
+TARGETTYPE      dll
+UID             0x10009D8D 0x101FFC82
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+MACRO __ENABLE_MSK
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+SOURCEPATH      ../src
+SOURCE          mpxmetadataeditordialog.cpp
+
+START RESOURCE  ../data/mpxmetadataeditordialog.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         eikdlg.lib
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         eikctl.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         estor.lib
+LIBRARY         bafl.lib
+LIBRARY         commonengine.lib
+LIBRARY         apgrfx.lib 
+LIBRARY         apmime.lib 
+LIBRARY         tzclient.lib
+
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcollectionhelper.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         centralrepository.lib  
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/inc/mpxmetadataeditordialog.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxmetadataeditordialogplugin
+*
+*/
+
+
+
+#ifndef MPXMETADATAEDITORDIALOG_HLP_HRH
+#define MPXMETADATAEDITORDIALOG_HLP_HRH
+
+_LIT(KMUS_HLP_METADATA_EDITING, "MUS_HLP_METADATA_EDITING"); 
+
+#endif  // MPXMETADATAEDITORDIALOG_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/inc/mpxmetadataeditordialog.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxmetadataeditordialog
+*
+*/
+
+
+
+#ifndef MPXMETADATAEDITORDIALOG_HRH
+#define MPXMETADATAEDITORDIALOG_HRH
+
+#define KMPXSongDetailsTextWidth            20
+#define KMPXSongDetailsTextLines            20
+#define KMPXSongDetailsTextMaxLen           255
+
+#define KMPXSongDetailsTrackNumMin          0
+#define KMPXSongDetailsTrackNumMax          999
+#define KMPXSongDetailsYearMin              0
+#define KMPXSongDetailsYearMax              9999
+
+
+// ENUMS
+enum TMPXMetadataEditorDlgCommandIds
+    {
+    EMPXCmdSongDetailsChange = 0x5000,
+    EMPXCmdSongDetails
+    };    
+    
+enum TMPXMetadataEditorDlgCtrlIds
+    {
+    EMPXMetadataEditorDlgCtrlIdSongName = 0x6000,
+    EMPXMetadataEditorDlgCtrlIdArtist,
+    EMPXMetadataEditorDlgCtrlIdAlbum,
+    EMPXMetadataEditorDlgCtrlIdTrackNumber,
+    EMPXMetadataEditorDlgCtrlIdYear,
+    EMPXMetadataEditorDlgCtrlIdComposer,
+    EMPXMetadataEditorDlgCtrlIdComment,
+    EMPXMetadataEditorDlgCtrlIdLibrary,
+    EMPXMetadataEditorDlgCtrlIdGenre      // Genre has to be the last item in this enum (for popup field items)
+    };
+
+enum TMPXMetadataEditorDlgCurrentLibrary
+    {
+    EMPXMetadataEditorDlgCollection,
+    EMPXMetadataEditorDlgPodcast
+    };    
+
+#endif  // MPXMETADATAEDITORDIALOG_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/loc/mpxmetadataeditordialog.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,572 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxmetadataeditordialog
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Command in options menu.
+// d:Option for showing file details.
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_options_view_file_details "View file details"
+
+// d:File details popup label.
+// d:Label for file details popup.
+// l:list_double_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_fd_filename "File name"
+
+// d:Heading item text for the file details popup listbox.
+// d:Clip format.
+// l:list_double_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_details_format "Format"
+
+// d:Heading item text for the file details popup listbox.
+// d:Clip duration.
+// l:list_double_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_details_duration "Duration"
+
+// d:File details popup label.
+// d:Label for file details popup.
+// l:list_double_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_details_bitrate "Bitrate"
+
+// d:Heading item text for the file details popup listbox.
+// d:Clip samplerate.
+// l:list_double_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_details_samplerate "Sampling rate"
+
+// d:File details popup label.
+// d:Label for file details popup.
+// l:list_double_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_details_size "Size"
+
+// d:Heading item text for the file details popup listbox.
+// d:Clip last playback time.
+// l:list_double_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_details_last_playback_position "Last Playback Position"
+
+// d:Heading item text for the file details popup listbox.
+// d:Clip published time.
+// l:list_double_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_details_published "Published"
+
+// d:Heading item text for the file details popup listbox.
+// d:Clip modified time.
+// l:list_double_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_details_modified "Modified"
+
+// d:Heading item text for the file details popup listbox.
+// d:Clip copyright.
+// l:list_double_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_details_copyright "Copyright"
+
+// d:Heading item text for the file details popup listbox.
+// d:URL address for the track.
+// l:list_double_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mp_details_url "URL"
+
+// d:dialog title for enter genre dialog
+// l:popup_query_data_window
+// r:3.1
+//
+#define qtn_nmp_prmpt_custom_genre "Enter genre:"
+
+// d:dialog title for enter category dialog
+// l:popup_query_data_window
+// r:3.1
+//
+#define qtn_nmp_prmpt_custom_category "Enter category:"
+
+// d:Customize genre with free text in metadata editing
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_custom_selection "Custom..."
+
+// d:Customize genre with free text in podcast metadata editing
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_custom_podcst_selection "Custom..."
+
+// d:genre for podcast
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_podcast "Podcast"
+
+// Predefined genre list for music collection
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_alternative       "Alternative"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_blues             "Blues"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_classical         "Classical"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_country           "Country"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_dance             "Dance"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_easylistening     "Easy Listening"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_electronic        "Electronic"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_folk              "Folk"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_hiphop            "Hip-Hop"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_jazz              "Jazz"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_latin             "Latin"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_metal             "Metal"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_newage            "New Age"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_other             "Other"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_pop               "Pop"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_rb                "R&B"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_rap               "Rap"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_reggae            "Reggae"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_rock              "Rock"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_soundtrack        "Soundtrack"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_spoken            "Spoken"
+
+// d:predefined genre list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_world             "World"
+
+// d:"Unknown" Genre text
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_unknown           "Unknown"
+
+// Predefined category list for podcast
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_arts           "Arts"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_business           "Business"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_comedy             "Comedy"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_education          "Education"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_games_hobbies      "Games & Hobbies"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_government_organizations    "Government & Organizations"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_health             "Health"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_kids_family        "Kids & Family"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_music              "Music"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_news_politics      "News & Politics"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_religion_spirituality      "Religion & Spirituality"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_science_medicine   "Science & Medicine"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_society_culture    "Society & Culture"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_sports_recreation  "Sports & Recreation"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_technology         "Technology"
+
+// d:predefined podcast category list
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_category_tv_film            "TV & Film"
+
+// d:Music library
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_selection_music "Music"
+
+// d:Podcast library
+// l:list_form_graphic_pane_t1
+// r:3.1
+//
+#define qtn_nmp_genre_selection_podcast "Podcast"
+
+// d:Text in title pane
+// d:Form title
+// l:title_pane_t1
+// r:3.1
+//
+#define qtn_mus_title_details_track "Song details"
+
+// d:Text in title pane
+// d:Form title
+// l:title_pane_t1
+// r:3.1
+//
+#define qtn_mus_title_details_episode "Episode details"
+
+// d:Metadata editing prompt text.
+// d:Song name prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_song_details_name "Song name"
+
+// d:Metadata editing prompt text.
+// d:episode name prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_episode_details_name "Episode name"
+
+// d:Metadata editing prompt text.
+// d:Artist prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_song_details_artist "Artist"
+
+// d:Metadata editing prompt text.
+// d:Author prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_episode_details_author "Author"
+
+// d:Metadata editing prompt text.
+// d:Album prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_song_details_album "Album"
+
+// d:Metadata editing prompt text.
+// d:Podcast title prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_episode_details_title "Podcast title"
+
+// d:Metadata editing prompt text.
+// d:Track number prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_song_details_track_number "Track number"
+
+// d:Metadata editing prompt text.
+// d:Episode number prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_song_details_episode_number "Episode number"
+
+// d:Metadata editing prompt text.
+// d:Year prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_song_details_year "Year"
+
+// d:Metadata editing prompt text.
+// d:Genre prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_song_details_genre "Genre"
+
+// d:Metadata editing prompt text.
+// d:Category prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_episode_details_genre "Category"
+
+// d:Metadata editing prompt text.
+// d:Composer prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_song_details_composer "Composer"
+
+// d:Metadata editing prompt text.
+// d:Comment prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_song_details_comment "Comment"
+
+// d:Metadata editing prompt text.
+// d:library prompt.
+// l:form_field_data_wide_pane_t1
+// r:3.1
+//
+#define qtn_nmp_episode_details_library "Library"
+
+// d:File details popup.
+// d:Title for file details popup.
+// l:heading_pane_t1
+// r:3.1
+//
+#define qtn_mus_title_file_details_track "File details:"
+
+// d:Clip bitrate
+// d:%N is the bitrate of the video clip
+// l:list_double_pane_t2_cp2
+// r:3.1
+//
+#define qtn_mp_bitrate_kbps "%N kbps"
+
+// d:Format in which the sampling rate value is shown.
+// d:%U is the sampling rate in hertz (1-6 numbers, for example: 44100)
+// l:list_double_pane_t2_cp2
+// r:3.1
+//
+#define qtn_mp_sr_value "%U Hz"
+
+// d:Confirmation query for move to a different library.
+// d:%U is the name of the library
+// l:popup_note_window
+// r:3.1
+//
+#define qtn_nmp_query_move_to_library "Item will be moved to %U library. Some details may be lost. Continue?" 
+
+// d:Text shown in File Details as value for last playback time
+// d:
+// d:This text will be used when the episode has playcount >= 1
+//   last saved playback position is == 0
+// l:list_double_pane_t2_cp2
+// r:3.1
+//
+#define qtn_mp_details_playback_complete "Playback complete" 
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/metadataeditordialog/src/mpxmetadataeditordialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2821 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player metadata editor dialog implementation
+*
+*/
+
+
+// INCLUDE FILES
+#include <eikmenub.h>
+#include <eikcapc.h>
+#include <eikdialg.h> // for dialog functions
+#include <eikedwin.h> // for edwins
+#include <eikmfne.h>  // for number editor
+#include <AknPopupFieldText.h>
+#include <AknQueryValueText.h>
+#include <aknappui.h>
+#include <eikspane.h> // for status pane update/restore
+#include <akntitle.h> // for title pane
+#include <aknnavilabel.h> // for navi label
+#include <aknnavi.h>
+#include <aknnavide.h>
+#include <StringLoader.h>
+#include <aknnotewrappers.h>
+#include <aknlists.h>
+#include <aknclearer.h>
+#include <hlplch.h>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+#include <drmrightsmanager.rsg>
+#include <centralrepository.h> // for podcasting cenrep key
+#include <tz.h>
+
+#include <aknSDData.h>
+#include <AknMediatorFacade.h>
+#include <mplayersecondarydisplayapi.h>
+#include <aknEditStateIndicator.h>
+#include <AknIndicatorContainer.h>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <mpxmetadataeditordialog.rsg>
+#include <mpxcollectionutility.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediaaudiodefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxpodcastdefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxconstants.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionplugin.hrh>
+#include <mpxinternalcrkeys.h>
+#include <mpxuser.h>
+#include "mpxcommonuihelper.h"
+#include "mpxmetadataeditordialog.h"
+#include "mpxmetadataeditordialog.hrh"
+#include "mpxmetadataeditordialog.hlp.hrh"
+#include "mpxlog.h"
+
+// CONSTANTS
+const TInt KMPXFileDetailsMaxTitleLen = 32;
+const TInt KMPXFileDetailsMaxBufferLen = 255;
+const TInt KMPXMinNumDateTrack = 0;
+const TInt KMPXFileDetailsExtraBufferLen = 10;
+
+const TInt KMPXMaxTimeLength = 36;
+const TInt KMPXMaxVal = 512;
+const TInt KMPXOneDigit = 10;
+const TInt KMPXTwoDigits = 100;
+
+const TInt KMPXBitrateFactor = 1000;
+const TInt KSecondInMilliseconds = 1000;
+const TInt KOneHourInSeconds = 3600;
+
+
+
+const TInt KDigitFive = 5;
+const TInt KDigitNine = 9;
+const TInt KDigitTen = 10;
+const TInt KDigitEleven = 11;
+const TInt KDigitFourTeen = 14;
+const TInt KDigitHundred = 100;
+
+const TInt KMaxDaysInOneMonths = 31;
+const TInt KMaxDaysInTwoMonths = 62;
+const TInt KMaxDaysInThreeMonths = 92;
+const TInt KMaxDaysInFourMonths = 123;
+const TInt KMaxDaysInFiveMonths = 153;
+const TInt KMaxDaysInSixMonths = 184;
+const TInt KMaxDaysInSevenMonths= 215;
+const TInt KMaxDaysInEightMonths = 245;
+const TInt KMaxDaysInNineMonths = 276;
+const TInt KMaxDaysInTenMonths = 306;
+const TInt KMaxDaysInElevenMonths = 337;
+const TInt KMaxDaysInTwelveMonths = 366;
+
+// MACROS
+_LIT( KMPXMetadataEditorRscPath, "mpxmetadataeditordialog.rsc" );
+_LIT( KMPXDrmManagerRscPath, "drmrightsmanager.rsc" );
+_LIT( KMPXSpace, " ");
+
+const TInt KMPXDurationDisplayResvLen( 10 );
+const TInt64 KSecondInMicroSeconds( 1000000 );
+
+// FUNCTION PROTOTYPES
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ----------------------------------------------------------------------------
+// CMPXQueryDialog::NewL
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMPXQueryDialog* CMPXQueryDialog::NewL()
+    {
+    CMPXQueryDialog* self = new (ELeave) CMPXQueryDialog();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXQueryDialog::OfferKeyEventL
+// Keyevent handler.
+// ----------------------------------------------------------------------------
+//
+TKeyResponse CMPXQueryDialog::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType)
+    {
+    // exit from query dialog whever lost forground, currently implementing by mornitor
+    // application key and end key
+    if (( aKeyEvent.iScanCode == EStdKeyNo ||
+        aKeyEvent.iScanCode == EStdKeyApplication0  &&
+        aType == EEventKey ) ||
+        ( aKeyEvent.iScanCode == EStdKeyApplication6  &&
+        aType == EEventKeyDown ))
+        {
+        TryExitL(EEikBidCancel);
+        return EKeyWasNotConsumed;
+        }
+    else
+        {
+        return CAknQueryDialog::OfferKeyEventL( aKeyEvent,aType );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::NewL
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CMPXMetadataEditorDialog* CMPXMetadataEditorDialog::NewL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::NewL" );
+    CMPXMetadataEditorDialog* self =
+          new (ELeave) CMPXMetadataEditorDialog();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::~CMPXMetadataEditorDialog
+// Destructor.
+// ----------------------------------------------------------------------------
+//
+EXPORT_C CMPXMetadataEditorDialog::~CMPXMetadataEditorDialog()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::~CMPXMetadataEditorDialog" );
+    delete iEmptyNaviDecorator;
+    delete iTitlePaneText;
+    delete iCommonUiHelper;
+    delete iParam;
+    delete iIdle;
+    delete iDrmInfo;
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+    if ( iCollectionUiHelper )
+        {
+        iCollectionUiHelper->Close();
+        }
+    if ( iMedia )
+        {
+        delete iMedia;
+        }
+    if ( iTextValues )
+        {
+        delete iTextValues;
+        }
+    if ( iValueTextArray )
+        {
+        delete iValueTextArray;
+        }
+    if ( iGenreArr )
+        {
+        delete iGenreArr;
+        }
+    if ( iLibraryTextValues )
+        {
+        delete iLibraryTextValues;
+        }
+    if ( iLibraryValueTextArray )
+        {
+        delete iLibraryValueTextArray;
+        }
+    if ( iLibraryArr )
+        {
+        delete iLibraryArr;
+        }
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+    if ( iDrmResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iDrmResourceOffset );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::SetParamL
+// parameter passed in from viewframework
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXMetadataEditorDialog::SetParamL( const TDesC* aParam )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::SetParamL" );
+    delete iParam;
+    iParam = NULL;
+    iParam = aParam->AllocL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::OkToExitL
+// This function ALWAYS returns ETrue
+// -----------------------------------------------------------------------------
+//
+TBool CMPXMetadataEditorDialog::OkToExitL(TInt aButtonId)
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::OkToExitL" );
+    TBool res = EFalse;
+
+    switch ( aButtonId )
+        {
+        case EAknSoftkeyDone:
+            {
+            SaveFormDataL();
+            RestoreNaviLabelL();
+            RestoreTitlePaneL();
+            res = ETrue;
+            break;
+            }
+        case EAknSoftkeyExit:
+            {
+            RestoreNaviLabelL();
+            RestoreTitlePaneL();
+            res = ETrue;
+            break;
+            }
+        case EAknSoftkeyOptions:
+        default:
+            {
+            // display the options menu
+            res = CAknForm::OkToExitL( aButtonId );
+            break;
+            }
+        }
+    return res;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::ExecuteLD
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMetadataEditorDialog::ExecuteLD( TInt /*aResourceId*/ )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::ExecuteLD" );
+    TInt resId = R_MPX_CUI_SONG_DETAILS_DIALOG;
+    if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast )
+        {
+        resId = R_MPX_CUI_PODCAST_DETAILS_DIALOG;
+        }
+    else if( iDisablePodcasting )
+        {
+        resId = R_MPX_CUI_SONG_DETAILS_DIALOG_NO_MOVE_LIBRARY;
+        }
+    return CAknForm::ExecuteLD( resId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::ViewFileDetailsPopupL
+// Display file details popup window
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::ViewFileDetailsPopupL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::ViewFileDetailsPopupL" );
+    CAknDoublePopupMenuStyleListBox* listBox =
+        new (ELeave) CAknDoublePopupMenuStyleListBox();
+    CleanupStack::PushL( listBox );
+    CAknPopupList* popupList = CAknPopupList::NewL(
+                                listBox,
+                                R_AVKON_SOFTKEYS_OK_EMPTY,
+                                AknPopupLayouts::EMenuDoubleWindow );
+    CleanupStack::PushL( popupList );
+
+    listBox->ConstructL( popupList, CEikListBox::ELeftDownInViewRect );
+    listBox->CreateScrollBarFrameL( ETrue );
+    listBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+        CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
+
+    // Enable Marquee
+    static_cast<CEikFormattedCellListBox*>
+        ( listBox )->ItemDrawer()->ColumnData()->EnableMarqueeL( ETrue );
+
+    // Retrieve heading array
+    CDesCArrayFlat* headingsArray = NULL;
+    TInt itemCount = 0;
+    if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection )
+        {
+        headingsArray = iCoeEnv->ReadDesCArrayResourceL(
+            R_MPX_CUI_FD_HEADINGS_SONGS );
+        itemCount = EMPXSongsFileDetailsHeadingCount;
+        }
+    else if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast )
+        {
+        headingsArray = iCoeEnv->ReadDesCArrayResourceL(
+            R_MPX_CUI_FD_HEADINGS_PODCASTS );
+        itemCount = EMPXPodcastsFileDetailsHeadingCount;
+        }
+    else
+        {
+        User::Leave( KErrArgument );
+        }
+    CleanupStack::PushL( headingsArray );
+
+    CAknLocalScreenClearer* clearer = CAknLocalScreenClearer::NewLC( EFalse );
+    CDesCArray* itemArray =
+        static_cast<CDesCArray*>( listBox->Model()->ItemTextArray() );
+    CDesCArrayFlat* dataArray =
+        new ( ELeave ) CDesCArrayFlat( itemCount );
+    CleanupStack::PushL( dataArray );
+
+    if ( iMedia )
+        {
+        PopulateFileDetailsL( headingsArray, dataArray );
+        // item count might have been updated due to addition of
+        // DRM content details
+        itemCount = headingsArray->MdcaCount();
+        }
+    else
+        {
+        // properties not available
+        for ( TInt i = 0; i < itemCount; i++ )
+            {
+            dataArray->AppendL( KNullDesC );
+            }
+        }
+
+    for ( TInt i = 0; i < itemCount; i++ )
+        {
+        AddItemToListBoxL( headingsArray->MdcaPoint( i ), dataArray->MdcaPoint( i ), itemArray );
+        }
+    CleanupStack::PopAndDestroy( dataArray );
+    CleanupStack::PopAndDestroy( clearer );
+    CleanupStack::PopAndDestroy( headingsArray );
+
+    // Set title
+    TBuf<KMPXFileDetailsMaxTitleLen> title;
+    iCoeEnv->ReadResourceL( title, R_MPX_CUI_FD_TITLE );
+    popupList->SetTitleL( title );
+
+    // Show popup list
+    popupList->ExecuteLD();
+    CleanupStack::Pop();
+    CleanupStack::PopAndDestroy( listBox );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection message.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::HandleCollectionMessage(
+    CMPXMessage* /*aMessage*/, TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d a folder
+// ---------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::HandleOpenL(
+    const CMPXMedia& /*aEntries*/,
+    TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the item being opened. Typically called
+// when client has Open()'d an item. Client typically responds by
+// 'playing' the item via the playlist
+// ---------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::HandleOpenL(
+    const CMPXCollectionPlaylist& /*aPlaylist*/, TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aMedia.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::HandleCollectionMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::HandleCollectionMediaL" );
+    TRAP_IGNORE( DoHandleMediaL( aMedia, aError ) );
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::CMPXMetadataEditorDialog
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ----------------------------------------------------------------------------
+//
+CMPXMetadataEditorDialog::CMPXMetadataEditorDialog()
+    {
+    // do nothing
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::ConstructL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::ConstructL" );
+
+    CCoeEnv* coeEnv = iEikonEnv;
+    TParse parse;
+    parse.Set( KMPXMetadataEditorRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    parse.Set( KMPXDrmManagerRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName drmResourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( drmResourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), drmResourceFile );
+    TRAPD(drmResourceError,iDrmResourceOffset = coeEnv->AddResourceFileL( drmResourceFile ));
+    iDrmDetails = (drmResourceError == KErrNone) ? ETrue: EFalse;
+
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
+    iCommonUiHelper = CMPXCommonUiHelper::NewL();
+
+    CAknForm::ConstructL( R_MPX_CUI_SONG_DETAILS_MENUBAR );
+
+    iCurrentLibrary = EMPXMetadataEditorDlgCollection;
+    // check if it's podcast collection
+    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL( cpath );
+    if ( cpath->Levels() > 0 )
+        {
+        RArray<TUid> ary;
+        CleanupClosePushL( ary );
+        ary.AppendL( TUid::Uid(EMPXCollectionPluginPodCast) );
+        TUid podcastUid = iCollectionUtility->CollectionIDL( ary.Array() );
+        CleanupStack::PopAndDestroy( &ary );
+
+        if ( cpath->Id( 0 ) == podcastUid.iUid )
+            {
+            MPX_DEBUG1( "CMPXMetadataEditorDialog::ConstructL Podcast collection" );
+            iCurrentLibrary = EMPXMetadataEditorDlgPodcast;
+            }
+        }
+    iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+    CleanupStack::PopAndDestroy( cpath );
+
+    // Get podcasting key
+    TInt val(0);
+    CRepository* repository = CRepository::NewL( KCRUidMPXMPFeatures );
+    repository->Get( KMPXMPLocalVariation, val );
+    iDisablePodcasting = val&KMPXDisablePodcastingOption ? ETrue : EFalse;
+    delete repository;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::CleanUpGenreText
+// Clean up function for genre related members.
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::CleanUpGenreText()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::CleanUpGenreText" );
+
+    if ( iGenreArr )
+        {
+        delete iGenreArr;
+        iGenreArr = NULL;
+        }
+    if ( iValueTextArray )
+        {
+        delete iValueTextArray;
+        iValueTextArray = NULL;
+        }
+    if ( iTextValues )
+        {
+        delete iTextValues;
+        iTextValues = NULL;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::FetchGenreL
+// Populates genre popup with genre list for tracks.
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::FetchGenreL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::FetchGenreL" );
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL( attrs );
+    attrs.Append( KMPXMediaGeneralTitle );
+    CMPXMedia* criteria = CMPXMedia::NewL();
+    CleanupStack::PushL( criteria );
+    criteria->SetTObjectValueL<TUid>(
+        KMPXMediaGeneralCollectionId, TUid::Uid( 0x101FFC3A ) );
+    criteria->SetTObjectValueL<TMPXGeneralType>(
+        KMPXMediaGeneralType, EMPXGroup );
+    criteria->SetTObjectValueL<TMPXGeneralCategory>(
+        KMPXMediaGeneralCategory, EMPXGenre );
+    iCollectionUtility->Collection().FindAllL( *criteria, attrs.Array(), *this );
+    CleanupStack::PopAndDestroy( criteria );
+    CleanupStack::PopAndDestroy( &attrs );
+    }
+
+// ---------------------------------------------------------------------------
+// Handle media properties.
+// ---------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::DoHandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::DoHandleMediaL" );
+
+    if ( iCurrentMediaLOp == EMPXMetadataEditorGetSongInfo )
+        {
+        delete iMedia;
+        iMedia = NULL;
+        if ( aError == KErrNone )
+            {
+            iMedia = CMPXMedia::NewL( aMedia );
+            // common for both music and podcast
+            // Fetch the artist
+
+            if ( iMedia->IsSupported( KMPXMediaDrmProtected ) )
+                {
+                iIsDrmProtected = iMedia->ValueTObjectL<TBool>( KMPXMediaDrmProtected );
+                }
+
+            SetControlTextL( EMPXMetadataEditorDlgCtrlIdArtist,
+                iMedia->ValueText( KMPXMediaMusicArtist ), KNullDesC );
+
+            // Fetch the album
+            SetControlTextL( EMPXMetadataEditorDlgCtrlIdAlbum,
+                iMedia->ValueText( KMPXMediaMusicAlbum ), KNullDesC );
+
+            // Fetch the track number
+            SetControlNumberL( EMPXMetadataEditorDlgCtrlIdTrackNumber,
+                iMedia->ValueText( KMPXMediaMusicAlbumTrack ),
+                KMPXSongDetailsTrackNumMin, KMPXSongDetailsTrackNumMax );
+
+            // Fetch the year
+            TInt64 year(0);
+            if ( iMedia->IsSupported (KMPXMediaMusicYear ) )
+                {
+                year = iMedia->ValueTObjectL<TInt64>( KMPXMediaMusicYear );
+                }
+            TTime yearTime( year);
+            iYear = yearTime.DateTime().Year ( );
+            HBufC* yearBuf = HBufC::NewLC ( KMPXMaxTimeLength );
+            yearBuf->Des().AppendNum ( iYear );
+            SetControlNumberL ( EMPXMetadataEditorDlgCtrlIdYear, *yearBuf,
+                    KMPXSongDetailsYearMin, KMPXSongDetailsYearMax );
+            CleanupStack::PopAndDestroy ( yearBuf );
+
+            // Fetch genre
+            FetchGenreL();
+
+            // Fetch the comment
+            SetControlTextL( EMPXMetadataEditorDlgCtrlIdComment,
+                iMedia->ValueText( KMPXMediaGeneralComment ), KNullDesC );
+
+            // Fetch the song name
+            TParsePtrC fileDetail( iMedia->ValueText( KMPXMediaGeneralUri ) );
+            SetControlTextL( EMPXMetadataEditorDlgCtrlIdSongName,
+                iMedia->ValueText( KMPXMediaGeneralTitle ), fileDetail.Name() );
+
+            if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection )
+                {
+                // Fetch the composer
+                SetControlTextL( EMPXMetadataEditorDlgCtrlIdComposer,
+                    iMedia->ValueText( KMPXMediaMusicComposer ), KNullDesC );
+                }
+            DrawNow();
+            }
+        else
+            {
+            // if error getting metadata, exit editor
+            iCommonUiHelper->HandleErrorL( aError );
+            if ( iIdle )
+                {
+                iIdle->Cancel();
+                delete iIdle;
+                iIdle = NULL;
+                }
+            iIdle = CIdle::NewL( CActive::EPriorityStandard );
+            iIdle->Start( TCallBack( CMPXMetadataEditorDialog::DeferredExitCallback, this ) );
+            }
+        }
+    else if ( iCurrentMediaLOp == EMPXMetadataEditorGetDrmInfo )
+        {
+        delete iDrmInfo;
+        iDrmInfo = NULL;
+        if ( aError == KErrNone )
+            {
+            iDrmInfo = CMPXMedia::NewL( aMedia );
+            }
+        else
+            {
+            iDrmInfo = CMPXMedia::NewL();
+            }
+        if ( iIdle )
+            {
+            iIdle->Cancel();
+            delete iIdle;
+            iIdle = NULL;
+            }
+        iIdle = CIdle::NewL( CActive::EPriorityStandard );
+        iIdle->Start( TCallBack( CMPXMetadataEditorDialog::DeferredFileDetailsCallback, this ) );
+        }
+    else
+        {
+        // Should not reach here
+        ASSERT( 0 );
+        }
+    iCurrentMediaLOp = EMPXMetadataEditorIdle;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::SaveFormDataL
+// Save form data.
+// ----------------------------------------------------------------------------
+//
+TBool CMPXMetadataEditorDialog::SaveFormDataL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::SaveFormDataL" );
+    if ( iMedia )
+        {
+        MPX_DEBUG1( "CMPXMetadataEditorDialog::SaveFormDataL Saving.." );
+        CMPXMedia* media = CMPXMedia::NewL();
+        CleanupStack::PushL( media );
+
+        TBool changed = EFalse;
+
+        // common to both music and podcast
+        // update local copy of media as well because getting media prop is slow
+        changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdSongName,
+            media, KMPXMediaGeneralTitle );
+
+        changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdArtist,
+            media, KMPXMediaMusicArtist ) || changed;
+
+        changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdAlbum,
+            media, KMPXMediaMusicAlbum ) || changed;
+
+        changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdTrackNumber,
+            media, KMPXMediaMusicAlbumTrack ) || changed;
+
+        changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdComment,
+            media, KMPXMediaGeneralComment ) || changed;
+
+        // special handling needed for year
+        CCoeControl* coeControl = ControlOrNull( EMPXMetadataEditorDlgCtrlIdYear );
+        if ( coeControl )
+            {
+            CEikNumberEditor* control = static_cast<CEikNumberEditor*>( coeControl );
+            if ( control )
+                {
+                TInt num = control->Number();
+                if ( num != iYear )
+                    {
+                    MPX_DEBUG3( "CMPXMetadataEditorDialog::SaveFormDataL year changed from %d to %d", iYear, num );
+                    TDateTime newYear;
+                    newYear.Set( num, EJanuary, 0, 0, 0, 0, 0 );
+                    TTime year( newYear );
+                    iMedia->SetTObjectValueL<TInt64>(
+                        KMPXMediaMusicYear, year.Int64() );
+                    media->SetTObjectValueL<TInt64>(
+                        KMPXMediaMusicYear, year.Int64() );
+                    iYear = num;
+                    changed = ETrue;
+                    }
+                else
+                    {
+                    MPX_DEBUG1( "CMPXMetadataEditorDialog::SaveFormDataL year not changed" );
+                    }
+                }
+            }
+
+        if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection )
+            {
+            changed = UpdateMediaObjectWithControlL( EMPXMetadataEditorDlgCtrlIdComposer,
+                media, KMPXMediaMusicComposer ) || changed;
+            }
+        else if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast )
+            {
+            // no special handling, all covered in common
+            }
+        if ( changed )
+            {
+            // save it back to collection engine
+            SaveMediaPropertiesL( media );
+            MPX_DEBUG1( "CMPXMetadataEditorDialog::SaveFormDataL Saved" );
+            }
+#ifdef _DEBUG
+        else
+            {
+            MPX_DEBUG1( "CMPXMetadataEditorDialog::SaveFormDataL All equal, not saved" );
+            }
+#endif
+        CleanupStack::PopAndDestroy( media );
+        }
+    return ETrue;
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::DoNotSaveFormDataL
+// Does not save form data.
+// ----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::DoNotSaveFormDataL()
+    {
+    // Do nothing
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::SetTitlePane
+// Set Title Pane from descriptor.
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::SetTitlePaneL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::SetTitlePaneL" );
+    // Saving the current title before it's overwritten
+    CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
+
+    iTitlePane =
+        static_cast<CAknTitlePane*>
+            ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+    const TDesC* text = iTitlePane->Text();
+    iTitlePaneText = text->AllocL();
+
+    HBufC* newText = NULL;
+    if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection )
+        {
+        newText = StringLoader::LoadLC( R_MPX_CUI_SONG_DETAILS_TITLE );
+        }
+    else if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast )
+        {
+        newText = StringLoader::LoadLC( R_MPX_CUI_SONG_DETAILS_EPISODE );
+        }
+
+    // Update Title Pane
+    if ( newText )
+        {
+        iTitlePane->SetTextL( *newText );
+        }
+    CleanupStack::PopAndDestroy( newText );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::RestoreTitlePane
+// Restore Title Pane from the member data.
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::RestoreTitlePaneL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::RestoreTitlePaneL" );
+    // Update Title Pane
+    iTitlePane->SetTextL( *iTitlePaneText );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::SetNaviLabelL
+// Set Navi Label from descriptor.
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::SetNaviLabelL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::SetNaviLabelL" );
+    MAknEditingStateIndicator *editingStateIndicator = CAknEnv::Static()->EditingStateIndicator();
+    CAknIndicatorContainer* indicContainerEditing = editingStateIndicator->IndicatorContainer();
+    indicContainerEditing->SetIndicatorValueL( TUid::Uid( EAknNaviPaneEditorIndicatorMessageInfo), KNullDesC );
+    // Saving the current title before it's overwritten
+    CEikStatusPane* statusPane = iAvkonAppUi->StatusPane();
+
+    iNaviPane = static_cast<CAknNavigationControlContainer*>
+        ( statusPane->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
+
+    // store the latest navi pane
+    iNaviDecorator = iNaviPane->Top();
+
+    // set the new navi label
+    iEmptyNaviDecorator =
+        iNaviPane->CreateNavigationLabelL(KNullDesC);
+
+    iNaviPane->PushL( *iEmptyNaviDecorator );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::RestoreNaviLabelL
+// Restore Navi Label from the member data.
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::RestoreNaviLabelL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::RestoreNaviLabelL" );
+    iNaviPane->Pop( iEmptyNaviDecorator ); // pop out the empty navi
+    if ( iNaviDecorator )
+        {
+        iNaviPane->PushL( *iNaviDecorator );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::DynInitMenuPaneL
+// Dynamically initialises a menu pane.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane)
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::DynInitMenuPaneL" );
+    CAknForm::DynInitMenuPaneL(aResourceId, aMenuPane);
+
+    if ( aResourceId == R_AVKON_FORM_MENUPANE )
+        {
+        if ( ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdGenre ) ||
+            ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdLibrary ) )
+            {
+            aMenuPane->SetItemDimmed( EMPXCmdSongDetailsChange, EFalse );
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EMPXCmdSongDetailsChange, ETrue );
+            }
+        // Dim out the Avkon menu items
+        aMenuPane->SetItemDimmed( EAknFormCmdEdit, ETrue );
+        aMenuPane->SetItemDimmed( EAknFormCmdAdd, ETrue );
+        aMenuPane->SetItemDimmed( EAknFormCmdSave, ETrue );
+        aMenuPane->SetItemDimmed( EAknFormCmdLabel, ETrue );
+        aMenuPane->SetItemDimmed( EAknFormCmdDelete, ETrue );
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::ProcessCommandL
+// Act on the menu selection if menu is showing.
+// ----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::ProcessCommandL( TInt aCommandId )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::ProcessCommandL" );
+    CAknForm::ProcessCommandL(aCommandId);
+
+    switch (aCommandId)
+        {
+        case EMPXCmdSongDetailsChange:
+            {
+            if ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdGenre )
+                {
+                iPopup = static_cast<CAknPopupField*>
+                    ( ControlOrNull( EMPXMetadataEditorDlgCtrlIdGenre ) );
+                }
+            else if ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdLibrary )
+                {
+                iPopup = static_cast<CAknPopupField*>
+                    ( ControlOrNull( EMPXMetadataEditorDlgCtrlIdLibrary ) );
+                }
+            if ( iPopup )
+                {
+                iPopup->ActivateSelectionListL();
+                }
+
+            break;
+            }
+        case EMPXCmdSongDetails:
+            {
+            if ( iIsDrmProtected && !iDrmInfo )
+                {
+                CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+                CleanupStack::PushL( cpath );
+                if ( iParam )
+                    {
+                    TLex yearLex( iParam->Des() );
+                    TInt lexToInt = NULL;
+                    if ( yearLex.Val( lexToInt ) == KErrNone )
+                        {
+                        cpath->Set( lexToInt );
+                        RArray<TMPXAttribute> attrs;
+                        CleanupClosePushL(attrs);
+                        attrs.Append( KMPXMediaGeneralUri );
+                        attrs.Append( KMPXMediaDrmAll );
+                        iCurrentMediaLOp = EMPXMetadataEditorGetDrmInfo;
+                        iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+                        CleanupStack::PopAndDestroy( &attrs );
+                        }
+                    }
+                CleanupStack::PopAndDestroy( cpath );
+                }
+            else
+                {
+                if( iMedia )
+                    {
+                    ViewFileDetailsPopupL();
+                    }
+                }
+            break;
+            }
+        case EAknCmdHelp:
+            {
+            TCoeHelpContext helpContext;
+            GetHelpContext( helpContext );
+
+            CArrayFixFlat<TCoeHelpContext>* array =
+                new(ELeave)CArrayFixFlat<TCoeHelpContext>( 1 );
+
+            CleanupStack::PushL( array );
+            array->AppendL( helpContext );
+            CleanupStack::Pop(); // array
+
+            // HlpLauncher deletes array
+            HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), array );
+            break;
+            }
+        case EAknCmdExit:
+            {
+            static_cast<MEikCommandObserver*>(iEikonEnv->EikAppUi())->
+                ProcessCommandL(aCommandId);
+            }
+        default :
+            break;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::PopulateFileDetailsL
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::PopulateFileDetailsL(
+    CDesCArrayFlat* aHeadingsArray, CDesCArrayFlat* aDataArray )
+    {
+
+    MPX_FUNC( "CMPXMetadataEditorDialog::PopulateFileDetailsL" );
+
+    TBool drmProtected( iMedia->ValueTObjectL<TBool>( KMPXMediaDrmProtected ) );
+    MPX_DEBUG2( "CMPXMetadataEditorDialog::PopulateFileDetailsL drm protected: %d", drmProtected );
+
+    if ( drmProtected )
+        {
+        MakeDrmItemsL( aHeadingsArray, aDataArray );
+        }
+
+    // Get filename
+    const TDesC& uri = iMedia->ValueText( KMPXMediaGeneralUri );
+    TParsePtrC parse(uri);
+
+    AppendStringToArrayL( aDataArray, parse.Name() );
+
+    // Get mime type
+    const TDesC& mimeType = iMedia->ValueText( KMPXMediaGeneralMimeType );
+    AppendStringToArrayL( aDataArray, mimeType );
+
+    // Get duration
+    TInt duration( iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration ) );
+    if ( duration > 0 )
+        {
+        // convert milliseconds to seconds
+        duration = duration / KSecondInMilliseconds;
+        CMPXCommonUiHelper::TMPXDuratDisplayMode durationMode =
+            CMPXCommonUiHelper::EMPXDuratAuto;
+        if ( duration > KOneHourInSeconds )
+            {
+            durationMode = CMPXCommonUiHelper::EMPXDuratHMS;
+            }
+        HBufC* stringBuf = iCommonUiHelper->DisplayableDurationL(
+            duration, durationMode );
+        CleanupStack::PushL( stringBuf );
+        aDataArray->AppendL( *stringBuf );
+        CleanupStack::PopAndDestroy( stringBuf );
+        }
+    else
+        {
+        aDataArray->AppendL( KNullDesC );
+        }
+
+    // Get bitrate
+    TInt bitrate( iMedia->ValueTObjectL<TInt>( KMPXMediaAudioBitrate ) );
+    if ( bitrate > 0 )
+        {
+        // convert bitrate to kpbs
+        bitrate = bitrate / KMPXBitrateFactor;
+        HBufC* bitrateText = StringLoader::LoadLC(
+                        R_MPX_CUI_METADATAEDITOR_BITRATE_TXT, bitrate );
+        aDataArray->AppendL( bitrateText->Des() );
+        CleanupStack::PopAndDestroy( bitrateText );
+        }
+    else
+        {
+        aDataArray->AppendL( KNullDesC );
+        }
+
+    // Get sampling rate
+    TInt samplingRateNum( ( TInt )iMedia->ValueTObjectL<TInt>( KMPXMediaAudioSamplerate ) );
+    if ( samplingRateNum > 0 )
+        {
+        HBufC* stringBuf = HBufC::NewLC( KMPXFileDetailsMaxBufferLen );
+        TPtr stringBufPtr = stringBuf->Des();
+        stringBufPtr.AppendNum( samplingRateNum );
+        HBufC* samplingrate = StringLoader::LoadLC(
+                        R_MPX_CUI_METADATAEDITOR_SAMPLINGRATE_TXT, stringBufPtr );
+        aDataArray->AppendL( samplingrate->Des() );
+        CleanupStack::PopAndDestroy( samplingrate );
+        CleanupStack::PopAndDestroy( stringBuf );
+        }
+    else
+        {
+        aDataArray->AppendL( KNullDesC );
+        }
+
+    // Get size, not stored in collection, have to use RFile
+    //
+    RFs& fs = CEikonEnv::Static()->FsSession();
+    RFile file;
+    TInt sizeNum(0);
+    TInt err ( file.Open( fs, uri, EFileRead | EFileShareReadersOrWriters ) );
+    if ( err == KErrNone )
+        {
+        file.Size(sizeNum);
+        file.Close();
+        }
+
+    if ( sizeNum > 0 )
+        {
+        HBufC* stringBuf = iCommonUiHelper->UnitConversionL( sizeNum );
+        CleanupStack::PushL( stringBuf );
+        aDataArray->AppendL( *stringBuf );
+        CleanupStack::PopAndDestroy( stringBuf );
+        }
+    else
+        {
+        aDataArray->AppendL( KNullDesC );
+        }
+
+    if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast )
+        {
+        PopulatePodcastFileDetailsL( aHeadingsArray, aDataArray );
+        }
+
+    // Get modified
+    if ( iMedia->IsSupported( KMPXMediaGeneralDate ) )
+        {
+        TInt64 timeInt( ( TInt64 )iMedia->ValueTObjectL<TInt64>(
+            KMPXMediaGeneralDate ) );
+        TTime time( timeInt );
+        ConvertToLocalTimeL(time);
+        HBufC* modDateTime = HBufC::NewLC(
+            KMPXMaxTimeLength + KMPXDurationDisplayResvLen );
+        HBufC* format = StringLoader::LoadLC(
+            R_QTN_DATE_USUAL_WITH_ZERO );
+        TPtr modDatePtr = modDateTime->Des();
+        MPX_TRAPD( err, time.FormatL( modDatePtr, *format ) );
+        CleanupStack::PopAndDestroy( format );
+        if (err != KErrNone)
+            {
+            aDataArray->AppendL( KNullDesC );
+            }
+        else
+            {
+            format = StringLoader::LoadLC(
+                R_QTN_TIME_USUAL_WITH_ZERO );
+            HBufC* modTime = HBufC::NewLC(
+                format->Length() + KMPXDurationDisplayResvLen );
+            TPtr modTimePtr = modTime->Des();
+            MPX_TRAPD( err, time.FormatL( modTimePtr, *format ) );
+            if ( err != KErrNone )
+                {
+                aDataArray->AppendL( KNullDesC );
+                }
+            else
+                {
+                modDatePtr.Append( KMPXSpace );
+                modDatePtr.Append( modTimePtr );
+                aDataArray->AppendL( modDatePtr );
+                }
+            CleanupStack::PopAndDestroy( modTime );
+            CleanupStack::PopAndDestroy( format );
+            }
+        CleanupStack::PopAndDestroy( modDateTime );
+        }
+    else
+        {
+        aDataArray->AppendL( KNullDesC );
+        }
+
+    // Get filename
+    AppendStringToArrayL( aDataArray, iMedia->ValueText(
+        KMPXMediaGeneralCopyright ) );
+
+    // Get URL
+    AppendStringToArrayL( aDataArray, iMedia->ValueText(
+        KMPXMediaMusicURL ) );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL(
+    CDesCArrayFlat* /*aHeadingsArray*/, CDesCArrayFlat* aDataArray )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::PopulatePodcastFileDetailsL" );
+    // Get last playback position
+
+    TInt lastPbPosition( ( TInt )iMedia->ValueTObjectL<TInt>(
+        KMPXMediaGeneralLastPlaybackPosition ) );
+
+    if ( lastPbPosition > 0 )
+        {
+        // convert milliseconds to seconds
+        lastPbPosition = lastPbPosition / KSecondInMilliseconds;
+        CMPXCommonUiHelper::TMPXDuratDisplayMode lastPbPositionMode =
+            CMPXCommonUiHelper::EMPXDuratAuto;
+        if ( lastPbPosition > KOneHourInSeconds )
+            {
+            lastPbPositionMode = CMPXCommonUiHelper::EMPXDuratHMS;
+            }
+        HBufC* stringBuf = iCommonUiHelper->DisplayableDurationL(
+            lastPbPosition, lastPbPositionMode );
+        CleanupStack::PushL( stringBuf );
+        aDataArray->AppendL( *stringBuf );
+        CleanupStack::PopAndDestroy( stringBuf );
+        }
+    else if(lastPbPosition == 0 &&
+            iMedia->IsSupported(KMPXMediaGeneralPlayCount) &&
+            iMedia->ValueTObjectL<TInt>(KMPXMediaGeneralPlayCount) > 0 )
+        {
+        HBufC* stringBuf = StringLoader::LoadLC( R_MPX_CUI_METADATAEDITOR_PLAYBACK_COMPLETE );
+        aDataArray->AppendL( *stringBuf );
+        CleanupStack::PopAndDestroy( stringBuf );
+
+        }
+    else
+        {
+        aDataArray->AppendL( KNullDesC );
+        }
+
+
+    // Get published
+    if ( iMedia->IsSupported( TMPXAttribute( KMPXMediaIdPodcast,
+            EMPXMediaPodcastPubDate ) ) )
+        {
+        TInt64 timeInt( ( TInt64 )iMedia->ValueTObjectL<TInt64>(
+            TMPXAttribute( KMPXMediaIdPodcast, EMPXMediaPodcastPubDate ) ) );
+        TTime time( timeInt );
+        ConvertToLocalTimeL(time);
+        HBufC* modDateTime = HBufC::NewLC(
+            KMPXMaxTimeLength + KMPXDurationDisplayResvLen );
+        HBufC* format = StringLoader::LoadLC(
+            R_QTN_DATE_USUAL_WITH_ZERO );
+        TPtr modDatePtr = modDateTime->Des();
+        MPX_TRAPD( err, time.FormatL( modDatePtr, *format ) );
+        CleanupStack::PopAndDestroy( format );
+        if (err != KErrNone ||
+            time == 0)
+            {
+            aDataArray->AppendL( KNullDesC );
+            }
+        else
+            {
+            format = StringLoader::LoadLC(
+                R_QTN_TIME_USUAL_WITH_ZERO );
+            HBufC* modTime = HBufC::NewLC(
+                format->Length() + KMPXDurationDisplayResvLen );
+            TPtr modTimePtr = modTime->Des();
+            MPX_TRAPD( err, time.FormatL( modTimePtr, *format ) );
+            if ( err != KErrNone )
+                {
+                aDataArray->AppendL( KNullDesC );
+                }
+            else
+                {
+                modDatePtr.Append( KMPXSpace );
+                modDatePtr.Append( modTimePtr );
+                aDataArray->AppendL( modDatePtr );
+                }
+            CleanupStack::PopAndDestroy( modTime );
+            CleanupStack::PopAndDestroy( format );
+            }
+        CleanupStack::PopAndDestroy( modDateTime );
+        }
+    else
+        {
+        aDataArray->AppendL( KNullDesC );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::MakeDrmItemsL
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::MakeDrmItemsL(
+    CDesCArrayFlat* aHeadingsArray, CDesCArrayFlat* aDataArray )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::MakeDrmItemsL" );
+    if (iDrmDetails )
+        {
+        TInt itemCount( 0);
+        if ( iDrmInfo->IsSupported( KMPXMediaDrmType ) )
+            {
+            MPX_DEBUG2( "CMPXMetadataEditorDialog::MakeDrmItemsL drm type: %d",
+                    iDrmInfo->ValueTObjectL<TInt>( KMPXMediaDrmType ) );
+            TInt rightStatus( iDrmInfo->ValueTObjectL<TInt>( KMPXMediaDrmRightsStatus ) );
+            HBufC* rights( StringLoader::LoadLC( R_QTN_DRM_MGR_DET2_PLAY ) );
+            HBufC* heading( NULL);
+            HBufC* value( NULL);
+
+            switch ( rightStatus )
+                {
+                case EMPXDrmRightsFull:
+                    {
+                    // status
+                    heading = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_STAT );
+                    value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_VALID );
+                    aHeadingsArray->InsertL ( itemCount, heading->Des ( ) );
+                    aDataArray->InsertL ( itemCount, value->Des ( ) );
+                    CleanupStack::PopAndDestroy ( value );
+                    CleanupStack::PopAndDestroy ( heading );
+                    itemCount++;
+
+                    // full rights
+                    heading = StringLoader::LoadLC (
+                        R_QTN_DRM_MGR_DET_FULL_X, *rights );
+                    value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_UNLIMITED );
+                    aHeadingsArray->InsertL ( itemCount, heading->Des ( ) );
+                    aDataArray->InsertL ( itemCount, value->Des ( ) );
+                    CleanupStack::PopAndDestroy ( value );
+                    CleanupStack::PopAndDestroy ( heading );
+                    itemCount++;
+                    break;
+                    }
+                case EMPXDrmRightsRestricted:
+                case EMPXDrmRightsPreview:
+                    {
+                    // status
+                    heading = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_STAT );
+                    value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_VALID );
+                    aHeadingsArray->InsertL ( itemCount, heading->Des ( ) );
+                    aDataArray->InsertL ( itemCount, value->Des ( ) );
+                    CleanupStack::PopAndDestroy ( value );
+                    CleanupStack::PopAndDestroy ( heading );
+                    itemCount++;
+                    // rights
+                    MakeRestrictedDrmItemsL(
+                        rights, itemCount, aHeadingsArray, aDataArray );
+                    break;
+                    }
+                case EMPXDrmRightsMissing:
+                    {
+                    // status
+                    heading = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_STAT );
+                    value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_EXP );
+                    aHeadingsArray->InsertL ( itemCount, heading->Des ( ) );
+                    aDataArray->InsertL ( itemCount, value->Des ( ) );
+                    CleanupStack::PopAndDestroy ( value );
+                    CleanupStack::PopAndDestroy ( heading );
+                    itemCount++;
+                    break;
+                    }
+                case EMPXDrmRightsExpired:
+                    {
+                    // status
+                    heading = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_STAT );
+                    value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_EXP );
+                    aHeadingsArray->InsertL ( itemCount, heading->Des ( ) );
+                    aDataArray->InsertL ( itemCount, value->Des ( ) );
+                    CleanupStack::PopAndDestroy ( value );
+                    CleanupStack::PopAndDestroy ( heading );
+                    itemCount++;
+                    // make rest of the drm items
+                    MakeRestrictedDrmItemsL(
+                        rights, itemCount, aHeadingsArray, aDataArray );
+                    break;
+                    }
+                default:
+                    {
+                    break;
+                    }
+                }
+
+            heading = NULL;
+            value = NULL;
+
+            // sending
+            heading = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_CS );
+            TBool forwardAllowed( iDrmInfo->ValueTObjectL<TBool>( KMPXMediaDrmSendingAllowed ) );
+            if ( forwardAllowed )
+                {
+                value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_ALLOWED );
+                }
+            else
+                {
+                value = StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_FORBID );
+                }
+            aHeadingsArray->InsertL ( itemCount, heading->Des ( ) );
+            aDataArray->InsertL ( itemCount, value->Des ( ) );
+            CleanupStack::PopAndDestroy ( value );
+            CleanupStack::PopAndDestroy ( heading );
+            CleanupStack::PopAndDestroy ( rights ); // heading, value, rights
+            }
+        else
+            {
+            // if error getting drm info, drm type will not be valid
+            // by default assume the rights are invalid (since we can't read it)
+            MPX_DEBUG1( "CMPXMetadataEditorDialog::MakeDrmItemsL unable to get drm data" );
+            HBufC* heading( StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_STAT ));
+            HBufC* value( StringLoader::LoadLC ( R_QTN_DRM_MGR_DET_INVALID ));
+            aHeadingsArray->InsertL ( 0, heading->Des ( ) );
+            aDataArray->InsertL ( 0, value->Des ( ) );
+            CleanupStack::PopAndDestroy ( value );
+            CleanupStack::PopAndDestroy ( heading );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(
+    HBufC* aRights, TInt& aCurrentIndex,
+    CDesCArrayFlat* aHeadingsArray, CDesCArrayFlat* aDataArray )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL" );
+    TMPXMediaDrmRightsType expireConstraint( EMPXDrmRightsTypeNoRestriction );
+    if ( iDrmInfo->IsSupported( KMPXMediaDrmRightsType ) )
+        {
+        expireConstraint = iDrmInfo->ValueTObjectL<TMPXMediaDrmRightsType>(
+            KMPXMediaDrmRightsType );
+        }
+    MPX_DEBUG2("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): ExpireConstraint = %d", expireConstraint);
+    TInt64 intervalTime( KErrNotFound );
+    if ( iDrmInfo->IsSupported( KMPXMediaDrmIntervalStartTime ) )
+        {
+        MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): Interval Start Time");
+        intervalTime = (TInt64)iDrmInfo->ValueTObjectL<TInt64>( KMPXMediaDrmIntervalStartTime );
+        }
+    HBufC* heading = NULL;
+    HBufC* value = NULL;
+    // acculated time 
+    if ( expireConstraint ==  EMPXDrmRightsTypeAccTime )
+      	{
+      	MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): AccTime based");
+        heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_ACCUM_TIME_LEFT  );
+
+        TTimeIntervalSeconds  accTime = iDrmInfo->ValueTObjectL<TTimeIntervalSeconds>(  KMPXMediaDrmAccumulatedTime );
+        TInt years( 0 );
+        TInt months( 0 );
+        TInt days( 0 );
+        TInt hours( 0 );
+        TInt minutes( 0 );
+        TInt seconds( 0 );
+        SplitTime( accTime, years, months, days, hours, minutes, seconds );
+        value = AddPartsOfTimeLC( years, months, days, hours, minutes, seconds );      
+        
+        TPtr text = value->Des();
+        LanguageSpecificNumberConversion( text );   
+      	aHeadingsArray->InsertL( aCurrentIndex, heading->Des() );  
+        aDataArray->InsertL( aCurrentIndex, value->Des() ); 
+        
+        CleanupStack::PopAndDestroy( value );
+        CleanupStack::PopAndDestroy( heading );         
+        aCurrentIndex++;   
+      	}
+
+    // count
+    if ( expireConstraint == EMPXDrmRightsTypeCount ||
+         expireConstraint == EMPXDrmRightsTypeTimeCount )
+        {
+        MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): Count based");
+        heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_UTL_X, *aRights );
+
+        TInt counts( iDrmInfo->ValueTObjectL<TInt>( KMPXMediaDrmCount ) );
+        if ( counts == 1 )
+            {
+            value = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_1_COUNT );
+            }
+        else
+            {
+            value = StringLoader::LoadLC(
+                R_QTN_DRM_MGR_DET_N_COUNTS, counts );
+            }
+        TPtr text = value->Des();
+        LanguageSpecificNumberConversion( text );
+        aHeadingsArray->InsertL( aCurrentIndex, heading->Des() );
+        aDataArray->InsertL( aCurrentIndex, value->Des() );
+        CleanupStack::PopAndDestroy( value );
+        CleanupStack::PopAndDestroy( heading );
+        aCurrentIndex++;
+        }
+
+    if ( expireConstraint == EMPXDrmRightsTypeTime ||
+         expireConstraint == EMPXDrmRightsTypeTimeCount ||
+         ( expireConstraint == EMPXDrmRightsTypeInterval &&
+         intervalTime > 0 ) )
+        {
+        MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): Time based");
+        HBufC* dateFormatString = StringLoader::LoadLC(
+                R_QTN_DATE_USUAL_WITH_ZERO );
+        HBufC* timeFormatString = StringLoader::LoadLC( R_QTN_TIME_USUAL );
+
+        // from
+        if ( iDrmInfo->IsSupported( KMPXMediaDrmStartTime ) )
+            {
+            MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): Start time found");
+            TTime from( iDrmInfo->ValueTObjectL<TInt64>( KMPXMediaDrmStartTime ) );
+            heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_RVF_X, *aRights );
+            HBufC* datePointer = HBufC::NewLC( KMaxFileName );
+            TPtr date = datePointer->Des();
+            from.FormatL( date, *dateFormatString );
+            TBuf<KMPXMaxTimeLength> time;
+            from.FormatL( time, *timeFormatString );
+            date.Append( KMPXSpace );
+            date.Append( time );
+            LanguageSpecificNumberConversion( date );
+            aHeadingsArray->InsertL( aCurrentIndex, heading->Des() );
+            aDataArray->InsertL( aCurrentIndex, date );
+            CleanupStack::PopAndDestroy( datePointer );
+            CleanupStack::PopAndDestroy( heading );
+            aCurrentIndex++;
+            }
+
+        // until
+        if ( iDrmInfo->IsSupported( KMPXMediaDrmEndTime ) )
+            {
+            MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): End time found");
+            TTime until( iDrmInfo->ValueTObjectL<TInt64>( KMPXMediaDrmEndTime ) );
+            heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_RVT_X, *aRights );
+            HBufC* dateToPntr = HBufC::NewLC( KMaxFileName );
+            TPtr dateTo = dateToPntr->Des();
+            until.FormatL( dateTo, *dateFormatString );
+            TBuf<KMPXMaxTimeLength> timeTo;
+            until.FormatL( timeTo, *timeFormatString );
+            dateTo.Append( KMPXSpace );
+            dateTo.Append( timeTo );
+            LanguageSpecificNumberConversion( dateTo );
+            aHeadingsArray->InsertL( aCurrentIndex, heading->Des() );
+            aDataArray->InsertL( aCurrentIndex, dateTo );
+            CleanupStack::PopAndDestroy( dateToPntr );
+            CleanupStack::PopAndDestroy( heading );
+            aCurrentIndex++;
+            }
+        CleanupStack::PopAndDestroy( timeFormatString );
+        CleanupStack::PopAndDestroy( dateFormatString );
+        }
+    else if ( expireConstraint == EMPXDrmRightsTypeInterval &&
+         intervalTime < 0 )
+        {
+        MPX_DEBUG1("CMPXMetadataEditorDialog::MakeRestrictedDrmItemsL(): Time not activated");
+        // times not activated
+        heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_UTS_X, *aRights );
+        value  = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_NOT_ACT );
+        aHeadingsArray->InsertL( aCurrentIndex, heading->Des() );
+        aDataArray->InsertL( aCurrentIndex, value->Des() );
+        CleanupStack::PopAndDestroy( value );
+        CleanupStack::PopAndDestroy( heading );
+        aCurrentIndex++;
+
+        // query what the current time is
+        TTime currentTime;
+        currentTime.HomeTime();
+        // calculate rights end time
+        TTimeIntervalSeconds interval = iDrmInfo->ValueTObjectL<TInt64>( KMPXMediaDrmInterval );
+        TTime endTime( currentTime.Int64() + (TInt64) interval.Int() * KSecondInMicroSeconds );
+        TBuf<KMPXMaxVal> val;
+        TInt count = 0;
+
+        // years
+        TTimeIntervalYears years = endTime.YearsFrom( currentTime );
+        if ( years.Int() )
+            {
+            AddSinglePartOfTimeL( years.Int(),
+                R_QTN_DRM_NBR_OF_YEARS_ONE,
+                R_QTN_DRM_NBR_OF_YEARS_ONE_FINAL,
+                R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR,
+                R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO,
+                value );
+            count++;
+            val.Append( *value );
+            endTime -= years;
+            CleanupStack::PopAndDestroy( value );
+            }
+
+        // months
+        TTimeIntervalMonths months = endTime.MonthsFrom( currentTime );
+        if ( months.Int() )
+            {
+            AddSinglePartOfTimeL( months.Int(),
+                R_QTN_DRM_NBR_OF_MONTHS_ONE,
+                0,
+                R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR,
+                R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO,
+                value );
+             if ( count )
+                {
+                val.Append( KMPXSpace );
+                }
+
+            count++;
+            val.Append( *value );
+            endTime -= months;
+            CleanupStack::PopAndDestroy( value );
+            }
+
+        // days
+        TTimeIntervalDays days = endTime.DaysFrom( currentTime );
+        if ( days.Int() && count < 2 )
+            {
+            AddSinglePartOfTimeL( days.Int(),
+                R_QTN_DRM_NBR_OF_DAYS_ONE,
+                R_QTN_DRM_NBR_OF_DAYS_ONE_FINAL,
+                R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR,
+                R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO,
+                value );
+            if ( count )
+                {
+                val.Append( KMPXSpace );
+                }
+
+            val.Append( *value );
+            endTime -= days;
+            CleanupStack::PopAndDestroy( value );
+            count++;
+            }
+
+        // hours
+        TTimeIntervalHours hours;
+        TInt ret = endTime.HoursFrom( currentTime, hours );
+        if ( ret == KErrNone && count < 2 && hours.Int() )
+            {
+            AddSinglePartOfTimeL( hours.Int(),
+                R_QTN_DRM_NBR_OF_HOURS_ONE,
+                R_QTN_DRM_NBR_OF_HOURS_ONE_FINAL,
+                R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR,
+                R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO,
+                value );
+            if ( count )
+                {
+                val.Append( KMPXSpace );
+                }
+
+            val.Append( *value );
+            endTime -= hours;
+            CleanupStack::PopAndDestroy( value );
+            count++;
+            }
+
+        // mins
+        TTimeIntervalMinutes minutes;
+        ret = endTime.MinutesFrom( currentTime, minutes );
+        if ( ret == KErrNone && count < 2 && minutes.Int() )
+            {
+            AddSinglePartOfTimeL( minutes.Int(),
+                R_QTN_DRM_NBR_OF_MINS_ONE,
+                R_QTN_DRM_NBR_OF_MINS_ONE_FINAL,
+                R_QTN_DRM_NBR_OF_MINS_TWO_FOUR,
+                R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO,
+                value );
+            if ( count )
+                {
+                val.Append( KMPXSpace );
+                }
+
+            val.Append( *value );
+            endTime -= minutes;
+            CleanupStack::PopAndDestroy( value );
+            count++;
+            }
+
+        // seconds
+        TTimeIntervalSeconds seconds;
+        ret = endTime.SecondsFrom( currentTime,seconds );
+        if ( ret == KErrNone && count < 2 && seconds.Int() )
+            {
+            AddSinglePartOfTimeL( seconds.Int(),
+                R_QTN_DRM_NBR_OF_SECS_ONE,
+                R_QTN_DRM_NBR_OF_SECS_ONE_FINAL,
+                R_QTN_DRM_NBR_OF_SECS_TWO_FOUR,
+                R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO,
+                value );
+
+            if ( count )
+                {
+                val.Append( KMPXSpace );
+                }
+
+            val.Append( *value );
+            CleanupStack::PopAndDestroy(); // value
+            count++;
+            }
+
+        heading = StringLoader::LoadLC( R_QTN_DRM_MGR_DET_UDL_X, *aRights );
+        LanguageSpecificNumberConversion( val );
+        aHeadingsArray->InsertL( aCurrentIndex, heading->Des() );
+        aDataArray->InsertL( aCurrentIndex, val );
+        CleanupStack::PopAndDestroy( heading );
+        aCurrentIndex++;
+        }
+    }
+  
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::AddPartsOfTimeLC
+// -----------------------------------------------------------------------------
+//
+HBufC* CMPXMetadataEditorDialog::AddPartsOfTimeLC( TInt aIntYrs, TInt aIntMon, TInt aIntDay, 
+                         TInt aIntHrs, TInt aIntMin, TInt aIntSec )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::AddPartsOfTimeLC" );   
+    // Only the two most meaningful data will be showed
+    TInt numOfData( 0 );
+    const TInt KMaxDataItems = 2;
+
+    CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( KMaxDataItems );
+    CleanupStack::PushL( strings );
+
+    if ( aIntYrs > 0 )
+        {
+        AddSinglePartOfTimeL( aIntYrs, 
+            R_QTN_DRM_NBR_OF_YEARS_ONE,
+            R_QTN_DRM_NBR_OF_YEARS_ONE_FINAL,
+            R_QTN_DRM_NBR_OF_YEARS_TWO_FOUR,
+            R_QTN_DRM_NBR_OF_YEARS_FIVE_ZERO,
+            strings );
+        numOfData++;
+        }
+
+    if ( aIntMon > 0 )
+        {
+        //  Second type not provided because 11 is the maximum
+        AddSinglePartOfTimeL( aIntMon, 
+            R_QTN_DRM_NBR_OF_MONTHS_ONE,
+            0,       
+            R_QTN_DRM_NBR_OF_MONTHS_TWO_FOUR, 
+            R_QTN_DRM_NBR_OF_MONTHS_FIVE_ZERO, 
+            strings );
+        numOfData++;
+        }
+
+    // Only if years or months were missing
+    if ( aIntDay > 0 && numOfData < KMaxDataItems )
+        {
+        AddSinglePartOfTimeL( aIntDay, 
+            R_QTN_DRM_NBR_OF_DAYS_ONE,
+            R_QTN_DRM_NBR_OF_DAYS_ONE_FINAL,
+            R_QTN_DRM_NBR_OF_DAYS_TWO_FOUR, 
+            R_QTN_DRM_NBR_OF_DAYS_FIVE_ZERO, 
+            strings );
+        numOfData++;
+        }
+
+    if ( aIntHrs > 0 && numOfData < KMaxDataItems )
+        {
+        AddSinglePartOfTimeL( aIntHrs, 
+            R_QTN_DRM_NBR_OF_HOURS_ONE, 
+            R_QTN_DRM_NBR_OF_HOURS_ONE_FINAL,
+            R_QTN_DRM_NBR_OF_HOURS_TWO_FOUR, 
+            R_QTN_DRM_NBR_OF_HOURS_FIVE_ZERO, 
+            strings );
+        numOfData++;
+        }
+
+    if ( aIntMin > 0 && numOfData < KMaxDataItems )
+        {
+        AddSinglePartOfTimeL( aIntMin, 
+            R_QTN_DRM_NBR_OF_MINS_ONE,
+            R_QTN_DRM_NBR_OF_MINS_ONE_FINAL,
+            R_QTN_DRM_NBR_OF_MINS_TWO_FOUR, 
+            R_QTN_DRM_NBR_OF_MINS_FIVE_ZERO, 
+            strings );
+        numOfData++;
+        }
+
+    // If interval is 0, then it shows "0 seconds" anyway
+    if ( ( aIntSec > 0 && numOfData < KMaxDataItems ) || numOfData == 0 )
+        {
+        AddSinglePartOfTimeL( aIntSec, 
+            R_QTN_DRM_NBR_OF_SECS_ONE, 
+            R_QTN_DRM_NBR_OF_SECS_ONE_FINAL,
+            R_QTN_DRM_NBR_OF_SECS_TWO_FOUR, 
+            R_QTN_DRM_NBR_OF_SECS_FIVE_ZERO, 
+            strings );
+        numOfData++;
+        }
+
+    HBufC* stringHolder = NULL;
+    if ( numOfData == 1 )
+        {
+        stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER,
+            strings->MdcaPoint(0) );
+        }
+    else
+        {
+        stringHolder = StringLoader::LoadL( R_QTN_DRM_MGR_DET_INTER_TWO,
+            *strings );
+        }
+
+    CleanupStack::PopAndDestroy( strings );
+    
+    CleanupStack::PushL( stringHolder );
+
+    return stringHolder;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::AddSinglePartOfTimeL
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::AddSinglePartOfTimeL( TInt aNumOfElements,
+        TInt aResourceIdSingle,
+        TInt aResourceIdOneFinal, 
+        TInt aResourceIdTwoFour,
+        TInt aResourceIdFiveZero, 
+        CDesCArrayFlat* aStrings )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::AddSinglePartOfTimeL" );   
+   
+    HBufC* stringHolder = NULL;
+    TInt finalOneDigit( aNumOfElements % KDigitTen );
+    TInt finalTwoDigits( aNumOfElements % KDigitHundred );
+
+    if ( aNumOfElements == 1 )
+        {
+        stringHolder = StringLoader::LoadLC( aResourceIdSingle );
+        }
+    else if ( finalOneDigit == 1 && finalTwoDigits != KDigitEleven )
+        {
+        stringHolder = StringLoader::LoadLC( aResourceIdOneFinal, 
+            aNumOfElements );
+        }
+    else if ( finalOneDigit == 0 || 
+             ( finalOneDigit >= KDigitFive && finalOneDigit <= KDigitNine ) ||
+             ( finalTwoDigits >= KDigitEleven && finalTwoDigits <= KDigitFourTeen ) )
+        {
+        stringHolder = StringLoader::LoadLC( aResourceIdFiveZero,
+            aNumOfElements );
+        }
+    else
+        {
+        stringHolder = StringLoader::LoadLC( aResourceIdTwoFour,
+            aNumOfElements );
+        }
+
+    if ( aStrings )
+        {
+        aStrings->AppendL( *stringHolder );
+        }
+
+    CleanupStack::PopAndDestroy ( stringHolder );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::SplitTime
+// 
+// -----------------------------------------------------------------------------
+//
+
+void CMPXMetadataEditorDialog::SplitTime( const TTimeIntervalSeconds& aInterval,
+        TInt& aIntYrs, TInt& aIntMon, TInt& aIntDay,
+        TInt& aIntHrs, TInt& aIntMin, TInt& aIntSec )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::SplitTime" );       
+    const TInt KSecsInMin( 60 );
+    const TInt KSecsInHour( KSecsInMin * 60 );
+    const TInt KSecsInDay( KSecsInHour * 24 );
+
+    // includes leap year day
+
+    const TInt KMaxDaysInMonths[] = {
+    		KMaxDaysInOneMonths,
+    		KMaxDaysInTwoMonths,
+    		KMaxDaysInThreeMonths,
+    		KMaxDaysInFourMonths,
+    		KMaxDaysInFiveMonths,
+    		KMaxDaysInSixMonths,
+    		KMaxDaysInSevenMonths,
+    		KMaxDaysInEightMonths,
+    		KMaxDaysInNineMonths,
+    		KMaxDaysInTenMonths,
+    		KMaxDaysInElevenMonths,
+    		KMaxDaysInEightMonths }; 
+
+    // calculate full days
+    TInt temp( aInterval.Int() / KSecsInDay );
+
+    // calculate full years, calculate without leap year for user to get the 
+    // longest time possible
+    aIntYrs = temp / ( KMaxDaysInMonths[KDigitEleven] - 1 );
+
+    // calc remainder days
+    temp = temp % ( KMaxDaysInMonths[KDigitEleven] - 1 );
+
+    aIntMon = 0;
+
+    TInt i( 0 );
+    if ( temp >= KMaxDaysInMonths[0] )
+        {
+        for ( i = 0; i < KDigitEleven; i++ )
+            {
+            // found correct amount of months
+            if ( temp >= KMaxDaysInMonths[i] && temp < KMaxDaysInMonths[i+1] )
+                {
+                // i now contains amount of full months (+1 because of table index)
+                aIntMon = i + 1;
+                break;
+                }
+            }
+        }
+
+    // calc remainder days = allSecs - secsInFullYears - secsInFullMonts
+    if( temp >= KMaxDaysInMonths[i] )
+        {
+        aIntDay = temp - KMaxDaysInMonths[i];
+        }
+    else
+        {
+        aIntDay = temp;
+        }
+
+    // calculate remainder secs
+    temp = aInterval.Int() % KSecsInDay;
+
+    aIntHrs = temp / KSecsInHour;
+
+    // calculate remainder secs
+    temp = temp % KSecsInHour;
+
+    aIntMin = temp / KSecsInMin;
+
+    // calculate remainder secs
+    aIntSec = temp % KSecsInMin;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::AddSinglePartOfTimeL
+// Language specific time formats
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::AddSinglePartOfTimeL(
+    TInt aNumOfElements,
+    TInt aResourceIdSingle,
+    TInt aResourceIdOneFinal,
+    TInt aResourceIdTwoFour,
+    TInt aResourceIdFiveZero,
+    HBufC*& aStrings )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::AddSinglePartOfTimeL" );
+    TInt finalOneDigit = aNumOfElements % KMPXOneDigit;
+    TInt finalTwoDigits = aNumOfElements % KMPXTwoDigits;
+
+    if ( aNumOfElements == 1 )
+        {
+        aStrings = StringLoader::LoadLC( aResourceIdSingle );
+        }
+    else if ( finalOneDigit == 1 && finalTwoDigits != KDigitEleven )
+        {
+        // Used for period of years ending with 1 from 21 (21, 31, 41, etc.)
+        aStrings = StringLoader::LoadLC( aResourceIdOneFinal, aNumOfElements );
+        }
+    else if ( finalOneDigit == 0 ||
+            ( finalOneDigit >= KDigitFive && finalOneDigit <= KDigitNine ) ||
+            ( finalTwoDigits >= KDigitEleven && finalTwoDigits <= KDigitFourTeen ) )
+        {
+        // Used for period of minutes ending from 5 to 0 plus range between 11
+        // and 14 (5-20, 25-30, 35-40, 45-50, 53-59)
+        aStrings = StringLoader::LoadLC( aResourceIdFiveZero, aNumOfElements );
+        }
+    else
+        {
+        // Used for period of minutes ending from 2 to 4, excluded 12-14 (2-4,
+        // 22-24, 32-34, 42-44, 52-54)
+        aStrings = StringLoader::LoadLC( aResourceIdTwoFour, aNumOfElements );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::LanguageSpecificNumberConversion
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::LanguageSpecificNumberConversion( TDes& aText ) const
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::LanguageSpecificNumberConversion" );
+    if ( AknTextUtils::DigitModeQuery( AknTextUtils::EDigitModeShownToUser ) )
+        {
+        AknTextUtils::DisplayTextLanguageSpecificNumberConversion( aText );
+        }
+    }
+
+
+// ----------------------------------------------------------------------------
+// Converts the time value to localtime
+// ----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::ConvertToLocalTimeL(TTime& aTime )
+    {
+    RTz timeConverter;
+    CleanupClosePushL(timeConverter);
+    User::LeaveIfError( timeConverter.Connect() );
+    User::LeaveIfError( timeConverter.ConvertToLocalTime( aTime ) );
+    CleanupStack::PopAndDestroy();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::AddItemToListBoxL
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::AddItemToListBoxL(
+    const TDesC& aHeading,
+    const TDesC& aValue,
+    CDesCArray* aItemArray )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::AddItemToListBoxL" );
+    CDesCArrayFlat* items = new (ELeave) CDesCArrayFlat( 2 );
+    CleanupStack::PushL( items );
+    items->AppendL( aHeading ); //First string (heading)
+    items->AppendL( aValue );   //Second string (value)
+    HBufC* headingAndValue =
+            StringLoader::LoadLC( R_MPX_CUI_METADATAEDITOR_FILE_DETAILS_ROW_FORMAT, *items );
+
+    aItemArray->AppendL( *headingAndValue );
+    CleanupStack::PopAndDestroy( headingAndValue );
+    CleanupStack::PopAndDestroy( items );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::HandleControlStateChangeL
+// Handle State Changes in Genre popup.
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::HandleControlStateChangeL( TInt aControlId )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::HandleControlStateChangeL" );
+    if( !iTryingExit )
+        {
+        if ( aControlId == EMPXMetadataEditorDlgCtrlIdGenre )
+            {
+            // check to see if the genre pop has item custom selected
+            if ( iTextValues->CurrentValueIndex() == 0 )
+                {
+                HBufC* genreName = HBufC::NewLC( KMPXSongDetailsTextMaxLen );
+                TPtr genrePtr = genreName->Des();
+                CAknTextQueryDialog* queryDlg =
+                    CAknTextQueryDialog::NewL( genrePtr );
+                CleanupStack::PushL( queryDlg );
+                HBufC* promptTxt = NULL;
+                if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection )
+                    {
+                    promptTxt = StringLoader::LoadLC( R_MPX_CUI_CUSTOM_GENRE_RENAME_TEXT );
+                    }
+                else
+                    {
+                    promptTxt = StringLoader::LoadLC( R_MPX_CUI_CUSTOM_CATEGORY_RENAME_TEXT );
+                    }
+                queryDlg->SetPromptL( *promptTxt );
+                queryDlg->SetPredictiveTextInputPermitted( ETrue );
+                CleanupStack::PopAndDestroy( promptTxt );
+                CleanupStack::Pop( queryDlg );
+                if ( queryDlg->ExecuteLD( R_MPX_CUI_CUSTOM_GENRE_NAME_QUERY_DLG ) )
+                    {
+                    TBool isHandled = EFalse;
+                    TBool tryExit = EFalse;
+                    if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection )
+                        {
+                        // in music libray, if genre is set to podcast, ask user
+                        // to confirm move to podcast database
+                        HBufC* podcastText = StringLoader::LoadLC( R_MPX_QTN_NMP_GENRE_PODCAST );
+                        if ( genreName->Des().CompareF( *podcastText ) == 0 &&
+                             !iDisablePodcasting )
+                            {
+                            isHandled = ETrue;
+                            // genre is set to podcast
+                            if ( PromptForLibraryChangeL( EMPXMetadataEditorDlgPodcast ) )
+                                {
+                                MPX_DEBUG1( "CMPXMetadataEditorDialog::HandleControlStateChangeL Move to a different library" );
+                                iCollectionUiHelper->MoveL( iMedia, TUid::Uid(EMPXCollectionPluginPodCast) , this);
+                                tryExit = ETrue;
+                                iTryingExit = ETrue;
+                                }
+                            }
+                        CleanupStack::PopAndDestroy( podcastText );
+                        }
+                    if ( !isHandled )
+                        {
+                        // ok selected
+                        CMPXMedia* media = CMPXMedia::NewL();
+                        CleanupStack::PushL( media );
+                        iMedia->SetTextValueL(
+                            KMPXMediaMusicGenre, genreName->Des() );
+                        media->SetTextValueL(
+                            KMPXMediaMusicGenre, genreName->Des() );
+                        SaveMediaPropertiesL( media );
+                        CleanupStack::PopAndDestroy( media );
+                        }
+                    if ( !tryExit )
+                        {
+                        FetchGenreL();
+                        }
+                    }
+                else
+                    {
+                    // Text query cancelled.  Display popup list again.
+                    iTextValues->SetCurrentValueIndex( 0 );
+                    iPopup->ActivateSelectionListL();
+                    // genre is fetched so that "Custom..." isn't passed as the new genre
+                    FetchGenreL();
+                    }
+                CleanupStack::PopAndDestroy( genreName );
+                }
+            else
+                {
+                if ( iUnknownGenre &&
+                    ( iTextValues->CurrentValueIndex() == ( iTextValues->MdcArray()->MdcaCount() - 1 ) ) )
+                    {
+                    MPX_DEBUG1( "CMPXMetadataEditorDialog::HandleControlStateChangeL last entry with unknown genre, do nothing" );
+                    }
+                else
+                    {
+                    CMPXMedia* media = CMPXMedia::NewL();
+                    CleanupStack::PushL( media );
+                    HBufC* currentTxt = iTextValues->CurrentValueTextLC();
+                    iMedia->SetTextValueL( KMPXMediaMusicGenre, *currentTxt );
+                    media->SetTextValueL( KMPXMediaMusicGenre, *currentTxt );
+                    CleanupStack::PopAndDestroy( currentTxt );
+                    SaveMediaPropertiesL( media );
+                    CleanupStack::PopAndDestroy( media );
+                    FetchGenreL();
+                    }
+                }
+            }
+        else if ( aControlId == EMPXMetadataEditorDlgCtrlIdLibrary )
+            {
+            TInt currentIndex = iLibraryTextValues->CurrentValueIndex();
+            if ( iCurrentLibrary != currentIndex )
+                {
+                if ( PromptForLibraryChangeL( currentIndex ) )
+                    {
+                    MPX_DEBUG1( "CMPXMetadataEditorDialog::HandleControlStateChangeL Move to a different library" );
+                    TUid targetCollection = TUid::Uid( EMPXCollectionPluginMusic );
+                    if ( currentIndex == EMPXMetadataEditorDlgPodcast )
+                        {
+                        targetCollection = TUid::Uid(EMPXCollectionPluginPodCast);
+                        }
+                    // before moving, save current data
+                    SaveFormDataL();
+                    iCurrentLibrary = currentIndex; // Fix for ELWG-7AACMS prevent the if clause to be reentried.
+                    iCollectionUiHelper->MoveL( iMedia, targetCollection, this );
+                    iTryingExit = ETrue;
+                    }
+                else
+                    {
+                    iLibraryTextValues->SetCurrentValueIndex( iCurrentLibrary );
+                    // Fix EIZU-7QQAZN, Let it display back to "Music" immediately.
+                    if ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdLibrary )
+                        {
+                        iPopup = static_cast<CAknPopupField*>
+                                        ( ControlOrNull( EMPXMetadataEditorDlgCtrlIdLibrary ) );
+                        if ( iPopup )
+                            {
+                            iPopup->SetQueryValueL( iLibraryTextValues );
+                            iPopup->DrawDeferred();
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    CAknForm::HandleControlStateChangeL( aControlId );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::PrepareForFocusTransitionL
+// Handle Focus changes for track and year controls.
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::PrepareForFocusTransitionL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::PrepareForFocusTransitionL" );
+    TInt err = KErrNone;
+
+    CEikNumberEditor* myTrackNumberEditor = static_cast<CEikNumberEditor*>
+            ( ControlOrNull( EMPXMetadataEditorDlgCtrlIdTrackNumber ) );
+
+    CEikNumberEditor* myYearNumberEditor = static_cast<CEikNumberEditor*>
+            ( ControlOrNull( EMPXMetadataEditorDlgCtrlIdYear ) );
+
+    if ( myTrackNumberEditor )
+        {
+        // if length 0 trap error and set to 0.
+        MPX_TRAP( err, myTrackNumberEditor->Number() );
+        if ( err )
+            {
+            myTrackNumberEditor->SetNumber( KMPXMinNumDateTrack );
+            }
+        }
+
+    if ( myYearNumberEditor )
+        {
+        // if length 0 trap error and set to 0.
+        MPX_TRAP( err, myYearNumberEditor->Number() );
+        if ( err )
+            {
+            myYearNumberEditor->SetNumber( KMPXMinNumDateTrack );
+            }
+        }
+
+    CAknForm::PrepareForFocusTransitionL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::GetHelpContext
+// Gets Help
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::GetHelpContext" );
+    aContext.iMajor = KAppUidMusicPlayerX;
+    aContext.iContext = KMUS_HLP_METADATA_EDITING;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::HandleFindAllL
+// Handle callback for "find" operation
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::HandleFindAllL(const CMPXMedia& aResults,
+                               TBool /*aComplete*/, TInt aError)
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::HandleFindAllL" );
+    iPopup = static_cast<CAknPopupField*>
+        ( ControlOrNull( EMPXMetadataEditorDlgCtrlIdGenre ) );
+    CleanUpGenreText();
+    // populate predefined genre
+    TResourceReader reader;
+    if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection )
+        {
+        if( !iDisablePodcasting )
+            {
+            iEikonEnv->CreateResourceReaderLC( reader, R_MPX_MUSIC_GENRE_STRINGS );
+            }
+        else
+            {
+            iEikonEnv->CreateResourceReaderLC( reader, R_MPX_MUSIC_GENRE_STRINGS_PODCAST );
+            }
+        }
+    else if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast )
+        {
+        iEikonEnv->CreateResourceReaderLC(
+            reader, R_MPX_PODCAST_CATEGORY_STRINGS );
+        }
+    iGenreArr = reader.ReadDesCArrayL( );
+    CleanupStack::PopAndDestroy(); // reader
+
+    // populate genres from database
+    if ( aError == KErrNone )
+        {
+        const CMPXMediaArray* mediaArray =
+            aResults.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+        User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+        
+        TInt entriesCount( mediaArray->Count() );
+        MPX_DEBUG2( "CMPXMetadataEditorDialog::HandleFindAllL genres from database count = %d", entriesCount );
+        for ( TInt i = 0; i < entriesCount; i++ )
+            {
+            CMPXMedia* media = mediaArray->AtL( i );
+            TInt location( 0 );
+            const TDesC& genre = media->ValueText( KMPXMediaGeneralTitle );
+            if ( i == entriesCount - 1)
+                {
+                if ( genre.Compare( KNullDesC ) != 0 )
+                    {
+                    // if last item is a null descriptor, don't append to array
+                    if ( iGenreArr->Find( genre, location ) != 0 )
+                        {
+                        // a match is not found
+                        MPX_DEBUG1( "CMPXMetadataEditorDialog::HandleFindAllL adding to genre list" );
+                        iGenreArr->AppendL( genre );
+                        }
+                    }
+                }
+            else
+                {
+                if ( iGenreArr->Find( genre, location ) != 0 )
+                    {
+                    // a match is not found
+                    MPX_DEBUG1( "CMPXMetadataEditorDialog::HandleFindAllL adding to genre list" );
+                    iGenreArr->AppendL( genre );
+                    }
+                }
+            }
+        }
+    iGenreArr->Sort(ECmpCollated);
+    
+    if ( iCurrentLibrary == EMPXMetadataEditorDlgCollection )
+        {
+            HBufC* custTxt =
+            StringLoader::LoadLC( R_MPX_CUI_CUSTOM_GENRE_PROMPT_TEXT );
+            iGenreArr->InsertL( 0, *custTxt );
+            CleanupStack::PopAndDestroy( custTxt );
+        }
+    else if ( iCurrentLibrary == EMPXMetadataEditorDlgPodcast )
+        {
+            HBufC* custTxt =
+            StringLoader::LoadLC( R_MPX_CUI_PODCAST_CUSTOM_GENRE_PROMPT_TEXT );
+            iGenreArr->InsertL( 0, *custTxt );
+            CleanupStack::PopAndDestroy( custTxt );
+        }
+
+    iValueTextArray = CAknQueryValueTextArray::NewL();
+    iValueTextArray->SetArray( *iGenreArr );
+
+    iTextValues = CAknQueryValueText::NewL();
+    iTextValues->SetArrayL( iValueTextArray );
+    if ( iMedia->ValueText( KMPXMediaMusicGenre ).Length() == 0 )
+        {
+        // no genre
+        iUnknownGenre = ETrue;
+        HBufC* unknownGenre( StringLoader::LoadLC( R_MPX_CUI_UNKNOWN_GENRE_TEXT ) );
+        iGenreArr->AppendL( *unknownGenre );
+        CleanupStack::PopAndDestroy( unknownGenre );
+        iTextValues->SetCurrentValueIndex( iGenreArr->Count() - 1 );
+        }
+    else
+        {
+        // Find the genre
+        iUnknownGenre = EFalse;
+        TInt genreIndex;
+        iGenreArr->Find( iMedia->ValueText( KMPXMediaMusicGenre ), genreIndex );
+        iTextValues->SetCurrentValueIndex( genreIndex );
+        }
+    // Set values into popup fields.
+    iPopup->SetQueryValueL( iTextValues ); // Moved up from below.
+    iPopup->DrawDeferred();
+    }
+
+// ----------------------------------------------------------------------------
+// void CMPXMetadataEditorDialog::HandleOperationCompleteL
+// Handle callback for the ui helper.
+// ----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::HandleOperationCompleteL(
+    TCHelperOperation aOperation,
+    TInt aErr, void* aArgument )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::HandleOperationCompleteL" );
+    if ( aOperation == EMoveOp )
+        {
+        if ( aErr != KErrNone )
+            {
+            // TO-DO: error handling
+            }
+        // move complete, quit the editor
+        if ( iIdle )
+            {
+            iIdle->Cancel();
+            delete iIdle;
+            iIdle = NULL;
+            }
+        iIdle = CIdle::NewL( CActive::EPriorityStandard );
+        iIdle->Start( TCallBack( CMPXMetadataEditorDialog::DeferredExitCallback, this ) );
+        }
+    if ( aArgument )
+        {
+        delete (CBase*)aArgument;
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// void CMPXMetadataEditorDialog::DeferredExitCallback
+// call back function for deferred exit.
+// ----------------------------------------------------------------------------
+//
+TInt CMPXMetadataEditorDialog::DeferredExitCallback( TAny* aPtr )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::DeferredExitCallback" );
+    CMPXMetadataEditorDialog* self =
+        static_cast<CMPXMetadataEditorDialog*>( aPtr );
+    TRAP_IGNORE( self->TryExitL( EAknSoftkeyExit ) );
+    return KErrNone;
+    }
+
+// ----------------------------------------------------------------------------
+// void CMPXMetadataEditorDialog::DeferredFileDetailsCallback
+// call back function for deferred file details dialog.
+// ----------------------------------------------------------------------------
+//
+TInt CMPXMetadataEditorDialog::DeferredFileDetailsCallback( TAny* aPtr )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::DeferredFileDetailsCallback" );
+    CMPXMetadataEditorDialog* self =
+        static_cast<CMPXMetadataEditorDialog*>( aPtr );
+    TRAP_IGNORE( self->ViewFileDetailsPopupL() );
+    return KErrNone;
+    }
+
+#ifdef __ENABLE_MSK
+// -----------------------------------------------------------------------------
+// CMPXAddTracksDialog::UpdateSoftkeyL()
+// Update softkey.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::UpdateSoftkeyL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::UpdateSoftkeyL" );
+    TInt resId( 0 );
+
+    if ( ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdGenre ) ||
+        ( IdOfFocusControl() == EMPXMetadataEditorDlgCtrlIdLibrary ) )
+        {
+        resId = R_MPX_CUI_SONG_DETAILS_SOFTKEYS_OPTIONS_CHANGE_DONE;
+        }
+    else
+        {
+        resId = R_MPX_CUI_SONG_DETAILS_SOFTKEYS_OPTIONS_EMPTY_DONE;
+        }
+
+    ButtonGroupContainer().SetCommandSetL( resId );
+    ButtonGroupContainer().DrawDeferred();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::OfferKeyEventL
+// Handles key-events.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TKeyResponse CMPXMetadataEditorDialog::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::OfferKeyEventL" );
+    TKeyResponse res = CAknForm::OfferKeyEventL( aKeyEvent, aType );
+
+    if ( aType == EEventKey )
+        {
+        switch ( aKeyEvent.iScanCode )
+            {
+            case EStdKeyUpArrow:
+            case EStdKeyDownArrow:
+                {
+                UpdateSoftkeyL();
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+
+    return res;
+    }
+#endif // __ENABLE_MSK
+
+// ----------------------------------------------------------------------------
+// void CMPXMetadataEditorDialog::PreLayoutDynInitL
+// Initialises the dialog's controls before the dialog is sized and layed out.
+// ----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::PreLayoutDynInitL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::PreLayoutDynInitL" );
+    SetTitlePaneL();
+    SetNaviLabelL();
+
+    _LIT( KZero, "0" );
+    
+    SetControlNumberL( EMPXMetadataEditorDlgCtrlIdTrackNumber, KZero,
+    	KMPXSongDetailsTrackNumMin, KMPXSongDetailsTrackNumMax );
+
+    SetControlNumberL ( EMPXMetadataEditorDlgCtrlIdYear, KZero,
+    	KMPXSongDetailsYearMin, KMPXSongDetailsYearMax );
+
+    // Get media property for the current song
+    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL( cpath );
+    if ( iParam )
+        {
+        TLex yearLex( iParam->Des() );
+        TInt lexToInt = NULL;
+        if ( yearLex.Val( lexToInt ) == KErrNone )
+            {
+            cpath->Set( lexToInt );
+            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;
+            iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+            CleanupStack::PopAndDestroy( &attrs );
+            }
+        }
+    CleanupStack::PopAndDestroy( cpath );
+
+    // Podcasting is enabled
+    if ( !iDisablePodcasting )
+        {
+        iPopup = static_cast<CAknPopupField*>
+            ( ControlOrNull( EMPXMetadataEditorDlgCtrlIdLibrary ) );
+        iLibraryArr = new (ELeave) CDesCArrayFlat( 1 );
+        HBufC* custTxt = StringLoader::LoadLC( R_MPX_CUI_GENRE_SELECTION_MUSIC_TEXT );
+        iLibraryArr->AppendL( *custTxt );
+        CleanupStack::PopAndDestroy( custTxt );
+        custTxt = StringLoader::LoadLC( R_MPX_CUI_GENRE_SELECTION_PODCAST_TEXT );
+        iLibraryArr->AppendL( *custTxt );
+        CleanupStack::PopAndDestroy( custTxt );
+        iLibraryValueTextArray = CAknQueryValueTextArray::NewL();
+        iLibraryValueTextArray->SetArray( *iLibraryArr );
+        iLibraryTextValues = CAknQueryValueText::NewL();
+        iLibraryTextValues->SetArrayL( iLibraryValueTextArray );
+        iLibraryTextValues->SetCurrentValueIndex( iCurrentLibrary );
+        // Set values into popup fields
+        iPopup->SetQueryValueL( iLibraryTextValues ); // Moved up from below
+        }
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::PostLayoutDynInitL
+// Set default field value to member data.
+// ----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::PostLayoutDynInitL()
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::PostLayoutDynInitL" );
+    CAknForm::PostLayoutDynInitL();
+    SetEditableL( ETrue );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::SaveMediaPropertiesL
+// Saves media back to collection engine
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::SaveMediaPropertiesL( CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::SaveMediaPropertiesL" );
+    if ( iMedia->IsSupported( KMPXMediaGeneralUri ) )
+        {
+        aMedia->SetTextValueL(
+            KMPXMediaGeneralUri, iMedia->ValueText( KMPXMediaGeneralUri ) );
+        }
+
+    if ( iMedia->IsSupported( KMPXMediaGeneralType ) )
+        {
+        aMedia->SetTObjectValueL<TInt>(
+            KMPXMediaGeneralType, iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralType ) );
+        }
+
+    if ( iMedia->IsSupported( KMPXMediaGeneralCategory ) )
+        {
+        aMedia->SetTObjectValueL<TInt>(
+            KMPXMediaGeneralCategory,
+            iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralCategory ) );
+        }
+
+    if ( iMedia->IsSupported( KMPXMediaGeneralId ) )
+        {
+        aMedia->SetTObjectValueL<TMPXItemId>(
+            KMPXMediaGeneralId, iMedia->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+        }
+
+    if ( iMedia->IsSupported( KMPXMediaGeneralCollectionId ) )
+        {
+        aMedia->SetTObjectValueL<TUid>(
+            KMPXMediaGeneralCollectionId,
+            iMedia->ValueTObjectL<TUid>( KMPXMediaGeneralCollectionId ) );
+        }
+    
+    if ( iMedia->IsSupported( KMPXMediaMusicAlbumArtFileName ) )
+        {
+        aMedia->SetTextValueL(
+            KMPXMediaMusicAlbumArtFileName,
+            iMedia->ValueText( KMPXMediaMusicAlbumArtFileName ) );
+        }
+
+    // toggle the modified flag for the internal media reference
+    // or else any subsequent FindAllL calls won't be able to
+    // match against this object
+    iMedia->SetTObjectValueL<TBool>(KMPXMediaGeneralModified, ETrue);
+
+    // Set to collection via command
+    //
+    CMPXCommand* cmd = CMPXCommand::NewL();
+    CleanupStack::PushL( cmd );
+
+    cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet );
+    cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue );
+    TUid colId(iMedia->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId));
+    cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid );
+    cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColSetMedia, aMedia );
+
+    iCollectionUtility->Collection().CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::AppendStringToArrayL
+// Appends the value to the array, if the vaule has zero length,
+// appends "unavailable"
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::AppendStringToArrayL(
+    CDesCArrayFlat* aArray, const TDesC& aValue )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::AppendStringToArrayL" );
+    if ( aValue.Length() > 0 )
+        {
+        HBufC* stringBuf = HBufC::NewLC(
+            aValue.Length() + KMPXFileDetailsExtraBufferLen );
+        TPtr stringBufPtr = stringBuf->Des();
+        stringBufPtr.Append( aValue );
+        aArray->AppendL( stringBufPtr );
+        CleanupStack::PopAndDestroy( stringBuf );
+        }
+    else
+        {
+        aArray->AppendL( KNullDesC );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::SetControlTextL
+// Sets control text
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::SetControlTextL( TInt aControlId,
+    const TDesC& aValue, const TDesC& aAlternateValue )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::SetControlTextL" );
+    CEikEdwin* myEdwin = static_cast< CEikEdwin* >
+        ( ControlOrNull( aControlId ) );
+    if ( myEdwin )
+        {
+        if ( aValue.Length() > 0 )
+            {
+            myEdwin->SetTextL( &( aValue ) );
+            }
+        else if ( aAlternateValue.Length() > 0 )
+            {
+            myEdwin->SetTextL( &( aAlternateValue ) );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::SetControlNumberL
+// Sets control number
+// -----------------------------------------------------------------------------
+//
+void CMPXMetadataEditorDialog::SetControlNumberL( TInt aControlId,
+    const TDesC& aValue, TInt aMinValue, TInt aMaxValue )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::SetControlNumberL" );
+    CEikNumberEditor* myNumberEditor = static_cast< CEikNumberEditor* >
+        ( ControlOrNull( aControlId ) );
+
+    TInt defaultValue( 0 );
+    if ( aMinValue > 0  )
+        {
+        defaultValue = aMinValue;
+        }
+
+    if ( myNumberEditor )
+        {
+        if ( aValue.Length() > 0 )
+            {
+            TLex trackNumLex( aValue );
+            TInt LexToInt;
+            if ( trackNumLex.Val( LexToInt ) == KErrNone )
+                {
+                if ( LexToInt > aMaxValue )
+                    {
+                    LexToInt = aMaxValue;
+                    }
+                if ( LexToInt < aMinValue )
+                    {
+                    LexToInt = aMinValue;
+                    }
+                myNumberEditor->SetNumber( LexToInt );
+                }
+            else
+                {
+                myNumberEditor->SetNumber( defaultValue );
+                }
+            }
+        else
+            {
+            myNumberEditor->SetNumber( defaultValue );
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::PromptForLibraryChangeL
+// prompt user for library change
+// -----------------------------------------------------------------------------
+//
+TBool CMPXMetadataEditorDialog::PromptForLibraryChangeL( TInt aMoveToLibrary )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::PromptForLibraryChangeL" );
+    CMPXQueryDialog* confirmationDlg = CMPXQueryDialog::NewL();
+    CleanupStack::PushL( confirmationDlg );
+    HBufC* libraryName = NULL;
+    if ( aMoveToLibrary == EMPXMetadataEditorDlgCollection )
+        {
+        libraryName =
+            StringLoader::LoadLC( R_MPX_CUI_GENRE_SELECTION_MUSIC_TEXT );
+        }
+    else if ( aMoveToLibrary == EMPXMetadataEditorDlgPodcast )
+        {
+        libraryName =
+            StringLoader::LoadLC( R_MPX_CUI_GENRE_SELECTION_PODCAST_TEXT );
+        }
+    else
+        {
+        // should not reach here
+        User::Leave( KErrArgument );
+        }
+    HBufC* promptTxt = StringLoader::LoadLC(
+        R_MPX_CUI_QUERY_MOVE_TO_LIBRARY, libraryName->Des() );
+    confirmationDlg->SetPromptL( *promptTxt );
+    CleanupStack::PopAndDestroy( promptTxt );
+
+
+    confirmationDlg->PublishDialogL(
+        EMPlayerQueryMoveToLibrary,
+        KMPlayerNoteCategory);
+
+    CAknMediatorFacade* covercl(
+        AknMediatorFacade( confirmationDlg ) );
+    if ( covercl )
+        {
+        covercl->BufStream() << libraryName->Des();
+        }
+    CleanupStack::PopAndDestroy( libraryName );
+    CleanupStack::Pop( confirmationDlg );
+    return confirmationDlg->ExecuteLD( R_MPX_CUI_MOVE_TO_LIBRARY_CONFIRMATION_QUERY );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMetadataEditorDialog::UpdateMediaObjectWithControlL
+// Updates media object with current control text, this will also
+// update iMedia
+// -----------------------------------------------------------------------------
+//
+TBool CMPXMetadataEditorDialog::UpdateMediaObjectWithControlL(
+    TInt aControlId, CMPXMedia* aMedia, TMPXAttribute aAttribute )
+    {
+    MPX_FUNC( "CMPXMetadataEditorDialog::UpdateMediaObjectWithControlL" );
+    TBool ret = EFalse;
+    CCoeControl* coeControl = ControlOrNull( aControlId );
+    if ( coeControl )
+        {
+        HBufC* buf = NULL;
+        switch ( aControlId )
+            {
+            case EMPXMetadataEditorDlgCtrlIdSongName:
+            case EMPXMetadataEditorDlgCtrlIdArtist:
+            case EMPXMetadataEditorDlgCtrlIdAlbum:
+            case EMPXMetadataEditorDlgCtrlIdComment:
+            case EMPXMetadataEditorDlgCtrlIdComposer:
+                {
+                CEikEdwin* control = static_cast<CEikEdwin*>( coeControl );
+                if ( control )
+                    {
+                    buf = control->GetTextInHBufL();
+                    if ( !buf )
+                        {
+                        // the text contains nothing
+                        // special handling is needed for song name
+                        if ( aControlId == EMPXMetadataEditorDlgCtrlIdSongName && iMedia )
+                            {
+                            if ( iMedia->IsSupported( KMPXMediaGeneralUri ) )
+                                {
+                                // if URI is defined, use filename as song name
+                                TParsePtrC fn( iMedia->ValueText( KMPXMediaGeneralUri ) );
+                                buf = fn.Name().AllocL();
+                                }
+                            else
+                                {
+                                buf = HBufC::NewL( 0 );
+                                }
+                            }
+                        else
+                            {
+                            buf = HBufC::NewL( 0 );
+                            }
+                        }
+                    CleanupStack::PushL( buf );
+                    }
+                else
+                    {
+                    // should not reach here
+                    User::Leave( KErrArgument );
+                    }
+                break;
+                }
+            case EMPXMetadataEditorDlgCtrlIdTrackNumber:
+                {
+                CEikNumberEditor* control = static_cast<CEikNumberEditor*>( coeControl );
+                if ( control )
+                    {
+                    TInt num = control->Number();
+                    MPX_DEBUG2( "CMPXMetadataEditorDialog::UpdateMediaObjectWithControlL number from control %d", num );
+                    buf = HBufC::NewLC( KMPXFileDetailsMaxBufferLen );
+                    TPtr bufPtr = buf->Des();
+                    bufPtr.AppendNum( num );
+                    }
+                else
+                    {
+                    // should not reach here
+                    User::Leave( KErrArgument );
+                    }
+                break;
+                }
+            default:
+                {
+                // should not reach here
+                User::Leave( KErrArgument );
+                break;
+                }
+            }
+        if ( buf )
+            {
+            const TDesC& origValue = iMedia->ValueText( aAttribute );
+            if ( origValue.Compare( *buf ) != 0 )
+                {
+	                //check if the track number is actually changed
+	                if (aControlId == EMPXMetadataEditorDlgCtrlIdTrackNumber &&
+	                	origValue.Compare(_L("")) == 0 &&
+	                	buf->Compare(_L("0")) == 0)
+	                	{
+	                	//nothing to do
+	                	}
+	            	else
+	            		{
+		                ret = ETrue;
+		                iMedia->SetTextValueL( aAttribute , *buf );
+		                aMedia->SetTextValueL( aAttribute , *buf );
+	            		}
+                }
+            CleanupStack::PopAndDestroy( buf );
+            }
+        }
+    return ret;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/bwinscw/mpxpdplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewL@CMPXPdPlaybackView@@SAPAV1@XZ @ 1 NONAME ; class CMPXPdPlaybackView * CMPXPdPlaybackView::NewL(void)
+	?NewLC@CMPXPdPlaybackView@@SAPAV1@XZ @ 2 NONAME ; class CMPXPdPlaybackView * CMPXPdPlaybackView::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/data/mpxpdplaybackview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,185 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxpdplaybackview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MPPV // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+#include <mpxcommonplaybackview.mbg>
+#include <mpxcommonplaybackview.rsg>
+#include "mpxcommonplaybackview.hrh"
+#include <mpxcommonplaybackview.loc>
+#include <mpxpdplaybackview.loc>
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+// RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------------------------
+// r_mpx_pd_playback_view
+// Progressive Download Playback view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_mpx_pd_playback_view
+    {
+    menubar = r_mpx_pd_playback_view_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    toolbar = R_MPX_PBV_TOUCH_TOOLBAR;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pd_playback_view_menubar
+// Progressive Download Playback view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_pd_playback_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_pd_playback_view_menu;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pd_playback_view_menu
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_pd_playback_view_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdResumeDownload;
+            txt = qtn_mus_options_resume_dl;
+            },
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdCancelDownload;
+            txt = qtn_mus_options_cancel_dl;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdFMTransmitter;
+            txt = qtn_nmp_go_to_fm_transmitter;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_download_status_buffering
+//    Text used when download content is buffering.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_download_status_buffering
+    {
+    buf = qtn_music_shop_status_buffering;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_download_status_paused
+//    Text used when download content is paused.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_download_status_paused
+    {
+    buf = qtn_music_shop_downloadstatus_paused;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_download_status_completed
+//    Text used when download content is completed.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_download_status_completed
+    {
+    buf = qtn_music_shop_downloadstatus_completed;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_download_status_interrupted
+//    Text used when download content is interrupted.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_download_status_interrupted
+    {
+    buf = qtn_music_shop_downloadstatus_stopped;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_conf_cancel_download_txt
+//    Confirmation query text for canceling download.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_conf_cancel_download_txt
+    {
+    buf = qtn_musicshop_note_cancel;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_download_played_all_content
+//    Text used when all download content has been played
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_download_played_all_content
+    {
+    buf = qtn_musicshop_note_played_all_content;
+    }
+    
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/eabi/mpxpdplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_ZN18CMPXPdPlaybackView4NewLEv @ 1 NONAME
+	_ZN18CMPXPdPlaybackView5NewLCEv @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxpdplaybackview.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxpdplaybackview.loc	APP_LAYER_LOC_EXPORT_PATH(mpxpdplaybackview.loc)
+
+PRJ_MMPFILES
+mpxpdplaybackview.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/group/mpxpdplaybackview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxpdplaybackview.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxpdplaybackview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC9D
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxpdplaybackviewcontainer.cpp
+SOURCE          mpxpdplaybackview.cpp
+SOURCE          mpxpdplaybackviewimp.cpp
+SOURCE          mpxpdplaybackviewlayout.cpp
+
+START RESOURCE  ../data/mpxpdplaybackview.rss
+DEPENDS mpxcommonplaybackview.rsg
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         ws32.lib
+LIBRARY         fbscli.lib
+LIBRARY         bitgdi.lib
+LIBRARY         gdi.lib
+LIBRARY         egul.lib
+LIBRARY         eikctl.lib
+LIBRARY         eiksrv.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknicon.lib
+LIBRARY         featmgr.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknskinsrv.lib
+LIBRARY         commonengine.lib
+LIBRARY         centralrepository.lib
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         cdlengine.lib
+LIBRARY         estor.lib
+LIBRARY         ProfileEng.lib
+
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxmediakeyhandler.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcommonplaybackview.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/inc/mpxpdplaybackview.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxpdplaybackview
+*
+*/
+
+
+
+#ifndef MPXPDPLAYBACKVIEW_HLP_HRH
+#define MPXPDPLAYBACKVIEW_HLP_HRH
+
+_LIT( KMUS_HLP_EMBED_MUSIC_SHOP, "MUS_HLP_EMBED_MUSIC_SHOP" );
+
+#endif  // MPXPDPLAYBACKVIEW_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/inc/mpxpdplaybackview.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxpdplaybackview
+*
+*/
+
+
+
+#ifndef MPXPDPLAYBACKVIEW_HRH
+#define MPXPDPLAYBACKVIEW_HRH
+
+#define KMPXPdPlaybackViewId    0x101FFC9D
+
+#endif  // MPXPDPLAYBACKVIEW_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/inc/mpxpdplaybackviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Progressive Download playback view's container implementation.
+*
+*/
+
+
+
+#ifndef C_CMPXPDPLAYBACKVIEWCONTAINER_H
+#define C_CMPXPDPLAYBACKVIEWCONTAINER_H
+
+
+// INCLUDES
+#include <mpxplaybackcommanddefs.h>
+#include "mpxcommonplaybackviewcontainer.h"
+
+
+// FORWARD DECLARATIONS
+class MMPXLayoutSwitchObserver;
+class MMPXPlaybackViewLayout;
+
+// CLASS DECLARATION
+
+/**
+ *  Container class for audio view.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPdPlaybackViewContainer ) : public CMPXCommonPlaybackViewContainer
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     *
+     * @param aLayoutObserver    Observer to send layout switch events to.
+     * @param aLayout            Layout
+     */
+    CMPXPdPlaybackViewContainer(
+        MEikCommandObserver* aCommandObserver,
+        MMPXLayoutSwitchObserver* aLayoutObserver,
+        MMPXPlaybackViewLayout* aLayout );
+
+    /**
+     * Symbian 2nd phase constructor.
+     * 
+     * @param aRect Frame rectangle for container.
+     */
+    void ConstructL( const TRect& aRect );
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPdPlaybackViewContainer();
+
+    /**
+     * From MPXCommonPlaybackViewContainer and CCoeControl.
+     * Handle events from the touch screen. Overridden from Commonplayback view.
+     * PdPlaybackview does not utilise pointer events, since EMC doesn't support
+     * seeking from progressbar during progressive download.
+     * since 5.0
+     */
+    void HandlePointerEventL(const TPointerEvent& aPointerEvent); 
+    
+    /**
+     * Handles when the download position has changed
+     */
+    void HandleDownloadPositionChanged( 
+        TInt aDownloadedBytes, 
+        TInt aTotalBytes );
+
+// from MPXCommonPlaybackViewContainer
+    /**
+     * Redraw part of the screen to the bitmap context.
+     *
+     * @param aRect Area to be redrawn.
+     * @param aGc Graphics context to draw to.
+     */
+    void RedrawRect(
+        const TRect& aRect,
+        CBitmapContext& aGc) const;
+
+    /**
+     * Sets main pane mode.
+     *
+     * @since S60 3.0
+     * @param aMode Playback mode.
+     */
+    void SetMode( TMPXPbvPlaybackMode aMode );
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since S60 3.0
+     */
+    void UpdateLayout();
+    
+// from base class CoeControl
+
+    /**
+     * From CoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+    
+    };
+
+#endif  // C_CMPXPDPLAYBACKVIEWCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/inc/mpxpdplaybackviewimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,236 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Progressive Download playback view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXPDPLAYBACKVIEWIMP_H
+#define C_CMPXPDPLAYBACKVIEWIMP_H
+
+
+// INCLUDES
+#include <mpxplaybackcommanddefs.h>
+#include "mpxpdplaybackview.h"
+
+#include <akntoolbarobserver.h>
+// FORWARD DECLARATIONS
+class CMPXPdPlaybackViewContainer;
+class CMPXPdPlaybackViewLayout;
+
+class CAknToolbar;
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Progressive Download playback view.
+ *
+ *  @lib mpxpdplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPdPlaybackViewImp ) : public CMPXPdPlaybackView
+                                           ,public MAknToolbarObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPdPlaybackViewImp* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPdPlaybackViewImp* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPdPlaybackViewImp();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPdPlaybackViewImp();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Gets download information
+     */
+    void GetDownloadInformationL(
+        TUint& aTransactionId,
+        TMPXPlaybackPdDownloadState& aState,
+        TInt& aDownloadedBytes,
+        TInt& aTotalBytes );
+
+    /**
+    * This checks only two things:  Network available, Network Strength>none.
+    * @param: aCheck holds the UID of the failed check.
+    * @param: aState holds the state of the failed check.
+    * @return ETrue if network available and network strength
+    * is Low or Medium or High, otherwise return EFalse.
+    */
+    TBool CheckSignalAvailableL( TUid& aCheck, TInt& aState );
+
+
+	  /**
+     *  Handle playback property
+     *
+     *  @param aProperty the property
+     *  @param aValue the value of the property
+     *  @param aError error code
+     */
+    void DoHandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue,
+        TInt aError );
+
+// from base class CMPXCommonPlaybackViewImp
+    /**
+     *  Handle playback message
+     *
+     *  @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL(
+        const CMPXMessage& aMessage );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     *  @param aData Extra data parameter, used for any extra information
+     *               along with the state change message
+     */
+    void DoHandleStateChangedL(
+        TMPXPlaybackState aState,
+        TInt aData );
+
+    /**
+     * Updates download state label.
+     */
+    void UpdateDownloadStateLabelL();
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    void HandleErrorL( TInt aError );
+
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    void DynInitMenuPaneL(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Returns views id.
+     *
+     * @since 3.0
+     * @return Views Uid
+     */
+    TUid Id() const;
+
+    /**
+     * From CAknView
+     * Command handling function.
+     *
+     * @since 3.0
+     * @param aCommand Command which is handled
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Processes user commands.
+     *
+     * @since 3.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void ProcessCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Handles a view activation.
+     *
+     * @param aPrevViewId Specifies the view previously active.
+     * @param aCustomMessageId Specifies the message type.
+     * @param aCustomMessage The activation message.
+     */
+    void DoActivateL(
+        const TVwsViewId& aPrevViewId,
+        TUid aCustomMessageId,
+        const TDesC8& aCustomMessage );
+
+    /**
+     * From MAknToolbarObserver
+     * Processes user commands.
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void OfferToolbarEventL( TInt aCommandId );
+
+    /**
+     * From MAknToolbarObserver
+     * Used to change toolbar settings before it is made visible
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolBar );
+
+    /**
+    * Update the toolbar state
+    *
+    * @since 5.0
+    *
+    */
+	void UpdateToolbar();
+
+private:    // data
+    CMPXPdPlaybackViewLayout* iPlaybackViewLayout;    // owned
+    TInt iPdResourceOffset;       // must be freed
+    TMPXPlaybackPdDownloadState iDownloadState;
+    TInt iTotalBytes;
+    CAknToolbar* iToolbar; //owned
+    };
+
+#endif  // C_CMPXPLAYBACKVIEWIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/inc/mpxpdplaybackviewlayout.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  An interface providing skin and layout data for 
+*                Progressive Download playback view.
+*
+*/
+
+
+#ifndef C_CMPXPDPLAYBACKVIEWLAYOUT_H
+#define C_CMPXPDPLAYBACKVIEWLAYOUT_H
+
+//  INCLUDES
+#include "mpxcommonplaybackviewlayout.h"
+
+// CLASS DECLARATION
+
+/**
+*  An interface providing skin and layout data for playback view.
+*
+*  @lib mpxpdplaybackview.dll
+*  @since S60 v3.0
+*/
+NONSHARABLE_CLASS( CMPXPdPlaybackViewLayout ) : public CMPXCommonPlaybackViewLayout
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPdPlaybackViewLayout* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPdPlaybackViewLayout* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPdPlaybackViewLayout();
+       
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPdPlaybackViewLayout();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXPDPLAYBACKVIEWLAYOUT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/loc/mpxpdplaybackview.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxpdplaybackview
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Options menu item for cancelling a progressive download.
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_options_cancel_dl "Cancel download"
+
+// d:Options menu item for resuming a paused progressive download.
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_options_resume_dl "Resume download"
+
+// d:A string in the main pane.
+// d:Shown in progresive playback view when content is buffering.
+// l:mup3_progress_pane_t3
+// r:3.1
+//
+#define qtn_music_shop_status_buffering "Buffering..."
+
+// d:A string in the main pane.
+// d:Shown in progresive playback view when download is paused.
+// l:mup3_progress_pane_t3
+// r:3.1
+//
+#define qtn_music_shop_downloadstatus_paused "Download paused"
+
+// d:A string in the main pane.
+// d:Shown in progresive playback view when download is completed.
+// l:mup3_progress_pane_t3
+// r:3.1
+//
+#define qtn_music_shop_downloadstatus_completed "Download completed"
+
+// d:A string in the main pane.
+// d:Shown in progresive playback view when download is interrupted.
+// l:mup3_progress_pane_t3
+// r:3.1
+//
+#define qtn_music_shop_downloadstatus_stopped "Download stopped"
+
+// d:Confirmation query, yes or no to cancel downloading
+// d:If yes is selected, MusicShop will cancel the download and it cannot be resumed
+// l:popup_note_window
+// r:3.1
+//
+#define qtn_musicshop_note_cancel "Unable to resume download after cancelling. Cancel anyway?"
+
+// d:Information note text
+// d:Display when progressive download is paused and playback reaches
+// d:the end of the partially download file.
+// l:popup_note_window
+// r:3.1
+//
+#define qtn_musicshop_note_played_all_content "All downloaded content has been played."
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/src/mpxpdplaybackview.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Progressive Download Playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxpdplaybackview.h"
+#include "mpxpdplaybackviewimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXPdPlaybackView* CMPXPdPlaybackView::NewL()
+    {
+    return CMPXPdPlaybackViewImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXPdPlaybackView* CMPXPdPlaybackView::NewLC()
+    {
+    return CMPXPdPlaybackViewImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackView::~CMPXPdPlaybackView()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/src/mpxpdplaybackviewcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,207 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Progressive Download Playback view's container.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <AknDef.h>
+#include <gulicon.h>
+
+#include "mpxconstants.h"
+#include "mpxpdplaybackview.hlp.hrh"
+#include "mpxplaybackviewinfolabel.h"
+#include "mpxpdplaybackviewcontainer.h"
+#include "mpxplaybackviewlayoutinterface.h"
+#include "mpxlog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewContainer::CMPXPdPlaybackViewContainer(
+    MEikCommandObserver* aCommandObserver,
+    MMPXLayoutSwitchObserver* aLayoutObserver,
+    MMPXPlaybackViewLayout* aLayout )
+    {
+    iCommandObserver = aCommandObserver;
+    iLayoutObserver = aLayoutObserver;
+    iMode = EUninitialized;
+    iLayout = aLayout;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewContainer::ConstructL( const TRect& aRect )
+    {
+    MPX_DEBUG1( "CMPXPdPlaybackViewContainer::ConstructL() entering" );
+    
+    CMPXCommonPlaybackViewContainer::ConstructL( aRect );
+
+    MPX_DEBUG1( "CMPXPdPlaybackViewContainer::ConstructL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewContainer::~CMPXPdPlaybackViewContainer()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXPdPlaybackViewContainer::HandlePointerEventL
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
+	{
+	//Handles the touch events, except for sliderpane.
+	if ( (!iSliderPaneRect.Contains(aPointerEvent.iPosition) ) )
+		{
+		CMPXCommonPlaybackViewContainer::HandlePointerEventL(aPointerEvent);
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// Handles when the download position has changed
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewContainer::HandleDownloadPositionChanged(
+    TInt aDownloadedBytes, 
+    TInt aTotalBytes )
+    {
+    MPX_DEBUG3("CMPXPdPlaybackViewContainer::HandleDownloadPositionChanged(%d, %d) entering", 
+                aDownloadedBytes, 
+                aTotalBytes);
+    
+    if (aTotalBytes)
+        {
+        TReal t = aTotalBytes;
+        iDownloadRatio = aDownloadedBytes / t;
+        
+        RefreshProgressBar();
+        }    
+    
+    MPX_DEBUG1("CMPXPdPlaybackViewContainer::HandleDownloadPositionChanged() exiting");    
+    }
+
+// ---------------------------------------------------------------------------
+// Redraw part of the screen.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewContainer::RedrawRect(
+    const TRect& aRect,
+    CBitmapContext& aGc) const
+    {
+    MPX_DEBUG1("CMPXPdPlaybackViewContainer::RedrawRect() entering");
+    
+    CMPXCommonPlaybackViewContainer::RedrawRect( aRect, aGc );
+    
+    // Always show progress bars in progressive download
+    DrawIndicator( aGc, aRect, iSliderBackgroundRect, iSliderBackground );
+    DrawIndicator( aGc, 
+                   aRect,
+                   TRect(iDownloadSliderRect.iTl,
+                         iDownloadSlider->Bitmap()->SizeInPixels()),
+                   iDownloadSlider );
+    DrawIndicator( aGc, 
+                   aRect, 
+                   TRect(iPlaybackSliderRect.iTl,
+                         iPlaybackSlider->Bitmap()->SizeInPixels()),
+                   iPlaybackSlider );
+    
+    MPX_DEBUG1("CMPXPdPlaybackViewContainer::RedrawRect() exiting");    
+    }
+
+// ---------------------------------------------------------------------------
+// Sets main pane mode.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewContainer::SetMode( TMPXPbvPlaybackMode aMode )
+    {
+    MPX_DEBUG2("CMPXPdPlaybackViewContainer::SetMode(%d) entering", aMode);
+    
+    CMPXCommonPlaybackViewContainer::SetMode( aMode );
+
+    if ( ENoTracksMode != aMode )
+        {
+        iLabels[ETextArtist]->MakeVisible( ETrue );
+        iLabels[ETextTrack]->MakeVisible( ETrue );
+
+        // Make sure download label is visible all the time
+        iLabels[ETextDownloadState]->MakeVisible( ETrue );
+
+        // Make sure album art is visible all the time
+        iDisplayAlbumArt = ETrue;
+        }
+    
+    MPX_DEBUG1("CMPXPdPlaybackViewContainer::SetMode() exiting");    
+    }
+    
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewContainer::UpdateLayout()
+    {
+    MPX_DEBUG1( "CMPXPdPlaybackViewContainer::UpdateLayout() entering" );
+    
+    CMPXCommonPlaybackViewContainer::UpdateLayout();
+
+    MPX_DEBUG1( "CMPXPdPlaybackViewContainer::UpdateLayout() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXPdPlaybackViewContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG4( "CMPXPdPlaybackViewContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)", 
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+    // No action for rocker left and right keys in progress download view
+    if (aKeyEvent.iScanCode == EStdKeyLeftArrow || 
+    	aKeyEvent.iScanCode == EStdKeyRightArrow ) 
+    	{
+    	return EKeyWasConsumed;
+    	}
+    return CMPXCommonPlaybackViewContainer::OfferKeyEventL( aKeyEvent, aType );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewContainer::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KAppUidMusicPlayerX;  
+    aContext.iContext = KMUS_HLP_EMBED_MUSIC_SHOP; 
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/src/mpxpdplaybackviewimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,784 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Progressive Download Playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <eikmenub.h>
+#include <eikapp.h>
+#include <AknUtils.h>
+#include <bautils.h>
+#include <featmgr.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxplaybackmessage.h>
+#include <mpxcommonplaybackview.rsg>
+#include <mpxpdplaybackview.rsg>
+#include <mpxcmn.h>
+#include <mpxplaybackutility.h>
+#include <mpxviewutility.h>
+#include <StringLoader.h>
+#include <AknQueryDialog.h>
+#include <MProfileEngine.h>
+#include <e32property.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxuser.h>
+#include <sacls.h>
+
+#include "mpxcommonuihelper.h"
+#include "mpxcommonplaybackview.hrh"
+#include "mpxpdplaybackview.hrh"
+#include "mpxpdplaybackviewimp.h"
+#include "mpxpdplaybackviewcontainer.h"
+#include "mpxpdplaybackviewlayout.h"
+#include "mpxlog.h"
+
+#include <mpxplaybackutility.h>
+#include <akntoolbar.h>
+#include <aknbutton.h>
+// CONSTANTS
+_LIT( KMPXPdPlaybackRscPath, "mpxpdplaybackview.rsc" );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewImp::CMPXPdPlaybackViewImp()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::ConstructL()
+    {
+    MPX_FUNC( "CMPXPdPlaybackViewImp::ConstructL" );
+
+    CMPXCommonPlaybackViewImp::ConstructL();
+
+    // Need to set a higher priority because download manager sets it's
+    // own priority high, so we need to make sure we're at least the same
+    iPlaybackUtility->SetPriority( CActive::EPriorityStandard + 2 );
+
+    CCoeEnv* coeEnv = iEikonEnv;
+    TParse parse;
+    parse.Set( KMPXPdPlaybackRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile = parse.FullName();
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iPdResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    BaseConstructL( R_MPX_PD_PLAYBACK_VIEW );
+    if(AknLayoutUtils::PenEnabled())
+    {
+    CAknView::ShowToolbarOnViewActivation(ETrue);
+    if ( Toolbar() )
+        {
+        iToolbar = Toolbar();
+        iToolbar->SetToolbarObserver( this );
+        }
+    }
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewImp* CMPXPdPlaybackViewImp::NewL()
+    {
+    CMPXPdPlaybackViewImp* self = CMPXPdPlaybackViewImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewImp* CMPXPdPlaybackViewImp::NewLC()
+    {
+    CMPXPdPlaybackViewImp* self = new ( ELeave ) CMPXPdPlaybackViewImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewImp::~CMPXPdPlaybackViewImp()
+    {
+    MPX_DEBUG1( "CMPXPdPlaybackViewImp::~CMPXPdPlaybackViewImp entering" );
+
+    delete iPlaybackViewLayout;
+
+    if ( iPdResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iPdResourceOffset );
+        }
+
+    MPX_DEBUG1( "CMPXPdPlaybackViewImp::~CMPXPdPlaybackViewImp exiting" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Gets download information
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::GetDownloadInformationL(
+        TUint& aTransactionId,
+        TMPXPlaybackPdDownloadState& aState,
+        TInt& aDownloadedBytes,
+        TInt& aTotalBytes )
+    {
+    MPX_DEBUG1("CMPXPdPlaybackViewImp::GetDownloadInformationL() entering");
+
+    // Create the command to send to MPX
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackPD );
+    cmd->SetTObjectValueL<TMPXPlaybackPdCommand>( KMPXCommandPlaybackGeneralType, EPbCmdGetPdStatus );
+    iPlaybackUtility->CommandL( *cmd );
+
+    // Check that return values were provided, if not, playback plugin is messed up.
+    if ( !cmd->IsSupported( KMPXCommandPlaybackPDTransactionID ) ||
+            !cmd->IsSupported( KMPXCommandPlaybackPDState ) ||
+            !cmd->IsSupported( KMPXCommandPlaybackPDDownloadedBytes ) ||
+            !cmd->IsSupported( KMPXCommandPlaybackPDTotalBytes ) )
+        {
+        aState = EPbDlStateDownloadError;
+        CleanupStack::PopAndDestroy( cmd );
+        MPX_DEBUG1("CMPXPdPlaybackViewImp::GetDownloadInformationL() Error in Command info");
+        return;
+        }
+
+    // Copy the return values
+    aTransactionId = cmd->ValueTObjectL<TUint>( KMPXCommandPlaybackPDTransactionID );
+    aState = cmd->ValueTObjectL<TMPXPlaybackPdDownloadState>( KMPXCommandPlaybackPDState );
+    aDownloadedBytes = cmd->ValueTObjectL<TInt>( KMPXCommandPlaybackPDDownloadedBytes );
+    aTotalBytes = cmd->ValueTObjectL<TInt>( KMPXCommandPlaybackPDTotalBytes );
+    CleanupStack::PopAndDestroy( cmd );
+
+    MPX_DEBUG1("CMPXPdPlaybackViewImp::GetDownloadInformationL() exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPdPlaybackViewImp::CheckSignalAvailableL
+// This checks for Network available, and Network Strength > none.
+// - Return ETrue if network available and network strength
+// is Low or Medium or High, otherwise return EFalse.
+// -----------------------------------------------------------------------------
+//
+TBool CMPXPdPlaybackViewImp::CheckSignalAvailableL( TUid& aCheck, TInt& aState )
+    {
+    TBool ret( ETrue );
+
+    // Check the network is available.
+    aCheck = KUidNetworkStatus;
+    TInt err( RProperty::Get( KUidSystemCategory, KUidNetworkStatusValue, aState ));
+    if ( err != KErrNone )
+        {
+        aState = ESANetworkUnAvailable;
+        }
+    if( aState != ESANetworkAvailable )
+        {
+        ret = EFalse;
+        }
+
+    // Check network coverage.
+    aCheck = KUidNetworkStrength;
+    err = RProperty::Get( KUidSystemCategory, KUidNetworkStrengthValue, aState );
+    if ( err != KErrNone )
+        {
+        aState = ESANetworkStrengthUnknown;
+        }
+    if( aState != ESANetworkStrengthLow &&
+        aState != ESANetworkStrengthMedium &&
+        aState != ESANetworkStrengthHigh )
+        {
+        ret = EFalse;
+        }
+
+    //passed all tests, OK to send
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "-->CMPXPdPlaybackViewImp::DoHandlePlaybackMessageL" );
+
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        MPX_DEBUG2( "CMPXPdPlaybackViewImp::DoHandlePlaybackMessageL type = %d", type );
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EDownloadPositionChanged:
+                {
+                if ( iContainer )
+                    {
+                    MPX_DEBUG2( "CMPXPdPlaybackViewImp::DoHandlePlaybackMessageL - EDownloadPositionChanged(%d)", data );
+                    CMPXPdPlaybackViewContainer* container =
+                        static_cast<CMPXPdPlaybackViewContainer*>(iContainer);
+                    container->HandleDownloadPositionChanged( data, iTotalBytes );
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::EDownloadStateChanged:
+                {
+                MPX_DEBUG2( "CMPXPdPlaybackViewImp::DoHandlePlaybackMessageL - EDownloadStateChanged(%d)", data );
+                iDownloadState = static_cast<TMPXPlaybackPdDownloadState>( data );
+                if ( iDownloadState == EPbDlStateDownloading ||
+                     iDownloadState == EPbDlStateDownloadCompleted )
+                    {
+                    RequestMediaL();
+                    }
+                if( iContainer && iDownloadState == EPbDlStateDownloadCompleted )
+                    {
+                    CMPXPdPlaybackViewContainer* container =
+                        static_cast<CMPXPdPlaybackViewContainer*>(iContainer);
+                    container->HandleDownloadPositionChanged( iTotalBytes, iTotalBytes );
+                    }
+                UpdateViewL();
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                MPX_DEBUG2( "CMPXPdPlaybackViewImp::DoHandlePlaybackMessageL - EStateChanged(%d)", type );
+
+                UpdateMiddleSoftKeyDisplayL();
+                UpdateToolbar();
+                TMPXPlaybackState state =
+                    static_cast<TMPXPlaybackState>( type );
+                DoHandleStateChangedL( state, data );
+                break;
+                }
+            case TMPXPlaybackMessage::EDownloadStarted:
+                {
+                iTotalBytes = aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData );
+                MPX_DEBUG2( "CMPXPdPlaybackViewImp::DoHandlePlaybackMessageL - DownloadStarted, totalBytes = %d", iTotalBytes );
+                break;
+                }
+            default:
+                {
+                CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL( aMessage );
+                break;
+                }
+            }
+        }
+    MPX_DEBUG1("<--CMPXPdPlaybackViewImp::DoHandlePlaybackMessageL()");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::DoHandleStateChangedL(
+    TMPXPlaybackState aState,
+    TInt aData )
+    {
+    MPX_DEBUG2( "CMPXPdPlaybackViewImp::DoHandleStateChangedL(%d)", aState );
+
+    switch ( aState )
+        {
+        case EPbStateInitialising:
+            {
+            UpdatePlaybackState( aState );
+            UpdateDownloadStateLabelL();
+            RequestMediaL();
+            break;
+            }
+        case EPbStatePaused:
+            {
+            //Show the note only when all content played (disconnected and buffer empty), not on user Pause.
+            if ( iContainer && KErrUnderflow == aData && EPbDlStateDownloadPaused == iDownloadState )
+                {
+                iCommonUiHelper->DisplayInfoNoteL( R_MPX_DOWNLOAD_PLAYED_ALL_CONTENT );
+                }
+            // fall through on purpose
+            }
+        default:
+            {
+            CMPXCommonPlaybackViewImp::DoHandleStateChangedL( aState, aData );
+            break;
+            }
+        }
+    MPX_DEBUG1("CMPXPdPlaybackViewImp::DoHandleStateChangedL()");
+    }
+
+// ---------------------------------------------------------------------------
+// Updates download state label.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::UpdateDownloadStateLabelL()
+    {
+    MPX_DEBUG1("CMPXPdPlaybackViewImp::UpdateDownloadStateLabelL() entering");
+
+    if ( iContainer && !iSwitchingView )
+        {
+        TInt resId = KErrNotFound;
+        switch ( iDownloadState )
+            {
+            case EPbDlStateBuffering:
+                {
+                MPX_DEBUG1("CMPlayerPlaybackContainer::UpdateDownloadStateLabelL() - Buffering");
+                resId = R_MPX_DOWNLOAD_STATUS_BUFFERING;
+                break;
+                }
+            case EPbDlStateDownloadPaused:
+                {
+                // If offline mode, this case will be entered.
+                resId = R_MPX_DOWNLOAD_STATUS_PAUSED;
+                TBool offLine( EFalse );
+
+                // Check profile, display "Download Stopped" if
+                // Offline enabled.
+                MProfileEngine* profileEngine( CreateProfileEngineL() );
+
+                if ( profileEngine->ActiveProfileId() == EProfileOffLineId )
+                    {
+                    MPX_DEBUG1("CMPXPdPlaybackViewImp::UpdateDownloadStateLabelL() -- OffLine ");
+                    offLine = ETrue;
+                    resId = R_MPX_DOWNLOAD_STATUS_INTERRUPTED;
+                    }
+                profileEngine->Release();
+
+                if ( !offLine )
+                    {
+                    // Check network coverage, display "Download Stopped" if
+                    // No coverage.
+                    TUid uid;
+                    TInt res( 0 );
+                    TBool signalAvailable( CheckSignalAvailableL( uid, res ));
+
+                    if ( !signalAvailable )
+                        {
+                        MPX_DEBUG1("CMPXPdPlaybackViewImp::UpdateDownloadStateLabelL() -- No Signal ");
+                        resId = R_MPX_DOWNLOAD_STATUS_INTERRUPTED;
+                        }
+                    }
+                break;
+                }
+            case EPbDlStateDownloadError:
+            case EPbDlStateDownloadCanceled:
+            case EPbDlStateNotDownloading:
+                {
+                MPX_DEBUG1("CMPlayerPlaybackContainer::UpdateDownloadStateLabelL() - Download Canceled");
+                resId = R_MPX_DOWNLOAD_STATUS_INTERRUPTED;
+                break;
+                }
+            case EPbDlStateDownloadCompleted:
+                {
+                MPX_DEBUG1("CMPlayerPlaybackContainer::UpdateDownloadStateLabelL() - Download Completed");
+                resId = R_MPX_DOWNLOAD_STATUS_COMPLETED;
+                break;
+                }
+            case EPbDlStateDownloading:
+            default:
+                {
+                MPX_DEBUG2(" default state: %d", iDownloadState );
+                // Do nothing
+                break;
+                }
+            }
+/*
+        // Display Album art in progressive download
+        if( iActualAlbumArtBitmap )
+            {
+            MPX_DEBUG1("CMPlayerPlaybackContainer::UpdateDownloadStateLabelL() - Draw ActualAlbumArt");
+            iAlbumArtBitmap = iActualAlbumArtBitmap;
+            DrawNow();
+            }
+        else
+            {
+            MPX_DEBUG1("CMPlayerPlaybackContainer::UpdateDownloadStateLabelL() - Draw DefaultAlbumArt");
+            // Display default Album Art
+            iAlbumArtBitmap = iDefaultAlbumArtBitmap;
+            DrawNow();
+            }
+*/
+
+        if (resId != KErrNotFound)
+            {
+            // Display download status text
+            HBufC* statusText = StringLoader::LoadLC( resId );
+            iContainer->UpdateLabelL( ETextDownloadState, *statusText );
+            CleanupStack::PopAndDestroy( statusText );
+            }
+        else
+            {
+            // Clear download status text
+            iContainer->UpdateLabelL( ETextDownloadState, KNullDesC );
+            }
+        }
+
+    MPX_DEBUG1("CMPXPdPlaybackViewImp::UpdateDownloadStateLabelL() exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::HandleErrorL( TInt aError )
+    {
+    MPX_DEBUG2("CMPXPdPlaybackViewImp::HandleErrorL(%d): Entering", aError);
+    if ( aError )
+        {
+        TUint transactionId(0);
+        TMPXPlaybackPdDownloadState state( EPbDlStateNotDownloading );
+        TInt downloadedBytes(0);
+        TInt totalBytes(0);
+        GetDownloadInformationL( transactionId,
+                                 state,
+                                 downloadedBytes,
+                                 totalBytes );
+        if ( EPbDlStateBuffering == state ||
+             EPbDlStateDownloading == state ||
+             EPbDlStateDownloadPaused == state )
+            {
+            CMPXCommand* cmd( CMPXCommand::NewL() );
+            CleanupStack::PushL( cmd );
+            cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+            cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackPD );
+            cmd->SetTObjectValueL<TMPXPlaybackPdCommand>(
+                KMPXCommandPlaybackGeneralType,
+                EPbCmdCancelPd );
+            iPlaybackUtility->CommandL( *cmd );
+            CleanupStack::PopAndDestroy( cmd );
+            }
+        iCommonUiHelper->HandleErrorL( aError );
+        CMPXCommonPlaybackViewImp::HandleCommandL( EAknSoftkeyBack );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    MPX_DEBUG2("CMPXPdPlaybackViewImp::DynInitMenuPaneL(%d): entering", aResourceId);
+
+    // Override base menu actions
+    switch ( aResourceId )
+        {
+        case R_MPX_PD_PLAYBACK_VIEW_MENU:
+            {
+            aMenuPane->SetItemDimmed(
+                EMPXPbvCmdResumeDownload,
+                iDownloadState != EPbDlStateDownloadPaused);
+            aMenuPane->SetItemDimmed(
+                EMPXPbvCmdCancelDownload,
+                iDownloadState != EPbDlStateDownloading &&
+                iDownloadState != EPbDlStateBuffering &&
+                iDownloadState != EPbDlStateDownloadPaused);
+
+			// Check if FM Transmitter is supported
+			if ( !FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+				{
+				aMenuPane->SetItemDimmed(
+					EMPXPbvCmdFMTransmitter,
+					ETrue );
+				}
+            break;
+            }
+        default:
+            {
+            // Call base clase to handle most cases
+            CMPXCommonPlaybackViewImp::DynInitMenuPaneL( aResourceId, aMenuPane );
+            break;
+            }
+        }
+
+    MPX_DEBUG1("CMPXPdPlaybackViewImp::DynInitMenuPaneL(): exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Command handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::HandleCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2("CMPXPdPlaybackViewImp::HandleCommandL(%d) entering", aCommand);
+
+    switch (aCommand)
+        {
+        case EMPXPbvCmdResumeDownload:
+            {
+            if ( EPbDlStateDownloadPaused == iDownloadState )
+                {
+                CMPXCommand* cmd( CMPXCommand::NewL() );
+                CleanupStack::PushL( cmd );
+                cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+                cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackPD );
+                cmd->SetTObjectValueL<TMPXPlaybackPdCommand>(
+                    KMPXCommandPlaybackGeneralType,
+                    EPbCmdResumePd );
+                iPlaybackUtility->CommandL( *cmd );
+                CleanupStack::PopAndDestroy( cmd );
+                }
+            break;
+            }
+        case EMPXPbvCmdCancelDownload:
+            {
+            if ( EPbDlStateDownloading == iDownloadState ||
+                 EPbDlStateBuffering == iDownloadState ||
+                 EPbDlStateDownloadPaused == iDownloadState )
+                {
+                HBufC* queryTxt = StringLoader::LoadLC( R_MPX_CONF_CANCEL_DOWNLOAD_TXT );
+                CAknQueryDialog* query = CAknQueryDialog::NewL(
+                                            CAknQueryDialog::EConfirmationTone );
+
+/* TODO: add when we support cover UI
+                query->PublishDialogL(
+                        EMPXNoteMusicshopCancel,
+*/
+
+                if ( query->ExecuteLD(
+                        R_MPX_GENERIC_CONFIRMATION_QUERY,
+                        *queryTxt ))
+                    {
+                    iPlaybackUtility->CommandL( EPbCmdClose );
+                    CMPXCommand* cmd( CMPXCommand::NewL() );
+                    CleanupStack::PushL( cmd );
+                    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+                    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackPD );
+                    cmd->SetTObjectValueL<TMPXPlaybackPdCommand>(
+                        KMPXCommandPlaybackGeneralType,
+                        EPbCmdCancelPd );
+                    iPlaybackUtility->CommandL( *cmd );
+                    CleanupStack::PopAndDestroy( cmd );
+
+                    // Close PD view and go back to host application
+                    AppUi()->HandleCommandL( EAknSoftkeyBack );
+                    }
+                }
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            TUint ignore1(0);
+            TMPXPlaybackPdDownloadState state( EPbDlStateNotDownloading );
+            TInt ignore2(0);
+
+            GetDownloadInformationL( ignore1,
+                                     state,
+                                     ignore2,
+                                     ignore2);
+            if ( EPbDlStateDownloadCompleted == state &&
+                 ( EPbStatePaused == iPlaybackState ||
+                   EPbStateStopped == iPlaybackState ))
+                {
+                CMPXCommand* cmd( CMPXCommand::NewL() );
+                CleanupStack::PushL( cmd );
+                cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+                cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackPD );
+                cmd->SetTObjectValueL<TMPXPlaybackPdCommand>(
+                    KMPXCommandPlaybackGeneralType,
+                    EPbCmdFinishPd );
+                iPlaybackUtility->CommandL( *cmd );
+                CleanupStack::PopAndDestroy( cmd );
+                }
+            }   // fall through
+        default:
+            {
+            CMPXCommonPlaybackViewImp::HandleCommandL( aCommand );
+            break;
+            }
+        }
+
+    MPX_DEBUG1("CMPXPdPlaybackViewImp::HandleCommandL() exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::DoHandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXPdPlaybackViewImp::DoHandlePropertyL" );
+    MPX_DEBUG4( "HandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError );
+
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty  )
+            {
+            case EPbPropertyRandomMode:
+            case EPbPropertyRepeatMode:
+            // ignore these cases in PD
+                break;
+            default:
+                {
+                CMPXCommonPlaybackViewImp::DoHandlePropertyL(aProperty,aValue,aError);
+                break;
+                }
+            }
+        }
+    else
+        {
+        HandleErrorL( aError );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Returns views id.
+// ---------------------------------------------------------------------------
+//
+TUid CMPXPdPlaybackViewImp::Id() const
+    {
+    return TUid::Uid( KMPXPdPlaybackViewId );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Processes user commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::ProcessCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2("CMPXPdPlaybackViewImp::ProcessCommandL(%d): entering", aCommand);
+    if ( aCommand == EAknCmdExit )
+        {
+        if ( MenuBar() )
+            {
+            MenuBar()->StopDisplayingMenuBar();
+            }
+        }
+    CAknView::ProcessCommandL( aCommand );
+    MPX_DEBUG1("CMPXPdPlaybackViewImp::ProcessCommandL(): exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Handles a view activation.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::DoActivateL(
+    const TVwsViewId& aPrevViewId,
+    TUid aCustomMessageId,
+    const TDesC8& aCustomMessage )
+    {
+    MPX_FUNC( "CMPXPdPlaybackViewImp::DoActivateL()" );
+
+    if ( !iContainer )
+        {
+        if ( !iPlaybackViewLayout )
+            {
+            iPlaybackViewLayout = CMPXPdPlaybackViewLayout::NewL();
+            }
+        iContainer = new ( ELeave ) CMPXPdPlaybackViewContainer(
+            this,
+            this,
+            iPlaybackViewLayout );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( ClientRect() );
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    CMPXCommonPlaybackViewImp::DoActivateL( aPrevViewId , aCustomMessageId, aCustomMessage );
+    UpdateMiddleSoftKeyDisplayL();
+    }
+
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Used to change toolbar settings before toolbar becomes visible
+// -----------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::DynInitToolbarL(TInt aResourceId, CAknToolbar* aToolbar)
+    {
+    if(aResourceId == R_MPX_PBV_TOUCH_TOOLBAR)
+        {
+        // Put initializations here to take effect before toolbar is shown
+        aToolbar->SetItemDimmed( EMPXPbvCmdPreviousListItem, ETrue, EFalse );
+        aToolbar->SetItemDimmed( EMPXPbvCmdNextListItem, ETrue, EFalse );
+        UpdateToolbar();
+        aToolbar->UpdateBackground();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Handles toolbar events
+// -----------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::OfferToolbarEventL( TInt aCommandId )
+    {
+    CAknView::ProcessCommandL( aCommandId );
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the middle toolbar button
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewImp::UpdateToolbar()
+    {
+    MPX_FUNC( "CMPXPdPlaybackViewImp::UpdateToolbar" );
+
+    if ( AknLayoutUtils::PenEnabled() && Toolbar())
+        {
+        CAknToolbar* toolbar = Toolbar();
+        TBool pausePlayDimmed(ETrue);
+        MMPXSource* s = iPlaybackUtility->Source();
+        if ( s )
+            {
+            TMPXPlaybackState state = iPlaybackUtility->StateL();
+            CAknButton* pausePlayControl;
+            pausePlayControl = (CAknButton*)(toolbar->ComponentControl( 1 ));
+            if ((state == EPbStateInitialising) || (state == EPbStatePlaying))
+                {
+                pausePlayControl->SetCurrentState(0, ETrue);
+                }
+            else
+                {
+                pausePlayControl->SetCurrentState(1, ETrue);
+                }
+            if ( state == EPbStatePlaying ||
+                    state == EPbStatePaused ||
+                    state == EPbStateStopped )
+                {
+                pausePlayDimmed = EFalse;
+                }
+            }
+        toolbar->SetItemDimmed( EMPXPbvCmdPlayPause, pausePlayDimmed, ETrue );
+        }
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdplaybackview/src/mpxpdplaybackviewlayout.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Layout and graphic factory for Progressive Download Playback View
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <barsread.h>
+#include <gulicon.h>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <layoutmetadata.cdl.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxpdplaybackview.rsg>
+#include <centralrepository.h>
+#include <mpxinternalcrkeys.h>
+#include <mpxlbxextendedfeatures.h>
+
+#include "mpxpdplaybackviewlayout.h"
+#include "mpxlog.h"
+
+using namespace AknLayoutScalable_Apps;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewLayout* CMPXPdPlaybackViewLayout::NewL()
+    {
+    CMPXPdPlaybackViewLayout* self = CMPXPdPlaybackViewLayout::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewLayout* CMPXPdPlaybackViewLayout::NewLC()
+    {
+    CMPXPdPlaybackViewLayout* self = new ( ELeave ) CMPXPdPlaybackViewLayout();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewLayout::~CMPXPdPlaybackViewLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPdPlaybackViewLayout::CMPXPdPlaybackViewLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdPlaybackViewLayout::ConstructL()
+    {
+    MPX_FUNC( "CMPXPdPlaybackViewLayout::ConstructL" );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/bwinscw/mpxpdsbplaybackviewu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewL@CMPXPdSbPlaybackView@@SAPAV1@XZ @ 1 NONAME ; class CMPXPdSbPlaybackView * CMPXPdSbPlaybackView::NewL(void)
+	?NewLC@CMPXPdSbPlaybackView@@SAPAV1@XZ @ 2 NONAME ; class CMPXPdSbPlaybackView * CMPXPdSbPlaybackView::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/data/mpxpdsbplaybackview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxpdsbplaybackview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MPPV // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+#include <mpxcommonplaybackview.mbg>
+
+#include <AiwCommon.hrh>
+#include <AiwCommon.rh>
+#include <mpxcommonplaybackview.rsg>
+#include "mpxcommonplaybackview.hrh"
+#include "mpxpdsbplaybackview.hrh"
+#include <mpxcommonplaybackview.loc>
+#include <mpxpdsbplaybackview.loc>
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+// RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------------------------
+// r_mpx_pd_sb_playback_view
+// Progressive Download Playback view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_mpx_pd_sb_playback_view
+    {
+    menubar = r_mpx_pd_sb_playback_view_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    toolbar = R_MPX_PBV_TOUCH_TOOLBAR;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pd_sb_playback_view_menubar
+// Progressive Download Playback view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_pd_sb_playback_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_pd_sb_playback_view_menu;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_pd_playback_view_menu
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_pd_sb_playback_view_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdGotoMusicMenu;
+            txt = qtn_mus_options_music_menu;
+            },
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdResumeDownload;
+            txt = qtn_mus_options_resume_dl;
+            },
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdCancelDownload;
+            txt = qtn_mus_options_cancel_dl;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdFMTransmitter;
+            txt = qtn_nmp_go_to_fm_transmitter;
+            },
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdUseAsCascade;
+            txt = qtn_mus_options_use_tone_as;
+            cascade = R_MPX_USE_AS_CASCADE;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EMPXPbvCmdExitPDPlaybackView;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_download_status_buffering
+//    Text used when download content is buffering.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_download_status_buffering
+    {
+    buf = qtn_music_shop_status_buffering;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_download_status_paused
+//    Text used when download content is paused.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_download_status_paused
+    {
+    buf = qtn_music_shop_downloadstatus_paused;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_download_status_completed
+//    Text used when download content is completed.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_download_status_completed
+    {
+    buf = qtn_music_shop_downloadstatus_completed;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_download_status_interrupted
+//    Text used when download content is interrupted.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_download_status_interrupted
+    {
+    buf = qtn_music_shop_downloadstatus_stopped;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_conf_cancel_download_txt
+//    Confirmation query text for canceling download.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_conf_cancel_download_txt
+    {
+    buf = qtn_musicshop_note_cancel;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_download_played_all_content
+//    Text used when all download content has been played
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_download_played_all_content
+    {
+    buf = qtn_musicshop_note_played_all_content;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/eabi/mpxpdsbplaybackviewu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_ZN20CMPXPdSbPlaybackView4NewLEv @ 1 NONAME
+	_ZN20CMPXPdSbPlaybackView5NewLCEv @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxpdsbplaybackview.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxpdsbplaybackview.loc	APP_LAYER_LOC_EXPORT_PATH(mpxpdsbplaybackview.loc)
+
+PRJ_MMPFILES
+mpxpdsbplaybackview.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/group/mpxpdsbplaybackview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxpdsbplaybackview.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxpdsbplaybackview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x10207BCF
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+MACRO __S60_AVKON_LAYOUTS
+MACRO __S60_MPX_PLAYBACK_VIEW_MSK
+MACRO __S60_MPX_PD_PLAYBACK_VIEW_MSK
+MACRO __S60_MPX_AIW_ASSIGN_AS
+
+SOURCEPATH      ../src
+SOURCE          mpxpdsbplaybackviewcontainer.cpp
+SOURCE          mpxpdsbplaybackview.cpp
+SOURCE          mpxpdsbplaybackviewimp.cpp
+SOURCE          mpxpdsbplaybackviewlayout.cpp
+
+START RESOURCE  ../data/mpxpdsbplaybackview.rss
+DEPENDS mpxcommonplaybackview.rsg
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         ws32.lib
+LIBRARY         fbscli.lib
+LIBRARY         bitgdi.lib
+LIBRARY         gdi.lib
+LIBRARY         egul.lib
+LIBRARY         eikctl.lib
+LIBRARY         eiksrv.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknicon.lib
+LIBRARY         featmgr.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknskinsrv.lib
+LIBRARY         commonengine.lib
+LIBRARY         centralrepository.lib
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         cdlengine.lib
+LIBRARY         estor.lib
+LIBRARY         ProfileEng.lib
+LIBRARY         apgrfx.lib
+
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxmediakeyhandler.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcommonplaybackview.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/inc/mpxpdsbplaybackview.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxpdsbplaybackview
+*
+*/
+
+
+
+#ifndef MPXPDSBPLAYBACKVIEW_HLP_HRH
+#define MPXPDSBPLAYBACKVIEW_HLP_HRH
+
+_LIT( KMUS_HLP_EMBED_MUSIC_SHOP, "MUS_HLP_DOWNLOAD_PLAYBACK_VIEW" );
+
+#endif  // MPXPDSBPLAYBACKVIEW_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/inc/mpxpdsbplaybackview.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxpdsbplaybackview
+*
+*/
+
+
+
+#ifndef MPXPDSBPLAYBACKVIEW_HRH
+#define MPXPDSBPLAYBACKVIEW_HRH
+
+#define KMPXPdSbPlaybackViewId    0x10207BCF
+
+
+// ENUMS
+
+/** Command ID's. */
+enum TMPXPodcastPlaybackViewCommandIds
+    {
+    EMPXPbvCmdExitPDPlaybackView = 0x2000
+    };
+
+#endif  // MPXPDSBPLAYBACKVIEW_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/inc/mpxpdsbplaybackviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Progressive Download playback view's container implementation.
+*
+*/
+
+
+
+#ifndef C_CMPXPDSBPLAYBACKVIEWCONTAINER_H
+#define C_CMPXPDSBPLAYBACKVIEWCONTAINER_H
+
+
+// INCLUDES
+#include <mpxplaybackcommanddefs.h>
+#include "mpxcommonplaybackviewcontainer.h"
+
+
+// FORWARD DECLARATIONS
+class MMPXLayoutSwitchObserver;
+class MMPXPlaybackViewLayout;
+
+// CLASS DECLARATION
+
+/**
+ *  Container class for progressive download from browser playback view.
+ *
+ *  @lib mpxpdsbplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPdSbPlaybackViewContainer ) : public CMPXCommonPlaybackViewContainer
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     *
+     * @param aLayoutObserver    Observer to send layout switch events to.
+     * @param aLayout            Layout
+     */
+    CMPXPdSbPlaybackViewContainer(
+        MEikCommandObserver* aCommandObserver,
+        MMPXLayoutSwitchObserver* aLayoutObserver,
+        MMPXPlaybackViewLayout* aLayout );
+
+    /**
+     * Symbian 2nd phase constructor.
+     *
+     * @param aRect Frame rectangle for container.
+     */
+    void ConstructL( const TRect& aRect );
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPdSbPlaybackViewContainer();
+
+
+    /**
+     * Handles when the download position has changed
+     */
+    void HandleDownloadPositionChanged(
+        TInt aDownloadedBytes,
+        TInt aTotalBytes );
+
+// from MPXCommonPlaybackViewContainer
+    /**
+     * Redraw part of the screen to the bitmap context.
+     *
+     * @param aRect Area to be redrawn.
+     * @param aGc Graphics context to draw to.
+     */
+    void RedrawRect(
+        const TRect& aRect,
+        CBitmapContext& aGc) const;
+
+    /**
+     * From MPXCommonPlaybackViewContainer and CCoeControl.
+     * Handle events from the touch screen. Overridden from Commonplayback view.
+     * PdSbPlaybackview does not utilise pointer events, since EMC doesn't support
+     * seeking from progressbar during progressive download.
+     */
+    void HandlePointerEventL(const TPointerEvent& aPointerEvent);    
+    
+    /**
+     * Sets main pane mode.
+     *
+     * @since S60 3.0
+     * @param aMode Playback mode.
+     */
+    void SetMode( TMPXPbvPlaybackMode aMode );
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since S60 3.0
+     */
+    void UpdateLayout();
+
+// from base class CoeControl
+
+    /**
+     * From CoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+    };
+
+#endif  // C_CMPXPDSBPLAYBACKVIEWCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/inc/mpxpdsbplaybackviewimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,249 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Progressive Download Init from Stand-alone Browser playback
+*                view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXPDSBPLAYBACKVIEWIMP_H
+#define C_CMPXPDSBPLAYBACKVIEWIMP_H
+
+
+// INCLUDES
+#include <mpxplaybackcommanddefs.h>
+#include "mpxpdsbplaybackview.h"
+#include <akntoolbarobserver.h>
+
+// FORWARD DECLARATIONS
+class CMPXPdSbPlaybackViewContainer;
+class CMPXPdSbPlaybackViewLayout;
+
+class CAknToolbar;
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Progressive Download playback view.
+ *
+ *  @lib mpxpdsbplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPdSbPlaybackViewImp ) : public CMPXPdSbPlaybackView,
+                                               public MAknToolbarObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPdSbPlaybackViewImp* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPdSbPlaybackViewImp* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPdSbPlaybackViewImp();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPdSbPlaybackViewImp();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Gets download information
+     */
+    void GetDownloadInformationL(
+        TUint& aTransactionId,
+        TMPXPlaybackPdDownloadState& aState,
+        TInt& aDownloadedBytes,
+        TInt& aTotalBytes );
+
+    /**
+    * This checks only two things:  Network available, Network Strength>none.
+    * @param: aCheck holds the UID of the failed check.
+    * @param: aState holds the state of the failed check.
+    * @return ETrue if network available and network strength
+    * is Low or Medium or High, otherwise return EFalse.
+    */
+    TBool CheckSignalAvailableL( TUid& aCheck, TInt& aState );
+
+
+      /**
+     *  Handle playback property
+     *
+     *  @param aProperty the property
+     *  @param aValue the value of the property
+     *  @param aError error code
+     */
+    void DoHandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue,
+        TInt aError );
+
+// from base class CMPXCommonPlaybackViewImp
+    /**
+     *  Handle playback message
+     *
+     *  @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL(
+        const CMPXMessage& aMessage );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     */
+    void DoHandleStateChangedL(
+        TMPXPlaybackState aState,
+        TInt aData );
+
+    /**
+     * Updates download state label.
+     */
+    void UpdateDownloadStateLabelL();
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    void HandleErrorL( TInt aError );
+
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    void DynInitMenuPaneL(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Returns views id.
+     *
+     * @since 3.0
+     * @return Views Uid
+     */
+    TUid Id() const;
+
+    /**
+     * From CAknView
+     * Command handling function.
+     *
+     * @since 3.0
+     * @param aCommand Command which is handled
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Processes user commands.
+     *
+     * @since 3.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void ProcessCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Handles a view activation.
+     *
+     * @param aPrevViewId Specifies the view previously active.
+     * @param aCustomMessageId Specifies the message type.
+     * @param aCustomMessage The activation message.
+     */
+    void DoActivateL(
+        const TVwsViewId& aPrevViewId,
+        TUid aCustomMessageId,
+        const TDesC8& aCustomMessage );
+
+    void HandleForegroundEventL( TBool aForeground );
+
+    /**
+    * Find Brower by unique id and bring it to foreground
+    *
+    * @return ETrue if browser if found. Otherwise, EFalse.
+    * @since 5.0
+    *
+    */
+    TBool BringUpBrowserL();
+
+    /**
+     * From MAknToolbarObserver
+     * Processes user commands.
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void OfferToolbarEventL( TInt aCommandId );
+
+    /**
+     * From MAknToolbarObserver
+     * Used to change toolbar settings before it is made visible
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolBar );
+
+    /**
+    * Update the toolbar state
+    *
+    * @since 5.0
+    *
+    */
+	void UpdateToolbar();
+
+private:    // data
+    CMPXPdSbPlaybackViewLayout* iPlaybackViewLayout;    // owned
+    TInt iPdResourceOffset;       // must be freed
+    TMPXPlaybackPdDownloadState iDownloadState;
+    TInt iTotalBytes;
+    TBool iForeground;
+    TBool iPlaybackCompleted;
+    TBool iExiting;
+    CAknToolbar* iToolbar; //owned
+    };
+
+#endif  // C_CMPXPDSBPLAYBACKVIEWIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/inc/mpxpdsbplaybackviewlayout.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  An interface providing skin and layout data for
+*                Progressive Download playback view.
+*
+*/
+
+
+#ifndef C_CMPXPDSBPLAYBACKVIEWLAYOUT_H
+#define C_CMPXPDSBPLAYBACKVIEWLAYOUT_H
+
+//  INCLUDES
+#include "mpxcommonplaybackviewlayout.h"
+
+// CLASS DECLARATION
+
+/**
+*  An interface providing skin and layout data for playback view.
+*
+*  @lib mpxpdsbplaybackview.dll
+*  @since S60 v5.0
+*/
+NONSHARABLE_CLASS( CMPXPdSbPlaybackViewLayout ) : public CMPXCommonPlaybackViewLayout
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPdSbPlaybackViewLayout* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPdSbPlaybackViewLayout* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPdSbPlaybackViewLayout();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPdSbPlaybackViewLayout();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXPDSBPLAYBACKVIEWLAYOUT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/loc/mpxpdsbplaybackview.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxpdsbplaybackview
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Options menu item for cancelling a progressive download.
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_options_cancel_dl "Cancel download"
+
+// d:Options menu item for resuming a paused progressive download.
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_mus_options_resume_dl "Resume download"
+
+// d:A string in the main pane.
+// d:Shown in progresive playback view when content is buffering.
+// l:mup3_progress_pane_t3
+// r:3.1
+//
+#define qtn_music_shop_status_buffering "Buffering..."
+
+// d:A string in the main pane.
+// d:Shown in progresive playback view when download is paused.
+// l:mup3_progress_pane_t3
+// r:3.1
+//
+#define qtn_music_shop_downloadstatus_paused "Download paused"
+
+// d:A string in the main pane.
+// d:Shown in progresive playback view when download is completed.
+// l:mup3_progress_pane_t3
+// r:3.1
+//
+#define qtn_music_shop_downloadstatus_completed "Download completed"
+
+// d:A string in the main pane.
+// d:Shown in progresive playback view when download is interrupted.
+// l:mup3_progress_pane_t3
+// r:3.1
+//
+#define qtn_music_shop_downloadstatus_stopped "Download stopped"
+
+// d:Confirmation query, yes or no to cancel downloading
+// d:If yes is selected, MusicShop will cancel the download and it cannot be resumed
+// l:popup_note_window
+// r:3.1
+//
+#define qtn_musicshop_note_cancel "Unable to resume download after cancelling. Cancel anyway?"
+
+// d:Information note text
+// d:Display when progressive download is paused and playback reaches
+// d:the end of the partially download file.
+// l:popup_note_window
+// r:3.1
+//
+#define qtn_musicshop_note_played_all_content "All downloaded content has been played."
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/src/mpxpdsbplaybackview.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Progressive Download Playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxpdsbplaybackview.h"
+#include "mpxpdsbplaybackviewimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXPdSbPlaybackView* CMPXPdSbPlaybackView::NewL()
+    {
+    return CMPXPdSbPlaybackViewImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXPdSbPlaybackView* CMPXPdSbPlaybackView::NewLC()
+    {
+    return CMPXPdSbPlaybackViewImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackView::~CMPXPdSbPlaybackView()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/src/mpxpdsbplaybackviewcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,209 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Progressive Download Playback view's container.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <AknDef.h>
+#include <gulicon.h>
+
+#include "mpxconstants.h"
+#include "mpxpdsbplaybackview.hlp.hrh"
+#include "mpxplaybackviewinfolabel.h"
+#include "mpxpdsbplaybackviewcontainer.h"
+#include "mpxplaybackviewlayoutinterface.h"
+#include "mpxlog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewContainer::CMPXPdSbPlaybackViewContainer(
+    MEikCommandObserver* aCommandObserver,
+    MMPXLayoutSwitchObserver* aLayoutObserver,
+    MMPXPlaybackViewLayout* aLayout )
+    {
+    iCommandObserver = aCommandObserver;
+    iLayoutObserver = aLayoutObserver;
+    iMode = EUninitialized;
+    iLayout = aLayout;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewContainer::ConstructL( const TRect& aRect )
+    {
+    MPX_DEBUG1( "CMPXPdSbPlaybackViewContainer::ConstructL() entering" );
+
+    CMPXCommonPlaybackViewContainer::ConstructL( aRect );
+
+    MPX_DEBUG1( "CMPXPdSbPlaybackViewContainer::ConstructL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewContainer::~CMPXPdSbPlaybackViewContainer()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXPdSbPlaybackViewContainer::HandlePointerEventL
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent)
+	{
+	//Handles the touch events, except for sliderpane.
+	if ( (!iSliderPaneRect.Contains(aPointerEvent.iPosition) ) )
+		{
+		CMPXCommonPlaybackViewContainer::HandlePointerEventL(aPointerEvent);
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// Handles when the download position has changed
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewContainer::HandleDownloadPositionChanged(
+    TInt aDownloadedBytes,
+    TInt aTotalBytes )
+    {
+    MPX_DEBUG3("CMPXPdSbPlaybackViewContainer::HandleDownloadPositionChanged(%d, %d) entering",
+                aDownloadedBytes,
+                aTotalBytes);
+
+    if (aTotalBytes)
+        {
+        TReal t = aTotalBytes;
+        iDownloadRatio = aDownloadedBytes / t;
+
+        RefreshProgressBar();
+        }
+
+    MPX_DEBUG1("CMPXPdSbPlaybackViewContainer::HandleDownloadPositionChanged() exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Redraw part of the screen.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewContainer::RedrawRect(
+    const TRect& aRect,
+    CBitmapContext& aGc) const
+    {
+    MPX_DEBUG1("CMPXPdSbPlaybackViewContainer::RedrawRect() entering");
+
+    CMPXCommonPlaybackViewContainer::RedrawRect( aRect, aGc );
+
+    // Always show progress bars in progressive download
+    DrawIndicator( aGc, aRect, iSliderBackgroundRect, iSliderBackground );
+    DrawIndicator( aGc,
+                   aRect,
+                   TRect(iDownloadSliderRect.iTl,
+                         iDownloadSlider->Bitmap()->SizeInPixels()),
+                   iDownloadSlider );
+    DrawIndicator( aGc,
+                   aRect,
+                   TRect(iPlaybackSliderRect.iTl,
+                         iPlaybackSlider->Bitmap()->SizeInPixels()),
+                   iPlaybackSlider );
+
+    MPX_DEBUG1("CMPXPdSbPlaybackViewContainer::RedrawRect() exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Sets main pane mode.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewContainer::SetMode( TMPXPbvPlaybackMode aMode )
+    {
+    MPX_DEBUG2("CMPXPdSbPlaybackViewContainer::SetMode(%d) entering", aMode);
+
+    CMPXCommonPlaybackViewContainer::SetMode( aMode );
+
+    if ( ENoTracksMode != aMode )
+        {
+        iLabels[ETextArtist]->MakeVisible( ETrue );
+        iLabels[ETextTrack]->MakeVisible( ETrue );
+
+        // Make sure download label is visible all the time
+        iLabels[ETextDownloadState]->MakeVisible( ETrue );
+
+        // Make sure album art is visible all the time
+        iDisplayAlbumArt = ETrue;
+        }
+
+    MPX_DEBUG1("CMPXPdSbPlaybackViewContainer::SetMode() exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewContainer::UpdateLayout()
+    {
+    MPX_DEBUG1( "CMPXPdSbPlaybackViewContainer::UpdateLayout() entering" );
+
+    CMPXCommonPlaybackViewContainer::UpdateLayout();
+
+    MPX_DEBUG1( "CMPXPdSbPlaybackViewContainer::UpdateLayout() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXPdSbPlaybackViewContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG4( "CMPXPdSbPlaybackViewContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+    // No action for rocker left and right keys in progress download view
+    if (aKeyEvent.iScanCode == EStdKeyLeftArrow ||
+        aKeyEvent.iScanCode == EStdKeyRightArrow ||
+        aKeyEvent.iScanCode == EStdKeyDownArrow  ||
+        aKeyEvent.iScanCode == EStdKeyUpArrow )
+        {
+        return EKeyWasConsumed;
+        }
+    return CMPXCommonPlaybackViewContainer::OfferKeyEventL( aKeyEvent, aType );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewContainer::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KAppUidMusicPlayerX;
+    aContext.iContext = KMUS_HLP_EMBED_MUSIC_SHOP;
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/src/mpxpdsbplaybackviewimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,908 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Progressive Download Playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <eikmenub.h>
+#include <eikapp.h>
+#include <AknUtils.h>
+#include <bautils.h>
+#include <featmgr.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxplaybackmessage.h>
+#include <mpxcommonplaybackview.rsg>
+#include <mpxpdsbplaybackview.rsg>
+#include <mpxcmn.h>
+#include <mpxplaybackutility.h>
+#include <mpxviewutility.h>
+#include <StringLoader.h>
+#include <AknQueryDialog.h>
+#include <MProfileEngine.h>
+#include <e32property.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <apgwgnam.h>
+#include <mpxuser.h>
+#include <sacls.h>
+
+#include "mpxcommonuihelper.h"
+#include "mpxcommonplaybackview.hrh"
+#include "mpxpdsbplaybackview.hrh"
+#include "mpxpdsbplaybackviewimp.h"
+#include "mpxpdsbplaybackviewcontainer.h"
+#include "mpxpdsbplaybackviewlayout.h"
+#include "mpxlog.h"
+#include "mpxappui.hrh"
+
+#include <akntoolbar.h>
+#include <aknbutton.h>
+
+// CONSTANTS
+_LIT( KMPXPdSbPlaybackRscPath, "mpxpdsbplaybackview.rsc" );
+#define KMPlayerBrowserUid    0x10008D39
+#define KMPlayerBrowserUid2   0x1020724D
+#define KProgressDownloadUid  0x10207BCD
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewImp::CMPXPdSbPlaybackViewImp()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::ConstructL()
+    {
+    MPX_FUNC( "CMPXPdSbPlaybackViewImp::ConstructL" );
+
+    CMPXCommonPlaybackViewImp::ConstructL();
+    iPlaybackUtility->RemoveObserverL( *this );
+    iPlaybackUtility->Close();
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( TUid::Uid(KProgressDownloadUid) );
+    iPlaybackUtility->AddObserverL( *this );
+
+    // Need to set a higher priority because download manager sets it's
+    // own priority high, so we need to make sure we're at least the same
+    iPlaybackUtility->SetPriority( CActive::EPriorityStandard + 2 );
+
+    CCoeEnv* coeEnv = iEikonEnv;
+    TParse parse;
+    parse.Set( KMPXPdSbPlaybackRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile = parse.FullName();
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iPdResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    BaseConstructL( R_MPX_PD_SB_PLAYBACK_VIEW );
+    if(AknLayoutUtils::PenEnabled())
+        {
+        CAknView::ShowToolbarOnViewActivation(ETrue);
+        if ( Toolbar() )
+            {
+            iToolbar = Toolbar();
+            iToolbar->SetToolbarObserver( this );
+            }
+        }
+    iDownloadState = EPbDlStateDownloading;     // Otherwise we will show "Download Stopped"
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewImp* CMPXPdSbPlaybackViewImp::NewL()
+    {
+    CMPXPdSbPlaybackViewImp* self = CMPXPdSbPlaybackViewImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewImp* CMPXPdSbPlaybackViewImp::NewLC()
+    {
+    CMPXPdSbPlaybackViewImp* self = new ( ELeave ) CMPXPdSbPlaybackViewImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewImp::~CMPXPdSbPlaybackViewImp()
+    {
+    MPX_DEBUG1( "CMPXPdSbPlaybackViewImp::~CMPXPdSbPlaybackViewImp entering" );
+
+    delete iPlaybackViewLayout;
+
+    if ( iPdResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iPdResourceOffset );
+        }
+
+    MPX_DEBUG1( "CMPXPdSbPlaybackViewImp::~CMPXPdSbPlaybackViewImp exiting" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Gets download information
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::GetDownloadInformationL(
+        TUint& aTransactionId,
+        TMPXPlaybackPdDownloadState& aState,
+        TInt& aDownloadedBytes,
+        TInt& aTotalBytes )
+    {
+    MPX_DEBUG1("CMPXPdSbPlaybackViewImp::GetDownloadInformationL() entering");
+
+    // Create the command to send to MPX
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackPD );
+    cmd->SetTObjectValueL<TMPXPlaybackPdCommand>( KMPXCommandPlaybackGeneralType, EPbCmdGetPdStatus );
+    iPlaybackUtility->CommandL( *cmd );
+
+    // Check that return values were provided
+    ASSERT( cmd->IsSupported( KMPXCommandPlaybackPDTransactionID ) &&
+            cmd->IsSupported( KMPXCommandPlaybackPDState ) &&
+            cmd->IsSupported( KMPXCommandPlaybackPDDownloadedBytes ) &&
+            cmd->IsSupported( KMPXCommandPlaybackPDTotalBytes ));
+
+    // Copy the return values
+    aTransactionId = cmd->ValueTObjectL<TUint>( KMPXCommandPlaybackPDTransactionID );
+    aState = cmd->ValueTObjectL<TMPXPlaybackPdDownloadState>( KMPXCommandPlaybackPDState );
+    aDownloadedBytes = cmd->ValueTObjectL<TInt>( KMPXCommandPlaybackPDDownloadedBytes );
+    aTotalBytes = cmd->ValueTObjectL<TInt>( KMPXCommandPlaybackPDTotalBytes );
+    CleanupStack::PopAndDestroy( cmd );
+
+    MPX_DEBUG1("CMPXPdSbPlaybackViewImp::GetDownloadInformationL() exiting");
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPdSbPlaybackViewImp::CheckSignalAvailableL
+// This checks for Network available, and Network Strength > none.
+// - Return ETrue if network available and network strength
+// is Low or Medium or High, otherwise return EFalse.
+// -----------------------------------------------------------------------------
+//
+TBool CMPXPdSbPlaybackViewImp::CheckSignalAvailableL( TUid& aCheck, TInt& aState )
+    {
+    TBool ret( ETrue );
+
+    // Check the network is available.
+    aCheck = KUidNetworkStatus;
+    TInt err( RProperty::Get( KUidSystemCategory, KUidNetworkStatusValue, aState ));
+    if ( err != KErrNone )
+        {
+        aState = ESANetworkUnAvailable;
+        }
+    if( aState != ESANetworkAvailable )
+        {
+        ret = EFalse;
+        }
+
+    // Check network coverage.
+    aCheck = KUidNetworkStrength;
+    err = RProperty::Get( KUidSystemCategory, KUidNetworkStrengthValue, aState );
+    if ( err != KErrNone )
+        {
+        aState = ESANetworkStrengthUnknown;
+        }
+    if( aState != ESANetworkStrengthLow &&
+        aState != ESANetworkStrengthMedium &&
+        aState != ESANetworkStrengthHigh )
+        {
+        ret = EFalse;
+        }
+
+    //passed all tests, OK to send
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "-->CMPXPdSbPlaybackViewImp::DoHandlePlaybackMessageL" );
+
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        MPX_DEBUG2( "CMPXPdPlaybackViewImp::DoHandlePlaybackMessageL type = %d", type );
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EDownloadPositionChanged:
+                {
+                if ( iContainer )
+                    {
+                    MPX_DEBUG2( "CMPXPdPlaybackViewImp::DoHandlePlaybackMessageL - EDownloadPositionChanged(%d)", data );
+                    CMPXPdSbPlaybackViewContainer* container =
+                        static_cast<CMPXPdSbPlaybackViewContainer*>(iContainer);
+                    container->HandleDownloadPositionChanged( data, iTotalBytes );
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::EDownloadStateChanged:
+                {
+                TInt data( *aMessage.Value<TInt>( KMPXMessageGeneralData ) );
+                MPX_DEBUG2( "CMPXPdSbPlaybackViewImp::DoHandlePlaybackMessageL - EDownloadStateChanged(%d)", data );
+                iDownloadState = static_cast<TMPXPlaybackPdDownloadState>( data );
+                if ( iDownloadState == EPbDlStateDownloading ||
+                     iDownloadState == EPbDlStateDownloadCompleted )
+                    {
+                    RequestMediaL();
+                    }
+                if( iContainer && iDownloadState == EPbDlStateDownloadCompleted )
+                    {
+                    CMPXPdSbPlaybackViewContainer* container =
+                        static_cast<CMPXPdSbPlaybackViewContainer*>(iContainer);
+                    container->HandleDownloadPositionChanged( iTotalBytes, iTotalBytes );
+                    }
+                UpdateViewL();
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                MPX_DEBUG2( "CMPXPdSbPlaybackViewImp::DoHandlePlaybackMessageL - EStateChanged(%d)", type );
+
+                UpdateToolbar();
+                UpdateMiddleSoftKeyDisplayL();
+                TInt data( *aMessage.Value<TInt>( KMPXMessageGeneralData ) );
+                TMPXPlaybackState state =
+                    static_cast<TMPXPlaybackState>( type );
+                DoHandleStateChangedL( state, data );
+                if ( iDownloadState == EPbDlStateDownloadPaused && state == EPbStatePaused )
+                    {
+                    iCommonUiHelper->DisplayInfoNoteL( R_MPX_DOWNLOAD_PLAYED_ALL_CONTENT );
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::EDownloadStarted:
+                {
+                iTotalBytes = aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData );
+                MPX_DEBUG2( "CMPXPdSbPlaybackViewImp::DoHandlePlaybackMessageL - DownloadStarted, totalBytes = %d", iTotalBytes );
+                break;
+                }
+
+            case TMPXPlaybackMessage::EDownloadUpdated:
+                {
+                iTotalBytes = aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData );
+                MPX_DEBUG2( "CMPXPdSbPlaybackViewImp::DoHandlePlaybackMessageL - DownloadUpdated, totalBytes = %d", iTotalBytes );
+                break;
+                }
+
+
+            case TMPXPlaybackMessage::EMediaChanged:
+
+                iPlaybackCompleted = ETrue;
+                if ( !iForeground )
+                    {
+                    //TODO: Add something like AppUi()->HandleCommandL( EMPXCmdGoToNowPlaying ); but it should not bring to foreground
+                    }
+                break;
+            case TMPXPlaybackMessage::EDownloadCmdCancelDownload:
+                // stop playback
+                // bring back previous now playing view
+                AppUi()->HandleCommandL( EMPXCmdGoToNowPlaying );
+                // Bring Browser to foreground.
+                BringUpBrowserL();
+                break;
+            case TMPXPlaybackMessage::EDownloadFileMoved:
+                {
+                // set updated Uri from aMessage for iMedia
+                iMedia->SetTextValueL( KMPXMediaGeneralUri, aMessage.ValueText( KMPXMediaGeneralUri ) );
+                break;
+                }
+
+            default:
+                {
+                CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL( aMessage );
+                break;
+                }
+            }
+        }
+    MPX_DEBUG1("<--CMPXPdSbPlaybackViewImp::DoHandlePlaybackMessageL()");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::DoHandleStateChangedL(
+    TMPXPlaybackState aState,
+    TInt aData )
+    {
+    MPX_DEBUG2( "CMPXPdSbPlaybackViewImp::DoHandleStateChangedL(%d)", aState );
+
+    switch ( aState )
+        {
+        case EPbStateInitialising:
+            {
+            UpdatePlaybackState( aState );
+            UpdateDownloadStateLabelL();
+            RequestMediaL();
+            break;
+            }
+        case EPbStatePlaying:
+            RequestMediaL();
+            CMPXCommonPlaybackViewImp::DoHandleStateChangedL( aState, aData );
+            break;
+        case EPbStateStopped:
+        case EPbStatePaused:
+            if ( iExiting )
+                {
+                AppUi()->RunAppShutter();
+                }
+        default:
+            {
+            CMPXCommonPlaybackViewImp::DoHandleStateChangedL( aState, aData );
+            break;
+            }
+        }
+    MPX_DEBUG1("CMPXPdSbPlaybackViewImp::DoHandleStateChangedL()");
+    }
+
+// ---------------------------------------------------------------------------
+// Updates download state label.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::UpdateDownloadStateLabelL()
+    {
+    MPX_DEBUG1("CMPXPdSbPlaybackViewImp::UpdateDownloadStateLabelL() entering");
+
+    if ( iContainer && !iSwitchingView )
+        {
+        TInt resId = KErrNotFound;
+        switch ( iDownloadState )
+            {
+            case EPbDlStateBuffering:
+                {
+                MPX_DEBUG1("CMPXPdSbPlaybackViewImp::UpdateDownloadStateLabelL() - Buffering");
+                resId = R_MPX_DOWNLOAD_STATUS_BUFFERING;
+                break;
+                }
+            case EPbDlStateDownloadPaused:
+                {
+                // If offline mode, this case will be entered.
+                resId = R_MPX_DOWNLOAD_STATUS_PAUSED;
+                TBool offLine( EFalse );
+
+                // Check profile, display "Download Stopped" if
+                // Offline enabled.
+                MProfileEngine* profileEngine( CreateProfileEngineL() );
+
+                if ( profileEngine->ActiveProfileId() == EProfileOffLineId )
+                    {
+                    MPX_DEBUG1("CMPXPdSbPlaybackViewImp::UpdateDownloadStateLabelL() -- OffLine ");
+                    offLine = ETrue;
+                    resId = R_MPX_DOWNLOAD_STATUS_INTERRUPTED;
+                    }
+                profileEngine->Release();
+
+                if ( !offLine )
+                    {
+                    // Check network coverage, display "Download Stopped" if
+                    // No coverage.
+                    TUid uid;
+                    TInt res( 0 );
+                    TBool signalAvailable( CheckSignalAvailableL( uid, res ));
+
+                    if ( !signalAvailable )
+                        {
+                        MPX_DEBUG1("CMPXPdSbPlaybackViewImp::UpdateDownloadStateLabelL() -- No Signal ");
+                        resId = R_MPX_DOWNLOAD_STATUS_INTERRUPTED;
+                        }
+                    }
+
+                break;
+                }
+            case EPbDlStateDownloadError:
+            case EPbDlStateDownloadCanceled:
+            case EPbDlStateNotDownloading:
+                {
+                MPX_DEBUG1("CMPXPdSbPlaybackViewImp::UpdateDownloadStateLabelL() - Download Canceled");
+                resId = R_MPX_DOWNLOAD_STATUS_INTERRUPTED;
+                break;
+                }
+            case EPbDlStateDownloadCompleted:
+                {
+                MPX_DEBUG1("CMPXPdSbPlaybackViewImp::UpdateDownloadStateLabelL() - Download Completed");
+                resId = R_MPX_DOWNLOAD_STATUS_COMPLETED;
+                break;
+                }
+            case EPbDlStateDownloading:
+            default:
+                {
+                MPX_DEBUG2(" default state: %d", iDownloadState );
+                // Do nothing
+                break;
+                }
+            }
+/*
+        // Display Album art in progressive download
+        if( iActualAlbumArtBitmap )
+            {
+            MPX_DEBUG1("CMPlayerPlaybackContainer::UpdateDownloadStateLabelL() - Draw ActualAlbumArt");
+            iAlbumArtBitmap = iActualAlbumArtBitmap;
+            DrawNow();
+            }
+        else
+            {
+            MPX_DEBUG1("CMPlayerPlaybackContainer::UpdateDownloadStateLabelL() - Draw DefaultAlbumArt");
+            // Display default Album Art
+            iAlbumArtBitmap = iDefaultAlbumArtBitmap;
+            DrawNow();
+            }
+*/
+
+        if (resId != KErrNotFound)
+            {
+            // Display download status text
+            HBufC* statusText = StringLoader::LoadLC( resId );
+            iContainer->UpdateLabelL( ETextDownloadState, *statusText );
+            CleanupStack::PopAndDestroy( statusText );
+            }
+        else
+            {
+            // Clear download status text
+            iContainer->UpdateLabelL( ETextDownloadState, KNullDesC );
+            }
+        }
+
+    MPX_DEBUG1("CMPXPdSbPlaybackViewImp::UpdateDownloadStateLabelL() exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::HandleErrorL( TInt aError )
+    {
+    MPX_DEBUG2("CMPXPdSbPlaybackViewImp::HandleErrorL(%d): Entering", aError);
+    if ( aError )
+        {
+        TUint transactionId(0);
+        TMPXPlaybackPdDownloadState state( EPbDlStateNotDownloading );
+        TInt downloadedBytes(0);
+        TInt totalBytes(0);
+        GetDownloadInformationL( transactionId,
+                                 state,
+                                 downloadedBytes,
+                                 totalBytes );
+        if ( EPbDlStateBuffering == state ||
+             EPbDlStateDownloading == state ||
+             EPbDlStateDownloadPaused == state )
+            {
+            CMPXCommand* cmd( CMPXCommand::NewL() );
+            CleanupStack::PushL( cmd );
+            cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+            cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackPD );
+            cmd->SetTObjectValueL<TMPXPlaybackPdCommand>(
+                KMPXCommandPlaybackGeneralType,
+                EPbCmdCancelPd );
+            iPlaybackUtility->CommandL( *cmd );
+            CleanupStack::PopAndDestroy( cmd );
+            }
+        iCommonUiHelper->HandleErrorL( aError );
+        CMPXCommonPlaybackViewImp::HandleCommandL( EAknSoftkeyBack );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    MPX_DEBUG2("CMPXPdSbPlaybackViewImp::DynInitMenuPaneL(%d): entering", aResourceId);
+
+    // Override base menu actions
+    switch ( aResourceId )
+        {
+        case R_MPX_PD_SB_PLAYBACK_VIEW_MENU:
+            {
+            aMenuPane->SetItemDimmed(
+                EMPXPbvCmdResumeDownload,
+                iDownloadState != EPbDlStateDownloadPaused);
+            aMenuPane->SetItemDimmed(
+                EMPXPbvCmdCancelDownload,
+                iDownloadState != EPbDlStateDownloading &&
+                iDownloadState != EPbDlStateBuffering &&
+                iDownloadState != EPbDlStateDownloadPaused);
+
+			// Check if FM Transmitter is supported
+			if ( !FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+				{
+				aMenuPane->SetItemDimmed(
+					EMPXPbvCmdFMTransmitter,
+					ETrue );
+				}
+
+            if ( iDownloadState == EPbDlStateDownloading ||
+                 iDownloadState == EPbDlStateBuffering ||
+                 iDownloadState == EPbDlStateDownloadPaused ||
+                 iPlaybackState == EPbStateInitialising ||
+                 iPlaybackState == EPbStatePlaying ||
+                 iPlaybackState == EPbStatePaused  )
+                {
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdUseAsCascade, ETrue );
+                }
+			else
+                {
+                aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdUseAsCascade, EFalse );
+                }
+			break;
+            }
+        default:
+            {
+            // Call base clase to handle most cases
+            CMPXCommonPlaybackViewImp::DynInitMenuPaneL( aResourceId, aMenuPane );
+            break;
+            }
+        }
+
+    MPX_DEBUG1("CMPXPdSbPlaybackViewImp::DynInitMenuPaneL(): exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Command handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::HandleCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2("CMPXPdSbPlaybackViewImp::HandleCommandL(%d) entering", aCommand);
+
+    switch (aCommand)
+        {
+        case EMPXPbvCmdResumeDownload:
+            {
+            if ( EPbDlStateDownloadPaused == iDownloadState )
+                {
+                CMPXCommand* cmd( CMPXCommand::NewL() );
+                CleanupStack::PushL( cmd );
+                cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+                cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackPD );
+                cmd->SetTObjectValueL<TMPXPlaybackPdCommand>(
+                    KMPXCommandPlaybackGeneralType,
+                    EPbCmdResumePd );
+                iPlaybackUtility->CommandL( *cmd );
+                CleanupStack::PopAndDestroy( cmd );
+                }
+            break;
+            }
+        case EMPXPbvCmdCancelDownload:
+            {
+            if ( EPbDlStateDownloading == iDownloadState ||
+                 EPbDlStateBuffering == iDownloadState ||
+                 EPbDlStateDownloadPaused == iDownloadState )
+                {
+                HBufC* queryTxt = StringLoader::LoadLC( R_MPX_CONF_CANCEL_DOWNLOAD_TXT );
+                CAknQueryDialog* query = CAknQueryDialog::NewL(
+                                            CAknQueryDialog::EConfirmationTone );
+
+/* TODO: add when we support cover UI
+#ifdef __COVER_DISPLAY      //VCPCCMOD_BEGIN
+                query->PublishDialogL(
+                        EMPXNoteMusicshopCancel,
+                        KMPXNoteCategory);
+#endif  //__COVER_DISPLAY   //VCPCCMOD_END
+*/
+
+                if ( query->ExecuteLD(
+                        R_MPX_GENERIC_CONFIRMATION_QUERY,
+                        *queryTxt ))
+                    {
+                    iPlaybackUtility->CommandL( EPbCmdStop );
+                    CMPXCommand* cmd( CMPXCommand::NewL() );
+                    CleanupStack::PushL( cmd );
+                    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+                    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackPD );
+                    cmd->SetTObjectValueL<TMPXPlaybackPdCommand>(
+                        KMPXCommandPlaybackGeneralType,
+                        EPbCmdCancelPd );
+                    iPlaybackUtility->CommandL( *cmd );
+                    CleanupStack::PopAndDestroy( cmd );
+                    iPlaybackUtility->CommandL( EPbCmdClose );
+                    }
+                CleanupStack::PopAndDestroy( queryTxt );
+                }
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            if ( iPlaybackCompleted )
+                {
+                AppUi()->HandleCommandL( EMPXCmdGoToNowPlaying );
+                }
+            // Goto Browser, Bring Browser to foreground.
+            if ( !BringUpBrowserL() )
+                {
+                //We are in Music Store, launched from Download Mgr. Instead, stop playback
+                iPlaybackUtility->CommandL( EPbCmdStop );
+                iPlaybackUtility->CommandL( EPbCmdClose );
+                iExiting = ETrue;
+                }
+            }
+            break;
+        case EMPXPbvCmdExitPDPlaybackView:
+            if ( iPlaybackState == EPbStatePlaying )
+                {
+                iPlaybackUtility->CommandL( EPbCmdStop );
+                iExiting = ETrue;
+                }
+            else
+                {
+                AppUi()->RunAppShutter();
+                }
+            break;
+        case EMPXPbvCmdGotoMusicMenu:
+            AppUi()->HandleCommandL( EMPXCmdGotoCollection );
+
+        default:
+            {
+            CMPXCommonPlaybackViewImp::HandleCommandL( aCommand );
+            break;
+            }
+        }
+
+    MPX_DEBUG1("CMPXPdSbPlaybackViewImp::HandleCommandL() exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::DoHandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXPdSbPlaybackViewImp::DoHandlePropertyL" );
+    MPX_DEBUG4( "HandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError );
+
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty  )
+            {
+            case EPbPropertyRandomMode:
+            case EPbPropertyRepeatMode:
+            // ignore these cases in PD
+                break;
+            default:
+                {
+                CMPXCommonPlaybackViewImp::DoHandlePropertyL(aProperty,aValue,aError);
+                break;
+                }
+            }
+        }
+    else
+        {
+        HandleErrorL( aError );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Returns views id.
+// ---------------------------------------------------------------------------
+//
+TUid CMPXPdSbPlaybackViewImp::Id() const
+    {
+    return TUid::Uid( KMPXPdSbPlaybackViewId );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Processes user commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::ProcessCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2("CMPXPdSbPlaybackViewImp::ProcessCommandL(%d): entering", aCommand);
+    if ( aCommand == EAknCmdExit )
+        {
+        if ( MenuBar() )
+            {
+            MenuBar()->StopDisplayingMenuBar();
+            }
+        }
+    CAknView::ProcessCommandL( aCommand );
+    MPX_DEBUG1("CMPXPdSbPlaybackViewImp::ProcessCommandL(): exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Handles a view activation.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::DoActivateL(
+    const TVwsViewId& aPrevViewId,
+    TUid aCustomMessageId,
+    const TDesC8& aCustomMessage )
+    {
+    MPX_FUNC( "CMPXPdSbPlaybackViewImp::DoActivateL()" );
+
+    if ( !iContainer )
+        {
+        if ( !iPlaybackViewLayout )
+            {
+            iPlaybackViewLayout = CMPXPdSbPlaybackViewLayout::NewL();
+            }
+            iContainer = new ( ELeave ) CMPXPdSbPlaybackViewContainer(
+                                        this,
+                                        this,
+                                        iPlaybackViewLayout );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( ClientRect() );
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    CMPXCommonPlaybackViewImp::DoActivateL( aPrevViewId , aCustomMessageId, aCustomMessage );
+    UpdateMiddleSoftKeyDisplayL();
+    }
+
+
+// ---------------------------------------------------------
+// Bring Browser application to the foreground.
+// ---------------------------------------------------------
+//
+TBool CMPXPdSbPlaybackViewImp::BringUpBrowserL()
+    {
+    RWsSession& wsSession=iEikonEnv->WsSession();
+    TInt count=wsSession.NumWindowGroups( 0 );
+
+    RArray<RWsSession::TWindowGroupChainInfo> allWgIds;
+    CleanupClosePushL(allWgIds);
+    User::LeaveIfError(wsSession.WindowGroupList(&allWgIds));
+
+    count = allWgIds.Count();
+
+    CApaWindowGroupName* windowName;
+
+    TBool browserFound = EFalse;
+    for ( TInt index=0; index < count; index++ )
+        {
+        RWsSession::TWindowGroupChainInfo& info = allWgIds[index];
+
+        if ( info.iParentId <= 0 )
+            {
+            TInt wgId=info.iId;
+            windowName = CApaWindowGroupName::NewLC(wsSession, wgId);
+            TUid applicationUid = windowName->AppUid();
+            if ( applicationUid == TUid::Uid(KMPlayerBrowserUid))
+                {
+                TApaTask task( iEikonEnv->WsSession() );
+                task.SetWgId( wgId );
+                task.BringToForeground();
+                browserFound = ETrue;
+                }
+            CleanupStack::PopAndDestroy();  //windowName
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &allWgIds );
+
+    return browserFound;
+    }
+
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Foreground event handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::HandleForegroundEventL( TBool aForeground )
+    {
+    MPX_DEBUG2( "--->CMPXPdSbPlaybackViewImp::HandleForegroundEventL(%d)", aForeground );
+
+    iForeground = aForeground;
+    CMPXCommonPlaybackViewImp::HandleForegroundEventL(aForeground);
+    MPX_DEBUG1( "<---CMPXPdSbPlaybackViewImp::HandleForegroundEventL()" );
+    }
+
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Used to change toolbar settings before toolbar becomes visible
+// -----------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::DynInitToolbarL(TInt aResourceId, CAknToolbar* aToolbar)
+    {
+    if(aResourceId == R_MPX_PBV_TOUCH_TOOLBAR)
+        {
+        // Put initializations here to take effect before toolbar is shown
+        aToolbar->SetItemDimmed( EMPXPbvCmdPreviousListItem, ETrue, EFalse );
+        aToolbar->SetItemDimmed( EMPXPbvCmdNextListItem, ETrue, EFalse );
+        UpdateToolbar();
+        aToolbar->UpdateBackground();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Handles toolbar events
+// -----------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::OfferToolbarEventL( TInt aCommandId )
+    {
+    CAknView::ProcessCommandL( aCommandId );
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the middle toolbar button
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewImp::UpdateToolbar()
+    {
+    MPX_FUNC( "CMPXPdSbPlaybackViewImp::UpdateToolbar" );
+
+    if ( AknLayoutUtils::PenEnabled() && Toolbar())
+        {
+        CAknToolbar* toolbar = Toolbar();
+        TBool pausePlayDimmed(ETrue);
+        MMPXSource* s = iPlaybackUtility->Source();
+        if ( s )
+            {
+            TMPXPlaybackState state = iPlaybackUtility->StateL();
+            CAknButton* pausePlayControl;
+            pausePlayControl = (CAknButton*)(toolbar->ComponentControl( 1 ));
+            if ((state == EPbStateInitialising) || (state == EPbStatePlaying))
+                {
+                pausePlayControl->SetCurrentState(0, ETrue);
+                }
+            else
+                {
+                pausePlayControl->SetCurrentState(1, ETrue);
+                }
+            if ( state == EPbStatePlaying ||
+                    state == EPbStatePaused ||
+                    state == EPbStateStopped )
+                {
+                pausePlayDimmed = EFalse;
+                }
+            }
+        toolbar->SetItemDimmed( EMPXPbvCmdPlayPause, pausePlayDimmed, ETrue );
+        }
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/pdsbplaybackview/src/mpxpdsbplaybackviewlayout.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Layout and graphic factory for Progressive Download Playback View
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <barsread.h>
+#include <gulicon.h>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <layoutmetadata.cdl.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxpdsbplaybackview.rsg>
+#include <centralrepository.h>
+#include <mpxinternalcrkeys.h>
+#include <mpxlbxextendedfeatures.h>
+
+#include "mpxpdsbplaybackviewlayout.h"
+#include "mpxlog.h"
+
+using namespace AknLayoutScalable_Apps;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewLayout* CMPXPdSbPlaybackViewLayout::NewL()
+    {
+    CMPXPdSbPlaybackViewLayout* self = CMPXPdSbPlaybackViewLayout::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewLayout* CMPXPdSbPlaybackViewLayout::NewLC()
+    {
+    CMPXPdSbPlaybackViewLayout* self = new ( ELeave ) CMPXPdSbPlaybackViewLayout();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewLayout::~CMPXPdSbPlaybackViewLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPdSbPlaybackViewLayout::CMPXPdSbPlaybackViewLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPdSbPlaybackViewLayout::ConstructL()
+    {
+    MPX_FUNC( "CMPXPdSbPlaybackViewLayout::ConstructL" );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/bwinscw/mpxplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewL@CMPXPlaybackView@@SAPAV1@XZ @ 1 NONAME ; class CMPXPlaybackView * CMPXPlaybackView::NewL(void)
+	?NewLC@CMPXPlaybackView@@SAPAV1@XZ @ 2 NONAME ; class CMPXPlaybackView * CMPXPlaybackView::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/data/mpxplaybackview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxplaybackview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MXPV // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/eabi/mpxplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_ZN16CMPXPlaybackView4NewLEv @ 1 NONAME
+	_ZN16CMPXPlaybackView5NewLCEv @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxplaybackview.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxplaybackview.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/group/mpxplaybackview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxplaybackview.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxplaybackview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC70
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxplaybackviewcontainer.cpp
+SOURCE          mpxplaybackview.cpp
+SOURCE          mpxplaybackviewimp.cpp
+SOURCE          mpxplaybackviewlayout.cpp
+
+START RESOURCE  ../data/mpxplaybackview.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         ws32.lib
+LIBRARY         fbscli.lib
+LIBRARY         bitgdi.lib
+LIBRARY         gdi.lib
+LIBRARY         egul.lib
+LIBRARY         eikctl.lib
+LIBRARY         eiksrv.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknicon.lib
+LIBRARY         featmgr.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknskinsrv.lib
+LIBRARY         commonengine.lib
+LIBRARY         centralrepository.lib
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         cdlengine.lib
+
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxmediakeyhandler.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcommonplaybackview.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/inc/mpxplaybackview.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxplaybackview
+*
+*/
+
+
+
+#ifndef MPXPLAYBACKVIEW_HLP_HRH
+#define MPXPLAYBACKVIEW_HLP_HRH
+
+_LIT( KMUS_HLP_PLAYBACK_VIEW, "MUS_HLP_PLAYBACK_VIEW" );
+
+#endif  // MPXPLAYBACKVIEW_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/inc/mpxplaybackview.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxplaybackview
+*
+*/
+
+
+
+#ifndef MPXPLAYBACKVIEW_HRH
+#define MPXPLAYBACKVIEW_HRH
+
+#define KMPXPlaybackViewId    0x101FFC70
+
+#endif  // MPXPLAYBACKVIEW_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/inc/mpxplaybackviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX playback view's container implementation.
+*
+*/
+
+
+
+#ifndef C_CMPXPLAYBACKVIEWCONTAINER_H
+#define C_CMPXPLAYBACKVIEWCONTAINER_H
+
+
+// INCLUDES
+#include "mpxcommonplaybackviewcontainer.h"
+
+
+// FORWARD DECLARATIONS
+class MMPXLayoutSwitchObserver;
+class MMPXPlaybackViewLayout;
+
+// CLASS DECLARATION
+
+/**
+ *  Container class for audio view.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPlaybackViewContainer ) : public CMPXCommonPlaybackViewContainer
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     *
+     * @param aLayoutObserver    Observer to send layout switch events to.
+     * @param aIsEmbedded        ETrue if Music Player is in embedded mode.
+     */
+    CMPXPlaybackViewContainer(
+        MEikCommandObserver* aCommandObserver,
+        MMPXLayoutSwitchObserver* aLayoutObserver,
+        MMPXPlaybackViewLayout* aLayout );
+
+    /**
+     * Symbian 2nd phase constructor.
+     * 
+     * @param aRect Frame rectangle for container.
+     */
+    void ConstructL( const TRect& aRect );
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPlaybackViewContainer();
+
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since S60 3.0
+     */
+    void UpdateLayout();
+    
+// from base class CoeControl
+
+    /**
+     * From CoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+
+    };
+
+#endif  // C_CMPXPLAYBACKVIEWCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/inc/mpxplaybackviewimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX playback view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXPLAYBACKVIEWIMP_H
+#define C_CMPXPLAYBACKVIEWIMP_H
+
+#include <akntoolbarobserver.h>
+
+// INCLUDES
+#include "mpxplaybackview.h"
+
+// FORWARD DECLARATIONS
+class CMPXPlaybackViewContainer;
+class CMPXPlaybackViewLayout;
+class CAknToolbar;
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX playback view.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPlaybackViewImp ) : public CMPXPlaybackView
+                                           ,public MAknToolbarObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPlaybackViewImp* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPlaybackViewImp* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPlaybackViewImp();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPlaybackViewImp();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    void DynInitMenuPaneL(
+        TInt aResourceId, 
+        CEikMenuPane* aMenuPane );
+
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Returns views id.
+     *
+     * @since 3.0
+     * @return Views Uid
+     */
+    TUid Id() const;
+
+    /**
+     * From CAknView
+     * Processes user commands.
+     *
+     * @since 3.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void ProcessCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Handles a view activation.
+     *
+     * @param aPrevViewId Specifies the view previously active.
+     * @param aCustomMessageId Specifies the message type.
+     * @param aCustomMessage The activation message.
+     */
+    void DoActivateL(
+        const TVwsViewId& aPrevViewId,
+        TUid aCustomMessageId,
+        const TDesC8& aCustomMessage );
+        
+    /**
+     * From MAknToolbarObserver
+     * Processes user commands.
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void OfferToolbarEventL( TInt aCommandId );
+      
+    /**
+     * From MAknToolbarObserver
+     * Used to change toolbar settings before it is made visible
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolBar );
+
+private:    // data
+    CMPXPlaybackViewLayout* iPlaybackViewLayout;    // owned
+    void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+    CAknToolbar* iToolbar;  //owned
+    };
+
+#endif  // C_CMPXPLAYBACKVIEWIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/inc/mpxplaybackviewlayout.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  An interface providing skin and layout data for playback view.
+*
+*/
+
+
+#ifndef C_CMPXPLAYBACKVIEWLAYOUT_H
+#define C_CMPXPLAYBACKVIEWLAYOUT_H
+
+//  INCLUDES
+#include "mpxcommonplaybackviewlayout.h"
+
+// CLASS DECLARATION
+
+/**
+*  An interface providing skin and layout data for playback view.
+*
+*  @lib mpxplaybackview.dll
+*  @since S60 v3.0
+*/
+NONSHARABLE_CLASS( CMPXPlaybackViewLayout ) : public CMPXCommonPlaybackViewLayout
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPlaybackViewLayout* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPlaybackViewLayout* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPlaybackViewLayout();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPlaybackViewLayout();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXPLAYBACKVIEWLAYOUT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/src/mpxplaybackview.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxplaybackview.h"
+#include "mpxplaybackviewimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXPlaybackView* CMPXPlaybackView::NewL()
+    {
+    return CMPXPlaybackViewImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXPlaybackView* CMPXPlaybackView::NewLC()
+    {
+    return CMPXPlaybackViewImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackView::~CMPXPlaybackView()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/src/mpxplaybackviewcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,115 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Playback view's container.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <AknDef.h>
+#include <mpxconstants.h>
+
+#include "mpxplaybackview.hlp.hrh"
+#include "mpxplaybackviewcontainer.h"
+#include "mpxplaybackviewlayoutinterface.h"
+#include "mpxlog.h"
+
+
+// CONSTANTS
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewContainer::CMPXPlaybackViewContainer(
+    MEikCommandObserver* aCommandObserver,
+    MMPXLayoutSwitchObserver* aLayoutObserver,
+    MMPXPlaybackViewLayout* aLayout )
+    {
+    iCommandObserver = aCommandObserver;
+    iLayoutObserver = aLayoutObserver;
+    iMode = EUninitialized;
+    iLayout = aLayout;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewContainer::ConstructL( const TRect& aRect )
+    {
+    MPX_DEBUG1( "CMPXPlaybackViewContainer::ConstructL() entering" );
+    
+    CMPXCommonPlaybackViewContainer::ConstructL( aRect );
+
+    MPX_DEBUG1( "CMPXPlaybackViewContainer::ConstructL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewContainer::~CMPXPlaybackViewContainer()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewContainer::UpdateLayout()
+    {
+    MPX_DEBUG1( "CMPXPlaybackViewContainer::UpdateLayout() entering" );
+    
+    CMPXCommonPlaybackViewContainer::UpdateLayout();
+
+    MPX_DEBUG1( "CMPXPlaybackViewContainer::UpdateLayout() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXPlaybackViewContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG4( "CMPXPlaybackViewContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)", 
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+        
+    return CMPXCommonPlaybackViewContainer::OfferKeyEventL( aKeyEvent, aType );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewContainer::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KAppUidMusicPlayerX;  
+    aContext.iContext = KMUS_HLP_PLAYBACK_VIEW; 
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/src/mpxplaybackviewimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <eikmenub.h>
+#include <eikapp.h>
+#include <AknUtils.h>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxcommonplaybackview.rsg>
+#include <mpxplaybackview.rsg>
+
+#include "mpxplaybackview.hrh"
+#include "mpxplaybackviewimp.h"
+#include "mpxplaybackviewcontainer.h"
+#include "mpxplaybackviewlayout.h"
+#include "mpxlog.h"
+
+#include <mpxplaybackutility.h>
+#include <akntoolbar.h>
+#include <aknbutton.h>
+#include "mpxcommonplaybackview.hrh"
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessage.h>
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewImp::CMPXPlaybackViewImp()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewImp::ConstructL()
+    {
+    MPX_FUNC( "CMPXPlaybackViewImp::ConstructL" );
+
+    CMPXCommonPlaybackViewImp::ConstructL();
+
+    BaseConstructL( R_MPX_PLAYBACK_VIEW );
+    if(AknLayoutUtils::PenEnabled())
+    {
+    if ( Toolbar() )
+        {
+        iToolbar = Toolbar();
+        iToolbar->SetToolbarObserver( this );
+        }
+    }
+
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewImp* CMPXPlaybackViewImp::NewL()
+    {
+    CMPXPlaybackViewImp* self = CMPXPlaybackViewImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewImp* CMPXPlaybackViewImp::NewLC()
+    {
+    CMPXPlaybackViewImp* self = new ( ELeave ) CMPXPlaybackViewImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewImp::~CMPXPlaybackViewImp()
+    {
+    MPX_DEBUG1( "CMPXPlaybackViewImp::~CMPXPlaybackViewImp entering" );
+
+    delete iPlaybackViewLayout;
+
+    MPX_DEBUG1( "CMPXPlaybackViewImp::~CMPXPlaybackViewImp exiting" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewImp::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    CMPXCommonPlaybackViewImp::DynInitMenuPaneL( aResourceId, aMenuPane );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Returns views id.
+// ---------------------------------------------------------------------------
+//
+TUid CMPXPlaybackViewImp::Id() const
+    {
+    return TUid::Uid( KMPXPlaybackViewId );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Processes user commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewImp::ProcessCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2("CMPXPlaybackViewImp::ProcessCommandL(%d): entering", aCommand);
+    if ( aCommand == EAknCmdExit )
+        {
+        if ( MenuBar() )
+            {
+            MenuBar()->StopDisplayingMenuBar();
+            }
+		HandleCommandL( aCommand );
+        }
+    CAknView::ProcessCommandL( aCommand );
+    MPX_DEBUG1("CMPXPlaybackViewImp::ProcessCommandL(): exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Handles a view activation.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewImp::DoActivateL(
+    const TVwsViewId& aPrevViewId,
+    TUid aCustomMessageId,
+    const TDesC8& aCustomMessage )
+    {
+    MPX_FUNC( "CMPXPlaybackViewImp::DoActivateL()" );
+MPX_PERF_START(CWM_CMPXPlaybackViewImp_DoActivateL);
+    if ( !iContainer )
+        {
+        if ( !iPlaybackViewLayout )
+            {
+            iPlaybackViewLayout = CMPXPlaybackViewLayout::NewL();
+            }
+        iContainer = new ( ELeave ) CMPXPlaybackViewContainer(
+            this,
+            this,
+            iPlaybackViewLayout );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( ClientRect() );
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+    else
+        {
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    CMPXCommonPlaybackViewImp::DoActivateL( aPrevViewId , aCustomMessageId, aCustomMessage );
+    UpdateMiddleSoftKeyDisplayL();
+    MPX_PERF_CHECKPT("Playback view displayed");
+MPX_PERF_END(CWM_CMPXPlaybackViewImp_DoActivateL);
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewImp::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_DEBUG1( "CMPXPlaybackViewImp::DoHandlePlaybackMessageL");
+
+    TMPXMessageId id( *aMessage.Value<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( *aMessage.Value<TInt>( KMPXMessageGeneralType ) );
+        TInt data( *aMessage.Value<TInt>( KMPXMessageGeneralData ) );
+        switch ( *aMessage.Value<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EStateChanged:
+                UpdateMiddleSoftKeyDisplayL();
+                UpdateToolbar();
+                break;
+
+            default:
+                break;
+            }
+        }
+    CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL (aMessage);
+    }
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Used to change toolbar settings before toolbar becomes visible
+// -----------------------------------------------------------------------------
+//
+void CMPXPlaybackViewImp::DynInitToolbarL(TInt aResourceId, CAknToolbar* aToolbar)
+    {
+    if (aResourceId == R_MPX_PBV_TOUCH_TOOLBAR)
+        {
+        // Put initializations here to take effect before toolbar is shown
+        UpdateToolbar();
+    	aToolbar->UpdateBackground();
+       }
+    }
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Handles toolbar events
+// -----------------------------------------------------------------------------
+//
+void CMPXPlaybackViewImp::OfferToolbarEventL( TInt aCommandId )
+    {
+    TInt commandId = aCommandId;
+    TInt eventModifiers = iToolbar->EventModifiers();
+    if ( eventModifiers == CAknToolbar::ELongPress )
+    	{
+    	if ( aCommandId == EMPXPbvCmdNextListItem )
+    		{
+    		commandId = EMPXPbvCmdSeekForward;
+    		}
+    	else if ( aCommandId == EMPXPbvCmdPreviousListItem )
+    		{
+    		commandId = EMPXPbvCmdSeekBackward;
+    		}
+    	}
+    else if ( eventModifiers == CAknToolbar::ELongPressEnded )
+    	{
+    	if ( aCommandId == EMPXPbvCmdNextListItem || aCommandId == EMPXPbvCmdPreviousListItem )
+    	    {
+    	    commandId = EMPXPbvCmdEndSeek;
+    	    }
+    	}
+
+    CAknView::ProcessCommandL( commandId );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/playbackview/src/mpxplaybackviewlayout.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Layout and graphic factory for Playback View
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <barsread.h>
+#include <gulicon.h>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <layoutmetadata.cdl.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxplaybackview.rsg>
+#include <centralrepository.h>
+#include <mpxinternalcrkeys.h>
+#include <mpxlbxextendedfeatures.h>
+
+#include "mpxplaybackviewlayout.h"
+#include "mpxlog.h"
+
+using namespace AknLayoutScalable_Apps;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewLayout* CMPXPlaybackViewLayout::NewL()
+    {
+    CMPXPlaybackViewLayout* self = CMPXPlaybackViewLayout::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewLayout* CMPXPlaybackViewLayout::NewLC()
+    {
+    CMPXPlaybackViewLayout* self = new ( ELeave ) CMPXPlaybackViewLayout();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewLayout::~CMPXPlaybackViewLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPlaybackViewLayout::CMPXPlaybackViewLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPlaybackViewLayout::ConstructL()
+    {
+    MPX_FUNC( "CMPXPlaybackViewLayout::ConstructL" );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/bwinscw/mpxpodcastplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	?HandleCommandL@CMPXPodcastPlaybackViewImp@@EAEXH@Z @ 1 NONAME ; void CMPXPodcastPlaybackViewImp::HandleCommandL(int)
+	?NewL@CMPXPodcastPlaybackView@@SAPAV1@XZ @ 2 NONAME ; class CMPXPodcastPlaybackView * CMPXPodcastPlaybackView::NewL(void)
+	?NewLC@CMPXPodcastPlaybackView@@SAPAV1@XZ @ 3 NONAME ; class CMPXPodcastPlaybackView * CMPXPodcastPlaybackView::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/data/mpxpodcastplaybackview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxpodcastplaybackview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MDPV // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+
+#include <mpxcommonplaybackview.rsg>
+#include <mpxcommonplaybackview.mbg>
+#include "mpxcommonplaybackview.hrh"
+#include <mpxcommonplaybackview.loc>
+#include <mpxpodcastplaybackview.loc>
+#include "mpxpodcastplaybackview.hrh"
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_playback_view
+// Podcast playback view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_mpx_podcast_playback_view
+    {
+    menubar = r_mpx_podcast_playback_view_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    toolbar = R_MPX_PBV_TOUCH_TOOLBAR;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_playback_view_menubar
+// Podcast playback view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_podcast_playback_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = R_MPX_PLAYBACK_VIEW_MENU;
+            },
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_podcast_playback_view_menu1;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_playback_view_menu1
+// Podcast playback view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_podcast_playback_view_menu1
+    {
+    items=
+        {
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdGoToPodcastMenu;
+            txt = qtn_mus_options_go_to_podcast_menu;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_unknown_title
+// Text to show when podcast title information is not available.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_unknown_title
+    {
+    buf = qtn_nmp_unknown;
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/eabi/mpxpodcastplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	_ZN23CMPXPodcastPlaybackView4NewLEv @ 1 NONAME
+	_ZN23CMPXPodcastPlaybackView5NewLCEv @ 2 NONAME
+	_ZN26CMPXPodcastPlaybackViewImp14HandleCommandLEi @ 3 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxpodcastplaybackview.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxpodcastplaybackview.loc	APP_LAYER_LOC_EXPORT_PATH(mpxpodcastplaybackview.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxpodcastplaybackview.mif
+OPTION HEADERFILE mpxpodcastplaybackview.mbg
+OPTION SOURCES -c16,8 qgn_indi_mup_default_album_pcast
+END
+
+
+PRJ_MMPFILES
+
+
+mpxpodcastplaybackview.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1 @@
+/c16,8 qgn_indi_mup_default_album_pcast.svg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/group/mpxpodcastplaybackview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxpodcastplaybackview.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxpodcastplaybackview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFCB8
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH      ../src
+SOURCE          mpxpodcastplaybackviewcontainer.cpp
+SOURCE          mpxpodcastplaybackview.cpp
+SOURCE          mpxpodcastplaybackviewimp.cpp
+SOURCE          mpxpodcastplaybackviewlayout.cpp
+
+START RESOURCE  ../data/mpxpodcastplaybackview.rss
+DEPENDS mpxcommonplaybackview.rsg
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         ws32.lib
+LIBRARY         fbscli.lib
+LIBRARY         bitgdi.lib
+LIBRARY         gdi.lib
+LIBRARY         egul.lib
+LIBRARY         eikctl.lib
+LIBRARY         eiksrv.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknicon.lib
+LIBRARY         featmgr.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknskinsrv.lib
+LIBRARY         commonengine.lib
+LIBRARY         centralrepository.lib
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         cdlengine.lib
+
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxmediakeyhandler.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcommonplaybackview.lib
+LIBRARY         mpxcollectionhelper.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/group/mpxpodcastplaybackviewicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxpodcastplaybackview
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxpodcastplaybackview.mif
+HEADERFILENAME=$(HEADERDIR)/mpxpodcastplaybackview.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/inc/mpxpodcastplaybackview.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxpodcastplaybackview
+*
+*/
+
+
+
+#ifndef MPXPODCASTPLAYBACKVIEW_HLP_HRH
+#define MPXPODCASTPLAYBACKVIEW_HLP_HRH
+
+_LIT( KMUS_HLP_PODCAST_PLAYBACK_VIEW, "MUS_HLP_PLAYBACK_VIEW" );
+
+#endif  // MPXPODCASTPLAYBACKVIEW_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/inc/mpxpodcastplaybackview.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxpodcastplaybackview
+*
+*/
+
+
+
+#ifndef MPXPODCASTPLAYBACKVIEW_HRH
+#define MPXPODCASTPLAYBACKVIEW_HRH
+
+// ENUMS
+
+/** Command ID's. */
+enum TMPXPodcastPlaybackViewCommandIds
+    {
+    EMPXPbvCmdGoToPodcastMenu = 0x1A00
+    };
+
+#define KMPXPodcastPlaybackViewId 0x101FFCB8
+
+#endif  // MPXPODCASTPLAYBACKVIEW_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/inc/mpxpodcastplaybackviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX podcast playback view's container implementation.
+*
+*/
+
+
+
+#ifndef C_CMPXPODCASTPLAYBACKVIEWCONTAINER_H
+#define C_CMPXPODCASTPLAYBACKVIEWCONTAINER_H
+
+
+// INCLUDES
+#include "mpxcommonplaybackviewcontainer.h"
+
+
+// FORWARD DECLARATIONS
+class MMPXLayoutSwitchObserver;
+class MMPXPlaybackViewLayout;
+
+// CLASS DECLARATION
+
+/**
+ *  Container class for podcast playback view.
+ *
+ *  @lib mpxpodcastplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPodcastPlaybackViewContainer ) : public CMPXCommonPlaybackViewContainer
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     *
+     * @param aCommandObserver  Observer for commands.
+     * @param aLayoutObserver   Observer to send layout switch events to.
+     * @param aLayout           Pointer to playback view layout.
+     */
+    CMPXPodcastPlaybackViewContainer(
+        MEikCommandObserver* aCommandObserver,
+        MMPXLayoutSwitchObserver* aLayoutObserver,
+        MMPXPlaybackViewLayout* aLayout );
+
+    /**
+     * Symbian 2nd phase constructor.
+     * 
+     * @param aRect Frame rectangle for container.
+     */
+    void ConstructL( const TRect& aRect );
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPodcastPlaybackViewContainer();
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since S60 3.0
+     */
+    void UpdateLayout();
+    
+// from base class CoeControl
+
+    /**
+     * From CoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+    /**
+     * From CoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+    };
+
+#endif  // C_CMPXPODCASTPLAYBACKVIEWCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/inc/mpxpodcastplaybackviewimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,198 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX Podcast playback view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXPODCASTPLAYBACKVIEWIMP_H
+#define C_CMPXPODCASTPLAYBACKVIEWIMP_H
+
+
+// INCLUDES
+#include "mpxpodcastplaybackview.h"
+#include <akntoolbarobserver.h>
+
+// FORWARD DECLARATIONS
+class MMPXCollectionUtility;
+class MMPXCollectionUiHelper;
+class CMPXPodcastPlaybackViewContainer;
+class CMPXPodcastPlaybackViewLayout;
+class CAknToolbar;
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX playback view.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPodcastPlaybackViewImp ) : public CMPXPodcastPlaybackView
+                                           ,public MAknToolbarObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPodcastPlaybackViewImp* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPodcastPlaybackViewImp* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPodcastPlaybackViewImp();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPodcastPlaybackViewImp();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+// from base class CMPXCommonPlaybackViewImp
+
+    /**
+     *  Handle playback property
+     *
+     *  @param aProperty the property
+     *  @param aValue the value of the property
+     *  @param aError error code
+     */
+    virtual void DoHandlePropertyL(
+        TMPXPlaybackProperty aProperty,
+        TInt aValue,
+        TInt aError );
+
+    /**
+     * Updates track info field.
+     *
+     * @param aMedia Media's properties. If NULL, default info will
+     *                    be shown.
+     */
+    void UpdateTrackInfoL( const CMPXMedia* aMedia );
+
+    /**
+    * Restore status pane to it's normal state.
+    */
+    void PrepareStatusPaneForExitingViewL();
+
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    void DynInitMenuPaneL(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Returns views id.
+     *
+     * @since 3.0
+     * @return Views Uid
+     */
+    TUid Id() const;
+
+    /**
+     * From CAknView
+     * Command handling function.
+     *
+     * @since 3.0
+     * @param aCommand Command which is handled
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Handles a view activation.
+     *
+     * @param aPrevViewId Specifies the view previously active.
+     * @param aCustomMessageId Specifies the message type.
+     * @param aCustomMessage The activation message.
+     */
+    void DoActivateL(
+        const TVwsViewId& aPrevViewId,
+        TUid aCustomMessageId,
+        const TDesC8& aCustomMessage );
+
+    /**
+     * From MAknToolbarObserver
+     * Processes user commands.
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void OfferToolbarEventL( TInt aCommandId );
+
+    /**
+     * From MAknToolbarObserver
+     * Used to change toolbar settings before it is made visible
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolBar );
+
+    /**
+     *  Handle playback message
+     *
+     *  @param aMsg playback message
+     */
+    void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+    /**
+     * Updates the middle (play/pause) toolbar control key
+     * icon based on playback state
+     */
+    void UpdateToolbar();
+
+private:    // data
+
+    CMPXPodcastPlaybackViewLayout* iPlaybackViewLayout;    // owned
+
+    TInt  iPodcastResourceOffset;    // must be freed
+    TInt  iPosition;
+    CAknToolbar* iToolbar; //owned
+    };
+
+#endif  // C_CMPXPODCASTPLAYBACKVIEWIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/inc/mpxpodcastplaybackviewlayout.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  An interface providing skin and layout data for podcast playback view.
+*
+*/
+
+
+#ifndef C_CMPXPODCASTPLAYBACKVIEWLAYOUT_H
+#define C_CMPXPODCASTPLAYBACKVIEWLAYOUT_H
+
+//  INCLUDES
+#include "mpxcommonplaybackviewlayout.h"
+
+// CLASS DECLARATION
+
+/**
+*  An interface providing skin and layout data for podcast playback view.
+*
+*  @lib mpxpodcastplaybackview.dll
+*  @since S60 v3.0
+*/
+NONSHARABLE_CLASS( CMPXPodcastPlaybackViewLayout ) : public CMPXCommonPlaybackViewLayout
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPodcastPlaybackViewLayout* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPodcastPlaybackViewLayout* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXPodcastPlaybackViewLayout();
+
+    /**
+     * Get the bitmap and mask for a given indicator.
+     *
+     * @since 3.0
+     * @param  aIndicator   Enumeration value identifying the indicator
+     * @return CGulIcon     Indicator graphic and mask. Ownership 
+     *                      transferred to caller.
+     */
+    CGulIcon* GetIndicatorIconMaskL(
+        TMPXPbvIndicator aIndicator );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPodcastPlaybackViewLayout();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXPODCASTPLAYBACKVIEWLAYOUT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/loc/mpxpodcastplaybackview.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxpodcastplaybackview
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Text in main pane.
+// d:Shown when no title metadata can be found in the track.
+// l:main_mup3_pane_t1
+// r:5.0
+//
+#define qtn_nmp_unknown "Unknown"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/src/mpxpodcastplaybackview.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Podcast Playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxpodcastplaybackview.h"
+#include "mpxpodcastplaybackviewimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXPodcastPlaybackView* CMPXPodcastPlaybackView::NewL()
+    {
+    return CMPXPodcastPlaybackViewImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXPodcastPlaybackView* CMPXPodcastPlaybackView::NewLC()
+    {
+    return CMPXPodcastPlaybackViewImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackView::~CMPXPodcastPlaybackView()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/src/mpxpodcastplaybackviewcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Podcast Playback view's container.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <AknDef.h>
+#include <mpxconstants.h>
+
+#include "mpxpodcastplaybackview.hlp.hrh"
+#include "mpxpodcastplaybackviewcontainer.h"
+#include "mpxplaybackviewlayoutinterface.h"
+#include "mpxlog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewContainer::CMPXPodcastPlaybackViewContainer(
+    MEikCommandObserver* aCommandObserver,
+    MMPXLayoutSwitchObserver* aLayoutObserver,
+    MMPXPlaybackViewLayout* aLayout )
+    {
+    iCommandObserver = aCommandObserver;
+    iLayoutObserver = aLayoutObserver;
+    iMode = EUninitialized;
+    iLayout = aLayout;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewContainer::ConstructL( const TRect& aRect )
+    {
+    MPX_DEBUG1( "CMPXPodcastPlaybackViewContainer::ConstructL() entering" );
+    
+    CMPXCommonPlaybackViewContainer::ConstructL( aRect );
+
+    MPX_DEBUG1( "CMPXPodcastPlaybackViewContainer::ConstructL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewContainer::~CMPXPodcastPlaybackViewContainer()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewContainer::UpdateLayout()
+    {
+    MPX_DEBUG1( "CMPXPlaybackViewContainer::UpdateLayout() entering" );
+    
+    CMPXCommonPlaybackViewContainer::UpdateLayout();
+
+    MPX_DEBUG1( "CMPXPlaybackViewContainer::UpdateLayout() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXPodcastPlaybackViewContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG4( "CMPXPlaybackViewContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)", 
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+        
+    return CMPXCommonPlaybackViewContainer::OfferKeyEventL( aKeyEvent, aType );
+    }
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewContainer::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KAppUidMusicPlayerX;  
+    aContext.iContext = KMUS_HLP_PODCAST_PLAYBACK_VIEW; 
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/src/mpxpodcastplaybackviewimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,545 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Podcast playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include <aknViewAppUi.h>
+#include <eikmenub.h>
+#include <eikapp.h>
+#include <AknUtils.h>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxpodcastplaybackview.rsg>
+#include <mpxcommonplaybackview.rsg>
+#include <featmgr.h>
+
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxmedia.h>
+#include <mpxviewutility.h>
+#include <mpxviewpluginmanager.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxpodcastdefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxplaybackutility.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessage.h>
+#include <mpxuser.h>
+#include <mpxappui.hrh>
+#include "mpxcommonplaybackview.hrh"
+#include "mpxpodcastplaybackviewimp.h"
+#include "mpxpodcastplaybackviewcontainer.h"
+#include "mpxpodcastplaybackviewlayout.h"
+#include "mpxpodcastplaybackview.hrh"
+#include "mpxlog.h"
+
+#include "mpxcommonplaybackview.hrh"
+
+#include <akntoolbar.h>
+#include <aknbutton.h>
+// CONSTANTS
+_LIT( KMPXPodcastPlaybackRscPath, "mpxpodcastplaybackview.rsc" );
+const TInt KPodcastingCollectionID = 0x101FFC3C;
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewImp::CMPXPodcastPlaybackViewImp()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewImp::ConstructL()
+    {
+    MPX_FUNC( "CMPXPodcastPlaybackViewImp::ConstructL" );
+
+    CCoeEnv* coeEnv = iEikonEnv;
+    TParse parse;
+    parse.Set( KMPXPodcastPlaybackRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iPodcastResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    CMPXCommonPlaybackViewImp::ConstructL();
+
+    BaseConstructL( R_MPX_PODCAST_PLAYBACK_VIEW );
+    if(AknLayoutUtils::PenEnabled())
+    {
+    if ( Toolbar() )
+        {
+        iToolbar = Toolbar();
+        iToolbar->SetToolbarObserver( this );
+        }
+    }
+
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewImp* CMPXPodcastPlaybackViewImp::NewL()
+    {
+    CMPXPodcastPlaybackViewImp* self = CMPXPodcastPlaybackViewImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewImp* CMPXPodcastPlaybackViewImp::NewLC()
+    {
+    CMPXPodcastPlaybackViewImp* self = new ( ELeave ) CMPXPodcastPlaybackViewImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewImp::~CMPXPodcastPlaybackViewImp()
+    {
+    MPX_DEBUG1( "CMPXPodcastPlaybackViewImp::~CMPXPodcastPlaybackViewImp entering" );
+
+    delete iPlaybackViewLayout;
+
+    if ( iPodcastResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iPodcastResourceOffset );
+        }
+
+    MPX_DEBUG1( "CMPXPodcastPlaybackViewImp::~CMPXPodcastPlaybackViewImp exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From base class CMPXCommonPlaybackViewImp
+//
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewImp::DoHandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXPodcastPlaybackViewImp::DoHandlePropertyL" );
+    MPX_DEBUG4( "HandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError );
+
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty  )
+            {
+            case EPbPropertyPosition:
+                {
+                if (iPosition == 0 && aValue != 0)
+                    {
+                    MMPXSource* s = iPlaybackUtility->Source();
+                    if (s)
+                        {
+                        // Trick to make the song played
+                        CMPXCollectionPlaylist* playlist = s->PlaylistL();
+                        CleanupStack::PushL(playlist);
+                        if ( playlist )
+                            {
+                            CMPXMedia* media = CMPXMedia::NewL();
+                            CleanupStack::PushL(media);
+                            media->SetTObjectValueL( KMPXMediaGeneralType,
+                                                     EMPXItem );
+                            media->SetTObjectValueL( KMPXMediaGeneralCategory,
+                                                     EMPXSong );
+                            media->SetTObjectValueL( KMPXMediaGeneralCollectionId,
+                                                     playlist->Path().Id( CMPXCollectionPath::ECollectionUid ).iId1);
+
+                            media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId , playlist->Path().Id() );
+                            media->SetTObjectValueL( KMPXMediaGeneralLastPlaybackPosition, aValue );
+                            playlist->SetL( *media );
+                            CleanupStack::PopAndDestroy(media);
+                            }
+                        CleanupStack::PopAndDestroy(playlist);
+                        }
+                    }
+                iPosition = aValue;
+                CMPXCommonPlaybackViewImp::DoHandlePropertyL(aProperty, aValue, aError);
+                break;
+                }
+            default:
+                {
+                CMPXCommonPlaybackViewImp::DoHandlePropertyL(aProperty,
+                    aValue,
+                    aError);
+                break;
+                }
+            }
+        }
+    else
+        {
+        HandleErrorL( aError );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates track info field.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewImp::UpdateTrackInfoL(
+    const CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXPodcastPlaybackViewImp::UpdateTrackInfo" );
+
+    CMPXCommonPlaybackViewImp::UpdateTrackInfoL( aMedia );
+
+    if( iContainer && !iSwitchingView )
+        {
+        if ( aMedia )
+            {
+            // Set ETextArtist field as Podcast Title
+            if ( aMedia->IsSupported(KMPXMediaMusicAlbum))
+                {
+                HBufC* titleText = aMedia->ValueText(KMPXMediaMusicAlbum).AllocL();
+                CleanupStack::PushL(titleText);
+                if ( titleText->Length() > 0)
+                    {
+                    iContainer->UpdateLabelL( ETextArtist, *titleText );
+                    }
+                else
+                    {
+                    HBufC* unknownText =
+                        StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_TITLE );
+                    iContainer->UpdateLabelL(
+                        ETextArtist, *unknownText );
+                    CleanupStack::PopAndDestroy( unknownText );
+                    }
+                CleanupStack::PopAndDestroy( titleText );
+                }
+            else
+                {
+                HBufC* unknownText =
+                        StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_TITLE );
+                iContainer->UpdateLabelL(
+                    ETextArtist, *unknownText );
+                CleanupStack::PopAndDestroy( unknownText );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewImp::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    switch( aResourceId )
+        {
+        case R_MPX_PODCAST_PLAYBACK_VIEW_MENU1:
+            {
+            break;
+            }
+        case R_MPX_PLAYBACK_VIEW_MENU:
+            {
+            CMPXCommonPlaybackViewImp::DynInitMenuPaneL( aResourceId, aMenuPane );
+
+            // dim the options that aren't applicable
+            // to podcast collection
+            aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdGotoMusicMenu,
+                    ETrue );
+            aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdAddToPlaylist,
+                    ETrue );
+            aMenuPane->SetItemDimmed(
+                EMPXPbvCmdUseAsCascade,
+                ETrue );
+            aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdRepeat,
+                    ETrue );
+            aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdRandom,
+                    ETrue );
+
+			// Check if FM Transmitter is supported
+			if ( !FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+				{
+				aMenuPane->SetItemDimmed(
+					EMPXPbvCmdFMTransmitter,
+					ETrue );
+				}
+            break;
+            }
+        default:
+            {
+            // Call base clase to handle most cases
+            CMPXCommonPlaybackViewImp::DynInitMenuPaneL(
+                aResourceId,
+                aMenuPane );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Returns views id.
+// ---------------------------------------------------------------------------
+//
+TUid CMPXPodcastPlaybackViewImp::Id() const
+    {
+    return TUid::Uid( KMPXPodcastPlaybackViewId );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Command handling function.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CMPXPodcastPlaybackViewImp::HandleCommandL( TInt aCommand )
+    {
+    switch( aCommand )
+        {
+        case EMPXPbvCmdGoToPodcastMenu:
+            {
+            // Handle Goto main podcast menu
+            CMPXCollectionPath* cpath = iCollectionUiHelper->PodCastMenuPathL();
+            CleanupStack::PushL( cpath );
+            MPX_DEBUG_PATH (*cpath);
+            iCollectionUtility->Collection().OpenL( *cpath );
+            CleanupStack::PopAndDestroy( cpath );
+
+            // Restore status pane
+            if ( StatusPane()->CurrentLayoutResId() !=
+                 R_AVKON_STATUS_PANE_LAYOUT_USUAL)
+                {
+                StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+                }
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            MMPXSource* s = iPlaybackUtility->Source();
+            TBool handled = EFalse;
+            if(s == NULL)
+                {
+                CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+                CleanupStack::PushL(path);
+                TInt levels = path->Levels();
+                if(levels == 3)
+                    {
+                    const TMPXItemId& iid0 = path->Id(0);
+                    const TMPXItemId& iid1 = path->Id(1);
+                    if(iid0 == KPodcastingCollectionID && iid1 == 4) //EBrowseNotPlayed
+                        {
+                        path->Back();
+                        iViewUtility->PushDefaultHistoryL();
+                        iCollectionUtility->Collection().OpenL(*path);
+                        handled = ETrue;
+                        }
+                    }
+                CleanupStack::PopAndDestroy(path);
+                }
+            if(!handled)
+                {
+                CMPXCommonPlaybackViewImp::HandleCommandL( aCommand );
+                }
+            break;
+            }
+        default:
+            {
+            CMPXCommonPlaybackViewImp::HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Handles a view activation.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewImp::DoActivateL(
+    const TVwsViewId& aPrevViewId,
+    TUid aCustomMessageId,
+    const TDesC8& aCustomMessage )
+    {
+    MPX_FUNC( "CMPXPodcastPlaybackViewImp::DoActivateL()" );
+
+    if ( !iContainer )
+        {
+        if ( !iPlaybackViewLayout )
+            {
+            iPlaybackViewLayout = CMPXPodcastPlaybackViewLayout::NewL();
+            }
+        iContainer = new ( ELeave ) CMPXPodcastPlaybackViewContainer(
+            this,
+            this,
+            iPlaybackViewLayout );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( ClientRect() );
+        AppUi()->AddToStackL( *this, iContainer );
+        }
+
+    CMPXCommonPlaybackViewImp::DoActivateL( aPrevViewId , aCustomMessageId, aCustomMessage );
+    UpdateMiddleSoftKeyDisplayL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastPlaybackViewImp::PrepareStatusPaneForExitingViewL
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewImp::PrepareStatusPaneForExitingViewL()
+    {
+    if ( StatusPane()->CurrentLayoutResId() !=
+         R_AVKON_STATUS_PANE_LAYOUT_USUAL)
+        {
+        StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+        }
+    }
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Used to change toolbar settings before toolbar becomes visible
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewImp::DynInitToolbarL(TInt aResourceId, CAknToolbar* aToolbar)
+    {
+    if (aResourceId == R_MPX_PBV_TOUCH_TOOLBAR)
+        {
+        // Put initializations here to take effect before toolbar is shown
+        UpdateToolbar();
+        aToolbar->UpdateBackground();
+       }
+    }
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Handles toolbar events
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewImp::OfferToolbarEventL( TInt aCommandId )
+    {
+    TInt commandId = aCommandId;
+    TInt eventModifiers = iToolbar->EventModifiers();
+    if ( eventModifiers == CAknToolbar::ELongPress )
+        {
+        if ( aCommandId == EMPXPbvCmdNextListItem )
+            {
+            commandId = EMPXPbvCmdSeekForward;
+            }
+        else if ( aCommandId == EMPXPbvCmdPreviousListItem )
+            {
+            commandId = EMPXPbvCmdSeekBackward;
+            }
+        }
+    else if ( eventModifiers == CAknToolbar::ELongPressEnded )
+        {
+        if ( aCommandId == EMPXPbvCmdNextListItem || aCommandId == EMPXPbvCmdPreviousListItem )
+            {
+            commandId = EMPXPbvCmdEndSeek;
+            }
+        }
+
+    CAknView::ProcessCommandL( commandId );
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewImp::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_DEBUG1( "CMPXPodcastPlaybackViewImp::DoHandlePlaybackMessageL");
+
+    TMPXMessageId id( *aMessage.Value<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( *aMessage.Value<TInt>( KMPXMessageGeneralType ) );
+        TInt data( *aMessage.Value<TInt>( KMPXMessageGeneralData ) );
+        switch ( *aMessage.Value<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EStateChanged:
+                UpdateMiddleSoftKeyDisplayL();
+                UpdateToolbar();
+                break;
+
+            default:
+                break;
+            }
+        }
+    CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL (aMessage);
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the middle toolbar button
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewImp::UpdateToolbar()
+    {
+    MPX_FUNC("CMPXPodcastPlaybackViewImp::UpdateToolbar");
+
+    if ( AknLayoutUtils::PenEnabled() )
+        {
+        if ( iToolbar )
+            {
+            CAknButton* pausePlayControl;
+            pausePlayControl = (CAknButton*)(iToolbar->ComponentControl( 1 ));
+            MMPXSource* s = iPlaybackUtility->Source();
+            if ( s )
+                {
+                CMPXCollectionPlaylist* playlist = s->PlaylistL();
+                if ( playlist )
+                    {
+                    if ( playlist->Count() > 0 && pausePlayControl )
+                        {
+                        TMPXPlaybackState state = iPlaybackUtility->StateL();
+                        if ((state == EPbStateInitialising) || (state == EPbStatePlaying))
+                           {
+                           pausePlayControl->SetCurrentState(0, ETrue);
+                           }
+                        else
+                           {
+                           pausePlayControl->SetCurrentState(1, ETrue);
+                           }
+                        }
+                    }
+                delete playlist;
+                }
+            }
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastplaybackview/src/mpxpodcastplaybackviewlayout.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Layout and graphic factory for Podcast Playback View
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <barsread.h>
+#include <gulicon.h>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <layoutmetadata.cdl.h>
+#include <data_caging_path_literals.hrh>
+#include <centralrepository.h>
+#include <mpxuser.h>
+
+#include <mpxpodcastplaybackview.mbg>
+#include "mpxpodcastplaybackviewlayout.h"
+#include "mpxlog.h"
+
+
+// CONSTANTS
+_LIT( KMPXPodcastPlaybackViewIconFile, "mpxpodcastplaybackview.mbm" );
+
+
+using namespace AknLayoutScalable_Apps;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewLayout* CMPXPodcastPlaybackViewLayout::NewL()
+    {
+    CMPXPodcastPlaybackViewLayout* self = CMPXPodcastPlaybackViewLayout::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewLayout* CMPXPodcastPlaybackViewLayout::NewLC()
+    {
+    CMPXPodcastPlaybackViewLayout* self = new ( ELeave ) CMPXPodcastPlaybackViewLayout();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewLayout::~CMPXPodcastPlaybackViewLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastPlaybackViewLayout::CMPXPodcastPlaybackViewLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastPlaybackViewLayout::ConstructL()
+    {
+    MPX_FUNC( "CMPXPodcastPlaybackViewLayout::ConstructL" );
+    }
+
+// ---------------------------------------------------------------------------
+// Get the bitmap and mask for a given indicator.
+// ---------------------------------------------------------------------------
+//
+CGulIcon* CMPXPodcastPlaybackViewLayout::GetIndicatorIconMaskL(
+    TMPXPbvIndicator aIndicator )
+    {
+    TParse parse;
+    parse.Set( KMPXPodcastPlaybackViewIconFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    switch ( aIndicator )
+        {
+        case EAlbumArtArea:
+            {
+            return AknsUtils::CreateGulIconL(
+                skin,
+                KAknsIIDQgnIndiMupDefaultAlbumPcast,
+                iconFile,
+                EMbmMpxpodcastplaybackviewQgn_indi_mup_default_album_pcast,
+                EMbmMpxpodcastplaybackviewQgn_indi_mup_default_album_pcast_mask );
+            }
+        default:
+            {
+            return CMPXCommonPlaybackViewLayout::GetIndicatorIconMaskL(
+                aIndicator );
+            }
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/bwinscw/mpxpodcastcollectionviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewL@CMPXPodcastCollectionView@@SAPAV1@XZ @ 1 NONAME ; class CMPXPodcastCollectionView * CMPXPodcastCollectionView::NewL(void)
+	?NewLC@CMPXPodcastCollectionView@@SAPAV1@XZ @ 2 NONAME ; class CMPXPodcastCollectionView * CMPXPodcastCollectionView::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/data/mpxpodcastcollectionview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,912 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxpodcastcollectionview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MPCV // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <CommonDialogs.hrh> 
+#include <CommonDialogs.rh> 
+#include <bldvariant.hrh>
+#include <pathconfiguration.hrh>
+
+#include <AiwCommon.hrh>
+#include <AiwCommon.rh>
+
+#include <mpxappui.hrh>
+#include <mpxpodcastcollectionview.loc>
+#include "mpxpodcastcollectionview.hrh"
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_collection_view
+// Podcast Collection view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_mpx_podcast_collection_view
+    {
+    menubar = r_mpx_podcast_collection_titles_view_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_collection_view_menubar
+// Podcast Collection view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_podcast_collection_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_podcast_collection_view_podcast_menu;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_collection_view_podcast_menu
+// Podcast Collection view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_podcast_collection_view_podcast_menu
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToNowPlaying;
+            txt = qtn_nmp_options_go_to_nowplaying;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdPodcasting;
+            txt = qtn_nmp_options_go_to_podcasting;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdLibraryDetails;
+            txt = qtn_mus_options_details_podcast_library;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+    
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_collection_titles_view_menubar
+// Podcast Collection view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_podcast_collection_titles_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_podcast_collection_view_menu_1;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_collection_publishdate_view_menubar
+// Podcast Collection view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_podcast_collection_publishdate_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_podcast_collection_view_menu_1;
+            }
+        };
+    }
+    
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_collection_view_menu_1
+// Podcast Collection view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_podcast_collection_view_menu_1
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToNowPlaying;
+            txt = qtn_nmp_options_go_to_nowplaying;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdFind;
+            txt = qtn_options_find;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdUpnpPlayVia;
+            txt = qtn_nmp_options_play_via;
+            cascade = r_mpx_podcast_collection_play_via_sub_menu; 
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdUPnPAiwCmdCopyToExternalCriteria;
+            txt = "(copy to ext)";
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdDelete;
+            txt = qtn_mus_options_delete;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;            
+#endif
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdPodcasting;
+            txt = qtn_nmp_options_go_to_podcasting;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdLibraryDetails;
+            txt = qtn_mus_options_details_podcast_library;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+#ifdef SINGLE_CLICK_INCLUDED
+// ---------------------------------------------------------------------------
+// r_mpx_collection_view_menubar_no_marking
+// Collection view menu bar without marking.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_podcast_collection_episodes_view_no_marking
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_podcast_collection_view_menu_3;
+            },
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_podcast_collection_view_menu_2;
+            }
+        };
+    }
+#endif
+
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_collection_episodes_view_menubar
+// Podcast Collection view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_podcast_collection_episodes_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_podcast_collection_view_menu_3;
+            },
+        MENU_TITLE 
+            {
+            menu_pane = R_AVKON_MENUPANE_MARKABLE_LIST;
+            },
+        MENU_TITLE 
+            {
+            menu_pane = r_mpx_podcast_collection_view_menu_2;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_collection_view_menu_2
+// Podcast Collection view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_podcast_collection_view_menu_2
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdGoToNowPlaying;
+            txt = qtn_nmp_options_go_to_nowplaying;
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdFind;
+            txt = qtn_options_find;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdUpnpPlayVia;
+            txt = qtn_nmp_options_play_via;
+            cascade = r_mpx_podcast_collection_play_via_sub_menu; 
+            },    
+        MENU_ITEM
+            {
+            command = EMPXCmdUPnPAiwCmdCopyToExternalCriteria;
+            txt = "(copy to ext)";
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdSend;
+            txt = qtn_options_send_via;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;            
+#endif
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdDelete;
+            txt = qtn_mus_options_delete;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;            
+#endif
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdSetPlayed;
+            txt = qtn_nmp_options_set_to_played;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;            
+#endif
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdSetUnplayed;
+            txt = qtn_nmp_options_set_to_unplayed;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;            
+#endif
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_collection_view_menu_3
+// Podcast Collection view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_podcast_collection_view_menu_3
+    {
+    items=
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdEpisodeDetails;
+            txt = qtn_mus_options_details_episode;
+#ifdef SINGLE_CLICK_INCLUDED
+            flags = EEikMenuItemSpecific;            
+#endif
+            },
+        MENU_ITEM
+            {
+            command = EMPXCmdPodcasting;
+            txt = qtn_nmp_options_go_to_podcasting;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdHelp;
+            txt = qtn_options_help;
+            },
+        MENU_ITEM
+            {
+            command = EAknCmdExit;
+            txt = qtn_options_exit;
+            }
+        };
+    }
+
+
+// ---------------------------------------------------------------------------
+// r_mpx_podcast_collectionview_title
+// Title for Podcast Collection view.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_podcast_collection_view_title
+    {
+    buf = qtn_mp_title_my_podcast;
+    }
+
+            
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_unknown_title
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_mpx_qtn_nmp_unknown_title
+    {
+    buf = qtn_mp_list_unknown;
+    }   
+
+// ---------------------------------------------------------------------------
+// r_mpx_playback_collection_via_sub_menu
+// Collection view UPnP Play Via sub menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_podcast_collection_play_via_sub_menu
+    {
+    items = 
+        {
+        MENU_ITEM
+            {
+            command = EMPXCmdUpnpPlayViaLocal;
+            txt = qtn_nmp_options_play_device;
+            flags = EEikMenuItemRadioStart;
+            },
+        MENU_ITEM
+            { 
+            command = EMPXCmdUpnpPlayViaRemotePlayer;
+            txt = qtn_nmp_options_play_homenet;
+            flags = EEikMenuItemRadioEnd;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_upnp_copy_to_external_menu_interest
+// Copy to remote menu definition needed by AIW to display and handle the menu
+// ---------------------------------------------------------------------------
+//
+RESOURCE AIW_INTEREST r_mpx_upnp_copy_to_external_menu_interest
+    {
+    items=
+        {
+        AIW_CRITERIA_ITEM
+            {
+            id = EMPXCmdUPnPAiwCmdCopyToExternalCriteria;
+            serviceCmd   = KAiwCmdUPnPCopy; //AIWCommon.hrh
+            serviceClass = KAiwClassMenu;   //AIWCommon.hrh
+            contentType  = "*";
+//            maxProviders = 1;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_delete_confirmation_query
+// Confirmation query dialog for deleting.
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_cui_delete_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_generic_confirmation_query
+// Generic confirmation query dialog.
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_collection_generic_confirmation_query
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_mpx_options_back_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_back_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_back;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_open;
+            }
+        };
+    }
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_options_back_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_back_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_back;
+            }
+        };
+    }
+#endif // __ENABLE_MSK
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// r_mpx_options_exit_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_exit_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_exit;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_open;
+            }
+        };
+    }
+#else
+// ---------------------------------------------------------------------------
+// r_mpx_options_exit_cba_no_action
+// ---------------------------------------------------------------------------
+// 
+RESOURCE CBA r_mpx_options_exit_cba_no_action
+    {
+    buttons = 
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            txt = text_softkey_exit;
+            }
+        };
+    }
+#endif // __ENABLE_MSK
+    
+// ---------------------------------------------------------------------------
+// r_mpx_cui_collection_details_headings
+// Headings for Collection Details popup
+// ---------------------------------------------------------------------------
+//
+#ifdef RD_MULTIPLE_DRIVE
+RESOURCE ARRAY r_mpx_podcast_cui_collection_details_headings
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_nmp_detail_number_of_episodes;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_phone_memory;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_mass_memory;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_mmc;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_date_refresh;
+            }
+        };
+    }   
+#else
+RESOURCE ARRAY r_mpx_podcast_cui_collection_details_headings
+    {
+    items =
+        {
+        LBUF
+            {
+            txt = qtn_nmp_detail_number_of_episodes;
+            },
+        LBUF
+            {
+            txt = qtn_mp_details_duration;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_phone_memory;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_memory_card;
+            },
+        LBUF
+            {
+            txt = qtn_nmp_details_date_refresh;
+            }
+        };
+    }   
+#endif // RD_MULTIPLE_DRIVE   
+ 
+
+// ---------------------------------------------------------------------------
+// r_mpx_collection_waitnote_softkeys_empty_stop
+// Softkeys used by generic wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_collection_waitnote_softkeys_empty_stop
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;
+            txt = text_softkey_stop;
+            }
+        };
+    }
+    
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_query_common_conf_delete
+// Text for single item deletion confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_query_common_conf_delete
+    {
+    buf = qtn_query_common_conf_delete;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_to_be_implemented
+// notes for To be implemented.
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_qtn_to_be_implemented
+    {
+    buf = qtn_mpx_to_be_implemented;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_del_songs_query
+// Text for multiple tracks deletion confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_del_songs_query
+    {
+    buf = qtn_nmp_del_songs_query;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_query_conf_delete_group
+// Text for group deletion confirmation query.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_query_conf_delete_group
+    {
+    buf = qtn_nmp_query_conf_delete_group;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_del_songs_wait_note
+// Text for multiple item deletion wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_del_songs_wait_note
+    {
+    buf = qtn_nmp_del_songs_wait_note;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_album_waiting_deleting
+// Text for single item deletion wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_album_waiting_deleting
+    {
+    buf = qtn_album_waiting_deleting;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_mus_query_conf_delete_all
+// Text for group deletion wait note.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_mus_query_conf_delete_all
+    {
+    buf = qtn_album_waiting_deleting;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_delete_fail
+// Text used when a delete fails due to a file in use error
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_delete_fail
+    {
+    buf = qtn_nmp_delete_file_open;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_delete_fail
+// Text used when a delete fails due to a file in use error
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_delete_fail_multi_selection
+    {
+    buf = qtn_nmp_delete_mutl_file_open;
+    }
+        
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_title_collection_details
+// Text used for Collection Details title.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_title_collection_details
+    {
+    buf = qtn_nmp_title_collection_details1;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_phone_memory_root_path
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_phone_memory_root_path
+    {
+    buf = text_phone_memory_root_path;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_memory_card_root_path
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_memory_card_root_path
+    {
+    buf = text_memory_card_root_path;
+    }
+
+#ifdef RD_MULTIPLE_DRIVE
+// -----------------------------------------------------------------------------
+// r_mpx_cui_collection_details_card_unavailable_item
+// -----------------------------------------------------------------------------
+//	
+RESOURCE TBUF r_mpx_cui_collection_details_memory_unavailable
+    {
+    buf = qtn_nmp_memory_unavailable;
+    }	
+#endif // RD_MULTIPLE_DRIVE   
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_collection_details_card_unavailable_item
+// -----------------------------------------------------------------------------
+//	
+RESOURCE TBUF r_mpx_cui_collection_details_card_unavailable_item
+    {
+    buf = qtn_nmp_mmc_unavailable;
+    }	
+
+    
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_num_episodes
+// ---------------------------------------------------------------------------
+// 
+RESOURCE TBUF r_mpx_qtn_nmp_num_episodes
+    {
+    buf = qtn_nmp_num_episodes;
+    }
+ 
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_one_episode
+// ---------------------------------------------------------------------------
+//     
+RESOURCE TBUF r_mpx_qtn_nmp_one_episode
+    {
+    buf = qtn_nmp_one_episode;
+    }    
+   
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_no_episodes
+// ---------------------------------------------------------------------------
+//     
+RESOURCE TBUF r_mpx_qtn_nmp_no_episodes
+    {
+    buf = qtn_nmp_no_episodes;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_no_episodes_go_to_app
+// ---------------------------------------------------------------------------
+//      
+RESOURCE TBUF r_mpx_qtn_nmp_no_episodes_go_to_app
+    {
+    buf = qtn_nmp_no_episodes_go_to_app;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_query_send_invalid_songs_txt
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_query_send_invalid_songs_txt
+    {
+    buf = qtn_nmp_query_send_valid_songs1;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_send_all_invalid_songs_note_txt
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_send_all_invalid_songs_note_txt
+    {
+    buf = qtn_nmp_note_nothing_to_send;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_menu_play_via_on_device
+// Text used when Play via sub menu opens
+// This is local player type name
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_menu_play_via_on_device
+    {
+    buf = qtn_nmp_options_play_device;
+    }
+    
+// -----------------------------------------------------------------------------
+// r_mpx_menu_play_via_home_net
+// Text used when Play via sub menu opens
+// This is remote player type name
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_menu_play_via_home_net
+    {
+    buf = qtn_nmp_options_play_homenet;
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_note_remote_connection_failed
+// Text used when a remote connection failed and player reverts to Local
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_note_remote_connection_failed
+    {
+    buf = qtn_nmp_note_remote_connection_failed;
+    }
+
+
+// -----------------------------------------------------------------------------
+// r_mpx_collection_info_file_not_found
+// info note for file not found
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_collection_info_file_not_found
+    {
+    buf = qtn_mp_note_broken_file;
+    }  
+
+// -----------------------------------------------------------------------------
+// r_mpx_qtn_nmp_del_batch_songs_wait_note
+// Text for group deletion wait note.
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_del_batch_songs_wait_note
+    {
+    buf = qtn_nmp_del_batch_songs_wait_note;
+    }
+
+    
+//------------------------------------------------------------------------------
+// r_mpx_progress_note
+// Generic Progress note.      
+//------------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_progress_note
+    {
+    flags = EAknProgressNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_CANCEL;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = 0x1000;
+            control = AVKON_NOTE
+                {
+                layout = EProgressLayout;
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/eabi/mpxpodcastcollectionviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_ZN25CMPXPodcastCollectionView4NewLEv @ 1 NONAME
+	_ZN25CMPXPodcastCollectionView5NewLCEv @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,40 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxpodcastcollectionview.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxpodcastcollectionview.loc	APP_LAYER_LOC_EXPORT_PATH(mpxpodcastcollectionview.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxpodcastcollectionview.mif
+OPTION HEADERFILE mpxpodcastcollectionview.mbg
+OPTION SOURCEFILE iconlist.txt
+END
+
+
+PRJ_MMPFILES
+
+
+mpxpodcastcollectionview.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,20 @@
+-c8,8 qgn_graf_mup_lst_pdc_added
+-c8,8 qgn_graf_mup_lst_pdc_auto
+-c8,8 qgn_graf_mup_lst_pdc_categ
+-c8,8 qgn_graf_mup_lst_pdc_compplay
+-c8,8 qgn_graf_mup_lst_pdc_date
+-c8,8 qgn_graf_mup_lst_pdc_episode
+-c8,8 qgn_graf_mup_lst_pdc_new
+-c8,8 qgn_graf_mup_lst_pdc_noplay
+-c8,8 qgn_graf_mup_lst_pdc_partplay
+-c8,8 qgn_graf_mup_lst_pdc_title
+-c8,8 qgn_menu_folder_apps
+-c8,8 qgn_prop_unknown
+-c8,8 qgn_graf_mup_npv_icon_pause
+-c8,8 qgn_graf_mup_npv_icon_play
+-c8,8 qgn_indi_mup_forw_add
+-c8,8 qgn_indi_mup_rew_add
+-c8,8 qgn_indi_mmc_add
+-c8,8 qgn_graf_mup_dlst_podcast
+-c8,8 qgn_graf_mup_lst_brokenpodc
+-c8,8 qgn_graf_mup_lst_corruptpodc
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/group/mpxpodcastcollectionview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxpodcastcollectionview.
+*
+*/
+
+
+
+#include <bldvariant.hrh>
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+#include "../../../../../inc/musicplayerbldvariant.hrh"
+
+TARGET          mpxpodcastcollectionview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC9A
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+#ifdef IAD_INCLUDE_UPNP 
+MACRO UPNP_INCLUDED
+#endif
+
+MACRO __ENABLE_MSK
+MACRO __ENABLE_PODCAST_IN_MUSIC_MENU
+MACRO __ENABLE_HITCHCOCK_UI
+MACRO __HG_COLLECTIONVIEW
+#ifdef IAD_INCLUDE_SINGLE_CLICK 
+MACRO SINGLE_CLICK_INCLUDED
+#endif
+
+SOURCEPATH      ../src
+SOURCE          mpxpodcastcollectionviewimp.cpp
+SOURCE          mpxpodcastcollectionview.cpp
+SOURCE          mpxpodcastcollectionviewcontainer.cpp
+SOURCE          mpxpodcastcollectionviewlistboxarray.cpp
+
+START RESOURCE  ../data/mpxpodcastcollectionview.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         egul.lib
+LIBRARY         estor.lib
+LIBRARY         eikctl.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknicon.lib
+LIBRARY         commonengine.lib
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         cdlengine.lib
+LIBRARY         sendui.lib
+LIBRARY         centralrepository.lib
+LIBRARY         platformenv.lib // pathinfo
+LIBRARY         commondialogs.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxcommoncontainer.lib
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         apgrfx.lib  // TApaTask
+LIBRARY         mpxcollectionhelper.lib
+LIBRARY         fbscli.lib  // CFbsBitmap
+
+LIBRARY         servicehandler.lib  // AIW
+#ifdef IAD_INCLUDE_UPNP
+LIBRARY         upnpcommand.lib
+#endif
+
+LIBRARY         eikdlg.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/group/mpxpodcastcollectionviewicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxpodcastcollectionview
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxpodcastcollectionview.mif
+HEADERFILENAME=$(HEADERDIR)/mpxpodcastcollectionview.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/inc/mpxpodcastcollectionview.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxpodcastcollectionview
+*
+*/
+
+
+
+#ifndef MPXPODCASTCOLLECTIONVIEW_HLP_HRH
+#define MPXPODCASTCOLLECTIONVIEW_HLP_HRH
+
+_LIT( KMUS_HLP_PODCAST_MENU_VIEW, "MUS_HLP_PODCAST_MAIN_VIEW" );
+_LIT( KMUS_HLP_PODCAST_PUBLISH_DATE_CAT_VIEW, "MUS_HLP_PODCAST_DATES_VIEW" ); 
+_LIT( KMUS_HLP_PODCAST_TITLES_VIEW, "MUS_HLP_PODCAST_TITLES_VIEW" );
+_LIT( KMUS_HLP_PODCAST_EPISODES_VIEW, "MUS_HLP_PODCAST_EPISODES" );
+
+
+#endif  // MPXPODCASTCOLLECTIONVIEW_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/inc/mpxpodcastcollectionview.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxpodcastcollectionview
+*
+*/
+
+
+
+#ifndef MPXPODCASTCOLLECTIONVIEW_HRH
+#define MPXPODCASTCOLLECTIONVIEW_HRH
+
+// ENUMS
+
+/** Podcast Collection view ID */
+enum TMPXPodcastCollectionViewIds
+    {
+    KMPXPodcastCollectionViewId = 20003
+    };
+    
+/** command ID's */    
+enum TMPXPodcastCollectionCommandIds
+    {
+    EMPXCmdEpisodeDetails = 0x0010,
+    EMPXCmdAlbumArt,
+    EMPXCmdSend,
+    EMPXCmdDelete,
+    EMPXCmdPodcasting,
+    EMPXCmdLibraryDetails,    
+    EMPXCmdSetPlayed,
+    EMPXCmdSetUnplayed,
+    EMPXCmdMarkUnmark,
+    EMPXCmdAddSongs,
+    EMPXCmdRemove,
+    EMPXCmdMusicLibraryDetails,
+    EMPXCmdUPnPAiwCmdCopyToExternalCriteria,    
+    EMPXCmdUpArrow,
+    EMPXCmdDownArrow,
+    EMPXCmdFind,
+    // Next 4 items should always stay together.
+    EMPXCmdUpnpPlayVia,
+    EMPXCmdUpnpPlayViaLocal,
+    EMPXCmdUpnpPlayViaRemotePlayer, //0x1011
+    // Should always be the last one in the list.  Sets the end of the Upnpplayer commands.
+    // Allows for dynamic upnp player commands.  Currently set to allow up to 10 more
+    // dynamic players.  If more are needed then this number needs to be adjusted.
+    EMPXCmdUpnpLastCommandId = 0x0035
+    };
+
+enum TMPXCollectionViewCurrentFindAllLOp
+    {
+    EMPXOpFindAllLIdle,
+    EMPXOpFindAllLUpnp    
+    };    
+
+enum TMPXCollectionViewCurrentMediaLOp
+    {
+    EMPXOpMediaLIdle,
+    EMPXOpMediaLCopyToRemote,
+    EMPXOpMediaLGetContainerInfo,
+    EMPXOpMediaLSongDetailsFileCheck,    
+    EMPXOpMediaLSend,
+    EMPXOpMediaLSetAsRingtone,
+    EMPXOpMediaLCollectionDetails,
+    EMPXOpMediaLPlaylistDetails,
+    EMPXOpMediaLSetToPlayed,
+    EMPXOpMediaLSetToUnplayed
+    };
+    
+enum TMPXCollectionDetailsHeading
+    {
+    EMPXCollectionDetailsSongs,
+    EMPXCollectionDetailsDuration,
+    EMPXCollectionDetailsPhoneMemory,
+    EMPXCollectionDetailsMemoryCard,
+    EMPXCollectionDetailsRefreshed,
+    EMPXCollectionDetailsCount
+    };
+    
+#endif  // MPXPODCASTCOLLECTIONVIEW_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/inc/mpxpodcastcollectionviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,171 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX PodcastCollection view container implementation
+*
+*/
+
+
+
+#ifndef C_CMPXPODCASTCOLLECTIONVIEWCONTAINER_H
+#define C_CMPXPODCASTCOLLECTIONVIEWCONTAINER_H
+
+
+// INCLUDES
+#include <mpxcommonframeworkdefs.h> // TMPXItemId
+#include <mpxpodcastdefs.h> // Podcast specific
+#include "mpxviewcontainer.h"
+#include "mpxcommoncontainer.h"
+
+// FORWARD DECLARATION
+class TAknsItemID;
+class CAknContextPane;
+class CMPXCommonContainerFactory;
+class MMPXCommonContainer;
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Podcast Collection view container.
+ *
+ *  @lib mpxpodcastcollectionview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPodcastCollectionViewContainer )
+    : public CBase
+    , public MMPXViewContainer
+    , public MMPXCommonListBoxArrayObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 5.1
+     * @param aView Command observer.
+     * @param aObserver MEikListBoxObserver
+     * @return Pointer to newly created object.
+     */
+    static CMPXPodcastCollectionViewContainer* NewL(
+        MEikCommandObserver* aView,
+        MEikListBoxObserver* aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPodcastCollectionViewContainer();
+
+    /**
+     * Sets playback status with item id
+     *
+     * @param aId item id of the episode
+     * @param aStatus status of the episode
+     */
+    void SetPlaybackStatusByIdL( TMPXItemId aId, TMPXPlaybackState aStatus );
+
+    /**
+     * Get current playback index
+     *
+     * @return Current playback index, KErrNotFound if nothing is playing
+     */
+    TInt PlaybackIndex();
+
+    /**
+     * Called by podcast collection view to set current view
+     * to be used to determine the correct help context
+     *
+     * @param: the current view
+     */
+    void SetCurrentView( const TMPXPodcastView& currentView );
+
+    /**
+     * Return common container
+     *
+     * @since 3.2
+     */
+    MMPXCommonContainer* Common();
+
+// from base class MMPXViewContainer
+
+    /**
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse HandleKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * Handles the retrieval of the view container's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void HandleHelpContext( TCoeHelpContext& aContext ) const;
+
+    /**
+     * Returns the indicators for the specified item within the view container
+     *
+     * @param aIndex specified array index
+     * @return Indicator icon indices
+     */
+    RArray<TInt> IndicatorsL( TInt aIndex );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPodcastCollectionViewContainer(
+        MEikCommandObserver* aView,
+        MEikListBoxObserver* aObserver);
+
+    /**
+     * Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Creates listbox array
+     *
+     */
+    CMPXCommonListBoxArrayBase* CreateListBoxArrayL();
+
+// from base class MMPXCommonListBoxArrayObserver
+
+    /**
+     * From MMPXCommonListBoxArrayObserver.
+     * Handle listbox array events
+     *
+     *  @param aEvent list box event
+     */
+    void HandleListBoxArrayEventL(
+        MMPXCommonListBoxArrayObserver::TMPXCommonListBoxArrayEvents aEvent );
+
+private: // data member
+
+    MMPXCommonContainer*                   iCommonContainer; // Owned
+    MEikCommandObserver*                   iView; // not owned
+    MEikListBoxObserver*                   iListBoxObserver; // not owned
+    CAknContextPane*                       iContextPane; // Not owned
+    CMPXPodcastCollectionViewListBoxArray* iLbxArray; // Not owned
+    CEikImage*                             iNewIcon;  // New context icon, owned
+    CEikImage*                             iOrigIcon; // New context icon, not owned
+    TMPXPodcastView                        iCurrentView; // stores the current view to help with setting
+                                                         // help context
+    };
+
+#endif  // C_CMPXPODCASTCOLLECTIONVIEWCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/inc/mpxpodcastcollectionviewimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,691 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX podcast collection view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXPODCASTCOLLECTIONVIEWIMP_H
+#define C_CMPXPODCASTCOLLECTIONVIEWIMP_H
+
+
+// INCLUDES
+#include <eikspmod.h>
+#include <eikclb.h>
+#include <AknProgressDialog.h>  // MProgressDialogCallback
+#include <eikprogi.h>
+#include <AknWaitDialog.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxcollectionobserver.h>
+#include <mpxplaybackobserver.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionuihelperobserver.h>
+#include <mpxcollectionhelper.h>
+#include <mpxcollectionpath.h>  // TMPXItemId
+#include <mpxviewactivationobserver.h>
+#include "mpxpodcastcollectionview.h"
+
+#include "mpxplaybackframeworkdefs.h" // TMPXPlaybackPlayerType
+
+// FORWARD DECLARATIONS
+class CMPXPodcastCollectionViewContainer;
+class MMPXCollectionUtility;
+class CMPXCollectionPlaylist;
+class MMPXPlaybackUtility;
+class CMPXCommonUiHelper;
+class MMPXViewUtility;
+class CSendUi;
+class CAknNavigationDecorator;
+class CAknNaviLabel;
+class CAknNavigationControlContainer;
+class CEikButtonGroupContainer;
+
+class MMPXPlayerManager;
+class CAiwServiceHandler;
+#ifdef UPNP_INCLUDED
+class CUpnpCopyCommand;
+#endif
+// CLASS DECLARATION
+
+/**
+ *  MPX Podcast Collection view.
+ *
+ *  @lib mpxpodcastcollectionview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXPodcastCollectionViewImp ) : public CMPXPodcastCollectionView,
+                                             public MMPXCollectionObserver,
+                                             public MMPXPlaybackObserver,
+                                             public MMPXPlaybackCallback,
+                                             public MEikListBoxObserver,
+                                             public MProgressDialogCallback,
+                                             public MMPXCollectionFindObserver,
+                                             public MMPXCHelperObserver,
+                                             public MMPXViewActivationObserver,
+                                             public MCoeViewDeactivationObserver,
+                                             public MCoeViewActivationObserver
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPodcastCollectionViewImp* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPodcastCollectionViewImp* NewLC();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPodcastCollectionViewImp();
+
+    /**
+     * Delete the selected items
+     *
+     * @ since 3.0
+     */
+    void DeleteSelectedItemsL();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPodcastCollectionViewImp();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Updates list box
+     *
+     * @param aEntries Podcast collection entries opened. Method may
+     *                 update the entries array by removing the playing item
+     *                 if currently within Never Played list view.
+     * @param aIndex focused entry
+     */
+    void UpdateListBoxL(CMPXMedia& aEntries,
+                        TInt aIndex );
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    void HandleErrorL( TInt aError );
+
+    /**
+     * Updates the navi pane
+     */
+    void UpdateNaviPaneL();
+
+    /**
+     * Updates the title pane
+     */
+    void UpdateTitlePaneL();
+
+    /**
+     * Updates the option menu
+     *
+     */
+    void UpdateOptionMenuL();
+
+    /**
+     * Start either the delete progress note
+     */
+    void StartProgressNoteL();
+
+    /**
+     * Updates the progress note text and progress bar
+     * 
+     * @param	aProgress 		Indicates the portion of the process completed
+     * @param 	aProgressText	Text to be displayed on the progress note  	
+     */
+    void UpdateProcessL(TInt aProgress,const TDesC& aProgressText);
+
+    /**
+     * Updates the copy to remote menu attachment
+     *
+     */
+    void UpdateCopyToRemoteMenu(TInt aMenuPane);
+
+    /**
+     * Updates playback status/indicatior
+     * @param aStatusChangeFlag flag to indicate if a status change
+     *        has indeed been detected
+     * Returns the current selection index if the paths match
+     */
+    TInt UpdatePlaybackStatusL(TBool aStatusChangeFlag);
+
+    /**
+     * Change the button group
+     *
+     * @aResId resource ID
+     */
+    void SetNewCbaL( TInt aResId );
+
+    /**
+     * Display collection details
+     *
+     * @param aMedia media object containing the library details
+     */
+    void ShowCollectionDetailsL( const CMPXMedia& aMedia );
+
+    /**
+     * Handles Upnp menus from DynInitMenuPaneL()
+     *
+     * @param aResourceId the id of the resource being initialized
+     * @param aMenuPane the menu pane the resource belongs to
+     */
+    void HandleDynInitUpnpL( TInt aResourceId, CEikMenuPane& aMenuPane );
+
+    /**
+     * Checks if UPnP AP is defined
+     *
+     * @return ETrue if visible, EFalse otherwise
+     */
+    TBool IsUpnpVisible();
+
+    /**
+     * Displays the available players in the Play via submenu
+     *
+     * @param aMenuPane Menu pane to put the sub menu items
+     */
+    void AddPlayersNamesToMenuL( CEikMenuPane& aMenuPane );
+
+    /**
+     * Adds one player type to the Play via submenu
+     *
+     * @param aMenuPane menu pane to add player name to
+     * @param aCommandId ID of the command
+     * @param aPlayerManager player manager
+     * @param aPlayerType type of the player
+     * @param aMenuText optional menu text
+     */
+    void AddPlayerNameToMenuL( CEikMenuPane& aMenuPane,
+                               TInt aCommandId,
+                               MMPXPlayerManager& aPlayerManager,
+                               TMPXPlaybackPlayerType& aPlayerType,
+                               const TDesC& aMenuText = KNullDesC );
+
+    /**
+     * Retrieves the current player name and type
+     */
+    void GetCurrentPlayerDetails();
+
+    /**
+     * Selects a new player for audio playback
+     *
+     * @param aCommand Command Id to identify which player to use
+     */
+    void SelectNewPlayerL( TInt aCommand );
+
+    /**
+     * Copies selected file(s) to remote player
+     */
+    void CopySelectedItemsToRemoteL();
+
+    /**
+     * Handle call back from collectionframework for Copy to Remote command
+     *
+     * @param aMedia media
+     * @param aComplete all selected medias have been found
+     */
+    void DoHandleCopyToRemoteL(const CMPXMedia& aMedia,
+                               TBool aComplete = ETrue );
+
+
+    /**
+     * checks if send option should be shown the option is selected
+     *
+     * @return ETrue if send command should be hided, EFalse if it should be shown
+     */
+    TBool SendOptionVisibilityL();
+
+    /**
+     * Checks if file details option should be shown
+     *
+     * @return ETrue if the command should be hiden, EFalse if it should be shown
+     */
+    TBool FileDetailsOptionVisibilityL();
+
+    /**
+     * Handle send command
+     */
+    void DoSendL();
+
+    /**
+     * Handle call back from collectionframework for send command
+     *
+     * @param aMedia media
+     * @param aError error code
+     */
+    void DoHandleSendL(const CMPXMedia& aMedia, TInt aError );
+    /**
+     * Prepares media object for selected items
+     *
+     * @param aMedia on return, populates the media object with a media array
+     *        containing info for currently selected items used by playlist
+     *        does not own this object
+     *
+     * @return error code
+     */
+    TInt PrepareMediaForSelectedItemsL( CMPXMedia* aMedia );
+
+    /**
+     * Set/clears the flags for item in database
+     * @param aIndex index of the item in the list box
+     * @param aMedia media object containing at least the following attribute:
+     *        TMPXAttribute( KMPXMediaIdGeneral,EMPXMediaGeneralCollectionId )
+     * @param aFlag flag to set/clear
+     * @param aSet ETrue to set the flag, EFalse to clear the flag
+     * @param aEnableInfoDialog ETrue to enable info dialog display, EFalse to disable
+     */
+    void UpdateDatabaseFlagL( TInt aIndex,
+                              const CMPXMedia& aMedia,
+                              TUint aFlag,
+                              TBool aSet,
+                              TBool aEnableInfoDialog = ETrue );
+
+    /**
+     * Handle playback message
+     *
+     * @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+    /**
+     * Handle collection message
+     *
+     * @param aMessage collection message
+     */
+    void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+
+    /**
+     * Updates a media to the collection
+     * @param aMedia media to update
+     * @param aSync synchronous operation or not
+     */
+    void DoSetCollectionL( CMPXMedia* aMedia, TBool aSync );
+
+#ifdef __ENABLE_MSK
+    /**
+     * Updates the middle softkey display to a label or icon depending on whether
+     * there are marked indices
+     * @param aMskId middle softkey command id
+     */
+    void UpdateMiddleSoftKeyDisplayL( TInt aMskId );
+#endif // __ENABLE_MSK
+
+    /**
+     * Changes the selected episode(s) status to Played /unplayed
+     * @param aPlayed played status to set (EFalse: unplayed)
+     */
+    void SetPlayedStatusL( TBool aPlayed );
+
+    /**
+     * From MProgressDialogCallback
+     * Callback method
+     * Get's called when a dialog is dismissed.
+     */
+    void DialogDismissedL( TInt aButtonId );
+
+    /**
+     * From MMPXCollectionObserver
+     * Handle collection message.
+     *
+     * @param aMessage Collection message
+     * @param aErr system error code.
+     */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d a folder
+     *
+     *  @param aEntries collection entries opened
+     *  @param aIndex focused entry
+     *  @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     *  @param aError error code
+     */
+    void HandleOpenL(const CMPXMedia& aEntries,
+                     TInt aIndex,
+                     TBool aComplete,
+                     TInt aError );
+
+    /**
+     *  From MMPXCollectionObserver
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d an item. Client typically responds by
+     *  'playing' the item
+     *
+     *  @param aPlaylist Podcast collection path to item
+     *  @param aError error code
+     */
+    void HandleOpenL(const CMPXCollectionPlaylist& aPlaylist,
+                     TInt aError );
+
+    /**
+     *
+     *  From MMPXCollectionObserver
+     *  Handle media properties
+     *
+     *  @param aMedia media
+     *  @param aError error code
+     */
+    void HandleCollectionMediaL(const CMPXMedia& aMedia,
+                                TInt aError );
+
+// from base class MMPXCHelperObserver
+
+    /**
+     * From MMPXCHelperObserver
+     * Handles the completion of any collection helper event.
+     *
+     * @param aOperation, operation completed
+     * @param aErr. the error code
+     * @param aArgument Argument returned from the operation
+     */
+    void HandleOperationCompleteL( TCHelperOperation aOperation,
+                                   TInt aErr,
+                                   void* aArgument );
+
+// from base class MMPXPlaybackObserver
+
+    /**
+     * From MMPXPlaybackObserver
+     * Handle playback message
+     *
+     * @since 3.0
+     * @param aMessage playback message
+     * @param aErr system error code.
+     */
+    void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+// from base class MMPXPlaybackCallback
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle playback property
+     *
+     * @since 3.0
+     * @param aProperty the property
+     * @param aValue the value of the property
+     * @param aError error code
+     */
+    void HandlePropertyL(TMPXPlaybackProperty aProperty,
+                         TInt aValue,
+                         TInt aError );
+
+    /**
+     * 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
+     *
+     * @since 3.0
+     * @param aPlayer UID of the subplayer
+     * @param aSubPlayers a list of sub players
+     * @param aComplete ETrue no more sub players. EFalse more subplayer
+     *                  expected
+     * @param aError error code
+     */
+    void HandleSubPlayerNamesL(TUid aPlayer,
+                               const MDesCArray* aSubPlayers,
+                               TBool aComplete,
+                               TInt aError );
+
+    /**
+     * From MMPXPlaybackCallback
+     * Handle media properties
+     *
+     * @since 3.0
+     * @param aMedia media
+     * @param aError error code
+     */
+    void HandleMediaL(const CMPXMedia& aMedia,
+                      TInt aError );
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Returns views id.
+     *
+     * @since 3.0
+     * @return Views Uid
+     */
+    TUid Id() const;
+
+    /**
+     * From CAknView
+     * Command handling function.
+     *
+     * @since 3.0
+     * @param aCommand Command which is handled
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Handles a view activation.
+     *
+     * @param aPrevViewId Specifies the view previously active.
+     * @param aCustomMessageId Specifies the message type.
+     * @param aCustomMessage The activation message.
+     */
+    void DoActivateL(const TVwsViewId& aPrevViewId,
+                     TUid aCustomMessageId,
+                     const TDesC8& aCustomMessage );
+
+    /**
+     * From CAknView
+     * View deactivation function.
+     */
+    void DoDeactivate();
+
+    /**
+     * From CAknView
+     * Foreground event handling function.
+     *
+     * @param aForeground Indicates the required focus state of the control.
+     */
+    void HandleForegroundEventL( TBool aForeground );
+
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    void DynInitMenuPaneL(TInt aResourceId,
+                          CEikMenuPane* aMenuPane );
+
+// from MEikListBoxObserver
+
+    /**
+     * Handles listbox events.
+     *
+     * @param aListBox Listbox where the event occurred.
+     * @param aEventType Event type.
+     */
+     void HandleListBoxEventL(CEikListBox* aListBox,
+                              TListBoxEvent aEventType );
+
+// from MEikCommandObserver
+
+    /**
+     * Processes user commands.
+     *
+     * @param aCommandId ID of the command to respond to.
+     */
+    virtual void ProcessCommandL(TInt aCommandId);
+
+// from MMPXCollectionFindObserver
+
+    /**
+    *  Handle callback for "find" operation
+    *  @param aEntries, CMPXMedia to be returned
+    *  @param aComplete ETrue no more entries. EFalse more entries
+    *                   expected
+    *  @param aError error code
+    */
+    virtual void HandleFindAllL(const CMPXMedia& aResults,
+                                TBool aComplete,TInt aError);
+
+    /**
+     * Launch Nokia Podcasting Application
+     *
+     */
+    void LaunchPodcastAppL();
+
+    /**
+     * Launch Nokia Podcasting Application
+     *
+     */
+    TInt CheckPodcastAppL();
+
+    /**
+     * Helper method that checks to see if the specified episode is
+     * currently playing.
+     *
+     * @param aItem id of item to check if currently playing
+     * @return ETrue if item currently playing else EFalse
+     */
+    TBool IsCurrentlyPlayingL(const TMPXItemId& aItem);
+
+// from MMPXViewActivationObserver
+
+   /**
+    * From MMPXViewActivationObserver
+    * Handle view activation.
+    *
+    * @param aCurrentViewType Current view type Uid.
+    * @param aPreviousViewType Previous view type Uid.
+    */
+    void HandleViewActivation(
+        const TUid& aCurrentViewType,
+        const TUid& aPreviousViewType );
+
+// from MCoeViewActivationObserver
+
+   /**
+    * From MCoeViewActivationObserver
+    * Handle view activation.
+    *
+    * @param aNewlyActivatedViewId newly activated view id.
+    * @param aViewIdToBeDeactivated deactivated view id.
+    */
+    void HandleViewActivation(
+        const TVwsViewId& aNewlyActivatedViewId,
+        const TVwsViewId& aViewIdToBeDeactivated );
+
+// from MCoeViewDeactivationObserver
+   /**
+    * Handles view deactivation notification from view server
+    */
+    void HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,
+                                const TVwsViewId& aNewlyActivatedViewId);
+    
+    /**
+     * Stores the current list box item index.
+     */
+    void StoreListboxItemIndexL();
+
+private:    // Data
+
+    CMPXPodcastCollectionViewContainer* iContainer;  // own
+    MMPXCollectionUtility*      iCollectionUtility;  // not own
+    MMPXPlaybackUtility*        iPlaybackUtility;
+    MMPXViewUtility*            iViewUtility;
+    CMPXCommonUiHelper*         iCommonUiHelper;
+    MMPXCollectionUiHelper*     iCollectionUiHelper;
+    CMPXMedia*                  iMediaToSet; // own
+
+    CSendUi*                    iSendUi;
+    HBufC*                      iTitle;
+    HBufC*                      iNumEpisode;
+    HBufC*                      iDuration;
+    HBufC*                      iOriginalTitle;
+    HBufC*                      iOriginalDuration;
+    CArrayFix<TInt>*            iBottomIndex;
+
+    TBool                       iBackOneLevel;
+    TBool                       iPossibleJump;
+    TBool                       iChangeRTForAllProfiles;
+    TBool                       iIsWaitNoteCanceled;
+    TBool                       iIsDeleting;
+    TBool                       iHandlingKeyEvent;
+    TBool                       iExitOptionHidden;
+    TBool                       iIgnoreNextFocusChangedMessage;
+
+    // HandleOpen was called and listbox was updated, only EFalse
+    // when view is activated
+    TBool                       iHandleOpenProcessed;
+
+    TInt                        iCurrentMediaLOp;   // current mediaL operation
+    TInt                        iCurrentFindAllLOp; // current FindAllL operation
+    TInt                        iLastDepth;
+    TInt                        iLastSelectedIndex;
+    TInt                        iCurrNotYetPlayedListIndex;
+    TInt                        iResourceOffset;        // must be freed
+#ifdef __ENABLE_MSK
+    TInt                        iCurrentMskId;
+    TBool                       iShowContextMenu;
+#endif // __ENABLE_MSK
+
+    CAknNavigationDecorator*        iNaviDecorator;
+    CAknNaviLabel*                  iNaviLabel;
+    CAknNavigationControlContainer* iNaviPane;
+
+    CEikButtonGroupContainer*       iCba; // owned
+
+    RArray<TUid> iPlayersList;
+    CAiwServiceHandler* iServiceHandler;
+    TInt iErrorAttachCopyMenu;
+    TMPXPlaybackPlayerType iCurrentPlayerType;
+    TInt iCurrentlyAttachedCopyToMenuPane;
+    HBufC* iSubPlayerName;
+    TBool iUpnpFrameworkSupport;
+
+    TMPXItemId iSelectedItem;
+    // Progress note for delete
+    CAknProgressDialog*	iProgressDialog;
+    CEikProgressInfo*	iProgressInfo;
+#ifdef UPNP_INCLUDED
+    CUpnpCopyCommand* iUpnpCopyCommand; 
+#endif
+    };
+
+#endif  // C_CMPXPODCASTCOLLECTIONVIEWIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/inc/mpxpodcastcollectionviewlistboxarray.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,175 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listbox array for podcast collection view.
+*
+*/
+
+
+#ifndef C_CMPXPODCASTCOLLECTIONVIEWLISTBOXARRAY_H
+#define C_CMPXPODCASTCOLLECTIONVIEWLISTBOXARRAY_H
+
+#include "mpxcommonlistboxarraybase.h"
+
+// FORWARD DECLARATIONS
+class TAknsItemID;
+
+// CLASS DECLARATION
+
+/**
+*  Listbox array for collection view container.
+*  Creates item text descriptors according to the list model.
+*/
+NONSHARABLE_CLASS( CMPXPodcastCollectionViewListBoxArray ): public CMPXCommonListBoxArrayBase
+    {
+public:  // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXPodcastCollectionViewListBoxArray* NewL();
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXPodcastCollectionViewListBoxArray();
+
+    /**
+     * Sets playback status with item id
+     *
+     * @since 3.1
+     * @param aId item id of the song
+     * @param aStatus status of the song
+     * @return The index of episode
+     */
+    TInt SetPlaybackStatusByIdL( TMPXItemId aId, TMPXPlaybackState aStatus );
+
+     /**
+     * Gets the index for the song that's currently playing
+     *
+     * @return The index for the song that's currently playing
+     */
+    TInt GetPlaybackIndex() const;
+
+    /**
+     * Get array of indicator icon indices at the specified index
+     */
+    RArray<TInt> IndicatorIconIndicesL( TInt aIndex );
+
+public: // Functions from base classes
+
+    /**
+     * From MDesCArray, indexes into a descriptor array.
+     * @param aIndex The position of the descriptor element within a descriptor array.
+     * @return Descriptor element located at position aIndex within a descriptor array
+     */
+    TPtrC MdcaPoint( TInt aIndex ) const;
+
+    /**
+     * Creates icon array
+     *
+     */
+    CAknIconArray* CreateIconArrayL();
+
+    /**
+     * Appends media array to the current array
+     *
+     * @param aMedia media array to append
+     */
+    void AppendMediaL( const CMPXMedia& aMedia );
+
+public: // new functions
+
+    /**
+     * Checks if the item is a broken link, ETrue if broken
+     *
+     * @param aIndex index of the item
+     */
+    TBool IsItemBrokenLinkL( TInt aIndex );
+
+    /**
+     * Checks if the item is corrupted, ETrue if corrupted
+     *
+     * @param aIndex index of the item
+     */
+    TBool IsItemCorruptedL( TInt aIndex );
+
+private: // constructors
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXPodcastCollectionViewListBoxArray();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     * Handle MdcaPoint
+     * @param aIndex The position of the descriptor element within a descriptor array.
+     * @return Descriptor element located at position aIndex within a descriptor array
+     */
+    TPtrC DoMdcaPointL( TInt aIndex ) const;
+
+private: // new functions
+
+    /**
+     * Load an icon and append it to an icon array.
+     * @param aArray    pointer to the icon array
+     * @param aID       skin id of the icon
+     * @param aColorId  Item ID of the color table.
+     * @param aColorIndex Index in the color table.
+     * @param aMbmFile  path to the mbm/mif file containing the icon
+     * @param aBitmapId mbm id of the bitmap
+     * @param aMaskId   mbm id of the mask
+     */
+    void AppendColorIconToArrayL(
+        CAknIconArray* aArray,
+        const TAknsItemID& aID,
+        const TAknsItemID& aColorId,
+        TInt aColorIndex,
+        const TDesC& aMbmFile,
+        TInt aBitmapId,
+        TInt aMaskId );
+
+    /**
+     * Maps list box index to array index in reorder mode
+     *
+     * @aIndex listbox index
+     */
+    TInt MapListBoxIndexToArrayIndex( TInt aIndex ) const;
+
+    /**
+     * Sets playback status
+     *
+     * @param aIndex index of the song to set
+     * @param aStatus status of the song
+     * @return The index of episode
+     */
+    TInt SetPlaybackStatusByIndex( TInt aIndex, TMPXPlaybackState aStatus );
+
+private: // data
+    TBool                   iReorder;
+    TInt                    iOriginalIndex;
+    TInt                    iMovedIndex;
+    TInt                    iMMCDrive;
+    };
+
+#endif  // C_CMPXPODCASTCOLLECTIONVIEWLISTBOXARRAY_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/loc/mpxpodcastcollectionview.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,309 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxpodcastcollectionview
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+// LOCALISATION STRINGS
+
+//d:Text in Podcast Menu View title pane
+//l:title_pane_t2/opt9
+//r:5.0
+//
+#define qtn_mp_title_my_podcast "Podcast Menu"
+
+// d:Options menu item for deleting.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_delete "Delete"
+
+// d:Options menu item for go to Now Playing View.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_go_to_nowplaying "Go to Now Playing"
+
+// d:Options menu item for go to Podcasting.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_go_to_podcasting "Go to Podcasting"
+
+// d:Options menu item for opening Podcast library details popup.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_details_podcast_library "Podcast library details"
+
+// d:Options menu item for set to played
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_set_to_played "Set to played"
+
+// d:Options menu item for set to unplayed
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_nmp_options_set_to_unplayed "Set to unplayed"
+
+// d:Options menu item for opening Episode details popup.
+// l:list_single_pane_t1_cp2/opt1
+// r:5.0
+//
+#define qtn_mus_options_details_episode "Episode details"
+
+//d:Navipane text to show the number of items in the collection.
+//d:Used when number of episodes is 0 (zero) or greater than 1.  
+//d:%N repesents the number of podcasts in the current view.
+//l:navi_text_pane_t1
+//r:5.0
+//
+#define qtn_nmp_num_episodes "%N episodes"
+
+//d:Navipane text to show the number of items in the collection.
+//d:Used when number of episodes is equal to 1.  
+//l:navi_text_pane_t1
+//r:5.0
+//
+#define qtn_nmp_one_episode "1 episode"
+
+//d:String displayed when there are no podcasts.
+//l:main_list_empty_pane
+//r:5.0
+//
+#define qtn_nmp_no_episodes "(no podcasts)"
+
+//d:String displayed when there are no podcasts, but Podcast App installed.
+//l:main_list_empty_pane
+//r:5.0
+//
+#define qtn_nmp_no_episodes_go_to_app "Go to Podcasting to download podcasts"
+
+// d:title for library details window
+// l:heading_pane_t1
+// r:5.0
+//
+#define qtn_nmp_title_collection_details1 "Library details:"
+
+// d:Collection details popup label.
+// d:Label for collection details popup.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_detail_number_of_episodes "Episodes"
+
+// d:Collection details popup label.
+// d:Label for collection details popup.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_mp_details_duration "Duration"
+
+// d:Collection details popup label.
+// d:Label for collection details popup.
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_nmp_details_phone_memory "Phone Memory"
+
+// d:Collection details popup label.
+// d:Label for collection details popup, available internal mass storage.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_mass_memory "Mass Memory"
+
+// d:Collection details popup label.
+// d:Label for collection details popup.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_memory_card "Memory Card"
+
+// d:Collection details popup label.
+// d:Label for collection details popup.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_mmc "MMC"
+
+// d:Collection details popup label.
+// d:Label for collection details popup.
+// l:list_single_heading_pane_t2_cp2
+// r:5.0
+//
+#define qtn_nmp_details_date_refresh "Refreshed"
+
+// d:Item for Music Library Details dialog.
+// d:Displayed when MMC is not present in the phone
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_nmp_mmc_unavailable "Card Unavailable"
+
+// d:Item for Music Library Details dialog.
+// d:Displayed when Memory is not present in the phone
+// l:list_single_heading_pane_t1_cp2
+// r:5.0
+//
+#define qtn_nmp_memory_unavailable "Unavailable"
+
+// d:Unknown in listbox.
+// l:list_single_graphic_pane_t1
+// r:5.0
+//
+#define qtn_mp_list_unknown "Unknown"
+
+// d:Text for wait note for deleting one item
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_album_waiting_deleting "Deleting '%U'"
+
+// d:Text for a confirmation query shown when user attempts to delete
+// d:all tracks belonging to a category. Category may be one album, artist,
+// d:composer or genre. %U is the name of the selected category.
+// d:For example, if the user selects delete when Mozart is focused in 
+// d:composer category view, %U will be Mozart.
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_query_conf_delete_group     "Delete all items belonging to '%U'?"
+
+// d:Text for wait note for deleting multiple items
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_del_songs_wait_note "Deleting"
+
+// d:Text for a confirmation query shown when user attempts to delete
+// d:multiple tracks.
+// d:%N is the number of the selected tracks.
+// d:For example, if the user selects delete when 3 tracks are marked in 
+// d:general tracks view, %N will be 3.
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_del_songs_query    "Delete %N items?"
+
+// d:Text for wait note for deleting a group
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_mus_query_conf_delete_all "Deleting items belonging to '%U'"
+
+// d:Cannot delete a file because it is in use
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_delete_file_open "Unable to delete item. It is currently in use"
+
+// d:Cannot delete a file because it is in use (multiple selection in list box)
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_delete_mutl_file_open   "Unable to delete some items. They are currently in use"
+
+// d:Options menu item for choosing player
+// l:list_single_pane_t1_cp2/opt3
+// r:5.0
+//
+#define qtn_nmp_options_play_via "Play"
+
+// d:Options menu item for chosing player
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_nmp_options_play_device "On device"
+
+// d:Options menu item for chosing player
+// l:list_single_popup_submenu_pane_t1
+// r:5.0
+//
+#define qtn_nmp_options_play_homenet "Via Home Net"
+
+// d:Text for connection to player failed error note
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_nmp_note_remote_connection_failed "Connection with %U failed."
+
+// d:sending multiple files, but at least one cannot be sent
+// d:invalid files confirmation query
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_query_send_valid_songs1 "Some files cannot be sent. Continue?"
+
+// d:Information note text
+// d:Display when all files to be sent are broken.
+// l:popup_note_window/opt1
+// r:5.0
+//
+#define qtn_nmp_note_nothing_to_send    "Files cannot be found. Nothing to send."
+
+// d:Text for not found dialog.
+// l:popup_note_window/opt2
+// r:5.0
+//
+#define qtn_mp_note_broken_file "File cannot be found.  Operation cancelled."
+
+// d:wait note for deleting multiple items
+// d:%N is the percentage of the tracks deleted.
+// l:popup_note_wait_window
+// r:5.0
+//
+#define qtn_nmp_del_batch_songs_wait_note "Deleting: %N%"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/src/mpxpodcastcollectionview.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Podcast Collection view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxpodcastcollectionview.h"
+#include "mpxpodcastcollectionviewimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXPodcastCollectionView* CMPXPodcastCollectionView::NewL()
+    {
+    return CMPXPodcastCollectionViewImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXPodcastCollectionView* CMPXPodcastCollectionView::NewLC()
+    {
+    return CMPXPodcastCollectionViewImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionView::~CMPXPodcastCollectionView()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/src/mpxpodcastcollectionviewcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,262 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Podcast Collection view container
+*
+*/
+
+
+// INCLUDE FILES
+#include <hlplch.h>
+#include <aknappui.h>
+#include <akncontext.h>
+#include <AknIconUtils.h>
+#include <data_caging_path_literals.hrh>
+#include <eikspane.h>
+#include <eiktxlbx.h>
+#include <mpxcollectionview.mbg>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxconstants.h>
+#include <mpxlog.h>
+#include <eikon.hrh>
+
+#include "mpxpodcastcollectionview.hrh"
+#include "mpxpodcastcollectionviewlistboxarray.h"
+#include "mpxpodcastcollectionview.hlp.hrh"
+#include "mpxpodcastcollectionviewcontainer.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewContainer* CMPXPodcastCollectionViewContainer::NewL(
+    MEikCommandObserver* aView,
+    MEikListBoxObserver* aObserver )
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewContainer::NewL" );
+    CMPXPodcastCollectionViewContainer* self =
+        new ( ELeave ) CMPXPodcastCollectionViewContainer(aView, aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewContainer::CMPXPodcastCollectionViewContainer(
+    MEikCommandObserver* aView,
+    MEikListBoxObserver* aObserver )
+    : iView( aView )
+    , iListBoxObserver( aObserver )
+    {
+    iCurrentView = EMPXMainPodcastMenuView;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewContainer::~CMPXPodcastCollectionViewContainer()
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewContainer::~CMPXPodcastCollectionViewContainer" );
+    delete iCommonContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewContainer::ConstructL()
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewContainer::ConstructL" );
+    iCommonContainer = CMPXCommonContainerFactory::NewL();
+    iCommonContainer->SetViewContainer( this );
+    iCommonContainer->SetCommandObserver( iView );
+    iCommonContainer->SetListBoxObserver( iListBoxObserver );
+    iCommonContainer->ConstructContainerL(MMPXCommonContainer::EMPXCommonContainerPodcast);
+    iLbxArray = static_cast<CMPXPodcastCollectionViewListBoxArray*>(
+        CreateListBoxArrayL() );
+    iCommonContainer->SetListBoxArrayL( iLbxArray );
+    iCommonContainer->HandleListBoxArrayEventL(
+        MMPXCommonListBoxArrayObserver::EMPXCommonListBoxArrayEventIconArrayChange );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets playback status
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewContainer::SetPlaybackStatusByIdL(
+    TMPXItemId aId, TMPXPlaybackState aStatus )
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewContainer::SetPlaybackStatusByIdL" );
+    if ( iLbxArray && iCommonContainer )
+        {
+        TInt index( iLbxArray->SetPlaybackStatusByIdL( aId, aStatus ) );
+        if ( index != KErrNotFound )
+            {
+            // Update the previous item as not playing anymore
+            iCommonContainer->DrawLbxItem( index );
+            }
+        index = iLbxArray->GetPlaybackIndex();
+        if ( index != KErrNotFound )
+            {
+            // Update new item as playing
+            iCommonContainer->DrawLbxItem( index );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Get playback index
+// ---------------------------------------------------------------------------
+//
+TInt CMPXPodcastCollectionViewContainer::PlaybackIndex()
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewContainer::PlaybackIndex" );
+    return ( iLbxArray ? iLbxArray->GetPlaybackIndex() : KErrNotFound );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets the current view to be used to determine the correct help context
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewContainer::SetCurrentView(
+    const TMPXPodcastView& currentView )
+    {
+    iCurrentView = currentView;
+    }
+
+// -----------------------------------------------------------------------------
+// Creates listbox array
+// -----------------------------------------------------------------------------
+//
+CMPXCommonListBoxArrayBase* CMPXPodcastCollectionViewContainer::CreateListBoxArrayL()
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewContainer::CreateListBoxArrayL" );
+    CMPXPodcastCollectionViewListBoxArray* array = CMPXPodcastCollectionViewListBoxArray::NewL();
+    array->ConstructListBoxArrayL();
+    array->SetObserver( this );
+    return array;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXViewContainer
+// Handles the retrieval of the view container's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewContainer::HandleHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewContainer::HandleHelpContext" );
+    aContext.iMajor = KAppUidMusicPlayerX;
+
+    switch(iCurrentView)
+        {
+        case EMPXMainPodcastMenuView:
+            {
+            aContext.iContext = KMUS_HLP_PODCAST_MENU_VIEW;
+            break;
+            }
+        case EMPXPublishDateView:
+            {
+            aContext.iContext = KMUS_HLP_PODCAST_PUBLISH_DATE_CAT_VIEW;
+            break;
+            }
+        case EMPXTitlesView:
+            {
+            aContext.iContext = KMUS_HLP_PODCAST_MENU_VIEW;
+            break;
+            }
+        case EMPXEpisodesView:
+            {
+            aContext.iContext = KMUS_HLP_PODCAST_EPISODES_VIEW;
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXViewContainer
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXPodcastCollectionViewContainer::HandleKeyEventL(
+    const TKeyEvent& aKeyEvent, TEventCode aType )
+    {
+    ASSERT( iCommonContainer );
+    MPX_DEBUG4( "CMPXPodcastCollectionViewContainer::HandleKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+
+    if ( aKeyEvent.iCode == EKeyUpArrow  ||
+        aKeyEvent.iCode == EKeyPrevious )
+        {
+        iView->ProcessCommandL( EMPXCmdUpArrow );
+        }
+    else if ( aKeyEvent.iCode == EKeyDownArrow ||
+        aKeyEvent.iCode == EKeyNext)
+        {
+        iView->ProcessCommandL( EMPXCmdDownArrow );
+        }
+
+    TKeyResponse response = EKeyWasNotConsumed;
+    // Hashkey mark/unmark only works in episodes view
+    if( iCurrentView == EMPXEpisodesView ||
+        aKeyEvent.iScanCode != EStdKeyHash )
+        {
+        response = iCommonContainer->HandleKeyEventL( aKeyEvent, aType );
+        }
+
+    return response;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXViewContainer
+// Returns the indicators for the specified item within the view container
+// Only used when using Hitchcock container.
+// ---------------------------------------------------------------------------
+//
+RArray<TInt> CMPXPodcastCollectionViewContainer::IndicatorsL( TInt aIndex )
+    {
+        return iLbxArray->IndicatorIconIndicesL( aIndex );
+    }
+
+// -----------------------------------------------------------------------------
+// Returns common container
+// -----------------------------------------------------------------------------
+//
+MMPXCommonContainer* CMPXPodcastCollectionViewContainer::Common()
+    {
+    return iCommonContainer;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCommonListBoxArrayObserver
+// Handle listbox array events.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewContainer::HandleListBoxArrayEventL(
+    TMPXCommonListBoxArrayEvents aEvent )
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewContainer::HandleListBoxArrayEventL" );
+    ASSERT( iCommonContainer );
+    iCommonContainer->HandleListBoxArrayEventL( aEvent );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/src/mpxpodcastcollectionviewimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4501 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Podcast Collection view
+*
+*/
+
+
+// INCLUDE FILES
+#include <aknlists.h>
+#include <aknViewAppUi.h>
+#include <eikmenub.h>
+#include <StringLoader.h>
+#include <aknnavilabel.h>
+#include <aknnavide.h>
+#include <eikapp.h>
+#include <AknUtils.h>
+#include <AknsUtils.h>
+#include <AknIconUtils.h>   // Icon no skin
+#include <akntitle.h>
+#include <aknconsts.h>
+#include <avkon.mbg>
+#include <textresolver.h>
+#include <aknnotewrappers.h>
+#include <aknnavi.h>
+#include <hlplch.h>
+#include <bautils.h>
+#include <eikspmod.h>
+#include <eikclb.h>
+#include <avkon.hrh>
+#include <avkon.rsg>
+#include <sendui.h>
+#include <CMessageData.h>
+#include <centralrepository.h>
+#include <avkon.rsg>
+#include <eikbtgpc.h>
+#include <AknWaitDialog.h>
+#include <apgcli.h>     // RApaLsSession
+#include <akncontext.h> // Context Pane
+#include <fbs.h>        // CFbsBitmap
+#include <bldvariant.hrh>
+#include <coeutils.h>
+#include <AknDlgShut.h>
+#ifdef RD_MULTIPLE_DRIVE
+#include <driveinfo.h>
+#endif //RD_MULTIPLE_DRIVE
+#include <mpxuser.h>
+
+#ifdef UPNP_INCLUDED
+#include <upnpcopycommand.h>
+#endif
+#include <e32const.h>
+#include <AiwServiceHandler.h>  //Copy to remote feature
+
+//#ifdef __COVER_DISPLAY
+#include <aknSDData.h>
+#include <AknMediatorFacade.h>
+#include "mplayersecondarydisplayapi.h"
+//#endif
+
+#include <mpxappui.hrh>
+#include <data_caging_path_literals.hrh>
+#include <layoutmetadata.cdl.h>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxviewutility.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpxpodcastcollectionview.rsg>
+#include <mpxcollectionview.mbg>
+#include <mpxcollectionutility.h>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxmedia.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediaarray.h>
+#include <mpxpodcastdefs.h> // Podcast specific
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxconstants.h>
+#include "mpxwaitnotedefs.h"
+
+#include <mpxinternalcrkeys.h>
+#include "mpxpodcastcollectionviewlistboxarray.h"
+#include "mpxcommoncontainer.hrh"
+#include "mpxcommoncontainer.h"
+#include "mpxcommonuihelper.h"
+#include "mpxpodcastcollectionviewcontainer.h"
+#include "mpxpodcastcollectionview.hrh"
+#include "mpxpodcastcollectionview.hlp.hrh"
+#include "mpxpodcastcollectionviewimp.h"
+#include "mpxlog.h"
+#include "mpxviewprivatepskeys.h"
+
+
+// CONSTANTS
+_LIT(KMPXPodcastCollectionRscPath, "mpxpodcastcollectionview.rsc");
+
+// Nokia Podcasting Application Uid
+const TUid KNPodAppUid = { 0x1028190B };
+
+const TInt KMilliSecondsToSeconds(1000);
+const TInt KMPXMaxBufferLength(160);
+const TInt KMPXMaxTimeLength(36);
+const TInt KMPXDurationDisplayResvLen(10);
+const TInt KPodcastCollectionMenuLevel( 2 );
+
+//#ifdef __UPNP_FRAMEWORK_2_0_
+const TInt KMPXLastDirectoryLevel( 2 );
+//#endif //__UPNP_FRAMEWORK_2_0_
+// MACROS
+_LIT(KMPXCollDetailsItemsFormat, "%S\t%S");
+
+const TInt KProgressBarMaxValue = 100; // Max Value for the Progress Info bar
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+#define KMusicCollectionUid 0x101FFC3A
+#endif
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewImp* CMPXPodcastCollectionViewImp::NewL()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::NewL");
+    CMPXPodcastCollectionViewImp* self = CMPXPodcastCollectionViewImp::NewLC();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewImp* CMPXPodcastCollectionViewImp::NewLC()
+    {
+    CMPXPodcastCollectionViewImp* self = new (ELeave) CMPXPodcastCollectionViewImp();
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewImp::~CMPXPodcastCollectionViewImp()
+    {
+    MPX_DEBUG1("CMPXPodcastCollectionViewImp::~CMPXPodcastCollectionViewImp entering");
+
+    if (iCollectionUtility)
+        {
+        iCollectionUtility->Close();
+        }
+
+    if (iPlaybackUtility)
+        {
+        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+        iPlaybackUtility->Close();
+        }
+
+    if (iViewUtility)
+        {
+        iViewUtility->Close();
+        }
+
+    if (iCollectionUiHelper)
+        {
+        iCollectionUiHelper->Close();
+        }
+
+    if ( iUpnpFrameworkSupport )
+        {
+        MPX_DEBUG1(_L("CMPXCollectionViewImp::~CMPXCollectionViewImp Detaching 'Copy to external' menu service..."));
+        if ((iServiceHandler) &&
+             (iCurrentlyAttachedCopyToMenuPane != KErrNotFound))
+            {
+            iServiceHandler->DetachMenu(iCurrentlyAttachedCopyToMenuPane,
+                                 R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST);
+            }
+        delete iServiceHandler;
+        iPlayersList.Close();
+        delete iSubPlayerName;
+        }
+#ifdef UPNP_INCLUDED
+    if (iUpnpCopyCommand)
+        {
+        delete iUpnpCopyCommand;
+        }
+#endif
+    if (iResourceOffset)
+        {
+        iEikonEnv->DeleteResourceFile(iResourceOffset);
+        }
+
+    if (iContainer)
+        {
+        AppUi()->RemoveFromStack( iContainer->Common()->CoeControl() );
+        delete iContainer;
+        }
+
+    if (iNaviDecorator)
+        {
+        delete iNaviDecorator;
+        }
+
+    if (iMediaToSet)
+        {
+        delete iMediaToSet;
+        }
+
+    delete iCommonUiHelper;
+    delete iSendUi;
+    delete iTitle;
+    delete iNumEpisode;
+    delete iDuration;
+    delete iOriginalTitle;
+    delete iOriginalDuration;
+    delete iBottomIndex;
+    delete iCba;
+
+
+    MPX_DEBUG1("CMPXPodcastCollectionViewImp::~CMPXPodcastCollectionViewImp exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Delete the selected items
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::DeleteSelectedItemsL()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::DeleteSelectedItemsL");
+
+    TBool isIgnore(EFalse);
+    if (iContainer->Common()->CurrentListItemCount() == 0)
+        {
+        // list is empty
+        isIgnore = ETrue;
+        }
+
+    if (!isIgnore)
+        {
+        CMPXCommonListBoxArrayBase* listboxArray =
+            iContainer->Common()->ListBoxArray();
+        TInt currentIndex = iContainer->Common()->CurrentLbxItemIndex();
+        // Create a copy of collection path
+        CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL(path);
+        CAknQueryDialog* confirmationDlg = NULL;
+        HBufC* promptTxt = NULL;
+        HBufC* waitNoteText = NULL;
+//        TInt waitNoteCBA = R_AVKON_SOFTKEYS_EMPTY;
+
+        // Marked indicies
+        const CArrayFix<TInt>* array =
+            iContainer->Common()->CurrentSelectionIndicesL();
+        TInt arrayCount = array->Count();
+        MPX_DEBUG2("CMPXPodcastCollectionViewImp::DeleteSelectedItemsL delete array count = %d", arrayCount);
+
+        if ( arrayCount > 1 )
+            {
+            waitNoteText = StringLoader::LoadLC(
+                R_MPX_QTN_NMP_DEL_SONGS_WAIT_NOTE);
+            promptTxt = StringLoader::LoadLC(
+                R_MPX_QTN_NMP_DEL_SONGS_QUERY,
+                    arrayCount);
+//            waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP;
+            confirmationDlg = CAknQueryDialog::NewL(
+                CAknQueryDialog::EConfirmationTone);
+            CleanupStack::PushL(confirmationDlg);
+
+//#ifdef __COVER_DISPLAY
+            confirmationDlg->PublishDialogL(
+                EMPlayerQueryDeleteTracks,
+                KMPlayerNoteCategory);
+            CAknMediatorFacade* covercl =
+                AknMediatorFacade(confirmationDlg);
+            if (covercl)
+                {
+                covercl->BufStream().WriteInt32L(arrayCount);
+                }
+//#endif //__COVER_DISPLAY
+
+            for (TInt i = 0; i < arrayCount; i++)
+                {
+                MPX_DEBUG2("CMPXPodcastCollectionViewImp::DeleteSelectedItemsL delete array index = %d", array->At(i));
+                path->SelectL(array->At(i));
+                }
+            }
+        else
+            {
+            const CMPXMedia& media( listboxArray->MediaL(
+                ( arrayCount > 0 ) ? array->At( 0 ) : currentIndex ) );
+            const TDesC& title = media.ValueText(KMPXMediaGeneralTitle);
+
+            TMPXGeneralType type = EMPXNoType;
+            TMPXGeneralCategory category = EMPXNoCategory;
+
+            if (media.IsSupported(KMPXMediaGeneralType))
+                {
+                type =
+                    media.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+                }
+            if (media.IsSupported(KMPXMediaGeneralCategory))
+                {
+                category =
+                    media.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory);
+                }
+
+            if (type == EMPXItem && category == EMPXPodcast)
+                {
+                // tracks level
+                waitNoteText = StringLoader::LoadLC(
+                        R_MPX_QTN_ALBUM_WAITING_DELETING, title);
+                promptTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_QUERY_COMMON_CONF_DELETE,
+                    title);
+                }
+            else
+                {
+                waitNoteText = StringLoader::LoadLC(
+                        R_MPX_QTN_MUS_QUERY_CONF_DELETE_ALL, title);
+//                waitNoteCBA = R_MPX_COLLECTION_WAITNOTE_SOFTKEYS_EMPTY_STOP;
+                promptTxt = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_QUERY_CONF_DELETE_GROUP,
+                    title);
+                }
+            confirmationDlg = CAknQueryDialog::NewL(
+                CAknQueryDialog::EConfirmationTone);
+            CleanupStack::PushL(confirmationDlg);
+//#ifdef __COVER_DISPLAY
+            if (type == EMPXItem && category == EMPXPodcast)
+                {
+                // tracks level
+                confirmationDlg->PublishDialogL(
+                    EMPlayerQueryDeleteCategory,
+                    KMPlayerNoteCategory);
+                }
+            else
+                {
+                confirmationDlg->PublishDialogL(
+                    EMPlayerQueryDeleteTrack,
+                    KMPlayerNoteCategory);
+                }
+            CAknMediatorFacade* covercl =
+                AknMediatorFacade(confirmationDlg);
+            if (covercl)
+                {
+                covercl->BufStream() << title;
+                }
+//#endif //__COVER_DISPLAY
+            path->Set( arrayCount > 0 ? array->At( 0 ) : currentIndex );
+            }
+        confirmationDlg->SetPromptL(*promptTxt);
+        CleanupStack::Pop(confirmationDlg);
+        CleanupStack::PopAndDestroy(promptTxt);
+        if (confirmationDlg->ExecuteLD(R_MPX_CUI_DELETE_CONFIRMATION_QUERY))
+            {
+            HandleCommandL( EMPXCmdIgnoreExternalCommand );
+            StartProgressNoteL();
+            TPtr buf = waitNoteText->Des();
+			UpdateProcessL(0, buf);
+            iCollectionUiHelper->DeleteL(*path, this);
+            iIsDeleting = ETrue;
+
+          }
+        CleanupStack::PopAndDestroy(waitNoteText);
+        CleanupStack::PopAndDestroy(path);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewImp::CMPXPodcastCollectionViewImp()
+    : iMediaToSet(NULL)
+    , iCurrNotYetPlayedListIndex(-1)
+#ifdef __ENABLE_MSK
+    , iCurrentMskId(KErrNotFound)
+    , iShowContextMenu(EFalse)
+#endif // __ENABLE_MSK
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::CMPXPodcastCollectionViewImp");
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::ConstructL()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::ConstructL");
+
+    CCoeEnv* coeEnv( iEikonEnv );
+    TParse parse;
+    parse.Set(KMPXPodcastCollectionRscPath, &KDC_APP_RESOURCE_DIR, NULL);
+    TFileName resourceFile(parse.FullName());
+    User::LeaveIfError(MPXUser::CompleteWithDllPath(resourceFile));
+    BaflUtils::NearestLanguageFile(coeEnv->FsSession(), resourceFile);
+    iResourceOffset = coeEnv->AddResourceFileL(resourceFile);
+
+    BaseConstructL(R_MPX_PODCAST_COLLECTION_VIEW);
+
+    // Get the collection utility instance from engine.
+    iCollectionUtility = MMPXCollectionUtility::NewL(this, KMcModeDefault);
+    iBackOneLevel = EFalse;
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+    iPlaybackUtility->AddObserverL( *this );
+    iViewUtility = MMPXViewUtility::UtilityL();
+    iViewUtility->AddObserverL(this);
+    iBottomIndex = new (ELeave) CArrayFixFlat<TInt>(1);
+
+    iCommonUiHelper = CMPXCommonUiHelper::NewL(iCollectionUtility);
+    iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+
+    // Monitor for view activation
+    AppUi()->AddViewActivationObserverL( this );
+#ifdef UPNP_INCLUDED
+  	if(!iUpnpCopyCommand)
+  	    {
+  	    MPX_TRAPD ( error, iUpnpCopyCommand = CUpnpCopyCommand::NewL() );   
+		    if ( error == KErrNone )
+            {
+            iUpnpFrameworkSupport = ETrue;
+            iServiceHandler = CAiwServiceHandler::NewL();
+            MPX_DEBUG1("CMPXPodcastCollectionViewImp::ConstructL() Attaching 'Copy to external' menu service...");
+            MPX_TRAP(iErrorAttachCopyMenu, iServiceHandler->AttachMenuL(R_MPX_PODCAST_COLLECTION_VIEW_MENU_1,
+                                                   R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST));
+            if ( iErrorAttachCopyMenu == KErrNotSupported )
+                {
+                // when CCoeEnv is not available
+                User::Leave( iErrorAttachCopyMenu );
+                }
+            MPX_DEBUG2("CMPXPodcastCollectionViewImp::ConstructL(): attach Copy menu error: %d", iErrorAttachCopyMenu);
+            }
+        else
+            {
+            iUpnpFrameworkSupport = EFalse;
+			iUpnpCopyCommand = NULL;
+            }
+        }
+#endif
+
+    TUid naviPaneUid;
+    naviPaneUid.iUid = EEikStatusPaneUidNavi;
+    iNaviPane =
+        static_cast<CAknNavigationControlContainer*>
+        (iAvkonViewAppUi->StatusPane()->ControlL(naviPaneUid));
+    iNaviDecorator = iNaviPane->CreateNavigationLabelL(KNullDesC);
+    //Create label to change text in Navi pane
+    iNaviLabel = static_cast<CAknNaviLabel*>
+            (iNaviDecorator->DecoratedControl());
+
+    TInt flags(0);
+    CRepository* repository = CRepository::NewL(KCRUidMPXMPFeatures);
+    repository->Get(KMPXMPLocalVariation, flags);
+    delete repository;
+    iChangeRTForAllProfiles =
+        static_cast<TBool>(flags & KMPXChangeRTForAll);
+
+    iLastDepth = 1;
+    MPX_DEBUG2("CMPXPodcastCollectionViewImp::ConstructL iLastDepth = %d", iLastDepth);
+    iBottomIndex->AppendL(0);
+
+#ifdef _DEBUG
+    iExitOptionHidden = EFalse;
+#else // _DEBUG
+    iExitOptionHidden = iCommonUiHelper->ExitOptionHiddenL();
+#endif // _DEBUG
+
+    // used to know if HandleOpen was called -> we cannot update the playback
+    // status of listbox items before the list box is updated in HandleOpen
+    iHandleOpenProcessed = EFalse;
+    iSelectedItem = KMPXInvalidItemId;
+    }
+
+// ---------------------------------------------------------------------------
+// Updates list box
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::UpdateListBoxL(
+    CMPXMedia& aEntries,
+    TInt aIndex)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateListBox");
+    MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateListBox aIndex = %d", aIndex);
+    if (iContainer)
+        {
+        CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL(cpath);
+
+        CMPXCommonListBoxArrayBase* array =
+            iContainer->Common()->ListBoxArray();
+        array->ResetMediaArrayL();
+        iContainer->Common()->HandleLbxItemRemovalL();
+
+
+        array->AppendMediaL(aEntries);
+        // this needs to be before HandleLbxItemAdditionL so that the items
+        // are redrawn properly after playback status has been updated.
+        UpdatePlaybackStatusL(EFalse);
+
+        iContainer->Common()->HandleLbxItemAdditionL();
+        MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateListBox List box contains %d items", iContainer->Common()->TotalListItemCount());
+
+        // Display empty List Box string if list box is empty
+        // Display different empty string if Podcast App does not exist
+        HBufC* emptyText = NULL;
+        if (CheckPodcastAppL() == KErrNone)
+            {
+            emptyText = StringLoader::LoadLC(
+                R_MPX_QTN_NMP_NO_EPISODES_GO_TO_APP);
+            }
+        else
+            {
+            emptyText = StringLoader::LoadLC(
+                R_MPX_QTN_NMP_NO_EPISODES);
+            }
+        iContainer->Common()->SetLbxEmptyTextL(*emptyText);
+        CleanupStack::PopAndDestroy(emptyText);
+
+        if (iBackOneLevel || iPossibleJump)
+            {
+            if (cpath->Levels() == (iLastDepth))
+                {
+                iLastDepth--;
+                TInt topIndex = iContainer->Common()->CalculateTopIndex(
+                    iBottomIndex->At(iLastDepth));
+                iContainer->Common()->SetLbxTopItemIndex(topIndex);
+                iContainer->Common()->SetLbxCurrentItemIndexAndDraw(aIndex);
+                iBottomIndex->Delete(iLastDepth);
+                }
+            else
+                {
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateListBox Invalid history, rebuilding");
+                // invalid path, rebuild with all 0. possibily caused by a jump in views
+                iBottomIndex->Reset();
+                iLastDepth = cpath->Levels();
+                for (TInt i = 0; i < iLastDepth; i++)
+                    {
+                    iBottomIndex->AppendL(0);
+                    }
+                iContainer->Common()->SetLbxCurrentItemIndexAndDraw(aIndex);
+                }
+            iPossibleJump = EFalse;
+            iBackOneLevel = EFalse;
+            }
+        else
+            {
+            if ((aIndex > 0) &&
+                (aIndex < iContainer->Common()->CurrentListItemCount()))
+                {
+                iContainer->Common()->SetLbxCurrentItemIndexAndDraw(aIndex);
+                }
+            else if(aIndex == 0 &&
+                    iCurrNotYetPlayedListIndex > 0 &&
+                    iCurrNotYetPlayedListIndex < iContainer->Common()->CurrentListItemCount())
+                {
+                iContainer->Common()->SetLbxCurrentItemIndexAndDraw(iCurrNotYetPlayedListIndex);
+                }
+            else
+                {
+                if ( iSelectedItem != KMPXInvalidItemId )
+                    {
+                    iContainer->Common()->SetLbxCurrentItemIndexAndDraw(cpath->IndexOfId(iSelectedItem));
+                    }
+                else
+                    {
+                    iContainer->Common()->SetLbxCurrentItemIndexAndDraw(0);
+                    }
+                }
+            iCurrNotYetPlayedListIndex = -1;
+            }
+        CleanupStack::PopAndDestroy(cpath);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleErrorL(TInt aError)
+    {
+    MPX_DEBUG2( "CMPXPodcastCollectionViewImp::HandleError(%d)", aError );
+    ASSERT( aError );
+
+    // only display error message if postcastcollection view is in the foreground
+    if ( iContainer )
+        {
+        TRAP_IGNORE( iCommonUiHelper->HandleErrorL( aError ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the navi pane
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::UpdateNaviPaneL()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateNaviPaneL");
+    TUid activeView = iViewUtility->ActiveViewType();
+    if (activeView == TUid::Uid(KMPXPluginTypeCollectionUid) ||
+        activeView == TUid::Uid(KMPXPluginTypeWaitNoteDialogUid)) // the harvester
+                                                           // might have a
+                                                           // scanning note
+                                                           // displayed
+        {
+        MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateNaviPaneL updating %d", iNumEpisode);
+        if (iNumEpisode)
+            {
+            iNaviLabel->SetTextL(*iNumEpisode);
+            iNaviPane->PushL(*iNaviDecorator);
+            }
+        else
+            {
+            iNaviPane->Pop(iNaviDecorator);
+            }
+        iNaviPane->DrawNow();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the title pane
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::UpdateTitlePaneL()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateTitlePaneL");
+    // Set title
+    TUid activeView = iViewUtility->ActiveViewType();
+    if (activeView == TUid::Uid(KMPXPluginTypeCollectionUid))
+        {
+        CAknTitlePane* title(NULL);
+
+        TRAP_IGNORE(
+            {
+            title = static_cast<CAknTitlePane*>
+                (StatusPane()->ControlL(TUid::Uid(EEikStatusPaneUidTitle)));
+            });
+
+        if (title)
+            {
+            if (iTitle)
+                {
+                MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateTitlePaneL Title is %S", iTitle);
+                if (iTitle->Length() == 0)
+                    {
+                    HBufC* titleText = StringLoader::LoadLC(R_MPX_QTN_NMP_UNKNOWN_TITLE);
+                    title->SetTextL(*titleText);
+                    CleanupStack::PopAndDestroy(titleText);
+                    }
+                else
+                    {
+                    title->SetTextL(*iTitle);
+                    }
+                }
+            else
+                {
+                CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+                CleanupStack::PushL(cpath);
+                TInt currentDepth = cpath->Levels();
+                if(currentDepth == 2)
+                    {
+                    // use default title if no metadata is available
+                    HBufC* titleText = StringLoader::LoadLC(
+                        R_MPX_PODCAST_COLLECTION_VIEW_TITLE);
+                    title->SetTextL(*titleText);
+                    CleanupStack::PopAndDestroy(titleText);
+                    }
+                CleanupStack::PopAndDestroy(cpath);
+                } // if (iTitle)
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the option menu
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::UpdateOptionMenuL()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateOptionMenuL");
+    if(iContainer)
+        {
+        // Check collection path level and change title resource id
+        CEikMenuBar* menubar = MenuBar();
+        TInt attachCopyToMenu = KErrNotFound;
+
+        if ( menubar )
+            {
+            CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL(cpath);
+            MPX_DEBUG_PATH(*cpath);
+            TInt depth = cpath->Levels();
+            MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateOptionMenuL cpath depth = %d", depth);
+            // root
+            if ( depth == 2 )
+                {
+                iContainer->Common()->EnableMarking( EFalse );
+                iContainer->SetCurrentView(EMPXTitlesView);
+                menubar->SetMenuTitleResourceId(R_MPX_PODCAST_COLLECTION_TITLES_VIEW_MENUBAR);
+                if ( iUpnpFrameworkSupport )
+                    {
+                    attachCopyToMenu = R_MPX_PODCAST_COLLECTION_VIEW_MENU_1;
+                    }
+                }
+            else if ( depth == 3 )
+                {
+#ifdef SINGLE_CLICK_INCLUDED
+                iContainer->Common()->EnableMarking( EFalse );
+#else
+                iContainer->Common()->EnableMarking( ETrue );
+#endif
+                iContainer->SetCurrentView(EMPXEpisodesView);
+#ifdef SINGLE_CLICK_INCLUDED
+                menubar->SetMenuTitleResourceId(R_MPX_PODCAST_COLLECTION_EPISODES_VIEW_NO_MARKING);
+#else
+                menubar->SetMenuTitleResourceId(R_MPX_PODCAST_COLLECTION_EPISODES_VIEW_MENUBAR);
+#endif
+                if ( iUpnpFrameworkSupport )
+                    {
+                    attachCopyToMenu = R_MPX_PODCAST_COLLECTION_VIEW_MENU_2;
+                    }
+                }
+            else // (depth > 3)
+                {
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateOptionMenuL ERROR cpath depth > 3");
+                ASSERT(0);
+                }
+            CleanupStack::PopAndDestroy(cpath);
+            }
+
+        if ( iUpnpFrameworkSupport )
+            {
+            UpdateCopyToRemoteMenu(attachCopyToMenu);
+            }
+        }
+    else
+        {
+        MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateOptionMenuL NULL iContainer");
+        }
+    }
+
+//#ifdef __UPNP_FRAMEWORK_2_0_
+// ---------------------------------------------------------------------------
+// Updates the copy to remote menu attachment
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::UpdateCopyToRemoteMenu(TInt aMenuPane)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateCopyToRemoteMenu");
+    MPX_DEBUG3("CMPXPodcastCollectionViewImp::UpdateCopyToRemoteMenu(): aMenuPane %d, iCurrentlyAttachedCopyToMenuPane %d", aMenuPane, iCurrentlyAttachedCopyToMenuPane);
+
+    if (iServiceHandler &&
+         (iCurrentlyAttachedCopyToMenuPane != aMenuPane))
+        {
+        if (iCurrentlyAttachedCopyToMenuPane != KErrNotFound)
+            {
+            MPX_DEBUG1(_L("CMPXCollectionViewImp::UpdateCopyToRemoteMenu() Detaching 'Copy to external' menu service..."));
+            iServiceHandler->DetachMenu(iCurrentlyAttachedCopyToMenuPane,
+                                 R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST);
+            }
+
+        if (aMenuPane != KErrNotFound)
+            {
+            MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateCopyToRemoteMenu() Attaching 'Copy to external' menu service...");
+            MPX_TRAP(iErrorAttachCopyMenu, iServiceHandler->AttachMenuL(aMenuPane,
+                                                       R_MPX_UPNP_COPY_TO_EXTERNAL_MENU_INTEREST));
+            if (iErrorAttachCopyMenu == KErrNone)
+                {
+                iCurrentlyAttachedCopyToMenuPane = aMenuPane;
+                }
+            else
+                {
+                iCurrentlyAttachedCopyToMenuPane = KErrNotFound;
+                }
+            MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateCopyToRemoteMenu(): iErrorAttachCopyMenu: %d", iErrorAttachCopyMenu);
+            }
+        else
+            {
+            iCurrentlyAttachedCopyToMenuPane = aMenuPane;
+            }
+        }
+    }
+//#endif //__UPNP_FRAMEWORK_2_0_
+
+// ---------------------------------------------------------------------------
+// Updates playback status indicatior
+// ---------------------------------------------------------------------------
+//
+TInt CMPXPodcastCollectionViewImp::UpdatePlaybackStatusL(TBool aStatusChangeFlag)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::UpdatePlaybackStatusL");
+    TInt ret( KErrNotFound );  // default selection
+    if ( iContainer )
+        {
+        TMPXPlaybackState pbState( EPbStateNotInitialised );
+        TInt selectedIndex( KErrNotFound );
+        TMPXItemId selectedItemId( KMPXInvalidItemId );
+        CMPXCollectionPath* cpath( iCollectionUtility->Collection().PathL() );
+        CleanupStack::PushL( cpath );
+
+        MMPXSource* source( iPlaybackUtility->Source() );
+        if ( source )
+            {
+            CMPXCollectionPlaylist* playlist( source->PlaylistL() );
+            if ( playlist )
+                {
+                CleanupStack::PushL( playlist );
+                CMPXCollectionPath* pbPath(
+                    CMPXCollectionPath::NewL( playlist->Path() ) );
+                CleanupStack::PushL( pbPath );
+                TInt playbackPathCount( pbPath->Levels() );
+                if ( cpath->Levels() == playbackPathCount )
+                    {
+                    // not comparing the index
+                    TBool isEqual( ETrue );
+                    for ( TInt i = 0; i < playbackPathCount - 1; i++ )
+                        {
+                        if ( cpath->Id( i ) != pbPath->Id( i ) )
+                            {
+                            isEqual = EFalse;
+                            break;
+                            }
+                        }
+                    if ( isEqual )
+                        {
+                        selectedIndex = pbPath->Index();
+                        selectedItemId = pbPath->Id();
+                        ret = selectedIndex;
+                        pbState = iPlaybackUtility->StateL();
+                        }
+                    }
+                CleanupStack::PopAndDestroy( pbPath );
+                CleanupStack::PopAndDestroy( playlist );
+                }
+            }
+        CleanupStack::PopAndDestroy( cpath );
+
+        CMPXCommonListBoxArrayBase* listboxArray =
+            iContainer->Common()->ListBoxArray();
+        const CMPXMedia* containerMedia = &listboxArray->ContainerMedia();
+
+        if (!containerMedia ||
+            !containerMedia->IsSupported(KMPXMediaPodcastCategoryGroup) ||
+            EMPXNotYetPlayed != containerMedia->ValueTObjectL<TMPXPodcastCategory>(KMPXMediaPodcastCategoryGroup))
+            {
+            if ( iHandleOpenProcessed )
+                {
+                // Might make performance worse if there are lots of episodes
+                iContainer->SetPlaybackStatusByIdL( selectedItemId, pbState );
+                }
+            }
+
+        if (iMediaToSet &&
+            aStatusChangeFlag &&
+            (pbState == EPbStateStopped ||
+             pbState == EPbStateNotInitialised))
+            {
+            DoSetCollectionL(iMediaToSet, EFalse );
+            delete iMediaToSet;
+            iMediaToSet = NULL;
+            }
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Start a Progress note
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::StartProgressNoteL()	
+	{
+	iProgressDialog = new (ELeave) CAknProgressDialog(
+		(REINTERPRET_CAST(CEikDialog**, &iProgressDialog)),
+		ETrue);
+	iProgressDialog->PrepareLC(R_MPX_PROGRESS_NOTE);
+	iProgressInfo = iProgressDialog->GetProgressInfoL();
+    iProgressDialog->SetCallback(this);
+    iProgressDialog->RunLD();
+	iProgressInfo->SetFinalValue(KProgressBarMaxValue);	
+	}
+ 
+// ---------------------------------------------------------------------------
+// Update the Progress note
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::UpdateProcessL(TInt aProgress,const TDesC& aProgressText)
+	{
+	if(iProgressDialog)
+		{
+		iProgressDialog->SetTextL(aProgressText);
+		iProgressInfo->SetAndDraw(aProgress);	
+    	}
+	}
+
+// -----------------------------------------------------------------------------
+// Change the button group
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::SetNewCbaL(TInt aResId)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::SetNewCbaL");
+    if (!iCba)
+        {
+        CCoeControl* coeControl = iContainer->Common()->CoeControl();
+        iCba = CEikButtonGroupContainer::NewL(
+            CEikButtonGroupContainer::ECba,
+            CEikButtonGroupContainer::EHorizontal,
+            this,
+            aResId, *coeControl );
+        }
+    else
+        {
+        iCba->SetCommandSetL(aResId);
+        iCba->DrawDeferred();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Display collection details
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::ShowCollectionDetailsL(const CMPXMedia& aMedia)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::ShowCollectionDetailsL");
+    CAknSingleHeadingPopupMenuStyleListBox* list =
+        new (ELeave) CAknSingleHeadingPopupMenuStyleListBox;
+
+    CleanupStack::PushL(list);
+    CAknPopupList* popupList = CAknPopupList::NewL(
+        list, R_AVKON_SOFTKEYS_OK_EMPTY,
+        AknPopupLayouts::EMenuGraphicHeadingWindow);
+
+    CleanupStack::PushL(popupList);
+    list->ConstructL(popupList, CEikListBox::ELeftDownInViewRect);
+    list->CreateScrollBarFrameL(ETrue);
+    list->ScrollBarFrame()->SetScrollBarVisibilityL(
+        CEikScrollBarFrame::EOff,
+        CEikScrollBarFrame::EAuto);
+
+    CDesCArrayFlat* dataArray =
+        new (ELeave) CDesCArrayFlat(EMPXCollectionDetailsCount);
+    CleanupStack::PushL(dataArray);
+
+    // Enable Marquee
+    static_cast<CEikFormattedCellListBox*>(list)->ItemDrawer()->ColumnData()->
+        EnableMarqueeL(ETrue);
+
+    // number of items
+    HBufC* dataToAppend = HBufC::NewLC(KMPXMaxBufferLength);
+    TInt songsCount = 0;
+    if (aMedia.IsSupported(KMPXMediaColDetailNumberOfItems))
+        {
+        songsCount = aMedia.ValueTObjectL<TInt>(KMPXMediaColDetailNumberOfItems);
+        }
+    TPtr ptr = dataToAppend->Des();
+    ptr.AppendNum(songsCount);
+    AknTextUtils::LanguageSpecificNumberConversion(ptr);
+    dataArray->AppendL(ptr);
+    CleanupStack::PopAndDestroy(dataToAppend);
+    dataToAppend = NULL;
+
+    // total duration
+    TInt duration = 0;
+    if (aMedia.IsSupported(KMPXMediaColDetailDuration))
+        {
+        duration = aMedia.ValueTObjectL<TInt>(KMPXMediaColDetailDuration);
+        }
+    if (duration > 0)
+        {
+        dataToAppend = iCommonUiHelper->DisplayableDurationInTextL(duration/KMilliSecondsToSeconds);
+        CleanupStack::PushL(dataToAppend);
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion(ptr);
+        dataArray->AppendL(ptr);
+        CleanupStack::PopAndDestroy(dataToAppend);
+        dataToAppend = NULL;
+        }
+    else
+        {
+        dataArray->AppendL(KNullDesC);
+        }
+
+#ifdef RD_MULTIPLE_DRIVE
+    RFs& fileSession( iCoeEnv->FsSession() );
+    TDriveList driveList;
+    TInt driveCount(0);
+    TInt64 freePhoneMemory(KErrNotFound);
+    TInt64 freeInternalMemory(KErrNotFound);
+    TInt64 freeExternalMemory(KErrNotFound);
+    TVolumeInfo volInfo;
+
+    // Get all visible drives
+    User::LeaveIfError( DriveInfo::GetUserVisibleDrives(
+           fileSession, driveList, driveCount ) );
+    MPX_DEBUG2 ("CMPXCollectionViewImp::ShowCollectionDetailsL - driveCount = %d", driveCount);
+
+    for( TInt driveNum = EDriveA; driveNum <= EDriveZ; driveNum++ )
+        {
+        if (driveList[driveNum])
+            {
+            // Get the volume information
+            if ( fileSession.Volume( volInfo, driveNum ) == KErrNone )
+                {
+                // Get the drive status
+                TUint driveStatus(0);
+                DriveInfo::GetDriveStatus( fileSession, driveNum, driveStatus );
+
+                // Add up free memory depending on memory location
+                if ( driveNum == EDriveC )
+                    {
+                    if ( freePhoneMemory == KErrNotFound )
+                        {
+                        freePhoneMemory = 0;
+                        }
+                    freePhoneMemory += volInfo.iFree;
+                    }
+                else if ( driveStatus & DriveInfo::EDriveInternal )
+                    {
+                    if ( freeInternalMemory == KErrNotFound )
+                        {
+                        freeInternalMemory = 0;
+                        }
+                    freeInternalMemory += volInfo.iFree;
+                    }
+                else if ( driveStatus &
+                    (DriveInfo::EDriveRemovable | DriveInfo::EDriveRemote) )
+                    {
+                    if ( freeExternalMemory == KErrNotFound )
+                        {
+                        freeExternalMemory = 0;
+                        }
+                    freeExternalMemory += volInfo.iFree;
+                    }
+                }
+            }
+        }
+
+    // phone memory free
+    if ( freePhoneMemory != KErrNotFound )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL(
+            freePhoneMemory, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr);
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_MEMORY_UNAVAILABLE );
+        ptr.Set(dataToAppend->Des());
+        }
+
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // internal memory (mass storage) free
+    if ( freeInternalMemory != KErrNotFound )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL(
+            freeInternalMemory, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr); 
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_MEMORY_UNAVAILABLE );
+        ptr.Set(dataToAppend->Des());
+        }
+
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+
+    // removable/remote (memory card) memory free
+    if ( freeExternalMemory != KErrNotFound )
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL(
+            freeExternalMemory, ETrue );
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr); 
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM );
+        ptr.Set(dataToAppend->Des());
+        }
+    CleanupStack::PushL( dataToAppend );
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy( dataToAppend );
+#else
+    // phone memory free
+    HBufC* driveLetter = StringLoader::LoadLC(R_MPX_COLLECTION_PHONE_MEMORY_ROOT_PATH);
+    CEikonEnv* coeEnv = CEikonEnv::Static();
+    RFs& fileSession = coeEnv->FsSession();
+    TVolumeInfo volInfo;
+    TDriveUnit driveUnit(*driveLetter); // Get the drive
+    CleanupStack::PopAndDestroy(driveLetter);
+    driveLetter = NULL;
+    TInt err = fileSession.Volume(volInfo, (TInt)driveUnit);
+    MPX_DEBUG2("CMPXCollectionViewImp::ShowCollectionDetailsL phonemem err = %d", err);
+    if (KErrNone == err)
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL(volInfo.iFree, ETrue);
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr);
+        }
+    else
+        {
+        dataToAppend = StringLoader::LoadL(
+            R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM);
+        ptr.Set(dataToAppend->Des());
+        }
+    CleanupStack::PushL(dataToAppend);
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy(dataToAppend);
+    dataToAppend = NULL;
+
+    // memory card
+    driveLetter = StringLoader::LoadLC(R_MPX_COLLECTION_MEMORY_CARD_ROOT_PATH);
+    driveUnit = *driveLetter; // Get the drive
+    CleanupStack::PopAndDestroy(driveLetter);
+    driveLetter = NULL;
+    err = fileSession.Volume(volInfo, (TInt)driveUnit);
+    MPX_DEBUG2("CMPXPodcastCollectionViewImp::ShowCollectionDetailsL memcard err = %d", err);
+    if (err == KErrNone)
+        {
+        dataToAppend = iCommonUiHelper->UnitConversionL(volInfo.iFree, ETrue);
+        ptr.Set(dataToAppend->Des());
+        AknTextUtils::LanguageSpecificNumberConversion( ptr); 
+        }
+    else if (err == KErrNotReady || err == KErrCorrupt)
+        {
+        dataToAppend = StringLoader::LoadLC(
+            R_MPX_CUI_COLLECTION_DETAILS_CARD_UNAVAILABLE_ITEM);
+        ptr.Set(dataToAppend->Des());
+        }
+    // else ignore
+    CleanupStack::PushL( dataToAppend );
+
+    dataArray->AppendL( ptr );
+    CleanupStack::PopAndDestroy(dataToAppend);
+    dataToAppend = NULL;
+#endif // RD_MULTIPLE_DRIVE
+
+    // last refreshed
+    TInt64 lastRefreshed( 0 );
+    if (aMedia.IsSupported(KMPXMediaColDetailLastRefreshed))
+        {
+        lastRefreshed = aMedia.ValueTObjectL<TInt64>(KMPXMediaColDetailLastRefreshed);
+        }
+    TTime time(lastRefreshed);
+    dataToAppend = HBufC::NewLC(
+        KMPXMaxTimeLength + KMPXDurationDisplayResvLen);
+    HBufC* format = StringLoader::LoadLC(R_QTN_DATE_USUAL_WITH_ZERO);
+    TPtr modDatePtr = dataToAppend->Des();
+    time.FormatL(modDatePtr, *format);
+    CleanupStack::PopAndDestroy(format);
+    format = NULL;
+    AknTextUtils::LanguageSpecificNumberConversion( modDatePtr ); 
+    dataArray->AppendL(modDatePtr);
+    CleanupStack::PopAndDestroy(dataToAppend);
+    dataToAppend = NULL;
+
+    // Retrieve heading array
+    CDesCArrayFlat* headingsArray = NULL;
+    headingsArray = iCoeEnv->ReadDesCArrayResourceL(
+            R_MPX_PODCAST_CUI_COLLECTION_DETAILS_HEADINGS);
+    CleanupStack::PushL(headingsArray);
+
+    // Item array combines heading array and data array
+    CDesCArrayFlat* itemArray =
+        new (ELeave) CDesCArrayFlat(headingsArray->Count());
+    CleanupStack::PushL(itemArray);
+
+    for (TInt i = 0; i < headingsArray->Count(); i++)
+        {
+        HBufC *item = HBufC::NewLC(
+            headingsArray->MdcaPoint(i).Length() +
+            dataArray->MdcaPoint(i).Length() +
+            KMPXDurationDisplayResvLen);
+
+        TPtrC tempPtr1 = headingsArray->MdcaPoint(i);
+        TPtrC tempPtr2 = dataArray->MdcaPoint(i);
+
+        item->Des().Format(KMPXCollDetailsItemsFormat,
+                            &tempPtr1,
+                            &tempPtr2);
+
+        itemArray->AppendL(*item);
+        CleanupStack::PopAndDestroy(item);
+        }
+
+    CleanupStack::Pop(itemArray);
+    CleanupStack::PopAndDestroy(headingsArray);
+    CleanupStack::PopAndDestroy(dataArray);
+
+    // Set list items
+    CTextListBoxModel* model = list->Model();
+    model->SetOwnershipType(ELbmOwnsItemArray);
+    model->SetItemTextArray(itemArray);
+
+    // Set title
+    HBufC* title =
+        StringLoader::LoadLC(R_MPX_QTN_NMP_TITLE_COLLECTION_DETAILS);
+    popupList->SetTitleL(*title);
+    CleanupStack::PopAndDestroy(title);
+
+    // Show popup list
+    CleanupStack::Pop(popupList);
+    popupList->ExecuteLD();
+    CleanupStack::PopAndDestroy(list);
+    }
+
+//#ifdef __UPNP_FRAMEWORK_2_0_
+// ---------------------------------------------------------------------------
+// Handles Upnp menus from DynInitMenuPaneL()
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleDynInitUpnpL(
+    TInt aResourceId,
+    CEikMenuPane& aMenuPane )
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL()");
+
+    if ( !IsUpnpVisible() )
+        {
+        GetCurrentPlayerDetails();
+
+        if ( iCurrentPlayerType == EPbLocal )
+            {
+            aMenuPane.SetItemDimmed(
+                EMPXCmdUpnpPlayVia,
+                ETrue);
+            }
+        aMenuPane.SetItemDimmed(
+            EMPXCmdUPnPAiwCmdCopyToExternalCriteria,
+            ETrue);
+        }
+    else
+        {
+        MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL(): UPnP visible and media");
+        TInt currentItem( iContainer->Common()->CurrentLbxItemIndex() );
+
+        const CMPXMedia& media =
+            (iContainer->Common()->ListBoxArray())->MediaL( currentItem );
+        TMPXGeneralType type( EMPXNoType );
+        if (media.IsSupported(KMPXMediaGeneralType))
+            {
+            type =
+                media.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+            }
+
+        if ( ( type == EMPXItem ) ||
+             ( type == EMPXGroup ) )
+            {
+            MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL(): folder or song");
+            if (iErrorAttachCopyMenu != KErrNone)
+                {
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL(): error, Dim Copy");
+                aMenuPane.SetItemDimmed(
+                    EMPXCmdUPnPAiwCmdCopyToExternalCriteria,
+                    ETrue);
+                }
+            else
+                {
+                if (iServiceHandler->HandleSubmenuL(aMenuPane))
+                    {
+                    return;
+                    }
+
+                if (iServiceHandler->IsAiwMenu(aResourceId))
+                    {
+                    MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL(): Aiw menu");
+                    CAiwGenericParamList& in = iServiceHandler->InParamListL();
+
+                    iServiceHandler->InitializeMenuPaneL(aMenuPane, aResourceId, EMPXCmdUPnPAiwCmdCopyToExternalCriteria, in);
+                    MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleDynInitUpnpL(): after InitializeMenuPaneL");
+                    }
+                }
+            }
+         else
+            {
+            aMenuPane.SetItemDimmed(
+                EMPXCmdUpnpPlayVia,
+                ETrue);
+            aMenuPane.SetItemDimmed(
+                EMPXCmdUPnPAiwCmdCopyToExternalCriteria,
+                ETrue);
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::IsUpnpVisible
+// Checks if UPnP access point is defined
+// -----------------------------------------------------------------------------
+//
+TBool CMPXPodcastCollectionViewImp::IsUpnpVisible()
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewImp::IsUpnpVisible" );
+    
+    TBool returnValue = EFalse;
+#ifdef UPNP_INCLUDED
+   	if ( iUpnpCopyCommand && iUpnpFrameworkSupport ) 	  
+        {
+        returnValue = iUpnpCopyCommand->IsAvailableL();   
+        }
+#endif
+    return returnValue; 
+    
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::AddPlayersNamesToMenuL
+// Taken from Gallery upnp support implementation
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::AddPlayersNamesToMenuL(CEikMenuPane& aMenuPane)
+    {
+    RArray<TMPXPlaybackPlayerType> playerTypes;
+    CleanupClosePushL(playerTypes);
+
+    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+    manager.GetPlayerTypesL(playerTypes);
+
+    GetCurrentPlayerDetails();
+
+    TInt countPlayersTypes( playerTypes.Count() );
+    TInt countLocalType(0);
+    TInt countRemoteType(0);
+
+    if ( countPlayersTypes >= 1 )
+        {
+        iPlayersList.Close();
+
+        for ( TInt i = 0; i < countPlayersTypes; i++ )
+            {
+            MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] );
+            switch (playerTypes[i])
+                {
+                case EPbLocal:
+                    {
+                    // we only show 1 specific type once in the menu
+                    if ( countLocalType == 0 )
+                        {
+                        AddPlayerNameToMenuL( aMenuPane,
+                                            EMPXCmdUpnpPlayViaLocal,
+                                            manager,
+                                            playerTypes[i] );
+
+                        countLocalType++;
+                        }
+                    break;
+                    }
+                case EPbRemote:
+                    {
+                    // we only show 1 specific type once in the menu
+                    if ( countRemoteType == 0 )
+                        {
+                        AddPlayerNameToMenuL( aMenuPane,
+                                            EMPXCmdUpnpPlayViaRemotePlayer,
+                                            manager,
+                                            playerTypes[i] );
+                        countRemoteType++;
+                        }
+                    break;
+                    }
+                default:
+                    {
+                    // default case is handled in the next loop, we want
+                    // to add any "other" player at the end of the list
+                    break;
+                    }
+                }
+            } // for loop
+
+        for ( TInt i = 0; i < countPlayersTypes; i++ )
+            {
+            MPX_DEBUG3( "playerTypes[%d]: %d", i, playerTypes[i] );
+            // EPbLocal and EPbRemote were already added to the
+            // submenu in the previous loop
+            if ( playerTypes[i] != EPbLocal &&
+                 playerTypes[i] != EPbRemote )
+                {
+                // EPbUnknown or else
+                TBool alreadyInTheList( EFalse );
+
+                for ( TInt j = 0; j < i; j++)
+                    {
+                    // if the new playertype is already in the list
+                    if ( playerTypes[i] == playerTypes[j] )
+                        {
+                        alreadyInTheList = ETrue;
+                        break;
+                        }
+                    }
+
+                if ( !alreadyInTheList )
+                    {
+                    HBufC* buf = manager.PlayerTypeDisplayNameL(playerTypes[i]);
+
+                    if ( buf )
+                        {
+                        CleanupStack::PushL(buf);
+                        AddPlayerNameToMenuL( aMenuPane,
+                                            EMPXCmdUpnpPlayViaRemotePlayer,
+                                            manager,
+                                            playerTypes[i],
+                                            *buf );
+                        CleanupStack::PopAndDestroy(buf);
+                        }
+                    // else we don't do anything. other player type is not
+                    // currently supported. Implementation will be finalized
+                    // when the requirement is defined.
+                    }
+                }
+            }
+        }
+
+    CleanupStack::PopAndDestroy(&playerTypes);
+
+    if ( iPlayersList.Count() <= 1 )
+        {
+        aMenuPane.SetItemDimmed( EMPXCmdUpnpPlayViaRemotePlayer,
+                                  ETrue );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::AddPlayerNameToMenuL
+// Taken from Gallery upnp support implementation
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::AddPlayerNameToMenuL(CEikMenuPane& aMenuPane,
+                                                TInt aCommandId,
+                                                MMPXPlayerManager& aPlayerManager,
+                                                TMPXPlaybackPlayerType& aPlayerType,
+                                                const TDesC& aMenuText)
+    {
+    RArray<TUid> players;
+    CleanupClosePushL(players);
+    aPlayerManager.GetPlayerListL(players, aPlayerType);
+
+    // For now we only keep the first player we find
+    // Local player is always the first one in the list
+    // Ui spec limitation
+    MPX_DEBUG2( "players[0]: %d", players[0].iUid );
+    if ( aCommandId == EMPXCmdUpnpPlayViaLocal )
+        {
+        iPlayersList.Insert(players[0], 0);
+        }
+    else if ( ( aCommandId == EMPXCmdUpnpPlayViaRemotePlayer ) &&
+              (iPlayersList.Count() > 1) )
+        {
+        iPlayersList.Insert(players[0], 1);
+        }
+    else
+        {
+        iPlayersList.AppendL(players[0]);
+        }
+    CleanupStack::PopAndDestroy(&players);
+
+    // if the player is of unknown type
+    if ( ( aCommandId != EMPXCmdUpnpPlayViaRemotePlayer ) &&
+         ( aCommandId != EMPXCmdUpnpPlayViaLocal ) )
+        {
+        CEikMenuPaneItem::SData menuItem;
+        menuItem.iText.Copy( aMenuText );
+        menuItem.iCascadeId = 0;
+        menuItem.iFlags = EEikMenuItemRadioEnd;
+
+        menuItem.iCommandId = aCommandId + (iPlayersList.Count() - 1);
+        aCommandId = menuItem.iCommandId;
+
+        aMenuPane.AddMenuItemL( menuItem );
+        }
+
+    if ( iCurrentPlayerType == aPlayerType )
+        {
+        aMenuPane.SetItemButtonState( aCommandId, EEikMenuItemSymbolOn );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::GetCurrentPlayerDetails
+// Retrieves the current player name and type
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::GetCurrentPlayerDetails()
+    {
+    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+    TUid currentlyUsedPlayer;
+    TInt currentlyUsedSubPlayer;
+    iCurrentPlayerType = EPbLocal;
+    delete iSubPlayerName;
+    iSubPlayerName = NULL;
+    TRAP_IGNORE( manager.GetSelectionL( iCurrentPlayerType,
+                                        currentlyUsedPlayer,
+                                        currentlyUsedSubPlayer,
+                                        iSubPlayerName));
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::SelectNewPlayerL
+// Selects a new player for audio playback
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::SelectNewPlayerL(TInt aCommand)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::SelectNewPlayerL()");
+    MPX_DEBUG2("CMPXPodcastCollectionViewImp::SelectNewPlayerL(%d)", aCommand);
+
+    TInt errorSelectPlayer( KErrCancel );
+
+    switch (aCommand)
+        {
+        case EMPXCmdUpnpPlayViaLocal:
+            {
+            // if Local is not already the current player, select it
+            if ( iCurrentPlayerType != EPbLocal )
+                {
+                MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+                MPX_TRAP( errorSelectPlayer, manager.ClearSelectPlayersL() );
+                }
+            else // no need to reselect it but always start playback
+                {
+                errorSelectPlayer = KErrNone;
+                }
+            break;
+            }
+        default:
+            {
+            if ( aCommand >= EMPXCmdUpnpPlayViaRemotePlayer )
+                {
+                HBufC* buf = HBufC::NewLC( KMaxUidName );
+                buf->Des().AppendNum(
+                     (iPlayersList[aCommand -
+                                   EMPXCmdUpnpPlayViaLocal]).iUid );
+
+                // ActivateViewL leaves with KErrCancel if the dialog is
+                // cancelled
+                // ActivateViewL leaves with KErrInUse if the selected player
+                // is already the active player
+                MPX_TRAP(errorSelectPlayer, iViewUtility->ActivateViewL(
+                                TUid::Uid( KMPXPluginTypeUPnPBrowseDialogUid ),
+                                buf ));
+                CleanupStack::PopAndDestroy( buf );
+                }
+            break;
+            }
+        }
+
+    GetCurrentPlayerDetails();
+
+    // If InUse, the player selected is already the current one, we start playback anyway
+    // contrary to Playback view
+    if ( ( errorSelectPlayer == KErrNone ) ||
+         ( errorSelectPlayer == KErrInUse ) )
+        {
+        // Starts playback by calling OpenL() for the selected track
+        CMPXCommonListBoxArrayBase* array = iContainer->Common()->ListBoxArray();
+        if ( array )
+            {
+            MPX_DEBUG1("CMPXPodcastCollectionViewImp::SelectNewPlayerL() before MediaL()");
+
+            TInt currentListBoxItemIndex(
+                iContainer->Common()->CurrentLbxItemIndex() );
+
+            if ( currentListBoxItemIndex >= 0 )
+                {
+                const CMPXMedia& media = array->MediaL( currentListBoxItemIndex );
+
+                TMPXGeneralType type( EMPXNoType );
+                TMPXGeneralCategory category( EMPXNoCategory );
+
+                if ( media.IsSupported( KMPXMediaGeneralType ) )
+                    {
+                    type = media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+                    }
+
+                if ( media.IsSupported( KMPXMediaGeneralCategory ) )
+                    {
+                    category = media.ValueTObjectL<TMPXGeneralCategory>(
+                                    KMPXMediaGeneralCategory );
+                    }
+
+                // Needed to reset the status of iPreservedState
+                iPlaybackUtility->CommandL(EPbCmdResetPreserveState);
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL(attrs);
+				// Append the signal to set IsPlaying flag
+                MPX_DEBUG2("CMPXPodcastCollectionViewImp::SelectNewPlayerL() currentIndex %d", currentListBoxItemIndex );
+
+                if ((type == EMPXItem) && (category == EMPXPodcast))
+                    {
+                    MPX_DEBUG1("CMPXPodcastCollectionViewImp::SelectNewPlayerL() type is EMPXItem");
+                    iCollectionUtility->Collection().OpenL( currentListBoxItemIndex, attrs.Array() );
+                    }
+                else // if a folder is selected
+                    {
+                    MPX_DEBUG1("CMPXPodcastCollectionViewImp::SelectNewPlayerL() type is EMPXGroup");
+                    iCollectionUtility->Collection().OpenL( currentListBoxItemIndex,
+                                                            EMPXOpenPlaylistOnly);
+                    }
+                CleanupStack::PopAndDestroy(&attrs);
+                }
+            }
+        }
+    else if ( errorSelectPlayer != KErrCancel )
+        {
+        User::LeaveIfError(errorSelectPlayer);
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::CopySelectedItemsToRemoteL
+// Copies selected file(s) to remote player
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::CopySelectedItemsToRemoteL()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::CopySelectedItemsToRemoteL()");
+
+    TInt index( iContainer->Common()->CurrentLbxItemIndex() );
+    if ( index >= 0 )
+        {
+        CMPXCommonListBoxArrayBase* array =
+            iContainer->Common()->ListBoxArray();
+        const CMPXMedia& media = array->MediaL( index );
+
+        TMPXGeneralType type( EMPXNoType );
+        TMPXGeneralCategory category( EMPXNoCategory );
+
+       if ( media.IsSupported( KMPXMediaGeneralType ) )
+            {
+            type =
+                media.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+            }
+        if ( media.IsSupported( KMPXMediaGeneralCategory ) )
+            {
+            category =
+                media.ValueTObjectL<TMPXGeneralCategory>( KMPXMediaGeneralCategory );
+            }
+
+        CMPXCollectionPath* cpath =
+                              iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL( cpath );
+
+        if ( ( type == EMPXItem ) && ( category == EMPXPodcast ) )
+            {
+            const CArrayFix<TInt>* arrayIndex =
+                iContainer->Common()->CurrentSelectionIndicesL();
+            TInt arrayCount( arrayIndex->Count() );
+
+            cpath->ClearSelection();
+            if ( arrayCount > 0 )
+                {
+                for (TInt index=0; index < arrayCount; index++)
+                    {
+                    cpath->SelectL(arrayIndex->At(index));
+                    }
+                }
+            else
+                {
+                cpath->Set( index );
+                }
+
+            // Ask for the list of selected song paths: will return in HandleMedia()
+            ASSERT( iCurrentMediaLOp == EMPXOpMediaLIdle );
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append( KMPXMediaGeneralUri );
+            iCollectionUtility->Collection().MediaL( *cpath, attrs.Array() );
+            iCurrentMediaLOp = EMPXOpMediaLCopyToRemote;
+            CleanupStack::PopAndDestroy( &attrs );
+            }
+        else // if a folder is selected
+            {
+            TMPXItemId id(0);
+            if ( media.IsSupported( KMPXMediaGeneralId ) )
+                {
+                id = media.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+                }
+
+            RArray<TInt> supportedIds;
+            CleanupClosePushL(supportedIds);
+            supportedIds.AppendL(KMPXMediaIdGeneral);
+
+            CMPXMedia* entry = CMPXMedia::NewL(supportedIds.Array());
+            CleanupStack::PushL(entry);
+            entry->SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup );
+
+            entry->SetTObjectValueL( KMPXMediaGeneralCategory, EMPXPodcast );
+
+            entry->SetTObjectValueL( KMPXMediaGeneralId, id );
+
+            TInt depth( cpath->Levels() );
+            // last level, we need to specify the container Id for the search
+            if(depth > KMPXLastDirectoryLevel)
+                {
+                const TMPXItemId& containerId = cpath->Id(depth-1);
+                entry->SetTObjectValueL( KMPXMediaGeneralContainerId,
+                                            containerId);
+                }
+
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append( KMPXMediaGeneralUri );
+
+            ASSERT( iCurrentFindAllLOp == EMPXOpFindAllLIdle );
+            iCollectionUtility->Collection().FindAllL( *entry,
+                                                       attrs.Array(),
+                                                       *this );
+            iCurrentFindAllLOp = EMPXOpFindAllLUpnp;
+
+            CleanupStack::PopAndDestroy( &attrs );
+            CleanupStack::PopAndDestroy( entry );
+            CleanupStack::PopAndDestroy( &supportedIds );
+            }
+        CleanupStack::PopAndDestroy( cpath );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::DoHandleCopyToRemoteL
+// Handle call back from collectionframework for Copy to Remote command
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::DoHandleCopyToRemoteL(
+    const CMPXMedia& aMedia, TBool aComplete )
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::DoHandleCopyToRemoteL()");
+
+    CMPXMediaArray* mediaArray( NULL );
+    TInt fileCount( 0 );
+
+    if ( aMedia.IsSupported( KMPXMediaArrayContents ) )
+        {
+        mediaArray =
+            aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+        if ( mediaArray )
+            {
+            fileCount = mediaArray->Count();
+            }
+        }
+    MPX_DEBUG2("CMPXPodcastCollectionViewImp::DoHandleCopyToRemoteL Entry count = %d", fileCount);
+
+    // Change this to Global will be needed if FindAll() is called
+    // repeatedly until aComplete is ETrue (Inc9?)
+    CAiwGenericParamList* aiwCopyInParamList = CAiwGenericParamList::NewLC();
+
+    // multiple files or folder
+    if ( fileCount > 0 )
+        {
+        if ( mediaArray )
+            {
+            for ( TInt i = 0; i < fileCount; i++ )
+                {
+                CMPXMedia* media( mediaArray->AtL( i ) );
+
+                if ( media->IsSupported( KMPXMediaGeneralUri ) )
+                    {
+                    const TDesC& location =
+                        media->ValueText( KMPXMediaGeneralUri );
+                        MPX_DEBUG3( "CMPXPodcastCollectionViewImp::DoHandleCopyToRemote %d filePath = %S", i, &location );
+
+                    TAiwVariant path( location );
+                    TAiwGenericParam fileParameter( EGenericParamFile,
+                                                    path );
+                    aiwCopyInParamList->AppendL( fileParameter );
+                    }
+                }
+            }
+        }
+    else // single file
+        {
+        TMPXGeneralType type( EMPXNoType );
+
+        if ( aMedia.IsSupported( KMPXMediaGeneralType ) )
+            {
+            type = aMedia.ValueTObjectL<TMPXGeneralType>( KMPXMediaGeneralType );
+            }
+
+        if ( type == EMPXItem )
+            {
+            if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
+                {
+                const TDesC& location =
+                    aMedia.ValueText( KMPXMediaGeneralUri );
+                TAiwVariant path( location );
+                MPX_DEBUG2( "CMPXPodcastCollectionViewImp::DoHandleCopyToRemote filePath = %S", &location );
+
+                TAiwGenericParam fileParameter( EGenericParamFile, path );
+                aiwCopyInParamList->AppendL( fileParameter );
+                }
+            }
+        }
+
+    if ( ( aiwCopyInParamList->Count() > 0 ) &&
+         aComplete )
+        {
+        CAiwGenericParamList* outParamList = CAiwGenericParamList::NewLC();
+        // do not allow the copy dialog to be dismissed by external command
+        HandleCommandL( EMPXCmdIgnoreExternalCommand );
+        iServiceHandler->ExecuteMenuCmdL(
+                  EMPXCmdUPnPAiwCmdCopyToExternalCriteria, /* command id */
+                  *aiwCopyInParamList,   /* in parameters */
+                  *outParamList,          /* out parameters */
+                  0,                      /* options */
+                  NULL );                 /* call back */
+        HandleCommandL( EMPXCmdHandleExternalCommand );
+
+        CleanupStack::PopAndDestroy( outParamList );
+        }
+
+    // Clear selection
+    if( iContainer )
+        {
+        iContainer->Common()->ClearLbxSelection();
+        }
+
+    CleanupStack::PopAndDestroy( aiwCopyInParamList );
+    }
+//#endif //__UPNP_FRAMEWORK_2_0_
+
+// -----------------------------------------------------------------------------
+// checks if send option should be shown the option is selected.
+// -----------------------------------------------------------------------------
+//
+TBool CMPXPodcastCollectionViewImp::SendOptionVisibilityL()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::SendOptionVisibilityL");
+    TBool isHidden( iContainer->Common()->TotalListItemCount() < 1 );
+
+    if ( !isHidden )
+        {
+        CMPXCommonListBoxArrayBase* baseArray =
+            iContainer->Common()->ListBoxArray();
+        CMPXPodcastCollectionViewListBoxArray* array =
+            static_cast<CMPXPodcastCollectionViewListBoxArray*>( baseArray );
+        const CArrayFix<TInt>* selectedIndexArray =
+            iContainer->Common()->CurrentSelectionIndicesL();
+        TInt selectionCount( selectedIndexArray->Count() );
+
+        if ( selectionCount > 0 )
+            {
+            TBool isValid( EFalse );
+            for ( TInt i = 0; i < selectionCount && !isValid; i++ )
+                {
+                // multiple selection
+                // corrupted song can be sent in this case
+                isValid = !array->IsItemBrokenLinkL(
+                    selectedIndexArray->At( i ) ) &&
+                    !array->IsItemCorruptedL(
+                    selectedIndexArray->At( i ) );
+                }
+            // if anything is valid, display the item
+            isHidden = !isValid;
+            }
+        else
+            {
+            //single selection
+            TInt currentItem( iContainer->Common()->CurrentLbxItemIndex() );
+            isHidden = array->IsItemBrokenLinkL( currentItem ) ||
+                array->IsItemCorruptedL( currentItem );
+            }
+        }
+
+    return isHidden;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if file details option should be shown
+// -----------------------------------------------------------------------------
+//
+TBool CMPXPodcastCollectionViewImp::FileDetailsOptionVisibilityL()
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewImp::FileDetailsOptionVisibilityL" );
+    TBool isHidden( iContainer->Common()->TotalListItemCount() < 1 ||
+        iContainer->Common()->CurrentSelectionIndicesL()->Count() );
+    if ( !isHidden )
+        {
+        CMPXPodcastCollectionViewListBoxArray* array =
+            static_cast<CMPXPodcastCollectionViewListBoxArray*>(
+            iContainer->Common()->ListBoxArray() );
+        const CMPXMedia& media =
+            array->MediaL( iContainer->Common()->CurrentLbxItemIndex() );
+
+        if ( media.IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            TUint flags( media.ValueTObjectL<TUint>( KMPXMediaGeneralFlags ) );
+            if ( ( flags ) & ( KMPXMediaGeneralFlagsIsMissingDetails ) )
+                {
+                isHidden = ETrue;
+                }
+            }
+        }
+    return isHidden;
+    }
+// -----------------------------------------------------------------------------
+// Handle send command.
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::DoSendL()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::DoSendL");
+    iCurrentMediaLOp = EMPXOpMediaLSend;
+    CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL(path);
+
+    // Marked indicies
+    const CArrayFix<TInt>* array =
+        iContainer->Common()->CurrentSelectionIndicesL();
+    TInt arrayCount = array->Count();
+    MPX_DEBUG2("CMPXPodcastCollectionViewImp::DoSendL array count = %d", arrayCount);
+    if (arrayCount > 1)
+        {
+        // if more than 1 selected
+        for (TInt i = 0; i < arrayCount; i++)
+            {
+            MPX_DEBUG2("CMPXCollectionViewImp::DoSendL array index = %d", array->At(i));
+            path->SelectL(array->At(i));
+            }
+        }
+    else if (arrayCount == 1)
+        {
+        // if only 1 item is marked, treat it as single selection
+        path->Set(array->At(0));
+        }
+    else
+        {
+        path->Set(iContainer->Common()->CurrentLbxItemIndex());
+        }
+
+
+    RArray<TMPXAttribute> attrs;
+    CleanupClosePushL(attrs);
+    attrs.Append(
+        TMPXAttribute(KMPXMediaIdGeneral,
+            EMPXMediaGeneralUri |
+            EMPXMediaGeneralSize |
+            EMPXMediaGeneralCollectionId |
+            EMPXMediaGeneralFlags |
+            EMPXMediaGeneralId |
+            EMPXMediaGeneralType |
+            EMPXMediaGeneralCategory));
+    iCollectionUtility->Collection().MediaL(*path, attrs.Array());
+    CleanupStack::PopAndDestroy(&attrs);
+    CleanupStack::PopAndDestroy(path);
+    }
+
+
+// -----------------------------------------------------------------------------
+// Handle call back from collectionframework for send command
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::DoHandleSendL(
+    const CMPXMedia& aMedia, TInt aError)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::DoHandleSendL");
+    if (aError == KErrNone)
+        {
+        TInt invalidFileCount(0);
+        TInt corruptedFileCount(0);
+        TInt maxSize(0);
+        CMessageData* messageData = CMessageData::NewLC();
+
+        TInt fileCount(0);
+        if(aMedia.IsSupported(KMPXMediaArrayContents))
+            {
+            const CMPXMediaArray* mediaArray =
+                aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+            User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+            
+            fileCount = mediaArray->Count();
+            }
+        MPX_DEBUG2("CMPXCollectionViewImp::DoHandleSendL Entry count = %d", fileCount);
+
+        if (fileCount > 0)
+            {
+            const CMPXMediaArray* mediaArray =
+                aMedia.Value<CMPXMediaArray>(KMPXMediaArrayContents);
+            User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+            
+            for (TInt i = 0; i < fileCount; i++)
+                {
+                CMPXMedia* media( mediaArray->AtL( i ) );
+                TUint flags = 0;
+
+                if (aMedia.IsSupported(KMPXMediaGeneralFlags))
+                    {
+                    flags = media->ValueTObjectL<TUint>(KMPXMediaGeneralFlags);
+                    }
+
+                TUint isCorrupted( ( flags ) & ( KMPXMediaGeneralFlagsIsCorrupted ) );
+                TUint isInvalid( ( flags ) & ( KMPXMediaGeneralFlagsIsInvalid ) );
+                const TDesC& location = media->ValueText(KMPXMediaGeneralUri);
+
+                if (!isCorrupted && !isInvalid && ConeUtils::FileExists(location))
+                    {
+                    TInt fileSize = 0;
+                    if (isCorrupted)
+                        {
+                        corruptedFileCount++;
+                        }
+                    if (aMedia.IsSupported(KMPXMediaGeneralSize))
+                        {
+                        fileSize = media->ValueTObjectL<TInt>(KMPXMediaGeneralSize);
+                        }
+                    else
+                        {
+                        RFs& fileSession = iCoeEnv->FsSession();
+                        TEntry pl;
+                        fileSession.Entry(location, pl);
+                        fileSize = pl.iSize;
+                        }
+
+                    if (maxSize < fileSize)
+                        {
+                        maxSize = fileSize;
+                        }
+                    messageData->AppendAttachmentL(location);
+                    }
+                else
+                    {
+                    UpdateDatabaseFlagL(KErrNotFound, *media,
+                        KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse);
+                    invalidFileCount++;
+                    }
+                }
+            }
+        else
+            {
+            // single file
+            fileCount = 1;
+            TUint flags = 0;
+
+            if (aMedia.IsSupported(KMPXMediaGeneralFlags))
+                {
+                flags = aMedia.ValueTObjectL<TUint>(KMPXMediaGeneralFlags);
+                }
+
+            TUint isCorrupted( ( flags ) & ( KMPXMediaGeneralFlagsIsCorrupted ) );
+            TUint isInvalid( ( flags ) & ( KMPXMediaGeneralFlagsIsInvalid ) );
+            const TDesC& location = aMedia.ValueText(KMPXMediaGeneralUri);
+
+            if (!isInvalid && ConeUtils::FileExists(location))
+                {
+                TInt fileSize(0);
+                if (isCorrupted)
+                    {
+                    corruptedFileCount++;
+                    }
+                if (aMedia.IsSupported(KMPXMediaGeneralSize))
+                    {
+                    fileSize = aMedia.ValueTObjectL<TInt>(KMPXMediaGeneralSize);
+                    }
+                else
+                    {
+                    RFs& fileSession = iCoeEnv->FsSession();
+                    TEntry pl;
+                    fileSession.Entry(location, pl);
+                    fileSize = pl.iSize;
+                    }
+
+                if (maxSize < fileSize)
+                    {
+                    maxSize = fileSize;
+                    }
+                messageData->AppendAttachmentL(location);
+                }
+            else
+                {
+                UpdateDatabaseFlagL(KErrNotFound, aMedia,
+                    KMPXMediaGeneralFlagsIsInvalid, ETrue, EFalse);
+                invalidFileCount++;
+                }
+            }
+
+        TBool confirmOk = EFalse;
+        MPX_DEBUG4("CMPXCollectionViewImp::DoHandleSendL Invalid Count = %d, Corrupted Count = %d, Total Count = %d", invalidFileCount, corruptedFileCount, fileCount);
+        if (invalidFileCount || corruptedFileCount)
+            {
+            if (invalidFileCount == fileCount)
+                {
+                // all files are invalid
+                if (invalidFileCount == 1)
+                    {
+                    iCommonUiHelper->DisplayInfoNoteL(
+                        R_MPX_COLLECTION_INFO_FILE_NOT_FOUND);
+                    }
+                else
+                    {
+                    // Show information note if all files are invalid
+                    iCommonUiHelper->DisplayInfoNoteL(
+                        R_MPX_COLLECTION_SEND_ALL_INVALID_SONGS_NOTE_TXT);
+                    }
+                }
+            else
+                {
+                // Show confirmation query if invalid/corrupted file found
+                HBufC* queryTxt = StringLoader::LoadLC(
+                    R_MPX_COLLECTION_QUERY_SEND_INVALID_SONGS_TXT);
+                CAknQueryDialog* query = CAknQueryDialog::NewL(
+                    CAknQueryDialog::EConfirmationTone);
+//#ifdef __COVER_DISPLAY
+                CleanupStack::PushL(query);
+                query->PublishDialogL(EMPlayerNoteSendInvalidSongs,
+                                    KMPlayerNoteCategory);
+                CleanupStack::Pop(query);
+//#endif  //__COVER_DISPLAY
+                if (query->ExecuteLD(
+                    R_MPX_COLLECTION_GENERIC_CONFIRMATION_QUERY,
+                    *queryTxt))
+                    {
+                    confirmOk = ETrue;
+                    }
+                CleanupStack::PopAndDestroy(queryTxt);
+                }
+            }
+
+        if ((!invalidFileCount && !corruptedFileCount) || // everything is ok
+            (invalidFileCount && confirmOk) || // invalid files exist
+            (corruptedFileCount && confirmOk)) // courrupt files exist
+            {
+            if (!iSendUi)
+                {
+                iSendUi = CSendUi::NewL();
+                }
+            TSendingCapabilities capabilities(
+                0,
+                maxSize,
+                TSendingCapabilities::ESupportsAttachments);
+            HandleCommandL( EMPXCmdIgnoreExternalCommand );
+            MPX_TRAPD(err, iSendUi->ShowQueryAndSendL(messageData, capabilities));
+            if ( err != KErrNone )
+                {
+                HandleErrorL( err );
+                }
+            HandleCommandL( EMPXCmdHandleExternalCommand );
+            }
+
+        // Clear selection
+        if (iContainer)
+            {
+            iContainer->Common()->ClearLbxSelection();
+            }
+        CleanupStack::PopAndDestroy(messageData);
+        }
+    else
+        {
+        HandleErrorL(aError);
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// Prepares media object for selected items
+// -----------------------------------------------------------------------------
+//
+TInt CMPXPodcastCollectionViewImp::PrepareMediaForSelectedItemsL(CMPXMedia* aMedia)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::PrepareMediaForSelectedItemsL");
+    TInt ret(KErrNone);
+
+    if (aMedia)
+        {
+        CMPXMediaArray* mediaArray = CMPXMediaArray::NewL();
+        CleanupStack::PushL(mediaArray);
+        const CArrayFix<TInt>* array =
+            iContainer->Common()->CurrentSelectionIndicesL();
+        CMPXCommonListBoxArrayBase* listBoxArray =
+            iContainer->Common()->ListBoxArray();
+        TInt count = array->Count();
+        CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+        CleanupStack::PushL(path);
+        TMPXItemId id = path->Id(0);
+        MPX_DEBUG2("CMPXCollectionViewImp::PrepareMediaForSelectedItemsL collection ID = 0x%x", id.iId1);
+        CleanupStack::PopAndDestroy(path);
+        if (count > 0)
+            {
+            for (TInt i = 0; i < count; i++)
+                {
+                const CMPXMedia& listBoxMedia = listBoxArray->MediaL(array->At(i));
+                CMPXMedia* entry = CMPXMedia::NewL();
+                CleanupStack::PushL(entry);
+                entry->SetTextValueL(KMPXMediaGeneralTitle,
+                    listBoxMedia.ValueText(KMPXMediaGeneralTitle));
+                entry->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem);
+                entry->SetTObjectValueL(KMPXMediaGeneralCategory,
+                    EMPXSong);
+
+                if (listBoxMedia.IsSupported(KMPXMediaGeneralId))
+                    {
+                    entry->SetTObjectValueL(
+                        KMPXMediaGeneralId,
+                        listBoxMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+                    }
+                else
+                    {
+                    User::Leave(KErrArgument);
+                    }
+
+                entry->SetTObjectValueL(KMPXMediaGeneralCollectionId, id);
+
+                mediaArray->AppendL(entry);
+                CleanupStack::Pop(entry);
+                }
+            }
+        else
+            {
+            count = 1;
+            TInt currentItem = iContainer->Common()->CurrentLbxItemIndex();
+            const CMPXMedia& listBoxMedia = listBoxArray->MediaL(currentItem);
+            CMPXMedia* entry = CMPXMedia::NewL();
+            CleanupStack::PushL(entry);
+            entry->SetTextValueL(
+                KMPXMediaGeneralTitle,
+                listBoxMedia.ValueText(
+                    KMPXMediaGeneralTitle));
+            entry->SetTObjectValueL(KMPXMediaGeneralType, EMPXItem);
+            entry->SetTObjectValueL(KMPXMediaGeneralCategory, EMPXSong);
+
+            if (listBoxMedia.IsSupported(KMPXMediaGeneralId))
+                {
+                entry->SetTObjectValueL(KMPXMediaGeneralId,
+                    listBoxMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId));
+                }
+            else
+                {
+                User::Leave(KErrArgument);
+                }
+
+            entry->SetTObjectValueL(KMPXMediaGeneralCollectionId, id);
+
+            mediaArray->AppendL(entry);
+            CleanupStack::Pop(entry);
+            }
+        aMedia->SetTObjectValueL(KMPXMediaGeneralCollectionId, id);
+
+        aMedia->SetCObjectValueL(KMPXMediaArrayContents,
+            mediaArray);
+        aMedia->SetTObjectValueL(KMPXMediaArrayCount,
+            mediaArray->Count());
+        CleanupStack::PopAndDestroy(mediaArray);
+        }
+    else
+        {
+        ret = KErrArgument;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Set/clears the flags for item in database
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::UpdateDatabaseFlagL(TInt aIndex,
+                                                       const CMPXMedia& aMedia,
+                                                       TUint aFlag,
+                                                       TBool aSet,
+                                                       TBool aEnableInfoDialog)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateDatabaseFlagL");
+    CMPXCommonListBoxArrayBase* array = iContainer->Common()->ListBoxArray();
+    if (array)
+        {
+        // set the item as invalid
+        TUint flags(0);
+        if (aSet)
+            {
+            flags = KMPXMediaGeneralFlagsSetOrUnsetBit;
+            }
+        flags |= aFlag;
+
+        MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateDatabaseFlagL flag after 0x%x", flags);
+        CMPXMedia* entry = CMPXMedia::NewL();
+        CleanupStack::PushL(entry);
+        if (aIndex > KErrNotFound)
+            {
+            MPX_DEBUG2("CMPXPodcastCollectionViewImp::UpdateDatabaseFlagL using aIndex = %d", aIndex);
+            const CMPXMedia& media = array->MediaL(aIndex);
+
+            TMPXItemId id( 0 );
+            TMPXGeneralType type( EMPXNoType );
+            TMPXGeneralCategory category( EMPXNoCategory );
+
+            if (media.IsSupported(KMPXMediaGeneralId))
+                {
+                id = media.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
+                }
+
+            if (media.IsSupported(KMPXMediaGeneralType))
+                {
+                type =
+                    media.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+                }
+
+            if (media.IsSupported(KMPXMediaGeneralCategory))
+                {
+                category =
+                    media.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory);
+                }
+
+            entry->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, id);
+            entry->SetTObjectValueL<TMPXGeneralType>(
+                KMPXMediaGeneralType,
+                type);
+            entry->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory,
+                category);
+            }
+        else
+            {
+            // try to look for the info inside aMedia
+            if (aMedia.IsSupported(KMPXMediaGeneralId))
+                {
+                TMPXItemId id( aMedia.ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId) );
+                entry->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, id);
+                }
+            if (aMedia.IsSupported(KMPXMediaGeneralType))
+                {
+                TMPXGeneralType type(
+                    aMedia.ValueTObjectL<TMPXGeneralType>(
+                        KMPXMediaGeneralType) );
+                entry->SetTObjectValueL<TMPXGeneralType>(
+                    KMPXMediaGeneralType,
+                    type);
+                }
+            if (aMedia.IsSupported(KMPXMediaGeneralCategory))
+                {
+                TMPXGeneralCategory category(
+                    aMedia.ValueTObjectL<TMPXGeneralCategory>(KMPXMediaGeneralCategory) );
+                entry->SetTObjectValueL<TMPXGeneralCategory>(KMPXMediaGeneralCategory,
+                    category);
+                }
+            }
+
+        TUid collectionId = TUid::Uid(0);
+        if (aMedia.IsSupported(KMPXMediaGeneralCollectionId))
+            {
+            collectionId = aMedia.ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId);
+            }
+        else
+            {
+            User::Leave(KErrArgument);
+            }
+
+        entry->SetTObjectValueL<TUid>(KMPXMediaGeneralCollectionId,
+            collectionId);
+        entry->SetTObjectValueL<TUint>(KMPXMediaGeneralFlags, flags);
+        DoSetCollectionL( entry, ETrue );
+        CleanupStack::PopAndDestroy(entry);
+        }
+    if (aEnableInfoDialog)
+        {
+        if (KMPXMediaGeneralFlagsIsInvalid == aFlag)
+            {
+            iCommonUiHelper->DisplayInfoNoteL(R_MPX_COLLECTION_INFO_FILE_NOT_FOUND);
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle playback message
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewImp::DoHandlePlaybackMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EActivePlayerChanged:
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                MPX_DEBUG2("CMPXPodcastCollectionViewImp::DoHandlePlaybackMessageL - EStateChanged(%d)", type );
+                UpdatePlaybackStatusL(ETrue);
+                break;
+                }
+            case TMPXPlaybackMessage::EError:
+                {
+                if (iCommonUiHelper)
+                    {
+                    iCommonUiHelper->DismissWaitNoteL();
+                    HandleCommandL( EMPXCmdHandleExternalCommand );
+                    }
+                if (iProgressDialog)
+					{
+					iProgressDialog->ProcessFinishedL();
+					}
+                if (iIsDeleting)
+                    {
+                    iCollectionUiHelper->Cancel();
+                    iIsDeleting = EFalse;
+                    // if delete is interrupted, reopen
+                    iCollectionUtility->Collection().OpenL();
+                    }
+                MPX_DEBUG2("CMPXCollectionViewImp::DoHandlePlaybackMessageL Error = %d", data );
+                break;
+                }
+            case TMPXPlaybackMessage::EPlayerUnavailable:
+                {
+//#ifdef __UPNP_FRAMEWORK_2_0_
+                if ( iUpnpFrameworkSupport )
+                    {
+                    if ( data == KErrNotFound)
+                        {
+                        if ( iViewUtility->ActiveViewType() ==
+                            TUid::Uid( KMPXPluginTypeCollectionUid ) )
+                            {
+                            if ( iSubPlayerName )
+                                {
+                                HBufC* dialogText = StringLoader::LoadLC(
+                                    R_MPX_COLLECTION_NOTE_REMOTE_CONNECTION_FAILED,
+                                    *iSubPlayerName);
+                                CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+                                errNote->SetTimeout(CAknNoteDialog::ELongTimeout);
+                                errNote->ExecuteLD( *dialogText );
+                                CleanupStack::PopAndDestroy( dialogText );
+                                }
+                            }
+                        }
+                    }
+//#endif // __UPNP_FRAMEWORK_2_0_
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Handle collection message
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::DoHandleCollectionMessageL( const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewImp::DoHandleCollectionMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        MPX_DEBUG3( "CMPXPodcastCollectionViewImp::HandleCollectionMessage Event = %d, Type() = %d",
+            event, type );
+
+        // Only handle collection messages while collection view is in focus
+        // and not transitioning views
+        if( iContainer )
+            {
+            if ( event == TMPXCollectionMessage::EPathChanged &&
+                type == EMcPathChangedByOpen &&
+                data == EMcContainerOpened)
+                { // Open new entries
+                iCollectionUtility->Collection().OpenL();
+                }
+            else if ( event == TMPXCollectionMessage::EPathChanged &&
+                     type == EMcPathChangedByCollectionChange)
+                {
+                if(!iIsDeleting)
+                    {
+                     // Re-Fetch entries only if we are in playlist
+                    iCollectionUtility->Collection().OpenL();
+                    }
+                }
+            else if ( event == TMPXCollectionMessage::EPathChanged &&
+                     type == EMcPathChangedByOpen &&
+                     data == EMcItemOpened)
+                {
+                // opened a song, revert back one level
+                iBackOneLevel = ETrue;
+                }
+            else if( event == TMPXCollectionMessage::EBroadcastEvent &&
+                     iViewUtility->ActiveViewType() != TUid::Uid(KMPXPluginTypeWaitNoteDialogUid))
+                {
+                MPX_DEBUG2( "CMPXPodcastCollectionViewImp::DoHandleCollectionMessageL - broadcast type = %d", type );
+                if ( type == EMcMsgDiskRemoved )
+                    {
+                    AknDialogShutter::ShutDialogsL( *CEikonEnv::Static() );
+                    }
+                }
+#ifdef __COVER_DISPLAY                          
+            else if ( event == TMPXCollectionMessage::EFocusChanged )
+                {
+                if ( data != KErrNotFound &&
+                    data < iContainer->Common()->CurrentListItemCount() &&
+                    !iIgnoreNextFocusChangedMessage )
+                    {
+                    iContainer->Common()->SetLbxCurrentItemIndexAndDraw( data );
+                    }
+                iIgnoreNextFocusChangedMessage = EFalse;
+                }
+#endif // __COVER_DISPLAY                            
+            // else ignore
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXAlbumArtEditorDialog::DoSetCollectionL
+// Perform a set operation
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::DoSetCollectionL( CMPXMedia* aMedia, TBool aSync )
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::DoSetCollectionL");
+    CMPXCommand* cmd = CMPXCommand::NewL();
+    CleanupStack::PushL( cmd );
+
+    cmd->SetTObjectValueL( KMPXCommandGeneralId, KMPXCommandIdCollectionSet );
+    cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, aSync );
+    TUid colId( aMedia->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId) );
+    cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, colId.iUid );
+    cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColSetMedia, aMedia );
+
+    iCollectionUtility->Collection().CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+#ifdef __ENABLE_MSK
+// ---------------------------------------------------------------------------
+// Updates the middle softkey display
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::UpdateMiddleSoftKeyDisplayL(TInt aMskId)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::UpdateMiddleSoftKeyDisplayL");
+    if (iContainer)
+        {
+        CEikButtonGroupContainer* cba = Cba();
+        if (cba)
+            {
+            if (!iContainer->Common()->CurrentListItemCount()) // list is empty
+                {
+                iCommonUiHelper->RemoveMiddleSoftKeyLabel(*cba);
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateMiddleSoftKeyDisplayL - remove label, list is empty");
+                }
+            else if (iContainer->Common()->CurrentSelectionIndicesL()->Count()) // marked items
+			{
+            CFbsBitmap* bitmap = NULL;
+            CFbsBitmap* mask = NULL;
+            AknsUtils::CreateColorIconL(
+                AknsUtils::SkinInstance(), 
+                KAknsIIDQgnPropMskMenu, 
+                KAknsIIDQsnComponentColors, 
+                EAknsCIQsnComponentColorsCG13,
+                bitmap, 
+                mask,
+                AknIconUtils::AvkonIconFileName(),
+                EMbmAvkonQgn_prop_msk_menu, 
+                EMbmAvkonQgn_prop_msk_menu_mask, 
+                KRgbBlack); 
+
+            CleanupStack::PushL(bitmap);
+            CleanupStack::PushL(mask);
+        
+            // set middle softkey icon 
+            iCommonUiHelper->SetMiddleSoftKeyIconL(*cba, bitmap, mask);
+        
+            CleanupStack::PopAndDestroy(2, bitmap);
+            MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateMiddleSoftKeyDisplayL - items marked, show icon");
+			}
+            else
+                {
+                iCommonUiHelper->SetMiddleSoftKeyLabelL(
+                    *cba,
+                    aMskId,
+                    EAknSoftkeyForwardKeyEvent);
+                iCurrentMskId = aMskId;
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::UpdateMiddleSoftKeyDisplayL - new label displayed");
+                }
+            cba->DrawDeferred();
+            }
+        }
+    }
+#endif // __ENABLE_MSK
+
+// ---------------------------------------------------------------------------
+// From MProgressDialogCallback
+// Callback method. Get's called when a dialog is dismissed
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::DialogDismissedL(TInt aButtonId)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::DialogDismissedL");
+    switch (aButtonId)
+        {
+        case EAknSoftkeyCancel:
+            {
+            iIsWaitNoteCanceled = ETrue;
+            if(iIsDeleting)
+                {
+                iCollectionUiHelper->Cancel();
+                iIsDeleting = EFalse;
+                // if delete is interrupted, reopen
+                iCollectionUtility->Collection().OpenL();
+                }
+
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection message
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleCollectionMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d a folder
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleOpenL(
+    const CMPXMedia& aEntries,
+    TInt aIndex,
+    TBool /*aComplete*/,
+    TInt aError)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::HandleOpenL 4");
+    iHandlingKeyEvent = EFalse;
+
+    if(aError == KErrNone)
+        {
+        if ( !iContainer )
+            {
+            // View is not active. Ignore.
+            return;
+            }
+#ifdef __ENABLE_MSK
+        TInt mskId(R_QTN_MSK_OPEN);
+    TMPXPodcastCategory pCategory = aEntries.ValueTObjectL<TMPXPodcastCategory>(KMPXMediaPodcastCategoryGroup);
+    TMPXPodcastType pType = aEntries.ValueTObjectL<TMPXPodcastType>(KMPXMediaPodcastType);
+    if ((pCategory == EMPXAll) || (pCategory == EMPXRecentlyAdded) ||
+        (pCategory == EMPXNotYetPlayed)||
+        ((pCategory == EMPXEpisode) && (pType == EMPXPodcastItem)))
+        {
+		    mskId = R_QTN_MSK_PLAY;
+		    }
+#endif // __ENABLE_MSK
+        UpdateOptionMenuL();
+        MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleOpenL Number of Entries: %d", aEntries.Count());
+        UpdateListBoxL(const_cast<CMPXMedia&>(aEntries), aIndex);
+
+        delete iNumEpisode;
+        iNumEpisode = NULL;
+
+        if(aEntries.IsSupported(KMPXMediaGeneralCount))
+            {
+            CMPXMediaArray* mediaArray =
+                const_cast<CMPXMediaArray*>(aEntries.Value<CMPXMediaArray>(KMPXMediaArrayContents));
+            User::LeaveIfNull(const_cast<CMPXMediaArray*>(mediaArray));
+             
+            TInt number( mediaArray->Count() );
+            HBufC* text( NULL );
+
+            if (number == 1)
+                {
+                text = StringLoader::LoadLC(R_MPX_QTN_NMP_ONE_EPISODE);
+                }
+            else if (number > 1)
+                {
+                text = StringLoader::LoadLC(R_MPX_QTN_NMP_NUM_EPISODES, number);
+                }
+            // else ignore
+
+            if ((mskId == R_QTN_MSK_PLAY) && (number <= 0))
+                    {
+                    mskId = 0;
+                    }
+            if (number >= 1)
+                {
+#ifdef __ENABLE_MSK
+#endif // __ENABLE_MSK
+                iNumEpisode = text->Alloc();
+                CleanupStack::PopAndDestroy(text);
+                }
+            }
+
+        UpdateNaviPaneL();
+
+        if ( iContainer )
+            {
+            // this has to be done after the list box media is properly
+            // updated
+            if ( !iContainer->Common()->FindBoxVisibility() )
+                {
+                MPX_DEBUG1( "CMPXPodcastCollectionViewImp::HandleOpenL find box not visible" );
+
+                CEikButtonGroupContainer* cba = Cba();
+                if ( cba )
+                    {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+                    cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+#else
+                    cba->SetCommandSetL(
+                        ( iViewUtility->ViewHistoryDepth() == 1) ?
+                        R_AVKON_SOFTKEYS_OPTIONS_EXIT : R_AVKON_SOFTKEYS_OPTIONS_BACK );
+
+#endif
+
+    #ifdef __ENABLE_MSK
+                    if (mskId != 0)
+                        {
+                        UpdateMiddleSoftKeyDisplayL(mskId);
+                        }
+    #endif // __ENABLE_MSK
+
+                    cba->DrawDeferred();
+                    }
+                }
+            else
+                {
+                MPX_DEBUG1( "CMPXPodcastCollectionViewImp::HandleOpenL find box visible" );
+                }
+
+            CMPXCommonListBoxArrayBase* array(
+                iContainer->Common()->ListBoxArray() );
+            const CMPXMedia& containerMedia = array->ContainerMedia();
+
+            delete iTitle;
+            iTitle = NULL;
+
+            if (containerMedia.IsSupported( KMPXMediaGeneralTitle ))
+                {
+                iTitle =
+                    containerMedia.ValueText( KMPXMediaGeneralTitle ).AllocL();
+                }
+            UpdateTitlePaneL();
+            }
+
+        iHandleOpenProcessed = ETrue;
+        }
+    else
+        {
+		if ( iContainer )
+            {
+            CEikButtonGroupContainer* cba = Cba();
+            if ( cba )
+                {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+                cba->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
+#else
+                cba->SetCommandSetL(
+                    ( iViewUtility->ViewHistoryDepth() == 1 ) ?
+                    R_AVKON_SOFTKEYS_OPTIONS_EXIT : R_AVKON_SOFTKEYS_OPTIONS_BACK );
+#endif
+                cba->DrawDeferred();
+                }
+            }
+
+        HandleErrorL(aError);
+        }
+
+    if (iIsDeleting)
+        {
+        // nothing else to delete
+        iIsDeleting = EFalse;
+        if (iProgressDialog)
+			{
+			iProgressDialog->ProcessFinishedL();
+			}
+        HandleCommandL( EMPXCmdHandleExternalCommand );
+        }
+    MPX_PERF_CHECKPT("Collection View opened");
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles the collection entries being opened. Typically called
+// when client has Open()'d an item. Client typically responds by
+// 'playing' the item
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleOpenL(
+    const CMPXCollectionPlaylist& /*aPlaylist*/,
+    TInt /*aError*/)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::HandleOpenL 2");
+    iHandlingKeyEvent = EFalse;
+    // Do Nothing: playback/fetch client should handle this stage
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle media properties
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleCollectionMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::HandleCollectionMediaL");
+    if (aError == KErrNone)
+        {
+        switch (iCurrentMediaLOp)
+            {
+            case EMPXOpMediaLGetContainerInfo:
+                {
+                delete iTitle;
+                iTitle = NULL;
+
+                TMPXGeneralType type = EMPXNoType;
+                if (aMedia.IsSupported(KMPXMediaGeneralType))
+                    {
+                    type =
+                        aMedia.ValueTObjectL<TMPXGeneralType>(KMPXMediaGeneralType);
+                    }
+
+                if (aMedia.IsSupported(KMPXMediaGeneralTitle) &&
+                    type != EMPXItem)
+                    {
+                    iTitle = aMedia.ValueText(KMPXMediaGeneralTitle).AllocL();
+                    MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleCollectionMediaL Title is %S", iTitle);
+                    }
+                UpdateTitlePaneL();
+                break;
+                }
+            case EMPXOpMediaLSongDetailsFileCheck:
+                {
+                const TDesC& location = aMedia.ValueText(KMPXMediaGeneralUri);
+
+                TInt currentLbxItemIndex(
+                    iContainer->Common()->CurrentLbxItemIndex());
+
+                if (location.Length() == 0 || ConeUtils::FileExists(location))
+                    {
+                    HBufC* buf = HBufC::NewLC(5); // magic number
+                    buf->Des().AppendNum(currentLbxItemIndex);
+                    // Activate metadata editor dialog via View Framework
+                    iViewUtility->ActivateViewL(
+                        TUid::Uid(KMPXPluginTypeMetadataEditorUid), buf);
+                    CleanupStack::PopAndDestroy(buf);
+                    }
+                else
+                    {
+                    // mark database for invalid
+                    UpdateDatabaseFlagL(currentLbxItemIndex,
+                        aMedia, KMPXMediaGeneralFlagsIsInvalid, ETrue);
+                    }
+                break;
+                }
+            case EMPXOpMediaLSend:
+                {
+                DoHandleSendL(aMedia, aError);
+                break;
+                }
+            case EMPXOpMediaLCollectionDetails:
+                {
+                ShowCollectionDetailsL(aMedia);
+                break;
+                }
+//#ifdef __UPNP_FRAMEWORK_2_0_
+            case EMPXOpMediaLCopyToRemote:
+                {
+                if ( iUpnpFrameworkSupport )
+                    {
+                    DoHandleCopyToRemoteL( aMedia );
+                    }
+                break;
+                }
+//#endif //__UPNP_FRAMEWORK_2_0_
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else
+        {
+        HandleErrorL(aError);
+        }
+    iCurrentMediaLOp = EMPXOpMediaLIdle;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCHelperObserver
+// Handles the completion of helper events
+// ---------------------------------------------------------------------------
+//
+
+void CMPXPodcastCollectionViewImp::HandleOperationCompleteL(
+                                           TCHelperOperation aOperation,
+                                           TInt aErr,
+                                           void* aArgument)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::HandleOperationCompleteL");
+    switch(aOperation)
+        {
+        case EDeleteOp:
+            {
+            // do not dismiss the wait note until HandleOpenL is called,
+            if(aErr == KErrInUse)
+                {
+                iIsDeleting = EFalse;
+				if (iProgressDialog)
+					{
+					iProgressDialog->ProcessFinishedL();
+					}
+                HandleCommandL( EMPXCmdHandleExternalCommand );
+                aErr = KErrNone; //handled here
+                HBufC* text(NULL);
+                if(iContainer->Common()->CurrentSelectionIndicesL()->Count() == 0)
+                    {
+                    // Single selection
+                    text = StringLoader::LoadLC(R_MPX_COLLECTION_NOTE_DELETE_FAIL);
+                    }
+                else
+                    {
+                    // Multi selection
+                    text = StringLoader::LoadLC(
+                        R_MPX_COLLECTION_NOTE_DELETE_FAIL_MULTI_SELECTION);
+                    }
+
+                CAknErrorNote* dlg = new (ELeave) CAknErrorNote(ETrue);
+                dlg->ExecuteLD(*text);
+                CleanupStack::PopAndDestroy(text);
+                }
+            else if (aErr != KErrNone)
+                {
+                iIsDeleting = EFalse;
+                if(!iIsWaitNoteCanceled)
+                    {
+                    if (iProgressDialog)
+                    	{
+						iProgressDialog->ProcessFinishedL();
+						}
+                    HandleCommandL( EMPXCmdHandleExternalCommand );
+                    iIsWaitNoteCanceled = EFalse;
+                    }
+
+                HandleErrorL(aErr);
+                }
+            // else do nothing
+
+            iContainer->Common()->ClearLbxSelection();
+
+             // reopen collection
+            iCollectionUtility->Collection().OpenL();
+            break;
+            }
+        case EDeleteStatusOp:
+            {
+            if ( aArgument )
+                {
+                CMPXMedia* media = (CMPXMedia*)aArgument;
+                CleanupStack::PushL( media );
+                if ( media->IsSupported( KMPXMediaGeneralCount ) )
+                    {
+                    TInt deletePercent = media->ValueTObjectL<TInt>( KMPXMediaGeneralCount );
+                    MPX_DEBUG2( "CMPXCollectionViewImp::HandleOperationCompleteL % Files Deleted: %d", deletePercent );
+                    // update WaitNote dialog.
+                    HBufC* string = StringLoader::LoadLC(R_MPX_QTN_NMP_DEL_BATCH_SONGS_WAIT_NOTE, deletePercent);
+                    TPtr buf = string->Des();
+
+                    UpdateProcessL(deletePercent, buf);
+                    CleanupStack::PopAndDestroy( string );
+                    }
+                CleanupStack::PopAndDestroy( media );
+                aArgument = NULL;
+                }
+            break;
+            }
+        case ERenameOp: // fall through
+        case ESetOp:
+        case EAddOp:
+        default:
+        break;
+        }
+
+
+    if(aArgument)
+        {
+        delete (CBase*)aArgument;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandlePropertyL(
+    TMPXPlaybackProperty /*aProperty*/,
+    TInt /*aValue*/,
+    TInt /*aError*/)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::HandlePropertyL");
+    }
+
+// ---------------------------------------------------------------------------
+// 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 CMPXPodcastCollectionViewImp::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::HandleSubPlayerNamesL");
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media event.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleMediaL(
+    const CMPXMedia& /*aMedia*/,
+    TInt /*aError*/)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::HandleMediaL");
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Returns views id.
+// ---------------------------------------------------------------------------
+//
+TUid CMPXPodcastCollectionViewImp::Id() const
+    {
+    return TUid::Uid(KMPXPodcastCollectionViewId);
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Command handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleCommandL(TInt aCommand)
+    {
+    MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleCommandL(%d) entering",
+        aCommand);
+
+    switch (aCommand)
+        {
+        case EAknCmdMark:
+        case EAknCmdUnmark:
+        case EAknMarkAll:
+        case EAknUnmarkAll:
+            {
+            // Custom handling of markable lists
+            iContainer->Common()->HandleMarkableListProcessCommandL(
+                aCommand );
+#ifdef __ENABLE_MSK
+            // Determine middle soft key labeling
+            UpdateMiddleSoftKeyDisplayL(iCurrentMskId);
+#endif // __ENABLE_MSK
+            break;
+            }
+        case EMPXCmdGoToNowPlaying:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+        case EMPXCmdAddSongs:
+            {
+            iViewUtility->ActivateViewL(
+                TUid::Uid(KMPXPluginTypeAddSongsEditorUid));
+            iCollectionUtility->Collection().OpenL();
+            break;
+            }
+        case EMPXCmdDelete: // fall through
+        case EMPXCmdRemove:
+            {
+            StoreListboxItemIndexL();
+            DeleteSelectedItemsL();
+            break;
+            }
+        case EMPXCmdSend:
+            {
+            DoSendL();
+            break;
+            }
+        case EMPXCmdEpisodeDetails:
+            {
+            StoreListboxItemIndexL();
+            
+            iCurrentMediaLOp = EMPXOpMediaLSongDetailsFileCheck;
+
+            iSelectedItem = KMPXInvalidItemId;
+            TInt currentIndex = iContainer->Common()->CurrentLbxItemIndex();
+            CMPXCommonListBoxArrayBase* listboxArray = iContainer->Common()->ListBoxArray();
+            const CMPXMedia& currentSelectedMedia = listboxArray->MediaL(currentIndex);
+            iSelectedItem = currentSelectedMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
+            CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL(path);
+
+            path->Set(iContainer->Common()->CurrentLbxItemIndex());
+
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append(
+                TMPXAttribute(KMPXMediaIdGeneral,
+                    EMPXMediaGeneralUri | EMPXMediaGeneralCollectionId));
+            iCollectionUtility->Collection().MediaL(*path, attrs.Array());
+            CleanupStack::PopAndDestroy(&attrs);
+            CleanupStack::PopAndDestroy(path);
+            break;
+            }
+        case EMPXCmdPodcasting:
+            {
+            LaunchPodcastAppL();
+            break;
+            }
+        case EMPXCmdLibraryDetails:
+            {
+            iCurrentMediaLOp = EMPXOpMediaLCollectionDetails;
+            CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+            CleanupStack::PushL(path);
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            attrs.Append(KMPXMediaColDetailNumberOfItems);
+            attrs.Append(KMPXMediaColDetailDuration);
+            attrs.Append(KMPXMediaColDetailLastRefreshed);
+            path->Back();
+            iCollectionUtility->Collection().MediaL(*path, attrs.Array());
+            CleanupStack::PopAndDestroy(&attrs);
+            CleanupStack::PopAndDestroy(path);
+            break;
+            }
+         case EMPXCmdSetPlayed:
+            {
+            SetPlayedStatusL( ETrue );
+            break;
+            }
+        case EMPXCmdSetUnplayed:
+            {
+            SetPlayedStatusL( EFalse );
+            break;
+            }
+        case EAknCmdHelp:
+            {
+            HlpLauncher::LaunchHelpApplicationL(
+                iEikonEnv->WsSession(),
+                AppUi()->AppHelpContextL());
+            break;
+            }
+        case EAknSoftkeyBack:
+            {
+            if(!iHandlingKeyEvent)
+                {
+                iContainer->Common()->ClearLbxSelection();
+                CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+                CleanupStack::PushL(cpath);
+                TInt currentDepth = cpath->Levels();
+                cpath->Back();
+                cpath->Back();
+
+#ifndef __ENABLE_PODCAST_IN_MUSIC_MENU
+                iCollectionUtility->Collection().BackL();
+#endif
+
+                if (currentDepth == 2)
+                    {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+                    // open the podcast collection db plugin
+                    CMPXCollectionPath* mainPodcastMenu = CMPXCollectionPath::NewL();
+                    CleanupStack::PushL( mainPodcastMenu );
+                    mainPodcastMenu->AppendL(KMusicCollectionUid);
+                    iCollectionUtility->Collection().OpenL( *mainPodcastMenu );
+                    CleanupStack::PopAndDestroy( mainPodcastMenu );
+
+                    // activate the podcast collection view
+                    RArray<TUid> uids;
+                    CleanupClosePushL( uids );
+                    uids.AppendL( TUid::Uid( KMPXPluginTypeCollectionUid ) );
+                    uids.AppendL( TUid::Uid( KMusicCollectionUid ));
+                    iViewUtility->ActivateViewL(uids);
+
+                    CleanupStack::PopAndDestroy( &uids );
+#else
+                    AppUi()->HandleCommandL(aCommand);
+#endif
+                    }
+                else if (currentDepth == 3) // jumping back to the main podcast menu
+                    {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+                    iCollectionUtility->Collection().BackL();
+#endif
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL(attrs);
+                    iHandlingKeyEvent = ETrue;
+                    iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo;
+                    attrs.Append(
+                        TMPXAttribute(KMPXMediaIdGeneral,
+                            EMPXMediaGeneralDuration|
+                            EMPXMediaGeneralCount));
+                    attrs.Append(
+                        TMPXAttribute(KMPXMediaIdPodcast,
+                            EMPXMediaPodcastType|
+                            EMPXMediaPodcastCategoryGroup));
+                    iCollectionUtility->Collection().MediaL(*cpath, attrs.Array());
+                    CleanupStack::PopAndDestroy(&attrs);
+                    iBackOneLevel = ETrue;
+                    }
+                else
+                    {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+                    iCollectionUtility->Collection().BackL();
+#endif
+                    RArray<TMPXAttribute> attrs;
+                    CleanupClosePushL(attrs);
+                    iHandlingKeyEvent = ETrue;
+                    iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo;
+                    attrs.Append(
+                        TMPXAttribute(KMPXMediaIdGeneral,
+                            EMPXMediaGeneralTitle |
+                            EMPXMediaGeneralDuration |
+                            EMPXMediaGeneralCount));
+                    attrs.Append(
+                        TMPXAttribute(KMPXMediaIdPodcast,
+                            EMPXMediaPodcastType |
+                            EMPXMediaPodcastCategoryGroup));
+                    iCollectionUtility->Collection().MediaL(*cpath, attrs.Array());
+                    CleanupStack::PopAndDestroy(&attrs);
+                    iBackOneLevel = ETrue;
+                    }
+                CleanupStack::PopAndDestroy(cpath);
+                }
+            else
+                {
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleCommandL Busy, ignoring command");
+                }
+            break;
+            }
+        case EAknCmdExit:
+        case EAknSoftkeyExit:
+            {
+            AppUi()->HandleCommandL( aCommand );
+            break;
+            }
+//#ifdef __UPNP_FRAMEWORK_2_0_
+        case EMPXCmdUpnpPlayViaLocal:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                SelectNewPlayerL( aCommand );
+                }
+            break;
+            }
+        case EMPXCmdUPnPAiwCmdCopyToExternalCriteria:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                CopySelectedItemsToRemoteL();
+                }
+            break;
+            }
+//#endif //__UPNP_FRAMEWORK_2_0_
+        case EMPXCmdPlay:
+        case EMPXCmdPlayPause:
+            {
+            TMPXPlaybackState state(iPlaybackUtility->StateL());
+            if ((EPbStateNotInitialised == state ||
+                EPbStateStopped == state) &&
+                iContainer->Common()->CurrentListItemCount() > 0)
+                {
+                // Needed to reset the status of iPreservedState
+                if ( EPbStateStopped == state )
+                    {
+                    iPlaybackUtility->CommandL(EPbCmdResetPreserveState);
+                    }
+
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL(attrs);
+
+                // specifying this attribute acts as a signal to the
+                // podcast collection plugin that this media file
+                // is currently being played
+
+                TInt currentItem(iContainer->Common()->CurrentLbxItemIndex());
+                MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleCommandL playing index %d", currentItem);
+                if (currentItem != KErrNotFound)
+                    {
+                    iCollectionUtility->Collection().OpenL(currentItem, attrs.Array(), EMPXOpenPlaylistOnly);
+                    }
+                // else ignore
+                CleanupStack::PopAndDestroy(&attrs);
+                }
+            else
+                {
+                AppUi()->HandleCommandL(aCommand);
+                }
+            break;
+            }
+        case EMPXCmdPause:
+        case EMPXCmdStop:
+        case EMPXCmdNext:
+        case EMPXCmdPrevious:
+        case EMPXCmdSeekForward:
+        case EMPXCmdSeekBackward:
+        case EMPXCmdStopSeeking:
+        case EMPXCmdVolumeUp:
+        case EMPXCmdVolumeDown:
+            {
+            AppUi()->HandleCommandL(aCommand);
+            break;
+            }
+        default:
+            {
+            MPX_PERF_CHECKPT("Handle Collection view unknown command");
+//#ifdef __UPNP_FRAMEWORK_2_0_
+            if ( iUpnpFrameworkSupport )
+                {
+                if (aCommand >= EMPXCmdUpnpPlayViaRemotePlayer  &&
+                     aCommand < EMPXCmdUpnpLastCommandId)
+                    {
+                    SelectNewPlayerL(aCommand);
+                    }
+                else
+                    {
+                    AppUi()->HandleCommandL(aCommand);
+                    }
+                }
+            else
+                {
+                AppUi()->HandleCommandL(aCommand);
+                }
+//#endif //__UPNP_FRAMEWORK_2_0_
+            break;
+            }
+        }
+    MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleCommandL() exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Handles a view activation.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::DoActivateL(
+    const TVwsViewId& /* aPrevViewId */,
+    TUid /* aCustomMessageId */,
+    const TDesC8& /* aCustomMessage */)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::DoActivateL()");
+
+    iHandleOpenProcessed = EFalse;
+
+    // Add view deactivation observer
+    AppUi()->AddViewDeactivationObserverL( this );
+
+    // Set status pane layout if switched here directly from another view,
+    // such as when using the AnyKey
+    StatusPane()->MakeVisible(ETrue);
+    if ( StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_USUAL )
+        {
+        StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+        }
+
+    if ( !iContainer )
+        {
+        iContainer = CMPXPodcastCollectionViewContainer::NewL(this, this);
+        }
+    CCoeControl* coeControl = iContainer->Common()->CoeControl();
+    coeControl->SetMopParent( this );
+    AppUi()->AddToStackL( *this, coeControl );
+    coeControl->SetRect( ClientRect() );
+    iContainer->Common()->SetLbxEmptyTextL(KNullDesC);
+    iContainer->Common()->ActivateContainerL();
+
+	// media is not valid until the first HandleOpenL call
+    CEikButtonGroupContainer* cba = Cba();
+    if ( cba )
+        {
+#ifdef __ENABLE_PODCAST_IN_MUSIC_MENU
+        cba->SetCommandSetL( R_MPX_OPTIONS_BACK_CBA_NO_ACTION );
+#else
+        cba->SetCommandSetL(
+            ( iViewUtility->ViewHistoryDepth() == 1 ) ?
+            R_MPX_OPTIONS_EXIT_CBA_NO_ACTION : R_MPX_OPTIONS_BACK_CBA_NO_ACTION );
+#endif
+        cba->DrawDeferred();
+        }
+
+    UpdateTitlePaneL();
+    UpdateNaviPaneL();
+
+    CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+    CleanupStack::PushL(cpath);
+    if (iViewUtility->PreviousViewType().iUid == KMPXPluginTypePlaybackUid)
+        {
+        // return back from playback view and in episodes level,
+        // highlight the new playing song
+        MMPXSource* source = iPlaybackUtility->Source();
+
+        if (source)
+            {
+            CMPXCollectionPlaylist* playlist = source->PlaylistL();
+            if (playlist)
+                {
+                CleanupStack::PushL(playlist);
+                CMPXCollectionPath* plPath =
+                    CMPXCollectionPath::NewL(playlist->Path());
+                CleanupStack::PushL(plPath);
+
+                // Going from NPV -> Collection, same collection level
+                if(plPath->Levels()  == cpath->Levels())
+                    {
+                    iPossibleJump = ETrue;
+                    }
+                CleanupStack::PopAndDestroy(plPath);
+                CleanupStack::PopAndDestroy(playlist);
+                }
+            }
+
+        if (cpath->Levels() > 1)
+            {
+            // valid path in collection
+            cpath->Back();
+            RArray<TMPXAttribute> attrs;
+            CleanupClosePushL(attrs);
+            iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo;
+
+            // don't ask for the title if jumping back to the
+            // main podcast menu, since the default title
+            // will be used
+            if(cpath->Levels() == 1)
+                {
+                attrs.Append(KMPXMediaGeneralDuration);
+                }
+            else
+                {
+                attrs.Append(
+                    TMPXAttribute(KMPXMediaIdGeneral,
+                        EMPXMediaGeneralTitle |
+                        EMPXMediaGeneralDuration));
+                }
+
+            iCollectionUtility->Collection().MediaL(*cpath, attrs.Array());
+            CleanupStack::PopAndDestroy(&attrs);
+            iCollectionUtility->Collection().OpenL();
+            }
+        else
+            {
+            TUid defaultView = iViewUtility->DefaultViewUid();
+            if (defaultView != KNullUid)
+                {
+                MPX_DEBUG2("CMPXCollectionViewImp::DoActivateL() Activating default view 0x%x", defaultView.iUid);
+                iViewUtility->ActivateViewL(defaultView);
+                }
+            else
+                {
+                MPX_DEBUG1("CMPXCollectionViewImp::DoActivateL() Activating main view");
+                iViewUtility->ActivateViewL(TUid::Uid(KMPXPluginTypeMainUid));
+                }
+            }
+        }
+    else
+        {
+        cpath->Back();
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        iCurrentMediaLOp = EMPXOpMediaLGetContainerInfo;
+        attrs.Append(KMPXMediaGeneralDuration);
+        attrs.Append(
+            TMPXAttribute(KMPXMediaIdPodcast,
+                EMPXMediaPodcastType |
+                EMPXMediaPodcastCategoryGroup));
+        iCollectionUtility->Collection().MediaL(*cpath, attrs.Array());
+        CleanupStack::PopAndDestroy(&attrs);
+        iCollectionUtility->Collection().OpenL();
+        }
+    CleanupStack::PopAndDestroy(cpath);
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// View deactivation function.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::DoDeactivate()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::DoDeactivate");
+    if (iContainer)
+        {
+        AppUi()->RemoveFromStack( iContainer->Common()->CoeControl() );
+        delete iContainer;
+        iContainer = NULL;
+        }
+
+    if (iNumEpisode)
+        {
+        delete iNumEpisode;
+        iNumEpisode = NULL;
+        TRAP_IGNORE(UpdateNaviPaneL());
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Foreground event handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleForegroundEventL(TBool aForeground)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::HandleForegroundEventL");
+    CAknView::HandleForegroundEventL(aForeground);
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::DynInitMenuPaneL");
+
+    // check number of items on the list
+    TInt count = iContainer->Common()->TotalListItemCount();
+    MPX_DEBUG2("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() %d items on list", count);
+
+    TInt currentItem( iContainer->Common()->CurrentLbxItemIndex() );
+    TBool isListEmpty( currentItem < 0 );
+
+    // check number of marked items on the list
+    TInt marked = iContainer->Common()->CurrentSelectionIndicesL()->Count();
+    MPX_DEBUG2("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() %d items marked", marked);
+
+    TInt usbUnblockingStatus;
+    RProperty::Get( KMPXViewPSUid,
+                    KMPXUSBUnblockingPSStatus, 
+                    usbUnblockingStatus);
+
+    switch (aResourceId)
+        {
+        case R_MPX_PODCAST_COLLECTION_VIEW_PODCAST_MENU:
+            {
+            if ( !iPlaybackUtility->Source() )
+                {
+                aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
+                }
+            // Dim "Go to Podcasting" if Podcasting App is not installed on device
+            if (CheckPodcastAppL() == KErrNotFound)
+                {
+                // Not displayed if Podcasting App is not installed
+                aMenuPane->SetItemDimmed(EMPXCmdPodcasting, ETrue);
+                }
+
+            aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden );
+            break;
+            }
+        case R_MPX_PODCAST_COLLECTION_VIEW_MENU_1:
+            {
+            aMenuPane->SetItemDimmed(EMPXCmdFind, ETrue);
+            if ( !iPlaybackUtility->Source() )
+                {
+                aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
+                }
+            if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive)
+                {
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Delete");
+                aMenuPane->SetItemDimmed(EMPXCmdDelete, ETrue);               
+                }
+            // Delete is displayed only if list is not empty
+            if (count == 0 || isListEmpty)
+                {
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Delete");
+                aMenuPane->SetItemDimmed(EMPXCmdDelete, ETrue);
+                // UPNP options will be displayed if list is not empty
+                aMenuPane->SetItemDimmed(EMPXCmdUpnpPlayVia, ETrue);
+                aMenuPane->SetItemDimmed(EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue);
+                }
+            else
+                {
+//#ifdef __UPNP_FRAMEWORK_2_0_
+                if ( iUpnpFrameworkSupport )
+                    {
+                    HandleDynInitUpnpL(aResourceId, *aMenuPane);
+                    }
+                else
+                    {
+                    aMenuPane->SetItemDimmed(EMPXCmdUpnpPlayVia, ETrue);
+                    aMenuPane->SetItemDimmed(EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue);
+                    }
+//#endif //__UPNP_FRAMEWORK_2_0_
+                }
+
+            // Dim "Go to Podcasting" if Podcasting App is not installed on device
+            if (CheckPodcastAppL() == KErrNotFound)
+                {
+                // Not displayed if Podcasting App is not installed
+                aMenuPane->SetItemDimmed(EMPXCmdPodcasting, ETrue);
+                }
+            aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden );
+            break;
+            }
+        case R_MPX_PODCAST_COLLECTION_VIEW_MENU_2:
+            {
+            aMenuPane->SetItemDimmed(EMPXCmdFind, ETrue);
+            if ( !iPlaybackUtility->Source() )
+                {
+                aMenuPane->SetItemDimmed( EMPXCmdGoToNowPlaying, ETrue );
+                }
+#ifdef __ENABLE_MSK
+            // multiple selection in episodes view
+            if (marked && iShowContextMenu)
+                {
+                MenuBar()->SetMenuType(CEikMenuBar::EMenuContext);
+                iShowContextMenu = EFalse;
+                }
+            else
+                {
+                MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions);
+                }
+#endif //__ENABLE_MSK
+                       
+            if (usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive)
+                {
+                aMenuPane->SetItemDimmed(EMPXCmdDelete, ETrue);
+                aMenuPane->SetItemDimmed(EMPXCmdSetPlayed, ETrue);	
+                aMenuPane->SetItemDimmed(EMPXCmdSetUnplayed, ETrue);
+                }
+
+            // Delete is not displayed if list is empty
+            // Mark/Unmark is not displayed if list is empty
+            if ( count == 0 || isListEmpty)
+                {
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Send");
+                aMenuPane->SetItemDimmed(EMPXCmdSend, ETrue);
+
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Delete");
+                aMenuPane->SetItemDimmed(EMPXCmdDelete, ETrue);
+
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Set to played");
+                aMenuPane->SetItemDimmed(EMPXCmdSetPlayed, ETrue);
+
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Set to unplayed");
+                aMenuPane->SetItemDimmed(EMPXCmdSetUnplayed, ETrue);
+
+                // UPNP options will be displayed if list is not empty
+                aMenuPane->SetItemDimmed(EMPXCmdUpnpPlayVia, ETrue);
+                aMenuPane->SetItemDimmed(EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue);
+                }
+            else
+                {
+//#ifdef __UPNP_FRAMEWORK_2_0_
+                if ( iUpnpFrameworkSupport )
+                    {
+                    HandleDynInitUpnpL(aResourceId, *aMenuPane);
+                    }
+                else
+                    {
+                    aMenuPane->SetItemDimmed(EMPXCmdUpnpPlayVia, ETrue);
+                    aMenuPane->SetItemDimmed(EMPXCmdUPnPAiwCmdCopyToExternalCriteria, ETrue);
+                    }
+//#endif //__UPNP_FRAMEWORK_2_0_
+
+                TInt completePlayed = 0;
+                // check episode state: New, partially played or completely played
+                CMPXCommonListBoxArrayBase* baseArray =
+                    iContainer->Common()->ListBoxArray();
+                CMPXPodcastCollectionViewListBoxArray* array =
+                    static_cast<CMPXPodcastCollectionViewListBoxArray*>(baseArray);
+                TInt currentItem = iContainer->Common()->CurrentLbxItemIndex();
+                const CMPXMedia& media = array->MediaL(currentItem);
+                TUint32 playCount = 0;
+
+                if (media.IsSupported(KMPXMediaGeneralPlayCount))
+                    {
+                    playCount =
+                        media.ValueTObjectL<TUint32>(KMPXMediaGeneralPlayCount);
+                    }
+
+                MPX_DEBUG2("CMPXCollectionViewImp::DynInitMenuPaneL item PlayCount = %d", playCount);
+
+                // playback engine increments the playcount after a song has finished playing
+                if (playCount >= 1)
+                    {
+                    completePlayed = 1;
+                    MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() item is completely played");
+                    }
+
+                // Set to played.
+                // If marking is off, only displayed if podcast is New Podcast or
+                // Partially Played states.
+                if (!marked && completePlayed)
+                    {
+                    MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Set to played");
+                    aMenuPane->SetItemDimmed(EMPXCmdSetPlayed, ETrue);
+                    }
+
+                // Set to unplayed.
+                // If marking is off, only displayed if podcast is Completely
+                // Played states.
+                if (!marked && !completePlayed)
+                    {
+                    MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Set to unplayed");
+                    aMenuPane->SetItemDimmed(EMPXCmdSetUnplayed, ETrue);
+                    }
+                aMenuPane->SetItemDimmed(EMPXCmdSend, SendOptionVisibilityL());
+                TBool isInvalid = array->IsItemBrokenLinkL(currentItem);
+                TBool isCorrupted = array->IsItemCorruptedL(currentItem);
+                if (isInvalid || isCorrupted)
+                    {
+                    aMenuPane->SetItemDimmed(EMPXCmdSetUnplayed, ETrue);
+                    aMenuPane->SetItemDimmed(EMPXCmdSetPlayed, ETrue);
+                    }
+                }
+            break;
+            }
+        case R_AVKON_MENUPANE_MARKABLE_LIST:
+            {
+            // Mark/Unmark submenu is displayed only if list is not empty
+            if (count == 0 ||
+                usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive ||
+                isListEmpty)
+                {
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Mark/Unmark submenu");
+                aMenuPane->SetItemDimmed(EAknCmdEditListMenu, ETrue);
+                }
+            break;
+            }
+        case R_MPX_PODCAST_COLLECTION_VIEW_MENU_3:
+            {
+            CMPXCommonListBoxArrayBase* baseArray =
+                iContainer->Common()->ListBoxArray();
+            CMPXPodcastCollectionViewListBoxArray* array =
+                static_cast<CMPXPodcastCollectionViewListBoxArray*>(baseArray);
+            TInt currentItem = iContainer->Common()->CurrentLbxItemIndex();
+
+            // Episode details is not displayed if list is empty.
+            // Not displayed if marking is on.
+            // TODO: Not displayed if item in active focus is tagged as unavailable
+            // or corrupt.
+            if(isListEmpty)
+                {
+                aMenuPane->SetItemDimmed( EMPXCmdEpisodeDetails,
+                    ETrue);
+                }
+            else if (count == 0 || marked )
+                {
+                MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() dimmed Episode details");
+                aMenuPane->SetItemDimmed( EMPXCmdEpisodeDetails,
+                    FileDetailsOptionVisibilityL() );
+                }
+            else
+                {
+                TBool isInvalid = array->IsItemBrokenLinkL(currentItem);
+                TBool isCorrupted = array->IsItemCorruptedL(currentItem);
+                if (isInvalid || isCorrupted)
+                    {
+                    aMenuPane->SetItemDimmed( EMPXCmdEpisodeDetails,
+                        ETrue);
+                    }
+                else
+                    {
+                    aMenuPane->SetItemDimmed( EMPXCmdEpisodeDetails,
+                        FileDetailsOptionVisibilityL() );
+                    }
+                }
+
+            // Dim "Go to Podcasting" if Podcasting App is not installed on device
+            if (CheckPodcastAppL() == KErrNotFound)
+                {
+                // Not displayed if Podcasting App is not installed
+                aMenuPane->SetItemDimmed(EMPXCmdPodcasting, ETrue);
+                }
+
+            aMenuPane->SetItemDimmed( EAknCmdExit, iExitOptionHidden );
+
+            break;
+            }
+//#ifdef __UPNP_FRAMEWORK_2_0_
+        case R_MPX_PODCAST_COLLECTION_PLAY_VIA_SUB_MENU:
+            {
+            if ( iUpnpFrameworkSupport )
+                {
+                AddPlayersNamesToMenuL( *aMenuPane );
+                }
+            break;
+            }
+//#endif //__UPNP_FRAMEWORK_2_0_
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+
+    if (!(aResourceId == R_AVKON_MENUPANE_MARKABLE_LIST && usbUnblockingStatus == EMPXUSBUnblockingPSStatusActive))
+        {
+        // Custom handling of menu pane for markable lists
+        iContainer->Common()->HandleMarkableListDynInitMenuPane(
+            aResourceId,
+            aMenuPane );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikListBoxObserver
+// Handles listbox events.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleListBoxEventL(
+    CEikListBox* /*aListBox*/,
+    TListBoxEvent aEventType)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::HandleListBoxEventL");
+    MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleListBoxEventL iLastDepth = %d", iLastDepth);
+    MPX_PERF_CHECKPT("Select collection item to open");
+
+    //handle this thouch screen event to tell to engine the index of selected song
+	//to keep/change focus on right song in rename/remove
+#ifdef SINGLE_CLICK_INCLUDED
+    if ( aEventType == EEventItemSingleClicked )
+#else
+	if ( aEventType == EEventItemClicked )
+#endif
+		{
+		if ( !iHandlingKeyEvent )
+			{
+			CMPXCommonListBoxArrayBase* listboxArray( iContainer->Common()->ListBoxArray() );
+			TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() );
+
+			CMPXCommand* command = CMPXCommand::NewL();
+			CleanupStack::PushL( command );
+			command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId,
+													  KMPXCommandIdCollectionSelect );
+			command->SetTObjectValueL( KMPXCommandCollectionSelectIndex, currentIndex );
+			command->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+			iCollectionUtility->Collection().CommandL( *command );
+			CleanupStack::PopAndDestroy( command );
+			}
+		}
+
+    if (aEventType == EEventEnterKeyPressed|| aEventType == EEventItemDoubleClicked
+#ifdef SINGLE_CLICK_INCLUDED
+        || aEventType == EEventItemSingleClicked            
+#endif
+        )
+        {
+        if (!iHandlingKeyEvent)
+            {
+            TMPXPlaybackState pbState( iPlaybackUtility->StateL() );
+            TBool isEqual( EFalse );
+            if ( pbState == EPbStatePlaying || pbState == EPbStatePaused )
+                {
+                // in currently playing view, check if current item is playing
+                if ( iContainer->Common()->CurrentLbxItemIndex() ==
+                    iContainer->PlaybackIndex() )
+                    {
+                    isEqual = ETrue;
+                    }
+                }
+
+            if ( isEqual )
+                {
+                MPX_DEBUG1( "CMPXPodcastCollectionViewImp::HandleListBoxEventL going to now playing view" );
+                if ( pbState == EPbStatePaused )
+                    {
+                    MPX_DEBUG1( "CMPXPodcastCollectionViewImp::HandleListBoxEventL resuming playback" );
+                    iPlaybackUtility->CommandL( EPbCmdPlay );
+                    }
+                HandleCommandL( EMPXCmdGoToNowPlaying );
+                }
+            else
+                {
+                CMPXCommonListBoxArrayBase* listboxArray =
+                    iContainer->Common()->ListBoxArray();
+                TInt currentItem = iContainer->Common()->CurrentLbxItemIndex();
+                const CMPXMedia& containerMedia = listboxArray->ContainerMedia();
+
+                CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+                CleanupStack::PushL(cpath);
+
+                MPX_DEBUG_PATH(*cpath);
+                if (cpath->Levels() == (iLastDepth + 1))
+                    {
+                    // navigated in one level
+                    iLastDepth++;
+                    iBottomIndex->AppendL(
+                        iContainer->Common()->BottomLbxItemIndex());
+                    }
+                else
+                    {
+                    // invalid path, rebuild with all 0
+                    iBottomIndex->Reset();
+                    iLastDepth = cpath->Levels();
+                    for (TInt i = 0; i < iLastDepth; i++)
+                        {
+                        iBottomIndex->AppendL(0);
+                        }
+                    }
+                CleanupStack::PopAndDestroy(cpath);
+
+                MPX_DEBUG2("CMPXPodcastCollectionViewImp::HandleListBoxEventL Opening Item: %d", currentItem);
+                iHandlingKeyEvent = ETrue;
+
+                // Needed to reset the status of iPreservedState
+                if ( EPbStateStopped == iPlaybackUtility->StateL() )
+                    {
+                    iPlaybackUtility->CommandL(EPbCmdResetPreserveState);
+                    }
+
+                RArray<TMPXAttribute> attrs;
+                CleanupClosePushL(attrs);
+
+                iCollectionUtility->Collection().OpenL(currentItem,
+                                                       attrs.Array(),
+                                                       EMPXOpenDefault);
+
+                CleanupStack::PopAndDestroy(&attrs);
+
+                }
+            }
+        else
+            {
+            MPX_DEBUG1("CMPXPodcastCollectionViewImp::HandleListBoxEventL Busy, ignoring command");
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikCommandObserver
+// Processes user commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::ProcessCommandL(TInt aCommandId)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::ProcessCommandL");
+
+    switch(aCommandId)
+        {
+        case EMPXCmdUpArrow:
+        case EMPXCmdDownArrow:
+            {
+#ifdef __COVER_DISPLAY                         	
+            iIgnoreNextFocusChangedMessage = ETrue;
+#endif                        
+            break;
+            }
+        case EMPXCmdCommonDelete:
+            {
+            CMPXCollectionPath* cpath = iCollectionUtility->Collection().PathL();
+	        CleanupStack::PushL(cpath);
+	        TInt depth = cpath->Levels();
+#ifndef __HG_COLLECTIONVIEW
+	        if(depth > 2) // 'C' key is invalid within the main Podcast Collection
+	                      // View menu
+#endif // __HG_COLLECTIONVIEW
+	            {
+	            StoreListboxItemIndexL();
+            	DeleteSelectedItemsL();
+            	}
+            CleanupStack::PopAndDestroy(cpath);
+            break;
+            }
+        case EMPXCmdCommonResourceChange:
+            {
+            iContainer->Common()->CoeControl()->SetRect( ClientRect() );
+            break;
+            }
+        case EAknSoftkeyEmpty:
+            {
+            // do nothing.  handled to avoid "unsupported" message
+            break;
+            }
+        case EMPXCmdCommonEnterKey:
+            {
+            // Handle list box event for enter key pressed
+            TInt currentItem = iContainer->Common()->CurrentLbxItemIndex();
+            if( currentItem >= 0 )
+                {
+                HandleListBoxEventL(
+                    NULL, // ignore
+                    EEventEnterKeyPressed );
+                }
+            break;
+            }
+#ifdef __ENABLE_MSK
+        case EMPXCmdCommonUpdateMiddleSoftKey:
+            {
+            // Determine middle soft key labeling
+            UpdateMiddleSoftKeyDisplayL(iCurrentMskId);
+            break;
+            }
+        case EAknSoftkeyContextOptions :
+            {
+            // set context menu flag
+            iShowContextMenu = ETrue;
+            // open context menu (by processing "Options" command)
+            CAknView::ProcessCommandL(EAknSoftkeyOptions);
+            break;
+            }
+#endif // __ENABLE_MSK
+		case EAknCmdExit:
+			{
+			HandleCommandL( aCommandId );
+			}
+        default:
+            {
+            CAknView::ProcessCommandL(aCommandId);
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCollectionViewImp::HandleFindAllL
+// Handle callback for "find" operation
+// -----------------------------------------------------------------------------
+//
+//#ifdef __UPNP_FRAMEWORK_2_0_
+void CMPXPodcastCollectionViewImp::HandleFindAllL(
+    const CMPXMedia& aResults,
+    TBool aComplete,
+    TInt aError)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::HandleFindAllL");
+    if (aError == KErrNone)
+        {
+        switch (iCurrentFindAllLOp)
+            {
+//#ifdef __UPNP_FRAMEWORK_2_0_
+            case EMPXOpFindAllLUpnp:
+                {
+                if ( iUpnpFrameworkSupport )
+                    {
+                    DoHandleCopyToRemoteL( aResults, aComplete );
+                    }
+                break;
+                }
+//#endif //__UPNP_FRAMEWORK_2_0_
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else
+        {
+        HandleErrorL(aError);
+        }
+    iCurrentFindAllLOp = EMPXOpFindAllLIdle;
+
+//#ifndef __UPNP_FRAMEWORK_2_0_
+    if ( !iUpnpFrameworkSupport )
+        {
+        // Remove compilation warnings
+        (void)aComplete;
+        }
+//#endif  //__UPNP_FRAMEWORK_2_0_
+    }
+
+// ---------------------------------------------------------------------------
+// Check presence of Nokia Podcasting Application.
+// ---------------------------------------------------------------------------
+//
+TInt CMPXPodcastCollectionViewImp::CheckPodcastAppL()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::CheckPodcastAppL");
+
+    TApaAppInfo appInfo;
+    RApaLsSession session;
+    User::LeaveIfError( session.Connect() );
+    CleanupClosePushL(session);
+    // Check Nokia Podcasting Application
+    TInt err = session.GetAppInfo(appInfo, KNPodAppUid);
+    CleanupStack::PopAndDestroy(); // Close RApaLsSession session
+    if (err == KErrNone)
+        {
+        MPX_DEBUG2("CMPXPodcastCollectionViewImp::CheckPodcastAppL() found %S", &appInfo.iFullName);
+        }
+    else if (err == KErrNotFound)
+        {
+        MPX_DEBUG1("CMPXPodcastCollectionViewImp::CheckPodcastAppL() Podcast app does not exist");
+        }
+    // else ignore
+
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Launch Nokia Podcasting Application.
+// ---------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::LaunchPodcastAppL()
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::LaunchPodcastAppL");
+    TApaTaskList tasList(iEikonEnv->WsSession());
+    TApaTask task = tasList.FindApp(KNPodAppUid);
+
+    // The check for whether task exists or not is not needed. The reason is that when
+    // process.create() is called, CAknApplicaiton class will first check if an instance of the
+    // applicaiton is present. If an instance is present, it will invoke/activate the
+    // existing application and then exit.
+
+    //if (task.Exists())
+    //    {
+    //    MPX_DEBUG1("CMPXPodcastCollectionViewImp::DynInitMenuPaneL() Podcast app exist");
+        // Bring Podcast App to foreground
+    //    task.BringToForeground();
+    //    }
+    //else
+    //    {
+
+        // Launch Nokia Podcasting Application
+        TApaAppInfo appInfo;
+        RApaLsSession session;
+        User::LeaveIfError( session.Connect() );
+        CleanupClosePushL(session);
+        TInt err = session.GetAppInfo(appInfo, KNPodAppUid);
+        if (err == KErrNone)
+            {
+            MPX_TRAP(err,
+            {
+            CApaCommandLine* commandLine = CApaCommandLine::NewLC();
+            commandLine->SetDocumentNameL(KNullDesC);
+            commandLine->SetExecutableNameL(appInfo.iFullName);
+            session.StartApp(*commandLine);
+            CleanupStack::PopAndDestroy();
+            });
+            }
+        CleanupStack::PopAndDestroy(); // Close RApaLsSession session
+    //    }
+    }
+
+// ---------------------------------------------------------------------------
+// Helper method that checks to see if the specified item is currently playing
+// ---------------------------------------------------------------------------
+//
+TBool CMPXPodcastCollectionViewImp::IsCurrentlyPlayingL(const TMPXItemId& aItem)
+    {
+    MPX_FUNC("CMPXPodcastCollectionViewImp::IsCurrentlyPlaying");
+
+    TBool currentlyPlaying(EFalse);
+
+    if ( (iPlaybackUtility->StateL() == EPbStatePlaying ||
+          iPlaybackUtility->StateL() == EPbStatePaused) &&
+          iContainer )
+        {
+        MMPXSource* source( iPlaybackUtility->Source() );
+        if ( source )
+            {
+            CMPXCollectionPlaylist* playlist( source->PlaylistL() );
+            if ( playlist )
+                {
+                CleanupStack::PushL( playlist );
+                CMPXCollectionPath* pbPath(
+                    CMPXCollectionPath::NewL( playlist->Path() ) );
+                CleanupStack::PushL( pbPath );
+
+                if (aItem == pbPath->IdOfIndex( playlist->Index() ) )
+                    {
+                    currentlyPlaying =  ETrue;
+                    }
+                CleanupStack::PopAndDestroy( pbPath );
+                CleanupStack::PopAndDestroy( playlist );
+                }
+            }
+        }
+    return currentlyPlaying;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::HandleViewActivation
+// Handle view activation
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleViewActivation(
+    const TUid& aCurrentViewType,
+    const TUid& /*aPreviousViewType*/ )
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewImp::HandleViewActivation" );
+    if ( aCurrentViewType.iUid == KMPXPluginTypeCollectionUid )
+        {
+        TRAP_IGNORE( UpdateNaviPaneL() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::HandleViewActivation
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleViewActivation(
+    const TVwsViewId& aNewlyActivatedViewId,
+    const TVwsViewId& /*aViewIdToBeDeactivated */)
+    {
+    if( aNewlyActivatedViewId.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) &&
+        aNewlyActivatedViewId.iViewUid == Id() )
+        {
+        TRAP_IGNORE( UpdateNaviPaneL() );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::HandleViewDeactivation
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::HandleViewDeactivation(const TVwsViewId& aViewIdToBeDeactivated,
+	                                               const TVwsViewId& /*aNewlyActivatedViewId*/)
+    {
+    if( aViewIdToBeDeactivated.iAppUid == TUid::Uid(KMusicPlayerAppUidConstant) &&
+        aViewIdToBeDeactivated.iViewUid == Id() )
+        {
+        if( iContainer )
+            {
+            if ( iNaviPane && iNaviDecorator )
+                {
+                iNaviPane->Pop( iNaviDecorator );
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::SetPlayedStatusL
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::SetPlayedStatusL( TBool aPlayed )
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewImp::SetPlayedStatus" );
+
+    const CArrayFix<TInt>* array =
+        iContainer->Common()->CurrentSelectionIndicesL();
+    TInt arrayCount = array->Count();
+
+    CMPXCommonListBoxArrayBase* listboxArray =
+        iContainer->Common()->ListBoxArray();
+
+    TMPXGeneralType type = EMPXNoType;
+    TMPXGeneralCategory category = EMPXNoCategory;
+
+    if (arrayCount > 0)
+        {
+        CMPXMediaArray* setArray( CMPXMediaArray::NewL() );
+        CleanupStack::PushL( setArray );
+
+        // playback needs to be stopped only once
+        TBool checkIfPlaying(ETrue);
+
+        // iterate through and toggle the episode state for each selection
+        for (TInt i = 0; i < arrayCount; i++)
+            {
+            /*CMPXPodcastCollectionViewListBoxArray* podcastArray =
+                static_cast<CMPXPodcastCollectionViewListBoxArray*>(listboxArray);
+            TBool isInvalid = podcastArray->IsItemBrokenLinkL(array->At(i));
+            TBool isCorrupted = podcastArray->IsItemCorruptedL(array->At(i));
+
+            if ( !isInvalid && !isCorrupted )
+                {*/
+            CMPXMedia* currentSelectedMedia =
+                CMPXMedia::NewL(listboxArray->MediaL(array->At(i)));
+            CleanupStack::PushL(currentSelectedMedia);
+
+            if (currentSelectedMedia->IsSupported(KMPXMediaGeneralType))
+                {
+                type =
+                    currentSelectedMedia->ValueTObjectL<TMPXGeneralType>(
+                    KMPXMediaGeneralType);
+                }
+            if (currentSelectedMedia->IsSupported(KMPXMediaGeneralCategory))
+                {
+                category =
+                    currentSelectedMedia->ValueTObjectL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory);
+                }
+
+            if (( type == EMPXItem ) && ( category == EMPXPodcast ))
+                {
+                TUint32 playCount = aPlayed;
+                TInt lastPlayPos = 0;
+
+                if ( checkIfPlaying &&
+                     currentSelectedMedia->IsSupported(KMPXMediaGeneralId) &&
+                     IsCurrentlyPlayingL(
+                        currentSelectedMedia->ValueTObjectL<TMPXItemId>(
+                            KMPXMediaGeneralId)))
+                    {
+                    iPlaybackUtility->CommandL(EPbCmdStop);
+                    checkIfPlaying = EFalse;
+
+                    // save off a copy of the media so Set can
+                    // be run after EPbCmdStop returns
+                    if(iMediaToSet)
+                        {
+                        delete iMediaToSet;
+                        iMediaToSet = NULL;
+                        }
+
+                    iMediaToSet = CMPXMedia::NewL();
+                    iMediaToSet->SetTObjectValueL( KMPXMediaGeneralType,
+                    	EMPXItem );
+                    iMediaToSet->SetTObjectValueL( KMPXMediaGeneralCategory,
+                    	EMPXPodcast);
+                    iMediaToSet->SetTObjectValueL( KMPXMediaGeneralCollectionId,
+                        currentSelectedMedia->ValueTObjectL<TUid>(
+                            KMPXMediaGeneralCollectionId));
+                    iMediaToSet->SetTObjectValueL( KMPXMediaGeneralId,
+                        currentSelectedMedia->ValueTObjectL<TMPXItemId>(
+                            KMPXMediaGeneralId));
+
+                    iMediaToSet->SetTObjectValueL<TUint32> (
+                        KMPXMediaGeneralPlayCount, playCount);
+                    iMediaToSet->SetTObjectValueL (
+                        KMPXMediaGeneralLastPlaybackPosition, lastPlayPos);
+                    iMediaToSet->SetTObjectValueL<TBool> (
+                        KMPXMediaPodcastIsPlaying, EFalse);
+                    }
+                else
+                    {
+                    currentSelectedMedia->SetTObjectValueL<TUint32> (
+                        KMPXMediaGeneralPlayCount, playCount);
+                    currentSelectedMedia->SetTObjectValueL (
+                        KMPXMediaGeneralLastPlaybackPosition, lastPlayPos);
+                    currentSelectedMedia->SetTObjectValueL<TBool> (
+                        KMPXMediaPodcastIsPlaying, EFalse);
+
+                    setArray->AppendL( *currentSelectedMedia );
+                    //DoSetCollectionL( currentSelectedMedia, ETrue );
+                    }
+                }
+
+            CleanupStack::PopAndDestroy(currentSelectedMedia);
+                /*}*/
+            }
+
+        if( setArray->Count() > 0 )
+            {
+            CMPXMedia* groupMedia( CMPXMedia::NewL() );
+            CleanupStack::PushL( groupMedia );
+            groupMedia->SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup);
+            groupMedia->SetCObjectValueL<CMPXMediaArray>(KMPXMediaArrayContents, setArray );
+            CMPXMedia* first( setArray->AtL( 0 ) );
+            TUid colId( first->ValueTObjectL<TUid>(KMPXMediaGeneralCollectionId) );
+            groupMedia->SetTObjectValueL<TUid>( KMPXMediaGeneralCollectionId, colId );
+            DoSetCollectionL( groupMedia, EFalse );
+            CleanupStack::PopAndDestroy( groupMedia );
+            }
+        CleanupStack::PopAndDestroy( setArray );
+        }
+    else
+        {
+        TInt currentIndex = iContainer->Common()->CurrentLbxItemIndex();
+        CMPXMedia* currentSelectedMedia =
+            CMPXMedia::NewL(listboxArray->MediaL(currentIndex));
+        CleanupStack::PushL(currentSelectedMedia);
+
+        if (currentSelectedMedia->IsSupported(KMPXMediaGeneralType))
+            {
+            type =
+                currentSelectedMedia->ValueTObjectL<TMPXGeneralType>(
+                    KMPXMediaGeneralType);
+            }
+        if (currentSelectedMedia->IsSupported(KMPXMediaGeneralCategory))
+            {
+            category =
+                currentSelectedMedia->ValueTObjectL<TMPXGeneralCategory>(
+                    KMPXMediaGeneralCategory);
+            }
+
+        if ((type == EMPXItem) && (category == EMPXPodcast))
+            {
+            TUint32 playCount = aPlayed;
+            TInt lastPlayPos = 0;
+
+            if ( currentSelectedMedia->IsSupported(KMPXMediaGeneralId) &&
+                 IsCurrentlyPlayingL(
+                    currentSelectedMedia->ValueTObjectL<TMPXItemId>(
+                        KMPXMediaGeneralId)) )
+                {
+                iPlaybackUtility->CommandL(EPbCmdStop);
+
+                // save off a copy of the media so Set can
+                // be run after EPbCmdStop returns
+                if(iMediaToSet)
+                    {
+                    delete iMediaToSet;
+                    iMediaToSet = NULL;
+                    }
+
+                iMediaToSet = CMPXMedia::NewL();
+                iMediaToSet->SetTObjectValueL( KMPXMediaGeneralType,
+					EMPXItem );
+                iMediaToSet->SetTObjectValueL( KMPXMediaGeneralCategory,
+                	EMPXPodcast);
+                iMediaToSet->SetTObjectValueL( KMPXMediaGeneralCollectionId,
+                    currentSelectedMedia->ValueTObjectL<TUid>(
+                        KMPXMediaGeneralCollectionId));
+                iMediaToSet->SetTObjectValueL( KMPXMediaGeneralId,
+                    currentSelectedMedia->ValueTObjectL<TMPXItemId>(
+                        KMPXMediaGeneralId));
+
+                iMediaToSet->SetTObjectValueL<TUint32> (
+                    KMPXMediaGeneralPlayCount, playCount);
+                iMediaToSet->SetTObjectValueL (
+                    KMPXMediaGeneralLastPlaybackPosition, lastPlayPos);
+                iMediaToSet->SetTObjectValueL<TBool> (
+                    KMPXMediaPodcastIsPlaying, EFalse);
+                }
+            else
+                {
+                currentSelectedMedia->SetTObjectValueL<TUint32> (
+                    KMPXMediaGeneralPlayCount, playCount);
+                currentSelectedMedia->SetTObjectValueL (
+                    KMPXMediaGeneralLastPlaybackPosition, lastPlayPos);
+                currentSelectedMedia->SetTObjectValueL<TBool> (
+                    KMPXMediaPodcastIsPlaying, EFalse);
+
+                DoSetCollectionL( currentSelectedMedia, EFalse );
+                }
+            }
+        CleanupStack::PopAndDestroy(currentSelectedMedia);
+        }
+
+    // Clear selection
+    if(iContainer)
+        {
+        iContainer->Common()->ClearLbxSelection();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPodcastCollectionViewImp::StoreListboxItemIndexL
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewImp::StoreListboxItemIndexL()
+	{
+    TInt currentIndex( iContainer->Common()->CurrentLbxItemIndex() );
+
+	CMPXCommand* command = CMPXCommand::NewL();
+	CleanupStack::PushL( command );
+	command->SetTObjectValueL<TMPXCommandId>( KMPXCommandGeneralId,
+											  KMPXCommandIdCollectionSelect );
+	command->SetTObjectValueL( KMPXCommandCollectionSelectIndex, currentIndex );
+	command->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+	iCollectionUtility->Collection().CommandL( *command );
+	CleanupStack::PopAndDestroy( command );
+	}
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/podcastview/src/mpxpodcastcollectionviewlistboxarray.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,878 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Listbox array for podcast collection view container
+*
+*/
+
+
+// INCLUDE FILES
+#include <StringLoader.h>
+#include <gulicon.h>
+#include <AknsSkinInstance.h>
+#include <AknUtils.h>
+#include <AknsUtils.h>
+#include <AknIconUtils.h>
+#include <aknconsts.h>
+#include <AknIconArray.h>
+#include <avkon.mbg>
+#include <f32file.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxmedia.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediaarray.h>
+#include <mpxlog.h>
+#include <mpxpodcastcollectionview.mbg>
+#include <mpxpodcastdefs.h> // Podcast specific
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxpodcastcollectionview.rsg>
+#include <mpxuser.h>
+#include <mpxcommonuihelper.h>
+#include "mpxcommoncontainer.hrh"
+#include "mpxpodcastcollectionview.hrh"
+#include "mpxcommonlistboxarrayobserver.h"
+#include "mpxpodcastcollectionviewlistboxarray.h"
+
+// CONSTANTS
+_LIT( KMPXCommonListboxFormatString, "%d\t%S" );
+_LIT( KMPXTab, "\t" );
+_LIT( KMPXPodcastCollectionViewIconFile, "mpxpodcastcollectionview.mbm" );
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewListBoxArray* CMPXPodcastCollectionViewListBoxArray::NewL()
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewListBoxArray::NewL" );
+    CMPXPodcastCollectionViewListBoxArray* self =
+        new ( ELeave ) CMPXPodcastCollectionViewListBoxArray();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::CMPXCommonListBoxArrayBase
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewListBoxArray::CMPXPodcastCollectionViewListBoxArray() :
+    CMPXCommonListBoxArrayBase()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+CMPXPodcastCollectionViewListBoxArray::~CMPXPodcastCollectionViewListBoxArray()
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewListBoxArray::~CMPXPodcastCollectionViewListBoxArray" );
+    }
+
+// -----------------------------------------------------------------------------
+// Destructor.
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewListBoxArray::ConstructL()
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewListBoxArray::ConstructL" );
+    iMMCDrive = CMPXCommonUiHelper::MMCDriveNumber();
+    }
+
+// ---------------------------------------------------------------------------
+// Sets playback status
+// ---------------------------------------------------------------------------
+//
+TInt CMPXPodcastCollectionViewListBoxArray::SetPlaybackStatusByIdL(
+    TMPXItemId aId, TMPXPlaybackState aStatus )
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewListBoxArray::SetPlaybackStatusById" );
+    if ( iMedia )
+        {
+        ASSERT( iMedia );
+        TInt index( KErrNotFound );
+        TInt count( iMedia->Count() );
+
+        for ( TInt i = 0; i < count; i++ )
+            {
+            CMPXMedia* entry( iMedia->AtL( i ) );
+            if( entry->IsSupported( KMPXMediaGeneralId ) )
+                {
+                TMPXItemId id(
+                    entry->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+
+                if ( id == aId )
+                    {
+                    index = i;
+                    break;
+                    }
+
+                }
+            }
+
+        return SetPlaybackStatusByIndex( index, aStatus );
+        }
+
+    return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
+// Gets the index for the song that's currently playing
+// ---------------------------------------------------------------------------
+//
+TInt CMPXPodcastCollectionViewListBoxArray::GetPlaybackIndex() const
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::GetPlaybackIndex" );
+    return iIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// Get array of indicator icon indices at the specified view index
+// Only used when using Hitchcock container.
+// -----------------------------------------------------------------------------
+//
+RArray<TInt> CMPXPodcastCollectionViewListBoxArray::IndicatorIconIndicesL(
+    TInt aIndex )
+    {
+    RArray<TInt> iconIndices;
+    TInt index( MapListBoxIndexToArrayIndex( aIndex ) );
+
+    CMPXMedia* entry( iMedia->AtL( index ) );
+
+    TMPXPodcastType type = EMPXPodcastNoType;
+    TMPXPodcastCategory category = EMPXUnknown;
+    if ( entry->IsSupported( KMPXMediaPodcastType ) )
+        {
+        type = entry->ValueTObjectL<TMPXPodcastType>( KMPXMediaPodcastType );
+        }
+    if ( entry->IsSupported( KMPXMediaPodcastCategoryGroup ) )
+        {
+        category = entry->ValueTObjectL<TMPXPodcastCategory>( KMPXMediaPodcastCategoryGroup );
+        }
+    TUint flags(0);
+    if ( entry->IsSupported( KMPXMediaGeneralFlags ) )
+        {
+        flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+        }
+
+    MPX_DEBUG4( "CMPXPodcastCollectionViewListBoxArray::IndicatorIconIndicesL (%d) Type: %d, Category: %d", aIndex, type, category );
+
+
+    // playback status icon
+    if ( iIndex == index )
+        {
+        switch ( iPbState )
+            {
+            case EPbStatePlaying:
+                {
+                iconIndices.Append( EMPXPodClvIconPlay );
+                break;
+                }
+            case EPbStatePaused:
+                {
+                iconIndices.Append( EMPXPodClvIconPause );
+                break;
+                }
+            default:
+                {
+                // other playback states, not handled
+                break;
+                }
+            }
+        }
+
+    if ( type == EMPXPodcastItem )
+        {
+        TBool checkFlag(ETrue);
+        switch( category )
+            {
+            case EMPXEpisode:
+                {
+                iconIndices.Append( EMPXPodClvIconEpisode );
+                break;
+                }
+            case EMPXNew:
+                {
+                if ( entry->IsSupported(KMPXMediaPodcastIsPlaying) &&
+                     entry->ValueTObjectL<TBool>(KMPXMediaPodcastIsPlaying) )
+                    {
+                    iconIndices.Append( EMPXPodClvIconPartplay );
+                    }
+                else if ( iIndex == aIndex  &&
+                          (iPbState == EPbStatePlaying || iPbState == EPbStatePaused) )
+                    {
+                    entry->SetTObjectValueL<TBool>(KMPXMediaPodcastIsPlaying, ETrue);
+                    iconIndices.Append( EMPXPodClvIconPartplay );
+                    }
+                else
+                    {
+                    iconIndices.Append( EMPXPodClvIconNew );
+                    }
+
+                break;
+                }
+            case EMPXPartlyPlayed:
+                {
+                iconIndices.Append( EMPXPodClvIconPartplay );
+                break;
+                }
+            case EMPXCompletelyPlayed:
+                {
+                iconIndices.Append( EMPXPodClvIconCompplay );
+                break;
+                }
+            case EMPXPodcastFile:
+                {
+                checkFlag = EFalse;
+                iconIndices.Append( EMPXPodClvIconFolder );
+                break;
+                }
+            default:
+                {
+                checkFlag = EFalse;
+                iconIndices.Append( EMPXPodClvIconUnknowFile );
+                break;
+                }
+            }
+
+            if ( checkFlag )
+                {
+                if ( flags & KMPXMediaGeneralFlagsIsCorrupted )
+                    {
+                    iconIndices.Append( EMPXPodClvIconCorrupt );
+                    }
+                else if ( flags & KMPXMediaGeneralFlagsIsInvalid )
+                    {
+                    iconIndices.Append( EMPXPodClvIconBroken );
+                    }
+                else if ( flags & KMPXMediaGeneralFlagsIsDrmLicenceInvalid )
+                    {
+                    iconIndices.Append( EMPXPodClvIconBroken );
+                    }
+                // else do nothing
+                }
+        }
+
+    TInt driveNum = ( ( flags ) & ( KMPXMediaGeneralFlagsDriveInfo ) );
+    if ( driveNum == iMMCDrive )
+        {
+        // The MMC icon is displayed in the first Indicator slot
+        iconIndices.Append( EMPXPodClvIconMMC );
+        }
+
+    return iconIndices;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::MdcaPoint
+// indexes into a descriptor array.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TPtrC CMPXPodcastCollectionViewListBoxArray::MdcaPoint( TInt aIndex ) const
+    {
+    TPtrC item( KNullDesC );
+    TRAP_IGNORE( item.Set( DoMdcaPointL( aIndex ) ) );
+    return item;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::CreateIconArrayL
+// creates icon array.
+// -----------------------------------------------------------------------------
+//
+CAknIconArray* CMPXPodcastCollectionViewListBoxArray::CreateIconArrayL()
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewListBoxArray::CreateIconArrayL" );
+    TParse mbmFileName;
+    mbmFileName.Set( KMPXPodcastCollectionViewIconFile,
+                     &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( mbmFileName.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    // Prepare icon array for listbox
+    CAknIconArray* iconArray = new ( ELeave ) CAknIconArray( 21 ); // magic: array granularity
+
+    // Update the enums when this list is updated
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMarkedAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG13,
+        KAvkonBitmapFile,
+        EMbmAvkonQgn_indi_marked_add,
+        EMbmAvkonQgn_indi_marked_add_mask);
+   AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropEmpty,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        KAvkonBitmapFile,
+        EMbmAvkonQgn_prop_empty,
+        EMbmAvkonQgn_prop_empty_mask);    
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstPdcAdded,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_added,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_added_mask );  //1
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstPdcAuto,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_auto,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_auto_mask );   //2
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstPdcCateg,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_categ,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_categ_mask );  //3
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstPdcCompplay,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_compplay,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_compplay_mask );  //4
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstPdcDate,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_date,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_date_mask );  //5
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstPdcEpisode,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_episode,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_episode_mask );  //6
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstPdcNew,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_new,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_new_mask );  //7
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstPdcNoplay,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_noplay,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_noplay_mask );  //8
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstPdcPartplay,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_partplay,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_partplay_mask );  //9
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstPdcTitle,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_title,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_pdc_title_mask );  //10
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnMenuFolderApps,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_menu_folder_apps,
+        EMbmMpxpodcastcollectionviewQgn_menu_folder_apps_mask );  //11
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnPropUnknown,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_prop_unknown,
+        EMbmMpxpodcastcollectionviewQgn_prop_unknown_mask );  //12
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupPlay,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_npv_icon_play,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_npv_icon_play_mask ); //13
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupPause,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_npv_icon_pause,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_npv_icon_pause_mask ); // 14
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupForwAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_indi_mup_forw_add,
+        EMbmMpxpodcastcollectionviewQgn_indi_mup_forw_add_mask );  // 15
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMupRewAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_indi_mup_rew_add,
+        EMbmMpxpodcastcollectionviewQgn_indi_mup_rew_add_mask ); // 16
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnIndiMmcAdd,
+        KAknsIIDQsnIconColors,
+        EAknsCIQsnIconColorsCG26,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_indi_mmc_add,
+        EMbmMpxpodcastcollectionviewQgn_indi_mmc_add_mask ); // 17
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstBrokenpodc,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_brokenpodc,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_brokenpodc_mask );  // 18
+    AppendColorIconToArrayL( iconArray,
+        KAknsIIDQgnGrafMupLstCorruptpodc,
+        KAknsIIDNone,
+        EAknsMinorNone,
+        iconFile,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_corruptpodc,
+        EMbmMpxpodcastcollectionviewQgn_graf_mup_lst_corruptpodc_mask );   // 19
+
+    return iconArray;
+    }
+
+// -----------------------------------------------------------------------------
+// Appends media array to the current array
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewListBoxArray::AppendMediaL( const CMPXMedia& aMedia )
+    {
+    MPX_FUNC( "CMPXCollectionViewListBoxArray::AppendMediaL" );
+    CMPXCommonListBoxArrayBase::AppendMediaL( aMedia );
+    if ( iMedia )
+        {
+        TInt entriesCount = iMedia->Count();
+        if ( entriesCount > 0 )
+            {
+            CMPXMedia* origMedia( iMedia->AtL( entriesCount - 1 ) );
+            if ( origMedia->ValueText(KMPXMediaGeneralTitle ).Length() == 0 )
+                {
+                HBufC* text = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_UNKNOWN_TITLE );
+                origMedia->SetTextValueL(KMPXMediaGeneralTitle,
+                    *text );
+                CleanupStack::PopAndDestroy( text );
+                }
+            }
+        }
+    if ( iContainerMedia )
+        {
+        if ( iContainerMedia->IsSupported(KMPXMediaGeneralTitle) )
+            {
+            if ( iContainerMedia->ValueText(KMPXMediaGeneralTitle).Length() == 0 )
+                {
+                HBufC* text = StringLoader::LoadLC(
+                    R_MPX_QTN_NMP_UNKNOWN_TITLE );
+                iContainerMedia->SetTextValueL(KMPXMediaGeneralTitle,
+                    *text );
+                CleanupStack::PopAndDestroy( text );
+                }
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if the current item is a broken link
+// -----------------------------------------------------------------------------
+//
+TBool CMPXPodcastCollectionViewListBoxArray::IsItemBrokenLinkL( TInt aIndex )
+    {
+    TBool ret( EFalse );
+    if ( iMedia )
+        {
+        CMPXMedia* entry( iMedia->AtL( aIndex ) );
+        TUint flags( 0 );
+        if(entry->IsSupported(KMPXMediaGeneralFlags))
+            {
+            flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+            }
+
+        ret = ( ( flags ) & ( KMPXMediaGeneralFlagsIsInvalid ) );
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// Checks if the current item is corrupted
+// -----------------------------------------------------------------------------
+//
+TBool CMPXPodcastCollectionViewListBoxArray::IsItemCorruptedL( TInt aIndex )
+    {
+    TBool ret( EFalse );
+    if ( iMedia )
+        {
+        CMPXMedia* entry( iMedia->AtL( aIndex ) );
+        TUint flags( 0 );
+        if(entry->IsSupported( KMPXMediaGeneralFlags))
+            {
+            flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+            }
+        ret = ( ( flags ) & ( KMPXMediaGeneralFlagsIsCorrupted ) );
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXCommonListBoxArrayBase::DoMdcaPointL
+// indexes into a descriptor array.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TPtrC CMPXPodcastCollectionViewListBoxArray::DoMdcaPointL( TInt aIndex ) const
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewListBoxArray::DoMdcaPointL" );
+    MPX_DEBUG3( "CMPXPodcastCollectionViewListBoxArray::DoMdcaPointL media count = %d aIndex = %d", MdcaCount(), aIndex );
+    TInt index( MapListBoxIndexToArrayIndex( aIndex ) );
+
+    CMPXMedia* entry( iMedia->AtL( index ) );
+
+    if( entry->IsSupported( KMPXMediaGeneralTitle ))
+        {
+        const TDesC& title = entry->ValueText(KMPXMediaGeneralTitle);
+        TMPXPodcastType type = EMPXPodcastNoType;
+        TMPXPodcastCategory category = EMPXUnknown;
+
+        if (entry->IsSupported(KMPXMediaPodcastType))
+            {
+            type =
+                entry->ValueTObjectL<TMPXPodcastType>(KMPXMediaPodcastType);
+
+            }
+        if (entry->IsSupported(KMPXMediaPodcastCategoryGroup))
+            {
+            category =
+                    entry->ValueTObjectL<TMPXPodcastCategory>(KMPXMediaPodcastCategoryGroup);
+            }
+        TUint flags(0);
+        if( entry->IsSupported( KMPXMediaGeneralFlags ) )
+            {
+            flags = entry->ValueTObjectL<TUint>( KMPXMediaGeneralFlags );
+            }
+
+        MPX_DEBUG3( "CMPXPodcastCollectionViewListBoxArray::MdcaPoint (%d) Name: %S", aIndex, &title );
+        MPX_DEBUG4( "CMPXPodcastCollectionViewListBoxArray::MdcaPoint (%d) Type: %d, Category: %d", aIndex, type, category );
+        TInt iconID;
+        if ( type == EMPXPodcastGroup )
+            {
+            switch( category )
+                {
+                case EMPXAll:
+                    {
+                    iconID = EMPXPodClvIconEpisode;
+                    break;
+                    }
+                case EMPXRecentlyAdded:
+                case EMPXNotYetPlayed:
+                    {
+                    iconID = EMPXPodClvIconAuto;
+                    break;
+                    }
+                case EMPXPubDate:
+                    {
+                    iconID = EMPXPodClvIconDate;
+                    break;
+                    }
+                case EMPXTitle:
+                    {
+                    iconID = EMPXPodClvIconTitle;
+                    break;
+                    }
+                case EMPXPodcastFile:
+                    {
+                    iconID = EMPXPodClvIconFolder;
+                    break;
+                    }
+                default:
+                    {
+                    iconID = EMPXPodClvIconUnknowFile;
+                    break;
+                    }
+                } // Switch
+            }
+        else if ( type == EMPXPodcastItem )
+            {
+            TBool checkFlag(ETrue);
+
+            switch( category )
+                {
+                case EMPXEpisode:
+                    {
+                    iconID = EMPXPodClvIconEpisode;
+                    break;
+                    }
+                case EMPXNew:
+                    {
+                    if(entry->IsSupported(KMPXMediaPodcastIsPlaying) &&
+                       entry->ValueTObjectL<TBool>(KMPXMediaPodcastIsPlaying))
+                        {
+                        iconID = EMPXPodClvIconPartplay;
+                        }
+                    else if(iIndex == aIndex  &&
+                           (iPbState == EPbStatePlaying ||
+                            iPbState == EPbStatePaused))
+                        {
+                        entry->SetTObjectValueL<TBool> (
+                            KMPXMediaPodcastIsPlaying, ETrue);
+                        iconID = EMPXPodClvIconPartplay;
+                        }
+                    else
+                        {
+                        iconID = EMPXPodClvIconNew;
+                        }
+
+                    break;
+                    }
+                case EMPXPartlyPlayed:
+                    {
+                    iconID = EMPXPodClvIconPartplay;
+                    break;
+                    }
+                case EMPXCompletelyPlayed:
+                    {
+                    iconID = EMPXPodClvIconCompplay;
+                    break;
+                    }
+                case EMPXPodcastFile:
+                    {
+                    checkFlag = EFalse;
+                    iconID = EMPXPodClvIconFolder;
+                    break;
+                    }
+                default:
+                    {
+                    checkFlag = EFalse;
+                    iconID = EMPXPodClvIconUnknowFile;
+                    break;
+                    }
+                } // Switch
+
+                if(checkFlag)
+                    {
+                    if ( flags & KMPXMediaGeneralFlagsIsCorrupted )
+                        {
+                        iconID = EMPXPodClvIconCorrupt;
+                        }
+                    else if ( flags & KMPXMediaGeneralFlagsIsInvalid )
+                        {
+                        iconID = EMPXPodClvIconBroken;
+                        }
+                    else if ( flags & KMPXMediaGeneralFlagsIsDrmLicenceInvalid )
+                        {
+                        iconID = EMPXPodClvIconBroken;
+                        }
+                    // else do nothing
+                    }
+            }
+        else
+            {
+            iconID = EMPXPodClvIconUnknowFile;
+            }
+
+        TPtrC item;
+
+        TPtr ptr = iItem->Des();
+        ptr.Zero();
+        ptr.Format( KMPXCommonListboxFormatString, iconID, &title );
+
+        // playback status icon
+        if ( iIndex == index )
+            {
+            if ( iPbState == EPbStatePlaying )
+                {
+                ptr.Append( KMPXTab );
+                ptr.AppendNum( EMPXPodClvIconPlay );
+                }
+            else if ( iPbState == EPbStatePaused )
+                {
+                ptr.Append( KMPXTab );
+                ptr.AppendNum( EMPXPodClvIconPause );
+                }
+            else if ( iPbState == EPbStateSeekingForward )
+                {
+                ptr.Append( KMPXTab );
+                ptr.AppendNum( EMPXPodClvIconForward );
+                }
+            else if ( iPbState == EPbStateSeekingBackward )
+                {
+                ptr.Append( KMPXTab );
+                ptr.AppendNum( EMPXPodClvIconRewind );
+                }
+            else
+                {
+                // Do nothing
+                }
+            }
+
+        // mmc icon
+        TInt driveNum = ( ( flags ) & ( KMPXMediaGeneralFlagsDriveInfo ) );
+        if( driveNum == iMMCDrive )
+            {
+            ptr.Append( KMPXTab );
+            ptr.AppendNum( EMPXPodClvIconMMC );
+            }
+
+        item.Set( *iItem );
+        return item;
+        }
+    else
+        {
+        TPtrC item( KNullDesC );
+        return item;
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Append icon to array
+// -----------------------------------------------------------------------------
+//
+void CMPXPodcastCollectionViewListBoxArray::AppendColorIconToArrayL(
+    CAknIconArray* aArray,
+    const TAknsItemID& aID,
+    const TAknsItemID& aColorId,
+    TInt aColorIndex,
+    const TDesC& aMbmFile,
+    TInt aBitmapId,
+    TInt aMaskId )
+    {
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    if ( aColorId == KAknsIIDNone )
+        {
+        // do not use theme color, use the default color from the file
+        AknsUtils::CreateIconLC( skin, aID,
+            bitmap, mask, aMbmFile, aBitmapId, aMaskId );
+        }
+    else
+        {
+        // use theme color
+        AknsUtils::CreateColorIconLC( skin, aID, aColorId, aColorIndex,
+            bitmap, mask, aMbmFile, aBitmapId, aMaskId, KRgbBlack );
+        }
+
+    CGulIcon* icon = CGulIcon::NewL( bitmap, mask );
+    icon->SetBitmapsOwnedExternally( EFalse );
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop( 2 ); // mask, bitmap
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL( icon );
+    aArray->AppendL( icon );
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop( icon );
+    }
+
+// -----------------------------------------------------------------------------
+// Maps list box index to array index in reorder mode
+// -----------------------------------------------------------------------------
+//
+TInt CMPXPodcastCollectionViewListBoxArray::MapListBoxIndexToArrayIndex(
+    TInt aIndex ) const
+    {
+    TInt index = aIndex;
+
+    if ( ( iReorder ) && ( iOriginalIndex != iMovedIndex ) )
+        {
+        if ( iMovedIndex > iOriginalIndex )
+            {
+            // moved down
+            if ( aIndex < iOriginalIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex > iMovedIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex < iMovedIndex )
+                {
+                // between original index and moved index
+                index = aIndex + 1;
+                }
+            else if ( aIndex == iMovedIndex )
+                {
+                index = iOriginalIndex;
+                }
+            }
+        else
+            {
+            // moved up
+            if ( aIndex > iOriginalIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex < iMovedIndex )
+                {
+                // do nothing
+                }
+            else if ( aIndex > iMovedIndex )
+                {
+                // between original index and moved index
+                index = aIndex - 1;
+                }
+            else if ( aIndex == iMovedIndex )
+                {
+                index = iOriginalIndex;
+                }
+            }
+        }
+
+    return index;
+    }
+
+// ---------------------------------------------------------------------------
+// Sets playback status
+// ---------------------------------------------------------------------------
+//
+TInt CMPXPodcastCollectionViewListBoxArray::SetPlaybackStatusByIndex(
+    TInt aIndex, TMPXPlaybackState aStatus )
+    {
+    MPX_FUNC( "CMPXPodcastCollectionViewListBoxArray::SetPlaybackStatusByIndex" );
+    TInt ret( iIndex );
+    iIndex = aIndex;
+
+    // Not to display seeking icons for seeking mode
+    if ( aStatus != EPbStateSeekingForward &&
+        aStatus != EPbStateSeekingBackward )
+        {
+        iPbState = aStatus;
+        }
+    return ret;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxaddtracksdialog.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxaddtracksdialog
+*
+*/
+
+
+
+#ifndef MPXADDTRACKSDIALOG_IBY
+#define MPXADDTRACKSDIALOG_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxaddtracksdialog.dll       SHARED_LIB_DIR\mpxaddtracksdialog.dll
+SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, mpxaddtracksdialog )
+
+#endif // MPXADDTRACKSDIALOG_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxaddtracksdialogrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxaddtracksdialog
+*
+*/
+
+
+
+#ifndef MPXADDTRACKSDIALOGRSC_IBY
+#define MPXADDTRACKSDIALOGRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxaddtracksdialog.rsc     APP_RESOURCE_DIR\mpxaddtracksdialog.rsc
+
+#endif // MPXADDTRACKSDIALOGRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxalbumarteditordialog.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxalbumarteditordialog
+*
+*/
+
+
+
+#ifndef MPXALBUMARTEDITORDIALOG_IBY
+#define MPXALBUMARTEDITORDIALOG_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxalbumarteditordialog.dll  SHARED_LIB_DIR\mpxalbumarteditordialog.dll
+
+#endif // MPXALBUMARTEDITORDIALOG_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxalbumarteditordialogrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxalbumarteditordialog
+*
+*/
+
+
+
+#ifndef MPXALBUMARTEDITORDIALOGRSC_IBY
+#define MPXALBUMARTEDITORDIALOGRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxalbumarteditordialog.rsc APP_RESOURCE_DIR\mpxalbumarteditordialog.rsc
+
+#endif // MPXALBUMARTEDITORDIALOGRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxaudioeffectsview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxaudioeffectsview
+*
+*/
+
+
+
+#ifndef MPXAUDIOEFFECTSVIEW_IBY
+#define MPXAUDIOEFFECTSVIEW_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxaudioeffectsview.dll      SHARED_LIB_DIR\mpxaudioeffectsview.dll
+
+#endif // MPXAUDIOEFFECTSVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxaudioeffectsviewrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxaudioeffectsview
+*
+*/
+
+
+
+#ifndef MPXAUDIOEFFECTSVIEWRSC_IBY
+#define MPXAUDIOEFFECTSVIEWRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxaudioeffectsview.rsc    APP_RESOURCE_DIR\mpxaudioeffectsview.rsc
+
+#endif // MPXAUDIOEFFECTSVIEWRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxcollectionview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxcollectionview
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONVIEW_IBY
+#define MPXCOLLECTIONVIEW_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxcollectionview.dll        SHARED_LIB_DIR\mpxcollectionview.dll
+SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, mpxcollectionview )
+
+#endif // MPXCOLLECTIONVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxcollectionviewhg.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxcollectionviewhg
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONVIEWHG_IBY
+#define MPXCOLLECTIONVIEWHG_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxcollectionviewhg.dll        SHARED_LIB_DIR\mpxcollectionviewhg.dll
+SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, mpxcollectionviewhg )
+
+#endif // MPXCOLLECTIONVIEWHG_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxcollectionviewhgrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxcollectionviewhg
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONVIEWHGRSC_IBY
+#define MPXCOLLECTIONVIEWHGRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxcollectionviewhg.rsc      APP_RESOURCE_DIR\mpxcollectionviewhg.rsc
+
+#endif // MPXCOLLECTIONVIEWHGRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxcollectionviewrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxcollectionview
+*
+*/
+
+
+
+#ifndef MPXCOLLECTIONVIEWRSC_IBY
+#define MPXCOLLECTIONVIEWRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxcollectionview.rsc      APP_RESOURCE_DIR\mpxcollectionview.rsc
+
+#endif // MPXCOLLECTIONVIEWRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxcommoncontainer.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxcommoncontainer
+*
+*/
+
+
+
+#ifndef MPXCOMMONCONTAINER_IBY
+#define MPXCOMMONCONTAINER_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxcommoncontainer.dll       SHARED_LIB_DIR\mpxcommoncontainer.dll
+
+#endif // MPXCOMMONCONTAINER_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxcommoncontainerrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxcommoncontainer
+*
+*/
+
+
+
+#ifndef MPXCOMMONCONTAINERRSC_IBY
+#define MPXCOMMONCONTAINERRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxcommoncontainer.rsc     APP_RESOURCE_DIR\mpxcommoncontainer.rsc
+
+#endif // MPXCOMMONCONTAINERRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxcommonplaybackview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxcommonplaybackview
+*
+*/
+
+
+
+#ifndef MPXCOMMONPLAYBACKVIEW_IBY
+#define MPXCOMMONPLAYBACKVIEW_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxcommonplaybackview.dll    SHARED_LIB_DIR\mpxcommonplaybackview.dll
+SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, mpxcommonplaybackview )
+
+#endif // MPXCOMMONPLAYBACKVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxcommonplaybackviewrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxcommonplaybackview
+*
+*/
+
+
+
+#ifndef MPXCOMMONPLAYBACKVIEWRSC_IBY
+#define MPXCOMMONPLAYBACKVIEWRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxcommonplaybackview.rsc  APP_RESOURCE_DIR\mpxcommonplaybackview.rsc
+data=DATAZ_\APP_RESOURCE_DIR\mpxfmtx.rsc  APP_RESOURCE_DIR\mpxfmtx.rsc
+
+#endif // MPXCOMMONPLAYBACKVIEWRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxembeddedplaybackview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxembeddedplaybackview
+*
+*/
+
+
+
+#ifndef MPXEMBEDDEDPLAYBACKVIEW_IBY
+#define MPXEMBEDDEDPLAYBACKVIEW_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxembeddedplaybackview.dll  SHARED_LIB_DIR\mpxembeddedplaybackview.dll
+SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, mpxembeddedplaybackview )
+
+#endif // MPXEMBEDDEDPLAYBACKVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxembeddedplaybackviewrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxembeddedplaybackview
+*
+*/
+
+
+
+#ifndef MPXEMBEDDEDPLAYBACKVIEWRSC_IBY
+#define MPXEMBEDDEDPLAYBACKVIEWRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxembeddedplaybackview.rsc APP_RESOURCE_DIR\mpxembeddedplaybackview.rsc
+
+#endif // MPXEMBEDDEDPLAYBACKVIEWRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxequalizerview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxequalizerview
+*
+*/
+
+
+
+#ifndef MPXEQUALIZERVIEW_IBY
+#define MPXEQUALIZERVIEW_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxequalizerview.dll         SHARED_LIB_DIR\mpxequalizerview.dll
+
+// Empty mp3 for equalizer
+data=ZSYSTEM\data\nullsound.mp3                system\data\nullsound.mp3
+
+#endif // MPXEQUALIZERVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxmainview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxmainview
+*
+*/
+
+
+
+#ifndef MPXMAINVIEW_IBY
+#define MPXMAINVIEW_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxmainview.dll              SHARED_LIB_DIR\mpxmainview.dll
+SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, mpxmainview )
+
+#endif // MPXMAINVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxmainviewrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxmainview
+*
+*/
+
+
+
+#ifndef MPXMAINVIEWRSC_IBY
+#define MPXMAINVIEWRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxmainview.rsc            APP_RESOURCE_DIR\mpxmainview.rsc
+
+#endif // MPXMAINVIEWRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxmetadataeditordialog.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxmetadataeditordialog
+*
+*/
+
+
+
+#ifndef MPXMETADATAEDITORDIALOG_IBY
+#define MPXMETADATAEDITORDIALOG_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxmetadataeditordialog.dll  SHARED_LIB_DIR\mpxmetadataeditordialog.dll
+
+#endif // MPXMETADATAEDITORDIALOG_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxmetadataeditordialogrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxmetadataeditordialog
+*
+*/
+
+
+
+#ifndef MPXMETADATAEDITORDIALOGRSC_IBY
+#define MPXMETADATAEDITORDIALOGRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxmetadataeditordialog.rsc APP_RESOURCE_DIR\mpxmetadataeditordialog.rsc
+
+#endif // MPXMETADATAEDITORDIALOGRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxpdplaybackview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpdplaybackview
+*
+*/
+
+
+
+#ifndef MPXPDPLAYBACKVIEW_IBY
+#define MPXPDPLAYBACKVIEW_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxpdplaybackview.dll        SHARED_LIB_DIR\mpxpdplaybackview.dll
+
+#endif // MPXPDPLAYBACKVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxpdplaybackviewrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpdplaybackview
+*
+*/
+
+
+
+#ifndef MPXPDPLAYBACKVIEWRSC_IBY
+#define MPXPDPLAYBACKVIEWRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxpdplaybackview.rsc      APP_RESOURCE_DIR\mpxpdplaybackview.rsc
+
+#endif // MPXPDPLAYBACKVIEWRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxpdsbplaybackview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpdsbplaybackview
+*
+*/
+
+
+
+#ifndef MPXPDSBPLAYBACKVIEW_IBY
+#define MPXPDSBPLAYBACKVIEW_IBY
+
+#include <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+file=ABI_DIR\BUILD_DIR\mpxpdsbplaybackview.dll      SHARED_LIB_DIR\mpxpdsbplaybackview.dll
+#endif
+
+#endif // MPXPDSBPLAYBACKVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxpdsbplaybackviewrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpdsbplaybackview
+*
+*/
+
+
+
+#ifndef MPXPDSBPLAYBACKVIEWRSC_IBY
+#define MPXPDSBPLAYBACKVIEWRSC_IBY
+
+#include <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+
+#ifdef RD_BROWSER_PROGRESSIVE_DOWNLOAD
+data=DATAZ_\APP_RESOURCE_DIR\mpxpdsbplaybackview.rsc    APP_RESOURCE_DIR\mpxpdsbplaybackview.rsc
+#endif
+
+#endif // MPXPDSBPLAYBACKVIEWRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxplaybackview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxplaybackview
+*
+*/
+
+
+
+#ifndef MPXPLAYBACKVIEW_IBY
+#define MPXPLAYBACKVIEW_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxplaybackview.dll      SHARED_LIB_DIR\mpxplaybackview.dll
+
+#endif // MPXPLAYBACKVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxplaybackviewrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxplaybackview
+*
+*/
+
+
+
+#ifndef MPXPLAYBACKVIEWRSC_IBY
+#define MPXPLAYBACKVIEWRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxplaybackview.rsc        APP_RESOURCE_DIR\mpxplaybackview.rsc
+
+#endif // MPXPLAYBACKVIEWRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxpodcastplaybackview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpodcastplaybackview
+*
+*/
+
+
+
+#ifndef MPXPODCASTPLAYBACKVIEW_IBY
+#define MPXPODCASTPLAYBACKVIEW_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxpodcastplaybackview.dll        SHARED_LIB_DIR\mpxpodcastplaybackview.dll
+SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, mpxpodcastplaybackview )
+
+#endif // MPXPODCASTPLAYBACKVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxpodcastplaybackviewrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpodcastplaybackview
+*
+*/
+
+
+
+#ifndef MPXPODCASTPLAYBACKVIEWRSC_IBY
+#define MPXPODCASTPLAYBACKVIEWRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxpodcastplaybackview.rsc      APP_RESOURCE_DIR\mpxpodcastplaybackview.rsc
+
+#endif // MPXPODCASTPLAYBACKVIEWRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxpodcastview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpodcastview
+*
+*/
+
+
+
+#ifndef MPXPODCASTVIEW_IBY
+#define MPXPODCASTVIEW_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxpodcastcollectionview.dll        SHARED_LIB_DIR\mpxpodcastcollectionview.dll
+SCALABLE_IMAGE( APP_BITMAP_DIR, APP_BITMAP_DIR, mpxpodcastcollectionview )
+
+#endif // MPXPODCASTVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxpodcastviewrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxpodcastnview
+*
+*/
+
+
+
+#ifndef MPXPODCASTVIEWRSC_IBY
+#define MPXPODCASTVIEWRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxpodcastcollectionview.rsc      APP_RESOURCE_DIR\mpxpodcastcollectionview.rsc
+
+#endif // MPXPODCASTVIEWRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxupnpbrowsedialog.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxupnpbrowsedialog
+*
+*/
+
+
+
+#ifndef MPXUPNPBROWSEDIALOG_IBY
+#define MPXUPNPBROWSEDIALOG_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxupnpbrowsedialog.dll SHARED_LIB_DIR\mpxupnpbrowsedialog.dll
+
+#endif // MPXUPNPBROWSEDIALOG_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxupnpbrowsedialogrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxupnpbrowsedialog
+*
+*/
+
+
+
+#ifndef MPXUPNPBROWSEDIALOGRSC_IBY
+#define MPXUPNPBROWSEDIALOGRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxupnpbrowsedialog.rsc APP_RESOURCE_DIR\mpxupnpbrowsedialog.rsc
+
+#endif // MPXUPNPBROWSEDIALOG_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxupnpplaybackdialog.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxupnpplaybackdialog
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKDIALOG_IBY
+#define MPXUPNPPLAYBACKDIALOG_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxupnpplaybackdialog.dll  SHARED_LIB_DIR\mpxupnpplaybackdialog.dll
+
+#endif // MPXUPNPPLAYBACKDIALOG_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxupnpplaybackdialogrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxupnpplaybackdialog
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKDIALOGRSC_IBY
+#define MPXUPNPPLAYBACKDIALOGRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxupnpplaybackdialog.rsc APP_RESOURCE_DIR\mpxupnpplaybackdialog.rsc
+
+#endif // MPXUPNPPLAYBACKDIALOGRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxupnpplaybackview.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxupnpplaybackview
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKVIEW_IBY
+#define MPXUPNPPLAYBACKVIEW_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxupnpplaybackview.dll      SHARED_LIB_DIR\mpxupnpplaybackview.dll
+
+#endif // MPXUPNPPLAYBACKVIEW_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxupnpplaybackviewrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxupnpplaybackview
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKVIEWRSC_IBY
+#define MPXUPNPPLAYBACKVIEWRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxupnpplaybackview.rsc    APP_RESOURCE_DIR\mpxupnpplaybackview.rsc
+
+#endif // MPXUPNPPLAYBACKVIEWRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxwaitnotedialog.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxwaitnotedialog
+*
+*/
+
+
+
+#ifndef MPXWAITNOTEDIALOG_IBY
+#define MPXWAITNOTEDIALOG_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+file=ABI_DIR\BUILD_DIR\mpxwaitnotedialog.dll        SHARED_LIB_DIR\mpxwaitnotedialog.dll
+
+#endif // MPXWAITNOTEDIALOG_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/rom/mpxwaitnotedialogrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Image description file for project mpxwaitnotedialog
+*
+*/
+
+
+
+#ifndef MPXWAITNOTEDIALOGRSC_IBY
+#define MPXWAITNOTEDIALOGRSC_IBY
+
+#include <data_caging_paths_for_iby.hrh>
+
+
+data=DATAZ_\APP_RESOURCE_DIR\mpxwaitnotedialog.rsc      APP_RESOURCE_DIR\mpxwaitnotedialog.rsc
+
+#endif // MPXWAITNOTEDIALOGRSC_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpbrowsedialog/bwinscw/mpxupnpbrowsedialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?ExecuteLD@CMPXUPnPBrowseDialog@@UAEHH@Z @ 1 NONAME ; int CMPXUPnPBrowseDialog::ExecuteLD(int)
+	?NewL@CMPXUPnPBrowseDialog@@SAPAV1@H@Z @ 2 NONAME ; class CMPXUPnPBrowseDialog * CMPXUPnPBrowseDialog::NewL(int)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpbrowsedialog/data/mpxupnpbrowsedialog.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project UPnP browse dialog
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MXUP // 4 letter ID
+
+// INCLUDES
+#include <mpxupnpbrowsedialog.loc>
+#include <eikon.rh>
+#include <avkon.loc>
+#include <avkon.hrh>
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// -----------------------------------------------------------------------------
+//
+//    r_upnp_menu_title_select_player
+//    Text for upnp dialog title
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_menu_title_select_player
+    {
+    buf = qtn_nmp_title_select_player;
+    }
+
+// -----------------------------------------------------------------------------
+//    r_upnp_dialog_waiting_for_devices
+//    Waiting text for upnp dialog 
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_upnp_dialog_waiting_for_devices
+    {
+    buf = qtn_nmp_select_player_searching;
+    }
+    
+// -----------------------------------------------------------------------------
+//    r_upnp_error_player_unavailable
+//    Error note for upnp dialog 
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_upnp_error_player_unavailable
+    {
+    buf = qtn_nmp_note_invalid_player;
+    }
+
+// -----------------------------------------------------------------------------
+//    r_upnp_list_upnp_more_subplayers
+//    Last item in the upnp dialog list
+// -----------------------------------------------------------------------------
+//  
+RESOURCE TBUF r_upnp_list_upnp_more_subplayers
+    {
+    buf = qtn_nmp_select_player_search_again;
+    }   
+    
+    
+// ---------------------------------------------------------------------------
+//    r_softkeys_upnp_empty_cancel
+// ---------------------------------------------------------------------------
+RESOURCE CBA r_mpx_softkeys_upnp_empty_cancel 
+    { 
+    buttons = 
+        { 
+        CBA_BUTTON 
+            { 
+            txt = text_softkey_empty;             
+            },        
+        CBA_BUTTON 
+            { 
+            id = EAknSoftkeyCancel; 
+            txt = text_softkey_cancel;  
+            } 
+        }; 
+    }	
+    
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpbrowsedialog/eabi/mpxupnpbrowsedialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,6 @@
+EXPORTS
+	_ZN20CMPXUPnPBrowseDialog4NewLEi @ 1 NONAME
+	_ZN20CMPXUPnPBrowseDialog9ExecuteLDEi @ 2 NONAME
+	_ZTI20CMPXUPnPBrowseDialog @ 3 NONAME ; #<TI>#
+	_ZTV20CMPXUPnPBrowseDialog @ 4 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpbrowsedialog/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxupnpbrowsedialog
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxupnpbrowsedialog.loc	APP_LAYER_LOC_EXPORT_PATH(mpxupnpbrowsedialog.loc)
+
+PRJ_MMPFILES
+mpxupnpbrowsedialog.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpbrowsedialog/group/mpxupnpbrowsedialog.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxupnpbrowsedialog.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxupnpbrowsedialog.dll
+TARGETTYPE      dll
+UID             0x10009D8D 0x101FFC94
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+SOURCEPATH      ../src
+SOURCE          mpxupnpbrowsedialog.cpp
+SOURCE          mpxplayermanagerstub.cpp
+
+START RESOURCE  ../data/mpxupnpbrowsedialog.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         eikdlg.lib
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         ws32.lib
+LIBRARY         fbscli.lib
+LIBRARY         bitgdi.lib
+LIBRARY         gdi.lib
+LIBRARY         egul.lib
+LIBRARY         eikctl.lib
+LIBRARY         eiksrv.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknicon.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknskinsrv.lib
+LIBRARY         commonengine.lib
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         cdlengine.lib
+LIBRARY         mgfetch.lib
+
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxviewutility.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpbrowsedialog/inc/mpxplayermanagerstub.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of winscw player manager stub
+*
+*/
+
+
+#ifndef CMPXPLAYERMANAGERSTUB_H
+#define CMPXPLAYERMANAGERSTUB_H
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxplaybackutility.h>
+
+// FORWARD DECLARATIONS
+
+/**
+* CMPXPlayerManagerStub
+*
+* Stub for player manager in Winscw
+* @since S60 3.1
+*/
+NONSHARABLE_CLASS(CMPXPlayerManagerStub) : public CActive, public MMPXPlayerManager
+    {
+public:
+    /**
+    * C++ default constructor.
+    */
+    CMPXPlayerManagerStub();
+
+    /**
+    * Symbian OS constructor.
+    */
+    void ConstructL();
+
+    /**
+    * Destructor.
+    */
+    virtual ~CMPXPlayerManagerStub();
+    
+public: // New functions
+
+    /**
+    *  Typically, a client will obtain the list of all the (non-duplicated)
+    *  player 'types' in the system from GetPlayerTypesL and present localized
+    *  type names (e.g. "Local","Home network", if possible, else if 
+    *  non-standard type,should use PlayerTypeDisplayNameL to get text from 
+    *  player).
+    *
+    *  User should be given opportunity to choose IF there is more than one 
+    *  type available, or if there is one type but more than one sub players,
+    *  the user could be presented with the sub player list.
+    *
+    *  @param aTypes the list of player types
+    */
+    virtual void GetPlayerTypesL(RArray<TMPXPlaybackPlayerType>& aTypes); 
+    
+    /**
+    *  Returns display name for custom types; standard types should be 
+    *  recognized by client and localized - calling this method would then not
+    *  be required
+    *
+    *  @param aType playback type
+    */
+    virtual HBufC* PlayerTypeDisplayNameL(TMPXPlaybackPlayerType aType);
+    
+    /**
+    *  Get the list of UIDs of all players
+    *
+    *  @param aPlayers All the players' uids in the system
+    */
+    virtual void GetPlayerListL(RArray<TUid>& aPlayers); 
+
+    /**
+    *  Get the list of UIDs of players with the specific type 
+    * 
+    *  @param aPlayers All the players' uids with the same type
+    *  @param aType the type of players
+    */
+    virtual void GetPlayerListL(RArray<TUid>& aPlayers,
+                               TMPXPlaybackPlayerType aType);
+
+    /**
+    *  Get the list of sub player names, Async
+    * 
+    *  @param aCallback sub players returned in call back interface 
+    *  @param aPlayer UID of the player
+    */
+    virtual void SubPlayerNamesL(MMPXPlaybackCallback& aCallback,
+                                 TUid aPlayer); 
+    
+    /**
+    *  Client selects all players with the type aType, the specific player used
+    *  then being resolved on the basis of the content. 
+    *
+    *  @param aType the type of player
+    */
+    virtual void SelectPlayersL(TMPXPlaybackPlayerType aType);
+    
+    /**
+    *  Client selects specific player aPlayer and sub player aSubPlayerIndex 
+    *  from array returned by SubPlayerNamesL
+    *
+    *  @param aPlayer the UID of player
+    *  @param aSubPlayerIndex the index of the sub player
+    */
+    virtual void SelectSubPlayerL(TUid aPlayer, TInt aSubPlayerIndex);
+    
+    /**
+    *  Client selects a specific player 
+    *
+    *  @param aPlayer the UID of the player
+    */
+    virtual void SelectPlayerL(TUid aPlayer);
+    
+    /**
+    *  Clears all selection criteria. Essentially the same as 
+    *  SelectPlayersL(EPbLocal).
+    */
+    virtual void ClearSelectPlayersL();
+    
+    /**
+    *  Retreives the current selection: KNullUid and KErrNotFound are possible
+    *  return values for aPlayer and aSubPlayerIndex respectively if none are
+    *  explicitly selected
+    *
+    *  @param aType player type
+    *  @param aPlayer the UID of player
+    *  @param aSubPlayerIndex index of the subplayer
+    */
+    virtual void GetSelectionL(TMPXPlaybackPlayerType& aType,
+                               TUid& aPlayer,
+                               TInt& aSubPlayerIndex,
+                               HBufC*& aSubPlayerName);
+    
+    /**
+    *  The current player, may change with each song, NULL if none found
+    *
+    *  @return object of current player
+    */
+    virtual MMPXPlayer* CurrentPlayer(); 
+    
+    /**
+    *  From MMPXPlayerManager
+    *  Get the name of the current sub player
+    * 
+    *  @param aSubPlayerIndex the index of the sub player 
+    *  @return friendly name of the sub player
+    */
+    virtual HBufC* GetSelectedSubPlayerNameL(TInt aSubPlayerIndex);    
+    
+private:
+    /**
+    * @see CActive::RunL()
+    */
+    void RunL();
+
+    /**
+    * @see CActive::DoCancel()
+    */
+    void DoCancel();
+
+private: // Data
+    MMPXPlaybackCallback* iCallback;
+    CDesCArrayFlat* iSubPlayersNamesArray;
+    TUid iUid;
+    };
+          
+#endif // CMPXPLAYERMANAGERSTUB_H
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpbrowsedialog/inc/mpxupnpbrowsedialog.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxupnpbrowsedialog
+*
+*/
+
+
+
+#ifndef MPXUPNPBROWSEDIALOG_HRH
+
+
+
+// ENUMS
+ 
+
+#endif  // MPXUPNPBROWSEDIALOG_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpbrowsedialog/loc/mpxupnpbrowsedialog.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxupnpbrowsedialog
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Heading for UPnP player selection popup
+// l:heading_pane_t1
+// r:3.1
+//
+#define qtn_nmp_title_select_player "Select a player:"
+
+// d:Item in the UPnP player selection popup
+// d:Display when device is searching for UPnP players
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_nmp_select_player_searching "Searching..."
+
+// d:Invalid player error note
+// d:Display when UPnP player isn't available
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_invalid_player "Player unavailable. Make another selection"
+
+// d:Item in the UPnP player selection popup
+// l:list_single_pane_t1_cp2
+// r:3.1
+//
+#define qtn_nmp_select_player_search_again "<search again>"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpbrowsedialog/src/mpxplayermanagerstub.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Winscw player manager stub
+*
+*/
+
+
+// INCLUDE FILES
+#include    <e32std.h>
+
+#include "mpxplayermanagerstub.h"
+#include <mpxplaybackobserver.h>
+
+
+// ================= MEMBER FUNCTIONS =======================
+
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::CMPXPlayerManagerStub
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXPlayerManagerStub::CMPXPlayerManagerStub()
+    : CActive(EPriorityStandard)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMPXPlayerManagerStub::ConstructL()
+    {
+    // Add this active object to the scheduler.
+    CActiveScheduler::Add(this);
+    }
+
+// Destructor
+CMPXPlayerManagerStub::~CMPXPlayerManagerStub()
+    {
+    delete iSubPlayersNamesArray;
+    Cancel();
+    }    
+
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::RunL
+// -----------------------------------------------------------------------------
+//
+void CMPXPlayerManagerStub::RunL()
+    {
+    delete iSubPlayersNamesArray;
+    iSubPlayersNamesArray = NULL;
+    iSubPlayersNamesArray = new (ELeave) CDesCArrayFlat(4);
+    
+    iSubPlayersNamesArray->AppendL(_L("Subplayer1"));
+    iSubPlayersNamesArray->AppendL(_L("Local"));
+    iSubPlayersNamesArray->AppendL(_L("Subplayer3"));
+    iSubPlayersNamesArray->AppendL(_L("Subplayer4"));
+    
+    iCallback->HandleSubPlayerNamesL( iUid, iSubPlayersNamesArray, 
+                                      ETrue, KErrNone);
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::DoCancel
+// -----------------------------------------------------------------------------
+//
+void CMPXPlayerManagerStub::DoCancel()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::GetPlayerTypesL
+// -----------------------------------------------------------------------------
+//    
+void CMPXPlayerManagerStub::GetPlayerTypesL(RArray<TMPXPlaybackPlayerType>& /*aTypes*/)
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::PlayerTypeDisplayNameL
+// -----------------------------------------------------------------------------
+//
+HBufC* CMPXPlayerManagerStub::PlayerTypeDisplayNameL(TMPXPlaybackPlayerType /*aType*/)
+    {
+    return NULL;
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::GetPlayerListL
+// -----------------------------------------------------------------------------
+//
+void CMPXPlayerManagerStub::GetPlayerListL(RArray<TUid>& /*aPlayers*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::GetPlayerListL
+// -----------------------------------------------------------------------------
+//
+void CMPXPlayerManagerStub::GetPlayerListL(RArray<TUid>& /*aPlayers*/,
+                           TMPXPlaybackPlayerType /*aType*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::SubPlayerNamesL
+// -----------------------------------------------------------------------------
+//
+void CMPXPlayerManagerStub::SubPlayerNamesL(MMPXPlaybackCallback& aCallback,
+                             TUid aPlayer)
+    {
+    iCallback = &aCallback;
+    iUid = aPlayer;
+    if (!IsActive())
+        {
+        iStatus = KRequestPending;
+        SetActive();
+        }
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::SelectPlayersL
+// -----------------------------------------------------------------------------
+//
+void CMPXPlayerManagerStub::SelectPlayersL(TMPXPlaybackPlayerType /*aType*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::SelectSubPlayerL
+// -----------------------------------------------------------------------------
+//
+void CMPXPlayerManagerStub::SelectSubPlayerL(TUid /*aPlayer*/, TInt /*aSubPlayerIndex*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::SelectPlayerL
+// -----------------------------------------------------------------------------
+//
+void CMPXPlayerManagerStub::SelectPlayerL(TUid /*aPlayer*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::ClearSelectPlayersL
+// -----------------------------------------------------------------------------
+//
+void CMPXPlayerManagerStub::ClearSelectPlayersL()
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::GetSelectionL
+// -----------------------------------------------------------------------------
+//
+void CMPXPlayerManagerStub::GetSelectionL(TMPXPlaybackPlayerType& /*aType*/,
+                           TUid& /*aPlayer*/,
+                           TInt& /*aSubPlayerIndex*/,
+                           HBufC*& /*aSubPlayerName*/)
+    {
+    }
+    
+// -----------------------------------------------------------------------------
+// CMPXPlayerManagerStub::CurrentPlayer
+// -----------------------------------------------------------------------------
+//
+MMPXPlayer* CMPXPlayerManagerStub::CurrentPlayer()
+    {
+    return NULL;
+    }
+        
+// ----------------------------------------------------------------------------
+// Returns current sub player name
+// ----------------------------------------------------------------------------
+//     
+HBufC* CMPXPlayerManagerStub::GetSelectedSubPlayerNameL(TInt /*aSubPlayerIndex*/)
+    {
+    return NULL; 
+    }        
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpbrowsedialog/src/mpxupnpbrowsedialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,739 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of UPnP players browse Dialog
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <aknPopupHeadingPane.h>
+#include <aknPopup.h>
+#include <aknlists.h>
+#include <AknIconArray.h>
+#include <gulicon.h>
+#include <StringLoader.h>
+#include <data_caging_path_literals.hrh>  // KDC_APP_RESOURCE_DIR
+#include <bautils.h>  // BaflUtils
+#include <AknsConstants.h>
+#include <aknnotewrappers.h>
+
+#include "mpxupnpbrowsedialog.h"
+#include <mpxupnpbrowsedialog.rsg>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxviewutility.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include "mpxplayermanagerstub.h"
+#include "mpxlog.h"
+
+#include <aknconsts.h>
+#include <avkon.mbg>
+#include <errorres.rsg>
+#include <wlanerrorcodes.h>
+
+#include <mpxmedia.h>
+#include <mpxplaybackutility.h> // MMPXPlayerManager, MMPXPlaybackUtility
+#include <mpxplaybackmessage.h>
+#include <mpxplaybackframeworkdefs.h>
+#include <mpxcommandgeneraldefs.h> // KMPXCommandGeneralDoSync
+#include <mpxcollectionplaylist.h>
+#include <mpxuser.h>
+
+// CONSTANTS
+_LIT( KMPlayerUPnPBrowserDialogRscPath, "mpxupnpbrowsedialog.rsc" );
+
+_LIT( KUPnPBrowseListboxString, "%S\t%d\t" );
+_LIT(KTab,"\t");
+_LIT(KSpace, " ");
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+EXPORT_C CMPXUPnPBrowseDialog* CMPXUPnPBrowseDialog::NewL(TInt aPlayerUid)
+    {
+    CMPXUPnPBrowseDialog* self = new (ELeave) CMPXUPnPBrowseDialog(aPlayerUid);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+void CMPXUPnPBrowseDialog::ConstructL( )
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::ConstructL" );
+
+    // Get the playback utility instance from engine.
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+    iPlaybackUtility->AddObserverL( *this );
+
+    // Load resource file
+    //
+    TParse parse;
+    parse.Set( KMPlayerUPnPBrowserDialogRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( CCoeEnv::Static()->FsSession(),
+                                    resourceFile );
+    iResourceOffset = CCoeEnv::Static()->AddResourceFileL( resourceFile );
+
+    iViewUtility = MMPXViewUtility::UtilityL();
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::CMPXUPnPBrowseDialog
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+CMPXUPnPBrowseDialog::CMPXUPnPBrowseDialog(TInt aPlayerUid) :
+    iPlayerUid(aPlayerUid)
+    {
+    }
+
+// Destructor
+CMPXUPnPBrowseDialog::~CMPXUPnPBrowseDialog()
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::Destructor" );
+    if (iResourceOffset)
+        {
+        CCoeEnv::Static()->DeleteResourceFile( iResourceOffset );
+        }
+    delete iListBox;
+
+    //Already cancelled in the destructor
+    delete iPlayerManagerStub;
+
+    if ( iPlaybackUtility )
+        {
+        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+        iPlaybackUtility->Close();
+        }
+
+    delete iCurrentlySelectedSubPlayerName;
+
+    if ( iViewUtility )
+        {
+        iViewUtility->Close();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Executes the popup list
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CMPXUPnPBrowseDialog::ExecuteLD(TInt aPlayerUid)
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::ExecuteLD()" );
+    TInt errorSelectSubPlayer = KErrNone;
+    TBool okToExit = EFalse;
+    TInt selectedSubplayerIndex = KErrNotFound;
+    iPlayerUnavailableError = EFalse;
+
+    iPlayerUid = aPlayerUid;
+
+    while ( !okToExit )
+        {
+        RetrieveCurrentlySelectSubplayerNameL();
+    	CreatePopupL();
+        TInt returnValue = StartPopupL();
+        MPX_DEBUG2( "CMPXUPnPBrowseDialog::ExecuteLD() after StartPopupL() returnValue %d", returnValue );
+
+        // if 1, Select was pressed
+        if ( returnValue )
+            {
+            TInt currentItemIndex = iListBox->CurrentItemIndex();
+            TInt numberOfItems = iListBox->Model()->NumberOfItems();
+
+            // check for boundaries
+            // if currentItemIndex is valid
+            if ( ( currentItemIndex >= 0 ) &&
+                 ( currentItemIndex < numberOfItems ) )
+                {
+                MPX_DEBUG2( "CMPXUPnPBrowseDialog::ExecuteLD() currentItemIndex %d", currentItemIndex );
+                MPX_DEBUG2( "CMPXUPnPBrowseDialog::ExecuteLD() numberOfItems %d", numberOfItems );
+
+                // if a subplayer was selected (and not <search again>)
+                HBufC* listText =
+                        StringLoader::LoadLC(R_UPNP_LIST_UPNP_MORE_SUBPLAYERS);
+                TInt isSelectedItemASubplayerName =
+                        listText->CompareF(
+                             (iListBox->Model()->ItemText(currentItemIndex)) );
+                MPX_DEBUG2( "CMPXUPnPBrowseDialog::ExecuteLD() isSelectedItemASubplayerName %d", isSelectedItemASubplayerName );
+                CleanupStack::PopAndDestroy( listText );
+
+                if ( isSelectedItemASubplayerName )
+                    {
+                    if ( iPlaybackUtility )
+                        {
+                        iPlaybackUtility->CancelRequest();
+                        }
+
+                    TBool selecDifferentSubPlayer = ETrue;
+
+                    if ( iCurrentlySelectedSubPlayerName )
+                        {
+                        TFileName listName(iListBox->Model()->ItemText(currentItemIndex));
+                        TInt index = listName.Find(KTab);
+                        if ( index >= 0 )
+                            {
+                            TFileName subPlayerName = listName.LeftTPtr(index);
+                            selecDifferentSubPlayer =
+                              ( ( subPlayerName.CompareF(
+                                  *iCurrentlySelectedSubPlayerName ) ) &&
+                                  ( aPlayerUid == iCurrentlyUsedPlayer.iUid) );
+                            }
+                        else
+                            {
+                            selecDifferentSubPlayer =
+                              ( ( listName.CompareF(
+                                  *iCurrentlySelectedSubPlayerName ) ) &&
+                                  ( aPlayerUid == iCurrentlyUsedPlayer.iUid) );
+                            }
+                        MPX_DEBUG2( "CMPXUPnPBrowseDialog::ExecuteLD() selecDifferentSubPlayer %d", selecDifferentSubPlayer);
+                        }
+
+                    MMPXSource* source = iPlaybackUtility->Source();
+                    CMPXCollectionPlaylist* playlist = NULL;
+                    if ( source )
+                        {
+                        playlist = source->PlaylistL();
+                        if ( playlist )
+                            {
+                            CleanupStack::PushL( playlist );
+                            }
+                        }
+
+                    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+                    // user selects a different remote player
+                    if ( iCurrentlySelectedSubPlayerName &&
+                         selecDifferentSubPlayer )
+                        {
+                        // need to clean up the current plugin
+                        TRAP_IGNORE( manager.ClearSelectPlayersL() );
+                        }
+
+                    MPX_DEBUG3( "CMPXUPnPBrowseDialog::ExecuteLD() before call to manager.SelectSubPlayerL(%d, %d)", iPlayerUid, currentItemIndex );
+                    MPX_TRAP( errorSelectSubPlayer,
+                          manager.SelectSubPlayerL( TUid::Uid(iPlayerUid),
+                                                    currentItemIndex ) );
+
+                    MPX_DEBUG2( "CMPXUPnPBrowseDialog::ExecuteLD() after manager.SelectSubPlayerL()", errorSelectSubPlayer );
+                    if ( errorSelectSubPlayer == KErrNone )
+                        {
+                        okToExit = ETrue;
+
+                        if ( selecDifferentSubPlayer )
+                            {
+                            selectedSubplayerIndex = currentItemIndex;
+                            }
+                        else // subplayer selected is the same as the current one
+                            {
+                            selectedSubplayerIndex = KErrInUse;
+                            }
+                        }
+                    else
+                        {
+                        TRAP_IGNORE( manager.ClearSelectPlayersL() );
+                        if ( playlist )
+                            {
+                            iPlaybackUtility->InitL( *playlist, EFalse );
+                            }
+
+                        DisplayErrorNoteL( R_UPNP_ERROR_PLAYER_UNAVAILABLE );
+                        }
+
+                    if ( playlist )
+                        {
+                        CleanupStack::PopAndDestroy( playlist );
+                        }
+                    } // if ( isSelectedItemASubplayerName )
+                } // check for boundaries
+            else
+                {
+                okToExit = ETrue;
+                selectedSubplayerIndex = KErrCancel;
+                }
+            } // if ( returnValue )
+        else // Cancel was selected
+            {
+            if ( !iPlayerUnavailableError )
+                {
+                if ( iPlaybackUtility )
+                    {
+                    iPlaybackUtility->CancelRequest();
+                    }
+
+                CMPXCommand* cmd = CMPXCommand::NewL();
+                CleanupStack::PushL(cmd);
+                cmd->SetTObjectValueL<TInt>(KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral);
+                // All of current commands are sync
+                cmd->SetTObjectValueL<TBool>(KMPXCommandGeneralDoSync, ETrue);
+                cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralType, EPbCmdUnloadNonActivePlugin);
+                cmd->SetTObjectValueL<TInt>(KMPXCommandPlaybackGeneralData, aPlayerUid);
+                iPlaybackUtility->CommandL(*cmd, NULL);
+                CleanupStack::PopAndDestroy(cmd);
+
+                okToExit = ETrue;
+                selectedSubplayerIndex = KErrCancel;
+                }
+            // else we display the popup again
+            else
+                {
+                iPlayerUnavailableError = EFalse;
+                }
+            }
+        } // while ( !okToExit )
+
+    return selectedSubplayerIndex;
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::PreLayoutDynInitL();
+// called by framework before dialog is shown
+// ---------------------------------------------------------------------------
+void CMPXUPnPBrowseDialog::PreLayoutDynInitL()
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::PreLayoutDynInitL()" );
+
+    // Browse dialog title text
+    HBufC* dialogTitle = StringLoader::LoadLC(R_UPNP_MENU_TITLE_SELECT_PLAYER);
+    iPopup->SetTitleL(*dialogTitle);
+    CleanupStack::PopAndDestroy(dialogTitle);
+
+    // Previous UPNP code
+
+    CAknIconArray* icons = new ( ELeave ) CAknIconArray(2);
+    CleanupStack::PushL(icons);
+
+    // Mif icons
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TFileName iconsPath( AknIconUtils::AvkonIconFileName( ) );
+
+    // Media server icon
+    AppendIconToArrayL( icons, skin,
+                        KAvkonBitmapFile,
+                        KAknsIIDQgnIndiMarkedAdd,
+                        EMbmAvkonQgn_indi_marked_add,
+                        EMbmAvkonQgn_indi_marked_add_mask );
+    iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
+    CleanupStack::Pop(icons);
+
+    // Previous UPNP code
+
+    LoadListItemsL();
+    }
+
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePopup::LoadListItemsL
+// Sends the browse request to MPXPlayerManager. When result set arrives,
+// Playback callback will call the "HandleSubPlayerNamesL" call back method,
+// which is implemented below.
+// --------------------------------------------------------------------------
+void CMPXUPnPBrowseDialog::LoadListItemsL()
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::LoadListItemsL()" );
+
+    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+
+    DisplayWaitingTextL();
+
+    if ( iPlayerManagerStub )
+        {
+        iPlayerManagerStub->SubPlayerNamesL(*this, TUid::Uid(iPlayerUid));
+        }
+    else
+        {
+        MPX_DEBUG1( "CMPXUPnPBrowseDialog::LoadListItemsL() before call to manager.SubPlayerNamesL()" );
+        manager.SubPlayerNamesL(*this, TUid::Uid(iPlayerUid));
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CUPnPBrowsePopup::DisplaySubPlayersNamesL
+// --------------------------------------------------------------------------
+void CMPXUPnPBrowseDialog::DisplaySubPlayersNamesL( const MDesCArray* aSubPlayers,
+                                                    const TBool aComplete )
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::DisplaySubPlayersNamesL()" );
+
+    CTextListBoxModel* model = iListBox->Model();
+    MDesCArray* textArray = model->ItemTextArray();
+    CDesCArray* listBoxItems = static_cast<CDesCArray*>(textArray);
+    TInt subPlayersCount = 0;
+
+    listBoxItems->Reset();
+
+    if ( aSubPlayers )
+        {
+        subPlayersCount = aSubPlayers->MdcaCount();
+        MPX_DEBUG2( "CMPXUPnPBrowseDialog::DisplaySubPlayersNamesL(), aSubPlayer exists %d",
+                    subPlayersCount );
+
+        if ( subPlayersCount > 0 )
+            {
+            for (TInt i=0; i < subPlayersCount; i++)
+                {
+                TPtrC temp = aSubPlayers->MdcaPoint(i);
+                TFileName subPlayerName;
+                
+                subPlayerName.Copy(temp);
+                subPlayerName.TrimAll();        // trim all leading and trailing spaces (including tab)
+                
+                TInt tabPos = subPlayerName.Find(KTab);
+                
+                // replace tab with single space
+                while (tabPos != KErrNotFound)
+                    {
+                    subPlayerName.Replace(tabPos, 1, KSpace);
+                    tabPos = subPlayerName.Find(KTab);
+                    }                
+                
+                // Append name of the subplayer in the listbox
+                if ( iCurrentlySelectedSubPlayerName )
+                    {
+                    if ( !subPlayerName.CompareF( *iCurrentlySelectedSubPlayerName ) )
+                        {
+                        // names are the same and we add the selection icon
+                        TFileName item;
+                        
+                        item.Format(KUPnPBrowseListboxString, &subPlayerName, 0);
+                        listBoxItems->AppendL(item);
+                        }
+                    else
+                        {
+                        listBoxItems->AppendL(subPlayerName);
+                        }
+                    }
+                else
+                    {
+                    listBoxItems->AppendL(subPlayerName);
+                    }
+                }
+
+            // if search is complete we add the <search again> listbox item last
+            if ( aComplete )
+                {
+                HBufC* listText = StringLoader::LoadLC(R_UPNP_LIST_UPNP_MORE_SUBPLAYERS);
+                listBoxItems->AppendL(*listText);
+                CleanupStack::PopAndDestroy( listText );
+                }
+
+            iPopup->ButtonGroupContainer()->SetCommandSetL(
+                                                R_AVKON_SOFTKEYS_SELECT_CANCEL);
+            iPopup->ButtonGroupContainer()->DrawDeferred();
+
+            iListBox->HandleItemAdditionL(); // Update listbox
+            iListBox->SetCurrentItemIndexAndDraw(0); // select new item
+            }
+        }
+
+    if ( !aSubPlayers || (subPlayersCount <= 0) )
+        {
+        if ( aComplete ) // search is complete
+            {
+            HBufC* searchAgainText = StringLoader::LoadLC(R_UPNP_LIST_UPNP_MORE_SUBPLAYERS);
+            listBoxItems->AppendL(*searchAgainText);
+            CleanupStack::PopAndDestroy(searchAgainText);
+
+            iPopup->ButtonGroupContainer()->SetCommandSetL(
+                                                R_AVKON_SOFTKEYS_SELECT_CANCEL);
+            iPopup->ButtonGroupContainer()->DrawDeferred();
+            iListBox->HandleItemAdditionL(); // Update listbox
+            iListBox->SetCurrentItemIndexAndDraw(0); // select new item
+            }
+        else  // not complete, we're still searching
+            {
+            DisplayWaitingTextL();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::HandlePropertyL
+// Handle playback property.
+// ---------------------------------------------------------------------------
+void CMPXUPnPBrowseDialog::HandlePropertyL( TMPXPlaybackProperty /*aProperty*/,
+                                            TInt /*aValue*/,
+                                            TInt /*aError*/)
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::HandlePropertyL()" );
+    // empty
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::HandleSubPlayerNamesL
+// 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 CMPXUPnPBrowseDialog::HandleSubPlayerNamesL( TUid /*aPlayer*/,
+                            const MDesCArray* aSubPlayers,
+                            TBool aComplete,
+                            TInt aError)
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::HandleSubPlayerNamesL()" );
+    MPX_DEBUG3( "CMPXUPnPBrowseDialog::HandleSubPlayerNamesL(complete %d, error: %d)",
+                aComplete, aError );
+
+    if ( aError == KErrNone )
+        {
+        DisplaySubPlayersNamesL(aSubPlayers, aComplete);
+        }
+    else
+        {
+        if ( ( aError == KErrServerTerminated ) ||
+             ( aError == KErrCouldNotConnect ) ||
+             ( aError == KErrWlanNetworkNotFound ))
+            {
+            // defined in errorres.rsg
+            DisplayErrorNoteL( R_ERRE_GE_WLAN_WLAN_NETWORK_LOST );
+            }
+
+        // No error note specified, we can't get list of subplayers so
+        // we just exit the dialog
+        iPopup->CancelPopup();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::HandleMediaL
+// Call back of media request
+// ---------------------------------------------------------------------------
+void CMPXUPnPBrowseDialog::HandleMediaL( const CMPXMedia& /*aProperties*/,
+                                         TInt /*aError*/)
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::HandleMediaL()" );
+    // empty
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::AppendIconToArrayL
+// Load a possibly skinned icon (with mask) and append it to an
+// icon array.
+// ---------------------------------------------------------------------------
+void CMPXUPnPBrowseDialog::AppendIconToArrayL(CAknIconArray* aArray,
+                                               MAknsSkinInstance* aSkin,
+                                               const TDesC& aMbmFile,
+                                               const TAknsItemID& aID,
+                                               TInt aBitmapId,
+                                               TInt aMaskId)
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::AppendIconToArrayL()" );
+
+    __ASSERT_DEBUG(aArray != NULL, User::Leave(KErrArgument));
+
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+
+    AknsUtils::CreateIconLC(aSkin, aID,
+        bitmap, mask, aMbmFile, aBitmapId, aMaskId);
+
+    CGulIcon* icon = CGulIcon::NewL(bitmap, mask);
+    icon->SetBitmapsOwnedExternally(EFalse);
+
+    // icon now owns the bitmaps, no need to keep on cleanup stack.
+    CleanupStack::Pop(2); // mask, bitmap
+    bitmap = NULL;
+    mask = NULL;
+
+    CleanupStack::PushL(icon);
+    aArray->AppendL(icon);
+
+    // aArray now owns the icon, no need to delete.
+    CleanupStack::Pop();
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::CreatePopupL
+// Creates a selection popup.
+// ---------------------------------------------------------------------------
+void CMPXUPnPBrowseDialog::CreatePopupL()
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::CreatePopupL()" );
+
+    // Create and configure the list box
+    if ( iListBox )
+        {
+        delete iListBox;
+        iListBox = NULL;
+        }
+    iListBox = new (ELeave) CAknSinglePopupMenuStyleListBox;
+    iPopup = CAknPopupList::NewL(iListBox,
+                                 R_MPX_SOFTKEYS_UPNP_EMPTY_CANCEL,
+                                 AknPopupLayouts::EDynMenuWindow);
+    iListBox->ConstructL(iPopup, EAknListBoxSelectionList);
+    iListBox->CreateScrollBarFrameL( ETrue );
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
+        CEikScrollBarFrame::EOff,
+        CEikScrollBarFrame::EAuto );
+    // Enable Marquee
+    CEikFormattedCellListBox* eikListbox = 
+    static_cast<CEikFormattedCellListBox*>( iListBox );
+    eikListbox->EnableExtendedDrawingL();
+    eikListbox->ItemDrawer()->FormattedCellData()->EnableMarqueeL( ETrue );
+    PreLayoutDynInitL();
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::StartPopupL
+// Parses the friendly names from the list of UPnPDevices and
+// executes the selection dialog. Returns 0 or 1 (Cancel or Select)
+// ---------------------------------------------------------------------------
+//
+TInt CMPXUPnPBrowseDialog::StartPopupL()
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::StartPopupL()" );
+
+    TInt popupOk = iPopup->ExecuteLD();
+    iPopup = NULL;
+    return popupOk;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPBrowseDialog::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::HandlePlaybackMessage()" );
+
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::RetrieveCurrentlySelectSubplayerNameL
+// Retrieves the name and other info of the currently used subplayer
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPBrowseDialog::RetrieveCurrentlySelectSubplayerNameL()
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::RetrieveCurrentlySelectSubplayerName()" );
+
+    if ( iCurrentlySelectedSubPlayerName )
+        {
+        delete iCurrentlySelectedSubPlayerName;
+        iCurrentlySelectedSubPlayerName = NULL;
+        }
+
+    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+    TMPXPlaybackPlayerType playerType;
+    TInt currentlyUsedSubPlayer;
+    MPX_DEBUG1( "CMPXUPnPBrowseDialog::RetrieveCurrentlySelectSubplayerName() before call to manager.GetSelectionL()" );
+    MPX_TRAPD( errorSelectSubPlayer, manager.GetSelectionL( playerType,
+                                                        iCurrentlyUsedPlayer,
+                                                        currentlyUsedSubPlayer,
+                                                        iCurrentlySelectedSubPlayerName));
+    MPX_DEBUG4( "CMPXUPnPBrowseDialog::RetrieveCurrentlySelectSubplayerName() after call to manager.GetSelectionL(%d, %d, %d)",
+                                                        playerType,
+                                                        iCurrentlyUsedPlayer.iUid,
+                                                        currentlyUsedSubPlayer );
+    if (iCurrentlySelectedSubPlayerName)
+        {
+        MPX_DEBUG2( "CMPXUPnPBrowseDialog::RetrieveCurrentlySelectSubplayerName() after call to manager.GetSelectionL(%S)",
+                                                        iCurrentlySelectedSubPlayerName );
+        }
+    if ( errorSelectSubPlayer != KErrNone  && iCurrentlySelectedSubPlayerName )
+        {
+        MPX_DEBUG2( "CMPXUPnPBrowseDialog::RetrieveCurrentlySelectSubplayerName() after call to manager.GetSelectionL() error %d",
+                                                        errorSelectSubPlayer );
+        delete iCurrentlySelectedSubPlayerName;
+        iCurrentlySelectedSubPlayerName = NULL;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::DisplayErrorNoteL
+// Retrieves the name and other info of the currently used subplayer
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPBrowseDialog::DisplayErrorNoteL( TInt aResourceId )
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::DisplayErrorNoteL()" );
+
+    // error note
+    HBufC* dialogText = StringLoader::LoadLC( aResourceId );
+    CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+    errNote->SetTimeout(CAknNoteDialog::ELongTimeout);
+    errNote->ExecuteLD( *dialogText );
+    CleanupStack::PopAndDestroy( dialogText );
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXUPnPBrowseDialog::DisplayWaitingTextL
+// Displays the waiting text during retrieval of subplayer names
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPBrowseDialog::DisplayWaitingTextL()
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::DisplayWaitingTextL()" );
+
+    if ( iListBox && iListBox->View() )
+        {
+        HBufC* waitText = StringLoader::LoadLC(R_UPNP_DIALOG_WAITING_FOR_DEVICES);
+        iListBox->View()->SetListEmptyTextL(*waitText);
+        CleanupStack::PopAndDestroy(waitText);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPBrowseDialog::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXUPnPBrowseDialog::DoHandlePlaybackMessageL" );
+
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EPlayerUnavailable:
+                {
+                MPX_DEBUG2( "HandlePlaybackMessageL - EPlayerUnavailable(%d)", type );
+                TUid activeView = iViewUtility->ActiveViewType();
+                if ( activeView == TUid::Uid( KMPXPluginTypeUPnPBrowseDialogUid ) )
+                    {
+                    iPlayerUnavailableError = ETrue;
+                    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+                    TRAP_IGNORE( manager.ClearSelectPlayersL() );
+                    DisplayErrorNoteL( R_UPNP_ERROR_PLAYER_UNAVAILABLE );
+
+                    iPopup->CancelPopup();
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/bwinscw/mpxupnpplaybackdialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	??1CMPXUPnPPlaybackDialog@@UAE@XZ @ 1 NONAME ; CMPXUPnPPlaybackDialog::~CMPXUPnPPlaybackDialog(void)
+	?NewL@CMPXUPnPPlaybackDialog@@SAPAV1@XZ @ 2 NONAME ; class CMPXUPnPPlaybackDialog * CMPXUPnPPlaybackDialog::NewL(void)
+	?SetParamL@CMPXUPnPPlaybackDialog@@QAEXPBVTDesC16@@@Z @ 3 NONAME ; void CMPXUPnPPlaybackDialog::SetParamL(class TDesC16 const *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/data/mpxupnpplaybackdialog.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project upnpplayback dialog
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MXUP // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <data_caging_paths_strings.hrh>
+#include <mpxcommonplaybackview.mbg>
+#include <mpxcommonplaybackview.rsg>
+#include <aknsconstants.hrh>
+
+#include "mpxupnpplaybackdialog.hrh"
+
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_upnp_playback_dialog_menubar
+// Album art dialog menu bar.
+// -----------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_cui_upnp_playback_dialog_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            { 
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_cui_upnp_playback_dialog
+// UPnP Playback dialog.
+// -----------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_cui_upnp_playback_dialog
+    {
+    title="";
+    buttons = R_AVKON_SOFTKEYS_CLOSE;
+    flags = EAknDialogGenericFullScreen;
+    items = 
+        {
+        DLG_LINE
+            {
+            id=EMPXUPnPPlaybackDlgCtrlId;
+            type=EMPXUPnPPlaybackDlg;
+            } //Image DLG_LINE
+        };
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_pbv_touch_toolbar_previous_item_btn
+// previous item button on toolbar
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON r_mpx_pbv_touch_toolbar_previous_item_btn
+    {
+    flags = KAknButtonReportOnLongPress;
+    states =
+        {
+        AVKON_BUTTON_STATE
+            {
+            bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+            bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev; 
+            bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev_mask;
+            dim_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev_dimmed;
+            dim_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev_dimmed_mask;
+            press_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev_focused;
+            press_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_prev_focused_mask;
+            extension = R_MPX_PBV_TOUCH_TOOLBAR_PREV_BUTTON_STATE_EXTENSION;
+            }
+        };            
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_pbv_touch_toolbar_playpause_btn
+// playpause item button on toolbar
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON r_mpx_pbv_touch_toolbar_playpause_btn
+    {
+    flags = 0;
+    states =
+        {
+        AVKON_BUTTON_STATE
+            {
+            bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+            bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause; 
+            bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause_mask;
+            dim_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause_dimmed;
+            dim_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause_dimmed_mask;
+            press_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause_focused;
+            press_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_pause_focused_mask;
+            extension = R_MPX_PBV_TOUCH_TOOLBAR_PAUSE_BUTTON_STATE_EXTENSION;
+            },                 
+        AVKON_BUTTON_STATE
+            {
+            bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+            bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2; 
+            bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2_mask;
+            dim_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2_dimmed;
+            dim_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2_dimmed_mask;
+            press_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2_focused;
+            press_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_play2_focused_mask;
+            extension = R_MPX_PBV_TOUCH_TOOLBAR_PLAY_BUTTON_STATE_EXTENSION;
+            }                 
+        };            
+    }
+
+// -----------------------------------------------------------------------------
+// r_mpx_pbv_touch_toolbar_next_item_btn
+// next item button on toolbar
+// -----------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON r_mpx_pbv_touch_toolbar_next_item_btn
+    {
+    flags = KAknButtonReportOnLongPress;
+    states =
+        {
+        AVKON_BUTTON_STATE
+            {
+            bmpfile=BITMAP_DIR"\\mpxcommonplaybackview.mif";
+            bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next; 
+            bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next_mask;
+            dim_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next_dimmed;
+            dim_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next_dimmed_mask;
+            press_bmpid=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next_focused;
+            press_bmpmask=EMbmMpxcommonplaybackviewQgn_prop_image_tb_next_focused_mask;
+            extension = R_MPX_PBV_TOUCH_TOOLBAR_NEXT_BUTTON_STATE_EXTENSION;
+            }                 
+        };            
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/eabi/mpxupnpplaybackdialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+	_ZN22CMPXUPnPPlaybackDialog4NewLEv @ 1 NONAME
+	_ZN22CMPXUPnPPlaybackDialog9SetParamLEPK7TDesC16 @ 2 NONAME
+	_ZN22CMPXUPnPPlaybackDialogD0Ev @ 3 NONAME
+	_ZN22CMPXUPnPPlaybackDialogD1Ev @ 4 NONAME
+	_ZN22CMPXUPnPPlaybackDialogD2Ev @ 5 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxupnpplaybackdialog.
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+mpxupnpplaybackdialog.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/group/mpxupnpplaybackdialog.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxupnpplaybackdialog.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxupnpplaybackdialog.dll
+TARGETTYPE      dll
+UID             0x10009D8D 0x101FFCBB
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+SOURCEPATH      ../src
+SOURCE          mpxupnpplaybackdialog.cpp
+SOURCE          mpxupnpplaybackdialogcustomcontrol.cpp
+SOURCE          mpxupnpplaybackdialogcustomcontrolcontainer.cpp
+SOURCE          mpxupnpplaybackdialoglayout.cpp
+
+START RESOURCE  ../data/mpxupnpplaybackdialog.rss
+DEPENDS mpxcommonplaybackview.rsg
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         eikdlg.lib
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         fbscli.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         commonengine.lib
+LIBRARY         mgfetch.lib
+LIBRARY         estor.lib
+LIBRARY         aknskins.lib
+LIBRARY         egul.lib    // CGulIcon
+LIBRARY         aknicon.lib // AknIconUtils
+LIBRARY         centralrepository.lib
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         cdlengine.lib
+LIBRARY         apgrfx.lib  // RApaLsSession
+LIBRARY         featmgr.lib
+LIBRARY         hwrmfmtxclient.lib // For FF_FMTX
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxcommonplaybackview.lib
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcollectionhelper.lib
+LIBRARY         mpxmediakeyhandler.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/inc/mpxupnpplaybackdialog.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxupnpplaybackdialog
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKDIALOG_HRH
+#define MPXUPNPPLAYBACKDIALOG_HRH
+
+// ENUMS
+
+enum TMPXUPnPPlaybackDlgCtrlIds
+    {
+    EMPXUPnPPlaybackDlgCtrlId = 1
+    };
+
+// UPnP Playback dialog custom controls
+enum TMPXUPnPPlaybackDlgCustomControls
+    {
+    EMPXUPnPPlaybackDlg = 0x800 
+    };
+    
+#endif  // MPXUPNPPLAYBACKDIALOG_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/inc/mpxupnpplaybackdialogcustomcontrol.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,154 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player upnp playback dialog declaration
+*
+*/
+
+
+#ifndef C_CMPXUPNPPLAYBACKDIALOGCUSTOMCONTROL_H
+#define C_CMPXUPNPPLAYBACKDIALOGCUSTOMCONTROL_H
+
+
+// INCLUDES
+#include <coecntrl.h>
+#include "mpxcommonplaybackviewcontainer.h"
+
+// FORWARD DECLARATIONS
+class CMPXUPnPPlaybackDialog;
+class CAknsBasicBackgroundControlContext;
+class MMPXLayoutSwitchObserver;
+class MMPXPlaybackViewLayout;
+
+// CLASS DECLARATION
+
+/**
+ * The custom control for UPnP playback Dialog.
+ */
+NONSHARABLE_CLASS( CMPXUPnPPlaybackDialogCustomControl ) : public CMPXCommonPlaybackViewContainer
+    {
+public:           
+
+public:  // Constructors and destructor
+
+    /**
+     * Two-phased constructor. Leaves on failure. Places the instance on the
+     * cleanup stack.
+     * @param aParent Parent control.
+     * @param aRect The control's extent.
+     * @param aCommandObserver  Observer for commands.
+     * @param aLayoutObserver   Observer to send layout switch events to.
+     * @param aLayout           Pointer to playback view layout.
+     * @return The constructed item.
+     */
+    static CMPXUPnPPlaybackDialogCustomControl* NewLC( const CCoeControl& aParent, 
+                                                       const TRect& aRect,
+                                                       MEikCommandObserver* aCommandObserver,
+                                                       MMPXLayoutSwitchObserver* aLayoutObserver,
+                                                       MMPXPlaybackViewLayout* aLayout,
+                                                       TMPXPlaybackPlayerType aCurrentPlayerType );
+
+    /**
+     * Two-phased constructor. Leaves on failure.
+     * @param aParent Parent control.
+     * @param aRect The control's extent.
+     * @param aCommandObserver  Observer for commands.
+     * @param aLayoutObserver   Observer to send layout switch events to.
+     * @param aLayout           Pointer to playback view layout.
+     * @return The constructed item.
+     */
+    static CMPXUPnPPlaybackDialogCustomControl* NewL( const CCoeControl& aParent, 
+                                                      const TRect& aRect,
+                                                      MEikCommandObserver* aCommandObserver,
+                                                      MMPXLayoutSwitchObserver* aLayoutObserver,
+                                                      MMPXPlaybackViewLayout* aLayout,
+                                                      TMPXPlaybackPlayerType aCurrentPlayerType );
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CMPXUPnPPlaybackDialogCustomControl();       
+    
+
+public: // New functions
+
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since S60 3.0
+     */
+    void UpdateLayout();
+    
+// from base class CoeControl
+
+    /**
+     * From CoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    
+private:    // new methods
+
+    /**
+     * Creates icons.
+     */
+    void CreateIconsL();
+
+    /**
+     * Redraw part of the screen to the bitmap context.
+     *
+     * @param aRect Area to be redrawn.
+     * @param aGc Graphics context to draw to.
+     */
+    void RedrawRect(
+        const TRect& aRect,
+        CBitmapContext& aGc) const;
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXUPnPPlaybackDialogCustomControl(
+                    MEikCommandObserver* aCommandObserver,
+                    MMPXLayoutSwitchObserver* aLayoutObserver,
+                    MMPXPlaybackViewLayout* aLayout );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     * @param aParent Parent control.
+     * @param aRect The control's extent.
+     */
+    void ConstructL( const CCoeControl& aParent, 
+                     const TRect &aRect,
+                     TMPXPlaybackPlayerType aCurrentPlayerType );
+    
+private:    // data
+   
+    CAknsBasicBackgroundControlContext* iBackground;
+        
+    CGulIcon* iRemotePlayerIcon;    // owned
+    TRect iRemotePlayerIconRect;
+    TBool iRemotePlayerUsed;
+    };
+
+#endif      // C_CMPXUPNPPLAYBACKDIALOGCUSTOMCONTROL_H 
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/inc/mpxupnpplaybackdialogcustomcontrolcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player UPnP Playback dialog declaration
+*
+*/
+
+
+#ifndef MPXUPNPPLAYBACKDIALOGCUSTOMCONTROLCONTAINER_H
+#define MPXUPNPPLAYBACKDIALOGCUSTOMCONTROLCONTAINER_H
+
+// INCLUDE FILES
+#include <coecntrl.h>
+
+// FORWARD DECLARATIONS
+class CMPXUPnPPlaybackDialogCustomControl;
+
+// CLASS DECLARATION
+
+/**
+ *  The container for the custom control in UPnP Playback Dialog
+ */
+NONSHARABLE_CLASS(CMPXUPnPPlaybackDialogCustomControlContainer) : public CCoeControl 
+    {
+public:  // Constructors and destructor
+    
+    /**
+     * Destructor.
+     */
+    ~CMPXUPnPPlaybackDialogCustomControlContainer(); 
+
+public: // New functions
+    
+    /**
+     * Draw function removes flicker from CEikDialog's Draw()..
+     * @param TRect The container's extent
+     */
+    void Draw( const TRect & ) const;
+    
+public: // from base classes
+    
+    /**
+     * From CoeControl.
+     * Handles a change to the control's resources.
+     *
+     * @param aType A message UID value.
+     */
+    void HandleResourceChange( TInt aType );     
+
+public:     // Data
+
+    CMPXUPnPPlaybackDialogCustomControl* iDialogCustomControl; // Custom Control
+    
+    };
+
+#endif      // MPXUPNPPLAYBACKDIALOGCUSTOMCONTROLCONTAINER_H 
+            
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/inc/mpxupnpplaybackdialoglayout.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  An interface providing skin and layout data for upnp playback dialog.
+*
+*/
+
+
+#ifndef C_CMPXUPNPPLAYBACKDIALOGLAYOUT_H
+#define C_CMPXUPNPPLAYBACKDIALOGLAYOUT_H
+
+//  INCLUDES
+#include "mpxcommonplaybackviewlayout.h"
+
+// CLASS DECLARATION
+
+/**
+*  An interface providing skin and layout data for playback view.
+*
+*  @lib mpxupnpplaybackdialog.dll
+*  @since S60 v3.0
+*/
+NONSHARABLE_CLASS( CMPXUPnPPlaybackDialogLayout ) : public CMPXCommonPlaybackViewLayout
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXUPnPPlaybackDialogLayout* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXUPnPPlaybackDialogLayout* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXUPnPPlaybackDialogLayout();
+
+    /**
+     * Get layout data for an graphical indicator.
+     *
+     * @since 3.0
+     * @param aParentRect Parent control's rect
+     * @param  aIndicator Enumeration value identifying the indicator
+     * @return Layout data
+     */
+    TRect IndicatorLayout(
+        const TRect& aParentRect,
+        TMPXPbvIndicator aIndicator );
+
+    /**
+     * Get the bitmap and mask for a given indicator.
+     *
+     * @since 3.0
+     * @param  aIndicator   Enumeration value identifying the indicator
+     * @return CGulIcon     Indicator graphic and mask. Ownership 
+     *                      transferred to caller.
+     */
+    CGulIcon* GetIndicatorIconMaskL(
+        TMPXPbvIndicator aIndicator );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXUPnPPlaybackDialogLayout();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    };
+
+#endif  // C_CMPXUPNPPLAYBACKDIALOGLAYOUT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/src/mpxupnpplaybackdialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,2585 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player upnp playback dialog implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <StringLoader.h>
+#include <akntitle.h>
+#include <aknnotewrappers.h>
+#include <aknnavide.h>
+#include <aknnavilabel.h>
+#include <coeutils.h>
+#include <hlplch.h>
+#include <bautils.h>
+#include <centralrepository.h>
+#include <bldvariant.hrh>
+#include <caf/caferr.h>
+#include <aknsoundsystem.h>
+#include <apgcli.h>             // RApaLsSession
+#include <ctsydomainpskeys.h>
+
+#include <featmgr.h>
+#include <hwrmfmtx.h> // TFmTxState, for FF_FMTX
+
+#ifdef __SERIES60_31__
+#include <upnpnetworkaccess.h>  // KCRUidUPnPApplication, KUPnPAppAccessPoint
+#else
+#include <upnpsettings.h>
+#endif
+
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionutility.h>
+#include <mpxmediakeyhandler.h>
+
+#include <data_caging_path_literals.hrh>
+#include <layoutmetadata.cdl.h>
+#include <mpxcommonplaybackview.rsg>
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxmessagegeneraldefs.h>   // KMPXMessageGeneralId
+#include <mpxplaybackmessagedefs.h>  // KMPXMessagePbMediaChanged, KMPXMessagePbMedia
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionpath.h>
+#include <mpxviewutility.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmediadrmdefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcommandgeneraldefs.h>
+
+
+#include <mpxconstants.h>
+#include <mpxappui.hrh>
+#include "mpxcommonplaybackview.hrh"
+#include "mpxalbumartutil.h"
+#include "mpxcommonuihelper.h"
+#include <mpxinternalcrkeys.h>
+#include <mpxtlshelper.h>
+#include <mpxlog.h>
+#include <mpxuser.h>
+#include <akntoolbar.h> 
+#include <aknbutton.h> 
+
+#include "mpxupnpplaybackdialog.hrh"
+#include "mpxupnpplaybackdialogcustomcontrol.h"
+#include <mpxupnpplaybackview.rsg>
+#include "mpxupnpplaybackdialogcustomcontrolcontainer.h"
+#include "mpxupnpplaybackdialog.h"
+#include "mpxupnpplaybackdialoglayout.h"
+#include <mpxupnpplaybackdialog.rsg>
+
+// CONSTANTS
+const TInt KMPXOneSecInMilliSecs( 1000 );
+
+_LIT( KMPXUPnPPlaybackDialogRscPath, "mpxUpnpPlaybackdialog.rsc" );
+_LIT( KMPXCommonPlaybackRscPath, "mpxcommonplaybackview.rsc" );
+_LIT( KMPXUpnpPlaybackRscPath, "mpxupnpplaybackview.rsc" );
+
+_LIT( KMPXFMTXRscPath, "mpxfmtx.rsc" ); // For FF_FMTX
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+_LIT(KMPXPnRealAudioMimeType, "audio/x-pn-realaudio");
+_LIT(KMPXRealAudioMimeType, "audio/x-realaudio");
+_LIT(KMPXRnRealAudioMimeType, "audio/vnd.rn-realaudio");
+#endif
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CMPXUPnPPlaybackDialog* CMPXUPnPPlaybackDialog::NewL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::NewL" );
+    CMPXUPnPPlaybackDialog* self =
+        new ( ELeave ) CMPXUPnPPlaybackDialog();
+    CleanupStack::PushL( self );
+    self->ConstructL( R_MPX_CUI_UPNP_PLAYBACK_DIALOG_MENUBAR );
+    CleanupStack::Pop( self );  // this, it will be PushL-d by executeLD...
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::CMPXUPnPPlaybackDialog
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialog::CMPXUPnPPlaybackDialog()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::SetParamL
+// parameter passed in from viewframework
+// ----------------------------------------------------------------------------
+//
+EXPORT_C void CMPXUPnPPlaybackDialog::SetParamL( const TDesC* /*aParam*/ )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::SetParamL" );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::ConstructL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::ConstructL( TInt aResource )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::ConstructL" );
+    CCoeEnv* coeEnv = iEikonEnv;
+    TParse parse;
+    parse.Set( KMPXUPnPPlaybackDialogRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    parse.Set( KMPXCommonPlaybackRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName playbackResourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( playbackResourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), playbackResourceFile );
+    iCommonPlaybackResourceOffset = coeEnv->AddResourceFileL( playbackResourceFile );
+
+    parse.Set( KMPXUpnpPlaybackRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName upnpResourceFile = parse.FullName();
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( upnpResourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), upnpResourceFile );
+    iUpnpResourceOffset = coeEnv->AddResourceFileL( upnpResourceFile );
+
+    // CommonPlaybackViewLayout uses this rsc file so it needs to be loaded
+	if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+		{
+		parse.Set( KMPXFMTXRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+		TFileName fmtxResourceFile( parse.FullName() );
+		User::LeaveIfError( MPXUser::CompleteWithDllPath( fmtxResourceFile ) );
+		BaflUtils::NearestLanguageFile( coeEnv->FsSession(), fmtxResourceFile );
+		iFMTXResourceOffset = coeEnv->AddResourceFileL( fmtxResourceFile );
+		}
+
+    // Get the playback utility instance from engine.
+    iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+    iPlaybackUtility->AddObserverL( *this );
+
+    iMPXUtility = CMPXAlbumArtUtil::NewL();
+    iCommonUiHelper = CMPXCommonUiHelper::NewL();
+
+    iEmbedded = iEikonEnv->StartedAsServerApp();
+
+    // Get an instance of view utility
+    iViewUtility = MMPXViewUtility::UtilityL();
+
+    TInt flags( 0 );
+    CRepository* repository( CRepository::NewL( KCRUidMPXMPFeatures ));
+    User::LeaveIfError( repository->Get( KMPXMPLocalVariation, flags ));
+    delete repository;
+    repository = NULL;
+
+    iChangeRTForAllProfiles =
+        static_cast<TBool>( flags & KMPXChangeRTForAll );
+
+    iCollectionUtility = MMPXCollectionUtility::NewL();
+
+    iStartPlaybackIndex = KErrNotFound;
+    iLastSkipDirection = 1;
+
+    if ( !iMediaKeyHandler )
+        {
+        // Handle media key in appui
+        iMediaKeyHandler = MMPXMediaKeyHandler::NewL(
+            EDisplayVolumePopup | EDisplayMediaPopup,
+            this );
+        }
+
+    CAknDialog::ConstructL( aResource );
+    if ( AknLayoutUtils::PenEnabled())
+        {
+        CAknAppUi* appUi = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi());
+        iToolbar = appUi->CurrentFixedToolbar();
+        if ( iToolbar )
+            {
+            iBtnPreviousItem = 
+                CAknButton::NewL( R_MPX_PBV_TOUCH_TOOLBAR_PREVIOUS_ITEM_BTN );
+            iBtnNextItem = 
+                CAknButton::NewL( R_MPX_PBV_TOUCH_TOOLBAR_NEXT_ITEM_BTN );
+            iBtnPlayPause = 
+                CAknButton::NewL( R_MPX_PBV_TOUCH_TOOLBAR_PLAYPAUSE_BTN );
+            
+            iToolbar->AddItemL( iBtnPreviousItem, EAknCtButton, 
+                    EMPXPbvCmdPreviousListItem, KAknButtonReportOnLongPress );
+            iToolbar->AddItemL( iBtnPlayPause, EAknCtButton, 
+                    EMPXPbvCmdPlayPause, 0 );
+            iToolbar->AddItemL( iBtnNextItem, EAknCtButton, 
+                    EMPXPbvCmdNextListItem, KAknButtonReportOnLongPress );
+            
+            iToolbar->SetToolbarVisibility( ETrue );
+            iToolbar->SetToolbarObserver( this );
+            }
+        }
+    }
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXUPnPPlaybackDialog::~CMPXUPnPPlaybackDialog()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::~CMPXUPnPPlaybackDialog" );
+
+    delete iMPXUtility;
+    delete iMedia;
+    delete iCommonUiHelper;
+
+    if ( iPlaybackUtility )
+        {
+        TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+        iPlaybackUtility->Close();
+        }
+
+    if ( iViewUtility )
+        {
+        iViewUtility->Close();
+        }
+
+    if ( iResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iResourceOffset );
+        }
+
+    if ( iCommonPlaybackResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iCommonPlaybackResourceOffset );
+        }
+
+    iPlayersList.Close();
+    delete iSubPlayerName;
+
+    if ( iUpnpResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iUpnpResourceOffset );
+        }
+
+	if ( iFMTXResourceOffset )
+		{
+		iEikonEnv->DeleteResourceFile( iFMTXResourceOffset );
+		}
+
+    if ( iCollectionUtility )
+        {
+        iCollectionUtility->Close();
+        }
+
+    if ( iKeySoundDisabled )
+        {
+        iAvkonAppUi->KeySounds()->PopContext();
+        }
+    delete iOrigTitle;
+    delete iPlaybackDialogLayout;
+
+    delete iMediaKeyHandler;
+
+    if ( iDelayedEventExit )
+        {
+        iDelayedEventExit->Cancel();
+        }
+    delete iDelayedEventExit;
+    }
+
+// ---------------------------------------------------------------------------
+// Updates playback view.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::UpdateViewL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::UpdateViewL" );
+
+    if ( GetUPnPPlaybackDialogCustomControl() && !iSwitchingView )
+        {
+        UpdatePlaybackState( iPlaybackState );
+        UpdateTrackInfoL( iMedia );
+        UpdateTrackPlaybackPositionL( iPosition, iDuration );
+        UpdateTrackPosInPlaylistL();
+        UpdateAlbumArtL( iMedia );
+        UpdateDownloadStateLabelL();
+
+        // Retrieve current repeat & random modes
+        iPlaybackUtility->PropertyL( *this, EPbPropertyRandomMode );
+        iPlaybackUtility->PropertyL( *this, EPbPropertyRepeatMode );
+        iPlaybackUtility->PropertyL( *this, EPbPropertyVolume);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates track info field.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::UpdateTrackInfoL(
+    const CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::UpdateTrackInfo" );
+
+    if ( GetUPnPPlaybackDialogCustomControl() && !iSwitchingView )
+        {
+        if ( aMedia )
+            {
+            if ( aMedia->IsSupported( KMPXMediaGeneralTitle ) )
+                {
+                GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                    ETextTrack,
+                    aMedia->ValueText( KMPXMediaGeneralTitle ) );
+                }
+            else if ( aMedia->IsSupported( KMPXMediaGeneralUri ) )
+                {
+                TParsePtrC filePath(
+                    aMedia->ValueText( KMPXMediaGeneralUri ) );
+                GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                    ETextTrack, filePath.Name() );
+                }
+            else
+                {
+                GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                    ETextTrack, KNullDesC );
+                }
+
+            if ( aMedia->IsSupported( KMPXMediaMusicArtist ) )
+                {
+                const TDesC& artist =
+                    aMedia->ValueText( KMPXMediaMusicArtist );
+                if ( artist != KNullDesC )
+                    {
+                    GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                        ETextArtist,
+                        artist );
+                    }
+                else
+                    {
+                    if ( !iSkipping )
+                        {
+                        // Display unknown artist as artist
+                        HBufC* unknownArtistText =
+                            StringLoader::LoadLC( R_MPX_PBV_UNKNOWN_ARTIST_LABEL );
+                        GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                            ETextArtist, *unknownArtistText );
+                        CleanupStack::PopAndDestroy( unknownArtistText );
+                        }
+                    else
+                        {
+                        GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                            ETextArtist, KNullDesC );
+                        }
+                    }
+                }
+            else
+                {
+                GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                    ETextArtist, KNullDesC );
+                }
+
+#ifdef RD_RA_SUPPORT_FOR_MUSIC_PLAYER
+            if ( aMedia->IsSupported( KMPXMediaGeneralMimeType ) )
+                {
+                // Get mime type
+                const TDesC& mimeType = aMedia->ValueText(
+                                                KMPXMediaGeneralMimeType );
+
+                const TBool realAudioMode =
+                    ( mimeType.Compare( KMPXPnRealAudioMimeType ) == 0 ) ||
+                    ( mimeType.Compare( KMPXRealAudioMimeType ) == 0) ||
+                    ( mimeType.Compare( KMPXRnRealAudioMimeType ) == 0 );
+
+                MPX_DEBUG2("CMPXUPnPPlaybackDialog::UpdateTrackInfoL() mimeType: %S", &mimeType);
+                // Set the real audio mode
+                GetUPnPPlaybackDialogCustomControl()->SetRealAudioMode( realAudioMode );
+                }
+            else
+                {
+                GetUPnPPlaybackDialogCustomControl()->SetRealAudioMode( EFalse );
+                }
+#endif
+            }
+        else
+            {
+            // Display nothing if properties is NULL
+            GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                ETextTrack, KNullDesC );
+            GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                ETextArtist, KNullDesC );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Update current playback state.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::UpdatePlaybackState(
+    TMPXPlaybackState aPlaybackState )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::UpdatePlaybackState()" );
+    MPX_DEBUG2("CMPXUPnPPlaybackDialog::UpdatePlaybackState(%d): Entering", aPlaybackState);
+
+    if ( GetUPnPPlaybackDialogCustomControl() && !iSwitchingView )
+        {
+        TMPXPbvPlaybackMode mode( EInvalidMode );
+
+        switch ( aPlaybackState )
+            {
+            case EPbStateNotInitialised:
+                {
+                mode = ENoTracksMode;
+                break;
+                }
+            case EPbStateInitialising:
+            case EPbStateDownloading:
+                {
+                mode = EInitialising;
+                break;
+                }
+            case EPbStatePlaying:
+                {
+                mode = EPlayMode;
+                break;
+                }
+            case EPbStatePaused:
+                {
+                mode = EPauseMode;
+                break;
+                }
+            case EPbStateStopped:
+                {
+                mode = EStopMode;
+                break;
+                }
+            default:
+                {
+                // Pass
+                break;
+                }
+            }
+
+        if ( EInvalidMode != mode )
+            {
+            iPlaybackState = aPlaybackState;
+            GetUPnPPlaybackDialogCustomControl()->SetMode( mode );
+            }
+
+        GetUPnPPlaybackDialogCustomControl()->UpdateButtons( aPlaybackState );
+        UpdateToolbar();
+        }
+    else
+        {
+        // If no container, just need to update state
+        switch ( aPlaybackState )
+            {
+            case EPbStateNotInitialised:
+            case EPbStateInitialising:
+            case EPbStateDownloading:
+            case EPbStatePlaying:
+            case EPbStatePaused:
+            case EPbStateStopped:
+                {
+                iPlaybackState = aPlaybackState;
+                break;
+                }
+            default:
+                {
+                // Pass
+                // Ignore other state changes such as skipping, etc.
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates track's playback position.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::UpdateTrackPlaybackPositionL(
+    TInt aPos,
+    TInt aDuration )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::UpdateTrackPlaybackPosition" );
+
+    if ( GetUPnPPlaybackDialogCustomControl() && !iSwitchingView )
+        {
+        if ( aPos > aDuration )
+            {
+            aPos = aDuration;
+            }
+        switch ( iPlaybackState )
+            {
+            case EPbStatePaused:
+            case EPbStatePlaying:
+                {
+                GetUPnPPlaybackDialogCustomControl()->UpdateTimeIndicatorsL( aPos, aDuration );
+                break;
+                }
+            case EPbStateStopped:
+                {
+                GetUPnPPlaybackDialogCustomControl()->UpdateTimeIndicatorsL( aPos, aDuration );
+                } // falls through
+            case EPbStateNotInitialised:
+                {
+                GetUPnPPlaybackDialogCustomControl()->UpdateDurationLabelL( aDuration );
+                break;
+                }
+            default:
+                {
+                // Do nothing
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates track's album art.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::UpdateAlbumArtL(
+    const CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::UpdateAlbumArt" );
+
+    if ( GetUPnPPlaybackDialogCustomControl() && !iSwitchingView )
+        {
+        TInt err( KErrNone );
+        if ( aMedia )
+            {
+            TRect albumArtRect(
+                iPlaybackDialogLayout->IndicatorLayout(
+                    iModRect, EAlbumArtArea ) );
+
+            MPX_TRAP( err,
+                iMPXUtility->ExtractAlbumArtL(
+                    *aMedia,
+                    *GetUPnPPlaybackDialogCustomControl(),
+                    albumArtRect.Size() ); );
+            }
+
+        if ( !aMedia || KErrNone != err )
+            {
+            // If error, show default album art
+            MPX_DEBUG2("CMPXUPnPPlaybackDialog::UpdateAlbumArt(): err = %d", err);
+            GetUPnPPlaybackDialogCustomControl()->ExtractAlbumArtCompleted( NULL, KErrNone );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates track position in playlist field.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::UpdateTrackPosInPlaylistL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::UpdateTrackPosInPlaylist" );
+
+    if ( GetUPnPPlaybackDialogCustomControl() && !iSwitchingView )
+        {
+        TBool emptyCount( EFalse );
+        TInt count( 0 );
+        TInt index( 0 );
+
+        MMPXSource* s = iPlaybackUtility->Source();
+        if ( s )
+            {
+            CMPXCollectionPlaylist* playlist = s->PlaylistL();
+            if ( playlist )
+                {
+                count = playlist->Count();
+                index = playlist->Index();
+                delete playlist;
+                playlist = NULL;
+                }
+            }
+        MPX_DEBUG3("CMPXUPnPPlaybackDialog::UpdateTrackPosInPlaylistL: index = %d, count = %d", index, count );
+
+        // not display for progressive mode & embedded track mode
+        TMPXLaunchMode mode = MPXTlsHelper::LaunchMode();
+
+        if ( count )
+            {
+            if ( EMPXLaunchModeTrack != mode )
+                {
+                // Current index (1-based) if playlist is non-empty
+                // Magic: array granularity
+                CArrayFixFlat<TInt>* params =
+                    new ( ELeave ) CArrayFixFlat<TInt>( 2 );
+                CleanupStack::PushL( params );
+                params->AppendL( index + 1 );
+                params->AppendL( count );
+                HBufC* plcounter = StringLoader::LoadLC(
+                    R_MPX_PBV_PLAYLIST_ITEM_COUNTER_LABEL, *params );
+                GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                    ETextPlaylistCount,
+                    *plcounter );
+                CleanupStack::PopAndDestroy( plcounter );
+                CleanupStack::PopAndDestroy( params );
+                }
+            else
+                {
+                emptyCount = ETrue;
+                }
+            }
+        else
+            {
+            emptyCount = ETrue;
+
+            // Display empty state text
+            HBufC* noTracksText =
+                StringLoader::LoadLC( R_MPX_PBV_NO_TRACKS_LABEL );
+            GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                ETextEmpty, *noTracksText );
+            CleanupStack::PopAndDestroy( noTracksText );
+            }
+
+        if ( emptyCount )
+            {
+            // Empty string if playlist is empty
+            GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                ETextPlaylistCount,
+                KNullDesC );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates download state label.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::UpdateDownloadStateLabelL()
+    {
+    MPX_FUNC( "CMPXCommonPlaybackViewImp::UpdateDownloadStateLabelL" );
+
+    if ( GetUPnPPlaybackDialogCustomControl() && !iSwitchingView )
+        {
+        switch ( iPlaybackState )
+            {
+            case EPbStateInitialising:
+            case EPbStateDownloading:
+                {
+                HBufC* labelText(
+                    StringLoader::LoadLC( R_MPX_PBV_SONG_OPENING_LABEL ));
+                GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                    ETextDownloadState, *labelText );
+                CleanupStack::PopAndDestroy( labelText );
+                break;
+                }
+            default:
+                {
+                GetUPnPPlaybackDialogCustomControl()->UpdateLabelL(
+                    ETextDownloadState, KNullDesC );
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates Title Pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::UpdateTitlePaneL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::UpdateTitlePaneL" );
+
+    CAknTitlePane* title( NULL );
+
+    TRAP_IGNORE(
+        {
+        title = static_cast<CAknTitlePane*>
+            ( iAvkonAppUi->StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+        } );
+
+    MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+    TUid currentlyUsedPlayer;
+    TInt currentlyUsedSubPlayer;
+    delete iSubPlayerName;
+    iSubPlayerName = NULL;
+    iCurrentPlayerType = EPbLocal;
+    TRAP_IGNORE( manager.GetSelectionL( iCurrentPlayerType,
+                                        currentlyUsedPlayer,
+                                        currentlyUsedSubPlayer,
+                                        iSubPlayerName ) );
+
+    if ( title )
+        {
+        if ( iCurrentPlayerType != EPbLocal)
+            {
+            if ( iSubPlayerName )
+                {
+                title->SetTextL( *iSubPlayerName );
+                }
+            }
+        else
+            {
+			if ( FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+				{
+				// We need to switch off FMtx so playback can be local
+				CHWRMFmTx* fmtx = CHWRMFmTx::NewLC();
+				TRAP_IGNORE( fmtx->DisableL());
+				CleanupStack::PopAndDestroy( fmtx );
+				}
+
+            RApaLsSession lsSession;
+            TInt ret = lsSession.Connect();
+            if ( ret == KErrNone )
+                {
+                CleanupClosePushL( lsSession );
+                TApaAppInfo appInfo;
+                RProcess registeredProcess;
+                CleanupClosePushL( registeredProcess );
+
+                ret = lsSession.GetAppInfo( appInfo, registeredProcess.Identity() );
+                MPX_DEBUG2("ProcessUID=0x%x", registeredProcess.Identity().iUid);
+
+                CleanupStack::PopAndDestroy( &registeredProcess );
+
+                if ( ret == KErrNone )
+                    {
+                    MPX_DEBUG2("calling app name = %S", &appInfo.iCaption);
+                    title->SetTextL(appInfo.iCaption);
+                    }
+                CleanupStack::PopAndDestroy( &lsSession ); // close lsSession
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::DoHandlePlaybackMessageL" );
+
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ));
+    if ( KMPXMessagePbMediaChanged == id )
+        {
+        if ( aMessage.IsSupported( KMPXMessagePbMedia ))
+            {
+            CMPXMedia* media( aMessage.Value<CMPXMedia>( KMPXMessagePbMedia ));
+            User::LeaveIfNull( media );
+            DoHandleMediaL( *media, KErrNone );
+            }
+        }
+    else if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EPropertyChanged:
+                {
+                MPX_DEBUG2( "CMPXUPnPPlaybackDialog::DoHandlePlaybackMessageL - EPropertyChanged(%d)", type );
+                TMPXPlaybackProperty property(
+                    static_cast<TMPXPlaybackProperty>( type ) );
+                TInt error( KErrNone );
+
+                DoHandlePropertyL( property, data, error );
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+                MPX_DEBUG2( "CMPXUPnPPlaybackDialog::DoHandlePlaybackMessageL - EStateChanged(%d)", type );
+
+                TMPXPlaybackState state =
+                    static_cast<TMPXPlaybackState>( type );
+                if ( ( data == KErrNotSupported ) &&
+                     ( state == EPbStatePaused ) )
+                     {
+                     CommandNotSupportedL();
+                     }
+                 else if ( ( data == KErrAccessDenied ) &&
+                           ( state == EPbStatePaused ))
+                    {
+                    if ( MPXUser::IsCallOngoing( EPSCTsyCallTypeH324Multimedia ))
+                        {
+                        iCommonUiHelper->HandleErrorL( KMPXErrorVideoCall );
+                        }
+                    }
+                 else
+                     {
+                     DoHandleStateChangedL( state, data );
+                     }
+                break;
+                }
+            case TMPXPlaybackMessage::EDownloadStarted:
+                {
+                MPX_DEBUG2( "CMPXUPnPPlaybackDialog::DoHandlePlaybackMessageL - EDownloadStarted(%d)", type );
+                TMPXPlaybackState state = EPbStateDownloading;
+                DoHandleStateChangedL( state, data );
+                break;
+                }
+            case TMPXPlaybackMessage::ECommandReceived:
+                {
+                MPX_DEBUG2( "CMPXUPnPPlaybackDialog::DoHandlePlaybackMessageL - ECommandReceived(%d)", type );
+                break;
+                }
+            case TMPXPlaybackMessage::ESkipping:
+                {
+                MPX_DEBUG2( "CMPXUPnPPlaybackDialog::DoHandlePlaybackMessageL - ESkipping(%d)", data );
+                iMPXUtility->CancelRequest();
+                if ( GetUPnPPlaybackDialogCustomControl() )
+                    {
+                    GetUPnPPlaybackDialogCustomControl()->SetMode( EMediaKeySkipping );
+                    }
+                TInt offset( data );
+                if ( offset < 0 )
+                    {
+                    iLastSkipDirection = -1;
+                    }
+                else
+                    {
+                    iLastSkipDirection = 1;
+                    }
+                iSkipping = ETrue;
+                break;
+                }
+            case TMPXPlaybackMessage::ESkipEnd:
+                {
+                MPX_DEBUG1( "CMPXUPnPPlaybackDialog::DoHandlePlaybackMessageL - ESkipEnd()");
+                iSkipping = EFalse;
+                break;
+                }
+            case TMPXPlaybackMessage::EPlaylistUpdated:
+                {
+                MPX_DEBUG1( "CMPXUPnPPlaybackDialog::DoHandlePlaybackMessageL - EPlaylistUpdated()");
+                // Do not retrive media again if in the middle of handling an error
+                if ( KErrNone == iDelayedError )
+                    {
+                    TBool noTracks( ETrue );
+                    MMPXSource* source = iPlaybackUtility->Source();
+                    if ( source )
+                        {
+                        CMPXCollectionPlaylist* pl( source->PlaylistL() );
+                        if ( pl )
+                            {
+                            CleanupStack::PushL( pl );
+                            if ( pl->Count() > 0 )
+                                {
+                                // Only update media if in foreground
+                                if ( !GetUPnPPlaybackDialogCustomControl() )
+                                    {
+                                    // If in background, wait for view to be activated
+                                    // before requesting media again
+                                    delete iMedia;
+                                    iMedia = NULL;
+                                    }
+                                noTracks = EFalse;
+                                }
+                            CleanupStack::PopAndDestroy( pl );
+                            }
+                        }
+                    if ( noTracks )
+                        {
+                        delete iMedia;
+                        iMedia = NULL;
+                        iPlaybackState = EPbStateNotInitialised;
+                        UpdateViewL();
+                        }
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::EInitializeComplete:
+                {
+                if (iCommonUiHelper)
+                    {
+                    iCommonUiHelper->DismissWaitNoteL();
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::EPlayerUnavailable:
+                {
+                TUid activeView = iViewUtility->ActiveViewType();
+                if ( activeView == TUid::Uid( KMPXPluginTypePlaybackUid ) )
+                    {
+                    iPlaybackUtility->CommandL(EPbCmdClose);
+                    if ( data == KErrNotFound )
+                        {
+                        if ( iSubPlayerName )
+                            {
+                            HBufC* dialogText = StringLoader::LoadLC( R_MPX_NOTE_REMOTE_CONNECTION_FAILED,
+                                                                      *iSubPlayerName );
+                            CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+                            errNote->SetTimeout(CAknNoteDialog::ELongTimeout);
+                            errNote->ExecuteLD( *dialogText );
+                            CleanupStack::PopAndDestroy( dialogText );
+                            }
+                        }
+
+                    if ( !iDelayedEventExit )
+                        {
+                        iDelayedEventExit = CIdle::NewL(CActive::EPriorityStandard);
+                        }
+
+                    if ( !iDelayedEventExit->IsActive())
+                        {
+                        TCallBack callBack( CMPXUPnPPlaybackDialog::DelayedExit,
+                                            this );
+                        iDelayedEventExit->Start(callBack);
+                        }
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::DoHandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError,
+    TBool aInit)
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::DoHandlePropertyL" );
+    MPX_DEBUG4( "HandlePropertyL - Property(%d); Value(%d); Error(%d)", aProperty, aValue, aError );
+
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty  )
+            {
+            case EPbPropertyPosition:
+                {
+                iPosition = aValue / KMPXOneSecInMilliSecs;
+                UpdateTrackPlaybackPositionL(
+                    iPosition, iDuration );
+                break;
+                }
+            case EPbPropertyDuration:
+                {
+                iDuration = aValue / KMPXOneSecInMilliSecs;
+                if ( ( ( iPlaybackState == EPbStateStopped ) ||
+                      ( iPlaybackState == EPbStateInitialising ) ) &&
+                     iDuration > 0 )
+                    {
+                    UpdateTrackPlaybackPositionL( iPosition, iDuration );
+                    }
+                break;
+                }
+            case EPbPropertyRandomMode:
+                {
+                iRandomMode = aValue;
+                if ( GetUPnPPlaybackDialogCustomControl() )
+                    {
+                    GetUPnPPlaybackDialogCustomControl()->SetRandomMode( aValue );
+                    }
+                break;
+                }
+            case EPbPropertyRepeatMode:
+                {
+                iRepeatMode = aValue;
+                if ( GetUPnPPlaybackDialogCustomControl() )
+                    {
+                    GetUPnPPlaybackDialogCustomControl()->SetRepeatMode(
+                        EPbRepeatAll == aValue, EPbRepeatOne == aValue );
+                    }
+                break;
+                }
+            case EPbPropertyVolume:
+                {
+                iCurrentVolume = aValue;
+                MPX_DEBUG2( "CMPXUPnPPlaybackDialog::DoHandlePlaybackMessageL iCurrentVolume = %d", iCurrentVolume );
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else
+        {
+        HandleErrorL( aError );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aProperties.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::DoHandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::DoHandleMediaL" );
+    MPX_DEBUG2("CMPXUPnPPlaybackDialog::DoHandleMediaL(): aError = %d", aError);
+
+    delete iMedia;
+    iMedia = NULL;
+    if ( KErrNone == aError )
+        {
+        iMedia = CMPXMedia::NewL( aMedia );
+
+        UpdateTrackPosInPlaylistL();
+        UpdateTrackInfoL( iMedia );
+        // If media key skipping, do not update album art
+        if ( !iSkipping )
+            {
+            UpdateAlbumArtL( iMedia );
+            }
+
+        // Update duration if previously not available
+        if ( iMedia->IsSupported( KMPXMediaGeneralDuration ) )
+            {
+            iDuration = iMedia->ValueTObjectL<TInt>( KMPXMediaGeneralDuration ) /
+                KMPXOneSecInMilliSecs;
+            UpdateTrackPlaybackPositionL( iPosition, iDuration );
+            }
+
+        // If there's a delayed error, handle it now
+        // that the media object has arrived
+        if ( iDelayedError != KErrNone )
+            {
+            // Copy error code and reset iDelayedError, this is becuase
+            // a media event may be called while handling this error
+            TInt err( iDelayedError );
+            iDelayedError = KErrNone;
+            HandleErrorL( err );
+            }
+        }
+    else
+        {
+        HandleErrorL( aError );
+        if ( aError == iDelayedError )
+            {
+            iDelayedError = KErrNone;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::DoHandleStateChangedL(
+    TMPXPlaybackState aState,
+    TInt aData )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::DoHandleStateChangedL" );
+
+    // If KErrDisconnected, it's a fatal error and we close the dialog
+    if ( ( aState == EPbStatePaused ) &&
+         ( aData == KErrDisconnected ) )
+        {
+        TUid activeView = iViewUtility->ActiveViewType();
+        if ( activeView == TUid::Uid( KMPXPluginTypePlaybackUid ) )
+            {
+            iPlaybackUtility->CommandL(EPbCmdStop);
+
+            if ( !iDelayedEventExit )
+                {
+                iDelayedEventExit = CIdle::NewL(CActive::EPriorityStandard);
+                }
+
+            if ( !iDelayedEventExit->IsActive())
+                {
+                TCallBack callBack( CMPXUPnPPlaybackDialog::DelayedExit,
+                                    this );
+                iDelayedEventExit->Start(callBack);
+                }
+            }
+        }
+    else
+        {
+        UpdatePlaybackState( aState );
+
+        switch ( aState )
+            {
+            case EPbStateStopped:
+                {
+                iStartPlaybackIndex = KErrNotFound;
+                }
+            case EPbStateNotInitialised:
+                {
+                UpdateTrackPlaybackPositionL( 0, iDuration );
+                break;
+                }
+            case EPbStateInitialising:
+                {
+                // Save the start playback index
+                if ( KErrNotFound == iStartPlaybackIndex &&
+                     KErrNotFound != aData )
+                    {
+                    iStartPlaybackIndex = aData;
+                    }
+
+                // Fall through on purpose
+                }
+            case EPbStateDownloading:
+                {
+                UpdateDownloadStateLabelL();
+                break;
+                }
+            case EPbStatePlaying:
+            case EPbStatePaused:
+            default:
+                {
+                MPX_PERF_CHECKPT("Playback state changes to Play/Pause");
+                iStartPlaybackIndex = KErrNotFound;
+                iLastSkipDirection = 1;
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandleErrorL( TInt aError )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::HandleErrorL()" );
+    MPX_DEBUG2( "CMPXUPnPPlaybackDialog::HandleErrorL(%d)", aError );
+    if ( aError )
+        {
+        TInt currentIndex( KErrNotFound );
+        TInt nextIndex( KErrNotFound );
+        TInt plCount( KErrNotFound );
+        MMPXSource* source( iPlaybackUtility->Source() );
+        if ( source )
+            {
+            CMPXCollectionPlaylist* pl( source->PlaylistL() );
+            if ( pl )
+                {
+                CleanupStack::PushL( pl );
+                currentIndex = pl->Index();
+                if ( iLastSkipDirection < 0 )
+                    {
+                    pl->Previous( ETrue );
+                    }
+                else
+                    {
+                    pl->Next( ETrue );
+                    }
+                nextIndex = pl->Index();
+                plCount = pl->Count();
+                CleanupStack::PopAndDestroy( pl );
+                }
+            }
+
+        // MMF framework will return KErrArgument/KErrCompletion if it reaches
+        // the end of a partially downloaded file.  The downloaded portion of
+        // the file should still be playable in this case.
+        if ( KErrNotFound != nextIndex &&
+            ( ( KErrArgument != aError && KErrCompletion != aError ) ||
+              iPlaybackState != EPbStatePlaying ))
+            {
+            // Check if all tracks are invalid, or if there's only
+            // 1 track in the playlist
+            if ( nextIndex == iStartPlaybackIndex ||
+                 plCount == 1 )
+                {
+                aError = KMPXAllTracksInvalid;
+                }
+            }
+
+        switch ( aError )
+            {
+            case KMPXRightsAboutToExpire:
+            case KErrCANotSupported:
+            case KErrCANoPermission:
+            case KErrCANoRights:
+            case KErrCANoAgent:
+            case KErrCAOutOfRange:
+            case KErrCAPendingRights:
+            case KErrCASizeNotDetermined:
+            case KErrCANewFileHandleRequired:
+            case KErrPermissionDenied:
+                {
+                if ( iMedia )
+                    {
+                    if ( iMedia->IsSupported( KMPXMediaDrmType ) )
+                        {
+                        TMPXMediaDrmType type(
+                            iMedia->ValueTObjectL<TMPXMediaDrmType>(
+                                KMPXMediaDrmType ) );
+                        // Only display DRM error message for WMDRM
+                        // if it's the first song selected
+                        if ( EMPXDrmTypeWMA == type &&
+                             currentIndex == iStartPlaybackIndex )
+                            {
+                            iCommonUiHelper->HandleErrorL( aError, iMedia );
+                            }
+                        }
+                    }
+                SkipOnErrorL( currentIndex, plCount );
+                break;
+                }
+            case KErrAccessDenied:
+                {
+                // Only display error message if first one selected to play
+                if ( currentIndex == iStartPlaybackIndex )
+                    {
+                    iCommonUiHelper->HandleErrorL( aError, iMedia );
+                    }
+                SkipOnErrorL( currentIndex, plCount );
+                break;
+                }
+            case KErrNotSupported:
+            case KErrCorrupt:
+            case KErrNotFound:
+            case KErrPathNotFound:
+                {
+                SkipOnErrorL( currentIndex, plCount );
+                break;
+                }
+            case KMPXAllTracksInvalid:
+                {
+                HandleAllTracksInvalidL();
+                break;
+                }
+            case KErrArgument:
+            case KErrCompletion:
+                {
+                TBool skip( ETrue );
+
+                // UI specs say theres two cases where it stops and
+                // does not skip to the next song.
+                // First case is if not repeat all and playback has
+                // reached the end of the list and gone to the first song.
+                // Second case is if not repeat all and the user is skipping
+                // backwards and reached the first song
+                if ( EPbRepeatAll != iRepeatMode &&
+                     0 == currentIndex &&
+                     -1 == iLastSkipDirection)
+                    {
+                    skip = EFalse;
+                    }
+
+                // Skip to next/previous track
+                if ( skip )
+                    {
+                    if ( iLastSkipDirection < 0 )
+                        {
+                        iPlaybackUtility->CommandL( EPbCmdPrevious );
+                        }
+                    else
+                        {
+                        iPlaybackUtility->CommandL( EPbCmdNext );
+                        }
+                    }
+                break;
+                }
+            // Cannot be recovered, exit the dialog.
+            case KErrDisconnected:
+                {
+                TUid activeView = iViewUtility->ActiveViewType();
+                if ( activeView == TUid::Uid( KMPXPluginTypePlaybackUid ) )
+                    {
+                    iPlaybackUtility->CommandL(EPbCmdStop);
+
+                    if ( !iDelayedEventExit )
+                        {
+                        iDelayedEventExit = CIdle::NewL(CActive::EPriorityStandard);
+                        }
+
+                    if ( !iDelayedEventExit->IsActive())
+                        {
+                        TCallBack callBack( CMPXUPnPPlaybackDialog::DelayedExit,
+                                            this );
+                        iDelayedEventExit->Start(callBack);
+                        }
+                    }
+                break;
+                }
+            default:
+                {
+                iPlaybackUtility->CommandL( EPbCmdStop );
+                iCommonUiHelper->HandleErrorL( aError, iMedia );
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error note for when all tracks are invalid,
+// and goes back to collection list view
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandleAllTracksInvalidL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::HandleAllTracksInvalidL()" );
+
+    iPlaybackUtility->CommandL( EPbCmdStop );
+    UpdatePlaybackState( EPbStateStopped );
+
+    // Do not display error if view is not active
+    if ( GetUPnPPlaybackDialogCustomControl() )
+        {
+        iCommonUiHelper->HandleErrorL( KMPXAllTracksInvalid, iMedia );
+        HandleCommandL( EAknSoftkeyBack );
+        }
+    iStartPlaybackIndex = KErrNotFound;
+    iLastSkipDirection = 1;
+
+    // Reset the playlist to point to the first item
+    // in list, but do not initialize the song for
+    // playback
+    MMPXSource* source( iPlaybackUtility->Source() );
+    if ( source )
+        {
+        CMPXCollectionPlaylist* pl( source->PlaylistL() );
+        if ( pl )
+            {
+            CleanupStack::PushL( pl );
+            pl->SetToFirst();
+            iPlaybackUtility->InitL( *pl, EFalse );
+            CleanupStack::PopAndDestroy( pl );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Checks whether or not to skip to next track on an error
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::SkipOnErrorL(
+    TInt aCurrentIndex,
+    TInt aCount )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::SkipOnErrorL()" );
+    MPX_DEBUG2("CMPXUPnPPlaybackDialog::SkipOnErrorL(%d)", aCurrentIndex);
+
+    TBool skip( ETrue );
+    TBool displayError( EFalse );
+
+    // UI specs say theres two cases where it stops and
+    // does not skip to the next song.
+    // First case is if not repeat all and playback has
+    // reached the end of the list and gone to the first song.
+    // Second case is if not repeat all and the user is skipping
+    // backwards and reached the first song
+    if ( EPbRepeatAll != iRepeatMode )
+        {
+        if ( 0 == aCurrentIndex &&
+             -1 == iLastSkipDirection )
+            {
+            skip = EFalse;
+            displayError = ETrue;
+            }
+        else if ( aCurrentIndex == aCount-1 &&
+                  1 == iLastSkipDirection )
+            {
+            skip = EFalse;
+            displayError = ETrue;
+            }
+        }
+
+    // Skip to next/previous track
+    if ( skip )
+        {
+        if ( iLastSkipDirection < 0 )
+            {
+            iPlaybackUtility->CommandL( EPbCmdPrevious );
+            }
+        else
+            {
+            iPlaybackUtility->CommandL( EPbCmdNext );
+            }
+        }
+
+    // Display error message
+    if ( displayError )
+        {
+        HandleAllTracksInvalidL();
+        }
+
+    MPX_DEBUG1("CMPXUPnPPlaybackDialog::SkipOnErrorL: Exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// Request for the media object
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::RequestMediaL( TBool aDrm /*=EFalse*/ )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::RequestMediaL()" );
+
+    MMPXSource* s = iPlaybackUtility->Source();
+    if ( s )
+        {
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        attrs.Append( KMPXMediaGeneralBasic |
+                      KMPXMediaGeneralUri |
+                      KMPXMediaGeneralMimeType |
+                      KMPXMediaGeneralDuration );
+        attrs.Append( KMPXMediaMusicAlbumArtFileName |
+                      KMPXMediaMusicArtist |
+                      KMPXMediaMusicAlbum );
+        if ( aDrm )
+            {
+            attrs.Append( KMPXMediaDrmAll );
+            }
+        else
+            {
+            // If not retrieving all drm attributes, then
+            // minimal is retrieve the protected flag and
+            // automated flag
+            attrs.Append( KMPXMediaDrmProtected |
+                          KMPXMediaDrmCanSetAutomated );
+            }
+        s->MediaL( attrs.Array(), *this );
+        CleanupStack::PopAndDestroy( &attrs );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::PrepareStatusPaneForPlaybackViewL
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::PrepareStatusPaneForPlaybackViewL()
+    {
+    iPreviousLayoutId = iAvkonAppUi->StatusPane()->CurrentLayoutResId();
+
+    if ( !Layout_Meta_Data::IsLandscapeOrientation() )
+        {
+        if ( iPreviousLayoutId !=
+             R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT )
+            {
+            TRAP_IGNORE(
+                iAvkonAppUi->StatusPane()->SwitchLayoutL(
+                R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ));
+            }
+        }
+    else
+        {
+        if ( iPreviousLayoutId !=
+             R_AVKON_STATUS_PANE_LAYOUT_USUAL )
+            {
+            TRAP_IGNORE(
+                iAvkonAppUi->StatusPane()->SwitchLayoutL(
+                R_AVKON_STATUS_PANE_LAYOUT_USUAL ));
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::PrepareStatusPaneForExitingViewL
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::PrepareStatusPaneForExitingViewL()
+    {
+    if ( iAvkonAppUi->StatusPane()->CurrentLayoutResId() !=
+         R_AVKON_STATUS_PANE_LAYOUT_USUAL)
+        {
+        iAvkonAppUi->StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandlePlaybackMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::HandlePlaybackMessage" );
+    MPX_DEBUG2("CMPXUPnPPlaybackDialog::HandlePlaybackMessage(%d)", aError);
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    else if ( aError != KErrNone )
+        {
+        MPX_DEBUG2( "CMPXUPnPPlaybackDialog::HandlePlaybackMessage - EError(%d)", aError );
+        // Check if it's a DRM song first, only get media for DRM songs
+        TBool drmSong( EFalse );
+        if ( iMedia )
+            {
+            if ( iMedia->IsSupported( KMPXMediaDrmProtected ))
+                {
+                drmSong = iMedia->ValueTObjectL<TBool>( KMPXMediaDrmProtected );
+                }
+            }
+        if ( drmSong )
+            {
+            iDelayedError = aError;
+            TRAP_IGNORE( RequestMediaL( ETrue ));
+            }
+        else
+            {
+            iDelayedError = KErrNone;
+            TRAP_IGNORE( HandleErrorL( aError ));
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandlePropertyL(
+    TMPXPlaybackProperty aProperty,
+    TInt aValue,
+    TInt aError )
+    {
+    DoHandlePropertyL( aProperty, aValue, aError, ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// 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 CMPXUPnPPlaybackDialog::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::HandleSubPlayerNamesL" );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media event.
+// Notes: The client is responsible for delete the object of aProperties.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandleMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::HandleMediaL" );
+    DoHandleMediaL( aMedia, aError );
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionMediaObserver
+// Handle extended media properties
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandleCollectionMediaL(
+    const CMPXMedia& aMedia,
+    TInt aError )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::HandleCollectionMediaL" );
+    DoHandleMediaL( aMedia, aError );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Command handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandleCommandL( TInt aCommand )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::HandleCommandL()" );
+    MPX_DEBUG2( "CMPXUPnPPlaybackDialog::HandleCommandL(%d) entering", aCommand );
+
+    switch (aCommand)
+        {
+        case EMPXPbvCmdPlay:
+            {
+            iPlaybackUtility->CommandL( EPbCmdPlay );
+            break;
+            }
+        case EMPXPbvCmdStop:
+            {
+            iPlaybackUtility->CommandL( EPbCmdStop );
+            break;
+            }
+        case EMPXPbvCmdPause:
+            {
+            MPX_PERF_CHECKPT("Pause command issued");
+            iPlaybackUtility->CommandL( EPbCmdPause );
+            break;
+            }
+        case EMPXPbvCmdPlayPause:
+            {
+            iPlaybackUtility->CommandL( EPbCmdPlayPause );
+            break;
+            }
+        case EMPXPbvCmdSeekForward:
+        case EMPXPbvCmdSeekBackward:
+            {
+            if ( iCurrentPlayerType == EPbLocal)
+                {
+                if ( aCommand == EMPXPbvCmdSeekForward )
+                    {
+                    iPlaybackUtility->CommandL( EPbCmdStartSeekForward );
+                    }
+                else
+                    {
+                    iPlaybackUtility->CommandL( EPbCmdStartSeekBackward );
+                    }
+
+                if ( !iKeySoundDisabled )
+                    {
+                    iAvkonAppUi->KeySounds()->PushContextL(
+                        R_MPX_PBV_LEFT_RIGHT_KEYS_SILENT );
+                    iKeySoundDisabled = ETrue;
+                    }
+                }
+            else
+                {
+                // Not Supported in UPnP
+                if ( iSeekForward )
+                    {
+                    break;
+                    }
+                iSeekForward = ETrue;
+                CommandNotSupportedL();
+
+                if ( iLastKeyType != EEventKeyUp )
+                    {
+                    iLastKeyType = EEventKeyUp;
+                    if ( GetUPnPPlaybackDialogCustomControl() )
+                        {
+                        GetUPnPPlaybackDialogCustomControl()->OfferKeyEventL(
+                                                                    iLastKeyEvent,
+                                                                    EEventKeyUp );
+                        }
+                    }
+                iSeekForward = EFalse;
+                }
+            break;
+            }
+        case EMPXPbvCmdEndSeek:
+            {
+            if ( iCurrentPlayerType == EPbLocal)
+                {
+                iPlaybackUtility->CommandL( EPbCmdStopSeeking );
+                if ( iKeySoundDisabled )
+                    {
+                    iAvkonAppUi->KeySounds()->PopContext();
+                    iKeySoundDisabled = EFalse;
+                    }
+                }
+            // else Not supported
+            break;
+            }
+        case EMPXPbvCmdNextListItem:
+            {
+            // When user skips a track, reset the start playback index
+            iStartPlaybackIndex = KErrNotFound;
+
+            iPlaybackUtility->CommandL( EPbCmdNext );
+            break;
+            }
+        case EMPXPbvCmdPreviousListItem:
+            {
+            // When user skips a track, reset the start playback index
+            iStartPlaybackIndex = KErrNotFound;
+
+            iPlaybackUtility->CommandL( EPbCmdPrevious );
+            break;
+            }
+        case EMPXPbvCmdDecreaseVolume:
+            {
+            iPlaybackUtility->CommandL( EPbCmdDecreaseVolume );
+            break;
+            }
+        case EMPXPbvCmdIncreaseVolume:
+            {
+            iPlaybackUtility->CommandL( EPbCmdIncreaseVolume );
+            break;
+            }
+        case EMPXCmdSeekForward:
+        case EMPXCmdSeekBackward:
+            {
+            if ( iCurrentPlayerType == EPbLocal)
+                {
+                iAvkonAppUi->HandleCommandL( aCommand );
+                }
+            else
+                {
+                CommandNotSupportedL();
+                }
+            break;
+            }
+        case EMPXCmdNext:
+        case EMPXCmdPrevious:
+            // When user skips a track, reset the start playback index
+            iStartPlaybackIndex = KErrNotFound;
+        case EMPXCmdPlay:
+        case EMPXCmdPause:
+        case EMPXCmdPlayPause:
+        case EMPXCmdStop:
+        case EMPXCmdStopSeeking:
+        case EMPXCmdVolumeUp:
+        case EMPXCmdVolumeDown:
+            {
+            iAvkonAppUi->HandleCommandL( aCommand );
+            break;
+            }
+        default:
+            {
+            iAvkonAppUi->HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Processes user commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::ProcessCommandL( TInt aCommandId )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::ProcessCommandL" );
+    CAknDialog::ProcessCommandL( aCommandId );
+    HandleCommandL( aCommandId );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Event handler for status pane size changes.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandleStatusPaneSizeChange()
+    {
+    CMPXUPnPPlaybackDialogCustomControlContainer *control =
+        ( CMPXUPnPPlaybackDialogCustomControlContainer* )
+        ControlOrNull ( EMPXUPnPPlaybackDlgCtrlId );
+    if ( control )
+        {
+        AknLayoutUtils::LayoutMetricsRect(
+            AknLayoutUtils::EMainPane, iModRect );
+
+        if ( iToolbar && iToolbar->IsVisible() 
+                && !Layout_Meta_Data::IsLandscapeOrientation())
+            {
+            iModRect.iBr.iY -= iToolbar->Rect().Height();
+            }
+        control->SetRect( iModRect );
+        control->iDialogCustomControl->SetRect( iModRect );
+        control->iDialogCustomControl->DrawDeferred();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::GetUPnPPlaybackDialogCustomControl
+// Returns the Custom Control Container.
+// -----------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialogCustomControl *CMPXUPnPPlaybackDialog::
+    GetUPnPPlaybackDialogCustomControl() const
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::GetUPnPPlaybackDialogCustomControl" );
+    CMPXUPnPPlaybackDialogCustomControlContainer *control =
+        ( CMPXUPnPPlaybackDialogCustomControlContainer* )
+        ControlOrNull ( EMPXUPnPPlaybackDlgCtrlId );
+    if ( control )
+        {
+        return control->iDialogCustomControl;
+        }
+    return NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::CreateCustomControlL
+// Creates a Custom Control for the dialog.
+// -----------------------------------------------------------------------------
+//
+SEikControlInfo CMPXUPnPPlaybackDialog::CreateCustomControlL(
+    TInt aControlType )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::CreateCustomControlL" );
+    SEikControlInfo controlInfo;
+    controlInfo.iControl = NULL;
+    controlInfo.iTrailerTextId = 0;
+    controlInfo.iFlags = 0;
+
+    switch (aControlType)
+        {
+        case EMPXUPnPPlaybackDlg:
+            {
+            controlInfo.iControl = new ( ELeave )
+                CMPXUPnPPlaybackDialogCustomControlContainer;
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    return controlInfo;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::PreLayoutDynInitL
+// Initialises the dialog's controls before the dialog is sized and layed out.
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::PreLayoutDynInitL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::PreLayoutDynInitL" );
+
+    iSwitchingView = EFalse;
+
+    PrepareStatusPaneForPlaybackViewL();
+
+    iRandomMode = KErrNotFound;
+    iRepeatMode = KErrNotFound;
+
+    BackupPreviousStatusPaneL();
+
+    // Set title
+    // Ignore errors from updating title pane since if that is not
+    // updated, still want to activate view
+    TRAP_IGNORE(
+        {
+        UpdateTitlePaneL();
+        CAknNavigationControlContainer* naviPane(
+            static_cast<CAknNavigationControlContainer*>
+            ( iAvkonAppUi->StatusPane()->ControlL(
+                TUid::Uid( EEikStatusPaneUidNavi ) ) ));
+        if ( naviPane )
+            {
+            naviPane->PushDefaultL();
+            }
+        } );
+
+    if ( ButtonGroupContainer().ButtonGroup() )
+        {
+        CCoeControl* control = ButtonGroupContainer().ButtonGroup()->AsControl();
+        static_cast<CEikCba*>( control )->
+            SetSkinBackgroundId( KAknsIIDQsnBgAreaControlMp );
+        }
+
+    AknLayoutUtils::LayoutMetricsRect(
+            AknLayoutUtils::EMainPane, iModRect );
+
+    if ( iToolbar && iToolbar->IsVisible() 
+            && !Layout_Meta_Data::IsLandscapeOrientation())
+        {
+        iModRect.iBr.iY -= iToolbar->Rect().Height();
+        }
+    CMPXUPnPPlaybackDialogCustomControlContainer *control1 =
+        ( CMPXUPnPPlaybackDialogCustomControlContainer* ) ControlOrNull (
+            EMPXUPnPPlaybackDlgCtrlId );
+    CMPXUPnPPlaybackDialogCustomControl *control = NULL;
+
+    if ( control1 )
+        {
+        if ( !iPlaybackDialogLayout )
+            {
+            iPlaybackDialogLayout = CMPXUPnPPlaybackDialogLayout::NewL();
+            }
+
+        control = CMPXUPnPPlaybackDialogCustomControl::NewL(
+            *control1, iModRect, this, this, iPlaybackDialogLayout, iCurrentPlayerType );
+        control1->iDialogCustomControl = control;
+        GetUPnPPlaybackDialogCustomControl()->MakeVisible( ETrue );
+        MakeVisible(EFalse);
+        }
+
+    // Update view
+    // Ignore errors from updating labels in view since if labels
+    // are empty, still want to activate view
+    iPlaybackState = iPlaybackUtility->StateL();
+    TRAP_IGNORE( UpdateViewL() );
+
+    if ( ( iPlaybackState == EPbStateInitialising ) ||
+         ( iPlaybackState == EPbStateDownloading ) )
+        {
+        delete iMedia;
+        iMedia = NULL;
+        UpdatePlaybackState( iPlaybackState );
+        UpdateTrackInfoL( iMedia );
+        }
+    else if ( iMedia == NULL )
+        {
+        MMPXSource* s = iPlaybackUtility->Source();
+        if (  s )
+            {
+            CMPXCollectionPlaylist* playlist( s->PlaylistL() );
+            if ( playlist )
+                {
+                CleanupStack::PushL( playlist );
+                if ( playlist->Count() > 0 )
+                    {
+                    RequestMediaL();
+                    UpdatePlaybackState( iPlaybackState );
+                    }
+                else
+                    {
+                    // playlist count is 0, no tracks
+                    iPlaybackState = EPbStateNotInitialised;
+                    }
+                CleanupStack::PopAndDestroy( playlist );
+                }
+            else
+                {
+                // If empty playlist, then no tracks
+                iPlaybackState = EPbStateNotInitialised;
+                }
+            }
+        }
+
+    CAknDialog::PreLayoutDynInitL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::OkToExitL
+// This function returns whether it's ok to exit or not
+// -----------------------------------------------------------------------------
+//
+TBool CMPXUPnPPlaybackDialog::OkToExitL( TInt aButtonId )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::OkToExitL" );
+    TBool retVal = EFalse;
+    switch (aButtonId)
+        {
+        case EAknSoftkeyClose:
+            {
+            if ( iToolbar )
+                {
+                iToolbar->SetToolbarVisibility( EFalse );
+                iToolbar->SetToolbarObserver( NULL );
+                iToolbar->RemoveItem( EMPXPbvCmdPreviousListItem );
+                iToolbar->RemoveItem( EMPXPbvCmdPlayPause );
+                iToolbar->RemoveItem( EMPXPbvCmdNextListItem );
+                iToolbar = NULL;
+                }
+            if ( !Layout_Meta_Data::IsLandscapeOrientation() )
+                {
+                PrepareStatusPaneForExitingViewL();
+                }
+
+            RestorePreviousStatusPaneL();
+            iPlaybackUtility->CommandL( EPbCmdStop );
+            iPlaybackUtility->CommandL( EPbCmdClose );
+            retVal = ETrue;
+            break;
+            }
+        default:
+            {
+            retVal = CAknDialog::OkToExitL( aButtonId );
+            break;
+            }
+        }
+    if ( retVal )
+        {
+        iMPXUtility->CancelRequest();
+
+        // We need to unload the current plugin to release WLAN connection
+        iPlaybackUtility->PlayerManager().ClearSelectPlayersL();
+        }
+    return retVal;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::BackupPreviousStatusPaneL
+// Backs up Status Pane information.
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::BackupPreviousStatusPaneL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::BackupPreviousStatusPaneL" );
+    CEikStatusPane* sp = iAvkonAppUi->StatusPane();
+    // Backup navi pane
+    iNaviPane = static_cast< CAknNavigationControlContainer* >
+        ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) );
+
+    // Backup title pane
+    iTitlePane = static_cast< CAknTitlePane* >
+        ( sp->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+    iOrigTitle = iTitlePane->Text()->AllocL();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::RestorePreviousStatusPaneL()
+// Restores previous status pane.
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::RestorePreviousStatusPaneL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::RestorePreviousStatusPaneL" );
+    if ( iOrigTitle && iTitlePane )
+        {
+        // Set original title pane
+        iTitlePane->SetTextL( *iOrigTitle );
+        }
+    // Set original navi pane
+    if ( iNaviPane )
+        {
+        iNaviPane->Pop();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::DynInitMenuPaneL" );
+    CAknDialog::DynInitMenuPaneL( aResourceId, aMenuPane );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::CountComponentControls
+// Counts the number of components.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXUPnPPlaybackDialog::CountComponentControls() const
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::CountComponentControls" );
+    TInt newitems = 0;
+    if ( GetUPnPPlaybackDialogCustomControl() ) newitems++;
+    return CAknDialog::CountComponentControls() + newitems;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::ComponentControl
+// Returns component control.
+// -----------------------------------------------------------------------------
+//
+CCoeControl* CMPXUPnPPlaybackDialog::ComponentControl( TInt aIndex ) const
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::ComponentControl" );
+    if (aIndex == CAknDialog::CountComponentControls() )
+        {
+        return GetUPnPPlaybackDialogCustomControl();
+        }
+    return CAknDialog::ComponentControl( aIndex );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXUPnPPlaybackDialog::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::OfferKeyEventL()" );
+    MPX_DEBUG4( "CMPXUPnPPlaybackDialog::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+
+    TKeyResponse keyResponse( EKeyWasNotConsumed );
+
+    if ( ( iLastKeyEvent.iScanCode == aKeyEvent.iScanCode ) &&
+         ( iLastKeyType == aType ) &&
+         ( iLastKeyType == EEventKeyUp ) )
+        {
+        keyResponse = EKeyWasConsumed;
+        }
+    else
+        {
+        iLastKeyEvent = aKeyEvent;
+        iLastKeyType = aType;
+
+        // End key was pressed and dialog needs to close
+        if ( aKeyEvent.iCode == EKeyEscape )
+            {
+            TryExitL(EAknSoftkeyClose);
+            keyResponse = EKeyWasConsumed;
+            }
+        else
+            {
+            if ( GetUPnPPlaybackDialogCustomControl() )
+                {
+                keyResponse = GetUPnPPlaybackDialogCustomControl()->OfferKeyEventL(
+                                                                    aKeyEvent,
+                                                                    aType );
+                }
+            }
+        }
+    return keyResponse;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCustomCommandObserver.
+// Handle custom commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandleMediaKeyCommand(
+    const TMPXPlaybackCommand aCommand,
+    const TInt aData )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::HandleMediaKeyCommand()" );
+
+    switch ( aCommand )
+        {
+        case EPbCmdSetVolume:
+            {
+    		TMPXPlaybackState playerState( iPlaybackUtility->StateL() );
+            if ( iAvkonAppUi->IsForeground() || playerState == EPbStatePlaying )
+                {
+				if ( aData != iCurrentVolume )
+					{
+					SetVolume( aData );
+					}
+				// popup volume control even if volume didn't change
+				HandlePopupL( EPbCmdSetVolume );
+				}
+            break;
+            }
+        case EPbCmdMuteVolume:
+            {
+    		TMPXPlaybackState playerState( iPlaybackUtility->StateL() );
+            if ( iAvkonAppUi->IsForeground() || playerState == EPbStatePlaying )
+                {
+				MuteVolume();
+				HandlePopupL( EPbCmdMuteVolume );
+				}
+            break;
+            }
+        case EPbCmdUnMuteVolume:
+            {
+    		TMPXPlaybackState playerState( iPlaybackUtility->StateL() );
+            if ( iAvkonAppUi->IsForeground() || playerState == EPbStatePlaying )
+                {
+				UnMuteVolume();
+				HandlePopupL( EPbCmdUnMuteVolume );
+				}
+            break;
+            }
+        default:
+            {
+            if ( iAvkonAppUi->IsForeground() )
+                {
+                // Forward the command to handle when
+                // music is foreground app and not displaying
+                // dialogs
+                MPX_DEBUG2( "CMPXUPnPPlaybackDialog::HandleCustomCommand sending command %d to view", aCommand );
+                TRAP_IGNORE( DoHandleMediaKeyCommandL( aCommand ) );
+                }
+            else
+                {
+                TMPXPlaybackState playerState( EPbStateNotInitialised );
+                TRAP_IGNORE( playerState = iPlaybackUtility->StateL() );
+                // displaying not foreground, pass to view to handle only play command
+                if ( playerState == EPbStatePlaying ||
+                     playerState == EPbStatePaused ||
+                     playerState == EPbStateSeekingForward ||
+                     playerState == EPbStateSeekingBackward )
+                    {
+                    MPX_DEBUG2( "CMPXUPnPPlaybackDialog::HandleCustomCommand not foreground, sending command %d to HandleMediaKeyCommandL", aCommand );
+                    TRAP_IGNORE( DoHandleMediaKeyCommandL( aCommand ) );
+                    }
+                else if ( aCommand == EPbCmdPlay || aCommand == EPbCmdPlayPause )
+                    {
+                    MPX_DEBUG2( "CMPXUPnPPlaybackDialog::HandleCustomCommand not foreground, active idle foreground, sending command %d to HandleMediaKeyCommandL", aCommand );
+                    // not foreground, play without loading playback view
+                    TRAP_IGNORE( DoHandleMediaKeyCommandL( aCommand ) );
+                    }
+                else
+                    {
+                    MPX_DEBUG2( "CMPXUPnPPlaybackDialog::HandleCustomCommand not foreground, inactive state, command %d ignored", aCommand );
+                    }
+                }
+			}
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Additional handling of media key commands.
+// Determine if the command will be passed to the playback engine.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::DoHandleMediaKeyCommandL(
+	TMPXPlaybackCommand aCommand )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::DoHandleMediaKeyCommandL()" );
+
+    TBool handleCommand(EFalse);
+    TMPXPlaybackState playerState( iPlaybackUtility->StateL() );
+
+    switch ( aCommand )
+        {
+        case EPbCmdPlay:
+        case EPbCmdPause:
+        case EPbCmdPlayPause:
+        case EPbCmdStop:
+        case EPbCmdNext:
+        case EPbCmdPrevious:
+        	handleCommand = ETrue;
+        	break;
+        case EPbCmdStartSeekForward:
+            {
+            if ( iCurrentPlayerType == EPbLocal  &&
+                 ( EPbStatePlaying == playerState ||
+                   EPbStatePaused == playerState ||
+                   EPbStateSeekingBackward == playerState ) )
+                {
+        		handleCommand = ETrue;
+                }
+            break;
+            }
+        case EPbCmdStartSeekBackward:
+            {
+            if ( iCurrentPlayerType == EPbLocal  &&
+                 ( EPbStatePlaying == playerState ||
+                   EPbStatePaused == playerState ||
+                   EPbStateSeekingForward == playerState ) )
+                {
+        		handleCommand = ETrue;
+                }
+            break;
+            }
+        case EPbCmdStopSeeking:
+            {
+            if ( iCurrentPlayerType == EPbLocal  &&
+                 ( EPbStateSeekingForward == playerState ||
+                   EPbStateSeekingBackward == playerState ) )
+                {
+        		handleCommand = ETrue;
+                }
+            // Do nothing, not supported by UPnP
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+
+    if ( handleCommand )
+        {
+        iPlaybackUtility->CommandL( aCommand );
+
+        // Control popup behaviour
+        HandlePopupL( aCommand );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// Control popup behaviour.
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandlePopupL(
+    TMPXPlaybackCommand aCommand )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::HandlePopupL" );
+
+    switch ( aCommand )
+        {
+        case EPbCmdStop:
+            {
+            iMediaKeyHandler->DismissNotifier( EDisplayMediaPopup );
+            break;
+            }
+        case EPbCmdSetVolume:
+        case EPbCmdMuteVolume:
+        case EPbCmdUnMuteVolume:
+            {
+            if ( iAvkonAppUi->IsForeground() )
+                {
+				// display pop up volume control
+				iMediaKeyHandler->ShowVolumePopupL();
+                }
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandleResourceChange( TInt aType )
+    {
+    if ( GetUPnPPlaybackDialogCustomControl() )
+        {
+        GetUPnPPlaybackDialogCustomControl()->HandleResourceChange( aType );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXLayoutSwitchObserver
+// Callback function when layout is changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::HandleLayoutChange()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialog::HandleLayoutChange()" );
+
+    if (GetUPnPPlaybackDialogCustomControl() && !iSwitchingView)
+        {
+        if ( !Layout_Meta_Data::IsLandscapeOrientation() )
+            {
+            if ( iAvkonAppUi->StatusPane()->CurrentLayoutResId() !=
+                 R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT )
+                {
+                TRAP_IGNORE(
+                    iAvkonAppUi->StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ));
+                }
+            }
+        else
+            {
+            if ( iAvkonAppUi->StatusPane()->CurrentLayoutResId() !=
+                 R_AVKON_STATUS_PANE_LAYOUT_USUAL )
+                {
+                TRAP_IGNORE(
+                    iAvkonAppUi->StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ));
+                }
+            }
+
+        AknLayoutUtils::LayoutMetricsRect(
+            AknLayoutUtils::EMainPane, iModRect );
+
+        if ( iToolbar && iToolbar->IsVisible() 
+                && !Layout_Meta_Data::IsLandscapeOrientation())
+            {
+            iModRect.iBr.iY -= iToolbar->Rect().Height();
+            }
+        GetUPnPPlaybackDialogCustomControl()->SetRect( iModRect );
+
+        // Update album art
+        TRAP_IGNORE( UpdateAlbumArtL( iMedia ));
+
+        GetUPnPPlaybackDialogCustomControl()->DrawDeferred();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::CommandNotSupportedL
+// Shows a Not supported error note
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::CommandNotSupportedL()
+    {
+    HBufC* dialogText = StringLoader::LoadLC(R_MPX_MEDIA_KEYS_NOT_SUPPORTED);
+    CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+    errNote->ExecuteLD( *dialogText );
+    CleanupStack::PopAndDestroy( dialogText );
+    }
+
+// -----------------------------------------------------------------------------
+// Exits the dialog when callback from CIdle
+// -----------------------------------------------------------------------------
+//
+TInt CMPXUPnPPlaybackDialog::DelayedExit( TAny* aPtr )
+    {
+    CMPXUPnPPlaybackDialog* upnpPlaybackDialog =
+        static_cast<CMPXUPnPPlaybackDialog*>(aPtr);
+
+    TRAP_IGNORE(upnpPlaybackDialog->TryExitL(EAknSoftkeyClose));
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::SetVolume
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::SetVolume( const TInt aVolume )
+    {
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdSetVolume );
+    cmd->SetTObjectValueL<TUint>( KMPXCommandPlaybackGeneralData, aVolume );
+    iPlaybackUtility->CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::MuteVolume
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::MuteVolume()
+    {
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdMuteVolume );
+    iPlaybackUtility->CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialog::UnMuteVolume
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::UnMuteVolume()
+    {
+    CMPXCommand* cmd( CMPXCommand::NewL() );
+    CleanupStack::PushL( cmd );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+    cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
+    cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, EPbCmdUnMuteVolume );
+    iPlaybackUtility->CommandL( *cmd );
+    CleanupStack::PopAndDestroy( cmd );
+    }
+
+// ---------------------------------------------------------------------------
+// Updates the middle toolbar button
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::UpdateToolbar()
+    {
+    if ( AknLayoutUtils::PenEnabled() )
+        {
+        MPX_DEBUG1("AknLayoutUtils::PenEnabled() : true");
+        if ( iToolbar && iToolbar->IsVisible())
+            {
+            MPX_DEBUG1("Toolbar() : true");
+            iToolbar->SetDimmed( EFalse );
+            CAknButton* pausePlayControl;
+            CAknButton* skipControl;
+            pausePlayControl = (CAknButton*)(iToolbar->ComponentControl( 1 ));
+            MMPXSource* s = iPlaybackUtility->Source();
+            if ( s )
+                {
+                CMPXCollectionPlaylist* playlist = s->PlaylistL();
+                if ( playlist )
+                    {
+                    if ( playlist->Count() > 0 )
+                        {
+                        if( pausePlayControl )
+                            {
+                            TMPXPlaybackState state = iPlaybackUtility->StateL();
+                            if ((state == EPbStateInitialising) || (state == EPbStatePlaying))
+                               {
+                               pausePlayControl->SetCurrentState(0, ETrue);
+                               }
+                            else
+                               {
+                               pausePlayControl->SetCurrentState(1, ETrue);
+                               }
+                            }
+                        }
+
+                    delete playlist;
+                    }
+                else
+                    {
+                    if( pausePlayControl )
+                        {
+                        TMPXPlaybackState state = iPlaybackUtility->StateL();
+                        if ( ( state == EPbStateInitialising ) ||
+                               ( state == EPbStatePlaying ) )
+                            {
+                            pausePlayControl->SetCurrentState( 0, ETrue );
+                            }
+                        else
+                            {
+                            pausePlayControl->SetCurrentState( 1, ETrue );
+                            }
+                        }
+                    }
+                skipControl = (CAknButton*)(iToolbar->ComponentControl( 0 ));
+                if( skipControl )
+                    {
+                    skipControl->SetCurrentState(1,ETrue);
+                    }
+
+                skipControl = (CAknButton*)(iToolbar->ComponentControl( 2 ));
+                if( skipControl )
+                    {
+                    skipControl->SetCurrentState(1,ETrue);
+                    }
+                }
+            else
+                {
+                iToolbar->SetDimmed( ETrue );
+                }
+            }
+        else
+            {
+            MPX_DEBUG1("Toolbar() : false");
+            }
+        }
+    }
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Used to change toolbar settings before toolbar becomes visible
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::DynInitToolbarL(TInt aResourceId, CAknToolbar* aToolbar)
+    {
+    CAknAppUi* appUi = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi());
+    CAknToolbar* toolbar = appUi->CurrentFixedToolbar();
+    if ( toolbar == aToolbar )
+        {
+        // Put initializations here to take effect before toolbar is shown
+        UpdateToolbar();
+        aToolbar->UpdateBackground();
+       }
+    }
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Handles toolbar events
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialog::OfferToolbarEventL( TInt aCommandId )
+    {
+    TInt commandId = aCommandId;
+    TInt eventModifiers = iToolbar->EventModifiers();
+    if ( eventModifiers == CAknToolbar::ELongPress )
+        {
+        if ( aCommandId == EMPXPbvCmdNextListItem )
+            {
+            commandId = EMPXPbvCmdSeekForward;
+            }
+        else if ( aCommandId == EMPXPbvCmdPreviousListItem )
+            {
+            commandId = EMPXPbvCmdSeekBackward;
+            }
+        }
+    else if ( eventModifiers == CAknToolbar::ELongPressEnded )
+        {
+        if ( aCommandId == EMPXPbvCmdNextListItem || aCommandId == EMPXPbvCmdPreviousListItem )
+            {
+            commandId = EMPXPbvCmdEndSeek;
+            }
+        }
+
+    HandleCommandL( commandId );
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/src/mpxupnpplaybackdialogcustomcontrol.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,203 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player UPnP Playback dialog implementation
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AknUtils.h>
+#include <eiklabel.h>
+#include <StringLoader.h>
+#include <AknsDrawUtils.h>
+#include <AknsBasicBackgroundControlContext.h>
+#include <AknsUtils.h>
+#include <gulicon.h>
+
+#include <mpxupnpplaybackdialog.rsg>
+
+#include "mpxupnpplaybackdialogcustomcontrol.h"
+#include "mpxplaybackviewlayoutinterface.h"
+#include "mpxlog.h"
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialogCustomControl::NewLC
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialogCustomControl*
+    CMPXUPnPPlaybackDialogCustomControl::NewLC(
+    const CCoeControl& aParent,
+    const TRect &aRect,
+    MEikCommandObserver* aCommandObserver,
+    MMPXLayoutSwitchObserver* aLayoutObserver,
+    MMPXPlaybackViewLayout* aLayout,
+    TMPXPlaybackPlayerType aCurrentPlayerType )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialogCustomControl::NewLC" );
+    CMPXUPnPPlaybackDialogCustomControl* self =
+        new ( ELeave ) CMPXUPnPPlaybackDialogCustomControl( aCommandObserver,
+                                                            aLayoutObserver,
+                                                            aLayout);
+    CleanupStack::PushL( self );
+    self->ConstructL( aParent, aRect, aCurrentPlayerType );
+    return self;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialogCustomControl::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialogCustomControl*
+    CMPXUPnPPlaybackDialogCustomControl::NewL(
+    const CCoeControl& aParent,
+    const TRect &aRect,
+    MEikCommandObserver* aCommandObserver,
+    MMPXLayoutSwitchObserver* aLayoutObserver,
+    MMPXPlaybackViewLayout* aLayout,
+    TMPXPlaybackPlayerType aCurrentPlayerType)
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialogCustomControl::NewL" );
+    CMPXUPnPPlaybackDialogCustomControl* self = NewLC(
+        aParent, aRect, aCommandObserver, aLayoutObserver, aLayout, aCurrentPlayerType );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// Destructor
+CMPXUPnPPlaybackDialogCustomControl::~CMPXUPnPPlaybackDialogCustomControl()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialogCustomControl::~CMPXUPnPPlaybackDialogCustomControl" );
+    delete iBackground;
+
+    delete iRemotePlayerIcon;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialogCustomControl::CMPXUPnPPlaybackDialogCustomControl
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialogCustomControl::CMPXUPnPPlaybackDialogCustomControl(
+    MEikCommandObserver* aCommandObserver,
+    MMPXLayoutSwitchObserver* aLayoutObserver,
+    MMPXPlaybackViewLayout* aLayout )
+    {
+    iCommandObserver = aCommandObserver;
+    iLayoutObserver = aLayoutObserver;
+    iMode = EUninitialized;
+    iLayout = aLayout;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialogCustomControl::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialogCustomControl::ConstructL(
+    const CCoeControl& aParent,
+    const TRect &aRect,
+    TMPXPlaybackPlayerType aCurrentPlayerType )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialogCustomControl::ConstructL" );
+
+    CMPXCommonPlaybackViewContainer::ConstructL( aRect );
+
+    if ( aCurrentPlayerType != EPbLocal )
+        {
+        iRemotePlayerUsed = ETrue;
+        }
+
+    // Disables FMTX label
+    SetFMTXMode(EFalse);
+
+    SetMopParent( const_cast < CCoeControl* >( &aParent ) );
+
+
+    SetRect( aRect );
+    ActivateL();
+    MakeVisible( ETrue );
+    }
+
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialogCustomControl::UpdateLayout()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialogCustomControl::UpdateLayout()" );
+
+    CMPXCommonPlaybackViewContainer::UpdateLayout();
+
+    iRemotePlayerIconRect = iLayout->IndicatorLayout( Rect(), EIconRemotePlayer );
+
+    if ( iRemotePlayerIcon )
+        {
+        AknIconUtils::SetSize(
+            iRemotePlayerIcon->Bitmap(), iRemotePlayerIconRect.Size() );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXUPnPPlaybackDialogCustomControl::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG4( "CMPXUPnPPlaybackDialogCustomControl::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+
+    return CMPXCommonPlaybackViewContainer::OfferKeyEventL( aKeyEvent, aType );
+    }
+
+// ---------------------------------------------------------------------------
+// Creates icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialogCustomControl::CreateIconsL()
+    {
+    CMPXCommonPlaybackViewContainer::CreateIconsL();
+
+    // Remote Player
+    delete iRemotePlayerIcon;
+    iRemotePlayerIcon = NULL;
+    iRemotePlayerIcon = iLayout->GetIndicatorIconMaskL( EIconRemotePlayer );
+    }
+
+// ---------------------------------------------------------------------------
+// Redraw part of the screen.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialogCustomControl::RedrawRect(
+    const TRect& aRect,
+    CBitmapContext& aGc) const
+    {
+    CMPXCommonPlaybackViewContainer::RedrawRect( aRect, aGc );
+
+    if ( iRemotePlayerUsed )
+        {
+        DrawIndicator( aGc, aRect, iRemotePlayerIconRect, iRemotePlayerIcon );
+        }
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/src/mpxupnpplaybackdialogcustomcontrolcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player UPnP playback dialog implementation
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "mpxupnpplaybackdialogcustomcontrolcontainer.h"
+#include "mpxupnpplaybackdialogcustomcontrol.h"
+
+// Destructor
+CMPXUPnPPlaybackDialogCustomControlContainer::~CMPXUPnPPlaybackDialogCustomControlContainer() 
+    { 
+    delete iDialogCustomControl; 
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackDialogCustomControlContainer::Draw
+// Removes flicker from CEikDialog's Draw().
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialogCustomControlContainer::Draw( const TRect & ) const
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles a change to the control's resources.
+// ---------------------------------------------------------------------------
+//    
+void CMPXUPnPPlaybackDialogCustomControlContainer::HandleResourceChange( TInt aType )
+    {
+    CCoeControl::HandleResourceChange( aType );    
+    }
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackdialog/src/mpxupnpplaybackdialoglayout.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,257 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Layout and graphic factory for Upnp Playback Dialog
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <barsread.h>
+#include <gulicon.h>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <layoutmetadata.cdl.h>
+#include <data_caging_path_literals.hrh>
+#include <centralrepository.h>
+#include <mpxcommonplaybackview.mbg>
+#include <mpxcommonplaybackview.rsg>
+#include <mpxupnpplaybackview.rsg>
+#include <mpxinternalcrkeys.h>
+#include <mpxlbxextendedfeatures.h>
+#include <mpxuser.h>
+
+#include "mpxupnpplaybackdialoglayout.h"
+#include "mpxlog.h"
+
+using namespace AknLayoutScalable_Apps;
+
+
+// CONSTANTS
+_LIT(KMPXUpnpPlaybackDialogIconFile, "mpxcommonplaybackview.mbm");
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialogLayout* CMPXUPnPPlaybackDialogLayout::NewL()
+    {
+    CMPXUPnPPlaybackDialogLayout* self = CMPXUPnPPlaybackDialogLayout::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialogLayout* CMPXUPnPPlaybackDialogLayout::NewLC()
+    {
+    CMPXUPnPPlaybackDialogLayout* self = new ( ELeave ) CMPXUPnPPlaybackDialogLayout();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialogLayout::~CMPXUPnPPlaybackDialogLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackDialogLayout::CMPXUPnPPlaybackDialogLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackDialogLayout::ConstructL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackDialogLayout::ConstructL" );
+    }
+
+// ---------------------------------------------------------------------------
+// Get layout data for an graphical indicator.
+// ---------------------------------------------------------------------------
+//
+TRect CMPXUPnPPlaybackDialogLayout::IndicatorLayout(
+    const TRect& aParentRect,
+    TMPXPbvIndicator aIndicator )
+    {
+    TInt resId(KErrNotFound);
+
+    // Get Rocker mapping support flag
+    TInt flags( 0 );
+    CRepository* repository( NULL );
+    MPX_TRAPD( err, repository = CRepository::NewL( KCRUidMPXMPFeatures ));
+    if ( KErrNone == err )
+        {
+        repository->Get( KMPXMPLocalVariation, flags );
+        delete repository;
+        repository = NULL;
+        }
+
+    TBool enableButton( flags & KMPXRockerMappingSupport );
+    const TSize screenSize( CCoeEnv::Static()->ScreenDevice()->SizeInPixels() );
+
+    if ( screenSize == TSize( 176,208 ))    //lowest portrait
+        {
+        switch ( aIndicator )
+            {
+            case EIconRemotePlayer:
+                {
+                if ( enableButton )
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT;
+                    }
+                else
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_WITHOUT_ROCKER;
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else if ( screenSize == TSize( 352,416 ))
+        {
+        switch ( aIndicator )
+            {
+            case EIconRemotePlayer:
+                {
+                resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_DOUBLE_PORTRAIT;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else if ( screenSize == TSize( 240,320 ))
+        {
+        switch ( aIndicator )
+            {
+            case EIconRemotePlayer:
+                {
+                if ( enableButton )
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_QVGA_PORTRAIT;
+                    }
+                else
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_QVGA_PORTRAIT_WITHOUT_ROCKER;
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else if ( screenSize == TSize( 320,240 )) // QVGA landscape
+        {
+        switch ( aIndicator )
+            {
+            case EIconRemotePlayer:
+                {
+                if ( enableButton )
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_QVGA_LANDSCAPE;
+                    }
+                else
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_QVGA_LANDSCAPE_WITHOUT_ROCKER;
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+
+    TRect rect;
+    if ( resId != KErrNotFound )
+        {
+        TAknLayoutRect res;
+        res.LayoutRect( aParentRect, resId );
+        rect = res.Rect();
+        }
+    else
+        {
+        rect = CMPXCommonPlaybackViewLayout::IndicatorLayout( aParentRect, aIndicator );
+        }
+
+    return rect;
+    }
+
+// ---------------------------------------------------------------------------
+// Get the bitmap and mask for a given indicator.
+// ---------------------------------------------------------------------------
+//
+CGulIcon* CMPXUPnPPlaybackDialogLayout::GetIndicatorIconMaskL(
+    TMPXPbvIndicator aIndicator )
+    {
+
+    TParse parse;
+    parse.Set( KMPXUpnpPlaybackDialogIconFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    switch ( aIndicator )
+        {
+        case EIconRemotePlayer:
+            {
+            return CreateColorIconL(
+                skin,
+                KAknsIIDQgnIndiMupRandom,
+                KAknsIIDQsnIconColors,
+                EAknsCIQsnIconColorsCG26,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_icon_upnp_remote,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_icon_upnp_remote_mask );
+            }
+        default:
+            {
+            break;
+            }
+        }
+
+    return CMPXCommonPlaybackViewLayout::GetIndicatorIconMaskL( aIndicator );
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/bwinscw/mpxupnpplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	?NewL@CMPXUPnPPlaybackView@@SAPAV1@XZ @ 1 NONAME ; class CMPXUPnPPlaybackView * CMPXUPnPPlaybackView::NewL(void)
+	?NewLC@CMPXUPnPPlaybackView@@SAPAV1@XZ @ 2 NONAME ; class CMPXUPnPPlaybackView * CMPXUPnPPlaybackView::NewLC(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/data/mpxupnpplaybackview.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxupnpplaybackview
+*
+*/
+
+
+
+// RESOURCE NAME IDENTIFIER
+NAME    MUPV // 4 letter ID
+
+// INCLUDES
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+
+#include <mpxcommonplaybackview.rsg>
+#include <mpxcommonplaybackview.loc>
+#include <mpxupnpplaybackview.loc>
+#include "mpxupnpplaybackview.hrh"
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF 
+    {
+    buf = "";
+    }
+
+
+// RESOURCE DEFINITIONS 
+
+// ---------------------------------------------------------------------------
+// r_mpx_upnp_playback_view
+// UPnP playback view information resource.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_VIEW r_mpx_upnp_playback_view
+    {
+    menubar = r_mpx_upnp_playback_view_menubar;
+    cba = R_AVKON_SOFTKEYS_OPTIONS_BACK;
+    toolbar = R_MPX_PBV_TOUCH_TOOLBAR;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_upnp_playback_view_menubar
+// UPnP playback view menu bar.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_BAR r_mpx_upnp_playback_view_menubar
+    {
+    titles =
+        {
+        MENU_TITLE
+            {
+            menu_pane = R_MPX_PLAYBACK_VIEW_MENU;
+            },
+        MENU_TITLE
+            {
+            menu_pane = r_mpx_upnp_podcast_playback_view_menu1;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_upnp_podcast_playback_view_menu1
+// Podcast playback view menu items.
+// ---------------------------------------------------------------------------
+//
+RESOURCE MENU_PANE r_mpx_upnp_podcast_playback_view_menu1
+    {
+    items=
+        {
+        MENU_ITEM
+            { 
+            command = EMPXPbvCmdGoToPodcastMenu;
+            txt = qtn_mus_options_go_to_podcast_menu;
+            }
+        };
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_qtn_nmp_unknown_title
+// Text to show when podcast title information is not available.
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_qtn_nmp_unknown_title
+    {
+    buf = qtn_nmp_unknown;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_remote_indi_layout
+// Image layout for shuffle indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_remote_indi_layout
+    {
+    l = 144; t = 62; W = 26; H = 18;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_remote_indi_layout_without_rocker
+// Image layout for shuffle indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_remote_indi_layout_without_rocker
+    {
+    l = 144; t = 62; W = 26; H = 18;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_remote_indi_layout_double_portrait
+// Image layout for shuffle indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_remote_indi_layout_double_portrait
+    {
+    l = 144; t = 62; W = 26; H = 18;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_remote_indi_layout_qvga_portrait
+// Image layout for shuffle indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_remote_indi_layout_qvga_portrait
+    {
+    l = 203; t = 51; W = 22; H = 15;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_remote_indi_layout_qvga_portrait_without_rocker
+// Image layout for remote player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_remote_indi_layout_qvga_portrait_without_rocker
+    {
+    l = 203; t = 51; W = 22; H = 15;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_remote_indi_layout_qvga_landscape
+// Image layout for remote player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_remote_indi_layout_qvga_landscape
+    {
+    l = 229; t = 6; W = 22; H = 15;
+    }
+
+// ---------------------------------------------------------------------------
+// r_mpx_pbv_remote_indi_layout_qvga_landscape_without_rocker
+// Image layout for remote player indicator.
+// ---------------------------------------------------------------------------
+//
+RESOURCE AVKON_LAYOUT_RECT r_mpx_pbv_remote_indi_layout_qvga_landscape_without_rocker
+    {
+    l = 202; t = 6; W = 22; H = 15;
+    }
+
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/eabi/mpxupnpplaybackviewU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,4 @@
+EXPORTS
+	_ZN20CMPXUPnPPlaybackView4NewLEv @ 1 NONAME
+	_ZN20CMPXUPnPPlaybackView5NewLCEv @ 2 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxupnpplaybackview.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxupnpplaybackview.loc	APP_LAYER_LOC_EXPORT_PATH(mpxupnpplaybackview.loc)
+
+PRJ_EXTENSIONS
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mpxupnpplaybackview.mif
+OPTION HEADERFILE mpxupnpplaybackview.mbg
+OPTION SOURCES -c8,8 qgn_graf_mup_icon_upnp_remote
+END
+
+
+PRJ_MMPFILES
+mpxupnpplaybackview.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1 @@
+/c8,8 qgn_graf_mup_icon_upnp_remote.svg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/group/mpxupnpplaybackview.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project mpxupnpplaybackview.
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+
+TARGET          mpxupnpplaybackview.dll
+TARGETTYPE      dll
+UID             0x1000006C 0x101FFC97
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+VERSION 15.0
+
+
+
+SOURCEPATH      ../src
+SOURCE          mpxupnpplaybackviewcontainer.cpp
+SOURCE          mpxupnpplaybackview.cpp
+SOURCE          mpxupnpplaybackviewimp.cpp
+SOURCE          mpxupnpplaybackviewlayout.cpp
+
+START RESOURCE  ../data/mpxupnpplaybackview.rss
+DEPENDS mpxcommonplaybackview.rsg
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../inc
+USERINCLUDE     ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         apparc.lib
+LIBRARY         cone.lib
+LIBRARY         eikcore.lib 
+LIBRARY         avkon.lib
+LIBRARY         hlplch.lib
+LIBRARY         ws32.lib
+LIBRARY         fbscli.lib
+LIBRARY         bitgdi.lib
+LIBRARY         gdi.lib
+LIBRARY         egul.lib
+LIBRARY         eikctl.lib
+LIBRARY         eiksrv.lib
+LIBRARY         eikcoctl.lib
+LIBRARY         efsrv.lib
+LIBRARY         bafl.lib
+LIBRARY         aknicon.lib
+LIBRARY         featmgr.lib
+LIBRARY         aknskins.lib
+LIBRARY         aknskinsrv.lib
+LIBRARY         commonengine.lib
+LIBRARY         centralrepository.lib
+LIBRARY         aknlayout2scalable.lib
+LIBRARY         cdlengine.lib
+
+LIBRARY         mpxplaybackutility.lib
+LIBRARY         mpxcollectionutility.lib
+LIBRARY         mpxcommon.lib
+LIBRARY         mpxmediakeyhandler.lib
+LIBRARY         mpxcommonui.lib
+LIBRARY         mpxviewutility.lib
+LIBRARY         mpxcommonplaybackview.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/group/mpxupnpplaybackviewicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project mpxupnpplaybackview
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/mpxupnpplaybackview.mif
+HEADERFILENAME=$(HEADERDIR)/mpxupnpplaybackview.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/inc/mpxupnpplaybackview.hlp.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CsHelp resource headers for project mpxupnpplaybackview
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKVIEW_HLP_HRH
+#define MPXUPNPPLAYBACKVIEW_HLP_HRH
+
+_LIT( KMUS_HLP_UPNP_PLAYBACK_VIEW, "MUS_HLP_UPNP_PLAYBACK_VIEW" );
+
+#endif  // MPXUPNPPLAYBACKVIEW_HLP_HRH
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/inc/mpxupnpplaybackview.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for project mpxupnpplaybackview
+*
+*/
+
+
+
+#ifndef MPXUPNPPLAYBACKVIEW_HRH
+#define MPXUPNPPLAYBACKVIEW_HRH
+
+#define KMPXUPnPPlaybackViewId    0x101FFC97
+
+/** Command ID's. */
+enum TMPXUPnPPlaybackViewCommandIds
+    {
+    EMPXPbvCmdGoToPodcastMenu = 0x1A00
+    };
+
+#endif  // MPXUPNPPLAYBACKVIEW_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/inc/mpxupnpplaybackviewcontainer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX upnp playback view's container implementation.
+*
+*/
+
+
+
+#ifndef C_CMPXUPNPPLAYBACKVIEWCONTAINER_H
+#define C_CMPXUPNPPLAYBACKVIEWCONTAINER_H
+
+
+// INCLUDES
+#include "mpxcommonplaybackviewcontainer.h"
+
+
+// FORWARD DECLARATIONS
+class MMPXLayoutSwitchObserver;
+class MMPXPlaybackViewLayout;
+
+// CLASS DECLARATION
+
+/**
+ *  Container class for audio view.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXUPnPPlaybackViewContainer ) : public CMPXCommonPlaybackViewContainer
+    {
+public:
+
+    /**
+     * C++ default constructor.
+     *
+     * @param aLayoutObserver    Observer to send layout switch events to.
+     * @param aIsEmbedded        ETrue if Music Player is in embedded mode.
+     */
+    CMPXUPnPPlaybackViewContainer(
+        MEikCommandObserver* aCommandObserver,
+        MMPXLayoutSwitchObserver* aLayoutObserver,
+        MMPXPlaybackViewLayout* aLayout );
+
+    /**
+     * Symbian 2nd phase constructor.
+     * 
+     * @param aRect Frame rectangle for container.
+     */
+    void ConstructL( const TRect& aRect );
+
+    /**
+     * Destructor.
+     */
+    ~CMPXUPnPPlaybackViewContainer();
+
+    /**
+     * Set layout for all elements and set sizes for icons.
+     *
+     * @since S60 3.0
+     */
+    void UpdateLayout();
+    
+// from base class CoeControl
+
+    /**
+     * From CoeControl.
+     * Handles key events.
+     *
+     * @param aKeyEvent The key event.
+     * @param aType The type of key event.
+     */
+    TKeyResponse OfferKeyEventL(
+        const TKeyEvent& aKeyEvent,
+        TEventCode aType );
+
+    /**
+     * From CoeControl.
+     * Gets the control's help context.
+     *
+     * @param aContext The control's help context.
+     */
+    void GetHelpContext( TCoeHelpContext& aContext ) const;
+    
+// from base class MMPXButtonCmdObserver
+    
+    /**
+     * From MMPXButtonCmdObserver
+     * Handle a button command.
+     * @param aCommand Command id, as specified in the button constructor.
+     */
+    void HandleButtonCommandL( TInt aCommand );
+    
+private:    // new methods
+
+    /**
+     * Creates icons.
+     */
+    void CreateIconsL();
+
+    /**
+     * Redraw part of the screen to the bitmap context.
+     *
+     * @param aRect Area to be redrawn.
+     * @param aGc Graphics context to draw to.
+     */
+    void RedrawRect(
+        const TRect& aRect,
+        CBitmapContext& aGc) const;
+
+    
+private:    // data
+        
+    CGulIcon* iRemotePlayerIcon;    // owned
+    TRect iRemotePlayerIconRect;
+    TBool iRemotePlayerUsed;
+    
+    TKeyEvent iLastKeyEvent;
+    TEventCode iLastKeyType;    
+    };
+
+#endif  // C_CMPXUPNPPLAYBACKVIEWCONTAINER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/inc/mpxupnpplaybackviewimp.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,230 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX upnp playback view implementation
+*
+*/
+
+
+
+#ifndef C_CMPXUPNPPLAYBACKVIEWIMP_H
+#define C_CMPXUPNPPLAYBACKVIEWIMP_H
+
+
+// INCLUDES
+#include <akntoolbarobserver.h> 
+#include "mpxupnpplaybackview.h"
+
+// FORWARD DECLARATIONS
+class CMPXUPnPPlaybackViewContainer;
+class CMPXUPnPPlaybackViewLayout;
+class CAknToolbar;  
+
+// CLASS DECLARATION
+
+/**
+ *  MPX playback view.
+ *
+ *  @lib mpxplaybackview.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXUPnPPlaybackViewImp ) : public CMPXUPnPPlaybackView,
+                                               public MAknToolbarObserver
+
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXUPnPPlaybackViewImp* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXUPnPPlaybackViewImp* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXUPnPPlaybackViewImp();
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXUPnPPlaybackViewImp();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     *  Handle playback message
+     *
+     *  @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL(
+        const CMPXMessage& aMessage );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     *  @param aData Extra data parameter, used for any extra information
+     *               along with the state change message
+     */
+    void DoHandleStateChangedL(
+        TMPXPlaybackState aState,
+        TInt aData );
+
+    /**
+     * Retrieves the current player name and updates the Label
+     */
+    void UpdateTitlePaneL();
+
+    /**
+     * Updates track info field.
+     *
+     * @param aMedia Media's properties. If NULL, default info will
+     *                    be shown.
+     */
+    void UpdateTrackInfoL( const CMPXMedia* aMedia );
+
+
+// from base class MEikMenuObserver
+
+    /**
+     * From MEikMenuObserver
+     * Dynamically initialises a menu pane.
+     *
+     * @param aResourceId The ID of the menu pane.
+     * @param aMenuPane The menu pane itself.
+     */
+    void DynInitMenuPaneL(
+        TInt aResourceId,
+        CEikMenuPane* aMenuPane );
+
+
+// from base class CAknView
+
+    /**
+     * From CAknView
+     * Returns views id.
+     *
+     * @since 3.0
+     * @return Views Uid
+     */
+    TUid Id() const;
+
+    /**
+     * From CAknView
+     * Command handling function.
+     *
+     * @since 3.0
+     * @param aCommand Command which is handled
+     */
+    void HandleCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Processes user commands.
+     *
+     * @since 3.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void ProcessCommandL( TInt aCommand );
+
+    /**
+     * From CAknView
+     * Handles a view activation.
+     *
+     * @param aPrevViewId Specifies the view previously active.
+     * @param aCustomMessageId Specifies the message type.
+     * @param aCustomMessage The activation message.
+     */
+    void DoActivateL(
+        const TVwsViewId& aPrevViewId,
+        TUid aCustomMessageId,
+        const TDesC8& aCustomMessage );
+
+    /**
+     * Displays a wait note when callback from CIdle
+     */
+    static TInt LoadingSong( TAny* aPtr );
+
+    /**
+     * Displays a wait note
+     */
+    void LoadingSongL();
+
+    /**
+     * Dismisses loading song wait note
+     */
+    void DismissWaitNoteL();
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    void HandleErrorL( TInt aError );
+
+// from base class MProgressDialogCallback
+    /**
+     * From MProgressDialogCallback
+     * Callback method
+     * Get's called when a dialog is dismissed.
+     */
+    void DialogDismissedL( TInt aButtonId );
+
+    /**
+     * From MAknToolbarObserver
+     * Processes user commands.
+     *
+     * @since 5.0
+     * @param aCommand ID of the command to respond to.
+     */
+    void OfferToolbarEventL( TInt aCommandId );
+
+    /**
+     * From MAknToolbarObserver
+     * Used to change toolbar settings before it is made visible
+     *
+     * @since 5.0
+     * @param aResourceId The ID of the menu pane.
+	 * @param aToolBar The ToolBar itself.
+     */
+    void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolBar );
+
+private:    // data
+    CMPXUPnPPlaybackViewLayout* iPlaybackViewLayout;    // owned
+    TInt iUpnpResourceOffset;       // must be freed
+
+    CIdle* iLoadingWaitNote; // Owned
+    TBool iUPnPLoadingWaitNoteDisplayed;
+    TBool iPodcastPlayback;
+    CAknToolbar* iToolbar; //owned
+    };
+
+#endif  // C_CMPXUPNPPLAYBACKVIEWIMP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/inc/mpxupnpplaybackviewlayout.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,110 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  An interface providing skin and layout data for upnp playback view.
+*
+*/
+
+
+#ifndef C_CMPXUPNPPLAYBACKVIEWLAYOUT_H
+#define C_CMPXUPNPPLAYBACKVIEWLAYOUT_H
+
+//  INCLUDES
+#include "mpxcommonplaybackviewlayout.h"
+
+// CLASS DECLARATION
+
+/**
+*  An interface providing skin and layout data for playback view.
+*
+*  @lib mpxplaybackview.dll
+*  @since S60 v3.0
+*/
+NONSHARABLE_CLASS( CMPXUPnPPlaybackViewLayout ) : public CMPXCommonPlaybackViewLayout
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXUPnPPlaybackViewLayout* NewL();
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since 3.0
+     * @return Pointer to newly created object.
+     */
+    static CMPXUPnPPlaybackViewLayout* NewLC();
+
+    /**
+     * Destructor.
+     */
+    ~CMPXUPnPPlaybackViewLayout();
+
+    /**
+     * Get layout data for an graphical indicator.
+     *
+     * @since 3.0
+     * @param aParentRect Parent control's rect
+     * @param  aIndicator Enumeration value identifying the indicator
+     * @return Layout data
+     */
+    TRect IndicatorLayout(
+        const TRect& aParentRect,
+        TMPXPbvIndicator aIndicator );
+
+    /**
+     * Get the bitmap and mask for a given indicator.
+     *
+     * @since 3.0
+     * @param  aIndicator   Enumeration value identifying the indicator
+     * @return CGulIcon     Indicator graphic and mask. Ownership 
+     *                      transferred to caller.
+     */
+    CGulIcon* GetIndicatorIconMaskL(
+        TMPXPbvIndicator aIndicator );
+
+    /**
+     * Sets whether we should use podcast or normal playback album art icon
+     *
+     * @since 3.1
+     * @param  aPodcastAlbumArt true if we're playing a podcast
+     * @return void
+     */
+        
+    void SetAlbumArtLayout(TBool aPodcastAlbumArt);
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CMPXUPnPPlaybackViewLayout();
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+    
+private:    // Data
+
+    TBool iPodcastAlbumArt;
+    };
+
+#endif  // C_CMPXUPNPPLAYBACKVIEWLAYOUT_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/loc/mpxupnpplaybackview.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxupnpplaybackview
+*
+*/
+
+
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+
+
+// LOCALISATION STRINGS
+
+// d:Text in main pane.
+// d:Shown when no title metadata can be found in the track.
+// l:main_mup3_pane_t1
+// r:5.0
+//
+#define qtn_nmp_unknown "Unknown"
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/src/mpxupnpplaybackview.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Upnp Playback view
+*
+*/
+
+
+
+// INCLUDE FILES
+#include "mpxupnpplaybackview.h"
+#include "mpxupnpplaybackviewimp.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXUPnPPlaybackView* CMPXUPnPPlaybackView::NewL()
+    {
+    return CMPXUPnPPlaybackViewImp::NewL();
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXUPnPPlaybackView* CMPXUPnPPlaybackView::NewLC()
+    {
+    return CMPXUPnPPlaybackViewImp::NewLC();
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackView::~CMPXUPnPPlaybackView()
+    {
+    // Do nothing
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/src/mpxupnpplaybackviewcontainer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Upnp Playback view's container.
+*
+*/
+
+
+
+// INCLUDE FILES
+
+#include <AknDef.h>
+#include <AknsUtils.h>
+#include <gulicon.h>
+#include <mpxconstants.h>
+#include <aknnotewrappers.h>  // error note
+#include <StringLoader.h>
+#include <mpxcommonplaybackview.rsg>
+#include "mpxupnpplaybackview.hlp.hrh"
+#include "mpxupnpplaybackviewcontainer.h"
+#include "mpxplaybackviewlayoutinterface.h"
+#include "mpxcommonplaybackview.hrh" // playback command
+#include "mpxlog.h"
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewContainer::CMPXUPnPPlaybackViewContainer(
+    MEikCommandObserver* aCommandObserver,
+    MMPXLayoutSwitchObserver* aLayoutObserver,
+    MMPXPlaybackViewLayout* aLayout )
+    {
+    iCommandObserver = aCommandObserver;
+    iLayoutObserver = aLayoutObserver;
+    iMode = EUninitialized;
+    iLayout = aLayout;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewContainer::ConstructL( const TRect& aRect )
+    {
+    MPX_DEBUG1( "CMPXUPnPPlaybackViewContainer::ConstructL() entering" );
+
+    CMPXCommonPlaybackViewContainer::ConstructL( aRect );
+
+    // TEMPORARY
+    iRemotePlayerUsed = ETrue;
+
+    // Disables FMTX label
+    SetFMTXMode(EFalse);
+
+    MPX_DEBUG1( "CMPXUPnPPlaybackViewContainer::ConstructL() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewContainer::~CMPXUPnPPlaybackViewContainer()
+    {
+    delete iRemotePlayerIcon;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Set layout for all elements and set sizes for icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewContainer::UpdateLayout()
+    {
+    MPX_DEBUG1( "CMPXUPnPPlaybackViewContainer::UpdateLayout() entering" );
+
+    CMPXCommonPlaybackViewContainer::UpdateLayout();
+
+    iRemotePlayerIconRect = iLayout->IndicatorLayout( Rect(), EIconRemotePlayer );
+
+    if ( iRemotePlayerIcon )
+        {
+        AknIconUtils::SetSize(
+            iRemotePlayerIcon->Bitmap(), iRemotePlayerIconRect.Size() );
+        }
+
+    MPX_DEBUG1( "CMPXUPnPPlaybackViewContainer::UpdateLayout() exiting" );
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Handles key events.
+// ---------------------------------------------------------------------------
+//
+TKeyResponse CMPXUPnPPlaybackViewContainer::OfferKeyEventL(
+    const TKeyEvent& aKeyEvent,
+    TEventCode aType )
+    {
+    MPX_DEBUG4( "CMPXUPnPPlaybackViewContainer::OfferKeyEventL(iCode=%d, iScanCode=%d, aType=%d)",
+        aKeyEvent.iCode, aKeyEvent.iScanCode, aType );
+
+    if ( ( iLastKeyEvent.iScanCode == aKeyEvent.iScanCode ) &&
+         ( iLastKeyType == aType ) &&
+         ( iLastKeyType == EEventKeyUp ) )
+        {
+        return EKeyWasConsumed;
+        }
+    else
+        {
+        iLastKeyEvent = aKeyEvent;
+        iLastKeyType = aType;
+
+        return CMPXCommonPlaybackViewContainer::OfferKeyEventL( aKeyEvent, aType );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CCoeControl
+// Gets the control's help context.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewContainer::GetHelpContext(
+    TCoeHelpContext& aContext ) const
+    {
+    aContext.iMajor = KAppUidMusicPlayerX;
+    aContext.iContext = KMUS_HLP_UPNP_PLAYBACK_VIEW;
+    }
+
+// ---------------------------------------------------------------------------
+// Creates icons.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewContainer::CreateIconsL()
+    {
+    CMPXCommonPlaybackViewContainer::CreateIconsL();
+
+    delete iRemotePlayerIcon;
+    iRemotePlayerIcon = NULL;
+
+    // Remote Player
+    iRemotePlayerIcon = iLayout->GetIndicatorIconMaskL( EIconRemotePlayer );
+    }
+
+// ---------------------------------------------------------------------------
+// Redraw part of the screen.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewContainer::RedrawRect(
+    const TRect& aRect,
+    CBitmapContext& aGc) const
+    {
+    CMPXCommonPlaybackViewContainer::RedrawRect( aRect, aGc );
+
+    if ( iRemotePlayerUsed )
+        {
+        DrawIndicator( aGc, aRect, iRemotePlayerIconRect, iRemotePlayerIcon );
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackViewContainer::HandleButtonCommandL
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewContainer::HandleButtonCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2("CMPXUPnPPlaybackViewContainer::HandleButtonCommandL(%d) entering", aCommand);
+
+    switch (aCommand)
+        {
+        case EMPXPbvCmdSeekForward:
+        case EMPXPbvCmdSeekBackward:
+            {
+            HBufC* dialogText = StringLoader::LoadLC(R_MPX_MEDIA_KEYS_NOT_SUPPORTED);
+            CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+            errNote->ExecuteLD( *dialogText );
+            CleanupStack::PopAndDestroy( dialogText );
+
+            // The error note consumed the up key event so it needs
+            //to be sent again
+            if ( iLastKeyType != EEventKeyUp )
+                {
+                iLastKeyType = EEventKeyUp;
+                CMPXCommonPlaybackViewContainer::OfferKeyEventL( iLastKeyEvent,
+                                                                   EEventKeyUp );
+                }
+            break;
+            }
+        case EMPXPbvCmdEndSeek:
+            {
+            // not used/forwarded
+            break;
+            }
+        default:
+            {
+            CMPXCommonPlaybackViewContainer::HandleButtonCommandL( aCommand );
+            break;
+            }
+        }
+    MPX_DEBUG1("CMPXUPnPPlaybackViewContainer::HandleButtonCommandL() exiting");
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/src/mpxupnpplaybackviewimp.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,813 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of Upnp Playback view
+*  Version     : %version: da1mmcf#35.1.3.1.4 % << Don't touch! Updated by Synergy at check-out.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <aknViewAppUi.h>
+#include <eikmenub.h>
+#include <StringLoader.h>
+#include <eikapp.h>
+#include <AknUtils.h>
+#include <akntitle.h>
+#include <akntoolbar.h>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+#include <aknnotewrappers.h> // CAknErrorNote
+#include <ctsydomainpskeys.h> // KTelephonyCallState
+#include <e32property.h>  // RProperty
+#include <featmgr.h>
+
+#include <mpxplaybackmessage.h>
+#include <mpxplaybackutility.h>
+#include <mpxviewutility.h>
+#include <mpxviewpluginmanager.h>
+#include <mpxviewplugin.h>
+#include <mpxmusicplayerviewplugin.hrh>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionutility.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxcommonplaybackview.rsg>
+#include <mpxupnpplaybackview.rsg>
+#include <mpxuser.h>
+#include "mpxcommonplaybackview.hrh"
+#include "mpxcommonuihelper.h"
+#include "mpxupnpplaybackview.hrh"
+#include "mpxupnpplaybackviewimp.h"
+#include "mpxupnpplaybackviewcontainer.h"
+#include "mpxupnpplaybackviewlayout.h"
+#include "mpxlog.h"
+#include "mpxconstants.h"
+
+
+// CONSTANTS
+_LIT( KMPXUpnpPlaybackRscPath, "mpxupnpplaybackview.rsc" );
+const TUid KMPXUpnpNPVImpmentationUid = { 0x101FFC99 };
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewImp::CMPXUPnPPlaybackViewImp()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::ConstructL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewImp::ConstructL" );
+
+    CMPXCommonPlaybackViewImp::ConstructL();
+
+    // Override base class setting to allow
+    // upnp playback to properly fetch media properties.
+    iLastPBViewActivated = ETrue;
+
+    CCoeEnv* coeEnv = iEikonEnv;
+    TParse parse;
+    parse.Set( KMPXUpnpPlaybackRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile = parse.FullName();
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( coeEnv->FsSession(), resourceFile );
+    iUpnpResourceOffset = coeEnv->AddResourceFileL( resourceFile );
+
+    iPodcastPlayback = EFalse;
+
+    BaseConstructL( R_MPX_UPNP_PLAYBACK_VIEW );
+	if ( AknLayoutUtils::PenEnabled() )
+        {
+        CAknView::ShowToolbarOnViewActivation(ETrue);
+        if ( Toolbar() )
+            {
+            iToolbar = Toolbar();
+            iToolbar->SetToolbarObserver( this );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewImp* CMPXUPnPPlaybackViewImp::NewL()
+    {
+    CMPXUPnPPlaybackViewImp* self = CMPXUPnPPlaybackViewImp::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewImp* CMPXUPnPPlaybackViewImp::NewLC()
+    {
+    CMPXUPnPPlaybackViewImp* self = new ( ELeave ) CMPXUPnPPlaybackViewImp();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewImp::~CMPXUPnPPlaybackViewImp()
+    {
+    MPX_DEBUG1( "CMPXUPnPPlaybackViewImp::~CMPXUPnPPlaybackViewImp entering" );
+
+    delete iPlaybackViewLayout;
+
+    if ( iUpnpResourceOffset )
+        {
+        iEikonEnv->DeleteResourceFile( iUpnpResourceOffset );
+        }
+
+    if ( iLoadingWaitNote )
+        {
+        iLoadingWaitNote->Cancel();
+        delete iLoadingWaitNote;
+        }
+    MPX_DEBUG1( "CMPXUPnPPlaybackViewImp::~CMPXUPnPPlaybackViewImp exiting" );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::DoHandlePlaybackMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewImp::DoHandlePlaybackMessageL" );
+
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt type( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        switch ( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) )
+            {
+            case TMPXPlaybackMessage::EError:
+                {
+                TInt error( data );
+                if ( KErrNone != error )
+                    {
+                    UpdateTitlePaneL();
+                    DismissWaitNoteL();
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::ESubPlayersChanged:
+            case TMPXPlaybackMessage::EPlayerChanged:
+                {
+                MPX_DEBUG2( "HandlePlaybackMessageL - ESubPlayersChanged(%d)", type );
+                UpdateTitlePaneL();
+                break;
+                }
+            case TMPXPlaybackMessage::EPlayerUnavailable:
+                {
+                MPX_DEBUG2( "HandlePlaybackMessageL - EPlayerUnavailable(%d)", type );
+                TUid activeView = iViewUtility->ActiveViewType();
+                if ( activeView == TUid::Uid( KMPXPluginTypePlaybackUid ) )
+                    {
+                    if ( data == KErrNotFound )
+                        {
+                        if ( iSubPlayerName )
+                            {
+                            HBufC* dialogText = StringLoader::LoadLC(
+                                                R_MPX_NOTE_REMOTE_CONNECTION_FAILED,
+                                                *iSubPlayerName );
+                            CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+                            errNote->SetTimeout(CAknNoteDialog::ELongTimeout);
+                            errNote->ExecuteLD( *dialogText );
+                            CleanupStack::PopAndDestroy( dialogText );
+                            }
+                        }
+
+                    // Remove from view utility's stack so that activating the
+                    // previous view will not activate this one.
+                    // have to use plugin implementation UID
+                    CMPXViewPlugin* p = iViewUtility->ViewPluginManager().PluginL( KMPXUpnpNPVImpmentationUid );
+                    p->DeactivateView();
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::EInitializeComplete:
+                {
+                DismissWaitNoteL();
+                break;
+                }
+            case TMPXPlaybackMessage::EAccessoryChanged:
+                {
+                MPX_DEBUG2( "HandlePlaybackMessageL - EAccessoryChanged(%d)", type );
+
+                // Get call status and type.
+                TInt callState( EPSCTsyCallStateUninitialized );
+
+                // Ignore error
+                RProperty::Get( KPSUidCtsyCallInformation,
+                                KCTsyCallState,
+                                callState );
+                MPX_DEBUG2("CMPXUPnPPlaybackViewImp EAccessoryChanged call state: %d", callState );
+
+                if ( callState != EPSCTsyCallStateConnected )
+                    {
+                    TMPXPlaybackAccessoryMode mode( static_cast<TMPXPlaybackAccessoryMode>( type ));
+                    TBool resetToLocal( EFalse );
+#ifdef __ACCESSORY_FW
+                    resetToLocal = ( EPbAccessoryWiredHeadset == mode ||
+                                     EPbAccessoryWirelessHeadset == mode ||
+                                     EPbAccessoryMusicStand == mode ||
+                                     EPbAccessoryTVOut == mode ||
+                                     EPbAccessoryHeadphones == mode );
+#else
+                    resetToLocal = ( EPbAccessoryHeadset == mode ||
+                                     EPbAccessoryLoopset == mode );
+#endif
+                    if ( resetToLocal )
+                        {
+                        SelectNewPlayerL( EMPXPbvCmdUpnpPlayViaLocal );
+                        GetCurrentPlayerDetails();
+                        }
+                    }
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+		        MPX_DEBUG1( "HandlePlaybackMessageL - EStateChanged" );
+                UpdateMiddleSoftKeyDisplayL();
+                UpdateToolbar();
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+
+    CMPXCommonPlaybackViewImp::DoHandlePlaybackMessageL( aMessage );
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::DoHandleStateChangedL(
+    TMPXPlaybackState aState,
+    TInt aData )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewImp::DoHandleStateChangedL" );
+    MPX_DEBUG2( "CMPXUPnPPlaybackViewImp::DoHandleStateChangedL %d", aState );
+
+    if ( ( aState == EPbStatePaused ) &&
+         ( aData == KErrDisconnected ) )
+        {
+        TUid activeView = iViewUtility->ActiveViewType();
+        if ( activeView == TUid::Uid( KMPXPluginTypePlaybackUid ) )
+            {
+            if ( iSubPlayerName )
+                {
+                HBufC* dialogText = StringLoader::LoadLC(
+                                    R_MPX_NOTE_REMOTE_CONNECTION_FAILED,
+                                    *iSubPlayerName );
+                CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+                errNote->SetTimeout(CAknNoteDialog::ELongTimeout);
+                errNote->ExecuteLD( *dialogText );
+                CleanupStack::PopAndDestroy( dialogText );
+                }
+
+            // UPnP connection failed, reset playback to Local
+            SelectNewPlayerL( EMPXPbvCmdUpnpPlayViaLocal );
+            GetCurrentPlayerDetails();
+            }
+        }
+    else
+        {
+        CMPXCommonPlaybackViewImp::DoHandleStateChangedL( aState, aData );
+        }
+
+    switch ( aState )
+        {
+        case EPbStateStopped:
+        case EPbStatePlaying:
+        case EPbStatePaused:
+            {
+            DismissWaitNoteL();
+            break;
+            }
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXUPnPPlaybackViewImp::UpdateTitlePaneL
+// Retrieves the current player name and updates the Label
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::UpdateTitlePaneL()
+    {
+    TUid activeView = iViewUtility->ActiveViewType();
+    if ( activeView == TUid::Uid( KMPXPluginTypePlaybackUid ) )
+        {
+        CAknTitlePane* title( NULL );
+
+        TRAP_IGNORE(
+            {
+            title = static_cast<CAknTitlePane*>
+                ( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) );
+            } );
+
+        GetCurrentPlayerDetails();
+
+        if ( title )
+            {
+            if ( iCurrentPlayerType != EPbLocal)
+                {
+                if ( iSubPlayerName )
+                    {
+                    title->SetTextL( *iSubPlayerName );
+                    }
+                }
+            else
+                {
+                CMPXCommonPlaybackViewImp::UpdateTitlePaneL();
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Updates track info field.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::UpdateTrackInfoL(
+    const CMPXMedia* aMedia )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewImp::UpdateTrackInfo" );
+
+    CMPXCommonPlaybackViewImp::UpdateTrackInfoL( aMedia );
+
+    if ( iPodcastPlayback &&
+         iContainer &&
+         !iSwitchingView )
+        {
+        if ( aMedia )
+            {
+            // Set ETextArtist field as Podcast Title
+            if ( aMedia->IsSupported(KMPXMediaMusicAlbum))
+                {
+                HBufC* titleText = aMedia->ValueText(KMPXMediaMusicAlbum).AllocL();
+                CleanupStack::PushL(titleText);
+                if ( titleText->Length() > 0)
+                    {
+                    iContainer->UpdateLabelL( ETextArtist, *titleText );
+                    }
+                else
+                    {
+                    HBufC* unknownText =
+                        StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_TITLE );
+                    iContainer->UpdateLabelL(
+                        ETextArtist, *unknownText );
+                    CleanupStack::PopAndDestroy( unknownText );
+                    }
+                CleanupStack::PopAndDestroy( titleText );
+                }
+            else
+                {
+                HBufC* unknownText =
+                        StringLoader::LoadLC( R_MPX_QTN_NMP_UNKNOWN_TITLE );
+                iContainer->UpdateLabelL(
+                    ETextArtist, *unknownText );
+                CleanupStack::PopAndDestroy( unknownText );
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MEikMenuObserver
+// Dynamically initialises a menu pane.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::DynInitMenuPaneL(
+    TInt aResourceId,
+    CEikMenuPane* aMenuPane )
+    {
+    // Call base clase to handle most cases
+    CMPXCommonPlaybackViewImp::DynInitMenuPaneL( aResourceId, aMenuPane );
+
+    switch ( aResourceId )
+        {
+        case R_MPX_UPNP_PODCAST_PLAYBACK_VIEW_MENU1:
+            {
+            if ( !iPodcastPlayback )
+                {
+                aMenuPane->SetItemDimmed(
+                        EMPXPbvCmdGoToPodcastMenu,
+                        ETrue );
+                }
+            break;
+            }
+        case R_MPX_PLAYBACK_VIEW_MENU:
+            {
+            aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdOpenMusicSettings,
+                    ETrue );
+
+            aMenuPane->SetItemDimmed(
+                    EMPXPbvCmdEqualizer,
+                    ETrue );
+
+
+
+			// Check if FM Transmitter is supported
+			if ( !FeatureManager::FeatureSupported( KFeatureIdFmtx ) )
+				{
+				aMenuPane->SetItemDimmed(
+						EMPXPbvCmdFMTransmitter,
+						ETrue );
+				}
+
+            if ( iPodcastPlayback )
+                {
+                // dim the options that aren't applicable
+                // to podcast collection
+                aMenuPane->SetItemDimmed(
+                        EMPXPbvCmdGotoMusicMenu,
+                        ETrue );
+                aMenuPane->SetItemDimmed(
+                        EMPXPbvCmdAddToPlaylist,
+                        ETrue );
+            aMenuPane->SetItemDimmed(
+                EMPXPbvCmdUseAsCascade,
+                ETrue );
+                aMenuPane->SetItemDimmed(
+                        EMPXPbvCmdRepeat,
+                        ETrue );
+                aMenuPane->SetItemDimmed(
+                        EMPXPbvCmdRandom,
+                        ETrue );
+                }
+            break;
+            }
+        default:
+            {
+            // Do nothing
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Returns views id.
+// ---------------------------------------------------------------------------
+//
+TUid CMPXUPnPPlaybackViewImp::Id() const
+    {
+    return TUid::Uid( KMPXUPnPPlaybackViewId );
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Command handling function.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::HandleCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2( "CMPXUPnPPlaybackViewImp::HandleCommandL(%d)", aCommand );
+
+    switch( aCommand )
+        {
+        case EMPXPbvCmdGoToPodcastMenu:
+            {
+            // Handle Go to main podcast menu
+            CMPXCollectionPath* cpath = iCollectionUiHelper->PodCastMenuPathL();
+            CleanupStack::PushL( cpath );
+            MPX_DEBUG_PATH (*cpath);
+            iCollectionUtility->Collection().OpenL( *cpath );
+            CleanupStack::PopAndDestroy( cpath );
+
+            // Restore status pane
+            if ( StatusPane()->CurrentLayoutResId() !=
+                 R_AVKON_STATUS_PANE_LAYOUT_USUAL)
+                {
+                StatusPane()->SwitchLayoutL(R_AVKON_STATUS_PANE_LAYOUT_USUAL);
+                }
+            break;
+            }
+        default:
+            {
+            CMPXCommonPlaybackViewImp::HandleCommandL( aCommand );
+            break;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Processes user commands.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::ProcessCommandL( TInt aCommand )
+    {
+    MPX_DEBUG2("--->CMPXUPnPPlaybackViewImp::ProcessCommandL(%d)", aCommand);
+    if ( aCommand == EAknCmdExit )
+        {
+        if ( MenuBar() )
+            {
+            MenuBar()->StopDisplayingMenuBar();
+            }
+        }
+    CAknView::ProcessCommandL( aCommand );
+    MPX_DEBUG1("<---CMPXUPnPPlaybackViewImp::ProcessCommandL(): exiting");
+    }
+
+// ---------------------------------------------------------------------------
+// From CAknView
+// Handles a view activation.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::DoActivateL(
+    const TVwsViewId& aPrevViewId,
+    TUid aCustomMessageId,
+    const TDesC8& aCustomMessage )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewImp::DoActivateL()" );
+
+    if ( !iContainer )
+        {
+        if ( !iPlaybackViewLayout )
+            {
+            iPlaybackViewLayout = CMPXUPnPPlaybackViewLayout::NewL();
+            }
+
+        iPodcastPlayback = EFalse;
+        MMPXSource* source( iPlaybackUtility->Source() );
+        if ( source )
+            {
+            CMPXCollectionPlaylist* pl( source->PlaylistL() );
+            if ( pl )
+                {
+                if ( TUid::Uid((TInt)pl->Path().Id(0)) == KMPXUidPodcastDBPlugin )
+                    {
+                    iPodcastPlayback = ETrue;
+                    }
+                delete pl;
+                }
+            }
+
+        iPlaybackViewLayout->SetAlbumArtLayout( iPodcastPlayback );
+
+        iContainer = new ( ELeave ) CMPXUPnPPlaybackViewContainer(
+            this,
+            this,
+            iPlaybackViewLayout );
+        iContainer->SetMopParent( this );
+        iContainer->ConstructL( ClientRect() );
+        AppUi()->AddToStackL( *this, iContainer );
+
+        iUPnPLoadingWaitNoteDisplayed =EFalse;
+
+        if ( iPlaybackUtility->StateL() == EPbStateInitialising )
+            {
+            if ( !iLoadingWaitNote )
+                {
+                iLoadingWaitNote = CIdle::NewL(CActive::EPriorityStandard);
+                }
+            iLoadingWaitNote->Cancel();
+            TCallBack callBack( CMPXUPnPPlaybackViewImp::LoadingSong,
+                                this );
+
+            // timer is needed because notes are dismissed by avkon during view
+            // activation/deactivation process, so we need to do it later
+            iLoadingWaitNote->Start(callBack);
+            }
+        }
+
+    CMPXCommonPlaybackViewImp::DoActivateL( aPrevViewId , aCustomMessageId, aCustomMessage );
+    }
+
+// -----------------------------------------------------------------------------
+// Displays  when callback from CIdle
+// -----------------------------------------------------------------------------
+//
+TInt CMPXUPnPPlaybackViewImp::LoadingSong( TAny* aPtr )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewImp::LoadingSong()");
+
+    CMPXUPnPPlaybackViewImp* upnpPlaybackview =
+    static_cast<CMPXUPnPPlaybackViewImp*>(aPtr);
+
+    TRAP_IGNORE( upnpPlaybackview->LoadingSongL() );
+    return EFalse;
+    }
+
+// -----------------------------------------------------------------------------
+// Displays  when callback from CIdle
+// -----------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::LoadingSongL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewImp::LoadingSongL()");
+
+    HBufC* string = StringLoader::LoadLC(
+        R_MPX_WAIT_UPNP_LOADING_SONG );
+
+    iUPnPLoadingWaitNoteDisplayed = ETrue;
+
+    // display waiting note
+    iCommonUiHelper->ShowWaitNoteL(
+        *string,
+        R_AVKON_SOFTKEYS_CANCEL,
+        EFalse, this );
+    CleanupStack::PopAndDestroy( string );
+    }
+
+// ---------------------------------------------------------------------------
+// Dismisses the loading song error note
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::DismissWaitNoteL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewImp::DismissWaitNoteL()" );
+    if ( iUPnPLoadingWaitNoteDisplayed )
+        {
+        if ( iLoadingWaitNote )
+            {
+            iLoadingWaitNote->Cancel();
+            }
+
+        if ( iCommonUiHelper )
+            {
+            iCommonUiHelper->DismissWaitNoteL();
+            }
+        iUPnPLoadingWaitNoteDisplayed = EFalse;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::HandleErrorL( TInt aError )
+    {
+    MPX_DEBUG2( "--->CMPXUPnPPlaybackViewImp::HandleErrorL(%d)", aError );
+    if ( aError )
+        {
+        DismissWaitNoteL();
+        }
+
+    if ( aError == KErrDisconnected )
+        {
+        MPX_DEBUG1( "CMPXUPnPPlaybackViewImp::HandleErrorL - KErrDisconnected");
+        TUid activeView = iViewUtility->ActiveViewType();
+        if ( activeView == TUid::Uid( KMPXPluginTypePlaybackUid ) )
+            {
+            if ( iSubPlayerName )
+                {
+                HBufC* dialogText = StringLoader::LoadLC(
+                                    R_MPX_NOTE_REMOTE_CONNECTION_FAILED,
+                                    *iSubPlayerName );
+                CAknErrorNote* errNote = new(ELeave) CAknErrorNote(ETrue);
+                errNote->SetTimeout(CAknNoteDialog::ELongTimeout);
+                errNote->ExecuteLD( *dialogText );
+                CleanupStack::PopAndDestroy( dialogText );
+                }
+
+            // UPnP connection failed, reset playback to Local
+            SelectNewPlayerL( EMPXPbvCmdUpnpPlayViaLocal );
+            GetCurrentPlayerDetails();
+            }
+        }
+    else if ( aError == KErrNotSupported )
+        {
+        MPX_DEBUG1( "CMPXUPnPPlaybackViewImp::HandleErrorL - KErrNotSupported" );
+        TUid activeView = iViewUtility->ActiveViewType();
+        if ( activeView == TUid::Uid( KMPXPluginTypePlaybackUid ) )
+            {
+            HBufC* dialogText = StringLoader::LoadLC( 
+                                                R_MPX_INVALID_GROUP_TEXT );
+
+            CAknErrorNote* errNote = new ( ELeave ) CAknErrorNote( ETrue );
+            errNote->SetTimeout( CAknNoteDialog::ELongTimeout );
+            errNote->ExecuteLD( *dialogText );
+            CleanupStack::PopAndDestroy( dialogText );
+            }
+        CMPXCommonPlaybackViewImp::HandleErrorL( aError );
+        }
+    else
+        {
+        CMPXCommonPlaybackViewImp::HandleErrorL( aError );
+        }
+    MPX_DEBUG1( "<---CMPXUPnPPlaybackViewImp::HandleErrorL");
+    }
+
+// ---------------------------------------------------------------------------
+// From MProgressDialogCallback
+// Callback method. Get's called when a dialog is dismissed
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewImp::DialogDismissedL( TInt aButtonId )
+    {
+    MPX_DEBUG2("--->CMPXUPnPPlaybackViewImp::DialogDismissedL(%d)", aButtonId);
+    switch (aButtonId)
+        {
+        case EAknSoftkeyCancel:
+            {
+            if ( iPlaybackUtility->StateL() == EPbStateInitialising &&
+                 iUPnPLoadingWaitNoteDisplayed )
+                {
+                iPlaybackUtility->CommandL(EPbCmdCancelInit);
+                HandleCommandL(EAknSoftkeyBack);
+                }
+            break;
+            }
+        case EAknSoftkeyDone:
+            {
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    MPX_DEBUG1("<---CMPXUPnPPlaybackViewImp::DialogDismissedL()");
+    }
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Used to change toolbar settings before toolbar becomes visible
+// -----------------------------------------------------------------------------
+//
+
+void CMPXUPnPPlaybackViewImp::DynInitToolbarL(TInt aResourceId, CAknToolbar* aToolbar)
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewImp::DynInitToolbarL" );
+    if ( aResourceId == R_MPX_PBV_TOUCH_TOOLBAR )
+        {
+        // Put initializations here to take effect before toolbar is shown
+        UpdateToolbar();
+        aToolbar->UpdateBackground();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// From MAknToolbarObserver
+// Handles toolbar events
+// -----------------------------------------------------------------------------
+//
+
+void CMPXUPnPPlaybackViewImp::OfferToolbarEventL( TInt aCommandId )
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewImp::OfferToolbarEventL" );
+    TInt commandId = aCommandId;
+    TInt eventModifiers = iToolbar->EventModifiers();
+    if ( eventModifiers == CAknToolbar::ELongPress )
+        {
+        if ( aCommandId == EMPXPbvCmdNextListItem )
+            {
+            commandId = EMPXPbvCmdSeekForward;
+            }
+        else if ( aCommandId == EMPXPbvCmdPreviousListItem )
+            {
+            commandId = EMPXPbvCmdSeekBackward;
+            }
+        }
+    else if ( eventModifiers == CAknToolbar::ELongPressEnded )
+        {
+        if ( aCommandId == EMPXPbvCmdNextListItem || aCommandId == EMPXPbvCmdPreviousListItem )
+            {
+            commandId = EMPXPbvCmdEndSeek;
+            }
+        }
+
+    CAknView::ProcessCommandL( commandId );
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/upnpplaybackview/src/mpxupnpplaybackviewlayout.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,288 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Layout and graphic factory for Upnp Playback View
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <AknsUtils.h>
+#include <AknUtils.h>
+#include <barsread.h>
+#include <gulicon.h>
+#include <aknlayoutscalable_apps.cdl.h>
+#include <layoutmetadata.cdl.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxupnpplaybackview.rsg>
+#include <centralrepository.h>
+#include <mpxcommonplaybackview.mbg>
+#include <mpxpodcastplaybackview.mbg>
+#include <mpxcommonplaybackview.rsg>
+#include <mpxupnpplaybackview.rsg>
+#include <mpxinternalcrkeys.h>
+#include <mpxlbxextendedfeatures.h>
+#include <mpxuser.h>
+#include "mpxupnpplaybackviewlayout.h"
+#include "mpxlog.h"
+
+using namespace AknLayoutScalable_Apps;
+
+
+// CONSTANTS
+_LIT(KMPXUpnpPlaybackViewIconFile, "mpxcommonplaybackview.mbm");
+_LIT( KMPXPodcastPlaybackViewIconFile, "mpxpodcastplaybackview.mbm" );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewLayout* CMPXUPnPPlaybackViewLayout::NewL()
+    {
+    CMPXUPnPPlaybackViewLayout* self = CMPXUPnPPlaybackViewLayout::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewLayout* CMPXUPnPPlaybackViewLayout::NewLC()
+    {
+    CMPXUPnPPlaybackViewLayout* self = new ( ELeave ) CMPXUPnPPlaybackViewLayout();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewLayout::~CMPXUPnPPlaybackViewLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+CMPXUPnPPlaybackViewLayout::CMPXUPnPPlaybackViewLayout()
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewLayout::ConstructL()
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewLayout::ConstructL" );
+    iPodcastAlbumArt = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Get layout data for an graphical indicator.
+// ---------------------------------------------------------------------------
+//
+TRect CMPXUPnPPlaybackViewLayout::IndicatorLayout(
+    const TRect& aParentRect,
+    TMPXPbvIndicator aIndicator )
+    {
+    TInt resId(KErrNotFound);
+
+    // Get Rocker mapping support flag
+    TInt flags( 0 );
+    CRepository* repository( NULL );
+    MPX_TRAPD( err, repository = CRepository::NewL( KCRUidMPXMPFeatures ));
+    if ( KErrNone == err )
+        {
+        repository->Get( KMPXMPLocalVariation, flags );
+        delete repository;
+        repository = NULL;
+        }
+
+    TBool enableButton( flags & KMPXRockerMappingSupport );
+    const TSize screenSize( CCoeEnv::Static()->ScreenDevice()->SizeInPixels() );
+
+    if ( screenSize == TSize( 176,208 ))    //lowest portrait
+        {
+        switch ( aIndicator )
+            {
+            case EIconRemotePlayer:
+                {
+                if ( enableButton )
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT;
+                    }
+                else
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_WITHOUT_ROCKER;
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else if ( screenSize == TSize( 352,416 ))
+        {
+        switch ( aIndicator )
+            {
+            case EIconRemotePlayer:
+                {
+                resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_DOUBLE_PORTRAIT;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else if ( screenSize == TSize( 240,320 ))
+        {
+        switch ( aIndicator )
+            {
+            case EIconRemotePlayer:
+                {
+                if ( enableButton )
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_QVGA_PORTRAIT;
+                    }
+                else
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_QVGA_PORTRAIT_WITHOUT_ROCKER;
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    else if ( screenSize == TSize( 320,240 )) // QVGA landscape
+        {
+        switch ( aIndicator )
+            {
+            case EIconRemotePlayer:
+                {
+                if ( enableButton )
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_QVGA_LANDSCAPE;
+                    }
+                else
+                    {
+                    resId = R_MPX_PBV_REMOTE_INDI_LAYOUT_QVGA_LANDSCAPE_WITHOUT_ROCKER;
+                    }
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+
+    TRect rect;
+    if ( resId != KErrNotFound )
+        {
+        TAknLayoutRect res;
+        res.LayoutRect( aParentRect, resId );
+        rect = res.Rect();
+        }
+    else
+        {
+        rect = CMPXCommonPlaybackViewLayout::IndicatorLayout( aParentRect, aIndicator );
+        }
+
+    return rect;
+    }
+
+// ---------------------------------------------------------------------------
+// Get the bitmap and mask for a given indicator.
+// ---------------------------------------------------------------------------
+//
+CGulIcon* CMPXUPnPPlaybackViewLayout::GetIndicatorIconMaskL(
+    TMPXPbvIndicator aIndicator )
+    {
+
+    TParse parse;
+    parse.Set( KMPXUpnpPlaybackViewIconFile, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName iconFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    switch ( aIndicator )
+        {
+        case EIconRemotePlayer:
+            {
+            return CreateColorIconL(
+                skin,
+                KAknsIIDQgnIndiMupRandom,
+                KAknsIIDQsnIconColors,
+                EAknsCIQsnIconColorsCG26,
+                iconFile,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_icon_upnp_remote,
+                EMbmMpxcommonplaybackviewQgn_graf_mup_icon_upnp_remote_mask );
+            }
+        case EAlbumArtArea:
+            {
+            if ( iPodcastAlbumArt )
+                {
+                TParse parse;
+                parse.Set( KMPXPodcastPlaybackViewIconFile, &KDC_APP_RESOURCE_DIR, NULL );
+                TFileName iconFile( parse.FullName() );
+                User::LeaveIfError( MPXUser::CompleteWithDllPath( iconFile ) );
+
+                return AknsUtils::CreateGulIconL(
+                    skin,
+                    KAknsIIDNone,
+                    iconFile,
+                    EMbmMpxpodcastplaybackviewQgn_indi_mup_default_album_pcast,
+                    EMbmMpxpodcastplaybackviewQgn_indi_mup_default_album_pcast_mask );
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }
+
+    return CMPXCommonPlaybackViewLayout::GetIndicatorIconMaskL( aIndicator );
+    }
+
+// ---------------------------------------------------------------------------
+// Sets whether we should use podcast or normal playback album art icon
+// ---------------------------------------------------------------------------
+//
+void CMPXUPnPPlaybackViewLayout::SetAlbumArtLayout(TBool aPodcastAlbumArt)
+    {
+    MPX_FUNC( "CMPXUPnPPlaybackViewLayout::SetAlbumArtLayout" );
+    iPodcastAlbumArt = aPodcastAlbumArt;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/bwinscw/mpxwaitnotedialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?ConstructWaitNoteL@CMPXWaitNoteConstructor@@SAPAVCMPXWaitNoteDialog@@ABVTDesC16@@PAVMMPXWaitNoteObserver@@@Z @ 1 NONAME ; class CMPXWaitNoteDialog * CMPXWaitNoteConstructor::ConstructWaitNoteL(class TDesC16 const &, class MMPXWaitNoteObserver *)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/data/mpxwaitnotedialog.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,265 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project mpxwaitnotedialog
+*
+*/
+
+
+NAME MPWN
+
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.loc>
+#include <eikon.rh>
+#include <avkon.mbg>
+#include <bldvariant.hrh>
+
+#include <mpxwaitnotedialog.loc>
+
+RESOURCE RSS_SIGNATURE { }
+RESOURCE TBUF { buf=""; }
+
+// RESOURCE DEFINITIONS
+
+//------------------------------------------------------------------------------
+//   
+//      r_mpx_generic_wait_note
+//      Generic wait note.
+//      
+//------------------------------------------------------------------------------
+//
+RESOURCE DIALOG r_mpx_generic_wait_note
+    {
+    flags = EAknWaitNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_EMPTY;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = 0x1000;
+            control = AVKON_NOTE
+                {
+                layout = EWaitLayout;
+                animation = R_QGN_GRAF_WAIT_BAR_ANIM;
+                };
+            }
+        };
+    }
+   
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_waitnote_softkeys_empty_stop
+//    Softkeys used by generic wait note.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE CBA r_mpx_waitnote_softkeys_empty_stop
+    {
+    buttons=
+        {
+        CBA_BUTTON
+            {
+            txt = text_softkey_empty;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyCancel;
+            txt = text_softkey_stop;
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_scanning_db_txt
+//    Text for scanning library wait note.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_scanning_db_txt
+    {
+    buf = qtn_nmp_note_scanning_db;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_scanning_complete_txt
+//    Text for scanning library dialog.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_scanning_complete_txt
+    {
+    buf = qtn_mus_note_search_complete1;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_scanning_stopped_txt
+//    Text for scanning library dialog.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_scanning_stopped_txt
+    {
+    buf = qtn_mus_note_search_stopped1;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_refreshing_db_txt
+//    Text for refreshing library wait note.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_refreshing_db_txt
+    {
+    buf = qtn_mus_note_refreshing_db;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_refreshing_db_complete_txt
+//    Text for refreshing library popup dialog.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_refreshing_db_complete_txt
+    {
+    buf = qtn_mus_note_refreshing_db_complete;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_refreshing_db_stopped_txt
+//    Text for refreshing library popup dialog.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_refreshing_db_stopped_txt
+    {
+    buf = qtn_mus_note_refreshing_db_stopped;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_mem_lo_not_enough_memory
+//    Text for not enough memory
+//    
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_mem_lo_not_enough_memory
+    {
+    buf = qtn_nmp_note_no_mem_complete_refresh;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//  r_mpx_usb_connection_in_progress
+//  Text for USB transfer wait note  
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_usb_connection_in_progress
+    {
+    buf = qtn_nmp_note_usb_connection_in_progress;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//  r_mpx_repairing_corrupt_db
+//  Text for rebuilding corrupt databases
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_repairing_corrupt_db
+    {
+    buf = qtn_nmp_note_rebuilding_db;
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_query_yes_no
+//    Ask the user for a yes/no question
+//
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_query_yes_no
+    {
+    flags = EGeneralQueryFlags;
+    buttons = R_AVKON_SOFTKEYS_YES_NO;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtQuery;
+            id = EGeneralQuery;
+            control= AVKON_CONFIRMATION_QUERY 
+                { 
+                layout = EConfirmationQueryLayout;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//   
+//    r_mpx_empty_close_note
+//    Dialog note with "empty" and "close" CBAs
+//
+// -----------------------------------------------------------------------------
+// 
+RESOURCE DIALOG r_mpx_empty_close_note
+    {
+    flags = EAknInformationNoteFlags;
+    buttons = R_AVKON_SOFTKEYS_CLOSE;
+    items =
+        {
+        DLG_LINE
+            {
+            type = EAknCtNote;
+            id = EGeneralQuery;
+            control = AVKON_NOTE
+                {
+                layout = EGeneralLayout;
+                animation = R_QGN_NOTE_INFO_ANIM;
+                };
+            }
+        };
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_opening_txt
+//    Text for opening wait note.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_opening_txt
+    {
+    buf = qtn_nmp_note_opening;
+    }
+
+// -----------------------------------------------------------------------------
+//
+//    r_mpx_formatting_txt
+//    Text for formatting wait note.
+//
+// -----------------------------------------------------------------------------
+//
+RESOURCE TBUF r_mpx_formatting_txt
+    {
+    buf = qtn_nmp_note_mp_unavailable_mmc;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/eabi/mpxwaitnotedialogU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,9 @@
+EXPORTS
+	_ZN23CMPXWaitNoteConstructor18ConstructWaitNoteLERK7TDesC16P20MMPXWaitNoteObserver @ 1 NONAME
+	_ZTI18CMPXWaitNoteDialog @ 2 NONAME ; #<TI>#
+	_ZTI22CMPXScanningWaitDialog @ 3 NONAME ; #<TI>#
+	_ZTV18CMPXWaitNoteDialog @ 4 NONAME ; #<VT>#
+	_ZTV22CMPXScanningWaitDialog @ 5 NONAME ; #<VT>#
+	_ZTI21CMPXOpeningWaitDialog @ 6 NONAME ; #<TI>#
+	_ZTV21CMPXOpeningWaitDialog @ 7 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxwaitnoteplugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/mpxwaitnotedialog.loc	APP_LAYER_LOC_EXPORT_PATH(mpxwaitnotedialog.loc)
+
+PRJ_MMPFILES
+mpxwaitnotedialog.mmp
+
+PRJ_TESTMMPFILES
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/group/mpxwaitnotedialog.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for mpxwaitnotedialog
+*
+*/
+
+
+
+#include <data_caging_paths.hrh>
+#include <platform_paths.hrh>
+
+TARGET                  mpxwaitnotedialog.dll
+TARGETTYPE              dll
+UID                     0x1000006C 0x101FFC6B
+
+CAPABILITY              CAP_GENERAL_DLL
+VENDORID                VID_DEFAULT
+
+VERSION 15.0
+
+SOURCEPATH              ../src
+SOURCE                  mpxwaitnotedialog.cpp
+SOURCE                  mpxscanningdialog.cpp
+SOURCE                  mpxmtpdialog.cpp
+SOURCE                  mpxusbdialog.cpp
+SOURCE                  mpxopeningdialog.cpp
+SOURCE                  mpxformatdialog.cpp
+SOURCE                  mpxwaitnoteconstructor.cpp
+
+START RESOURCE          ../data/mpxwaitnotedialog.rss
+HEADER
+TARGETPATH              APP_RESOURCE_DIR
+LANGUAGE_IDS 
+END // RESOURCE
+
+USERINCLUDE             ../inc
+USERINCLUDE             ../../../inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY                 euser.lib
+LIBRARY                 cone.lib
+LIBRARY                 avkon.lib
+LIBRARY                 aknskins.lib
+LIBRARY                 aknicon.lib
+LIBRARY                 eikcore.lib
+LIBRARY                 eikcdlg.lib
+LIBRARY                 eikctl.lib
+LIBRARY                 eikcoctl.lib 
+LIBRARY                 eikdlg.lib 
+LIBRARY                 commonengine.lib
+LIBRARY                 efsrv.lib 
+LIBRARY                 bafl.lib 
+#ifdef RD_MULTIPLE_DRIVE
+LIBRARY                 PlatformEnv.lib
+#endif //RD_MULTIPLE_DRIVE
+
+LIBRARY                 mpxcollectionutility.lib
+LIBRARY                 mpxcommon.lib
+LIBRARY                 mpxharvesterutility.lib
+
+LIBRARY         mediatorclient.lib
+LIBRARY         featmgr.lib
+LIBRARY         estor.lib
+
+#if defined(ARMCC)
+deffile ../eabi/ 
+#elif defined(WINSCW)
+deffile ../bwinscw/ 
+#endif
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/inc/mpxformatdialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note dialog for formatting
+*
+*/
+
+
+#ifndef C_MPXFORMATTINGDIALOG_H
+#define C_MPXFORMATTINGDIALOG_H
+
+#include "mpxwaitnotedialog.h"
+
+/**
+ *  Wait note class for the formatting cases
+ *
+ *  Blocking dialog shown during formatting
+ *
+ *  @lib mpxwaitnotedialog.dll
+ *  @since S60 3.1
+ */
+NONSHARABLE_CLASS( CMPXFormattingWaitDialog ) : public CMPXWaitNoteDialog                              
+    {
+
+public:
+
+    /**
+    * Two-phased constructor
+    */
+    static CMPXFormattingWaitDialog* NewL( MMPXWaitNoteObserver* aObs );
+
+    /**
+    * Virtual destructor
+    */
+    virtual ~CMPXFormattingWaitDialog();
+
+protected:
+    
+    /**
+    * From CMPXWaitNoteDialog
+    * Initialize the note before executing
+    * The inherited class should set CBA, text, icons etc here
+    */
+    void PreNoteDisplayHandleL();
+
+    /**
+    * From MMPXCollectionObserver
+    */
+    void HandleCollectionMessage(
+            CMPXMessage* aMessage, TInt aError );
+  
+private:
+    
+    /**
+    * Handles the collection message
+    * @param aMessage message to handle
+    * @param aError error code
+    */
+    void DoHandleCollectionMessageL(
+             const CMPXMessage& aMessage, TInt aError );
+               
+private:
+
+    /**
+    * Private constructor
+    */
+    CMPXFormattingWaitDialog( MMPXWaitNoteObserver* aObs );
+
+    /**
+    * Second phased constructor
+    */
+    void ConstructL();
+
+private: // data
+    
+    };
+
+#endif // C_MPXFORMATTINGDIALOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/inc/mpxmtpdialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note during MTP transfer
+*
+*/
+
+
+#ifndef C_MPX_MTP_WAIT_DIALOG_H
+#define C_MPX_MTP_WAIT_DIALOG_H
+
+#include "mpxwaitnotedialog.h"
+
+/**
+ *  MTP wait note dialog
+ *
+ *  Blocking dialog shown during an MTP transfer
+ *
+ *  @lib mpxwaitnotedialog.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXMtpWaitDialog ) : public CMPXWaitNoteDialog
+    {
+
+public:
+
+    static CMPXMtpWaitDialog* NewL( MMPXWaitNoteObserver* aObs );
+
+    virtual ~CMPXMtpWaitDialog();
+
+protected:
+
+    /**
+    * From CMPXWaitNoteDialog
+    * Initialize the note before executing
+    * The inherited class should set CBA, text, icons etc here
+    */
+    void PreNoteDisplayHandleL();
+
+
+private:
+
+    CMPXMtpWaitDialog( MMPXWaitNoteObserver* aObs );
+
+    void ConstructL();
+
+private: // data
+
+    };
+
+#endif // C_MPX_MTP_WAIT_DIALOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/inc/mpxopeningdialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note dialog for Opening
+*
+*/
+
+
+#ifndef C_MPXOPENINGNOTEDIALOG_H
+#define C_MPXOPENINGNOTEDIALOG_H
+
+#include "mpxwaitnotedialog.h"
+
+/**
+ *  Wait note class for the opening cases
+ *
+ *  Blocking dialog shown during opening
+ *
+ *  @lib mpxwaitnotedialog.dll
+ *  @since S60 3.1
+ */
+class CMPXOpeningWaitDialog : public CMPXWaitNoteDialog                              
+    {
+
+public:
+
+    /**
+    * Two-phased constructor
+    */
+    static CMPXOpeningWaitDialog* NewL( MMPXWaitNoteObserver* aObs, TBool aVisibilityDelayOff = ETrue );
+
+    /**
+    * Virtual destructor
+    */
+    virtual ~CMPXOpeningWaitDialog();
+
+protected:
+    
+    /**
+    * From CMPXWaitNoteDialog
+    * Initialize the note before executing
+    * The inherited class should set CBA, text, icons etc here
+    */
+    void PreNoteDisplayHandleL();
+
+private:
+
+    /**
+    * Private constructor
+    */
+    CMPXOpeningWaitDialog( MMPXWaitNoteObserver* aObs, TBool aVisibilityDelayOff );
+
+    /**
+    * Second phased constructor
+    */
+    void ConstructL();
+
+private: // data
+    
+    };
+
+#endif // C_MPXOPENINGNOTEDIALOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/inc/mpxscanningdialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note dialog for scanning
+*
+*/
+
+
+#ifndef C_MPXSCANNINGNOTEDIALOG_H
+#define C_MPXSCANNINGNOTEDIALOG_H
+
+#include "mpxwaitnotedialog.h"
+
+class MMPXHarvesterUtility;
+
+/**
+ *  Wait note class for the scanning cases
+ *
+ *  @lib mpxwaitnotedialog.dll
+ *  @since S60 3.1
+ */
+class CMPXScanningWaitDialog : public CMPXWaitNoteDialog
+                              
+    {
+
+public:
+
+    /**
+    * Two-phased constructor
+    */
+    static CMPXScanningWaitDialog* NewL( MMPXWaitNoteObserver* aObs,
+                                         TWaitNoteType aType );
+
+    /**
+    * Virtual destructor
+    */
+    virtual ~CMPXScanningWaitDialog();
+
+protected: // CMPXWaitNoteDialog
+    
+    /**
+    * Initialize the note before executing
+    * The inherited class should set CBA, text, icons etc here
+    */
+    void PreNoteDisplayHandleL();
+
+    /**
+    * Post note dissmissal handling
+    * @arg aButtonId, button ID that the note was cancelled with
+    */
+    void PostNoteHandleL( TInt aButtonId );
+    
+    /**
+    * From MMPXCollectionObserver
+    */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+private: 
+
+    /**
+    * Handle DB Corruption, cleans up both harvester and collection
+    */
+    void HandleDatabaseCorruptionL();
+    
+private:
+
+    /**
+    * Private constructor
+    */
+    CMPXScanningWaitDialog( MMPXWaitNoteObserver* aObs,
+                            TWaitNoteType aType );
+
+    /**
+    * Second phased constructor
+    */
+    void ConstructL();
+    
+    /**
+     * Handle collection message
+     * 
+     * @param aMessage collection message
+     */
+    void DoHandleCollectionMessageL( const CMPXMessage& aMessage );
+
+private: // data
+    MMPXHarvesterUtility*  iHarvesterUtil;
+    
+    TInt                   iNumItemsAdded;
+    TInt                   iScanningError;
+    TInt                   iInitialMMCCount;
+    TInt                   iTotalNewTracks;
+    };
+
+
+#endif // C_MPXSCANNINGNOTEDIALOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/inc/mpxusbdialog.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note during USB transfer
+*
+*/
+
+
+#ifndef C_MPX_USB_WAIT_DIALOG_H
+#define C_MPX_USB_WAIT_DIALOG_H
+
+#include "mpxwaitnotedialog.h"
+
+/**
+ *  MTP wait note dialog
+ *
+ *  Blocking dialog shown during an MTP transfer
+ *
+ *  @lib mpxwaitnotedialog.lib
+ *  @since S60 v3.0
+ */
+NONSHARABLE_CLASS( CMPXUsbWaitDialog ) : public CMPXWaitNoteDialog
+    {
+
+public:
+
+    static CMPXUsbWaitDialog* NewL( MMPXWaitNoteObserver* aObs );
+
+    virtual ~CMPXUsbWaitDialog();
+
+protected:
+
+    /**
+    * From CMPXWaitNoteDialog
+    * Initialize the note before executing
+    * The inherited class should set CBA, text, icons etc here
+    */
+    void PreNoteDisplayHandleL();
+
+
+private:
+
+    CMPXUsbWaitDialog( MMPXWaitNoteObserver* aObs );
+
+    void ConstructL();
+
+private: // data
+
+    };
+
+#endif // C_MPX_MTP_WAIT_DIALOG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/loc/mpxwaitnotedialog.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project mpxwaitnotedialog
+*
+*/
+
+
+// Searching Texts
+//
+
+// d:Text in wait dialog to show that a scanning operation is in progress
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_nmp_note_scanning_db "Searching for music"
+
+// d:Search complete text shown after scanning is complete 
+// d:and some songs are found
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_mus_note_search_complete1 "Search complete \nAdded: %N"
+
+// d:Search stopped text shown after scanning is complete 
+// d:and some songs are found
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_mus_note_search_stopped1 "Search stopped \nAdded: %N"
+
+// Refreshing Texts
+//
+
+// d:Text in wait dialog to show that a refresh operation is in progress
+// d:Also shows the number of songs added
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_mus_note_refreshing_db "Refreshing.\nAdded: %N"
+
+// d:Refresh stopped text shown after scanning is complete 
+// d:and some songs are found
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_mus_note_refreshing_db_complete "Refresh complete.\nAdded: %N"
+
+// d:Refresh stopped text shown after scanning is stopped 
+// d:and no songs are found
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_mus_note_refreshing_db_stopped "Refresh stopped.\nAdded: %N"
+
+// d:Insufficient disk space to scan, scanning is stopped
+// l:popup_note_window/opt2
+// r:3.1
+//
+#define qtn_nmp_note_no_mem_complete_refresh "Out of disk space.\nAdded: %N"
+
+// d:Music database is corrupt, rescanning for items
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_nmp_note_rebuilding_db "Repairing corrupt library. Searching for music"
+
+
+// Opening Texts
+//
+
+// d:Text in wait dialog to show that a opening operation is in progress
+// d:
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_nmp_note_opening "Opening"
+
+
+// Eject Memory Card Texts
+//
+
+// d:Wait note shown when USB connection in progress
+// l:popup_note_wait_window
+// r:3.1
+//
+#define qtn_nmp_note_usb_connection_in_progress "USB connection in progress"
+
+// d:Wait note shown when a disk format operation is in progress
+// l:popup_note_wait_window
+// r:9.0
+//
+#define qtn_nmp_note_mp_unavailable_mmc "Music Player unable to access memory card. Memory card operation underway."
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/src/mpxformatdialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note dialog for formatting
+*
+*/
+
+
+#include <e32base.h>
+#include <StringLoader.h>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <aknconsts.h>
+#include <mpxcollectionmessage.h>
+#include <mpxwaitnotedialog.rsg>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxlog.h>
+#include <mpxcollectionutility.h>
+#include <mpxmessagegeneraldefs.h>
+#include "mpxformatdialog.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXFormattingWaitDialog::CMPXFormattingWaitDialog( MMPXWaitNoteObserver* aObs )
+                                     : CMPXWaitNoteDialog ( aObs, 
+                                                           EMPXFormatScanningNote,
+                                                           EFalse )
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// 2nd Phased constructor
+// ---------------------------------------------------------------------------
+//
+void CMPXFormattingWaitDialog::ConstructL()
+    {
+    BaseConstructL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-Phased Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXFormattingWaitDialog* CMPXFormattingWaitDialog::NewL( MMPXWaitNoteObserver* aObs )
+    {
+    CMPXFormattingWaitDialog* self = new(ELeave) CMPXFormattingWaitDialog( aObs );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXFormattingWaitDialog::~CMPXFormattingWaitDialog()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Setup Wait Notes
+// ---------------------------------------------------------------------------
+//
+void CMPXFormattingWaitDialog::PreNoteDisplayHandleL()
+    {
+    // CBA
+    SetCBAL( R_AVKON_SOFTKEYS_EMPTY );
+    
+    // Text
+    HBufC* text = StringLoader::LoadLC( R_MPX_FORMATTING_TXT );
+    SetTextL( *text );
+    CleanupStack::PopAndDestroy( text );
+    
+    // Icon
+    TNoteIconInfo icon( (TInt)EMbmAvkonQgn_note_progress, 
+                        (TInt)EMbmAvkonQgn_note_progress_mask, 
+                        TFileName(KAvkonBitmapFile) );
+    SetIconL( icon );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Handle Collection Messages
+// ---------------------------------------------------------------------------
+//
+void CMPXFormattingWaitDialog::HandleCollectionMessage( CMPXMessage* aMessage, 
+                                                        TInt aError )
+    {
+    TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage, aError ) );
+    }
+
+// ---------------------------------------------------------------------------
+// Handle Collection Messages
+// ---------------------------------------------------------------------------
+//
+void CMPXFormattingWaitDialog::DoHandleCollectionMessageL( const CMPXMessage& aMessage, 
+                                                           TInt /*aError*/ )
+    {
+    MPX_FUNC( "CMPXFormattingWaitDialog::DoHandleCollectionMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt op( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        
+        if( event == TMPXCollectionMessage::EBroadcastEvent && 
+            op == EMcMsgFormatEnd )
+            {
+            MPX_DEBUG1("CMPXFormattingWaitDialog::DoHandleCollectionMessageL -- killing dialog");
+            if( iWaitDialog )
+                {
+                iWaitDialog->ProcessFinishedL();    
+                }
+            }
+        }
+    }
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/src/mpxmtpdialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,96 @@
+/*
+* Copyright (c)  Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note dialog for MTP connection
+*
+*/
+
+
+#include <e32base.h>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <StringLoader.h>
+#include <StringLoader.h>
+#include <aknconsts.h>
+#include <mpxcollectionmessage.h>
+#include <mpxwaitnotedialog.rsg>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxlog.h>
+#include "mpxmtpdialog.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXMtpWaitDialog::CMPXMtpWaitDialog( MMPXWaitNoteObserver* aObs ) :
+                                      CMPXWaitNoteDialog( aObs, EMPXMTPEventNote )
+    {
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// 2nd Phased constructor
+// ---------------------------------------------------------------------------
+//
+void CMPXMtpWaitDialog::ConstructL()
+    {
+    BaseConstructL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CMPXMtpWaitDialog* CMPXMtpWaitDialog::NewL( MMPXWaitNoteObserver* aObs )
+    {
+    CMPXMtpWaitDialog* self = new(ELeave) CMPXMtpWaitDialog( aObs );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXMtpWaitDialog::~CMPXMtpWaitDialog()
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Initialize the wait note
+// ---------------------------------------------------------------------------
+//
+void CMPXMtpWaitDialog::PreNoteDisplayHandleL()
+    {
+    // CBA
+    SetCBAL( R_AVKON_SOFTKEYS_EMPTY );
+
+    // Text
+    HBufC* text = StringLoader::LoadLC( R_MPX_USB_CONNECTION_IN_PROGRESS );
+    SetTextL( *text );
+    CleanupStack::PopAndDestroy( text );
+
+    // Icon
+    TNoteIconInfo icon( (TInt)EMbmAvkonQgn_note_progress,
+                        (TInt)EMbmAvkonQgn_note_progress_mask,
+                        TFileName(KAvkonBitmapFile) );
+    SetIconL( icon );
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/src/mpxopeningdialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,102 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note dialog for Opening
+*
+*/
+
+
+#include <e32base.h>
+#include <StringLoader.h>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <aknconsts.h>
+#include <mpxcollectionmessage.h>
+#include <mpxwaitnotedialog.rsg>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxlog.h>
+#include <mpxcollectionutility.h>
+#include "mpxopeningdialog.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXOpeningWaitDialog::CMPXOpeningWaitDialog( MMPXWaitNoteObserver* aObs, TBool aVisibilityDelayOff )
+                                     : CMPXWaitNoteDialog ( aObs,
+                                                           EMPXOpeningNote,
+                                                           aVisibilityDelayOff )
+    {
+	// CMPXWaitNoteDialog constructor should have 3rd parameter (=aVisibilityDelayOff) set to ETrue 
+	// when the length of the process is AWLAYS over 1.5 seconds. (e.g. opening all songs)
+    }
+
+
+// ---------------------------------------------------------------------------
+// 2nd Phased constructor
+// ---------------------------------------------------------------------------
+//
+void CMPXOpeningWaitDialog::ConstructL()
+    {
+    BaseConstructL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-Phased Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXOpeningWaitDialog* CMPXOpeningWaitDialog::NewL( MMPXWaitNoteObserver* aObs, TBool aVisibilityDelayOff )
+    {
+    CMPXOpeningWaitDialog* self = new(ELeave) CMPXOpeningWaitDialog( aObs, aVisibilityDelayOff );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXOpeningWaitDialog::~CMPXOpeningWaitDialog()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Setup Wait Notes
+// ---------------------------------------------------------------------------
+//
+void CMPXOpeningWaitDialog::PreNoteDisplayHandleL()
+    {
+    // CBA
+    SetCBAL( R_AVKON_SOFTKEYS_EMPTY );
+
+    // Text
+    HBufC* text = StringLoader::LoadLC( R_MPX_OPENING_TXT );
+    SetTextL( *text );
+    CleanupStack::PopAndDestroy( text );
+
+    // Icon
+    TNoteIconInfo icon( (TInt)EMbmAvkonQgn_note_progress,
+                        (TInt)EMbmAvkonQgn_note_progress_mask,
+                        TFileName(KAvkonBitmapFile) );
+    SetIconL( icon );
+
+    //HandleDatabaseOpenL();
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/src/mpxscanningdialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,449 @@
+/*
+* Copyright (c)  Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note dialog for scanning
+*
+*/
+
+
+#include <e32base.h>
+#include <StringLoader.h>
+#include <avkon.mbg>
+#include <aknconsts.h>
+#include <StringLoader.h>
+#include <aknnotedialog.h>
+#include <featmgr.h>
+#include <driveinfo.h>
+
+#include <mpxlog.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxwaitnotedialog.rsg>
+#include <mpxharvesterutility.h>
+#include <mpxcollectionutility.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionplugin.hrh>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxmessagecontainerdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include "mpxscanningdialog.h"
+
+
+// ---------------------------------------------------------------------------
+// Default Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXScanningWaitDialog::CMPXScanningWaitDialog( MMPXWaitNoteObserver* aObs,
+                                                TWaitNoteType aType ) : 
+                                             CMPXWaitNoteDialog( aObs, aType )
+    {
+    iNumItemsAdded = 0;
+    iInitialMMCCount = 0;
+    iTotalNewTracks = 0;
+    }
+
+
+// ---------------------------------------------------------------------------
+// 2nd Phased constructor
+// ---------------------------------------------------------------------------
+//
+void CMPXScanningWaitDialog::ConstructL()
+    {
+    iHarvesterUtil = CMPXHarvesterFactory::NewL();
+    BaseConstructL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two Phased constructor
+// ---------------------------------------------------------------------------
+//
+CMPXScanningWaitDialog* CMPXScanningWaitDialog::NewL( MMPXWaitNoteObserver* aObs, 
+                                                      TWaitNoteType aType  )
+    {
+    CMPXScanningWaitDialog* self = new(ELeave)CMPXScanningWaitDialog( aObs, 
+                                                                      aType );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Virtual destructor
+// ---------------------------------------------------------------------------
+//
+CMPXScanningWaitDialog::~CMPXScanningWaitDialog()
+    {
+    if( iHarvesterUtil )
+        {
+        iHarvesterUtil->Close();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXScanningWaitDialog::PreNoteDisplayHandleL()
+// ---------------------------------------------------------------------------
+//
+void CMPXScanningWaitDialog::PreNoteDisplayHandleL()
+    {
+    // CBA
+    SetCBAL( R_MPX_WAITNOTE_SOFTKEYS_EMPTY_STOP );
+    
+    // Text
+    HBufC* text = NULL;
+    if( iWaitNoteType == EMPXScanningNote )
+        {
+        text = StringLoader::LoadLC( R_MPX_SCANNING_DB_TXT );
+        }
+    else if( iWaitNoteType == EMPXRefreshingNote )
+        {
+        text = StringLoader::LoadLC( R_MPX_REFRESHING_DB_TXT, 0 );
+        }
+    else // iWaitNoteType == EMPXCorruptScanningNote
+        {
+        text = StringLoader::LoadLC( R_MPX_REPAIRING_CORRUPT_DB );    
+        }
+        
+    SetTextL( *text );
+    CleanupStack::PopAndDestroy( text );
+    
+    // Icon
+    TNoteIconInfo icon( (TInt)EMbmAvkonQgn_note_progress, 
+                    (TInt)EMbmAvkonQgn_note_progress_mask, 
+                    TFileName(KAvkonBitmapFile) );
+    SetIconL( icon );
+    
+    // If we are repairing a corrupt db, we first clean up the old ones
+    //
+    if( iWaitNoteType == EMPXCorruptScanningNote )
+        {
+        HandleDatabaseCorruptionL();
+        }
+        
+    // Start the scanning in harvester
+    iHarvesterUtil->ScanL();
+    iScanningError = KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXScanningWaitDialog::PostNoteHandleL()
+// ---------------------------------------------------------------------------
+//
+void CMPXScanningWaitDialog::PostNoteHandleL( TInt aButtonId )
+    {
+    MPX_DEBUG1("CMPXScanningWaitDialog::PostNoteHandleL --->");
+    
+    MPX_DEBUG1("    BUGHUNT: cover display");
+    TInt textRsc( KErrNotFound );
+    
+    HBufC* text = NULL;
+    if( aButtonId == EAknSoftkeyCancel )
+        {
+        iScanningError = KErrCancel;
+        // If harvester crashed,..... restart it.
+        MPX_TRAPD( err, iHarvesterUtil->CancelScanL() );
+        if( err != KErrNone )
+            {
+            iHarvesterUtil->Close();
+            iHarvesterUtil = NULL;
+            iHarvesterUtil = CMPXHarvesterFactory::NewL(); 
+            }
+        }
+    else if( iScanningError >= KErrNone )
+        {
+        // Show completed scan note
+        //
+        if( iWaitNoteType == EMPXScanningNote || 
+            iWaitNoteType == EMPXCorruptScanningNote )
+            {
+            text = StringLoader::LoadLC( R_MPX_SCANNING_COMPLETE_TXT, 
+                                         iNumItemsAdded );
+            textRsc = R_MPX_SCANNING_COMPLETE_TXT;                                         
+            }
+        else // iWaitNoteType == EMPXRefreshNote
+            {
+            text = StringLoader::LoadLC( R_MPX_REFRESHING_DB_COMPLETE_TXT, 
+                                         iNumItemsAdded ); 
+            textRsc = R_MPX_REFRESHING_DB_COMPLETE_TXT;                    
+            }
+        }
+    else if( iScanningError == KErrDiskFull )
+        {
+        // If the error was disk full
+        //
+        text = StringLoader::LoadLC( R_MPX_MEM_LO_NOT_ENOUGH_MEMORY, 
+                                     iNumItemsAdded );
+        }
+    else 
+        {
+        // Show stopped notes    
+        //
+        if( iWaitNoteType == EMPXScanningNote || 
+            iWaitNoteType == EMPXCorruptScanningNote )
+            {
+            textRsc = R_MPX_SCANNING_STOPPED_TXT;
+            text = StringLoader::LoadLC( R_MPX_SCANNING_STOPPED_TXT, 
+                                         iNumItemsAdded  );
+            }
+        else // iWaitNoteType == EMPXRefreshNote
+            {
+            textRsc = R_MPX_REFRESHING_DB_STOPPED_TXT;
+            text = StringLoader::LoadLC( R_MPX_REFRESHING_DB_STOPPED_TXT, 
+                                         iNumItemsAdded );    
+            }
+        }
+    
+    // Show the note
+    if( text )
+        {
+    if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) )
+        {
+        DisplayNoteDialogL( R_MPX_EMPTY_CLOSE_NOTE, textRsc, iNumItemsAdded,
+                            *text, CAknNoteDialog::EConfirmationTone );
+        }
+    else
+        {
+        DisplayNoteDialogL( R_MPX_EMPTY_CLOSE_NOTE, *text, 
+                            CAknNoteDialog::EConfirmationTone );
+        }
+        CleanupStack::PopAndDestroy( text );
+        }
+
+    MPX_DEBUG1("<--CMPXScanningWaitDialog::PostNoteHandleL");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle the collection message
+// ---------------------------------------------------------------------------
+//
+void CMPXScanningWaitDialog::HandleCollectionMessage(
+    CMPXMessage* aMessage, TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandleCollectionMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Cleanup both collection and harvester databases
+// ---------------------------------------------------------------------------
+//
+void CMPXScanningWaitDialog::HandleDatabaseCorruptionL()
+    {
+    // Cleanup Harvester
+    iHarvesterUtil->RecreateDatabasesL();
+    }
+
+// ---------------------------------------------------------------------------
+// MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMPXScanningWaitDialog::DoHandleCollectionMessageL(
+    const CMPXMessage& aMessage )
+    {
+    MPX_FUNC( "CMPXScanningWaitDialog::DoHandleCollectionMessageL" );
+    TMPXMessageId id( aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        TInt op( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+        TInt data( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+        
+        if(event == TMPXCollectionMessage::EBroadcastEvent &&
+                ((op == EMcMsgRefreshStart) || (op == EMcMsgRefreshEnd)))
+            {
+            TInt mmcCount = 0;
+            if ( iWaitNoteType == EMPXScanningNote)
+                { 
+                //get removable drive number
+                TInt removableDrive( EDriveF );                            
+                #ifdef RD_MULTIPLE_DRIVE
+                    User::LeaveIfError( DriveInfo::GetDefaultDrive(
+                        DriveInfo::EDefaultRemovableMassStorage,
+                        removableDrive ) );
+                #endif // RD_MULTIPLE_DRIVE
+ 
+                //get count from music db
+            
+                CMPXCommand* cmdCount = CMPXMedia::NewL();
+                CleanupStack::PushL( cmdCount );
+                cmdCount->SetTObjectValueL<TMPXCommandId>( 
+                        KMPXCommandGeneralId, 
+                        KMPXCommandCollectionGetCount );
+                cmdCount->SetTObjectValueL<TBool>( 
+                        KMPXCommandGeneralDoSync,
+                        ETrue );
+                cmdCount->SetTObjectValueL<TInt>( 
+                        KMPXCommandCollectionCountDrive,
+                        removableDrive);
+                
+                cmdCount->SetTObjectValueL<TInt>( 
+                        KMPXCommandCollectionCountTable,
+                        EMPXCollectionCountTotal );
+                                   
+                // Get the collection UIDs
+                RArray<TUid> ary;
+                CleanupClosePushL( ary );
+                ary.AppendL( TUid::Uid(EMPXCollectionPluginMusic) );
+                TUid musicCollectionId = 
+                iCollection->CollectionIDL( ary.Array() );
+                CleanupStack::PopAndDestroy( &ary );
+                cmdCount->SetTObjectValueL<TInt>( 
+                        KMPXCommandGeneralCollectionId,
+                        musicCollectionId.iUid );
+    
+                TRAPD(err, iCollection->Collection().CommandL( *cmdCount ) );
+                
+                if ( KErrNotFound != err )
+                    {
+                    User::LeaveIfError( err );
+                    }
+
+                // returned command should contain count
+                if ( cmdCount->IsSupported( KMPXCommandCollectionCountValue ) )
+                    {                        
+                    mmcCount = 
+                        cmdCount->ValueTObjectL<TInt>( 
+                                KMPXCommandCollectionCountValue );
+                    }
+                CleanupStack::PopAndDestroy( cmdCount );
+                }
+            if( op == EMcMsgRefreshStart )
+                {
+                MPX_DEBUG1("refreshStart store the initial count");
+                iInitialMMCCount = mmcCount;
+                }
+
+            if( op == EMcMsgRefreshEnd )                                    
+            {
+            MPX_DEBUG1("CMPXScanningWaitDialog::HandleCollectionMessageL refresh end");
+            iNumItemsAdded = mmcCount;
+            switch ( iWaitNoteType )
+                {
+                case EMPXScanningNote:
+                    {
+                    //total new tracks on external memory 
+                    TInt totalNewOnMMC = iNumItemsAdded - iInitialMMCCount;
+
+                    //total new tracks on internal memory 
+                    TInt newOnPhone = iTotalNewTracks - totalNewOnMMC; 
+
+                    //total new tracks to dispaly 
+                    iNumItemsAdded += newOnPhone;
+
+                    break;
+                    }
+
+                case EMPXOpeningNote:
+                case EMPXRefreshingNote:
+                case EMPXCorruptScanningNote:
+                case EMPXUsbEventNote:
+                case EMPXMTPEventNote:
+                case EMPXFormatScanningNote:
+                case EMPXMediaNotAvailableNote:
+                case EMPXNoteNotDefined:
+                    // fall through
+                default:
+                    {
+                    // Synchronize the number of items added if we had no errors
+                    //
+                    if( data >= KErrNone )
+                        {
+                        iNumItemsAdded = data;
+                        }
+                    break;
+                    }
+                };
+            
+            // If cancel was pressed, iWaitDialog is NULL
+            //
+            if( iWaitDialog )
+                {
+                MPX_DEBUG1("CMPXScanningWaitDialog::HandleCollectionMessageL killing dialog");
+                iScanningError = data;
+                iWaitDialog->ProcessFinishedL();
+                }
+                
+            // Delay showing the number added dialog
+            if( iScanningError == KErrCancel )
+                {
+                PostNoteHandleL( EAknSoftkeyOk );
+                }
+            
+            // Save the error code
+            iScanningError = data;
+            }
+        }
+        else if( event == TMPXCollectionMessage::EBroadcastEvent && 
+                 op == EMcMsgDiskInserted )
+            {
+            // Dismiss this scanning note because scanning will be restarted
+            //
+            MPX_DEBUG1("CMPXScanningWaitDialog::HandleCollectionMessageL \
+                        dismissing scan because of refresh msg ");
+            if( iWaitDialog )
+                {
+                MPX_DEBUG1("CMPXScanningWaitDialog::HandleCollectionMessageL killing dialog");
+                iWaitDialog->ProcessFinishedL();
+                }
+            
+            iScanningError = KErrNone;  
+            }
+        }
+    else if(id == KMPXMessageIdItemChanged)
+        {
+        // Loop through messages for arrays.
+        //
+        if (aMessage.IsSupported(KMPXMessageArrayContents))
+            {
+            const CMPXMessageArray* messageArray =
+                        aMessage.Value<CMPXMessageArray>(KMPXMessageArrayContents);
+            User::LeaveIfNull(const_cast<CMPXMessageArray*>(messageArray));
+            
+            for( TInt i=0; i<messageArray->Count(); ++i )
+                  {
+                  HandleCollectionMessage( messageArray->AtL( i ), KErrNone );  
+                  } 
+            }
+        // Single item
+        else
+            {
+            MPX_DEBUG1("CMPXScanningWaitDialog::HandleCollectionMessageL KMPXMessageIdItemChanged");
+            TMPXChangeEventType changeType( aMessage.ValueTObjectL<TMPXChangeEventType>( KMPXMessageChangeEventType ) );
+            TMPXGeneralCategory cat(aMessage.ValueTObjectL<TMPXGeneralCategory>(KMPXMessageMediaGeneralCategory));
+            if( changeType == EMPXItemInserted && 
+                (cat == EMPXSong || cat == EMPXPlaylist || cat == EMPXPodcast) )
+                {
+                iNumItemsAdded++;
+                iTotalNewTracks++;
+                // Update wait note text if refreshing
+                if( iWaitNoteType == EMPXRefreshingNote &&
+                    iScanningError == KErrNone )
+                    {
+                    HBufC* text = StringLoader::LoadLC( R_MPX_REFRESHING_DB_TXT, 
+                                                        iNumItemsAdded );
+                    SetTextL( *text ); 
+                    CleanupStack::PopAndDestroy( text );
+                    }
+                }    
+            }
+        } 
+    }
+    
+// END OF FILE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/src/mpxusbdialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,97 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note dialog for USB transfer
+*
+*/
+
+
+#include <e32base.h>
+#include <StringLoader.h>
+#include <avkon.rsg>
+#include <avkon.mbg>
+#include <aknconsts.h>
+#include <mpxcollectionmessage.h>
+#include <mpxwaitnotedialog.rsg>
+#include <mpxcollectionframeworkdefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxlog.h>
+#include "mpxusbdialog.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXUsbWaitDialog::CMPXUsbWaitDialog( MMPXWaitNoteObserver* aObs )
+                                     : CMPXWaitNoteDialog( aObs, EMPXUsbEventNote )
+    {
+
+    }
+
+
+// ---------------------------------------------------------------------------
+// 2nd Phased constructor
+// ---------------------------------------------------------------------------
+//
+void CMPXUsbWaitDialog::ConstructL()
+    {
+    BaseConstructL();
+    }
+
+
+// ---------------------------------------------------------------------------
+// Two-Phased Constructor
+// ---------------------------------------------------------------------------
+//
+CMPXUsbWaitDialog* CMPXUsbWaitDialog::NewL( MMPXWaitNoteObserver* aObs )
+    {
+    CMPXUsbWaitDialog* self = new(ELeave) CMPXUsbWaitDialog( aObs );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMPXUsbWaitDialog::~CMPXUsbWaitDialog()
+    {
+    }
+
+
+// ---------------------------------------------------------------------------
+// Setup Wait Notes
+// ---------------------------------------------------------------------------
+//
+void CMPXUsbWaitDialog::PreNoteDisplayHandleL()
+    {
+    // CBA
+    SetCBAL( R_AVKON_SOFTKEYS_EMPTY );
+
+    // Text
+    HBufC* text = StringLoader::LoadLC( R_MPX_USB_CONNECTION_IN_PROGRESS );
+    SetTextL( *text );
+    CleanupStack::PopAndDestroy( text );
+
+    // Icon
+    TNoteIconInfo icon( (TInt)EMbmAvkonQgn_note_progress,
+                        (TInt)EMbmAvkonQgn_note_progress_mask,
+                        TFileName(KAvkonBitmapFile) );
+    SetIconL( icon );
+    }
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/src/mpxwaitnoteconstructor.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,99 @@
+/*
+* Copyright (c)  Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Constructor class
+*
+*/
+
+
+
+#include <e32base.h>
+#include <mpxuser.h>
+#include "mpxwaitnoteobserver.h"
+#include "mpxwaitnoteconstructor.h"
+#include "mpxwaitnotedialog.h"
+#include "mpxscanningdialog.h"
+#include "mpxwaitnotedefs.h"
+#include "mpxusbdialog.h"
+#include "mpxmtpdialog.h"
+#include "mpxopeningdialog.h"
+#include "mpxformatdialog.h"
+
+// ---------------------------------------------------------------------------
+// Generic Constructor function
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CMPXWaitNoteDialog* CMPXWaitNoteConstructor::ConstructWaitNoteL(const TDesC& aArg,
+                                                           MMPXWaitNoteObserver* aObs )
+    {
+    // Make sure argument is provided
+    //
+    if( &aArg == NULL )
+        {
+        User::Leave(KErrArgument);
+        }
+
+    // Deserialize the data
+    //
+    HBufC8* arg = MPXUser::Alloc8L( aArg );
+    TPckg<TWaitNoteType> buf(EMPXNoteNotDefined);
+    buf.Copy(*arg);
+    TWaitNoteType type = buf();
+    delete arg;  // no leaving funcs
+
+    // Construct the wait note according to the type
+    //
+    CMPXWaitNoteDialog* note = (NULL);
+    switch( type )
+        {
+        case EMPXScanningNote:
+        case EMPXRefreshingNote:
+        case EMPXCorruptScanningNote:
+            {
+            note = CMPXScanningWaitDialog::NewL( aObs, type );
+            break;
+            }
+        case EMPXMTPEventNote:
+            {
+            note = CMPXMtpWaitDialog::NewL( aObs );
+            break;
+            }
+        case EMPXUsbEventNote:
+            {
+            note = CMPXUsbWaitDialog::NewL( aObs );
+            break;
+            }
+        case EMPXOpeningNote:
+            {
+            note = CMPXOpeningWaitDialog::NewL( aObs, EFalse );
+            break;
+            }
+        case EMPXFormatScanningNote:
+            {
+            note = CMPXFormattingWaitDialog::NewL( aObs );
+            break;
+            }
+		case EMPXImmediatelyOpeningNote:
+			{
+			note = CMPXOpeningWaitDialog::NewL( aObs );
+            break;
+            }
+        default:
+            {
+            User::Leave( KErrNotSupported );
+            break;
+            }
+        }
+    return note;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpxplugins/viewplugins/views/waitnotedialog/src/mpxwaitnotedialog.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,476 @@
+/*
+* Copyright (c)  Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Wait note dialog 
+*
+*/
+
+
+#include <e32base.h>
+#include <AknIconUtils.h>
+#include <eikimage.h>
+#include <eikenv.h>
+#include <bautils.h>
+#include <AknUtils.h>
+#include <AknsUtils.h>
+#include <aknnotewrappers.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxlog.h>
+#include <mpxcollectionutility.h>
+#include <aknSDData.h>
+#include <AknMediatorFacade.h>
+//#include <S32STRM.H>
+#include <mplayersecondarydisplayapi.h>
+
+#include <mpxwaitnotedialog.rsg>
+#include <mpxuser.h>
+#include "mpxwaitnotedialog.h"
+#include <mpxlog.h>
+
+// CONSTANTS
+_LIT( KMPXWaitNoteRscPath, "mpxwaitnotedialog.rsc" );
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+CMPXWaitNoteDialog::CMPXWaitNoteDialog( MMPXWaitNoteObserver* aObs,
+                                        TWaitNoteType aType,
+                                        TBool aVisibilityDelayOff  )
+                                        : iObserver( aObs ),
+                                          iWaitNoteType( aType ),
+                                          iVisDelayOff( aVisibilityDelayOff ),
+                                          iResourceOffset(0)
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// Base Second Phase Constructor
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::BaseConstructL()
+    {
+    // Collection Utility
+    iCollection = MMPXCollectionUtility::NewL( this );
+
+    // Resource file
+    CEikonEnv* eikEnv = CEikonEnv::Static();
+    TParse parse;
+    parse.Set( KMPXWaitNoteRscPath, &KDC_APP_RESOURCE_DIR, NULL );
+    TFileName resourceFile( parse.FullName() );
+    User::LeaveIfError( MPXUser::CompleteWithDllPath( resourceFile ) );
+    BaflUtils::NearestLanguageFile( eikEnv->FsSession(), resourceFile );
+    iResourceOffset = eikEnv->AddResourceFileL( resourceFile );
+    }
+
+
+// ---------------------------------------------------------------------------
+// Virtual destructor
+// ---------------------------------------------------------------------------
+//
+CMPXWaitNoteDialog::~CMPXWaitNoteDialog()
+    {
+    MPX_DEBUG1("CMPXWaitNoteDialog::~CMPXWaitNoteDialog <---");
+    if( iWaitDialog )
+        {
+        iWaitDialog->SetCallback( NULL );
+        TRAP_IGNORE( iWaitDialog->ProcessFinishedL() );
+        }
+
+    if( iResourceOffset )
+        {
+        CEikonEnv::Static()->DeleteResourceFile( iResourceOffset );
+        }
+
+    // Close any queries, if any
+    TRAP_IGNORE( DismissQueryNoteL() );
+
+    if( iCollection )
+        {
+        iCollection->Close();
+        }
+    MPX_DEBUG1("CMPXWaitNoteDialog::~CMPXWaitNoteDialog --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Execute the wait note
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::ExecuteLD()
+    {
+    MPX_DEBUG1("CMPXWaitNoteDialog::ExecuteLD <--");
+    // Construct the wait note
+    if(iWaitDialog )
+        {
+        MPX_DEBUG1("CMPXWaitNoteDialog::ExecuteLD -- deleting dlg");
+        iWaitDialog->SetCallback( NULL );
+        iWaitDialog->ProcessFinishedL();
+        iWaitDialog = NULL;
+        }
+
+    MPX_DEBUG1("CMPXWaitNoteDialog::ExecuteLD -- new dlg");
+    iWaitDialog = new ( ELeave ) CAknWaitDialog(
+                                        ( CEikDialog** )&iWaitDialog,
+                                        iVisDelayOff );
+    TInt dialogIndex = KErrNotFound;
+    switch ( iWaitNoteType )
+        {
+        case EMPXScanningNote:
+            {
+            dialogIndex = EMPlayerNoteCreatingDb;
+            break;
+            }
+
+        case EMPXOpeningNote:
+            {
+            dialogIndex = EMPlayerNoteOpeningDb;
+            break;
+            }
+
+        case EMPXRefreshingNote:
+            {
+            dialogIndex = EMPlayerNoteUpdatingDb;
+            break;
+            }
+
+        case EMPXCorruptScanningNote:
+            {
+            dialogIndex = EMPlayerNoteRebuildingDb;
+            break;
+            }
+
+        case EMPXUsbEventNote:
+            {
+            dialogIndex = EMPlayerUSBConnectionInProgress;
+            break;
+            }
+
+        case EMPXMTPEventNote:
+            {
+            dialogIndex = EMPlayerMTPConnectionInProgress;
+            break;
+            }
+
+        case EMPXFormatScanningNote:
+            {
+            dialogIndex = EMPlayerFormatting;
+            break;
+            }
+
+        case EMPXMediaNotAvailableNote:
+        case EMPXNoteNotDefined:
+        default:
+            break;
+        };
+
+    if ( dialogIndex != KErrNotFound )
+        {
+        iWaitDialog->PublishDialogL(
+            dialogIndex,
+            KMPlayerNoteCategory );
+
+        CAknMediatorFacade* covercl = AknMediatorFacade( iWaitDialog );
+        if ( covercl )
+            {
+            covercl->BufStream().WriteInt32L( 0 );
+            covercl->BufStream().CommitL();
+            }
+        }
+    iWaitDialog->SetCallback( this );
+    iWaitDialog->PrepareLC( R_MPX_GENERIC_WAIT_NOTE );
+
+    PreNoteDisplayHandleL();
+
+    iWaitDialog->RunLD();
+    MPX_DEBUG1("CMPXWaitNoteDialog::ExecuteLD -->");
+    }
+
+// ---------------------------------------------------------------------------
+// Cancel the wait note
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::CancelNoteL()
+    {
+    MPX_DEBUG1("CMPXWaitNoteDialog::CancelNoteL <---");
+    if( iWaitDialog )
+        {
+        iWaitDialog->ProcessFinishedL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Check the destruction status of wait dialog
+// ---------------------------------------------------------------------------
+//
+TBool CMPXWaitNoteDialog::ReadyToDestroy()
+    {
+    // iWaitDialog will be updated by CAknWaitDialog self-destruction mech
+    return iWaitDialog == NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// Do anything after the wait note is dismissed
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::PostNoteHandleL( TInt /*aButtonId*/ )
+    {
+    // Not used
+    }
+
+// ---------------------------------------------------------------------------
+// Set the wait note CBA buttons
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::SetCBAL( TInt aCBAId )
+    {
+    if( iWaitDialog )
+        {
+        MEikButtonGroup* buttonGroup =
+        iWaitDialog->ButtonGroupContainer().ButtonGroup();
+        buttonGroup->SetCommandSetL( aCBAId );
+        buttonGroup->AsControl()->DrawDeferred();
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set the wait note CBA text
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::SetTextL( const TDesC& aText )
+    {
+    if( iWaitDialog )
+        {
+        iWaitDialog->SetTextL( aText );
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Set the wait note Icon
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::SetIconL( TNoteIconInfo& aIconInfo )
+    {
+    if( iWaitDialog )
+        {
+        MAknsSkinInstance* skin( AknsUtils::SkinInstance() );
+
+        CFbsBitmap* bitmap = NULL;
+        CFbsBitmap* mask = NULL;
+
+        AknsUtils::CreateIconLC(
+            skin,
+            KAknsIIDNone,
+            bitmap,
+            mask,
+            aIconInfo.bmpfile,
+            aIconInfo.bitmapId,
+            aIconInfo.maskId );
+
+        CEikImage* icon = new ( ELeave ) CEikImage();
+        CleanupStack::PushL( icon );
+        icon->SetPicture( bitmap, mask );
+        icon->SetPictureOwnedExternally( EFalse );
+        iWaitDialog->SetImageL( icon );
+        CleanupStack::Pop( 3 ); // icon, bitmap, mask
+        }
+    else
+        {
+        User::Leave( KErrNotReady );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::HandleCollectionMediaL(const CMPXMedia& /*aMedia*/,
+                                                TInt /*aError*/)
+    {
+    // Not used
+    }
+
+// ---------------------------------------------------------------------------
+// MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::HandleCollectionMessage(
+    CMPXMessage* /*aMessage*/, TInt /*aError*/ )
+    {
+    // Not used
+    }
+
+// ---------------------------------------------------------------------------
+// MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::HandleOpenL(const CMPXMedia& /*aEntries*/,
+                                     TInt /*aIndex*/,TBool /*aComplete*/,TInt /*aError*/)
+    {
+    // Not used
+    }
+
+// ---------------------------------------------------------------------------
+// MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::HandleOpenL(const CMPXCollectionPlaylist& /*aPlaylist*/,
+                                     TInt /*aError*/)
+    {
+    // Not used
+    }
+
+// ---------------------------------------------------------------------------
+// MProgressDialogCallback
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::DialogDismissedL( TInt aButtonId )
+    {
+    // Tell inherited class abut the event
+    PostNoteHandleL( aButtonId );
+
+    // Tell view that wait dialog is finished
+    iObserver->HandleWaitNoteDismissedL();
+    }
+
+// ---------------------------------------------------------------------------
+// Display a confirmation note
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::DisplayConfirmationNoteL( const TDesC& aLabel )
+    {
+    CAknConfirmationNote* note = new ( ELeave ) CAknConfirmationNote();
+    note->ExecuteLD( aLabel );
+    }
+
+// ---------------------------------------------------------------------------
+// Display a information note
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::DisplayInformationNoteL( const TDesC& aLabel )
+    {
+    CAknInformationNote* note = new ( ELeave ) CAknInformationNote();
+    note->ExecuteLD( aLabel );
+    }
+
+// ---------------------------------------------------------------------------
+// Display a query note
+// ---------------------------------------------------------------------------
+//
+TInt CMPXWaitNoteDialog::DisplayQueryNoteL( const TDesC& aQuery )
+    {
+    CAknQueryDialog* query = new( ELeave ) CAknQueryDialog();
+    iQueryDialog = query;
+
+    TInt rtn = query->ExecuteLD( R_MPX_QUERY_YES_NO ,
+                                 aQuery );
+    iQueryDialog = NULL;  // Dialog destroyed
+    return rtn;
+    }
+
+// ---------------------------------------------------------------------------
+// Dismiss the current query note
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::DismissQueryNoteL()
+    {
+    if( iQueryDialog )
+        {
+        iQueryDialog->DismissQueryL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Display a generic note dialog
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::DisplayNoteDialogL( TInt aDlgRsc, const TDesC& aLabel,
+                                             CAknNoteDialog::TTone aTone )
+    {
+    iObserver->NoteDialogL( iNoteDialog, aDlgRsc, aTone );
+    if ( iNoteDialog )
+        {
+        iNoteDialog->SetTextL( aLabel );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Display a generic note dialog
+// ---------------------------------------------------------------------------
+//
+void CMPXWaitNoteDialog::DisplayNoteDialogL( TInt aDlgRsc, TInt aTextRsc,
+                                             TInt aItemsAdded, const TDesC& aLabel,
+                                             CAknNoteDialog::TTone aTone )
+    {
+    MPX_DEBUG1("CMPXWaitNoteDialog::DisplayNoteDialogL for COVER DISPLAY--->");
+
+    CAknNoteDialog* note = new ( ELeave ) CAknNoteDialog( aTone );
+    note->PrepareLC( aDlgRsc );
+    note->SetTextL( aLabel );
+    if ( aTextRsc == R_MPX_REFRESHING_DB_STOPPED_TXT )
+        {
+        note->PublishDialogL(
+            EMPlayerNoteDbUpdateStopped,
+            KMPlayerNoteCategory);
+        }
+    else if ( aTextRsc == R_MPX_SCANNING_STOPPED_TXT )
+        {
+        note->PublishDialogL(
+            EMPlayerNoteDbSearchStoppedItemFound,
+            KMPlayerNoteCategory);
+        }
+    else if ( aTextRsc == R_MPX_SCANNING_COMPLETE_TXT )
+        {
+        TInt noteId( EMPlayerNoteDbCreationCompleteEmpty );
+        if ( aItemsAdded > 0 )
+            {
+            noteId = EMPlayerNoteDbCreationComplete;
+            };
+
+        note->PublishDialogL(
+            noteId,
+            KMPlayerNoteCategory);
+        }
+    else if ( aTextRsc == R_MPX_REFRESHING_DB_COMPLETE_TXT )
+        {
+        note->PublishDialogL(
+            EMPlayerNoteDbUpdateComplete,
+            KMPlayerNoteCategory);
+        }
+
+    if ( aTextRsc != KErrNotFound )
+        {
+        CAknMediatorFacade* covercl = AknMediatorFacade( note );
+        if ( covercl )
+            {
+            covercl->BufStream().WriteInt32L( aItemsAdded );
+            covercl->BufStream().CommitL();
+            }
+        }
+
+    note->RunLD();
+    MPX_DEBUG1("<--CMPXWaitNoteDialog::DisplayNoteDialogL for COVER DISPLAY End");
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/bwins/dummyMusicu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?E32Main@@YAHXZ @ 1 NONAME ; int E32Main(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/music_matrix_items.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mm:content xmlns:mm="http://nokia.com/mmenu" 
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+            xsi:schemaLocation="http://nokia.com/mmenu ../mmenuschema.xsd" genre="musicsuite">
+<mm:localization namespace="musicsuite_loc" source="musichomescreen.rsc"/>
+
+    
+		<mm:item count="1" template="logical_template_6" id="msuitecps"> 
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_OPEN" event="key:select" position="1" />
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_HELP" event="custom:musicsuitehelp" position="2" />
+        <mm:query namespace="musicquery" service="Service.ContentPublishing" interface="IDataSource">
+        <mm:command mode="sync" name="GetList">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter">
+                    	<mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="text"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_text1"/>
+                    </mm:key>
+            </mm:command>
+        </mm:query>
+        <mm:notify_request service="Service.ContentPublishing" interface="IDataSource">
+            <mm:command name="RequestNotification">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter"> 
+                        <mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="text"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_text1"/>
+                    </mm:key>
+            </mm:command>
+       </mm:notify_request>
+
+        <mm:output alias="mul_title" type="string" value="musicquery:results/[$index]/data_map/musicmenu_musicinfo_text1data"/>
+        
+        <mm:query namespace="musicquery2" service="Service.ContentPublishing" interface="IDataSource">
+        <mm:command mode="sync" name="GetList">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter">
+                    	<mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="text"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_text2"/>
+                    </mm:key>
+            </mm:command>
+        </mm:query>
+        <mm:notify_request service="Service.ContentPublishing" interface="IDataSource">
+            <mm:command name="RequestNotification">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter"> 
+                        <mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="text"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_text2"/>
+                    </mm:key>
+            </mm:command>
+       	</mm:notify_request>
+       
+        <mm:output alias="mul_detail" type="string" value="musicquery2:results/[$index]/data_map/musicmenu_musicinfo_text2data"/>
+        
+
+
+
+        <mm:query namespace="musicquery3" service="Service.ContentPublishing" interface="IDataSource">
+        <mm:command mode="sync" name="GetList">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter">
+                    	<mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="image"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_image"/>
+                    </mm:key>
+            </mm:command>
+        </mm:query>
+        <mm:notify_request service="Service.ContentPublishing" interface="IDataSource">
+            <mm:command name="RequestNotification">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter"> 
+                        <mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="image"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_image"/>
+                    </mm:key>
+            </mm:command>
+       	</mm:notify_request>
+       
+        <mm:output alias="mul_icon">
+        <mm:image bitmap="musicquery3:results/[$index]/data_map/musicmenu_musicinfo_imagedata" mask="musicquery3:results/[$index]/data_map/musicmenu_musicinfo_imagedata_mask"/>
+        </mm:output>
+
+
+
+        <mm:event event="key:select">
+        	<mm:action service="Service.ContentPublishing" interface="IContentPublishing">
+				<mm:command name="ExecuteAction">
+					<mm:key name="type" type="string" value="cp_data"/>
+					<mm:key name="filter" type="map">
+						<mm:key name="publisher" type="string" value="MWPublisher"/>
+						<mm:key name="content_type" type="string" value="text"/>
+				    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_text1"/>
+						<mm:key name="action_trigger" type="string8" value="MMInfoTrigger"/>
+                    </mm:key>
+                </mm:command>
+            </mm:action>
+        </mm:event>
+    </mm:item>   
+    
+    <mm:item count="1" template="logical_template_6" id="msuitemymusic">
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_OPEN" event="key:select" position="1" />
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_HELP" event="custom:musicsuitehelp" position="2" />
+        <mm:output alias="mul_title">
+        	<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_MY_MUSIC"/>
+        </mm:output>
+    	<mm:query namespace="musicquery3" service="Service.ContentPublishing" interface="IDataSource">
+        	<mm:command mode="sync" name="GetList">
+            	<mm:key name="type" type="string" value="cp_data"/>
+                <mm:key name="filter">
+                   	<mm:key name="publisher" type="string" value="MpxCollectionPublisher"/>
+                   	<mm:key name="content_type" type="string" value="integer"/>
+                   	<mm:key name="content_id" type="string" value="musicmenu_collectioninfo_numb1"/>
+                </mm:key>
+            </mm:command>
+        </mm:query>
+        <mm:notify_request service="Service.ContentPublishing" interface="IDataSource">
+            <mm:command name="RequestNotification">
+     	       <mm:key name="type" type="string" value="cp_data"/>
+               <mm:key name="filter"> 
+               		<mm:key name="publisher" type="string" value="MpxCollectionPublisher"/>
+                    <mm:key name="content_type" type="string" value="integer"/>
+                   	<mm:key name="content_id" type="string" value="musicmenu_collectioninfo_numb1"/>
+               </mm:key>
+            </mm:command>
+       </mm:notify_request>
+
+		<!-- only one song present -->
+        <mm:output alias="mul_detail" condition="musicquery3:results/[$index]/data_map/musicmenu_collectioninfo_numb1data = 1">
+        	<mm:text value ="musicsuite_loc:R_MUSICHOMESCREEN_MY_MUSIC_1_SONG"/>
+        </mm:output>
+        <!-- multiple songs present -->
+        <mm:output alias="mul_detail" condition="musicquery3:results/[$index]/data_map/musicmenu_collectioninfo_numb1data &gt; 1">
+        	<!-- %N songs present -->
+        	<mm:text value ="musicsuite_loc:R_MUSICHOMESCREEN_MY_MUSIC_N_SONGS">
+ 				<mm:param value="musicquery3:results/[$index]/data_map/musicmenu_collectioninfo_numb1data"/>
+ 			</mm:text>
+        </mm:output>
+        <!-- default - no songs present -->
+        <mm:output alias="mul_detail">
+        	<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_MY_MUSIC_NO_SONGS"/>
+        </mm:output>
+        <mm:output alias="mul_icon">
+			<mm:image application_uid="0x102072C3"/>
+		</mm:output>    
+        
+        <mm:event event="key:select">
+            <mm:action service="Service.ActionHandler" interface="IDataAction">
+                <mm:command name="Execute">
+                    <mm:key name="plugin_id" type="uid" value="0x10207C16"/>
+                    <mm:key name="data">
+                        <mm:key name="type" type="string" value="MessageToMusicPlayer"/>
+                        <mm:key name="message" type="string" value="GoToMusicLibrary"/>
+                        <!--mm:key name="Path" type="string" value="MusicMenu"/-->
+                    </mm:key>
+                </mm:command>
+            </mm:action>
+        </mm:event>
+    </mm:item>
+   
+
+    <mm:item count="1" template="logical_template_6" id="msuitemusicstore">
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_OPEN" event="key:select" position="1" />
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_HELP" event="custom:musicsuitehelp" position="2" />
+        <mm:output alias="mul_title">
+        	<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_NOKIA_MUSIC_STORE"/>
+        </mm:output>
+        <mm:output alias="mul_detail">
+        		<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_NOKIA_STORE_AD"/>
+        </mm:output>
+        <mm:output alias="mul_icon">
+						<mm:image application_uid="0x101FFB51"/>
+		</mm:output> 
+        <mm:event event="key:select">
+            <mm:action service="Service.ActionHandler" interface="IDataAction">
+                <mm:command name="Execute">
+                    <mm:key>
+                        <mm:key name="plugin_id" type="uid" value="0x10282E5F"/>
+                        <mm:key name="data">
+                            <!-- At least one sub element is required in the data key. -->
+                            <mm:key name="type" type="string" value="launch_application"/>
+                            <mm:key name="launch_method" type="string" value="cmd_line"/>
+                            <mm:key name="application_uid" type="integer" value="0x101FFB51"/>
+                        </mm:key>
+                    </mm:key>
+                </mm:command>
+            </mm:action>      
+        </mm:event>
+    </mm:item>
+   
+   <mm:item count="1" template="logical_template_6" id="msuitefmradio">
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_OPEN" event="key:select" position="1" />
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_HELP" event="custom:musicsuitehelp" position="2" />
+       	<mm:output alias="mul_title">
+        	<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_FM_RADIO"/>
+       	</mm:output>
+       	<mm:output alias="mul_detail">
+        	<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_FM_RADIO_AD"/>
+       	</mm:output>
+       	<mm:output alias="mul_icon">
+			<mm:image application_uid="0x10207A89"/>
+		</mm:output> 
+        <mm:event event="key:select">
+            <mm:action service="Service.ActionHandler" interface="IDataAction">
+                <mm:command name="Execute">
+                    <mm:key>
+                        <mm:key name="plugin_id" type="uid" value="0x10282E5F"/>
+                        <mm:key name="data">
+                            <!-- At least one sub element is required in the data key. -->
+                            <mm:key name="type" type="string" value="launch_application"/>
+                            <mm:key name="launch_method" type="string" value="cmd_line"/>
+                            <mm:key name="application_uid" type="integer" value="0x10207A89"/>
+                        </mm:key>
+                    </mm:key>
+                </mm:command>
+            </mm:action>
+        </mm:event> 
+    </mm:item>
+           
+</mm:content>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/musichomescreen.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project MusicHomeScreen
+*
+*/
+
+
+NAME    MSCF
+
+#include <eikon.rsg>
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include <appinfo.rh>
+#include <bldvariant.hrh>
+
+#include <data_caging_paths_strings.hrh>
+
+#include <musichomescreen.loc>
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf=""; }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_suite_title
+// Title for the music suite in the matrix menu
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_suite_title
+    {
+    buf = qtn_vmp_title_suite;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_fm_radio
+// Text for the title of the FM radio application 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_fm_radio
+    {
+    buf = qtn_vmp_title_fm_radio;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_fm_radio_ad
+// Text for the description of the FM radio 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_fm_radio_ad
+    {
+    buf = qtn_vmp_title_fm_radio_ad;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_last_played
+// Text for the most recently played song or track 
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_musichomescreen_last_played
+    {
+    txt = qtn_vmp_title_last_played;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_music_no_music
+// Text to indicate that that there are NO songs in the collection
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_music_no_music
+    {
+    buf = qtn_vmp_title_music_no_music;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_my_music
+// Text for title of the music collection item 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_my_music
+    {
+    buf = qtn_vmp_title_my_music;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_nokia_music_store
+// Text for nokia music store web service
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_nokia_music_store
+    {
+    buf = qtn_vmp_title_nokia_music_store;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_nokia_store_ad
+// Text for store description
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_nokia_store_ad
+    {
+    buf = qtn_vmp_title_nokia_store_ad;
+    }
+// ---------------------------------------------------------------------------
+// r_musichomescreen_now_playing
+// Text for currently playing song or track
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_musichomescreen_now_playing
+    {
+    txt = qtn_vmp_title_now_playing;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_my_music_1_song
+// Text to indicate that there is ONE song in the collection 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_my_music_1_song
+    {
+    buf = qtn_vmp_title_my_music_1_song;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_my_music_n_songs
+// Text to indicate that there are n songs in the collection 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_my_music_n_songs
+    {
+    buf = qtn_vmp_title_my_music_n_songs;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_my_music_no_songs
+// Text to indicate that there are no songs in the collection 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_my_music_no_songs
+    {
+    buf = qtn_vmp_title_my_music_no_songs;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_musichomescreen_go_to_music
+// Text to be displayed on the music widget when there is no played Music.
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_musichomescreen_go_to_music
+    {
+    txt = qtn_vmp_music_widget_go_to_music;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_musichomescreen_opening
+// Text too be displayed when we are about to open a song.
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_musichomescreen_opening
+    {
+    txt = qtn_vmp_music_widget_opening;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_musichomescreen_options_open
+// 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_options_open
+    {
+    buf = qtn_options_open;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_options_help
+// 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_options_help
+    {
+    buf = qtn_options_help;
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/suite.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<mm:content xmlns:mm="http://nokia.com/mmenu" 
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+            xsi:schemaLocation="http://nokia.com/mmenu ../mmenuschema.xsd">
+	<mm:localization namespace="musicsuite_loc" source="musichomescreen.rsc"/>
+	<mm:suite template="logical_template_6" type="list" genre="musicsuite" title="musicsuite_loc:R_MUSICHOMESCREEN_SUITE_TITLE">
+	<mm:event event="custom:musicsuitehelp">
+	        	<mm:action service="Service.ActionHandler" interface="IDataAction">
+               <mm:command name="Execute">
+                   <mm:key>
+                       <mm:key name="plugin_id" type="uid" value="0x2001B285"/>
+                       <mm:key name="data">
+                           <mm:key name="help_uid" type="integer" value="0x102072C3"/>
+                           <mm:key name="help_topic" type="string" value="MUS_HLP_MUSIC_SUITE_VIEW"/>
+                       </mm:key>
+                   </mm:key>
+               </mm:command>
+           	</mm:action>                
+	</mm:event>
+	</mm:suite>
+</mm:content>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  build inf file
+*
+*/
+
+
+#include "../install/musicwidget/group/bld.inf"
+
+PRJ_PLATFORMS
+DEFAULT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The information required for building
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// Support for R&D builds
+//***********************
+// For WINSCW UDEB emulator
+../hsps/00/manifest.dat /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/hsps/00/manifest.dat
+../hsps/00/widgetconfiguration.xml /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/hsps/00/widgetconfiguration.xml
+../hsps/00/musicwidgetconfiguration.dtd /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/hsps/00/musicwidgetconfiguration.dtd
+../xuikon/00/musicwidget.o0000 /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/xuikon/00/musicwidget.o0000
+../xuikon/00/MusicWidget.dat /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.dat
+../xuikon/00/MusicWidget.css /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.css
+../xuikon/00/MusicWidget.xml /epoc32/release/winscw/udeb/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.xml
+
+// For IBY exports (engineering versions)
+../hsps/00/manifest.dat /epoc32/data/Z/private/200159c0/install/musicwidget/hsps/00/manifest.dat
+../hsps/00/widgetconfiguration.xml /epoc32/data/Z/private/200159c0/install/musicwidget/hsps/00/widgetconfiguration.xml
+../hsps/00/musicwidgetconfiguration.dtd /epoc32/data/Z/private/200159c0/install/musicwidget/hsps/00/musicwidgetconfiguration.dtd
+../xuikon/00/musicwidget.o0000 /epoc32/data/Z/private/200159c0/install/musicwidget/xuikon/00/musicwidget.o0000
+../xuikon/00/MusicWidget.dat /epoc32/data/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.dat
+../xuikon/00/MusicWidget.css /epoc32/data/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.css
+../xuikon/00/MusicWidget.xml /epoc32/data/Z/private/200159c0/install/musicwidget/xuikon/00/MusicWidget.xml
+
+// Support for productization and Carbide.Ui customization
+//********************************************************
+../hsps/00/manifest.dat /epoc32/data/Z/resource/homescreen/musicwidget/hsps/manifest.dat
+../hsps/00/widgetconfiguration.xml /epoc32/data/Z/resource/homescreen/musicwidget/hsps/widgetconfiguration.xml
+../hsps/00/musicwidgetconfiguration.dtd /epoc32/data/Z/resource/homescreen/musicwidget/hsps/musicwidgetconfiguration.dtd
+
+../xuikon/00/MusicWidget.dat /epoc32/data/Z/resource/homescreen/musicwidget/xuikon/MusicWidget.dat
+../xuikon/00/MusicWidget.css /epoc32/data/Z/resource/homescreen/musicwidget/xuikon/MusicWidget.css
+../xuikon/00/MusicWidget.xml /epoc32/data/Z/resource/homescreen/musicwidget/xuikon/MusicWidget.xml
+
+
+// Arabic languages
+//*****************
+../xuikon/37/MusicWidget.css /epoc32/data/Z/resource/homescreen/musicwidget/xuikon/37/MusicWidget.css
+../xuikon/50/MusicWidget.css /epoc32/data/Z/resource/homescreen/musicwidget/xuikon/50/MusicWidget.css
+../xuikon/57/MusicWidget.css /epoc32/data/Z/resource/homescreen/musicwidget/xuikon/57/MusicWidget.css
+../xuikon/94/MusicWidget.css /epoc32/data/Z/resource/homescreen/musicwidget/xuikon/94/MusicWidget.css
+
+
+// Support for S60 localization
+//*****************************
+// export localizable loc files (engineering versions)
+../loc/musicwidgetconfiguration.loc         APP_LAYER_LOC_EXPORT_PATH(musicwidgetconfiguration.loc)
+
+// Support for S60 builds
+//***********************
+// export iby files
+../rom/musicwidget_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(musicwidget_resources.iby)
+../rom/musicwidget_customer.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(musicwidget_customer.iby)
+../rom/musicwidget_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(musicwidget_variant.iby)
+../rom/musicwidget.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musicwidget.iby)
+
+
+// Dtd-localization
+//*****************
+PRJ_EXTENSIONS
+START EXTENSION tools/dtd
+OPTION SWITCH_LOC_FILE_NAME musicwidget
+OPTION DTD_TYPE widget
+OPTION LOC_FOLDERS yes
+END
+
+
+PRJ_MMPFILES
+
+// build icons
+
+
+// build application
+
+PRJ_TESTMMPFILES
+
+//#endif
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/hsps/00/manifest.dat	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<package version="0.3">
+
+    <type>widget</type>
+
+    <!-- interface uid -->
+	<interfaceuid>2001f48a</interfaceuid>
+
+	<!-- vendor uid  -->
+	<provideruid>101fb657</provideruid>
+
+	<!-- uid -->
+	<configurationuid>10207c18</configurationuid>
+
+	<!-- description -->
+	<fullname>&amp;qtn_musicwidget_configuration_name;</fullname>
+	<shortname>mw</shortname>
+	<version>1.0</version>
+	
+
+	<!-- configuration -->
+	<filexml>widgetconfiguration.xml</filexml>
+
+	<!-- Name of the localization files -->
+   <filedtd>musicwidgetconfiguration.dtd</filedtd>
+	<!-- Locale independent/common resources -->
+	
+
+  <!-- Locale specific resources -->
+	<localization>
+<fileresource>musicwidget.o0000</fileresource>
+	</localization>
+</package>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/hsps/00/musicwidgetconfiguration.dtd	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+============================================================================
+<FileName: "musicwidgetconfiguration.dtd">
+
+<FileDescription: "Localization strings for HSP Music Widget configuration">
+<FileVersion    : >
+
+<Copyright:
+"Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+All rights reserved.
+This component and the accompanying materials are made available
+under the terms of "Eclipse Public License v1.0"
+which accompanies this distribution, and is available
+at the URL "http://www.eclipse.org/legal/epl-v10.html".
+
+Initial Contributors:
+Nokia Corporation - initial contribution.
+
+Contributors:
+
+Description:   ">
+============================================================================
+-->
+
+<!--  LOCALISATION STRINGS  -->
+
+<!ENTITY qtn_musicwidget_configuration_name "Music Widget">
+
+
+<!-- End of File-->
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/hsps/00/widgetconfiguration.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+<configuration>
+    <control>
+        <settings/>
+    </control>
+</configuration>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/loc/musicwidgetconfiguration.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for Music Widget Configuration
+*
+*/
+
+
+// d: This is the text used to identify the music widget,
+// d: this is listed on the homescreen "add widget" dialog
+// l: ai_gene_pane_1_t1
+// w:
+// r: S60 v5.1
+#define qtn_musicwidget_configuration_name  "Music Widget"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/rom/musicwidget.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music widget HSPS-plugin IBY file.
+*
+*/
+
+
+#ifndef __MUSICWIDGET_IBY__
+#define __MUSICWIDGET_IBY__
+
+// Enabled by DTD-localization tools
+data=ZPRIVATE\200159c0\install\musicwidget\hsps\00\manifest.dat \private\200159c0\install\musicwidget\hsps\00\manifest.dat
+
+#endif // __MUSICWIDGET_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/rom/musicwidget_customer.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music widget HSPS-plugin language specific IBY file.
+*
+*/
+
+
+#ifndef __MUSICWIDGET_CUSTOMER_IBY__
+#define __MUSICWIDGET_CUSTOMER_IBY__
+
+// Enabled by DTD-localization tools, language specific
+data=ZPRIVATE\200159c0\install\musicwidget\xuikon\00\musicwidget.o0000 \private\200159c0\install\musicwidget\xuikon\00\musicwidget.o0000
+data=ZPRIVATE\200159c0\install\musicwidget\hsps\00\musicwidgetconfiguration.dtd \private\200159c0\install\musicwidget\hsps\00\musicwidgetconfiguration.dtd
+
+#endif // __MUSICWIDGET_CUSTOMER_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/rom/musicwidget_resources.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music widget HSPS-plugin language specific IBY file.
+*
+*/
+
+
+#ifndef __MUSICWIDGET_RESOURCES_IBY__
+#define __MUSICWIDGET_RESOURCES_IBY__
+
+// Enabled by DTD-localization tools, language specific
+#if defined (__LOCALES_37_IBY__)
+data=ZPRIVATE\200159c0\install\musicwidget\xuikon\37\musicwidget.o0037 \private\200159c0\install\musicwidget\xuikon\37\musicwidget.o0037
+#endif
+#if defined  (__LOCALES_50_IBY__)
+data=ZPRIVATE\200159c0\install\musicwidget\xuikon\50\musicwidget.o0050 \private\200159c0\install\musicwidget\xuikon\50\musicwidget.o0050
+#endif
+#if defined  (__LOCALES_57_IBY__)
+data=ZPRIVATE\200159c0\install\musicwidget\xuikon\57\musicwidget.o0057 \private\200159c0\install\musicwidget\xuikon\57\musicwidget.o0057
+#endif
+#if defined  (__LOCALES_94_IBY__)
+data=ZPRIVATE\200159c0\install\musicwidget\xuikon\94\musicwidget.o0094 \private\200159c0\install\musicwidget\xuikon\94\musicwidget.o0094
+#endif
+data=ZPRIVATE\200159c0\install\musicwidget\hsps\00\musicwidgetconfiguration.dtd \private\200159c0\install\musicwidget\hsps\00\musicwidgetconfiguration.dtd
+
+#endif // __MUSICWIDGET_RESOURCES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/rom/musicwidget_variant.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music widget HSPS-plugin variant specific IBY file.
+*
+*/
+
+
+#ifndef __MUSICWIDGET_VARIANT_IBY__
+#define __MUSICWIDGET_VARIANT_IBY__
+
+// Enabled by variation tools, variant specific
+data=ZPRIVATE\200159c0\install\musicwidget\hsps\00\widgetconfiguration.xml \private\200159c0\install\musicwidget\hsps\00\widgetconfiguration.xml
+
+#endif  // __MUSICWIDGET_VARIANT_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/xuikon/00/MusicWidget.css	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,135 @@
+widget#MusicWidget
+    {
+    display: block;
+    visibility: visible;
+    width:312px;
+    height:75px;
+    padding-top: 4px;
+    padding-bottom: 3px;
+    padding-left: 4px;
+    margin-left: auto;
+    margin-right: auto;
+    block-progression: rl;
+    direction: ltr;
+    nav-index:appearance;
+    }
+    
+box#area1
+    {
+    display: block;
+    visibility: visible;
+    width: 70px;
+    height: 70px;
+    margin-right: 3px;
+    padding-top: 3px;
+    padding-bottom: 2px;
+    padding-left: 2px;
+    padding-right: 2px;
+    direction: ltr;
+    block-progression: tb;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#area2
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: auto; 
+    block-progression: tb;
+    nav-index:appearance;
+    }
+    
+box#textbox
+    {
+    display: block;
+    visibility: visible;
+    margin-right: 3px;
+    width: 100%; 
+    height: 40%;
+    nav-index:appearance;
+    }
+
+box#toolbarbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 60%; 
+    block-progression: lr;
+    nav-index:appearance;
+    }
+    
+box.toolbarbuttonbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 100%;
+    margin-right: 3px;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+    
+box#textbox2
+    {
+    display: block;
+    visibility: visible;
+    margin-right: 3px;
+    width: auto; 
+    height: 100%; 
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#player_inactive
+{
+    display: block;
+
+}
+
+box#player_active
+{
+    display: none;
+}
+
+
+box:focus 
+    {
+    touchfeedbackdown: basic; 
+    touchfeedbackdrag: sensitive;
+    focus-background:"SKIN(268458534 9896)";
+    }
+
+
+image
+    {
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: auto;
+    margin-bottom: auto;
+    }
+image.area1_images
+    {
+    width: 70px;
+    height: 70px;
+    }
+    
+image.toolbarimage
+    {
+    width: 41px;
+    height: 41px;
+    }
+
+text
+    {
+    color:"SKIN(268458534 13056 74)";
+    display: block;
+    visibility: visible;
+    position: static;
+    font-family: EAknLogicalFontSecondaryFont;
+    font-size: 3.5u;
+    text-align:center;
+     direction: ltr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/xuikon/00/MusicWidget.dat	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<data>
+    <AppUid>E029CF57</AppUid>
+    <Provideruid>101FB657</Provideruid>
+    <ThemeUid>10207C1C</ThemeUid>
+    <ThemeFullName>musicwidget</ThemeFullName>
+    <ThemeShortName>musicwidget</ThemeShortName>
+    <ThemeVersion>1.0</ThemeVersion>
+    <FileXML>MusicWidget.xml</FileXML>
+    <FileCSS>MusicWidget.css</FileCSS>
+</data>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/xuikon/00/MusicWidget.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmluiml xmlns="http://www.series60.com/xml/xmluiml/1" version="1.0">
+
+
+    <widget id="MusicWidget">
+        <property class="ContentSource" name="MWCS" value="0x20019594"/>
+        <configuration name="service" value="Service.ContentPublishing"/>
+        <configuration name="interface" value="IContentPublishing"/>
+        <configuration name="command" value="GetList"/>
+
+        <box id="area1" focusable="true">
+            <actions>
+                <action>
+                    <trigger name="stylus">
+                        <property name="eventtype" value="up" />
+                    </trigger>
+                    <trigger name="activate"/>
+                    <trigger name="keyevent">
+                        <property name="scancode" value="3"/>
+                        <property name="eventtype" value="1"/>
+                    </trigger>
+                    <event name="MWCS/img1(MWTrigger1)"/>
+                </action>
+            </actions>
+
+          <image class="area1_images" id="DefaultImage" path="SKIN(270501603 8633)"/>
+            <image class="area1_images" id="area1_image1">
+                <property class="MWCS/img1"/>
+                <property class="policy/emptyContent" name="DefaultImage" value="display: block;"/>
+                <property class="policy/Content" name="DefaultImage" value="display: none;"/>
+                <configuration name="publisher" value="MWPublisher"/>
+                <configuration name="content_type" value="image"/>
+                <configuration name="content_id" value="area1_image1_content"/>
+                <configuration name="results" value="area1_image1_data"/>
+            </image>
+        </box><!--#area1-->
+
+        <box id="area2">        
+            <box id="player_inactive" visualisationaware="true">            
+                <box id="textbox2" focusable="true">
+                <actions>
+                    <action>
+                        <trigger name="stylus">
+                            <property name="eventtype" value="up" />
+                        </trigger>
+                        <trigger name="activate"/>
+                        <trigger name="keyevent">
+                            <property name="scancode" value="3"/>
+                            <property name="eventtype" value="1"/>
+                        </trigger>
+                        <event name="MWCS/default_text(MWTrigger2)"/>
+                    </action>
+                    <action>                    
+                        <trigger name="losevisualisation" />
+                        <event name="system/setfocus">
+                            <property name="id" value="area1"/>
+                        </event>                    
+                    </action>
+                </actions>
+    
+                <text id="area2_default_text">
+                    <property class="MWCS/default_text"/>                
+                                    
+                    <property class="policy/emptyContent" name="player_inactive" value="display: none;"/>
+                    <property class="policy/emptyContent" name="player_active" value="display: block;"/>
+                    
+                    <property class="policy/Content"      name="player_inactive" value="display: block;"/>
+                    <property class="policy/Content"      name="player_active" value="display: none;"/>
+                                        
+                    <configuration name="publisher" value="MWPublisher"/>
+                    <configuration name="content_type" value="text"/>
+                    <configuration name="content_id" value="default_text_content"/>
+                    <configuration name="results" value="default_text_data"/>
+                </text>
+                </box><!--#textbox2-->            
+            </box>
+            
+            <box id="player_active" visualisationaware="true">
+                <box id="textbox">
+                    <text id="area2_text1">
+                        <property class="MWCS/txt1"/>
+                        <configuration name="publisher" value="MWPublisher"/>
+                        <configuration name="content_type" value="text"/>
+                        <configuration name="content_id" value="area2_text1_content"/>
+                        <configuration name="results" value="area2_text1_data"/>
+                    </text>
+    
+                </box><!--#textbox-->
+    
+                <box id="toolbarbox">
+                    <box id="toolbarbutton1" class="toolbarbuttonbox" focusable="true">
+                        <actions>
+                            <action>
+                                <trigger name="stylus">
+                                    <property name="eventtype" value="up" />
+                                </trigger>
+                                <trigger name="activate"/>
+                                <trigger name="keyevent">
+                                    <property name="scancode" value="3"/>
+                                    <property name="eventtype" value="1"/>
+                                </trigger>
+                                <event name="MWCS/TB1(TB1Trigger)"/>
+                            </action>
+                            <action>
+                                <trigger name="losevisualisation" />
+                                <event name="system/setfocus">
+                                    <property name="id" value="area1"/>
+                                </event>
+                            </action>
+                        </actions>
+                        <image class="toolbarimage" id="toolbarimage1" >
+                            <property class="MWCS/TB1"/>
+                            <configuration name="publisher" value="MWPublisher"/>
+                            <configuration name="content_type" value="image"/>
+                            <configuration name="content_id" value="toolbar_b1_content"/>
+                            <configuration name="results" value="toolbar_b1_data"/>
+                        </image>
+                    </box><!--.toolbarbuttonbox-->
+    
+                    <box id="toolbarbutton2" class="toolbarbuttonbox" focusable="true">
+                        <actions>
+                            <action>
+                                <trigger name="stylus">
+                                    <property name="eventtype" value="up" />
+                                </trigger>
+                                <trigger name="activate"/>
+                                <trigger name="keyevent">
+                                    <property name="scancode" value="3"/>
+                                    <property name="eventtype" value="1"/>
+                                </trigger>
+                                <event name="MWCS/TB2(TB2Trigger)"/>
+                            </action>
+                            <action>
+                                <trigger name="losevisualisation" />
+                                <event name="system/setfocus">
+                                    <property name="id" value="area1"/>
+                                </event>
+                            </action>
+                        </actions>
+                        <image class="toolbarimage" id="toolbarimage2">
+                            <property class="MWCS/TB2"/>                            
+                            <property class="policy/emptyContent"      name="player_active" value="display: none;"/>
+			    <property class="policy/emptyContent"      name="player_inactive" value="display: block;"/>                                                        
+                            <configuration name="publisher" value="MWPublisher"/>
+                            <configuration name="content_type" value="image"/>
+                            <configuration name="content_id" value="toolbar_b2_content"/>
+                            <configuration name="results" value="toolbar_b2_data"/>
+                        </image>
+                    </box><!--.toolbarbuttonbox-->
+    
+                    <box id="toolbarbutton3" class="toolbarbuttonbox" focusable="true">
+                        <actions>
+                            <action>
+                                <trigger name="stylus">
+                                    <property name="eventtype" value="up" />
+                                </trigger>
+                                <trigger name="activate"/>
+                                <trigger name="keyevent">
+                                    <property name="scancode" value="3"/>
+                                    <property name="eventtype" value="1"/>
+                                </trigger>
+                                <event name="MWCS/TB3(TB3Trigger)"/>
+                            </action>
+                            <action>
+                                <trigger name="losevisualisation" />
+                                <event name="system/setfocus">
+                                    <property name="id" value="area1"/>
+                                </event>
+                            </action>
+                        </actions>
+                        <image class="toolbarimage" id="toolbarimage3">
+                            <property class="MWCS/TB3"/>
+                            <configuration name="publisher" value="MWPublisher"/>
+                            <configuration name="content_type" value="image"/>
+                            <configuration name="content_id" value="toolbar_b3_content"/>
+                            <configuration name="results" value="toolbar_b3_data"/>
+                        </image>
+                    </box><!--.toolbarbuttonbox-->    
+                </box><!--#toolbarbox-->                
+            </box>                                
+        </box><!--#area2-->
+    </widget><!--#MusicWidget-->
+</xmluiml>
Binary file musichomescreen/data/themes/default/install/musicwidget/xuikon/00/musicwidget.o0000 has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/xuikon/37/MusicWidget.css	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,136 @@
+widget#MusicWidget
+    {
+    display: block;
+    visibility: visible;
+    width:312px;
+    height:75px;
+    padding-top: 4px;
+    padding-bottom: 3px;
+    padding-right: 4px;
+    margin-left: auto;
+    margin-right: auto;
+    block-progression: rl;
+    direction: rtl;
+    nav-index:appearance;
+    }
+    
+box#area1
+    {
+    display: block;
+    visibility: visible;
+    width: 70px;
+    height: 70px;
+    margin-left: 3px;
+    padding-top: 3px;
+    padding-bottom: 2px;
+    padding-left: 2px;
+    padding-right: 2px;
+    direction: ltr;
+    block-progression: tb;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#area2
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: auto; 
+    block-progression: tb;
+    nav-index:appearance;
+    }
+    
+box#textbox
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: 100%; 
+    height: 40%;
+    nav-index:appearance;
+    }
+
+box#toolbarbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 60%;
+    direction: ltr;
+    block-progression: rl;
+    nav-index:appearance;
+    }
+    
+box.toolbarbuttonbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 100%;
+    margin-left: 3px;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+    
+box#textbox2
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: auto; 
+    height: 100%; 
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#player_inactive
+{
+    display: block;
+
+}
+
+box#player_active
+{
+    display: none;
+}
+
+
+box:focus 
+    {
+    touchfeedbackdown: basic; 
+    touchfeedbackdrag: sensitive;
+    focus-background:"SKIN(268458534 9896)";
+    }
+
+
+image
+    {
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: auto;
+    margin-bottom: auto;
+    }
+image.area1_images
+    {
+    width: 70px;
+    height: 70px;
+    }
+    
+image.toolbarimage
+    {
+    width: 41px;
+    height: 41px;
+    }
+
+text
+    {
+    color:"SKIN(268458534 13056 74)";
+    display: block;
+    visibility: visible;
+    position: static;
+    font-family: EAknLogicalFontSecondaryFont;
+    font-size: 3.5u;
+    text-align:center;
+    direction: ltr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/xuikon/50/MusicWidget.css	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,136 @@
+widget#MusicWidget
+    {
+    display: block;
+    visibility: visible;
+    width:312px;
+    height:75px;
+    padding-top: 4px;
+    padding-bottom: 3px;
+    padding-right: 4px;
+    margin-left: auto;
+    margin-right: auto;
+    block-progression: rl;
+    direction: rtl;
+    nav-index:appearance;
+    }
+    
+box#area1
+    {
+    display: block;
+    visibility: visible;
+    width: 70px;
+    height: 70px;
+    margin-left: 3px;
+    padding-top: 3px;
+    padding-bottom: 2px;
+    padding-left: 2px;
+    padding-right: 2px;
+    direction: ltr;
+    block-progression: tb;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#area2
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: auto; 
+    block-progression: tb;
+    nav-index:appearance;
+    }
+    
+box#textbox
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: 100%; 
+    height: 40%;
+    nav-index:appearance;
+    }
+
+box#toolbarbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 60%;
+    direction: ltr;
+    block-progression: rl;
+    nav-index:appearance;
+    }
+    
+box.toolbarbuttonbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 100%;
+    margin-left: 3px;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+    
+box#textbox2
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: auto; 
+    height: 100%; 
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#player_inactive
+{
+    display: block;
+
+}
+
+box#player_active
+{
+    display: none;
+}
+
+
+box:focus 
+    {
+    touchfeedbackdown: basic; 
+    touchfeedbackdrag: sensitive;
+    focus-background:"SKIN(268458534 9896)";
+    }
+
+
+image
+    {
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: auto;
+    margin-bottom: auto;
+    }
+image.area1_images
+    {
+    width: 70px;
+    height: 70px;
+    }
+    
+image.toolbarimage
+    {
+    width: 41px;
+    height: 41px;
+    }
+
+text
+    {
+    color:"SKIN(268458534 13056 74)";
+    display: block;
+    visibility: visible;
+    position: static;
+    font-family: EAknLogicalFontSecondaryFont;
+    font-size: 3.5u;
+    text-align:center;
+    direction: ltr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/xuikon/57/MusicWidget.css	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,136 @@
+widget#MusicWidget
+    {
+    display: block;
+    visibility: visible;
+    width:312px;
+    height:75px;
+    padding-top: 4px;
+    padding-bottom: 3px;
+    padding-right: 4px;
+    margin-left: auto;
+    margin-right: auto;
+    block-progression: rl;
+    direction: rtl;
+    nav-index:appearance;
+    }
+    
+box#area1
+    {
+    display: block;
+    visibility: visible;
+    width: 70px;
+    height: 70px;
+    margin-left: 3px;
+    padding-top: 3px;
+    padding-bottom: 2px;
+    padding-left: 2px;
+    padding-right: 2px;
+    direction: ltr;
+    block-progression: tb;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#area2
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: auto; 
+    block-progression: tb;
+    nav-index:appearance;
+    }
+    
+box#textbox
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: 100%; 
+    height: 40%;
+    nav-index:appearance;
+    }
+
+box#toolbarbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 60%;
+    direction: ltr;
+    block-progression: rl;
+    nav-index:appearance;
+    }
+    
+box.toolbarbuttonbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 100%;
+    margin-left: 3px;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+    
+box#textbox2
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: auto; 
+    height: 100%; 
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#player_inactive
+{
+    display: block;
+
+}
+
+box#player_active
+{
+    display: none;
+}
+
+
+box:focus 
+    {
+    touchfeedbackdown: basic; 
+    touchfeedbackdrag: sensitive;
+    focus-background:"SKIN(268458534 9896)";
+    }
+
+
+image
+    {
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: auto;
+    margin-bottom: auto;
+    }
+image.area1_images
+    {
+    width: 70px;
+    height: 70px;
+    }
+    
+image.toolbarimage
+    {
+    width: 41px;
+    height: 41px;
+    }
+
+text
+    {
+    color:"SKIN(268458534 13056 74)";
+    display: block;
+    visibility: visible;
+    position: static;
+    font-family: EAknLogicalFontSecondaryFont;
+    font-size: 3.5u;
+    text-align:center;
+    direction: ltr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/data/themes/default/install/musicwidget/xuikon/94/MusicWidget.css	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,136 @@
+widget#MusicWidget
+    {
+    display: block;
+    visibility: visible;
+    width:312px;
+    height:75px;
+    padding-top: 4px;
+    padding-bottom: 3px;
+    padding-right: 4px;
+    margin-left: auto;
+    margin-right: auto;
+    block-progression: rl;
+    direction: rtl;
+    nav-index:appearance;
+    }
+    
+box#area1
+    {
+    display: block;
+    visibility: visible;
+    width: 70px;
+    height: 70px;
+    margin-left: 3px;
+    padding-top: 3px;
+    padding-bottom: 2px;
+    padding-left: 2px;
+    padding-right: 2px;
+    direction: ltr;
+    block-progression: tb;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#area2
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: auto; 
+    block-progression: tb;
+    nav-index:appearance;
+    }
+    
+box#textbox
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: 100%; 
+    height: 40%;
+    nav-index:appearance;
+    }
+
+box#toolbarbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 60%;
+    direction: ltr;
+    block-progression: rl;
+    nav-index:appearance;
+    }
+    
+box.toolbarbuttonbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 100%;
+    margin-left: 3px;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+    
+box#textbox2
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: auto; 
+    height: 100%; 
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#player_inactive
+{
+    display: block;
+
+}
+
+box#player_active
+{
+    display: none;
+}
+
+
+box:focus 
+    {
+    touchfeedbackdown: basic; 
+    touchfeedbackdrag: sensitive;
+    focus-background:"SKIN(268458534 9896)";
+    }
+
+
+image
+    {
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: auto;
+    margin-bottom: auto;
+    }
+image.area1_images
+    {
+    width: 70px;
+    height: 70px;
+    }
+    
+image.toolbarimage
+    {
+    width: 41px;
+    height: 41px;
+    }
+
+text
+    {
+    color:"SKIN(268458534 13056 74)";
+    display: block;
+    visibility: visible;
+    position: static;
+    font-family: EAknLogicalFontSecondaryFont;
+    font-size: 3.5u;
+    text-align:center;
+    direction: ltr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/eabi/dummyMusicu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z7E32Mainv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for MusicHomeScreen.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/musichomescreen.loc APP_LAYER_LOC_EXPORT_PATH(musichomescreen.loc)
+
+../rom/musichomescreen.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musichomescreen.iby)
+../rom/musichomescreenrsc.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(musichomescreenrsc.iby)
+../rom/musicmatrixmenu.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musicmatrixmenu.iby)
+
+
+
+../data/suite.xml /epoc32/release/winscw/udeb/z/private/101F4CD2/import/suites/musicsuite/suite.xml
+../data/music_matrix_items.xml /epoc32/release/winscw/udeb/z/private/101F4CD2/import/suites/musicsuite/music_matrix_items.xml
+
+../data/suite.xml /epoc32/data/z/private/101F4CD2/import/suites/musicsuite/suite.xml
+../data/music_matrix_items.xml /epoc32/data/z/private/101F4CD2/import/suites/musicsuite/music_matrix_items.xml
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE musichomescreenicons.mif
+OPTION HEADERFILE musichomescreenicons.mbg
+OPTION SOURCEFILE iconlist.txt
+END
+
+#if defined(SBSV2) && defined(WINSCW)
+START EXTENSION general/copyheaderfile
+   SRCFILE musichomescreen.rsg
+END
+#endif
+
+PRJ_MMPFILES
+musicsuiteconf.mmp
+#ifndef SBSV2
+gnumakefile export_musicsuiteconf.mk
+#endif
+#include "../mpxcollectionpublisher/group/bld.inf"
+#include "../musiccontentpublisher/group/bld.inf"
+#include "../mcpmusicplayer/group/bld.inf"
+#include "../musicplayeractionhandlerplugin/group/bld.inf"
+#include "../data/themes/default/group/bld.inf"
+PRJ_TESTMMPFILES
+PRJ_TESTEXPORTS
+
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/group/export_musicsuiteconf.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  rsg export makefile for project
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+FINAL :
+	echo Exporting .rsg files...
+	copy \epoc32\include\musichomescreen.rsg $(ZDIR)\resource\apps\musichomescreen.rsg
+    
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES CLEAN BLD SAVESPACE :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,9 @@
+-c8,8 qgn_prop_image_tb_prev
+-c8,8 qgn_prop_image_tb_next
+-c8,8 qgn_prop_image_tb_pause
+-c8,8 qgn_prop_image_tb_play2
+-c8,8 qgn_prop_image_tb_prev_dimmed
+-c8,8 qgn_prop_image_tb_next_dimmed
+-c8,8 qgn_prop_image_tb_pause_dimmed
+-c8,8 qgn_prop_image_tb_play2_dimmed
+-c8,8 qgn_indi_mup_default_album
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/group/musichomescreenicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project MusicHomeScreen
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/musichomescreenicons.mif
+HEADERFILENAME=$(HEADERDIR)/musichomescreenicons.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/group/musicsuiteconf.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET          dummyMusic.dll
+TARGETTYPE      dll
+
+CAPABILITY      CAP_GENERAL_DLL
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+SOURCEPATH      ../src
+SOURCE          dummy.cpp
+
+SOURCEPATH      .
+USERINCLUDE     ../loc
+
+START RESOURCE  ../data/musichomescreen.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+
+LANGUAGE_IDS
+END
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/inc/cpglobals.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Global definitions
+ *
+*/
+
+
+#ifndef CPCLIENTGLOBALS_H
+#define CPCLIENTGLOBALS_H
+
+/** Data types for CP content */
+enum TDataTypes
+    {
+    ECPHardcodedText = 1, // 0001
+    ECPResourceText = 2, // 0010
+    ECPFilepathImage = 4, // 0100 
+    ECPResourceIcon = 8 // 1000
+    };
+
+enum TCPGetListOrder
+    {
+    ECPRecent = 1, // 0001
+    ECPPublisher = 2, // 0010
+    ECPContent = 4, // 0100 
+    ECPContentId = 8 // 1000 
+    };
+
+enum TFlag
+    {
+    EActivate = 1, // 0001
+    };
+    
+const TInt KNameArgumentsLimit = 5;
+
+_LIT( KService, "CP Service" );
+
+_LIT8( KCPInterface, "IDataSource" );
+_LIT8( KCPContentInterface, "IContentPublishing" );
+_LIT8( KCPService, "Service.ContentPublishing" );
+_LIT8( KCommand, "cmd" );
+
+//Supported Commands
+_LIT8( KGetList, "GetList" );
+_LIT8( KAdd, "Add" );
+_LIT8( KDelete, "Delete" );
+_LIT8( KRequestNotification, "RequestNotification" );
+_LIT8( KExecuteAction, "ExecuteAction" );
+_LIT8( KCmdCancel, "Cancel" );
+_LIT8( KActivate, "Activate" );
+_LIT8( KActivateTrigger, "activate" );
+_LIT8( KDeactivateTrigger, "deactivate" );
+
+// Input arguments
+_LIT8( KType, "type" );
+_LIT8( KAction, "action" );
+_LIT8( KItem, "item" );
+_LIT8( KFilter, "filter" );
+_LIT8( KData, "data" );
+_LIT8( KSortOrder, "sort_order" );
+_LIT8( KItemId, "item_id" );
+_LIT8( KByPublisher, "by_publisher" );
+_LIT8( KByEntryIds, "by_entryids" );
+_LIT8( KPublisherId, "publisher" );
+_LIT8( KContentType, "content_type" );
+_LIT8( KContentId, "content_id" );
+_LIT8( KExpirationDate, "expiration_date" );
+_LIT8( KActivatePublisher, "activate" );
+_LIT8( KIds, "ids" );
+_LIT8( KId, "id" );
+_LIT8( KFlag, "flag");
+_LIT8( KAccessList, "ACL" );
+_LIT8( KACLRead, "read");
+_LIT8( KACLWrite, "write");
+_LIT8( KACLDelete, "delete");
+_LIT8( KUIDs, "UID" );
+_LIT8( KCapability, "Capability" );
+_LIT( KAll, "all");
+_LIT( KSortPublisher, "publisher");
+_LIT( KSortContentType, "content_type");
+_LIT( KSortContentId, "content_id");
+_LIT( KSortRecent, "recent");
+_LIT( KOperationAdd, "add" );
+_LIT( KOperationUpdate, "update" );
+_LIT( KOperationDelete, "delete" );
+_LIT( KOperationExecute, "execute" );
+_LIT8( KDataType, "data_type" );
+_LIT8( KOperation, "operation" );
+_LIT8( KActionTrigger, "action_trigger" );
+_LIT8( KHardcodedText, "harcoded_text" );
+_LIT8( KResourceText, "resource_text" );
+_LIT8( KFilepathImage, "filepath_image" );
+_LIT8( KIdMask, "id_mask" );
+_LIT8( KResourceIcon, "resource_icon" );
+_LIT8( KIdIcon, "id_icon" );
+_LIT8( KIdText, "id_text" );
+_LIT( KCpData, "cp_data" );
+_LIT( KPublisher, "publisher" );
+_LIT8( KChangeInfo, "change_info" );
+
+_LIT8( KPublisher_Uid, "publisher_Uid" );
+
+// Argument in Action
+_LIT8( KActionHandlerInterface, "IDataAction" );
+_LIT8( KActionHandlerService, "Service.ActionHandler" );
+_LIT8( KCmdExecute, "Execute" );
+_LIT8( KPluginUid, "plugin_id" );
+_LIT8( KDataForActionHandler, "data" );
+
+_LIT8( KLaunchMethod, "launch_method" );
+_LIT8( KApplicationUid, "application_uid" );
+_LIT8( KDocumentName, "document_name" );
+_LIT8( KViewId, "view_id" );
+_LIT8( KMessageUid, "message_uid" );
+
+// Output
+_LIT8( KResults, "results" );
+_LIT8( KListMap, "list_map" );
+_LIT8( KStatus, "status" );
+_LIT8( KDataMap, "data_map" );
+_LIT8( KActionMap, "action_map" );
+_LIT8( KKey, "key" );
+
+_LIT8( KTransactionID, "TransactionID" );
+
+#endif /*CPCLIENTGLOBALS_H*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/inc/mpxresource.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class provide API to read resource from resource file
+*
+*/
+
+
+#ifndef CMPXRESOURCE_H
+#define CMPXRESOURCE_H
+
+//INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <barsc.h>
+
+// CLASS DECLARATION
+
+/**
+*  Resource class
+*  Singleton for one thread
+*/
+class CMPXResource : public CBase
+    {
+    public: // Factory and Release
+
+        /**
+        * Factory function, create the object.
+        * Note that calls to this must be matched with a call to Release().
+        *
+        * @param aResourceFile the resource file
+        *        In order to support installation of individual plugin.
+        *        aResourceFile must be a final name, including full file path.
+        *        All parse should be done in the plugin side.
+        *
+        * @return the resource object pointer
+        */
+        static CMPXResource* NewL(const TDesC& aResourceFile);
+
+        /**
+        * Factory function, create the object.
+        * Note that calls to this must be matched with a call to Release().
+        * @param aResourceFile the resource file
+        *        In order to support installation of individual plugin.
+        *        aResourceFile must be a final name, including full file path.
+        *        All parse should be done in the plugin side.
+        *
+        * @return the resource object pointer
+        */
+        static CMPXResource* NewLC(const TDesC& aResourceFile);
+
+        /**
+        * Decrements the reference count, and delete the object if it is 0
+        */
+        IMPORT_C void Release();
+
+    public: // New functions
+
+        /**
+        * Read array of descriptors
+        * @param aResourceId resource id
+        * @return array of descriptors. Ownership is abandoned.
+        */
+        CDesCArrayFlat* ReadDesCArrayL(TInt aResourceId);
+
+        /**
+        * Read array of descriptors
+        * @param aResourceId resource id
+        * @return array of descriptors. Ownership is abandoned.
+        */
+        CDesCArrayFlat* ReadDesCArrayLC(TInt aResourceId);
+
+        /**
+        * Get a heap descriptor from the resource file
+        * @param aResourceId resource id
+        * @return pointer to the heap descriptor.  Ownership is abandoned.
+        */
+        HBufC* ReadHBufCL(TInt aResourceId);
+
+        /**
+        * Read array of menu items
+        * @param aResourceId resource id
+        * @param aIdArray array of Id within the specified resource
+        * @return array of descriptors
+        */
+        CDesCArrayFlat* ReadMenuArrayL(TInt aResourceId, RArray<TInt>& aIdArray);
+
+        /**
+        * Read array of menu items
+        * @param aResourceId resource id
+        * @param aIdArray array of Id within the specified resource
+        * @return array of descriptors
+        */
+        CDesCArrayFlat* ReadMenuArrayLC(TInt aResourceId, RArray<TInt>& aIdArray);
+
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CMPXResource();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL(const TDesC& aResourceFile);
+
+        /**
+        * Don't allow users to delete this object
+        * Release has to be called
+        */
+        virtual ~CMPXResource();
+
+
+    private: // Data
+        // Member variables
+        RFs               iFs;
+        RResourceFile     iResourceFile;
+    };
+
+#endif // CMPXRESOURCE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/loc/musichomescreen.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project MusicHomeScreen
+*
+*/
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+// LOCALISATION STRINGS
+CHARACTER_SET UTF8
+
+// d: Title of the Music suite in the matrix menu main screen
+// l: title_pane_t2/opt9
+// r: S60 v5.1
+//
+#define qtn_vmp_title_suite "Music"
+
+// d: The title for the most recently played track or song
+// d: this is when the music player is in stopped state 
+// l: list_logical_template_3_title
+// r: S60 v5.1
+//
+#define qtn_vmp_title_last_played "Last Played"	
+
+// d: The title for the currently playing track or song 
+// d: this is when the music player is in playing state
+// l: list_logical_template_3_title
+// r: S60 v5.1
+//
+#define qtn_vmp_title_now_playing "Now Playing"
+
+// d: The detail when music player was never launched
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_music_no_music "No Music Played"
+
+// d: The music the user has in his terminal
+// l: list_logical_template_3_title
+// r: S60 v5.1
+//
+#define qtn_vmp_title_my_music "My Music"
+
+// d: The text indicating that the user has only ONE song in his terminal
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_my_music_1_song "1 Song"
+
+// d: The text indicating that the number of songs the
+// d: user has in his terminal
+// d: %N is total number of songs in My Music
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_my_music_n_songs "%N Songs"
+
+// d: The text indicating that the user has NO songs in his terminal
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_my_music_no_songs	"No Songs"
+
+// d: The name of the Nokia music store web service
+// l: list_logical_template_3_title
+// r: S60 v5.1
+//
+#define qtn_vmp_title_nokia_music_store	"Nokia Music Store"
+
+// d: The description ad for the Nokia music store
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_nokia_store_ad "Explore millions of songs and download music"
+
+// d: The name for the radio application
+// l: list_logical_template_3_title
+// r: S60 v5.1
+//
+#define qtn_vmp_title_fm_radio "FM Radio"
+
+// d: The Ad for the Radio application
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_fm_radio_ad "Radio with RDS"
+
+// d: The Text to be displayed when the device intially
+// d: powers up or when the user returns to the homescreen
+// d: and has not played any Music or Podcast 
+// r: S60 v5.1
+//
+#define qtn_vmp_music_widget_go_to_music "Go To Music"
+
+// d: The Text to be displayed when we are about to open a
+// d: a song, the purpose is to inform the user that an 
+// d: operation is ongoing.
+// r: S60 v5.1
+//
+#define qtn_vmp_music_widget_opening "Opening ..."
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/data/mcpmusicplayer.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM registration for Music Player MCP Plugin
+*
+*/
+
+
+#include <registryinfo.rh>
+#include <mcppluginuids.hrh>
+#include "mcpmusicplayeruids.hrh"
+
+// ---------------------------------------------------------------------------
+// MCPMusicPlayerInfo
+// Declares info for implementation of the plugin
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// UID for the DLL
+	dll_uid = KMCPMusicPlayerDLL;
+	// Declare array of interface info
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// UID of interface that is implemented
+			interface_uid = KMCPPluginUid;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KMCPMusicPlayerUID; 
+					version_no = 1;
+					display_name = "";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for MP MCP Plugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/mcpmusicplayer.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(mcpmusicplayer.iby)
+
+PRJ_MMPFILES
+mcpmusicplayer.mmp
+
+PRJ_TESTMMPFILES
+PRJ_TESTEXPORTS
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/group/mcpmusicplayer.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for MusicPlayer MCP Plugin
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include "../inc/mcpmusicplayeruids.hrh"
+
+TARGET                  mcpmusicplayer.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D KMCPMusicPlayerDLL
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  mcpmusicplayer.cpp
+SOURCE                  proxy.cpp
+SOURCE                  aiplayerpluginengine.cpp
+SOURCE                  filemonitor.cpp
+SOURCE                  applicationmonitor.cpp
+SOURCE                  pnsmonitor.cpp
+ 
+USERINCLUDE             ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+USERINCLUDE             ../../inc
+
+SOURCEPATH              ../data
+START RESOURCE          mcpmusicplayer.rss 
+HEADER
+TARGET                  mcpmusicplayer.rsc
+TARGETPATH              resource/plugins 
+END
+
+LIBRARY                 euser.lib
+LIBRARY                 liwservicehandler.lib
+LIBRARY                 mpxplaybackutility.lib
+LIBRARY                 mpxcommon.lib           // mpxparameter
+LIBRARY                 efsrv.lib               // TParse
+LIBRARY                 commonengine.lib        // stringloader
+LIBRARY                 avkon.lib
+LIBRARY                 ws32.lib                // RWsSession
+LIBRARY                 apgrfx.lib              // TApaTask 
+LIBRARY                 bafl.lib                // FileExists()
+LIBRARY                 mpxcommonui.lib         // CMPXAlbumArtUtil
+LIBRARY                 fbscli.lib
+LIBRARY                 aknskins.lib
+LIBRARY                 aknicon.lib
+LIBRARY                 mpxcollectionutility.lib
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/inc/aiplayerpluginengine.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Engine which interfaces to MPX framework.
+*
+*/
+
+
+#ifndef C_AIPLAYERPLUGINENGINE_H
+#define C_AIPLAYERPLUGINENGINE_H
+
+#include <e32base.h>
+#include <mpxplaybackobserver.h>
+#include <mpxalbumartutilobserver.h>
+#include "aiplayerpluginengineobserver.h"
+
+class MMPXPlaybackUtility;
+class CMPXAlbumArtUtil;
+
+
+/**
+ *  Music Player Player Plugin Engine.
+ *  This class provides interface to MPX framework.
+ *
+ *  @lib aiplayerplugin2.lib
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CAiPlayerPluginEngine ) : public CBase,
+                                             public MMPXPlaybackObserver,
+                                             public MMPXPlaybackCallback,
+                                             public MMPXAlbumArtUtilObserver
+    {
+public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CAiPlayerPluginEngine* NewL( MAiPlayerPluginEngineObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAiPlayerPluginEngine();
+
+    /**
+     * From MMPXPlaybackObserver
+     * See mpxplaybackobserver.h for detailed description.
+     * @since S60 5.0
+     */
+    void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+    /**
+     * From MMPXPlaybackCallback
+     * See mpxplaybackobserver.h for detailed description.
+     * @since S60 5.0
+     */
+    void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError );
+    void HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, TBool aComplete, TInt aError );
+    void HandleMediaL( const CMPXMedia& aMedia, TInt aError );
+    void HandlePlaybackCommandComplete( CMPXCommand* aCommandResult, TInt aError );
+
+    /**
+     * From MMPXAlbumArtUtilObserver
+     * See mpxalbumartutilobserver.h for detailed description
+     * @since S60 3.2.3
+     */
+    void ExtractAlbumArtStarted();
+    void ExtractAlbumArtCompleted( CFbsBitmap* aBitmap, TInt aErr );
+public:
+
+    /**
+     * Get the current state of the active player.
+     *
+     * @return Active player state
+     * @see TMPlayerState
+     */
+    TMPlayerState PlayerState();
+
+    /**
+     * Get the title of the currently playing song.
+     *
+     * @return Song title
+     */
+    const TDesC& TitleL();
+
+    /**
+     * Get the artist of the currently playing song.
+     *
+     * @return Artist
+     */
+    const TDesC& Artist();
+    
+    /**
+     * Get the uri of the currently playing song.
+     *
+     * @return Uri
+     */
+    const TDesC& Uri();
+
+    /**
+     * Get the current position.
+     *
+     * @return Current position.
+     */
+    TInt Position();
+
+    /**
+     * Get the duration of the currently playing song.
+     *
+     * @return Song duration.
+     */
+    TInt Duration();
+
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CAiPlayerPluginEngine( MAiPlayerPluginEngineObserver& aObserver );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     *  Handle playback message
+     *
+     *  @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+    /**
+     *  Handle playback property
+     *
+     *  @param aProperty the property
+     *  @param aValue the value of the property
+     *  @param aError error code
+     */
+    void DoHandlePropertyL( TInt aProperty, TInt aValue, TInt aError );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     */
+    void DoHandleStateChangedL( TMPXPlaybackState aState );
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    void HandleErrorL( TInt aError );
+
+    /**
+     *  Map states from TMPXPlaybackState to TMPlayerState
+     *
+     *  @param aState State in TMPXPlaybackState format
+     *  @return State in TMPlayerState format, or KErrNotFound
+     *          if the state can't be mapped
+     */
+    TMPlayerState MapState( TMPXPlaybackState aState );
+
+   /**
+     *  Request media.
+     */
+    void RequestMediaL();
+private:    // Data
+
+    MAiPlayerPluginEngineObserver* 	iObserver; 			// Not owned
+    MMPXPlaybackUtility*            iPlaybackUtility;   // Owned    
+    CMPXAlbumArtUtil* iAlbumArtUtil;  // own
+    HBufC*		iTitle;  // own
+    HBufC*      iArtist;  // own
+    HBufC*      iUri;  // own
+    CMPXMedia*  iMedia;  // own
+    TInt		iPosition;
+    TInt		iDuration;
+    TBool       iExtractingAlbumArt;
+    TBool       iSkipping;
+    
+    
+    };
+
+#endif  // C_CAiPlayerPluginEngine_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/inc/aiplayerpluginengineobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player stautus observer
+*
+*/
+
+
+#ifndef M_AIPLAYERPLUGINENGINEOBSERVER_H
+#define M_AIPLAYERPLUGINENGINEOBSERVER_H
+
+#include <e32std.h>
+
+
+/**
+ *  Player state.
+ */
+enum TMPlayerState
+    {
+    EMPlayerStatePlaying,
+    EMPlayerStatePaused,
+    EMPlayerStateSeeking,
+    EMPlayerStateOther,
+    EMPlayerStateStarting,
+    EMPlayerStateStopped
+    };
+
+class CFbsBitmap;
+
+/**
+ *  Observer interface to be implemented by a client of AiPlayerPluginEngine.
+ *
+ *  @lib aiplayerplugin2.lib
+ *  @since S60 5.0
+ */
+class MAiPlayerPluginEngineObserver
+    {
+public:
+
+    /**
+     * Called when active player instance's state changes
+     *
+     * @since S60 5.0
+     * @param aState Active player state
+     * @see TMPlayerState
+     */
+    virtual void PlayerStateChanged( TMPlayerState aState ) = 0;
+
+    /**
+     * Called when track info changes (i.e. track changes or current track's
+     * info is updated) in the active player instance.
+     *
+     * @since S60 5.0
+     * @param aTitle Current track's title.
+     * @param aArtist Current track's artist.
+     */
+    virtual void TrackInfoChanged( const TDesC& aTitle, 
+            const TDesC& aArtist ) = 0;
+
+    /**
+     * Called each second during playback.
+     *
+     * @since S60 5.0
+     * @param aPosition Current playback position in seconds.
+     */
+    virtual void PlaybackPositionChanged( TInt aPosition ) = 0;
+
+    /**
+     * Called when album art is ready or when there is no album art.
+     *
+     * @since S60 5.0
+     * @param aBitmap the new album art.
+     */
+    virtual void AlbumArtChanged( CFbsBitmap* aBitmap ) = 0;
+    
+    /**
+     * Called When there is an ongoing operation.
+     *
+     * @since S60 5.0
+     */
+    virtual void Opening() = 0;
+    
+    /**
+     * Called when to indicate that the playlist changed and it is empty.
+     *
+     * @since S60 5.0
+     * @param aBitmap the new album art.
+     */
+    virtual void PlaylisIsEmpty() = 0;
+
+    };
+
+
+#endif // ?M_AIPLAYERPLUGINENGINEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/inc/applicationmonitor.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors an application for exit event.
+*
+*/
+
+
+#ifndef C_APPLICATIONMONITOR_H
+#define C_APPLICATIONMONITOR_H
+
+#include <e32base.h>
+
+class MApplicationMonitorObserver;
+class RThread;
+
+/**
+ *  Application monitor class
+ *
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CApplicationMonitor ) : public CActive
+    {
+
+public:
+
+    /**
+    * Two-phased constructor
+    */
+    static CApplicationMonitor* NewL( MApplicationMonitorObserver& aObserver);
+
+    /**
+    * Virtual destructor
+    */
+    virtual ~CApplicationMonitor();
+
+    /**
+    * Start monitoring a particular Application
+    * @param aApplication to monitor
+    * @param aRootAppIndication ETrue for RootApp and EFalse EmbeddedApp
+    */
+    void StartL(  TUid aAppUid , TBool aRootAppIndication = ETrue);
+   
+protected:
+        
+    /**
+    * From CActive
+    */
+    void RunL();
+    
+    /**
+    * From CActive
+    */
+    void DoCancel();
+
+    /**
+    *  From CActive
+    */
+    TInt RunError(TInt aError);    
+            
+private:
+    
+    /**
+    * Private constructor
+    */
+    CApplicationMonitor( MApplicationMonitorObserver& aObserver);
+
+    /**
+    * 2nd phased constructor
+    */
+    void ConstructL();
+
+private: // data
+    MApplicationMonitorObserver&  iObserver;
+    RThread iThread; 
+    };
+
+#endif // C_APPLICATIONMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/inc/applicationmonitorobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Observer class to the Application monitor
+*
+*/
+
+
+#ifndef M_APPLICATIONMONITOROBSERVER_H
+#define M_APPLICATIONMONITOROBSERVER_H
+
+#include <e32std.h>
+
+/** 
+*   Interface class to monitor an application exit.
+*/
+class MApplicationMonitorObserver
+    {
+public:
+    /**
+     * Handle an application close event.
+     */
+    virtual void HandleApplicationClosedL(TExitType aReason) = 0;
+    };
+
+#endif // M_APPLICATIONMONITOROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/inc/filemonitor.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors the file system for changes in a file.
+*
+*/
+
+
+#ifndef C_FILEMONITOR_H
+#define C_FILEMONITOR_H
+
+#include <e32base.h>
+#include <f32file.h>//??? remove???
+
+class MFileMonitorObserver;
+
+/**
+ *  File monitor class
+ *
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CFileMonitor ) : public CActive
+    {
+
+public:
+
+    /**
+    * Two-phased constructor
+    */
+    static CFileMonitor* NewL( MFileMonitorObserver& aObserver);
+
+    /**
+    * Virtual destructor
+    */
+    virtual ~CFileMonitor();
+
+    /**
+    * Start monitoring a particular file
+    * @param aFile file to monitor
+    */
+    void StartL( const TDesC& aFile );
+   
+protected:
+        
+    /**
+    * From CActive
+    */
+    void RunL();
+    
+    /**
+    * From CActive
+    */
+    void DoCancel();
+
+    /**
+    *  From CActive
+    */
+    TInt RunError(TInt aError);    
+            
+private:
+    
+    /**
+    * Private constructor
+    */
+    CFileMonitor( MFileMonitorObserver& aObserver);
+
+    /**
+    * 2nd phased constructor
+    */
+    void ConstructL();
+
+private: // data
+    MFileMonitorObserver&  iObserver;
+    RFs iFs; 
+    HBufC* iFilePath;
+    };
+
+#endif // C_FILEMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/inc/filemonitorobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Observer class to the file monitor
+*
+*/
+
+
+#ifndef M_FILEMONITOROBSERVER_H
+#define M_FILEMONITOROBSERVER_H
+
+
+/** 
+*   Interface class to monitor to get callbacks to folder changes
+*/
+class MFileMonitorObserver
+    {
+public:
+    /**
+     * Handle a file system change notification
+     *
+     */
+    virtual void HandleFileRemovedL() = 0;
+    };
+
+#endif // M_FILEMONITOROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/inc/mcpmusicplayer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,388 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Updates Music Content Plublisher
+*
+*/
+
+
+#ifndef C_MCPMUSICPLAYER_H
+#define C_MCPMUSICPLAYER_H 
+
+#include <mpxplaybackcommanddefs.h> //for TMPXPlaybackCommand
+#include <e32std.h> // for TExitType
+#include <mcpplugin.h>
+#include <mcppluginobserver.h>
+#include <mpxcollectionobserver.h>
+#include "aiplayerpluginengineobserver.h"
+#include "filemonitorobserver.h"
+#include "applicationmonitorobserver.h"
+#include "pnsmonitorobserver.h"
+
+class MLiwInterface;
+class CLiwGenericParamList;
+class CAiPlayerPluginEngine;
+class CFileMonitor;
+class CApplicationMonitor;
+class CPNSMonitor;
+class RResourceFile;
+class MMPXCollectionUtility;
+
+/**
+ *  Music Player MCP plugin.
+ *  CMCPMusicPlayer implements CMCPPlugin
+ *
+ *  @since S60 S60 v5.0
+ */
+class CMCPMusicPlayer : public CMCPPlugin,
+                                public MAiPlayerPluginEngineObserver,
+                                public MFileMonitorObserver,
+                                public MApplicationMonitorObserver,
+                                public MMPXCollectionObserver,
+                                public MPNSMonitorObserver
+    {
+public:
+    /**
+     * Standard Symbian 2 phase constructor
+     */
+    static CMCPMusicPlayer* NewL(
+            MMCPPluginObserver* aObserver);
+
+    /**
+     * Standard C++ destructor.
+     */
+    virtual ~CMCPMusicPlayer();
+
+ // from base class CMCPPlugin
+
+    /**
+     * From CMCPPlugin
+     * @since S60 5.0
+     */
+    void Deactivate();
+    
+    /**
+     * From CMCPPlugin
+     * @since S60 5.0
+     */
+    void SkinChanged();
+        
+
+// from base class MAiPlayerPluginEngineObserver
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void PlayerStateChanged(TMPlayerState aState);
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void TrackInfoChanged(const TDesC& aTitle, const TDesC& aArtist);
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void PlaybackPositionChanged(TInt aPosition);
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void AlbumArtChanged( CFbsBitmap* aBitmap );
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void Opening();
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void PlaylisIsEmpty();
+    
+// from base class MFileMonitorObserver
+    /**
+     * from MFileMonitorObserver
+     * Handle a file system change notification
+     *
+     */
+    void HandleFileRemovedL();
+       
+// from base class MApplicationMonitorObserver
+    /**
+     * from MApplicationMonitorObserver
+     * Handle an application close event.
+     */
+    void HandleApplicationClosedL(TExitType aReason);
+    
+//from base class MMPXCollectionObserver  
+    /** 
+     *  Handle collection message
+     * 
+     *  @param aMsg collection message, ownership not transferred. 
+     *         Please check aMsg is not NULL before using it. 
+     *         If aErr is not KErrNone, plugin might still call back with more
+     *         info in the aMsg.
+     *  @param aErr system error code.
+     */
+    void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
+
+    /**
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d a folder.
+     *
+     *  @since S60 3.2.3
+     *  @param aEntries collection entries opened
+     *  @param aIndex focused entry
+     *  @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     *  @param aError error code   
+     */
+    void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, TBool aComplete,
+            TInt aError );
+
+    /**
+     *  Handles the item being opened. Typically called
+     *  when client has Open()'d an item. Client typically responds by
+     *  'playing' the item via the playlist.
+     *
+     *  @since S60 3.2.3
+     *  @param aPlaylist collection playlist
+     *  @param aError error code
+     */
+    void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError );
+
+    /**
+     * From MMPXCollectionMediaObserver 
+     * It handles MediaL event.
+     *
+     * @param aMedia object containing collection's informations
+     * @param aError error code
+     */
+    void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
+
+    /**
+     * from MPNSMonitorObserver
+     * Handle launching music player on the background.
+     */
+    void OpeningMusicPlayer();
+
+private:
+
+    /**
+     * Standard C++ constructor.
+     */
+    CMCPMusicPlayer( MMCPPluginObserver* aObserver );
+
+    /**
+     * Standard Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * returns ETrue if data can be propagated to the Music Content Publisher.
+     */
+    TBool IsOKToPublishData();
+     
+    /**
+     * Installs Playback command action, the puppose of this is to improve
+     * readability.
+     */
+    void InstallPlaybackCommandActionL( TMPXPlaybackCommand aCmd,
+            TMCPTriggerDestination aDestination );
+    /**
+     * Installs Launch Music Player action, the puppose of this is to improve
+     * readability.
+     */
+    void InstallLaunchMusicPlayerL( TMCPTriggerDestination aDestination );
+    
+    /**
+     * Installs Go To Now playing action, the puppose of this is to improve
+     * readability.
+     */
+    void InstallGoToNowPlayingL( TMCPTriggerDestination aDestination );
+        
+    /**
+     * Installs Go To Last Played action, the puppose of this is to improve
+     * readability.
+     */
+    void InstallGoToLastPlayedL( TMCPTriggerDestination aDestination, 
+             TBool aMinimized );
+    
+    /**
+     * Installs an action, mainly for readability purposes.
+     *
+     * @since S60 5.0
+     * @param aDestination Destination trigger that should launch the action.
+     */
+    void InstallGoToMusicL(TMCPTriggerDestination aDestination);
+    
+    /**
+     * Installs an empty action, mainly for readability purposes.
+     *
+     * @since S60 5.0
+     * @param aDestination Destination trigger that should launch the action.
+     */
+    void InstallEmptyActionL(TMCPTriggerDestination aDestination);
+    
+    /**
+     * Installs actions and icons in the toolbar.
+     *
+     * @since S60 5.0
+     */
+    void UpdateToolBarL(TUint aToolBarState);
+    
+    /**
+     * Resets the widget an Music Suite.
+     *
+     * @since S60 5.0
+     */
+    void ResetL();
+
+    /**
+     * Get a heap descriptor from the resource file
+     *
+     * @since S60 5.0
+     */
+    void GetLocalizedStringL(RResourceFile& aResourceFile, HBufC*& aRetBuf,
+            TInt aResourceId);
+    
+    
+    /**
+     * @since S60 5.0
+     */
+    void ActivateL();
+    void DoUpdatePlayerStateL(TMPlayerState aState);
+    void DoUpdateTrackInfoL(const TDesC& aTitle, const TDesC& aArtist);
+    void DoUpdatePlaybackPositionL(TInt aPosition);
+    void DoUpdateAlbumArtL( CFbsBitmap* aBitmap );
+    void DoHandleOpeningL();
+    void DoHandlePlaylisIsEmptyL();
+    void DoHandleSkinChangedL();
+    
+    /**
+     * Logic of HandleCollectionMessageL, to avoid the function leaves
+     * 
+     * @param aMsg collection message
+     */
+    void HandleCollectionMessageL( CMPXMessage* aMsg );
+
+    /**
+     * Logic of HandleCollectionMessage, to avoid the function leaves
+     * 
+     * @param aMsg collection message
+     */
+    void DoHandleGeneralMessageL( const CMPXMessage& aMsg );
+       
+    /**
+    *  Music Player opening timer callback
+    *
+    *  @param aPtr pointer the this
+    */
+    static TInt MusicPlayerOpeningTimerCallback( TAny* aPtr );
+
+private: // data
+
+    /**
+     * Instance of MCP plugin observer
+     * Not owned.
+     */
+    MMCPPluginObserver* iMHObserver;
+    
+    /**
+     * Instance of CAiPlayerPluginEngine used to observe Music player via 
+     * MAiPlayerPluginEngineObserver.
+     * Owned.
+     */
+    CAiPlayerPluginEngine* iEngine;
+    
+    /**
+     * State indicator, the plugin can be active or inactive. 
+     */
+    TBool iActive;
+    
+    /**
+     * art cached indicator. 
+     */
+    TBool iArtCached;
+    
+    /**
+     * Used to monitor last played song. 
+     */
+    CFileMonitor* iFileMonitor;
+
+    /**
+     * Used to monitor if music player closes. 
+     */
+    CApplicationMonitor* iAppMonitor;
+    
+    /**
+     * Used to monitor publish and subscribe property. 
+     */
+    CPNSMonitor* iPNSMonitor;
+
+    /**
+     * Current Album Art. 
+     */
+    CFbsBitmap* iArtBitmap;
+    
+    /**
+     * The art that was extracted but not used due to the current stateof
+     * the plugin (acctive, not active) 
+     */
+    CFbsBitmap* iCachedArtBitmap;
+    
+    /**
+     * Album Art mask. 
+     */
+    CFbsBitmap* iArtBitmapMask;
+    
+    /**
+     * Current Toolbar State.
+     */  
+    TUint iToolBarState;
+    
+    /**
+    * Buffers for the localized strings
+    */
+    HBufC* iGoToMusicBuffer;
+    HBufC* iOpeningBuffer;
+    
+    /**
+     * Flag of Mass Storage mode or MTP mode
+     */
+    TBool iUSBOnGoing;
+   
+    /**
+     * collection utility
+     */
+    MMPXCollectionUtility* iCollectionUtility;
+
+    CPeriodic* iMusicPlayerOpeningTimer;
+    };
+
+#endif // C_MCPMUSICPLAYER_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/inc/mcpmusicplayeruids.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for Music Player MCPPlugin
+*
+*/
+
+
+#ifndef MCPMUSICPLAYERUIDS_H_
+#define MCPMUSICPLAYERUIDS_H_
+
+/** Ecom implementation uid for Music Player Action Handler Plugin */
+#define KMCPMusicPlayerUID 0x10207C14
+
+/** Ecom dll uid for Music Player Action Handler Plugin */
+#define KMCPMusicPlayerDLL 0x10207C15
+
+#endif /*MCPMUSICPLAYERUIDS_H_*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/inc/pnsmonitor.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors for publish and subscribe property.
+*
+*/
+
+
+#ifndef C_PNSMONITOR_H
+#define C_PNSMONITOR_H
+
+#include <e32base.h>
+
+class MPNSMonitorObserver;
+
+/**
+ *  publish and subscribe monitor class
+ *
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CPNSMonitor ) : public CActive
+    {
+
+public:
+
+    /**
+    * Two-phased constructor
+    */
+    static CPNSMonitor* NewL( MPNSMonitorObserver& aObserver );
+
+    /**
+    * Virtual destructor
+    */
+    virtual ~CPNSMonitor();
+
+    /**
+    * Start monitoring a particular publish and subscribe property
+    */
+    void Start();
+   
+protected:
+        
+    /**
+    * From CActive
+    */
+    void RunL();
+    
+    /**
+    * From CActive
+    */
+    void DoCancel();
+
+    /**
+    *  From CActive
+    */
+    TInt RunError( TInt aError );    
+            
+private:
+    
+    /**
+    * Private constructor
+    */
+    CPNSMonitor( MPNSMonitorObserver& aObserver );
+
+    /**
+    * 2nd phased constructor
+    */
+    void ConstructL();
+
+private: // data
+    MPNSMonitorObserver& iObserver;
+    RProperty iPropertyHandler;
+    };
+
+#endif // C_PNSMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/inc/pnsmonitorobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface class to monitor publish and subscribe property.
+*
+*/
+
+
+#ifndef M_PNSMONITOROBSERVER_H
+#define M_PNSMONITOROBSERVER_H
+
+/** 
+*   Interface class to monitor publish and subscribe property.
+*/
+class MPNSMonitorObserver
+    {
+public:
+
+    /**
+     * Called when launching music player on the background
+     * (when selecting play from the widget and music player is closed)
+     *
+     * @since S60 5.0
+     */
+    virtual void OpeningMusicPlayer() = 0;
+    };
+
+
+#endif // M_PNSMONITOROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/rom/mcpmusicplayer.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Player MCP Plugin
+*
+*/
+
+
+#ifndef MCPMUSICPLAYER_IBY
+#define MCPMUSICPLAYER_IBY
+
+ECOM_PLUGIN(mcpmusicplayer.dll, mcpmusicplayer.rss)
+
+#endif // MCPMUSICPLAYER_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/src/aiplayerpluginengine.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,544 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player stautus observer
+*
+*/
+
+
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxmedia.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessagedefs.h>
+#include <mpxalbumartutil.h>
+#include <mpxlog.h>
+
+#include "aiplayerpluginengine.h"
+
+const TInt KMPXOneSecInMilliSecs( 1000 );
+const TUid  KMusicPlayerAppUid = { 0x102072C3 };
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::ConstructL()
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::ConstructL");
+    // Get the playback utility instance from engine.
+    //iPlaybackUtility = MMPXPlaybackUtility::NewL( KPbModeActivePlayer, this );
+    iPlaybackUtility = MMPXPlaybackUtility::NewL( KMusicPlayerAppUid, this );
+    iAlbumArtUtil = CMPXAlbumArtUtil::NewL();
+    if (iPlaybackUtility->StateL() == EPbStatePlaying)
+        {
+    	  RequestMediaL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::NewL
+// ---------------------------------------------------------------------------
+//
+CAiPlayerPluginEngine* CAiPlayerPluginEngine::NewL( 
+        MAiPlayerPluginEngineObserver& aObserver )
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::NewL");
+    CAiPlayerPluginEngine* self = new ( ELeave ) 
+            CAiPlayerPluginEngine( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::CAiPlayerPluginEngine
+// ---------------------------------------------------------------------------
+//
+CAiPlayerPluginEngine::CAiPlayerPluginEngine( 
+        MAiPlayerPluginEngineObserver& aObserver )
+    : iObserver( &aObserver ),
+      iPlaybackUtility( NULL ),
+      iTitle( NULL ),
+      iArtist( NULL ),
+      iUri( NULL ),
+      iMedia( NULL ),
+      iPosition( KErrNotFound ),
+      iDuration( KErrNotFound ),
+      iExtractingAlbumArt( EFalse ),
+      iSkipping( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::~CAiPlayerPluginEngine
+// ---------------------------------------------------------------------------
+//
+CAiPlayerPluginEngine::~CAiPlayerPluginEngine()
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::~CAiPlayerPluginEngine");
+    if ( iPlaybackUtility )
+        {
+        iPlaybackUtility->Close();
+        }
+    delete iMedia;
+    delete iAlbumArtUtil;
+    delete iTitle;
+    delete iArtist;
+    delete iUri;
+        
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandlePlaybackMessage( CMPXMessage* aMessage, 
+        TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandlePropertyL( TMPXPlaybackProperty aProperty, 
+        TInt aValue, TInt aError )
+    {
+    DoHandlePropertyL( aProperty, aValue, aError );
+    }
+
+// ---------------------------------------------------------------------------
+// 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 CAiPlayerPluginEngine::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandleMediaL( const CMPXMedia& aMedia, 
+        TInt aError )
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::HandleMediaL");
+    if ( KErrNone == aError )
+        {
+        delete iUri;
+        iUri = NULL;
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            TParsePtrC filePath(aMedia.ValueText(KMPXMediaGeneralUri) );
+            iUri = filePath.FullName().AllocL();
+            }
+        
+		delete iTitle;
+		iTitle = NULL;
+        if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) )
+            {
+            iTitle = ( aMedia.ValueText( KMPXMediaGeneralTitle ) ).AllocL();
+            }
+        else if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
+            {
+            TParsePtrC filePath( aMedia.ValueText( KMPXMediaGeneralUri ) );
+            iTitle = (filePath.Name()).AllocL();
+            }
+		delete iArtist;
+		iArtist = NULL;
+		iArtist = ( aMedia.ValueText( KMPXMediaMusicArtist ) ).AllocL();
+		
+		iObserver->TrackInfoChanged( *iTitle, *iArtist );
+        
+		if (!iSkipping)
+            {
+            if (iExtractingAlbumArt)
+                {
+                iAlbumArtUtil->CancelRequest();
+                iExtractingAlbumArt=EFalse;
+                }
+            
+            if ( aMedia.IsSupported( KMPXMediaMusicAlbumArtFileName ) )
+                {
+                delete iMedia;
+                iMedia=NULL;
+                iMedia = CMPXMedia::NewL( aMedia );
+                TRAPD(err,iAlbumArtUtil->ExtractAlbumArtL(
+                        *iMedia,
+                        *this,
+                        TSize(70,70)));
+                
+                if (err != KErrNone)
+                    {
+                    iObserver->AlbumArtChanged(NULL);
+                    }
+                }
+            else
+                {
+                iObserver->AlbumArtChanged(NULL);
+                }
+
+            }
+		else
+		    {
+		    iObserver->AlbumArtChanged(NULL);
+		    }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle completion of a asynchronous command
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandlePlaybackCommandComplete( 
+        CMPXCommand* /*aCommandResult*/, TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXAlbumArtUtilObserver
+// Notify that extraction of album art started.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::ExtractAlbumArtStarted()
+    {
+    iExtractingAlbumArt = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXAlbumArtUtilObserver
+// Notify that the extraction of album art has completed.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::ExtractAlbumArtCompleted( 
+        CFbsBitmap* aBitmap, 
+        TInt aErr )
+    {
+    if (aErr == KErrNone)
+        {
+        iObserver->AlbumArtChanged(aBitmap);
+        }
+    else
+        {
+        iObserver->AlbumArtChanged(NULL);
+        }
+    iExtractingAlbumArt = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Get the current state of the active player
+// ---------------------------------------------------------------------------
+//
+TMPlayerState CAiPlayerPluginEngine::PlayerState()
+    {
+    MPX_DEBUG1( "CAiPlayerPluginEngine::PlayerState" );
+    TMPXPlaybackState state( EPbStateNotInitialised );
+    TRAP_IGNORE( state = iPlaybackUtility->StateL() );
+    return MapState( state );
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::TitleL
+// ---------------------------------------------------------------------------
+//
+const TDesC& CAiPlayerPluginEngine::TitleL()
+    {
+
+    if ( iTitle )
+        {
+        return *iTitle;
+        }
+     else
+        {
+        RequestMediaL();
+        return KNullDesC;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::Artist
+// ---------------------------------------------------------------------------
+//
+const TDesC& CAiPlayerPluginEngine::Artist()
+    {
+    if ( iArtist )
+        {
+        return *iArtist;
+        }
+     else
+        {
+        return KNullDesC;
+        }
+    }
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::Artist
+// ---------------------------------------------------------------------------
+//
+const TDesC& CAiPlayerPluginEngine::Uri()
+    {
+    if ( iUri )
+        {
+        return *iUri;
+        }
+     else
+        {
+        return KNullDesC;
+        }
+    }
+
+// ----------------------------------------------------
+// CAiPlayerPluginEngine::Position
+// ----------------------------------------------------
+//
+TInt CAiPlayerPluginEngine::Position()
+    {
+    return iPosition;
+    }
+
+// ----------------------------------------------------
+// CAiPlayerPluginEngine::Duration
+// ----------------------------------------------------
+//
+TInt CAiPlayerPluginEngine::Duration()
+    {
+    return iDuration;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::DoHandlePlaybackMessageL( 
+        const CMPXMessage& aMessage )
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::DoHandlePlaybackMessageL");
+
+    TMPXMessageId id( 
+            aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        MPX_DEBUG2( "CAiPlayerPluginEngine::DoHandlePlaybackMessageL(%d)", 
+                event );
+        switch ( event )
+            {
+            case TMPXPlaybackMessage::EPropertyChanged:
+                {
+                TInt error( KErrNone );
+                DoHandlePropertyL(
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ),
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ),
+                    error );
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+				TMPXPlaybackState state( 
+				        aMessage.ValueTObjectL<TMPXPlaybackState>( 
+				                KMPXMessageGeneralType ));
+                MPX_DEBUG2("CAiPlayerPluginEngine::HandlePlaybackMessageL - E"
+                        "StateChanged(%d)", state);
+
+                DoHandleStateChangedL( state );
+                break;
+                }
+            case TMPXPlaybackMessage::EMediaChanged:
+            case TMPXPlaybackMessage::EPlaylistUpdated:
+                {
+                iPlaybackUtility->PropertyL( *this, EPbPropertyPosition );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyDuration );
+                RequestMediaL();
+                break;
+                }
+            case TMPXPlaybackMessage::ECommandReceived:
+                {
+                MPX_DEBUG2("CAiPlayerPluginEngine::HandlePlaybackMessageL - E"
+                        "CommandReceived(%d)",
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+                break;
+                }
+            case TMPXPlaybackMessage::EActivePlayerChanged:
+                {
+                MPX_DEBUG3("CAiPlayerPluginEngine::HandlePlaybackMessageL - E"
+                        "ActivePlayerChanged(%d, %d)",
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ), 
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyPosition );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyDuration );
+                DoHandleStateChangedL( iPlaybackUtility->StateL() );
+                // refresh media property
+                RequestMediaL();
+                break;
+                }
+            case TMPXPlaybackMessage::ESkipping:
+                {
+                MPX_DEBUG1( "CAiPlayerPluginEngine::DoHandlePlaybackMessageL - ESkipping");
+                iAlbumArtUtil->CancelRequest();
+                iObserver->Opening();
+                iSkipping =ETrue;
+                break;
+                }
+            case TMPXPlaybackMessage::ESkipEnd:
+                {
+                MPX_DEBUG1( "CAiPlayerPluginEngine::DoHandlePlaybackMessageL - ESkipEnd()");
+                iSkipping = EFalse;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::DoHandlePropertyL( TInt aProperty, TInt aValue, 
+        TInt aError )
+    {
+    MPX_DEBUG4("CAiPlayerPluginEngine::DoHandlePropertyL - Property(%d); Valu"
+            "e(%d); Error(%d)", aProperty, aValue, aError );
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty	)
+            {
+            case EPbPropertyPosition:
+                {
+				iPosition = aValue / KMPXOneSecInMilliSecs;
+                iObserver->PlaybackPositionChanged( iPosition );
+                break;
+                }
+            case EPbPropertyDuration:
+                {
+				iDuration = aValue / KMPXOneSecInMilliSecs;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::DoHandleStateChangedL( TMPXPlaybackState aState )
+    {
+    TMPlayerState state = MapState( aState );
+    MPX_DEBUG3("CAiPlayerPluginEngine::DoHandleStateChangedL - State mapped "
+            "from (%d) to (%d)", aState, state );
+    if (state != EMPlayerStateStarting)
+        {
+        iObserver->PlayerStateChanged(state);
+        }
+    else 
+        {
+        iObserver->Opening();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandleErrorL( TInt aError )
+    {
+	MPX_DEBUG2("CAiPlayerPluginEngine::HandleErrorL(%d)", aError );
+    }
+
+// ---------------------------------------------------------------------------
+// Map states from TMPXPlaybackState to TMPlayerState
+// ---------------------------------------------------------------------------
+//
+TMPlayerState CAiPlayerPluginEngine::MapState( TMPXPlaybackState aState )
+    {
+	TMPlayerState state = EMPlayerStateOther;
+    switch ( aState )
+        {
+        case EPbStatePlaying:
+            state = EMPlayerStatePlaying;
+            break;
+        case EPbStatePaused:
+            state = EMPlayerStatePaused;
+            break;
+        case EPbStateSeekingForward:
+        case EPbStateSeekingBackward:
+            state = EMPlayerStateSeeking;
+            break;
+        case EPbStateNotInitialised:
+        case EPbStateInitialising:
+            state = EMPlayerStateStarting;
+            break;
+        case EPbStateStopped:
+            state = EMPlayerStateStopped;
+            break;
+        default:
+            break;
+        }
+    return state;
+    }
+
+// ---------------------------------------------------------------------------
+// Requests Media.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::RequestMediaL()
+    {
+    MPX_DEBUG1( "CAiPlayerPluginEngine::RequestMediaL" );
+    MMPXSource* s = iPlaybackUtility->Source();
+    if ( s )
+        {
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        attrs.Append( KMPXMediaGeneralUri );
+        attrs.Append( KMPXMediaGeneralTitle );
+        attrs.Append( KMPXMediaMusicArtist );
+        attrs.Append( KMPXMediaMusicAlbumArtFileName );
+        s->MediaL( attrs.Array(), *this );
+        CleanupStack::PopAndDestroy( &attrs );
+        }
+    else 
+        {
+        iObserver->PlaylisIsEmpty();
+        }
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/src/applicationmonitor.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors an application exit event.
+*
+*/
+
+#include <mpxlog.h>                     // MPX_DEBUG
+#include <e32base.h>
+#include <e32std.h>
+#include <apacmdln.h>
+#include <apgtask.h>
+#include <AknTaskList.h>
+
+
+#include "applicationmonitor.h"
+#include "applicationmonitorobserver.h"
+
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CApplicationMonitor::CApplicationMonitor( MApplicationMonitorObserver& aObserver)
+        : CActive( EPriorityNormal ),
+        iObserver( aObserver )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Second Phase Constructor
+// ---------------------------------------------------------------------------
+//
+void CApplicationMonitor::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CApplicationMonitor* CApplicationMonitor::NewL( MApplicationMonitorObserver& aObserver)
+    {
+    MPX_DEBUG1("CApplicationMonitor::NewL <---");
+    CApplicationMonitor* self = new( ELeave ) CApplicationMonitor( aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    MPX_DEBUG1("CApplicationMonitor::NewL --->");
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CApplicationMonitor::~CApplicationMonitor()
+    {
+    MPX_DEBUG1("CApplicationMonitor::~CApplicationMonitor <---");
+    Cancel();
+    iThread.Close();
+    MPX_DEBUG1("CApplicationMonitor::~CApplicationMonitor --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Starts monitoring a particular Application
+// ---------------------------------------------------------------------------
+//
+void CApplicationMonitor::StartL( TUid aAppUid , TBool aRootAppIndication )
+    {
+    MPX_DEBUG1("CApplicationMonitor::StartL <---");
+    RWsSession wsSession;
+    User::LeaveIfError( wsSession.Connect() );
+    TUint64 threadId(0);
+    TBool taskExists(EFalse);
+    TInt status = KErrNone;
+    if(aRootAppIndication)
+        {
+        CAknTaskList* taskList = CAknTaskList::NewL( wsSession );
+        TApaTask task = taskList->FindRootApp( aAppUid );
+        delete taskList;
+        taskExists = task.Exists();
+        threadId = task.ThreadId().Id();
+        }
+    else
+        {
+        TApaTaskList taskList( wsSession );
+        TApaTask task = taskList.FindApp( aAppUid );
+        taskExists = task.Exists();
+        threadId = task.ThreadId().Id();
+        }
+    wsSession.Close();
+    
+    if (taskExists)
+        {
+        MPX_DEBUG1("CApplicationMonitor::StartL app found");
+        status = iThread.Open(TThreadId(threadId));
+        if ( status == KErrNone )
+        	{
+        	iThread.Logon(iStatus);
+        	SetActive();
+			}
+        }
+    else
+        {
+        MPX_DEBUG1("CApplicationMonitor::StartL not app found");
+        User::Leave(KErrNotFound);
+        }
+    MPX_DEBUG1("CApplicationMonitor::StartL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// RunL callback
+// ---------------------------------------------------------------------------
+//
+void CApplicationMonitor::RunL()
+    {
+    MPX_DEBUG1("CApplicationMonitor::RunL <---");
+    switch (iStatus.Int())
+        {
+        case EExitKill: 
+        case EExitTerminate:
+        case EExitPanic:
+            MPX_DEBUG1("CApplicationMonitor::RunL kill\terminate\panic");
+            iObserver.HandleApplicationClosedL((TExitType) iStatus.Int());
+            break;
+        case KErrCancel:
+        case KErrNoMemory:
+            MPX_DEBUG1("CApplicationMonitor::RunL cancel\memory");
+            break;
+        case EExitPending: 
+        default:
+            MPX_DEBUG1("CApplicationMonitor::RunL exitpendin\default");
+            // Listen again
+            iThread.Logon(iStatus);
+            SetActive();
+            break;
+        }
+    MPX_DEBUG1("CApplicationMonitor::RunL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle Cancelling
+// ---------------------------------------------------------------------------
+//
+void CApplicationMonitor::DoCancel()
+    {
+    MPX_DEBUG1("CApplicationMonitor::DoCancel <---");
+    // Stop monitoring
+    iThread.LogonCancel(iStatus);
+    MPX_DEBUG1("CApplicationMonitor::DoCancel --->");
+    }
+
+// ----------------------------------------------------------------------------
+// Handles a leave occurring in the request completion event handler RunL()
+// ----------------------------------------------------------------------------
+//
+TInt CApplicationMonitor::RunError(TInt /*aError*/)
+    {
+    MPX_DEBUG1("CApplicationMonitor::RunError <---");
+    // Listen again
+    iThread.Logon(iStatus);
+    SetActive();
+    MPX_DEBUG1("CApplicationMonitor::RunError --->");
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/src/filemonitor.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors the file system for changes in a file.
+*
+*/
+
+
+#include <e32base.h>
+#include <bautils.h>
+#include <mpxlog.h>
+
+#include "filemonitor.h"
+#include "filemonitorobserver.h"
+
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CFileMonitor::CFileMonitor( MFileMonitorObserver& aObserver)
+        : CActive( EPriorityNormal ),
+        iObserver( aObserver ),
+        iFilePath( NULL )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Second Phase Constructor
+// ---------------------------------------------------------------------------
+//
+void CFileMonitor::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    User::LeaveIfError( iFs.Connect() );
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CFileMonitor* CFileMonitor::NewL( MFileMonitorObserver& aObserver)
+    {
+    CFileMonitor* self = new( ELeave ) CFileMonitor( aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CFileMonitor::~CFileMonitor()
+    {
+    Cancel();
+    iFs.Close();
+    delete iFilePath;
+    }
+
+// ---------------------------------------------------------------------------
+// Starts monitoring a particular file
+// ---------------------------------------------------------------------------
+//
+void CFileMonitor::StartL(  const TDesC& aFile)
+    {
+    MPX_DEBUG1("CFileMonitor::Start <---");
+
+    delete iFilePath;
+    iFilePath = NULL;
+    iFilePath = aFile.AllocL();
+		
+    TNotifyType notType = ENotifyAll;
+    iFs.NotifyChange( notType, iStatus, *iFilePath );
+    SetActive();
+    MPX_DEBUG1("CFileMonitor::Start --->");
+    }
+
+// ---------------------------------------------------------------------------
+// RunL callback
+// ---------------------------------------------------------------------------
+//
+void CFileMonitor::RunL()
+    {
+    MPX_DEBUG1("CFileMonitor::RunL <---");
+    if (!BaflUtils::FileExists(iFs, *iFilePath ))
+        {
+        iObserver.HandleFileRemovedL();
+        MPX_DEBUG1("CFileMonitor::RunL - File was removed");
+        }
+    else
+        {
+        // Listen again
+        TNotifyType notType(ENotifyAll);
+        iFs.NotifyChange(notType, iStatus, *iFilePath);
+        SetActive();
+        MPX_DEBUG1("CFileMonitor::RunL - File exists");
+        }
+    MPX_DEBUG1("CFileMonitor::RunL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle Cancelling
+// ---------------------------------------------------------------------------
+//
+void CFileMonitor::DoCancel()
+    {
+    MPX_DEBUG1("CFileMonitor::DoCancel <---");
+
+    // Stop monitoring
+    iFs.NotifyChangeCancel();
+    MPX_DEBUG1("CFileMonitor::DoCancel --->");
+
+    }
+
+// ----------------------------------------------------------------------------
+// Handles a leave occurring in the request completion event handler RunL()
+// ----------------------------------------------------------------------------
+//
+TInt CFileMonitor::RunError(TInt aError)
+    {
+    MPX_DEBUG2("CFileMonitor::RunError(%d)", aError );
+   
+    // Listen again
+    TNotifyType notType(ENotifyAll);
+    iFs.NotifyChange( notType, iStatus, *iFilePath );
+    SetActive();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/src/mcpmusicplayer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1310 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Updates Music Content Publisher
+*
+*/
+
+#include <mpxlog.h>                     // MPX_DEBUG
+#include <implementationproxy.h>
+#include <LiwServiceHandler.h>
+#include <LiwVariant.h>
+#include <LiwGenericParam.h>
+#include <StringLoader.h>
+#include <AknUtils.h>
+#include <AknsUtils.h>
+#include <aknsconstants.hrh>
+#include <musichomescreenicons.mbg>
+#include <musichomescreen.rsg>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <AknTaskList.h>
+
+
+
+#include "cpglobals.h" //to be moved to domain API
+
+#include "mcpmusicplayer.h" 
+#include "mcpmusicplayeruids.hrh"
+#include "aiplayerpluginengine.h"
+#include "filemonitor.h"
+#include "applicationmonitor.h"
+#include "pnsmonitor.h"
+
+//const TUid  KLocalPlaybackUid = { 0x101FFC06 };
+const TInt  KMusicPlayerAppUidAsTInt =  0x102072C3;
+
+const TInt KMmUid3AsTInt( 0x101f4cd2 );
+const TInt KMSGUidAsTInt( 0x10003A39 );
+
+namespace TBK
+    {
+    const TUint  KSkeep_L          = 0x001; //000000000001
+    const TUint  KSkeep_R          = 0x002; //000000000010
+    const TUint  KPause            = 0x004; //000000000100
+    const TUint  KPlay             = 0x008; //000000001000
+    const TUint  KSkeep_L_dimmed   = 0x010; //000000010000
+    const TUint  KSkeep_R_dimmed   = 0x020; //000000100000
+    const TUint  KPause_dimmed     = 0x040; //000001000000
+    const TUint  KPlay_dimmed      = 0x080; //000010000000
+    const TUint  KPlay_last_played = 0x100; //000100000000
+    }
+
+_LIT( KEmpty, "" );
+_LIT( KNowPlaying, "LOC:NOW PLAYING" );
+_LIT( KLastPlayed, "LOC:LAST PLAYED" );
+
+
+_LIT( KMIF, "z:\\resource\\apps\\musichomescreenicons.mif");
+
+_LIT( KResourceFile, "z:musichomescreen.rsc");
+
+//for music player action handler - playback command
+_LIT( KActionPlaybackCommand , "PlaybackCommand" );
+_LIT8( KPBCommand, "command" );
+
+//for music player action handler - message to music player
+_LIT( KactionMessageToMusicPlayer, "MessageToMusicPlayer" );
+_LIT( KGoToNowPlaying, "GoToNowPlaying" );
+_LIT( KGoToLastPlayed, "GoToLastPlayed" );
+_LIT( KGoToLastPlayedMinimized, "GoToLastPlayedMinimized" );
+
+_LIT8( KMessage, "message" );
+_LIT8( KAdditionalData, "additional_data" );
+
+//for application launcher AHPlugin
+_LIT( KCmdLine, "cmd_line" );
+_LIT( KLaunchApp, "launch_application" );
+_LIT( KMessageWithTail, "message_with_tail" );
+_LIT8( KMessageForMMOpenMusicSuiteWithHide, "mm://root/musicsuite?exit=hide");
+
+
+//for time
+//_LIT( KSeparator, "/" );
+_LIT( KSeparatorhyphen, " - " );
+//_LIT( KMPXZeroDurationMark, "--" );
+//_LIT( KTitleNowPlaying, "Now Playing" );
+//_LIT( KTitleLastPlayed, "Last Played" );
+
+const TInt KMusicPlayerOpeningTimerInterval = 15000000; // 15 seconds
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMCPMusicPlayer::CMCPMusicPlayer(MMCPPluginObserver* aObserver)
+    {
+    iMHObserver = aObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::ConstructL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL <---");
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL creating engine");
+    iEngine = CAiPlayerPluginEngine::NewL( *this );
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL engine created");
+    AknsUtils::InitSkinSupportL();
+    //Load Loc strings
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL getting resource file");
+    RFs fs;
+    User::LeaveIfError(fs.Connect());
+    CleanupClosePushL(fs);  
+    TFileName fileName;
+    TParse* parseObj = new(ELeave) TParse();
+    TInt errInt = parseObj->Set( KResourceFile(),&KDC_APP_RESOURCE_DIR,NULL );
+    if(KErrNone != errInt)
+      {
+      delete parseObj;
+      User::Leave(errInt);
+      }
+    fileName = parseObj->FullName();
+    delete parseObj;
+    BaflUtils::NearestLanguageFile(fs,fileName);
+    if(!BaflUtils::FileExists(fs,fileName))
+        {
+        User::Leave(KErrNotFound);
+        }
+    RResourceFile resourceFile;
+    resourceFile.OpenL(fs,fileName);
+    CleanupClosePushL(resourceFile);
+    resourceFile.ConfirmSignatureL();
+    GetLocalizedStringL(resourceFile, iGoToMusicBuffer, R_MUSICHOMESCREEN_GO_TO_MUSIC);
+    GetLocalizedStringL(resourceFile, iOpeningBuffer, R_MUSICHOMESCREEN_OPENING);
+    CleanupStack::PopAndDestroy(&resourceFile);
+    CleanupStack::PopAndDestroy(&fs);
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL resources loaded");
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TRAPD(err, iArtBitmapMask = AknsUtils::CreateBitmapL( skin, 
+            KAknsIIDQgnHomePhotoMask ) );
+    if (err == KErrNone)
+        {
+        AknIconUtils::DisableCompression(iArtBitmapMask);
+        TSize size( 70 , 70);
+        AknIconUtils::SetSize( iArtBitmapMask, size );
+        if (iArtBitmapMask->SetDisplayMode( EGray256 ) != KErrNone)
+            {
+            delete iArtBitmapMask;
+            iArtBitmapMask = NULL;
+            }
+        }
+    else
+        {
+        delete iArtBitmapMask;
+        iArtBitmapMask = NULL;
+        }
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
+    iMusicPlayerOpeningTimer = CPeriodic::NewL( CActive::EPriorityLow );
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMCPMusicPlayer* CMCPMusicPlayer::NewL(MMCPPluginObserver* aObserver)
+    {
+    CMCPMusicPlayer* self = new ( ELeave ) 
+    CMCPMusicPlayer( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMCPMusicPlayer::~CMCPMusicPlayer()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::~CMCPMusicPlayer <---");
+    if (iArtCached && iArtBitmap != iCachedArtBitmap)
+        {
+        delete iCachedArtBitmap;
+        }
+    delete iArtBitmap;
+    delete iArtBitmapMask;
+    delete iEngine;
+    delete iFileMonitor;
+    delete iAppMonitor;
+    delete iPNSMonitor;
+    delete iGoToMusicBuffer;
+    delete iOpeningBuffer;
+    if ( iCollectionUtility )
+    	{
+    	iCollectionUtility->Close();
+    	}
+    delete iMusicPlayerOpeningTimer;
+    MPX_DEBUG1("CMCPMusicPlayer::~CMCPMusicPlayer --->");
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TBool CMCPMusicPlayer::IsOKToPublishData()
+    {
+    return iActive;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallPlaybackCommandActionL(TMPXPlaybackCommand aCmd,
+        TMCPTriggerDestination aDestination)
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallPlaybackCommandActionL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10207C16 ) ) );
+    mapData->InsertL( KType, TLiwVariant( KActionPlaybackCommand ) );
+    TInt32 cmd;
+    cmd=static_cast<TInt32>( aCmd );
+    mapData->InsertL( KPBCommand, TLiwVariant( cmd ) );
+    mapTrigger->InsertL( KData , TLiwVariant( mapData ) );
+    
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData  );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallPlaybackCommandActionL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallLaunchMusicPlayerL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallLaunchMusicPlayerL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10282E5F ) ) );
+    mapData->InsertL( KType, TLiwVariant( KLaunchApp ) );
+    mapData->InsertL( KLaunchMethod, TLiwVariant( KCmdLine ) );
+    mapData->InsertL(KApplicationUid,
+            TLiwVariant(TInt32(KMusicPlayerAppUidAsTInt) ) );
+    mapTrigger->InsertL( KData, TLiwVariant( mapData ) );
+    
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallLaunchMusicPlayerL --->");
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallGoToNowPlayingL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToNowPlayingL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10207C16 ) ) );
+    mapData->InsertL( KType, TLiwVariant( KactionMessageToMusicPlayer ) );
+    mapData->InsertL( KMessage, TLiwVariant( KGoToNowPlaying ) );
+    mapTrigger->InsertL( KData , TLiwVariant( mapData ) );
+
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData  );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToNowPlayingL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallGoToLastPlayedL(
+        TMCPTriggerDestination aDestination, TBool aMinimized )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToLastPlayedL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10207C16 ) ) );
+    mapData->InsertL( KType, TLiwVariant( KactionMessageToMusicPlayer ) );
+    if (aMinimized)
+        {
+        mapData->InsertL( KMessage, TLiwVariant( KGoToLastPlayedMinimized ) );
+        }
+    else
+        {
+        mapData->InsertL( KMessage, TLiwVariant( KGoToLastPlayed ) );
+        }
+    mapTrigger->InsertL( KData , TLiwVariant( mapData ) );
+
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData  );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToLastPlayedL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallGoToMusicL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToMusicL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10282E5F ) ) );
+    
+    mapData->InsertL( KType, TLiwVariant( KLaunchApp ) );
+    mapData->InsertL( KLaunchMethod, TLiwVariant( KMessageWithTail ) );
+    mapData->InsertL(KApplicationUid,
+            TLiwVariant(TInt32(KMmUid3AsTInt) ) );
+        mapData->InsertL( KAdditionalData, 
+            TLiwVariant( KMessageForMMOpenMusicSuiteWithHide ) );
+    mapData->InsertL(KMessageUid,
+            TLiwVariant(TInt32(KMSGUidAsTInt) ) );
+    
+    mapTrigger->InsertL( KData, TLiwVariant( mapData ) );
+    
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToMusicL --->");
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallEmptyActionL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallEmptyActionL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallEmptyActionL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Installs actions and icons in the toolbar.
+// ---------------------------------------------------------------------------
+//
+
+void CMCPMusicPlayer::UpdateToolBarL(TUint aToolBarState)
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL <---");
+    if (IsOKToPublishData())
+        {
+        TInt updateState;
+        //we update if there is a change on the state and if the new propery
+        //was set.
+        // updateState = ( new ^ old ) & new = new & ~old
+        updateState = aToolBarState & ~iToolBarState;
+        TAknsItemID iconId;
+        
+        if ( TBK::KSkeep_L & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPrev);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB1, iconId, 
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_prev, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_prev_mask);
+            InstallPlaybackCommandActionL(EPbCmdPrevious, 
+                    EMusicWidgetTB1Trigger);
+            iToolBarState |= TBK::KPlay_dimmed;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KSkeep_L");
+            }
+        
+        if ( TBK::KSkeep_R & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbNext);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB3, iconId, 
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_next, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_next_mask);
+            InstallPlaybackCommandActionL(EPbCmdNext, EMusicWidgetTB3Trigger);
+            iToolBarState |= TBK::KSkeep_R;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KSkeep_R");
+            }
+        
+        if ( TBK::KPause & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPause);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB2, iconId, 
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_pause, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_pause_mask);
+            InstallPlaybackCommandActionL(EPbCmdPlayPause,
+                    EMusicWidgetTB2Trigger);
+            iToolBarState |= TBK::KPause;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KPause");
+            }
+        
+        if ( TBK::KPlay & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPlay2 );
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB2, iconId,
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_play2, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_play2_mask);
+            InstallPlaybackCommandActionL(EPbCmdPlayPause, 
+                    EMusicWidgetTB2Trigger);
+            iToolBarState |= TBK::KPlay;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KPlay");
+            }
+        
+        if ( TBK::KPlay_last_played & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPlay2 );
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB2, iconId,
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_play2, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_play2_mask);
+            InstallGoToLastPlayedL(EMusicWidgetTB2Trigger, ETrue); 
+            iToolBarState |= TBK::KPlay_last_played;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KPlay_last_played");
+            }
+        
+        if ( TBK::KSkeep_L_dimmed & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPrevDimmed);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB1, iconId, 
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_prev_dimmed, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_prev_dimmed_mask);
+            InstallEmptyActionL( EMusicWidgetTB1Trigger);
+            iToolBarState |= TBK::KSkeep_L_dimmed;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KSkeep_L_dimmed");
+            }
+        
+        if ( TBK::KSkeep_R_dimmed & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbNextDimmed);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB3, iconId, 
+                KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_next_dimmed, 
+                EMbmMusichomescreeniconsQgn_prop_image_tb_next_dimmed_mask);
+            InstallEmptyActionL( EMusicWidgetTB3Trigger);
+            iToolBarState |= TBK::KSkeep_R_dimmed;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KSkeep_R_dimmed");
+            }
+        
+        if ( TBK::KPause_dimmed & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPauseDimmed);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB2, iconId, 
+                KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_pause_dimmed, 
+                EMbmMusichomescreeniconsQgn_prop_image_tb_pause_dimmed_mask);
+            InstallEmptyActionL( EMusicWidgetTB2Trigger);
+            iToolBarState |= TBK::KPause_dimmed;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KPause_dimmed");
+            }
+        
+        if ( TBK::KPlay_dimmed & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPlay2Dimmed);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB2, iconId, 
+                KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_play2_dimmed, 
+                EMbmMusichomescreeniconsQgn_prop_image_tb_play2_dimmed_mask);
+            InstallEmptyActionL( EMusicWidgetTB2Trigger);
+            iToolBarState |= TBK::KPlay_dimmed;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KPlay_dimmed");
+            }
+        
+        iToolBarState = aToolBarState;
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL <---");
+    }
+
+// ---------------------------------------------------------------------------
+// Resets the widget an Music Suite.
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::ResetL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::ResetL <---");
+    //Note that we are not checking if IsOKToPublishData()This will only get
+    //published if the plugin is still active on the music content publisher
+    //meaning that no other plugin has preempted us.
+    if ( iAppMonitor )
+        {
+        delete iAppMonitor;
+        iAppMonitor = NULL;
+        }
+    if (iFileMonitor)
+        {
+        delete iFileMonitor;
+        iFileMonitor = NULL;
+        }
+    if ( iPNSMonitor )
+        {
+        delete iPNSMonitor;
+        iPNSMonitor = NULL;
+        }
+    //Reset
+    iMHObserver->PublishTextL( this,EMusicWidgetDefaultText, iGoToMusicBuffer->Des() );
+    iMHObserver->PublishImageL(this,EMusicWidgetImage1,KEmpty);
+    InstallGoToMusicL( EMusicWidgetTrigger1 );
+    iMHObserver->PublishTextL( this,EMusicWidgetText1, KEmpty );
+    iMHObserver->PublishImageL(this,EMusicWidgetToolbarB1,KEmpty);
+    iMHObserver->PublishImageL(this,EMusicWidgetToolbarB2,KEmpty);
+    iMHObserver->PublishImageL(this,EMusicWidgetToolbarB3,KEmpty);
+    InstallEmptyActionL(EMusicWidgetTB1Trigger);
+    InstallEmptyActionL(EMusicWidgetTB2Trigger);
+    InstallEmptyActionL(EMusicWidgetTB3Trigger);
+    InstallGoToMusicL( EMusicWidgetTrigger2 );
+    
+
+    
+    //Reset the music menu info
+    InstallEmptyActionL(EMusicMenuMusicInfoTrigger);
+    iMHObserver->PublishTextL( this, EMusicMenuMusicInfoLine1, 
+            KLastPlayed );
+    iMHObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, 
+            KEmpty );
+    iMHObserver->PublishImageL( this, EMusicMenuMusicInfoImage1,
+        KAknsIIDQgnIndiMupDefaultAlbum, 
+        KMIF,
+        EMbmMusichomescreeniconsQgn_indi_mup_default_album,
+        EMbmMusichomescreeniconsQgn_indi_mup_default_album_mask); 
+    MPX_DEBUG1("CMCPMusicPlayer::ResetL --->");
+    }
+
+// ----------------------------------------------------------------------------
+// Get a heap descriptor from the resource file
+// ----------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::GetLocalizedStringL(RResourceFile& aResourceFile ,HBufC*& aRetBuf,
+        TInt aResourceId )
+   {
+   MPX_DEBUG1("CMCPMusicPlayer::GetLocalizedStringL <---");
+   HBufC8* dataBuffer = aResourceFile.AllocReadLC(aResourceId);
+   TResourceReader theReader;
+   theReader.SetBuffer(dataBuffer);
+   aRetBuf = theReader.ReadHBufCL();
+   CleanupStack::PopAndDestroy(dataBuffer);
+   MPX_DEBUG1("CMCPMusicPlayer::GetLocalizedStringL --->");
+   }
+
+// ----------------------------------------------------------------------------
+// Sets the plugin as active.
+// ----------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::ActivateL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL <---");
+    if ( iPNSMonitor )
+        {
+        delete iPNSMonitor;
+        iFileMonitor = NULL;
+        MPX_DEBUG1("CMCPMusicPlayer::ActivateL pns monitor deleted");
+        }
+    iPNSMonitor = CPNSMonitor::NewL(*this);
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL pns monitor created");
+    iPNSMonitor->Start();
+    if ( iAppMonitor )
+        {
+        delete iAppMonitor;
+        iAppMonitor = NULL;
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL app monitor deleted");
+    iAppMonitor = CApplicationMonitor::NewL(*this);
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL app monitor created");
+    TRAPD(err, 
+            iAppMonitor->StartL( TUid::Uid( KMusicPlayerAppUidAsTInt ) ) 
+          );
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL app monitor started");
+    if (KErrNone != err) //Music player is not running, it died somehow. 
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::ActivateL music player is not running");
+        if (iFileMonitor)
+            {
+            delete iFileMonitor;
+            iFileMonitor = NULL;
+            }
+        MPX_DEBUG1("CMCPMusicPlayer::ActivateL file monitor deleted");
+        const TDesC& uri = iEngine->Uri();
+        if ( uri != KNullDesC )
+            {
+            MPX_DEBUG1("CMCPMusicPlayer::ActivateL uri is not null creatin file monitor");
+            iFileMonitor = CFileMonitor::NewL(*this);
+            iFileMonitor->StartL( uri );
+            }
+        iActive = EFalse;
+        }
+    else //Music player is running
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::ActivateL music player is running, activating...");
+        iMHObserver->BecameActiveL(this);
+        iActive = ETrue;
+        MPX_DEBUG1("CMCPMusicPlayer::ActivateL we are active now");
+        
+        iMHObserver->PublishTextL( this, EMusicWidgetDefaultText, KEmpty );
+        InstallGoToNowPlayingL(EMusicWidgetTrigger1);
+        InstallGoToLastPlayedL(EMusicMenuMusicInfoTrigger, EFalse);
+        iMHObserver->PublishTextL(this, EMusicMenuMusicInfoLine1, 
+                 KNowPlaying);
+        DoUpdateTrackInfoL(iEngine->TitleL(), iEngine->Artist());
+        iToolBarState = 0;
+        DoUpdatePlayerStateL( iEngine->PlayerState() );
+        DoUpdateAlbumArtL(iArtCached ? iCachedArtBitmap : iArtBitmap);
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL --->");
+    }
+
+
+void CMCPMusicPlayer::DoUpdatePlayerStateL(TMPlayerState aState)
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL <---");
+    switch ( aState )
+            {
+            case EMPlayerStatePlaying:
+                {
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL EMPlayerStatePlaying");
+                UpdateToolBarL(TBK::KSkeep_L|TBK::KPause|TBK::KSkeep_R);
+                break;
+                }
+            case EMPlayerStatePaused:
+                {
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL EMPlayerStatePaused");
+                UpdateToolBarL(TBK::KSkeep_L|TBK::KPlay|TBK::KSkeep_R);
+                break;
+                }
+            case EMPlayerStateSeeking:
+                {
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL EMPlayerStateSeeking");
+                UpdateToolBarL(TBK::KSkeep_L_dimmed |
+                        TBK::KPlay_dimmed |
+                        TBK::KSkeep_R_dimmed);
+                break;
+                }
+            case EMPlayerStateStopped:
+                {
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL EMPlayerStateStopped");
+                if ( iUSBOnGoing )
+                    {
+                    UpdateToolBarL( TBK::KSkeep_L_dimmed |
+                            TBK::KPlay_dimmed |
+                            TBK::KSkeep_R_dimmed );
+                    }
+                else
+                    {
+                    UpdateToolBarL(TBK::KSkeep_L|TBK::KPlay|TBK::KSkeep_R);
+                    }
+                break;
+                }
+            default:
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL default");
+                break;
+            }
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL --->");
+    }
+
+void CMCPMusicPlayer::DoUpdateTrackInfoL(const TDesC& aTitle, const TDesC& aArtist)
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL <---");
+    if ( IsOKToPublishData() )
+            {
+            HBufC* nowPlayingForMM = HBufC::NewLC( aTitle.Length() + 
+            		                               KSeparatorhyphen().Length() + aArtist.Length() );     
+            TPtr nowPlayingForMMPtr = nowPlayingForMM->Des();
+            if ( &aTitle && aTitle.Length() )
+                {
+                nowPlayingForMMPtr.Copy( aTitle );
+                }
+            if ( &aArtist && aArtist.Length() )
+                {
+                nowPlayingForMMPtr.Append(KSeparatorhyphen);
+                nowPlayingForMMPtr.Append(aArtist);
+                }            
+            iMHObserver->PublishTextL( this,EMusicWidgetText1, *nowPlayingForMM );
+            iMHObserver->PublishTextL(this, EMusicMenuMusicInfoLine2,
+                    *nowPlayingForMM);
+            CleanupStack::PopAndDestroy( nowPlayingForMM );
+            MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL deliting file monitor");
+            if (iFileMonitor)
+                {
+                delete iFileMonitor;
+                iFileMonitor = NULL;
+                }
+            
+            const TDesC& uri = iEngine->Uri();
+            if ( uri != KNullDesC )
+                {
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL creating file monitor");
+                iFileMonitor = CFileMonitor::NewL(*this);
+                iFileMonitor->StartL( uri );
+                }
+            }
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL --->");
+    }
+
+void CMCPMusicPlayer::DoUpdatePlaybackPositionL(TInt /*aPosition*/)
+    {
+    /*
+     * 
+     * This code was left here in case some parts are helpfull
+     *  in the future, here is some code that used to work, 
+     *  Members and APIs used migh have changed.
+     *  
+        if ( IsOKToPublishData() )
+            {
+            const TInt KMPXMinSecSeparatorIndex = 2;
+            const TInt KMPXOneSecInMicroSecs = 1000000;
+            const TInt KMPXOneHourInSeconds = 60 * 60;
+            const TInt KMPXTimeIndicatorLength = 16;
+            
+            TBuf<KMPXTimeIndicatorLength> elapsed;
+            TBuf<KMPXTimeIndicatorLength> total;
+        
+            TInt64 playbackPosInSeconds;
+            TInt64 totalLengthInSeconds;
+        
+            playbackPosInSeconds = aPosition;
+            totalLengthInSeconds = iEngine->Duration();
+            HBufC* longFormatString;
+            HBufC* shortFormatString;
+        
+            longFormatString = StringLoader::LoadL(
+                    R_QTN_TIME_DURAT_LONG_WITH_ZERO );
+            shortFormatString = StringLoader::LoadL(
+                    R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO) ;
+            TPtrC format = *shortFormatString;
+        
+            if ( totalLengthInSeconds >= KMPXOneHourInSeconds )
+                {
+                // For tracks longer than an hour we use different time format and
+                //a slightly different layout which has more space for the time
+                //labels.
+                format.Set( *longFormatString );
+                }
+        
+            TTime elapsedTime( playbackPosInSeconds * KMPXOneSecInMicroSecs );
+            TTime totalTime( totalLengthInSeconds * KMPXOneSecInMicroSecs );
+        
+            if ( aPosition == 0 )
+                {
+                totalLengthInSeconds = 0;
+                }
+        
+            // Convert total playing time to texts.
+            elapsedTime.FormatL( elapsed, format );
+        
+            if ( totalLengthInSeconds )
+                {
+                // Time remaining
+                totalTime.FormatL( total, format );
+                }
+            else
+                {
+                // Time remaining: --:--
+                TLocale locale;
+                TBuf<KMPXTimeIndicatorLength> pos;
+                TChar separator = locale.TimeSeparator(KMPXMinSecSeparatorIndex);
+                total = KMPXZeroDurationMark;
+                total.Append( separator );
+                total += KMPXZeroDurationMark;
+                }
+        
+            AknTextUtils::LanguageSpecificNumberConversion( elapsed );
+            AknTextUtils::LanguageSpecificNumberConversion( total );
+            TBuf<128> duration;
+            TBuf<128> elapsedTimebuf;
+        
+            elapsedTimebuf.Copy( elapsed );
+        
+            duration.Copy( elapsed );
+            duration.Append( KSeparator );
+            duration.Append( total );
+        
+            iMHObserver->PublishTextL( this, EMusicWidgetText3, duration );
+        
+            delete longFormatString;
+            delete shortFormatString;
+            }
+     */
+    }
+
+void CMCPMusicPlayer::DoUpdateAlbumArtL( CFbsBitmap* aBitmap )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdateAlbumArtL <---");
+    //Make sure that iCachedArtBitmap is deleted or nulled in case it is an alias.
+    //This ensures that the data is not double deleted nor orphan.
+    if ( iCachedArtBitmap && iCachedArtBitmap !=  aBitmap  && iCachedArtBitmap != iArtBitmap)
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::DoUpdateAlbumArtL delete iCachedArtBitmap");
+        delete iCachedArtBitmap;
+        }
+    iCachedArtBitmap = NULL;
+    //Store the new bitmap.
+    if ( aBitmap != iArtBitmap )
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::DoUpdateAlbumArtL delete iArtBitmap");
+        delete iArtBitmap;
+        }
+    iArtBitmap = aBitmap;
+    iArtCached = EFalse;
+    
+    if (iArtBitmap)
+        {
+        TInt handle = iArtBitmap->Handle();
+        if (iArtBitmapMask)
+            {
+            TInt mskHandle = iArtBitmapMask->Handle();
+            iMHObserver->PublishImageL(this,EMusicWidgetImage1,handle,
+                    mskHandle);
+            }
+        else
+            {
+            iMHObserver->PublishImageL(this,EMusicWidgetImage1,handle);
+            }
+        iMHObserver->PublishImageL( this, EMusicMenuMusicInfoImage1, 
+                handle );
+        }
+    else
+        {
+        iMHObserver->PublishImageL( this, EMusicMenuMusicInfoImage1,
+                    KAknsIIDQgnIndiMupDefaultAlbum, 
+                    KMIF, EMbmMusichomescreeniconsQgn_indi_mup_default_album, 
+                    EMbmMusichomescreeniconsQgn_indi_mup_default_album_mask); 
+        iMHObserver->PublishImageL( this, EMusicWidgetImage1,
+                    KAknsIIDQgnIndiMupDefaultAlbum, 
+                    KMIF, EMbmMusichomescreeniconsQgn_indi_mup_default_album, 
+                    EMbmMusichomescreeniconsQgn_indi_mup_default_album_mask);
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdateAlbumArtL --->");
+    }
+
+void CMCPMusicPlayer::DoHandleOpeningL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandleOpeningL <---");
+    if ( IsOKToPublishData() )
+        {
+        iMHObserver->PublishTextL( this,EMusicWidgetText1, iOpeningBuffer->Des() );
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandleOpeningL --->");
+    }
+
+void CMCPMusicPlayer::DoHandlePlaylisIsEmptyL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandlePlaylisIsEmptyL <---");
+    iActive = EFalse;
+    ResetL();
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandlePlaylisIsEmptyL --->");
+    }
+void CMCPMusicPlayer::DoHandleSkinChangedL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandleSkinChangedL <---");
+    //To make sure the mask gets recreated even if we don't use it right now.
+    delete iArtBitmapMask;
+    iArtBitmapMask = NULL;
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    
+    TRAPD(err, iArtBitmapMask = AknsUtils::CreateBitmapL( skin, 
+            KAknsIIDQgnHomePhotoMask ) );
+    if (err == KErrNone)
+        {
+        AknIconUtils::DisableCompression(iArtBitmapMask);
+        TSize size( 70 , 70);
+        AknIconUtils::SetSize( iArtBitmapMask, size );
+        if (iArtBitmapMask->SetDisplayMode( EGray256 ) != KErrNone)
+            {
+            delete iArtBitmapMask;
+            iArtBitmapMask = NULL;
+            }
+        }
+    else
+        {
+        delete iArtBitmapMask;
+        iArtBitmapMask = NULL;
+        }
+    
+    if (iArtBitmap)
+        {
+        TInt handle = iArtBitmap->Handle();
+        if (iArtBitmapMask)
+            {
+            TInt mskHandle = iArtBitmapMask->Handle();
+            iMHObserver->PublishImageL(
+                    this,
+                    EMusicWidgetImage1,
+                    handle, 
+                    mskHandle);
+            }
+        else
+            {
+            iMHObserver->PublishImageL(
+                    this,
+                    EMusicWidgetImage1,
+                    handle);
+            }
+        }
+    else
+        {
+        iMHObserver->PublishImageL( this, EMusicMenuMusicInfoImage1,
+                    KAknsIIDQgnIndiMupDefaultAlbum, 
+                    KMIF, EMbmMusichomescreeniconsQgn_indi_mup_default_album, 
+                    EMbmMusichomescreeniconsQgn_indi_mup_default_album_mask); 
+        iMHObserver->PublishImageL( this, EMusicWidgetImage1,
+                    KAknsIIDQgnIndiMupDefaultAlbum, 
+                    KMIF, EMbmMusichomescreeniconsQgn_indi_mup_default_album, 
+                    EMbmMusichomescreeniconsQgn_indi_mup_default_album_mask);
+        }
+       
+    TUint tbstate = iToolBarState;
+    //To Force a change on the toolbar with the current properties.
+    iToolBarState = 0;
+    if (!iActive)
+        {
+        //This is to force the icons to update, but we still want to keep
+        //the plugin as incative.
+        iActive = ETrue;
+        UpdateToolBarL(tbstate);
+        iActive = EFalse;
+        }
+    else
+        {
+        UpdateToolBarL(tbstate);
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandleSkinChangedL --->");
+    }
+   
+
+
+// ---------------------------------------------------------------------------
+// From CMCPPlugin
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::Deactivate()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::Deactivate() <---");
+    iActive = EFalse;
+    if (iFileMonitor)
+        {
+        delete iFileMonitor;
+        iFileMonitor = NULL;
+        }
+    if (iAppMonitor)
+        {
+        delete iAppMonitor;
+        iAppMonitor = NULL;
+        }
+    if ( iPNSMonitor )
+        {
+        delete iPNSMonitor;
+        iPNSMonitor = NULL;
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::Deactivate() --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From CMCPPlugin
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::SkinChanged()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::SkinChanged() <---");
+    TRAP_IGNORE( DoHandleSkinChangedL() );
+    MPX_DEBUG1("CMCPMusicPlayer::SkinChanged() --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::PlayerStateChanged( TMPlayerState aState )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::PlayerStateChanged <---");
+    //we want to activate only with states that can be triggered by the user.
+    if (!iActive && 
+	        aState == EMPlayerStatePlaying)
+        {
+        //ActivateL updates the whole widget and music suite data.
+        MPX_DEBUG1("CMCPMusicPlayer::PlayerStateChanged activating");
+        TRAP_IGNORE( ActivateL() );
+        }
+    else
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::PlayerStateChanged updating state");
+        TRAP_IGNORE(DoUpdatePlayerStateL(aState));
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::PlayerStateChanged --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::TrackInfoChanged( const TDesC& aTitle, 
+        const TDesC& aArtist )
+    
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::TrackInfoChanged <---");
+    if (iActive)
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::TrackInfoChanged updating track info");
+        TRAP_IGNORE(DoUpdateTrackInfoL(aTitle, aArtist));
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::TrackInfoChanged --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::PlaybackPositionChanged( TInt aPosition )
+    {
+    TRAP_IGNORE( DoUpdatePlaybackPositionL( aPosition ) );
+    }
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+// 
+void CMCPMusicPlayer::AlbumArtChanged( CFbsBitmap* aBitmap )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::AlbumArtChanged <---");
+    if (!iActive)
+        {
+        iCachedArtBitmap = aBitmap;
+        iArtCached = ETrue;
+        }
+    else
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::AlbumArtChanged updating album art");
+        TRAP_IGNORE( DoUpdateAlbumArtL( aBitmap ) );
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::AlbumArtChanged --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::Opening()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::Opening <---");
+    TRAP_IGNORE( DoHandleOpeningL() );
+    MPX_DEBUG1("CMCPMusicPlayer::Opening --->");
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::PlaylisIsEmpty()
+    {
+    //TRAP_IGNORE( DoHandlePlaylisIsEmptyL() );
+    }
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::HandleFileRemovedL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::HandleFileRemovedL <---");
+    iActive = EFalse;
+    ResetL();
+    MPX_DEBUG1("CMCPMusicPlayer::HandleFileRemovedL --->");
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MApplicationMonitorObserver
+// ---------------------------------------------------------------------------
+// 
+void CMCPMusicPlayer::HandleApplicationClosedL(TExitType aReason)
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL <---");
+    if (aReason == EExitPanic)
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL panic");
+        iActive = EFalse;
+        ResetL();
+        }
+    else
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL normal close");
+        UpdateToolBarL( TBK::KSkeep_L_dimmed |
+                TBK::KPlay_last_played |
+                TBK::KSkeep_R_dimmed );
+        if (IsOKToPublishData() )
+            {
+            iMHObserver->PublishTextL( this, EMusicWidgetDefaultText, KEmpty );
+            InstallGoToLastPlayedL(EMusicMenuMusicInfoTrigger, EFalse);       
+            iMHObserver->PublishTextL(this, EMusicMenuMusicInfoLine1,
+                                KLastPlayed);     
+            DoUpdateTrackInfoL(iEngine->TitleL(), iEngine->Artist());
+            DoUpdateAlbumArtL(iArtCached ? iCachedArtBitmap : iArtBitmap);
+            }
+        if ( iAppMonitor )
+            {
+            MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL deliting app monitor");
+            delete iAppMonitor;
+            iAppMonitor = NULL;
+            }
+        
+        iActive = EFalse;
+        //in case the app closed before the info was updated.
+        if (iEngine->TitleL() == KNullDesC)
+            {
+            MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL there is no title - resetting");
+            ResetL();
+            }
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL --->");
+    }
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection messages.
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr )
+    {
+    MPX_DEBUG1("--->CMCPMusicPlayer::HandleCollectionMessage()");
+    if ( aErr == KErrNone && aMsg )
+        {
+        TRAP_IGNORE( HandleCollectionMessageL( aMsg ));
+        }
+    MPX_DEBUG1("<---CMCPMusicPlayer::HandleCollectionMessage()");
+    }
+// ---------------------------------------------------------------------------
+// Handle collection messages.
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::HandleCollectionMessageL( CMPXMessage* aMsg )
+    {
+    MPX_DEBUG1("--->CMCPMusicPlayer::HandleCollectionMessageL()");
+    TMPXMessageId messageId = aMsg->ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId );
+    if ( messageId == KMPXMessageGeneral )
+        {
+        DoHandleGeneralMessageL( *aMsg );
+        }
+    MPX_DEBUG1("<---CMCPMusicPlayer::HandleCollectionMessageL()");
+    }
+// ---------------------------------------------------------------------------
+// Handle collection general message.
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::DoHandleGeneralMessageL(const CMPXMessage& aMsg)
+    {
+    TInt event = aMsg.ValueTObjectL<TInt> ( KMPXMessageGeneralEvent );
+    TInt type = aMsg.ValueTObjectL<TInt> ( KMPXMessageGeneralType );
+    MPX_DEBUG3("--->CMCPMusicPlayer::DoHandleGeneralMessageL(), event = %d, type = %d", event, type);
+
+    if ( event == TMPXCollectionMessage::EBroadcastEvent
+        && ( type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart ))
+        {
+        iUSBOnGoing = ETrue;
+        MPX_DEBUG2("CMCPMusicPlayer::DoHandleGeneralMessageL(), iUSBOnGoing changed to: %d", iUSBOnGoing );
+        UpdateToolBarL( TBK::KSkeep_L_dimmed |
+                TBK::KPlay_dimmed |
+                TBK::KSkeep_R_dimmed );
+        if ( IsOKToPublishData() )
+            {
+            InstallGoToNowPlayingL( EMusicMenuMusicInfoTrigger );
+            }
+        }
+    else if ( event == TMPXCollectionMessage::EBroadcastEvent
+            && ( type == EMcMsgUSBMassStorageEnd || type == EMcMsgUSBMTPEnd ))
+        {
+        iUSBOnGoing = EFalse;
+        MPX_DEBUG2("CMCPMusicPlayer::DoHandleGeneralMessageL(), iUSBOnGoing changed to: %d", iUSBOnGoing );
+        DoUpdatePlayerStateL( iEngine->PlayerState() );
+        if ( IsOKToPublishData() )
+            {
+            iMHObserver->PublishTextL( this, EMusicWidgetDefaultText,
+                    KEmpty );
+            InstallGoToLastPlayedL( EMusicMenuMusicInfoTrigger, ETrue );
+            iMHObserver->PublishTextL( this, EMusicMenuMusicInfoLine1,
+                    KLastPlayed );
+            DoUpdateTrackInfoL( iEngine->TitleL(), iEngine->Artist() );
+            DoUpdateAlbumArtL( iArtCached ? iCachedArtBitmap : iArtBitmap );
+            }
+        }
+    MPX_DEBUG3("<---CMCPMusicPlayer::DoHandleGeneralMessageL(), event = %d, type = %d", event, type);
+    }
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ---------------------------------------------------------------------------  
+//
+void CMCPMusicPlayer::HandleOpenL( const CMPXMedia& /*aEntries*/,
+        TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/ )
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::HandleOpenL( const CMPXCollectionPlaylist& /*aPlaylist*/,
+        TInt /*aError*/ )
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionMediaObserver
+// ---------------------------------------------------------------------------
+void CMCPMusicPlayer::HandleCollectionMediaL( const CMPXMedia& /*aMedia*/, TInt /*aError*/ )
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MPNSMonitorObserver
+// ---------------------------------------------------------------------------
+// 
+void CMCPMusicPlayer::OpeningMusicPlayer()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::OpeningMusicPlayer <---");
+    // in this position, iActive is EFalse, so we can not call function
+    // DoHandleOpeningL() directly.
+    TRAP_IGNORE( 
+            iMHObserver->PublishTextL( this,
+                    EMusicWidgetText1,
+                    iOpeningBuffer->Des() ) );
+    
+    TCallBack cb( MusicPlayerOpeningTimerCallback, this );
+    iMusicPlayerOpeningTimer->Cancel();
+    iMusicPlayerOpeningTimer->Start( KMusicPlayerOpeningTimerInterval,
+            KMusicPlayerOpeningTimerInterval, cb );
+
+    MPX_DEBUG1("CMCPMusicPlayer::OpeningMusicPlayer --->");
+    }
+
+// ----------------------------------------------------------------------------
+// Music Player opening timer callback
+// ----------------------------------------------------------------------------
+//
+TInt CMCPMusicPlayer::MusicPlayerOpeningTimerCallback( TAny* aPtr )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback <---");
+    RWsSession wsSession;
+    TInt error = wsSession.Connect();
+    if ( error != KErrNone )
+        {
+        return error;
+        }
+    
+    TBool taskExists( EFalse );
+    CAknTaskList* taskList( NULL );
+    TRAPD( err, taskList = CAknTaskList::NewL( wsSession ) );
+    if ( err == KErrNone )
+        {
+        MPX_DEBUG2("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback "
+                "error = %d occur when creating CAknTaskList", err);
+        TApaTask task = taskList->FindRootApp( TUid::Uid( KMusicPlayerAppUidAsTInt ) );
+        delete taskList;
+        taskExists = task.Exists();
+        }
+    wsSession.Close();
+    
+    if ( !taskExists )
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback Music Player not opened");
+        //Reset the widget and menu, music player is not running
+        TRAP_IGNORE( static_cast<CMCPMusicPlayer*>(aPtr)->ResetL() );
+        }
+    static_cast<CMCPMusicPlayer*>(aPtr)->iMusicPlayerOpeningTimer->Cancel();
+    
+    MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback --->");
+    return KErrNone;
+    }
+ //  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/src/pnsmonitor.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors the file system for changes in a file.
+*
+*/
+
+
+#include <mpxlog.h>
+#include <mpxconstants.h>
+
+#include "pnsmonitor.h"
+#include "pnsmonitorobserver.h"
+
+// RProperty key to identify the case when Music Player launching
+// in the background
+const TInt KMPXLaunchingOnBackground( 100 );
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CPNSMonitor::CPNSMonitor( MPNSMonitorObserver& aObserver )
+        : CActive( CActive::EPriorityLow ),
+        iObserver( aObserver )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Second Phase Constructor
+// ---------------------------------------------------------------------------
+//
+void CPNSMonitor::ConstructL()
+    {
+    User::LeaveIfError( iPropertyHandler.Attach( KAppUidMusicPlayerX,
+            KMPXLaunchingOnBackground ) );
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CPNSMonitor* CPNSMonitor::NewL( MPNSMonitorObserver& aObserver )
+    {
+    CPNSMonitor* self = new( ELeave ) CPNSMonitor( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CPNSMonitor::~CPNSMonitor()
+    {
+    Cancel();
+    iPropertyHandler.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Starts monitoring
+// ---------------------------------------------------------------------------
+//
+void CPNSMonitor::Start()
+    {
+    MPX_DEBUG1("CPNSMonitor::Start <---");
+    iPropertyHandler.Subscribe( iStatus );
+    SetActive();
+    MPX_DEBUG1("CPNSMonitor::Start --->");
+    }
+
+// ---------------------------------------------------------------------------
+// RunL callback
+// ---------------------------------------------------------------------------
+//
+void CPNSMonitor::RunL()
+    {
+    MPX_DEBUG1("CPNSMonitor::RunL <---");
+    TInt ret( 0 );
+    TInt err = RProperty::Get( KAppUidMusicPlayerX,
+                KMPXLaunchingOnBackground,
+                ret );
+
+    if ( ret )
+        {
+        iObserver.OpeningMusicPlayer();
+        MPX_DEBUG1("CPNSMonitor::RunL - Opening Music Player on the background");
+        }
+    
+	// Listen again
+    Start();
+    
+    MPX_DEBUG1("CPNSMonitor::RunL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle Cancelling
+// ---------------------------------------------------------------------------
+//
+void CPNSMonitor::DoCancel()
+    {
+    MPX_DEBUG1("CPNSMonitor::DoCancel <---");
+    // Stop monitoring
+    iPropertyHandler.Cancel();
+    MPX_DEBUG1("CPNSMonitor::DoCancel --->");
+    }
+
+// ----------------------------------------------------------------------------
+// Handles a leave occurring in the request completion event handler RunL()
+// ----------------------------------------------------------------------------
+//
+TInt CPNSMonitor::RunError( TInt aError )
+    {
+    MPX_DEBUG2("CPNSMonitor::RunError(%d)", aError );
+   
+    // Listen again
+    Start();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mcpmusicplayer/src/proxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player MCP Plugin Implementation Proxy
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "mcpmusicplayer.h"
+#include "mcpmusicplayeruids.hrh"
+
+// ---------------------------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KMCPMusicPlayerUID,
+            CMCPMusicPlayer::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// Exported proxy for instantiation method resolution
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+        TInt& aTableCount )
+    {
+    aTableCount =
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+
+    return ImplementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mpxcollectionpublisher/data/mpxcollectionpublisher.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM registration for Music Content Publisher
+*
+*/
+
+
+#include <registryinfo.rh>
+#include <contentharvesterpluginuids.hrh>
+#include "mpxcollectionpublisheruids.hrh"
+
+// ---------------------------------------------------------------------------
+// MpxCollectionPublisherPluginInfo
+// Declares info for implementation of the plugin
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO MpxCollectionPublisherPluginInfo
+    {
+    // UID for the DLL
+    dll_uid = KMpxCollectionPublisherDLL;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = KContentHarvesterPluginUid;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMpxCollectionPublisherUID; 
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mpxcollectionpublisher/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Music Content Publisher.
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/mpxcollectionpublisher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(mpxcollectionpublisher.iby)
+
+PRJ_MMPFILES
+mpxcollectionpublisher.mmp
+
+PRJ_TESTMMPFILES
+PRJ_TESTEXPORTS
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mpxcollectionpublisher/group/mpxcollectionpublisher.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for Music Content Publisher.
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include "../inc/mpxcollectionpublisheruids.hrh"
+
+TARGET                  mpxcollectionpublisher.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D KMpxCollectionPublisherDLL
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  proxy.cpp
+SOURCE                  mpxcollectionpublisher.cpp
+
+USERINCLUDE             ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+USERINCLUDE             ../../inc
+
+SOURCEPATH              ../data
+START RESOURCE          mpxcollectionpublisher.rss 
+HEADER
+TARGET                  mpxcollectionpublisher.rsc
+TARGETPATH              resource/plugins 
+END
+
+LIBRARY                 ecom.lib
+LIBRARY                 euser.lib
+LIBRARY                 liwservicehandler.lib     // TLiwVariant
+LIBRARY                 mpxcollectionutility.lib
+LIBRARY                 mpxcommon.lib
+LIBRARY                 mpxcollectionhelper.lib  
+
+//  End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mpxcollectionpublisher/inc/mpxcollectionpublisher.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages MCP plugins, and content publishing.
+*
+*/
+
+
+#ifndef C_MUSICCONTENTPUBLISHER_H
+#define C_MUSICCONTENTPUBLISHER_H 
+
+#include <contentharvesterplugin.h>
+#include <mpxcollectionobserver.h>
+
+class MLiwInterface;
+class CLiwGenericParamList;
+
+// FORWARD DECLARATIONS
+class MMPXCollectionUtility;
+class MMPXCollectionUiHelper;
+class CMPXCollectionPath;
+
+/**
+ *  Music Content Publisher (a Content Harvester plugin)
+ *
+ *  @lib musiccontentpublisher.dll
+ *  @since S60 S60 v5.0
+ */
+class CMpxCollectionPublisher : public CContentHarvesterPlugin
+                               ,public MMPXCollectionObserver
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CMpxCollectionPublisher* NewL( MLiwInterface* aCPSInterface );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMpxCollectionPublisher();
+
+    // from base class CContentHarvesterPlugin
+    /**
+     * From CContentHarvesterPlugin
+     * This is called by the Content Harvester Server to signal an update. 
+     */
+    void UpdateL();
+    
+    //From Base class MMPXCollectionMediaObserver
+    /**
+     * From MMPXCollectionMediaObserver 
+     * It handles open collection event.
+     */
+    void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, 
+    		 TBool aComplete, TInt  aError );
+    
+    /**
+     * From MMPXCollectionMediaObserver 
+     * It handles open collection event.
+     */                
+    void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist,
+    		 TInt aError ); 
+    
+    /**
+     * From MMPXCollectionMediaObserver 
+     * It handles MediaL event.
+     *
+     * @param aMedia object containing collection's informations
+     * @param aError error code
+     */
+    void HandleCollectionMediaL( const CMPXMedia& aMedia,
+    		TInt aError );
+    
+    /** 
+    *  Handle collection message
+    * 
+    *  @param aMsg collection message, ownership not transferred. 
+    *         Please check aMsg is not NULL before using it. 
+    *         If aErr is not KErrNone, plugin might still call back with more
+    *         info in the aMsg.
+    *  @param aErr system error code.
+    */
+    void HandleCollectionMessage( CMPXMessage* aMsg, TInt /*aErr*/);
+        
+
+
+private:
+
+    /**
+     * Default constructor.
+     */
+    CMpxCollectionPublisher( MLiwInterface* aCPSInterface );
+
+    /**
+     * Perform the second phase construction 
+     */
+    void ConstructL();
+    
+    /**
+	 * Logic of HandleCollectionMessage, to avoid the function leaves
+	 */
+	void DoHandleGeneralMessageL(const CMPXMessage& aMsg);
+
+	/**
+	 * Logic of HandleCollectionMessage, to avoid the function leaves
+	 * it handles item change operation
+	 */
+	void DoHandleItemChangedMessageL(const CMPXMessage& aMsg);   
+    
+	/**
+	 * Logic of HandleCollectionMessageL, to avoid the function leaves
+	 */
+	void HandleCollectionMessageL(CMPXMessage* aMsg);  		
+	
+    /**
+     * Called when a number needs to be updated.
+	 *
+	 * @since S60 5.0
+	 * @param aNum containing the number.
+	 */
+	void PublishNumberL( const TInt aNumb );
+
+private: // data
+
+    /**
+     * Instance of CPS interface used for update with CPS.
+     * Not own
+     */
+    MLiwInterface* iCPSInterface;
+    
+    /**
+    * MPX Collection utility
+    * Own.
+    */
+    MMPXCollectionUtility* iCollectionUtility;
+    
+    /**
+    * MPX Collection helper
+    * Own.
+    */
+    MMPXCollectionUiHelper* iCollectionUiHelper;
+    
+    /**
+     * Path to Music collection
+     * Own.
+     */
+    CMPXCollectionPath* iAllSongsPath;
+
+	/**
+	* Indicates whether we're in a massive refresh operation
+	*/
+	TBool iRefreshOperation;
+	
+    /**
+    * Array containig wanted collection attributes
+    * Own.
+    */	    
+	RArray<TMPXAttribute> iDefaultAttrs;
+
+    };
+
+#endif // C_MUSICCONTENTPUBLISHER_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mpxcollectionpublisher/inc/mpxcollectionpublisheruids.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for Music Content Publisher
+*
+*/
+
+
+#ifndef MPXCOLLECTIONPUBLISHERUIDS_H_
+#define MPXCOLLECTIONPUBLISHERUIDS_H_
+
+/** Ecom implementation uid for Music Player Action Handler Plugin */
+#define KMpxCollectionPublisherUID 0x10207C1A
+
+/** Ecom dll uid for Music Player Action Handler Plugin */
+#define KMpxCollectionPublisherDLL 0x10207C1D
+
+#endif /*MPXCOLLECTIONPUBLISHERUIDS_H_*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mpxcollectionpublisher/rom/mpxcollectionpublisher.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Mpx Collection Publisher
+*
+*/
+
+
+#ifndef MPXCOLLECTIONPUBLISHER_IBY
+#define MPXCOLLECTIONPUBLISHER_IBY
+
+ECOM_PLUGIN(mpxcollectionpublisher.dll, mpxcollectionpublisher.rss)
+
+#endif // MPXCOLLECTIONPUBLISHER_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mpxcollectionpublisher/src/mpxcollectionpublisher.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,299 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages MCP plugins, and content publishing.
+*
+*/
+
+
+#include <LiwServiceHandler.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxmessagecontainerdefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionmessage.h>
+
+#include "cpglobals.h" //This will be moved to domain API (HSFW)
+#include "mpxcollectionpublisher.h"
+
+
+
+_LIT8( KMCPDataKey,"musicmenu_collectioninfo_numb1data" );
+_LIT( KMCPublisher, "MpxCollectionPublisher" );
+_LIT( KMCPType,"integer" );
+_LIT( KMCPContent,"musicmenu_collectioninfo_numb1" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMpxCollectionPublisher::CMpxCollectionPublisher(
+        MLiwInterface* aCPSInterface ) : iRefreshOperation( EFalse )
+	{
+	iCPSInterface = aCPSInterface;
+
+	}
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMpxCollectionPublisher::ConstructL()
+    {
+    iDefaultAttrs.Append( KMPXMediaColDetailNumberOfItems );
+    iCollectionUiHelper = 
+            CMPXCollectionHelperFactory:: NewCollectionUiHelperL();      
+	iCollectionUtility = 
+	        MMPXCollectionUtility::NewL( this, KMcModeIsolated );
+    
+	TUid collection = KLocalCollection;
+	collection = iCollectionUtility->
+                    Collection().CollectionIDL( collection );
+    iCollectionUtility->Collection().CommandL( EMcCmdCollectionInit, 
+                                               collection.iUid );
+	//music
+    iAllSongsPath = iCollectionUiHelper->MusicAllSongsPathL();
+    iCollectionUtility->Collection().CancelRequest();
+    iCollectionUtility->Collection().MediaL( *iAllSongsPath , 
+    	        iDefaultAttrs.Array());
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMpxCollectionPublisher* CMpxCollectionPublisher::NewL(  
+        MLiwInterface* aCPSInterface )
+    {
+    CMpxCollectionPublisher* self = 
+            new ( ELeave ) CMpxCollectionPublisher( aCPSInterface );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMpxCollectionPublisher::~CMpxCollectionPublisher()
+    {
+    if ( iCollectionUiHelper )
+		{
+		iCollectionUiHelper->Close();
+		}
+
+	if ( iCollectionUtility )
+		{
+		iCollectionUtility->Close();
+		}
+	iDefaultAttrs.Close();
+	delete iAllSongsPath;
+    }
+
+  
+void CMpxCollectionPublisher::UpdateL() 
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// empty
+// ---------------------------------------------------------------------------
+// 	    
+void CMpxCollectionPublisher::HandleOpenL( const CMPXMedia& /* aMedia */,
+            TInt /* aIndex */,
+    		TBool /* aComplete */,TInt /* aError */  )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// empty
+// ---------------------------------------------------------------------------
+//     					
+void CMpxCollectionPublisher::HandleOpenL( 
+            const CMPXCollectionPlaylist& /* aPlaylist */, 
+            TInt /* aError */)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles MediaL
+// ---------------------------------------------------------------------------
+// 
+void CMpxCollectionPublisher::HandleCollectionMediaL( const CMPXMedia& aMedia,
+		TInt aError )
+	{
+	if (KErrNone == aError && 
+	        aMedia.IsSupported( KMPXMediaColDetailNumberOfItems ) )
+		{
+		TInt numberOfSongs = 
+		       aMedia.ValueTObjectL<TBool>( KMPXMediaColDetailNumberOfItems );
+        PublishNumberL( numberOfSongs );
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// Handle collection messages.
+// ---------------------------------------------------------------------------
+//
+void CMpxCollectionPublisher::HandleCollectionMessageL( CMPXMessage* aMsg )
+    {       
+    TMPXMessageId messageId = 
+            aMsg->ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId );
+    if ( messageId == KMPXMessageGeneral )        
+        {          
+        DoHandleGeneralMessageL( *aMsg );   
+        } 
+    else if( messageId == KMPXMessageIdItemChanged )
+        {
+        // Loop through messages for arrays.
+        //
+        if ( aMsg->IsSupported( KMPXMessageArrayContents ) )
+            {
+			CMPXMessageArray* messageArray =
+                    aMsg->Value<CMPXMessageArray>( KMPXMessageArrayContents );
+							
+            User::LeaveIfNull( messageArray ); 
+            for( TInt i=0; i<messageArray->Count(); ++i )
+                {
+                HandleCollectionMessage( (*messageArray)[i], KErrNone);  
+                } 
+            }            
+        else // Single item
+            {                
+            DoHandleItemChangedMessageL( *aMsg ) ;                
+            }                
+        }                     
+    }     
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection messages.
+// ---------------------------------------------------------------------------
+//
+void CMpxCollectionPublisher::HandleCollectionMessage( CMPXMessage* aMsg, 
+                                                  TInt aError )
+    {
+	if ( aError == KErrNone && aMsg )
+		{
+        TRAP_IGNORE( HandleCollectionMessageL( aMsg ) );
+        }
+    }  
+
+// ---------------------------------------------------------------------------
+// Handle item change message.
+// ---------------------------------------------------------------------------
+//
+void CMpxCollectionPublisher::DoHandleItemChangedMessageL( 
+                                                    const  CMPXMessage& aMsg )
+    {
+    TMPXChangeEventType eventType( 
+            aMsg.ValueTObjectL<TMPXChangeEventType>( 
+                        KMPXMessageChangeEventType ) );
+    TMPXItemId itemId( 
+            aMsg.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId ) );
+  
+    if ( !iRefreshOperation && 
+          ( eventType == EMPXItemDeleted || eventType == EMPXItemInserted ) ) 
+        { 
+        //everytime an item is changed we need to refresh data
+        iCollectionUtility->Collection().CancelRequest();
+        iCollectionUtility->Collection().MediaL( *iAllSongsPath , 
+        	        iDefaultAttrs.Array() );
+        }                           
+        
+    } 
+
+// ---------------------------------------------------------------------------
+// Handle collection general message.
+// ---------------------------------------------------------------------------
+//
+void CMpxCollectionPublisher::DoHandleGeneralMessageL(  
+        const CMPXMessage& aMsg )
+    {
+    TInt event = aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralEvent );
+    TInt type = aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralType ); 
+    
+      
+    if ( event == TMPXCollectionMessage::EBroadcastEvent && 
+         ( type == EMcMsgRefreshStart || type == EMcMsgFormatStart ||             
+          type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart )         
+         )
+        {
+        //if refresh operation starts we block until refresh ends
+        iRefreshOperation = ETrue;
+        iCollectionUtility->Collection().CancelRequest(); 
+        }
+    else if ( event == TMPXCollectionMessage::EBroadcastEvent && 
+              ( type == EMcMsgRefreshEnd || type == EMcMsgFormatEnd ||
+               type == EMcMsgDiskRemoved || type == EMcMsgDiskInserted ||
+               type == EMcMsgUSBMassStorageEnd || type == EMcMsgUSBMTPEnd )
+            )
+        {
+        iRefreshOperation = EFalse;
+        iCollectionUtility->Collection().CancelRequest();
+        iCollectionUtility->Collection().MediaL( *iAllSongsPath , 
+        	        iDefaultAttrs.Array() );
+        }                       
+    }       
+
+// ---------------------------------------------------------------------------
+// Publishes a number to the required destination
+// ---------------------------------------------------------------------------
+//
+
+void CMpxCollectionPublisher::PublishNumberL( const TInt aNumb )
+	{
+	if ( iCPSInterface )
+		{
+		CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
+		CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+
+		TLiwGenericParam cptype( KType, TLiwVariant( KCpData ) );
+		inParam->AppendL( cptype );
+		CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC();
+		CLiwDefaultMap * map = CLiwDefaultMap::NewLC();
+
+		map->InsertL( KMCPDataKey, TLiwVariant( TInt32( aNumb ) ) );
+
+		cpdatamap->InsertL( KPublisherId, TLiwVariant( KMCPublisher ) );
+		cpdatamap->InsertL( KContentType, TLiwVariant( KMCPType ) );
+		cpdatamap->InsertL( KContentId, TLiwVariant( KMCPContent ) );
+		cpdatamap->InsertL( KDataMap, TLiwVariant( map ) );
+
+		TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) );
+		inParam->AppendL( item );
+
+		iCPSInterface->ExecuteCmdL( KAdd, *inParam, *outParam );
+
+		CleanupStack::PopAndDestroy( map );
+		CleanupStack::PopAndDestroy( cpdatamap );
+		CleanupStack::PopAndDestroy( outParam );
+		CleanupStack::PopAndDestroy( inParam );
+		}
+	}
+
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/mpxcollectionpublisher/src/proxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Content Publisher Implementation Proxy
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "mpxcollectionpublisher.h"
+#include "mpxcollectionpublisheruids.hrh"
+
+// ---------------------------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KMpxCollectionPublisherUID,
+            CMpxCollectionPublisher::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// Exported proxy for instantiation method resolution
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+        TInt& aTableCount )
+    {
+    aTableCount =
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+
+    return ImplementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/data/musiccontentpublisher.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM registration for Music Content Publisher
+*
+*/
+
+
+#include <registryinfo.rh>
+#include <contentharvesterpluginuids.hrh>
+#include "musiccontentpublisheruids.hrh"
+
+// ---------------------------------------------------------------------------
+// MCPPluginInfo
+// Declares info for implementation of the plugin
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO MCPPluginInfo
+    {
+    // UID for the DLL
+    dll_uid = KMusicContentPublisherDLL;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = KContentHarvesterPluginUid;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMusicContentPublisherUID; 
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Music Content Publisher.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/musiccontentpublisher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musiccontentpublisher.iby)
+
+PRJ_MMPFILES
+musiccontentpublisher.mmp
+
+PRJ_TESTMMPFILES
+PRJ_TESTEXPORTS
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/group/musiccontentpublisher.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for Music Content Publisher.
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include "../inc/musiccontentpublisheruids.hrh"
+
+TARGET                  musiccontentpublisher.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D KMusicContentPublisherDLL
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  musiccontentpublisher.cpp
+SOURCE                  proxy.cpp
+SOURCE                  pluginmanager.cpp
+SOURCE                  mcpharvesterpublisherobserver.cpp
+USERINCLUDE             ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+USERINCLUDE             ../../inc
+
+SOURCEPATH              ../data
+START RESOURCE          musiccontentpublisher.rss 
+HEADER
+TARGET                  musiccontentpublisher.rsc
+TARGETPATH              resource/plugins 
+END
+
+LIBRARY                 ecom.lib
+LIBRARY                 euser.lib
+LIBRARY                 liwservicehandler.lib   // TLiwVariant
+LIBRARY                 fbscli.lib
+LIBRARY                 aknskins.lib
+LIBRARY                 cone.lib
+LIBRARY                 aknicon.lib
+LIBRARY                 aknskinsrv.lib
+LIBRARY                 efsrv.lib
+LIBRARY                 bafl.lib
+LIBRARY                 estor.lib
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/inc/mcpharvesterpublisherobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,126 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Updates applications and icons in Operator Tile.
+*
+*/
+
+
+#ifndef C_MCPHARVESTERPUBLISHEROBSERVER_H
+#define C_MCPHARVESTERPUBLISHEROBSERVER_H 
+
+#include <e32base.h>
+#include <LiwCommon.h>
+
+// FORWARD DECLARATIONS
+class CMusicContentPublisher;
+class CLiwServiceHandler;
+// CONSTANTS
+
+// CLASS DECLARATION
+/**
+ */
+
+class CMCPHarvesterPublisherObserver : public CBase, public MLiwNotifyCallback
+	{
+	public: // Constructors and destructor
+		/**
+		 * Two-phased constructor.
+		 */
+		static CMCPHarvesterPublisherObserver* NewL( CMusicContentPublisher* aHarvester );
+
+		/**
+		 * Two-phased constructor.
+		 */
+		static CMCPHarvesterPublisherObserver* NewLC( CMusicContentPublisher* aHarvester );
+		
+		/**
+		 * Destructor.
+		 */
+		virtual ~CMCPHarvesterPublisherObserver();
+
+
+
+	public:  //from MLiwNotifyCallback
+	    
+	    /**
+	    * Handles notifications caused by an asynchronous Execute*CmdL call
+	    * or an event.
+	    *
+	    * @param aCmdId The service command associated to the event.
+	    * @param aEventId Occured event, see LiwCommon.hrh.
+	    * @param aEventParamList Event parameters, if any, as defined per
+	    *        each event.
+	    * @param aInParamList Input parameters, if any, given in the
+	    *        related HandleCommmandL.
+	    * @return Error code for the callback.
+	    */
+	    virtual TInt HandleNotifyL(
+	        TInt aCmdId,
+	        TInt aEventId,
+	        CLiwGenericParamList& aEventParamList,
+	        const CLiwGenericParamList& aInParamList);
+	
+	public:
+	    
+	    /**
+	    * Registers to CPS for add, delete , update and execute notifications
+	    * @aFilter - filter for input parameter list
+	    * @return void.
+	    */
+	    void RegisterL( CLiwDefaultMap* aFilter );
+	    
+	    
+	private:
+	    /**
+        * Perform the second phase construction 
+        */      
+        void ConstructL();
+        
+        /**
+		* Default constructor.
+		*/
+		CMCPHarvesterPublisherObserver( CMusicContentPublisher* aHarvester );
+		
+		// Prhohibited
+		CMCPHarvesterPublisherObserver();
+
+	    /**
+	    * Cancel all the registered notifications. 
+	    * @return void.
+	    */
+	    void ReleaseL();
+	    
+	    void InitLiwL();
+	    
+	    void ReleaseLiw();
+		
+	private: // data
+	        
+	    // Reference of 
+	    // Owned
+	    MLiwInterface* iInterface;
+	    
+	    // Reference of 
+	    // Owned
+	    CLiwServiceHandler* iLiwHandler;	            
+	            
+	    // Reference of the sapi data
+	    // Not owned
+	    CMusicContentPublisher* iHarvester;
+	    
+	    // Call back error code
+	    TInt iError;
+    };
+
+#endif // C_MCPHARVESTERPUBLISHEROBSERVER_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/inc/musiccontentpublisher.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,403 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages MCP plugins, and content publishing.
+*
+*/
+
+
+#ifndef C_MUSICCONTENTPUBLISHER_H
+#define C_MUSICCONTENTPUBLISHER_H 
+
+#include <contentharvesterplugin.h>
+#include <mcppluginobserver.h>
+#include <libc/stddef.h>  // For wchar_t
+#include <e32hashtab.h>
+#include <AknsSrvClient.h>
+
+class MLiwInterface;
+class CLiwGenericParamList;
+class CPluginManager;
+class CFbsBitmap;
+class CCoeEnv;
+class TAknsItemID;
+class CMCPHarvesterPublisherObserver;
+
+
+struct TMCPDestinationItem
+    {
+    const TInt id;
+    const wchar_t* type;
+    const char* dataKey;
+    const wchar_t* content;
+    };
+
+struct TMCPImageDestinationInfoItem
+    {
+    const TMCPImageDestination id;
+    const TInt sizex;
+    const TInt sizey;
+    };
+
+
+struct TBmpMsk
+    {
+    CFbsBitmap *bitmap;
+    CFbsBitmap *mask;
+    };
+
+struct TMyBufferItem
+    {
+    TAny* buf;
+    TInt size;
+    };
+
+
+const TMCPDestinationItem KMCPDestinationInfo[] =
+    {
+     { EMusicWidgetImage1,      L"image", "area1_image1_data", L"area1_image1_content" }
+    ,{ EMusicWidgetText1,       L"text",  "area2_text1_data",  L"area2_text1_content"  }
+    ,{ EMusicWidgetToolbarB1,   L"image", "toolbar_b1_data",   L"toolbar_b1_content"   }
+    ,{ EMusicWidgetToolbarB2,   L"image", "toolbar_b2_data",   L"toolbar_b2_content"   }
+    ,{ EMusicWidgetToolbarB3,   L"image", "toolbar_b3_data",   L"toolbar_b3_content"   }
+    ,{ EMusicWidgetDefaultText, L"text",  "default_text_data", L"default_text_content" }
+    ,{ EMusicWidgetTrigger1,    L"image", "MWTrigger1",        L"area1_image1_content" }
+    ,{ EMusicWidgetTrigger2,    L"text",  "MWTrigger2",        L"default_text_content" }
+    ,{ EMusicWidgetTB1Trigger,  L"image", "TB1Trigger",        L"toolbar_b1_content" }
+    ,{ EMusicWidgetTB2Trigger,  L"image", "TB2Trigger",        L"toolbar_b2_content" }
+    ,{ EMusicWidgetTB3Trigger,  L"image", "TB3Trigger",        L"toolbar_b3_content" }
+            
+    ,{ EMusicMenuMusicInfoImage1,   L"image",  "musicmenu_musicinfo_imagedata", L"musicmenu_musicinfo_image" }
+    ,{ EMusicMenuMusicInfoLine1,        L"text",   "musicmenu_musicinfo_text1data",  L"musicmenu_musicinfo_text1" }
+    ,{ EMusicMenuMusicInfoLine2,        L"text",   "musicmenu_musicinfo_text2data",  L"musicmenu_musicinfo_text2" }
+    ,{ EMusicMenuMusicInfoTrigger, L"text",   "MMInfoTrigger",  L"musicmenu_musicinfo_text1" }
+    };
+
+
+const TMCPImageDestinationInfoItem KMCPImageDestinationInfo[] =
+
+    {
+        {EMusicWidgetImage1, 70,70}
+    ,
+        {EMusicWidgetToolbarB1, 41,41}
+    ,
+        {EMusicWidgetToolbarB2, 41,41}
+    ,
+        {EMusicWidgetToolbarB3, 41,41}
+    ,
+        {EMusicMenuMusicInfoImage1, 70,70} 
+    };
+
+/**
+ *  Music Content Publisher (a Content Harvester plugin)
+ *
+ *  @lib musiccontentpublisher.dll
+ *  @since S60 S60 v5.0
+ */
+class CMusicContentPublisher : public CContentHarvesterPlugin
+                       ,public MMCPPluginObserver
+                       ,public MAknsSkinChangeObserver
+    {
+
+public:
+
+// from base class MMCPPluginObserver
+    /**
+     * from MMCPPluginObserver
+     * Called when an image needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the image is to be placed.
+     * @param aImagePath Source path of the Image.
+     */
+    void PublishImageL(CMCPPlugin* aPlugin,
+            TMCPImageDestination aDestination, const TDesC& aImagePath);
+
+    /**
+     * from MMCPPluginObserver
+     * Called when an image needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the image is to be placed.
+     * @param aBitmapHandle Bitmap handle to the image.
+     * @param aMaskBitmapHandle Mask Bitmap handle for the image.
+     */
+    void PublishImageL(CMCPPlugin* aPlugin, 
+            TMCPImageDestination aDestination,
+            TInt aBitmapHandle,
+            TInt aMaskBitmapHandle = NULL);
+    
+    /**
+     * from MMCPPluginObserver
+     * Called when an image needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the image is to be placed.
+     * @param aID major and minor Skin ID info.
+     * @param aFilename fallback mif/mbm file.
+     * @param aFileBitmapId bitmap id within the fallback file.
+     * @param aFileMaskId mask id within the fallback file.
+     */
+    void PublishImageL(CMCPPlugin* aPlugin, 
+            TMCPImageDestination aDestination,
+            const TAknsItemID& aID,
+            const TDesC& aFilename,
+            const TInt aFileBitmapId,
+            const TInt aFileMaskId );
+
+    /**
+     * from MMCPPluginObserver
+     * Called when a text needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the text is to be placed.
+     * @param aText Descriptor containing the text.
+     */
+    void PublishTextL( CMCPPlugin* aPlugin, 
+            TMCPTextDestination aDestination, const TDesC& aText );
+
+    /**
+     * from MMCPPluginObserver
+     * Called when an action needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Destination trigger that should launch the action.
+     * @param aTrigerMap LIW Map containint the action that can be interpreted
+     * by the specified action handler plugin.
+     */
+    void PublishActionL( CMCPPlugin* aPlugin, 
+            TMCPTriggerDestination aDestination, 
+            CLiwDefaultMap* aTrigerMap );
+    
+    /**
+     * from MMCPPluginObserver
+     * Called when a plugin becomes active.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     */
+    void BecameActiveL( CMCPPlugin* aPlugin );
+    
+    /**
+     * from MMCPPluginObserver
+     * Called when a plugin becomes active.
+     *
+     * @since S60 5.0
+     * @param aDst The image destination.
+     * @return The size of the image destination.
+     */
+    TSize GetImageDestinationSize(TMCPImageDestination aDst);
+    
+    /**
+     * From MAknsSkinChangeObserver.
+     * Called by the skin server when skin content is changed and the
+     * connected client wants to be informed.
+     *
+     * @since 2.0
+     */
+    void SkinContentChanged();
+
+    /**
+     * From MAknsSkinChangeObserver.
+     * Called by the skin server to indicate that the current skin
+     * configuration has changed.
+     *
+     * @param aReason Reason code.
+     *
+     * @since 2.5
+     */
+    void SkinConfigurationChanged(
+            const TAknsSkinStatusConfigurationChangeReason /*aReason*/){};
+
+    /**
+     * From MAknsSkinChangeObserver.
+     * Called by the skin server to indicate that the available
+     * skin packages have changed.
+     *
+     * @param aReason Reason code.
+     *
+     * @since 2.5
+     */
+    void SkinPackageChanged(const TAknsSkinStatusPackageChangeReason /*aReason*/){};
+
+    void HandlePublisherNotificationL( const TDesC& aContentId, const TDesC8& aTrigger );
+    /**
+     * Two-phased constructor.
+     */
+    static CMusicContentPublisher* NewL( MLiwInterface* aCPSInterface );
+
+
+
+    // from base class CContentHarvesterPlugin
+    /**
+     * From CContentHarvesterPlugin
+     * This is called by the Content Harvester Server to signal an update. 
+     */
+    void UpdateL();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CMusicContentPublisher();
+    
+    /**
+     * Resets the destinations with default values and removes active plugin.
+     */
+    void ResetL();
+
+private:
+
+    /**
+     * Default constructor.
+     */
+    CMusicContentPublisher( MLiwInterface* aCPSInterface );
+
+    /**
+     * Perform the second phase construction 
+     */
+    void ConstructL();
+    
+    /**
+     * Installs an action, mainly for readability purposes.
+     *
+     * @since S60 5.0
+     * @param aDestination Destination trigger that should launch the action.
+     */
+    void InstallGoToMusicL(TMCPTriggerDestination aDestination);
+    
+    /**
+     * Installs an rmpty action, mainly for readability purposes.
+     *
+     * @since S60 5.0
+     * @param aDestination Destination trigger that should launch the action.
+     */
+    void InstallEmptyActionL(TMCPTriggerDestination aDestination);
+    
+    
+    /**
+     * Maps an enum from TMCPImageDestination, TMCPTextDestination and 
+     * TMCPTriggerDestination to it's keys on CPS.
+     * @param aEnum the enum/destination
+     * @param aType the type key is loaded here
+     * @param aDataKey the data key is loaded here
+     * @param aContent the content key is loaded here
+     *
+     * @since S60 5.0
+     */
+    void MapEnumToDestinationInfoL(TInt aEnum,TPtrC& aType, TPtrC8& aDataKey, 
+            TPtrC& aContent);
+    
+    /**
+     * Resets the Bitmap cache.
+     *
+     * @since S60 5.0
+     */
+    void ResetBitmapCache();
+    
+    /**
+     * Resets the publishing buffers.
+     *
+     * @since S60 5.0
+     */
+    void ResetPublishingBuffers();
+    
+    TUint RegisterPublisherL( 
+        const TDesC& aPublisherId, 
+        const TDesC& aContentId,
+        const TDesC& aContentType, 
+        const TDesC8& aResultType );
+    
+    TUint CMusicContentPublisher::ExtractItemId( const CLiwGenericParamList& aInParamList );
+    
+    /**
+     * Get a heap descriptor from the resource file
+     *
+     * @since S60 5.0
+     */
+    void GetLocalizedStringL(RResourceFile& aResourceFile, HBufC*& aRetBuf,
+            TInt aResourceId);
+    
+    void DoPublishL();
+    
+
+private: // data
+
+    /**
+     * Instance of CPS interface used for update with CPS.
+     * Not own
+     */
+    MLiwInterface* iCPSInterface;
+
+    /**
+     * Creates the plugins and manages the plugins table.
+     * Own.
+     */
+    CPluginManager* iPluginManager;
+    
+    /**
+     * Pointer to the active plugin.
+     * Not own.
+     */    
+    CMCPPlugin* iActivePlugin;
+    
+    /**
+     * mapping for the destination translation.
+     */    
+    RHashMap<TInt, TMCPDestinationItem> iDestinationMap;
+    
+    /**
+     * mapping for the destination  image info translation.
+     */    
+    RHashMap<TInt, TSize> iImageDestinationSizeMap;
+    
+    /**
+     * bitmap cache map.
+     */    
+    RHashMap<TInt, TBmpMsk> iBitmapCache;
+    
+    /**
+     * To keep the unpublished data.
+     */
+    RHashMap<TInt, TMyBufferItem> iPublishingDataBuffers;
+    
+    /**
+     * To keep the unpublished actions.
+     */
+    RHashMap<TInt, TMyBufferItem> iPublishingActionBuffers;
+    
+    /**
+    * Skin server session.
+    */
+    RAknsSrvSession iAknsSrvSession;
+    
+    /**
+    * Buffers for the localized strings
+    */
+    HBufC* iNowPlayingBuffer;
+    HBufC* iLastPlayedBuffer;
+    HBufC* iGoToMusicBuffer;
+
+    CMCPHarvesterPublisherObserver* iHPObserver;
+    TBool iIsPublisherActive;
+
+   
+    };
+
+#endif // C_MUSICCONTENTPUBLISHER_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/inc/musiccontentpublisheruids.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for Music Content Publisher
+*
+*/
+
+
+#ifndef MUSICCONTENTPUBLISHERUIDS_H_
+#define MUSICCONTENTPUBLISHERUIDS_H_
+
+/** Ecom implementation uid for Music Player Action Handler Plugin */
+#define KMusicContentPublisherUID 0x10207C12
+
+/** Ecom dll uid for Music Player Action Handler Plugin */
+#define KMusicContentPublisherDLL 0x10207C13
+
+#endif /*MUSICCONTENTPUBLISHERUIDS_H_*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/inc/pluginmanager.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Plugin manager, responsible to load the plugins.
+*
+*/
+
+
+#ifndef C_PLUGINMANAGER_H
+#define C_PLUGINMANAGER_H
+
+#include <e32base.h>
+#include <e32hashtab.h>
+
+class REComSession;
+class CMusicContentPublisher;
+
+/**
+ *  Plugin manager.
+ *  Class used to manage the the ECOM plugins
+ *  @since S60 S60 v5.0
+ */
+class CPluginManager : public CActive
+    {
+public:
+
+    /**
+     * Standard Symbian 2 phase constructor
+     */
+    static CPluginManager* NewL( TUid aUid, TAny *aParameter , CMusicContentPublisher* aContentPublisher );
+
+    /**
+     * Standard Symbian 2 phase constructor
+     */
+    static CPluginManager* NewLC( TUid aUid, TAny *aParameter , CMusicContentPublisher* aContentPublisher  );
+
+    /**
+     * Standard C++ destructor.
+     */
+    ~CPluginManager();
+
+    /**
+     * Gets plugin with provided UID
+     *
+     * @param aUid required plugin
+     * @return pointer to plugin implementation
+     */
+    TAny* GetImplementation( TUid aUid );
+
+    /**
+     * Gets plugin with provided index
+     *
+     * @param aIndex index of plugin
+     * @return pointer to plugin implementation
+     */
+    TAny* GetImplementation( TInt aIndex );
+
+    /**
+     * Gets number of plugins
+     *
+     * @return number of plugins
+     */
+    TInt GetCount();
+
+protected:
+
+    /**
+     * From CActive, RunL.
+     * Handles the active object’s request completion event
+     */
+    void RunL();
+
+    /**
+     * From CActive, DoCancel.
+     * Implements cancellation of an outstanding request.
+     */
+    void DoCancel();
+
+    /**
+     * From CActive, RunError.
+     * Method called when leave occured in RunL
+     */
+    TInt RunError( TInt aError );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CPluginManager( TUid aUid, TAny *aParameter, CMusicContentPublisher* aContentPublisher );
+
+    /**
+     * Perform the second phase construction of a CPluginManager object.
+     */
+    void ConstructL();
+
+    /**
+     * Loads ECOM plugins
+     */
+    void LoadPluginsL();
+
+    /**
+     * Cleans plugins table;
+     */
+    void CleanPluginsTable();
+
+private: //data
+
+    /**
+     * ECOM handler
+     * Own.
+     */
+    REComSession* iSession;
+
+    /**
+     * Map containing plugins
+     * Own.
+     */
+    RHashMap< TInt32, TAny*> iPluginMap;
+
+    /**
+     * UID of the interface
+     */
+    const TUid iUid;
+
+    /**
+     * Parameter to pass to the object creation method.
+     */
+    TAny* iParameter;
+    
+    /**
+     * Content Publisher / Parent, not owned.
+     */
+    CMusicContentPublisher* iContentPublisher;
+
+    };
+
+#endif // C_PLUGINMANAGER_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/inc/sapidatapluginconst.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content model for data plug-in.
+*
+*/
+
+
+#ifndef SAPIDATAPLUGINCONST_H
+#define SAPIDATAPLUGINCONST_H
+
+#include <aicontentmodel.h>
+//#include "sapidatapluginuids.hrh"
+
+// AI Data Plug-in ECOM implementation UID.
+//const TInt KImplUidDataPlugin = SAPIDP_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_DATAPLUGIN;
+//const TUid KUidDataPlugin = { KImplUidDataPlugin };
+
+// ================================= CONTENT ===================================
+
+/**
+ * Content Model type identifier
+ */
+_LIT(KText ,"text");
+_LIT(KImage, "image");
+_LIT(KPlugin, "plugin");
+
+
+// CPS Constants
+_LIT(KService,         "service");
+_LIT(KInterface,       "interface");
+_LIT(KCommand,         "command");
+_LIT8( KType,          "type");
+_LIT( KCpData,         "cp_data");
+_LIT( KPubData,        "publisher" );
+_LIT8( KFilter,        "filter" );
+_LIT8( KDataMap,       "data_map");
+_LIT8( KActionTrigger, "action_trigger" );
+_LIT8( KGetList ,      "GetList" );
+_LIT( KExecute,       "execute" );
+_LIT8( KRequestNotification, "RequestNotification" );
+_LIT8( KChangeInfo, "change_info" );
+_LIT8( KListMap, "list_map" );
+_LIT8( KPublisherId, "publisher" );
+_LIT8( KContentType, "content_type" );
+_LIT8( KContentId,   "content_id" );
+_LIT8(KResults,      "results");
+_LIT( KAll, "all");
+_LIT8( KOperation, "operation" );
+
+_LIT( KOperationAdd, "add" );
+_LIT( KOperationUpdate, "update" );
+_LIT( KOperationDelete, "delete" );
+_LIT( KOperationExecute, "execute" );
+
+_LIT( KDeActive, "deactive");
+_LIT( KActive, "active");
+_LIT( KSuspend , "suspend");
+_LIT( KResume, "resume");
+
+// reserved extension for retrieving mask handle 
+_LIT8( KMask, "_mask");
+
+// Sapi Data Plugin Constants
+_LIT(KPluginNameSeprator, "/");
+
+/**
+ * Maximum length for the content name
+ */
+const TInt KMaxTypeLength = 8;
+
+/**
+ * Maximum length for the content name
+ */
+const TInt KSAPIContentNameMaxLength = 255;
+
+/**
+ * Maximum length for the content value
+ */
+const TInt KSAPIContentValueMaxLength = 255;
+
+/**
+ * Maximum length for the plugin name
+ */
+const TInt KAiPluginNameMaxLength = 255;
+
+
+#endif /* SAPIDATAPLUGINCONST_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/rom/musiccontentpublisher.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Content Publisher
+*
+*/
+
+
+#ifndef MUSICCONTENTPUBLISHER_IBY
+#define MUSICCONTENTPUBLISHER_IBY
+
+ECOM_PLUGIN(musiccontentpublisher.dll, musiccontentpublisher.rss)
+
+#endif // MUSICCONTENTPUBLISHER_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/src/mcpharvesterpublisherobserver.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,302 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Updates CPS storage
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "mcpharvesterpublisherobserver.h"
+#include "musiccontentpublisher.h"
+#include "sapidatapluginconst.h"
+
+#include <LiwServiceHandler.h>
+#include <LiwVariant.h>
+#include <LiwGenericParam.h>
+
+//#include <cpglobals.h> // CPS string definitions.
+
+// TODO Take these from some common header file!
+// CONTANTS
+/*
+_LIT( KPubData, "publisher" );
+_LIT8( KChangeInfo, "change_info" );
+_LIT8( KType, "type");
+_LIT8( KFilter, "filter" );
+_LIT8( KRequestNotification, "RequestNotification" );
+_LIT8( KContentId,   "content_id" );
+_LIT8( KOperation, "operation" );
+_LIT8( KActionTrigger, "action_trigger" );
+*/
+/**
+ * Maximum length for the content name
+ */
+ /*
+const TInt KSAPIContentNameMaxLength = 255;
+
+*/
+//_LIT8( KCPInterface, "IDataSource" );
+_LIT8( KCPContentInterface, "IContentPublishing" );
+_LIT8( KCPService, "Service.ContentPublishing" );
+_LIT( KMyOperationExecute, "execute" );
+
+// =============================================================================
+// --------------------------------------------------------------------------
+// Cleanup utility for RPointerArray
+// --------------------------------------------------------------------------
+//
+static void DoCleanup( TAny* aPtr )
+    {
+    __ASSERT_DEBUG( aPtr, User::Invariant() );
+    static_cast< RCriteriaArray* >( aPtr )->ResetAndDestroy();
+    }
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMCPHarvesterPublisherObserver::CMCPHarvesterPublisherObserver( CMusicContentPublisher* aHarvester )
+    : iHarvester( aHarvester )
+	{
+	}
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMCPHarvesterPublisherObserver* CMCPHarvesterPublisherObserver::NewL(
+        CMusicContentPublisher* aHarvester )
+    {
+    CMCPHarvesterPublisherObserver* self = CMCPHarvesterPublisherObserver::NewLC( aHarvester ) ;
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+CMCPHarvesterPublisherObserver* CMCPHarvesterPublisherObserver::NewLC( 
+        CMusicContentPublisher* aHarvester )
+    {
+    CMCPHarvesterPublisherObserver* self( 
+        new( ELeave ) CMCPHarvesterPublisherObserver( aHarvester ) );
+        
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMCPHarvesterPublisherObserver::~CMCPHarvesterPublisherObserver()
+    {
+    // TODO automatic releasing.
+    ReleaseLiw();
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMCPHarvesterPublisherObserver::ConstructL()
+    {
+    InitLiwL();
+    }
+
+// ---------------------------------------------------------------------------
+// Handles Published content notification
+// ---------------------------------------------------------------------------
+//
+TInt CMCPHarvesterPublisherObserver::HandleNotifyL( 
+    TInt /*aErrorCode */, 
+    TInt /*aEventId*/,
+    CLiwGenericParamList& aEventParamList, 
+    const CLiwGenericParamList& /*aInParamList*/ )
+    {
+    //__UHEAP_MARK;
+    TInt pos(0);
+
+    aEventParamList.FindFirst(pos, KChangeInfo);
+    if (pos != KErrNotFound)
+        {
+        // Get list of maps
+        TLiwVariant variant = (aEventParamList)[pos].Value();
+        variant.PushL();
+        const CLiwList* changeMapsList = variant.AsList();
+        
+        TPtrC publisher;
+        TPtrC operation;
+        TPtrC8 trigger;
+
+        // Iter through list content
+        for (TInt i = 0; i < changeMapsList->Count(); ++i)
+            {
+             if ( changeMapsList->AtL( i, variant )) 
+                 {
+                 const CLiwMap* map  = variant.AsMap();
+                 
+                 // Check what triggered a notification
+                 variant.Reset();
+                 if ( map->FindL( KOperation, variant ))
+                     {
+                     operation.Set( variant.AsDes()); 
+                     }
+                 if ( operation == KMyOperationExecute )
+                     {
+                     variant.Reset();
+                     if( map->FindL( KActionTrigger, variant ))
+                         {
+                         trigger.Set( variant.AsData()); 
+                         }
+                     TLiwVariant pubVariant;
+                     if( map->FindL( KContentId, pubVariant) )
+                         {
+                         publisher.Set( pubVariant.AsDes());
+                         }
+                     pubVariant.PushL();
+                     if( publisher.Length() && trigger.Length())
+                         {
+                         iHarvester->HandlePublisherNotificationL( publisher, trigger );
+                         }
+                     CleanupStack::PopAndDestroy( &pubVariant );
+                     }
+                 }
+            }
+        CleanupStack::PopAndDestroy( &variant );
+        }
+    //__UHEAP_MARKEND;
+    return KErrNone;
+
+    }
+
+// ---------------------------------------------------------------------------
+// Register for notifications
+// ---------------------------------------------------------------------------
+//
+void CMCPHarvesterPublisherObserver::RegisterL( CLiwDefaultMap* aFilter )
+    {
+    CLiwGenericParamList* inParamList( CLiwGenericParamList::NewLC() );
+    CLiwGenericParamList* outParamList( CLiwGenericParamList::NewLC() );
+    
+    // Fill in input list for RequestNotification command
+    inParamList->AppendL(TLiwGenericParam(KType,TLiwVariant( KPubData )));
+    inParamList->AppendL(TLiwGenericParam(KFilter ,TLiwVariant( aFilter )));
+        
+    iError = KErrNone;
+    TRAP( iError, iInterface->ExecuteCmdL( 
+                KRequestNotification,
+                *inParamList,
+                *outParamList,
+                0,
+                this ) );
+    
+    CleanupStack::PopAndDestroy( outParamList );
+    CleanupStack::PopAndDestroy( inParamList ); 
+    }
+
+// ---------------------------------------------------------------------------
+// Sing off to notification
+// ---------------------------------------------------------------------------
+//
+void CMCPHarvesterPublisherObserver::ReleaseL()
+    {
+    if( iInterface )
+        {
+        CLiwGenericParamList* inParamList = CLiwGenericParamList::NewL();
+        CleanupStack::PushL( inParamList );
+        CLiwGenericParamList* outParamList = CLiwGenericParamList::NewL();
+        CleanupStack::PushL( outParamList );
+        
+        TInt err(KErrNone);
+        TRAP(err, iInterface->ExecuteCmdL( 
+                KRequestNotification,
+                *inParamList,
+                *outParamList,
+                KLiwOptCancel,
+                this ));
+        
+        CleanupStack::PopAndDestroy( outParamList );
+        CleanupStack::PopAndDestroy( inParamList );
+        }
+    }
+
+
+// ------------------------------------------------------------------------
+// CWidgetUiWindowManager::FindObserver
+//
+// Init LIW interface.
+// ------------------------------------------------------------------------
+void CMCPHarvesterPublisherObserver::InitLiwL()
+    {
+    if ( !iLiwHandler )
+        {
+        TInt error( KErrNone );
+        CLiwGenericParamList* in( NULL );
+        CLiwGenericParamList* out( NULL );
+        CLiwCriteriaItem* criterion( NULL );
+        MLiwInterface* liwIface( NULL );
+
+        RCriteriaArray array( 1 );
+        TCleanupItem cleanup( DoCleanup, &array );
+        CleanupStack::PushL( cleanup );
+
+        // Do the basic initialization.
+        iLiwHandler = CLiwServiceHandler::NewL();
+
+        // Get iCPSIface.
+        in = CLiwGenericParamList::NewLC();
+        out = CLiwGenericParamList::NewLC();
+
+        criterion = CLiwCriteriaItem::NewL( 
+            KLiwCmdAsStr,
+            KCPContentInterface, 
+            KCPService );
+            
+        error = array.Append( criterion );
+        if ( error )
+            {
+            delete criterion; criterion = NULL;
+            User::Leave( error );
+            }
+
+        criterion->SetServiceClass( TUid::Uid( KLiwClassBase ) );
+            
+        iLiwHandler->AttachL( array );
+        iLiwHandler->ExecuteServiceCmdL( *criterion, *in, *out ); 
+
+        out->FindFirst( error, KCPContentInterface );
+        User::LeaveIfError( error );
+
+        iInterface = (*out)[ error ].Value().AsInterface();
+
+        CleanupStack::PopAndDestroy( 3 );
+        }
+    }
+
+void CMCPHarvesterPublisherObserver::ReleaseLiw()
+    {    
+    if ( iInterface )
+        {
+        iInterface->Close();
+        iInterface = NULL;
+        }
+        
+    delete iLiwHandler;
+    iLiwHandler = NULL;
+    }
+ //  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/src/musiccontentpublisher.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,998 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages MCP plugins, and content publishing.
+*
+*/
+
+#include <mpxlog.h>                     // MPX_DEBUG
+#include <LiwServiceHandler.h>
+#include <LiwVariant.h>
+#include <LiwGenericParam.h>
+
+#include <mcpplugin.h>
+#include <mcppluginuids.hrh>
+#include <fbs.h>
+#include <coemain.h>
+#include <AknsUtils.h>
+#include <gdi.h>
+#include <musichomescreen.rsg>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+#include <s32mem.h>
+#include <e32hashtab.h>
+
+#include "cpglobals.h" //This will be moved to domain API (HSFW)
+#include "musiccontentpublisher.h"
+#include "pluginmanager.h"
+#include "mcpharvesterpublisherobserver.h"
+
+_LIT( KExecute,       "execute" );
+_LIT( KPubData,        "publisher" );
+
+
+_LIT8( KMyActive, "active" );
+_LIT8( KMyDeActive, "deactive");
+_LIT8( KMySuspend, "suspend");
+_LIT8( KMyResume, "resume");
+_LIT8( KMySelected, "selected");
+_LIT8( KMyActionMap, "action_map" );
+_LIT8( KMyItem, "item" );
+_LIT8( KMyAdd, "Add" );
+_LIT8( KMyItemId, "item_id" );
+_LIT8( KMyResultName,"mydata" );
+_LIT( KMyActionName, "data" );
+
+_LIT( KEmpty, "" );
+_LIT( KLoc, "LOC:");
+_LIT( KNowPlaying, "LOC:NOW PLAYING" );
+_LIT( KLastPlayed, "LOC:LAST PLAYED" );
+_LIT( KMask, "_mask");
+_LIT( KMWPublisher, "MWPublisher");
+
+//for application launcher AHPlugin
+const TInt KMmUid3AsTInt( 0x101f4cd2 );
+const TInt KMSGUidAsTInt( 0x10003A39 );
+_LIT8( KAdditionalData, "additional_data" );
+_LIT( KLaunchApp, "launch_application" );
+_LIT( KMessageWithTail, "message_with_tail" );
+_LIT8( KMessageForMMOpenMusicSuiteWithHide, "mm://root/musicsuite?exit=hide");
+
+_LIT( KResourceFile, "z:musichomescreen.rsc");
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMusicContentPublisher::CMusicContentPublisher( MLiwInterface* aCPSInterface )
+    {
+    iCPSInterface = aCPSInterface;
+    iActivePlugin=NULL;
+    iIsPublisherActive = EFalse;
+
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::ConstructL()
+    {
+    MPX_DEBUG1("CMusicContentPublisher::ConstructL <---");
+    //Load the destination translation table.
+    TInt dstl (sizeof(KMCPDestinationInfo)/sizeof(TMCPDestinationItem));
+    for (TInt i = 0; i < dstl; i++)
+        {
+        iDestinationMap.InsertL(KMCPDestinationInfo[i].id, 
+                KMCPDestinationInfo[i]);
+        }
+    
+    dstl = (sizeof(KMCPImageDestinationInfo)/sizeof(
+            TMCPImageDestinationInfoItem));
+    for (TInt i = 0; i < dstl; i++)
+        {
+        iImageDestinationSizeMap.Insert(KMCPImageDestinationInfo[i].id,
+                TSize(KMCPImageDestinationInfo[i].sizex,
+                        KMCPImageDestinationInfo[i].sizey));
+        }
+    
+    MPX_DEBUG1("CMusicContentPublisher::ConstructL loading resources");
+    //Load Loc strings
+    RFs fs;
+    User::LeaveIfError(fs.Connect());
+    CleanupClosePushL(fs);  
+    TFileName fileName;
+    TParse* parseObj = new(ELeave) TParse();
+    TInt errInt = parseObj->Set( KResourceFile(),&KDC_APP_RESOURCE_DIR,NULL );
+    if(KErrNone != errInt)
+      {
+      delete parseObj;
+      User::Leave(errInt);
+      }
+    fileName = parseObj->FullName();
+    delete parseObj;
+    BaflUtils::NearestLanguageFile(fs,fileName);
+    if(!BaflUtils::FileExists(fs,fileName))
+        {
+        User::Leave(KErrNotFound);
+        }
+    RResourceFile resourceFile;
+    resourceFile.OpenL(fs,fileName);
+    CleanupClosePushL(resourceFile);
+    resourceFile.ConfirmSignatureL();
+    GetLocalizedStringL(resourceFile, iLastPlayedBuffer, R_MUSICHOMESCREEN_LAST_PLAYED);
+    GetLocalizedStringL(resourceFile, iNowPlayingBuffer, R_MUSICHOMESCREEN_NOW_PLAYING);
+    GetLocalizedStringL(resourceFile, iGoToMusicBuffer, R_MUSICHOMESCREEN_GO_TO_MUSIC);
+    CleanupStack::PopAndDestroy(&resourceFile);
+    CleanupStack::PopAndDestroy(&fs);
+    MPX_DEBUG1("CMusicContentPublisher::ConstructL resources loaded");
+    
+    // connect to the skin server, to receive skin changed event.
+    iAknsSrvSession.Connect(this);
+    
+    // enable skin.
+    AknsUtils::InitSkinSupportL();
+
+    MPX_DEBUG1("CMusicContentPublisher::ConstructL subscribing to observer");
+ TPtrC8 dataKey;
+ TPtrC type;
+ TPtrC content;
+ MapEnumToDestinationInfoL(EMusicWidgetImage1, type, dataKey, content); 
+ 
+    TUint id = RegisterPublisherL( 
+            KMWPublisher,
+            content, 
+            type, 
+            dataKey );
+        
+    if( id != 0 )
+        {
+    CLiwDefaultMap* filter = CLiwDefaultMap::NewLC();
+
+    filter->InsertL( KPublisherId, TLiwVariant( KMWPublisher ) );
+    filter->InsertL( KContentId, TLiwVariant( content ) );
+    filter->InsertL( KContentType, TLiwVariant( type ) );
+    filter->InsertL( KOperation, TLiwVariant( KExecute ));
+    
+    
+    iHPObserver = CMCPHarvesterPublisherObserver::NewL(this);
+    iHPObserver->RegisterL(filter);
+    CleanupStack::PopAndDestroy(filter);
+        }
+    MPX_DEBUG1("CMusicContentPublisher::ConstructL subscription to observer done");
+    ResetL();
+    MPX_DEBUG1("CMusicContentPublisher::ConstructL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMusicContentPublisher* CMusicContentPublisher::NewL(  
+        MLiwInterface* aCPSInterface )
+    {
+    CMusicContentPublisher* self = new ( ELeave ) CMusicContentPublisher( 
+            aCPSInterface );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMusicContentPublisher::~CMusicContentPublisher()
+    {
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher <---");
+    if(iHPObserver)
+        {
+        MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher deleting observer");
+        delete iHPObserver; 
+        }
+    delete iNowPlayingBuffer;
+    delete iLastPlayedBuffer;
+    delete iGoToMusicBuffer;
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher closing destination maps");
+    iImageDestinationSizeMap.Close();
+    iDestinationMap.Close();
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher resetting bitmap cache");
+    ResetBitmapCache();
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher closing skin server session");
+    iAknsSrvSession.Close();
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher deleting plugin manager");
+    delete iPluginManager;
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher resetting publishing buffers");
+    ResetPublishingBuffers();
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::InstallGoToMusicL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::InstallGoToMusicL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10282E5F ) ) );
+    mapData->InsertL( KType, TLiwVariant( KLaunchApp ) );
+    mapData->InsertL( KLaunchMethod, TLiwVariant( KMessageWithTail ) );
+    mapData->InsertL(KApplicationUid,
+            TLiwVariant(TInt32(KMmUid3AsTInt) ) );
+        mapData->InsertL( KAdditionalData, 
+            TLiwVariant( KMessageForMMOpenMusicSuiteWithHide ) );
+    mapData->InsertL(KMessageUid,
+            TLiwVariant(TInt32(KMSGUidAsTInt) ) );
+    
+    mapTrigger->InsertL( KData, TLiwVariant( mapData ) );
+    
+    PublishActionL( NULL, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMusicContentPublisher::InstallGoToMusicL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::InstallEmptyActionL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::InstallEmptyActionL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    PublishActionL( NULL, aDestination, mapTrigger );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMusicContentPublisher::InstallEmptyActionL --->");
+    }
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::MapEnumToDestinationInfoL(TInt aEnum,
+        TPtrC& aType, TPtrC8& aDataKey, TPtrC& aContent)
+    {
+    MPX_DEBUG1("CMusicContentPublisher::MapEnumToDestinationInfoL <---");
+    TMCPDestinationItem* tmpdstitemp;
+    tmpdstitemp = iDestinationMap.Find(aEnum);
+    
+    if (tmpdstitemp)
+        {
+        TPtrC type ( reinterpret_cast<const TUint16*>(
+                tmpdstitemp->type) );
+        TPtrC8 dataKey ( reinterpret_cast<const TUint8*>(
+                tmpdstitemp->dataKey ) );
+        TPtrC content ( reinterpret_cast<const TUint16*>(
+                tmpdstitemp->content) );
+        aType.Set(type);
+        aDataKey.Set(dataKey);
+        aContent.Set(content);
+        }
+    else
+        {
+        //API user provided an invalid destination or the destination is not
+        //defined properly.
+        __ASSERT_DEBUG(EFalse,User::Invariant());
+        }
+    MPX_DEBUG1("CMusicContentPublisher::MapEnumToDestinationInfoL --->");
+    }
+
+// ----------------------------------------------------------------------------
+// Get a heap descriptor from the resource file
+// ----------------------------------------------------------------------------
+//
+void CMusicContentPublisher::GetLocalizedStringL(RResourceFile& aResourceFile,
+        HBufC*& aRetBuf, TInt aResourceId )
+   {
+   MPX_DEBUG1("CMusicContentPublisher::GetLocalizedStringL <---");
+   HBufC8* dataBuffer = aResourceFile.AllocReadLC(aResourceId);
+   TResourceReader theReader;
+   theReader.SetBuffer(dataBuffer);
+   aRetBuf = theReader.ReadHBufCL();
+   CleanupStack::PopAndDestroy(dataBuffer);
+   MPX_DEBUG1("CMusicContentPublisher::GetLocalizedStringL --->");
+   }
+
+// ----------------------------------------------------------------------------
+// Publishes buffered data and actions.
+// ----------------------------------------------------------------------------
+//
+void CMusicContentPublisher::DoPublishL()
+    {
+    MPX_DEBUG1("CMusicContentPublisher::DoPublishL <---");
+    THashMapIter<TInt, TMyBufferItem> dataIter( iPublishingDataBuffers );
+    MPX_DEBUG1("CMusicContentPublisher::DoPublish publishing data");
+    
+    TMyBufferItem const* itemptr;
+    itemptr = dataIter.NextValue();
+    while (itemptr)
+        {
+        RMemReadStream rs(itemptr->buf, itemptr->size);
+        CLiwGenericParamList * inParam =
+        CLiwGenericParamList::NewLC(rs);
+        CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+        iCPSInterface->ExecuteCmdL(KAdd, *inParam, *outParam);
+        CleanupStack::PopAndDestroy(outParam);
+        CleanupStack::PopAndDestroy(inParam);
+        itemptr = dataIter.NextValue();
+        }
+        
+    //The order in wich we publish is important, actions should be published after the data contents.
+    THashMapIter<TInt, TMyBufferItem> actionIter( iPublishingActionBuffers );
+    MPX_DEBUG1("CMusicContentPublisher::DoPublish publishing actions");
+    
+    itemptr = NULL;
+    itemptr = actionIter.NextValue();
+    while (itemptr)
+        {
+        RMemReadStream rs(itemptr->buf, itemptr->size);
+        CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC(rs);
+        CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+        iCPSInterface->ExecuteCmdL(KAdd, *inParam, *outParam);
+        CleanupStack::PopAndDestroy(outParam);
+        CleanupStack::PopAndDestroy(inParam);
+        itemptr = actionIter.NextValue();
+        }
+    MPX_DEBUG1("CMusicContentPublisher::CMusicContentPublisher::DoPublishL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Resets all the graphical elements.
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::ResetL()
+    {
+    MPX_DEBUG1("CMusicContentPublisher::ResetL <---");
+    //Plugin deletion is handled by the pluginmanager.
+    iActivePlugin = NULL;
+    //Reset The Widget
+    PublishImageL(NULL,EMusicWidgetImage1,KEmpty);
+    InstallGoToMusicL( EMusicWidgetTrigger1 );
+    PublishTextL( NULL,EMusicWidgetText1, KEmpty );
+    PublishImageL(NULL,EMusicWidgetToolbarB1,KEmpty);
+    PublishImageL(NULL,EMusicWidgetToolbarB2,KEmpty);
+    PublishImageL(NULL,EMusicWidgetToolbarB3,KEmpty);
+    InstallEmptyActionL(EMusicWidgetTB1Trigger);
+    InstallEmptyActionL(EMusicWidgetTB2Trigger);
+    InstallEmptyActionL(EMusicWidgetTB3Trigger);
+    PublishTextL( NULL,EMusicWidgetDefaultText, iGoToMusicBuffer->Des() );  
+    InstallGoToMusicL( EMusicWidgetTrigger2 );
+
+    //Reset the music menu info
+    InstallEmptyActionL(EMusicMenuMusicInfoTrigger);
+    PublishTextL( NULL, EMusicMenuMusicInfoLine1, iLastPlayedBuffer->Des() );
+    PublishTextL( NULL, EMusicMenuMusicInfoLine2, KEmpty );
+    PublishImageL( NULL, EMusicMenuMusicInfoImage1, KEmpty );
+    MPX_DEBUG1("CMusicContentPublisher::ResetL --->");
+    }
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TSize CMusicContentPublisher::GetImageDestinationSize(
+        TMCPImageDestination aDst)
+    {
+    MPX_DEBUG1("CMusicContentPublisher::GetImageDestinationSize <---");
+    TSize * ret;
+    ret = iImageDestinationSizeMap.Find(aDst);
+    if (ret)
+        {
+        MPX_DEBUG1("CMusicContentPublisher::GetImageDestinationSize --->");
+        return *ret;    
+        }
+    else
+        {
+        MPX_DEBUG1("CMusicContentPublisher::GetImageDestinationSize --->");
+        return TSize(0,0);
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destroys the bitmaps saved on the cache.
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::ResetBitmapCache()
+    {
+    MPX_DEBUG1("CMusicContentPublisher::ResetBitmapCache <---");
+    THashMapIter<TInt, TBmpMsk> iter(iBitmapCache);
+    TBmpMsk const* ptr = iter.NextValue();
+    CFbsBitmap* bmp( NULL );
+    CFbsBitmap* msk( NULL );
+    while ( ptr )
+        {
+        bmp = ptr->bitmap;
+        msk = ptr->mask;
+        delete bmp;
+        bmp = NULL;
+        delete msk;
+        msk = NULL;
+        ptr = iter.NextValue();
+        }
+    iBitmapCache.Close();
+    MPX_DEBUG1("CMusicContentPublisher::ResetBitmapCache --->");
+    }
+    
+// ---------------------------------------------------------------------------
+// Destroys the publishing buffers.
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::ResetPublishingBuffers()
+    {
+    THashMapIter<TInt, TMyBufferItem> dataIter( iPublishingDataBuffers );
+    THashMapIter<TInt, TMyBufferItem> actionIter( iPublishingActionBuffers );
+    
+    TMyBufferItem const* itemptr;
+    itemptr = dataIter.NextValue();
+    while (itemptr)
+        {
+        User::Free(itemptr->buf);
+        dataIter.RemoveCurrent();
+        itemptr = dataIter.NextValue();
+        }
+    iPublishingDataBuffers.Close();
+    itemptr = NULL;
+    itemptr = actionIter.NextValue();
+    while (itemptr)
+        {
+        User::Free(itemptr->buf);
+        actionIter.RemoveCurrent();
+        itemptr = actionIter.NextValue();
+        }
+    iPublishingActionBuffers.Close();
+    }
+
+TUint CMusicContentPublisher::RegisterPublisherL( 
+    const TDesC& aPublisherId, 
+    const TDesC& aContentId,
+    const TDesC& aContentType, 
+    const TDesC8& aResultType )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::RegisterPublisherL <---");
+    TUint id( 0 );
+    if( iCPSInterface )
+        {   
+        CLiwGenericParamList* inparam( CLiwGenericParamList::NewLC() );
+        CLiwGenericParamList* outparam( CLiwGenericParamList::NewLC() );
+
+        TLiwGenericParam type( KType, TLiwVariant( KPubData ));
+        inparam->AppendL( type );
+        CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC();
+        CLiwDefaultMap* datamap = CLiwDefaultMap::NewLC();
+        CLiwDefaultMap* actionmap( NULL );
+
+        // Create the data map for publisher registry
+        cpdatamap->InsertL( KContentType, TLiwVariant( aContentType ));
+        cpdatamap->InsertL( KContentId, TLiwVariant( aContentId ));
+        cpdatamap->InsertL( KPublisherId, TLiwVariant( aPublisherId ));
+        datamap->InsertL( KMyResultName, TLiwVariant( aResultType ));
+
+        cpdatamap->InsertL( KDataMap, TLiwVariant(datamap) );
+        
+        // Create the action map for publisher registry
+        actionmap = CLiwDefaultMap::NewLC();
+        actionmap->InsertL(KMyActive, TLiwVariant( KMyActionName ));
+        actionmap->InsertL(KMyDeActive, TLiwVariant( KMyActionName ));
+        actionmap->InsertL(KMySuspend, TLiwVariant( KMyActionName ));
+        actionmap->InsertL(KMyResume, TLiwVariant( KMyActionName ));
+        actionmap->InsertL(KMySelected, TLiwVariant( KMyActionName ));
+ 
+        cpdatamap->InsertL( KMyActionMap, TLiwVariant(actionmap));
+        CleanupStack::PopAndDestroy( actionmap );
+        
+        TLiwGenericParam item( KMyItem, TLiwVariant( cpdatamap ));        
+        inparam->AppendL( item );
+        
+        iCPSInterface->ExecuteCmdL( KMyAdd , *inparam, *outparam);
+        id = ExtractItemId(*outparam);
+        
+        CleanupStack::PopAndDestroy( datamap );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        item.Reset();
+        type.Reset();   
+        CleanupStack::PopAndDestroy(outparam);
+        CleanupStack::PopAndDestroy(inparam);
+        }
+    MPX_DEBUG1("CMusicContentPublisher::RegisterPublisherL --->");
+    return id;
+    }
+
+TUint CMusicContentPublisher::ExtractItemId( const CLiwGenericParamList& aInParamList )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::ExtractItemId <---");
+    TUint result ( 0 );
+    TInt pos( 0 );
+    aInParamList.FindFirst( pos, KMyItemId );
+    if( pos != KErrNotFound )
+        {
+        // item id present - extract and return
+        aInParamList[pos].Value().Get( result );
+        }
+    MPX_DEBUG1("CMusicContentPublisher::ExtractItemId --->");
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// Publishes an image from path to the required destination
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::PublishImageL( CMCPPlugin* aPlugin,  
+        TMCPImageDestination aDestination, 
+        const TDesC& aImagePath )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL <---");
+    if( iCPSInterface && iActivePlugin == aPlugin )
+        {
+        CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
+        CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+        
+        TPtrC8 dataKey;
+        TPtrC type;
+        TPtrC content;
+        MapEnumToDestinationInfoL(aDestination, type, dataKey, content);
+        
+        TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
+        inParam->AppendL( cptype );
+        CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
+        CLiwDefaultMap * map = CLiwDefaultMap::NewLC( );
+        
+         
+        map->InsertL(dataKey, TLiwVariant( aImagePath ) );
+        
+        cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
+        cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
+        cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
+        cpdatamap->InsertL( KDataMap  , TLiwVariant( map ) );
+    
+        TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
+        inParam->AppendL( item );
+        
+        if ( aDestination >= EMusicMenuMusicInfoImage1 )
+            {
+            iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+            }
+        else
+            {
+            if ( iIsPublisherActive )
+                {
+                iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+                }
+            TMyBufferItem* ptr;
+            ptr = iPublishingDataBuffers.Find(aDestination);
+            if (ptr) //remove the old one
+                {
+                User::Free(ptr->buf);
+                iPublishingDataBuffers.Remove(aDestination);
+                }
+            TInt sz = inParam->Size();
+            TMyBufferItem bufferitem;
+            bufferitem.size = inParam->Size();
+            bufferitem.buf = User::AllocL(inParam->Size());
+            RMemWriteStream ws(bufferitem.buf, bufferitem.size);
+            inParam->ExternalizeL(ws);
+            iPublishingDataBuffers.Insert(aDestination, bufferitem);
+            }
+        CleanupStack::PopAndDestroy( map );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        CleanupStack::PopAndDestroy( outParam );
+        CleanupStack::PopAndDestroy( inParam );
+        }   
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Publishes an image from bitmap handle to the required destination
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::PublishImageL( CMCPPlugin* aPlugin, 
+        TMCPImageDestination aDestination,
+        TInt aBitmapHandle,
+        TInt aMaskBitmapHandle)
+    {
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL <---");
+    if( iCPSInterface && iActivePlugin == aPlugin )
+        {
+        CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
+        CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+        
+        TPtrC8 dataKey;
+        TPtrC type;
+        TPtrC content;
+        MapEnumToDestinationInfoL(aDestination, type, dataKey, content);
+        
+        TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
+        inParam->AppendL( cptype );
+        CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
+        CLiwDefaultMap * map = CLiwDefaultMap::NewLC( );
+        
+         
+        if (aDestination == EMusicMenuMusicInfoImage1)
+            {
+            //Matrix Menu expects a Tint32 (TVariantTypeId::EVariantTypeTInt32)   
+            map->InsertL(dataKey, TLiwVariant( (TInt32)aBitmapHandle ) );
+            }
+        else 
+            {
+            //Homescreen expects a TBool/TInt 
+            //(TVariantTypeId::EVariantTypeTBool)
+            map->InsertL(dataKey, TLiwVariant( aBitmapHandle ) );
+            }
+        
+        if (aMaskBitmapHandle)
+            {
+            HBufC8* maskResult = HBufC8::NewLC( 
+                    dataKey.Length() + KMask().Length() );
+            TPtr8 maskResultPtr = maskResult ->Des();
+            maskResultPtr.Append( dataKey );
+            maskResultPtr.Append( KMask );
+            if (aDestination == EMusicMenuMusicInfoImage1)
+                {
+                //Matrix Menu expects a Tint32 (TVariantTypeId::EVariantTypeTInt32)   
+                map->InsertL(maskResultPtr, TLiwVariant( (TInt32)aMaskBitmapHandle ) );
+                }
+            else 
+                {
+                //Homescreen expects a TBool/TInt 
+                //(TVariantTypeId::EVariantTypeTBool)
+                map->InsertL(maskResultPtr, TLiwVariant( aMaskBitmapHandle ) );
+                }
+            CleanupStack::PopAndDestroy( maskResult );
+            }
+        
+        cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
+        cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
+        cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
+        cpdatamap->InsertL( KDataMap  , TLiwVariant( map ) );
+    
+        TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
+        inParam->AppendL( item );
+        
+        if ( aDestination >= EMusicMenuMusicInfoImage1 )
+            {
+            iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+            }
+        else
+            {
+            if ( iIsPublisherActive )
+                {
+                iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );  	
+                }
+            TMyBufferItem* ptr;
+            ptr = iPublishingDataBuffers.Find(aDestination);
+            if (ptr) //remove the old one
+                {
+                User::Free(ptr->buf);
+                iPublishingDataBuffers.Remove(aDestination);
+                }
+            TInt sz = inParam->Size();
+            TMyBufferItem bufferitem;
+            bufferitem.size = inParam->Size();
+            bufferitem.buf = User::AllocL(inParam->Size());
+            RMemWriteStream ws(bufferitem.buf, bufferitem.size);
+            inParam->ExternalizeL(ws);
+            iPublishingDataBuffers.Insert(aDestination, bufferitem);
+            }
+        CleanupStack::PopAndDestroy( map );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        CleanupStack::PopAndDestroy( outParam );
+        CleanupStack::PopAndDestroy( inParam );
+        }
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Publishes an image from skin id and mif to the required destination
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::PublishImageL(CMCPPlugin* aPlugin, 
+        TMCPImageDestination aDestination,
+        const TAknsItemID& aID,
+        const TDesC& aFilename,
+        const TInt aFileBitmapId,
+        const TInt aFileMaskId )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL <---");
+    TBmpMsk* bitmapandmask;
+    bitmapandmask = iBitmapCache.Find(aID.iMajor+aID.iMinor);
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+    if (!bitmapandmask)
+        {
+        // Load from skin
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+        AknsUtils::CreateIconL(
+                    skin,
+                    aID,
+                    bitmap,
+                    mask,
+                    aFilename,
+                    aFileBitmapId,
+                    aFileMaskId);
+        AknIconUtils::SetSize(
+                bitmap,
+                GetImageDestinationSize(aDestination),
+                EAspectRatioPreserved );
+        AknIconUtils::SetSize(mask,
+                GetImageDestinationSize(aDestination),
+                EAspectRatioPreserved );
+        TBmpMsk bmpAndMsk;
+        bmpAndMsk.bitmap=bitmap;
+        bmpAndMsk.mask=mask;
+        iBitmapCache.Insert(aID.iMajor+aID.iMinor,bmpAndMsk);
+        bitmapandmask = iBitmapCache.Find(aID.iMajor+aID.iMinor);
+        __ASSERT_DEBUG(bitmapandmask,User::Invariant());
+        }
+    bitmap = bitmapandmask->bitmap;
+    mask = bitmapandmask->mask;
+    
+    PublishImageL( aPlugin, aDestination, bitmap->Handle() , mask->Handle()); 
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Publishes a text from path to the required destination
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::PublishTextL( CMCPPlugin* aPlugin, 
+        TMCPTextDestination aDestination, 
+        const TDesC& aText )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::PublishTextL <---");
+    if( iCPSInterface && iActivePlugin == aPlugin)
+        {
+        CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
+        CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+        
+        TPtrC8 dataKey;
+        TPtrC type;
+        TPtrC content;
+        MapEnumToDestinationInfoL(aDestination, type, dataKey, content);
+        
+        TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
+        inParam->AppendL( cptype );
+        CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
+        CLiwDefaultMap * map = CLiwDefaultMap::NewLC( );
+        
+        if (KErrNotFound == aText.Find(KLoc))
+            {
+            map->InsertL( dataKey , TLiwVariant( aText ) );    
+            }
+        else
+            {
+            if ( ! aText.Compare( KNowPlaying ) )
+                {
+                map->InsertL( dataKey , TLiwVariant( iNowPlayingBuffer ) );
+                }
+            else if ( ! aText.Compare( KLastPlayed ) )
+                {
+                map->InsertL( dataKey , TLiwVariant( iLastPlayedBuffer ) );
+                }
+            else
+                {
+                map->InsertL( dataKey , TLiwVariant( aText ) );
+                }
+            }
+        
+        cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
+        cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
+        cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
+        cpdatamap->InsertL( KDataMap  , TLiwVariant( map ) );
+        
+        TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
+        inParam->AppendL( item );
+        
+        if ( aDestination >= EMusicMenuMusicInfoLine1 )
+            {
+            if (aText  != KEmpty)
+			    {
+                iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+				}
+            else
+			    {
+                iCPSInterface->ExecuteCmdL( KDelete , *inParam, *outParam);
+				}
+            }
+        else
+            {
+            if ( iIsPublisherActive )
+                {
+                iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );        	
+                }
+            TMyBufferItem* ptr;
+            ptr = iPublishingDataBuffers.Find(aDestination);
+            if (ptr) //remove the old one
+                {
+                User::Free(ptr->buf);
+                iPublishingDataBuffers.Remove(aDestination);
+                }
+            TInt sz = inParam->Size();
+            TMyBufferItem bufferitem;
+            bufferitem.size = inParam->Size();
+            bufferitem.buf = User::AllocL(inParam->Size());
+            RMemWriteStream ws(bufferitem.buf, bufferitem.size);
+            inParam->ExternalizeL(ws);
+            iPublishingDataBuffers.Insert(aDestination, bufferitem);
+            }
+        CleanupStack::PopAndDestroy( map );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        CleanupStack::PopAndDestroy( outParam );
+        CleanupStack::PopAndDestroy( inParam );
+        }  
+    MPX_DEBUG1("CMusicContentPublisher::PublishTextL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Publishes an action from a trigger map to the required destination
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::PublishActionL( CMCPPlugin* aPlugin, 
+        TMCPTriggerDestination aDestination,
+        CLiwDefaultMap* aTriggerMap )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::PublishActionL <---");
+     if( iCPSInterface && iActivePlugin == aPlugin)
+        {
+        CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
+        CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+        
+        TPtrC8 triggerKey;
+        TPtrC hostType;
+        TPtrC hostContent;
+        
+        MapEnumToDestinationInfoL(aDestination, hostType, triggerKey, 
+                hostContent);
+        
+        TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
+        inParam->AppendL( cptype );
+        
+        CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
+        cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
+        cpdatamap->InsertL( KContentType , TLiwVariant( hostType ) );
+        cpdatamap->InsertL( KContentId  , TLiwVariant( hostContent ) );
+        
+        CLiwDefaultMap * actionmap = CLiwDefaultMap::NewLC( );
+        actionmap->InsertL( triggerKey , TLiwVariant( aTriggerMap ) );
+        cpdatamap->InsertL( KActionMap  , TLiwVariant( actionmap ) );
+        
+        TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
+        inParam->AppendL( item );
+        
+        if ( aDestination >= EMusicMenuMusicInfoTrigger )
+            {
+            iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+            }
+        else
+            {
+            if ( iIsPublisherActive )
+                {
+            	  iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+                }
+            TMyBufferItem* ptr;
+            ptr = iPublishingActionBuffers.Find(aDestination);
+            if (ptr) //remove the old one
+                {
+                User::Free(ptr->buf);
+                iPublishingActionBuffers.Remove(aDestination);
+                }
+            TInt sz = inParam->Size();
+            TMyBufferItem bufferitem;
+            bufferitem.size = inParam->Size();
+            bufferitem.buf = User::AllocL(inParam->Size());
+            RMemWriteStream ws(bufferitem.buf, bufferitem.size);
+            inParam->ExternalizeL(ws);
+            iPublishingActionBuffers.Insert(aDestination, bufferitem);
+            }
+        CleanupStack::PopAndDestroy( actionmap );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        CleanupStack::PopAndDestroy( outParam );
+        CleanupStack::PopAndDestroy( inParam );
+        }
+    MPX_DEBUG1("CMusicContentPublisher::PublishActionL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Called when a plugin becomes active, it deactivates the previous plugin.
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::BecameActiveL( CMCPPlugin* aPlugin )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::BecameActiveL <---");
+    if ( iActivePlugin != aPlugin )
+        {
+        if ( iActivePlugin )
+            {
+            MPX_DEBUG1("CMusicContentPublisher::BecameActiveL deactivating old plugin");
+            iActivePlugin->Deactivate();
+            MPX_DEBUG1("CMusicContentPublisher::BecameActiveL plugin deactivated");
+            PublishImageL( iActivePlugin, EMusicMenuMusicInfoImage1, KEmpty );
+            }
+        iActivePlugin = aPlugin;
+        }
+    MPX_DEBUG1("CMusicContentPublisher::BecameActiveL --->");
+    }
+// ---------------------------------------------------------------------------
+// From CContentHarvesterPlugin
+// This function updates information in CPS storage
+// ---------------------------------------------------------------------------
+//    
+void CMusicContentPublisher::UpdateL() 
+    {
+    MPX_DEBUG1("CMusicContentPublisher::UpdateL <---");
+    if ( !iPluginManager )
+        {
+        MPX_DEBUG1("CMusicContentPublisher::UpdateL creating the plugin manager");
+        iPluginManager = CPluginManager::NewL(
+                TUid::Uid( KMCPPluginUid ), 
+                static_cast<MMCPPluginObserver*>( this ),
+                this );
+        }
+    MPX_DEBUG1("CMusicContentPublisher::UpdateL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From MAknsSkinChangeObserver.
+// Called by the skin server when skin content is changed and the
+// connected client wants to be informed.
+// ---------------------------------------------------------------------------
+// 
+void CMusicContentPublisher::SkinContentChanged()
+    {
+    MPX_DEBUG1("CMusicContentPublisher::SkinContentChanged <---");
+    ResetBitmapCache();
+    if(iActivePlugin)
+        {
+        iActivePlugin->SkinChanged();
+        }
+    MPX_DEBUG1("CMusicContentPublisher::SkinContentChanged --->");
+    }
+
+void CMusicContentPublisher::HandlePublisherNotificationL( const TDesC& /*aContentId*/, const TDesC8& aTrigger )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL <---");
+    if ( aTrigger == KMyActive )
+        {
+        MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL activate");
+        }
+    else if ( aTrigger ==  KMyDeActive)
+        {
+        MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL deactivate");
+        iIsPublisherActive = EFalse;
+        }
+    else if ( aTrigger ==  KMySuspend)
+        {
+        MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL suspend");
+        iIsPublisherActive = EFalse;
+        }
+    else if ( aTrigger ==  KMyResume)
+        {
+        MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL resume");
+        iIsPublisherActive = ETrue;
+        DoPublishL();
+        }
+    else if ( aTrigger ==  KMySelected)
+        {
+        MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL select");
+        }
+    MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL --->");
+    }
+
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/src/pluginmanager.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,250 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Plugin manager, responsible to load the plugins.
+*
+*/
+
+#include <mpxlog.h>                     // MPX_DEBUG
+#include <ecom/ecom.h>
+// for CeanupResetAndDestroyPushL
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+#include "musiccontentpublisher.h"
+#include "pluginmanager.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CPluginManager::CPluginManager( TUid aUid, 
+        TAny* aParameter, 
+        CMusicContentPublisher* aContentPublisher) :
+                CActive( EPriorityStandard ), 
+                iUid( aUid ), 
+                iParameter( aParameter ), 
+                iContentPublisher(aContentPublisher)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CPluginManager::ConstructL()
+    {
+    MPX_DEBUG1("CPluginManager::ConstructL <---");
+    iSession = &REComSession::OpenL();
+    LoadPluginsL();
+    iSession->NotifyOnChange( iStatus );
+    CActiveScheduler::Add( this );
+    SetActive();
+    MPX_DEBUG1("CPluginManager::ConstructL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CPluginManager* CPluginManager::NewL( TUid aUid, 
+        TAny *aParameter, 
+        CMusicContentPublisher* aContentPublisher )
+    {
+    CPluginManager* self = CPluginManager::NewLC( aUid, 
+            aParameter, 
+            aContentPublisher );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CPluginManager* CPluginManager::NewLC( TUid aUid, 
+        TAny *aParameter,
+        CMusicContentPublisher* aContentPublisher )
+    {
+    CPluginManager* self = new( ELeave ) CPluginManager( aUid, 
+            aParameter, 
+            aContentPublisher );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// destructor
+// ---------------------------------------------------------------------------
+CPluginManager::~CPluginManager()
+    {
+    MPX_DEBUG1("CPluginManager::~CPluginManager <---");
+    Cancel();
+    CleanPluginsTable();
+    iPluginMap.Close();
+    if ( iSession )
+        {
+        iSession->Close();
+        }
+    REComSession::FinalClose();
+    MPX_DEBUG1("CPluginManager::~CPluginManager --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Retuns a plugin by UID
+// ---------------------------------------------------------------------------
+//
+TAny* CPluginManager::GetImplementation( TUid aUid )
+    {
+    TInt32 key = aUid.iUid;
+    TAny* ret= NULL;
+    TAny** imp= NULL;
+    imp = iPluginMap.Find( key );
+    if ( imp )
+        {
+        ret = *imp;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Retuns a plugin by index
+// ---------------------------------------------------------------------------
+//
+TAny* CPluginManager::GetImplementation( TInt aIndex )
+    {
+    TAny* ret= NULL;
+    THashMapIter<TInt32, TAny*> iter( iPluginMap );
+    TAny*const* ptr = iter.NextValue();
+    for ( TInt i( 0 ); ptr; i++ )
+        {
+        if ( i == aIndex )
+            {
+            ret = *ptr;
+            break;
+            }
+        ptr = iter.NextValue();
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the count of the plug-ins.
+// ---------------------------------------------------------------------------
+//
+TInt CPluginManager::GetCount()
+    {
+    return iPluginMap.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// Loads the plugins.
+// ---------------------------------------------------------------------------
+//
+void CPluginManager::LoadPluginsL()
+    {
+    MPX_DEBUG1("CPluginManager::LoadPluginsL <---");
+    // Read info about all implementations into infoArray
+    RImplInfoPtrArray infoArray;
+    CleanupResetAndDestroyPushL( infoArray );
+
+    REComSession::ListImplementationsL( iUid, infoArray );
+    for ( TInt i = 0; i < infoArray.Count(); i++ )
+        {
+        TUid current_plugin = infoArray[i]->ImplementationUid();
+        TAny* plug( NULL );
+        TUid temp;
+        TInt err( KErrNone );
+        TRAP( err, plug = REComSession::CreateImplementationL(
+                        current_plugin,
+                        temp,
+                        iParameter ) );
+        if ( err == KErrNone && plug )
+            {
+            CleanupStack::PushL( plug );
+            TInt32 key = current_plugin.iUid;
+            iPluginMap.InsertL( key, plug );
+            CleanupStack::Pop( plug );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &infoArray );
+    MPX_DEBUG1("CPluginManager::LoadPluginsL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Unloads the plgugins.
+// ---------------------------------------------------------------------------
+//        
+void CPluginManager::CleanPluginsTable()
+    {
+    MPX_DEBUG1("CPluginManager::CleanPluginsTable <---");
+    THashMapIter<TInt32, TAny*> iter( iPluginMap );
+    TAny*const* ptr = iter.NextValue();
+    CBase* plug( NULL );
+    const TInt32* pluginUid( NULL );
+    while ( ptr )
+        {
+        plug = static_cast<CBase*>( *ptr );
+        delete plug;
+        plug = NULL;
+        pluginUid = iter.CurrentKey();
+        REComSession::DestroyedImplementation( TUid::Uid( *pluginUid ) );
+        ptr = iter.NextValue();
+        pluginUid = NULL;
+        }
+    MPX_DEBUG1("CPluginManager::CleanPluginsTable --->");
+    }
+
+// ---------------------------------------------------------------------------
+//From CActive
+// ---------------------------------------------------------------------------
+//
+void CPluginManager::RunL()
+    {
+    MPX_DEBUG1("CPluginManager::RunL <---");
+    CleanPluginsTable();
+    iPluginMap.Close();
+    iContentPublisher->ResetL();
+    LoadPluginsL();
+    iSession->NotifyOnChange( iStatus );
+    SetActive();
+    MPX_DEBUG1("CPluginManager::RunL --->");
+    }
+
+// ---------------------------------------------------------------------------
+//From CActive
+// ---------------------------------------------------------------------------
+//
+void CPluginManager::DoCancel()
+    {
+    MPX_DEBUG1("CPluginManager::DoCancel <---");
+    iSession->CancelNotifyOnChange( iStatus );
+    MPX_DEBUG1("CPluginManager::DoCancel --->");
+    }
+
+// ---------------------------------------------------------------------------
+//From CActive
+// ---------------------------------------------------------------------------
+//
+TInt CPluginManager::RunError( TInt /*aError*/ )
+    {
+    MPX_DEBUG1("CPluginManager::RunError <---");
+    MPX_DEBUG1("CPluginManager::RunError --->");
+    return KErrNone;
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musiccontentpublisher/src/proxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Content Publisher Implementation Proxy
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "musiccontentpublisher.h"
+#include "musiccontentpublisheruids.hrh"
+
+// ---------------------------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KMusicContentPublisherUID,
+            CMusicContentPublisher::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// Exported proxy for instantiation method resolution
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+        TInt& aTableCount )
+    {
+    aTableCount =
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+
+    return ImplementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musicplayeractionhandlerplugin/data/musicplayeractionhandlerplugin.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM registration for Music Player Action Handler Plugin
+*
+*/
+
+
+#include <registryinfo.rh>
+#include <ahpluginuids.hrh>
+#include "musicplayeractionhandleruids.hrh"
+
+// ---------------------------------------------------------------------------
+// MusicPlayerActionHandlerPluginInfo
+// Declares info for implementation of the plugin
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO MusicPlayerActionHandlerPluginInfo
+    {
+    // UID for the DLL
+    dll_uid = KMusicPlayerActionHandlerDLL;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = KAHPluginInterfaceUid;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMusicPlayerActionHandlerUID;
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musicplayeractionhandlerplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Music Player Action Handler Plugin
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/musicplayeractionhandlerplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musicplayeractionhandlerplugin.iby)
+
+PRJ_MMPFILES
+musicplayeractionhandlerplugin.mmp
+
+PRJ_TESTMMPFILES
+PRJ_TESTEXPORTS
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musicplayeractionhandlerplugin/group/musicplayeractionhandlerplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for Music Player ActionHandlerPlugin
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include "../inc/musicplayeractionhandleruids.hrh"
+
+TARGET                  musicplayeractionhandlerplugin.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D KMusicPlayerActionHandlerDLL 
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  proxy.cpp
+SOURCE                  musicplayeractionhandler.cpp
+
+USERINCLUDE             ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+
+SOURCEPATH              ../data
+START RESOURCE          musicplayeractionhandlerplugin.rss
+HEADER
+TARGET                  musicplayeractionhandlerplugin.rsc
+TARGETPATH              resource/plugins 
+END
+
+LIBRARY                 euser.lib
+LIBRARY                 liwservicehandler.lib   // TLiwVariant
+LIBRARY                 ws32.lib                // RWsSession
+LIBRARY                 apgrfx.lib              // TApaTask, TApaTaskList, RApaLsSession
+LIBRARY                 apparc.lib              // CApaCommandLine, TApaAppInfo
+LIBRARY                 estor.lib               // RBufWriteStream, RWriteStream
+LIBRARY                 mpxcommon.lib           // CMPXparameter
+LIBRARY                 mpxplaybackutility.lib  // MMPXPlaybackUtility
+LIBRARY                 mpxcommonui.lib         // Common UI helpers
+LIBRARY                 mpxcollectionhelper.lib // Collection helpers
+LIBRARY                 avkon.lib               // CAknTaskList
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musicplayeractionhandlerplugin/inc/musicplayeractionhandler.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player Action Handler Plugin
+*
+*/
+
+
+#ifndef C_MUSICPLAYERACTIONHANDLER_H
+#define C_MUSICPLAYERACTIONHANDLER_H
+
+#include <ahplugin.h>
+
+// FORWARD DECLARATION
+class CLiwMap;
+class TLiwVariant;
+class MMPXPlaybackUtility;
+
+/**
+ *  Music Player Action Handler Plugin.
+ *  Class extends the CAHPlugin in order to be used as a plugin for
+ *  action handler.
+ *  @since S60 S60 v5.0
+ */
+NONSHARABLE_CLASS( CMusicPlayerActionHandler ) : public CAHPlugin
+    {
+public:
+
+    /**
+     * Standard Symbian 2 phase constructor
+     */
+    static CMusicPlayerActionHandler* NewL();
+
+    /**
+     * Standard Symbian 2 phase constructor
+     */
+    static CMusicPlayerActionHandler* NewLC();
+
+    /**
+     * Standard C++ destructor.
+     */
+    ~CMusicPlayerActionHandler();
+
+// from base class CAHPlugin
+
+    /**
+     * From CAHPlugin
+     * This is called by the AH to execute an action 
+     * @param aMap an action object to be executed
+     * @return Error code
+     */
+    TInt ExecuteActionL( const CLiwMap* aMap );
+
+private:
+    /**
+     * Standard Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Executes Playback command on the current player.
+     * @param aMap an action object to be executed
+     * @return status code
+     */
+    TInt ExecutePlaybackCommandL( const CLiwMap* aMap );
+
+    /**
+     * Sends a message to Music Player.
+     * @param aMap an action object to be executed
+     * @return status code
+     */
+    TInt ExecuteMessageToMusicPlayerL( const CLiwMap* aMap );
+
+    /**
+     * goes to now-playing view
+     * @return status code
+     */
+    TInt GoToNowPlayingL();
+    
+    /**
+     * goes to The last Played song.
+     * @param aMinimized indicates if app should be in the background.
+     * @return status code
+     */
+    TInt GoToLastPlayedL(TBool aMinimazed);
+    
+    /**
+     * goes to library/collection view
+     * @return status code
+     */
+    TInt GoToMusicLibraryL();
+    
+    /**
+     * Gets a descriptor from the map.
+     * @param aMap containing the data.
+     * @param aString where the data is extracted to.
+     * @param aMapName element of the map that is to be extracted.
+     * @return status code
+     */
+    TInt ExtractDesL( const CLiwMap* aMap, RBuf& aString,
+            const TDesC8& aMapName );
+
+    /**
+     * Gets a variant from the map.
+     * @param aMap containing the data.
+     * @param aVariant where the data is extracted to.
+     * @param aMapName element of the map that is to be extracted.
+     * @return status code
+     */
+    TInt ExtractVariantL( const CLiwMap* aMap, TLiwVariant& aVariant,
+            const TDesC8& aMapName );
+
+private: // data
+
+    /**
+     * The playback utility where playback operations are performed.
+     * Own.
+     */
+    MMPXPlaybackUtility* iPlaybackUtility;
+    };
+
+#endif /* C_MUSICPLAYERACTIONHANDLER_H */
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musicplayeractionhandlerplugin/inc/musicplayeractionhandleruids.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for Musci Playe ActionHandler Plugin
+*
+*/
+
+
+#ifndef MUSICPLAYERACTIONHANDLERUIDS_H_
+#define MUSICPLAYERACTIONHANDLERUIDS_H_
+
+/** Ecom implementation uid for Music Player Action Handler Plugin */
+#define KMusicPlayerActionHandlerUID 0x10207C16
+
+/** Ecom dll uid for Music Player Action Handler Plugin */
+#define KMusicPlayerActionHandlerDLL 0x10207C17
+
+#endif /*MUSICPLAYERACTIONHANDLERUIDS_H_*/
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musicplayeractionhandlerplugin/rom/musicplayeractionhandlerplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Player Action Handler Plugin
+*
+*/
+
+
+#ifndef MUSICPLAYERACTIONHANDLERPLUGIN_IBY
+#define MUSICPLAYERACTIONHANDLERPLUGIN_IBY
+
+ECOM_PLUGIN(musicplayeractionhandlerplugin.dll, musicplayeractionhandlerplugin.rsc)
+
+#endif // MUSICPLAYERACTIONHANDLERPLUGIN_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musicplayeractionhandlerplugin/src/musicplayeractionhandler.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,433 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player Action Handler Plugin
+*
+*/
+
+
+#include <LiwVariant.h>                 // TLiwVariant
+#include <apgcli.h>                     // RApaLsSession, TApaAppInfo
+#include <apacmdln.h>                   // CApaCommandLine
+#include <apgtask.h>                    // TApaTaskList
+#include <mpxlog.h>                     // MPX_DEBUG
+#include <mpxparameter.h>               // CMPXParameter
+#include <mpxplaybackutility.h>         // MMPXPlaybackUtility
+#include <mpxconstants.h>               // KAppUidMusicPlayerX
+#include <mpxmusicplayerviewplugin.hrh> // KMPXPluginTypePlaybackUid
+#include <AknTaskList.h>                // CAknTaskList
+
+#include <mpxcommonuihelper.h>
+#include <mpxcollectionhelperfactory.h>
+#include "musicplayeractionhandler.h"
+
+
+
+const TInt KPlayerMusicPlayerParameterGranularity = 50;
+const TUid  KMusicPlayerAppUid = { 0x102072C3 };
+
+// RProperty key to identify the case when Music Player launching
+// in the background
+const TInt KMPXLaunchingOnBackground( 100 );
+
+//map values
+_LIT( KActionPlaybackCommand , "PlaybackCommand" );
+_LIT( KactionMessageToMusicPlayer, "MessageToMusicPlayer" );
+_LIT( KGoToNowPlaying, "GoToNowPlaying" );
+_LIT( KGoToLastPlayed, "GoToLastPlayed" );
+_LIT( KGoToLastPlayedMinimized, "GoToLastPlayedMinimized" );
+_LIT( KGoToMusicLibrary, "GoToMusicLibrary" );
+
+//map keys
+_LIT8( KType, "type" );
+_LIT8( KCommand, "command" );
+_LIT8( KMessage, "message" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMusicPlayerActionHandler::ConstructL()
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::ConstructL()");
+    
+    //iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
+    iPlaybackUtility = MMPXPlaybackUtility::NewL( KMusicPlayerAppUid);
+
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::ConstructL()");
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMusicPlayerActionHandler* CMusicPlayerActionHandler::NewL()
+    {
+    CMusicPlayerActionHandler* self = CMusicPlayerActionHandler::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMusicPlayerActionHandler* CMusicPlayerActionHandler::NewLC()
+    {
+    CMusicPlayerActionHandler* self = new( ELeave ) CMusicPlayerActionHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// destructor
+// ---------------------------------------------------------------------------
+//
+CMusicPlayerActionHandler::~CMusicPlayerActionHandler()
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::~CMusicPlayerActionHandler()");
+    if ( iPlaybackUtility )
+        {
+        iPlaybackUtility->Close();
+        }
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::~CMusicPlayerActionHandler()");
+    }
+
+// ---------------------------------------------------------------------------
+// Executes Playback command on current player
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::ExecutePlaybackCommandL(const CLiwMap* aMap)
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::ExecutePlaybackCommandL()");
+    TInt errCode;
+    TLiwVariant variant;
+    variant.PushL();
+    errCode = ExtractVariantL( aMap, variant, KCommand );
+    if ( errCode == KErrNone )
+        {
+        TMPXPlaybackCommand Command;
+        Command = static_cast<TMPXPlaybackCommand>( variant.AsTInt32() );
+        iPlaybackUtility->CommandL( Command );
+        }
+    CleanupStack::PopAndDestroy( &variant);
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::ExecutePlaybackCommandL()");
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// Sends a message to music player
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::ExecuteMessageToMusicPlayerL(
+        const CLiwMap* aMap )
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::"
+            "ExecuteMessageToMusicPlayerL()");
+    TInt errCode;
+    RBuf msg;
+    CleanupClosePushL( msg );
+    errCode = ExtractDesL( aMap, msg, KMessage );
+    if ( errCode == KErrNone )
+        {
+        if ( ! msg.CompareF( KGoToNowPlaying ) )
+            {
+            errCode = GoToNowPlayingL();
+            }
+        else if ( ! msg.CompareF( KGoToLastPlayed ) )
+            {
+            errCode = GoToLastPlayedL( EFalse );
+            }
+        else if ( ! msg.CompareF( KGoToLastPlayedMinimized ) )
+            {
+            errCode = GoToLastPlayedL( ETrue );
+            }
+        else if ( ! msg.CompareF( KGoToMusicLibrary ) )
+            {
+            errCode = GoToMusicLibraryL();
+            }        
+        }
+    CleanupStack::PopAndDestroy( &msg );
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::"
+            "ExecuteMessageToMusicPlayerL()");
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// Opens musicplayer in library view, even if it is already open and playing.
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::GoToMusicLibraryL()
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::GoToNowPlayingL()");
+    //Launch player
+    RWsSession wsSession;
+    User::LeaveIfError( wsSession.Connect() );
+    CAknTaskList *taskList = CAknTaskList::NewL( wsSession );
+    TApaTask task = taskList->FindRootApp( KAppUidMusicPlayerX );
+    delete taskList;
+    CMPXParameter* param = new ( ELeave ) CMPXParameter();
+    CleanupStack::PushL( param );
+    param->iType.iUid = KMPXPluginTypeCollectionUid;
+    param->iCmdForward = EMPXCmdFwdNone;
+
+    MMPXCollectionUiHelper* collectionHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+    CMPXCollectionPath* path = collectionHelper->MusicMenuPathL();
+    if (path)
+        {
+        param->iCollectionPath = path;
+        param->iPathType = EMPXTypeCollectionPath;
+        }
+    collectionHelper->Close();
+    
+    CBufBase* buffer =
+            CBufFlat::NewL( KPlayerMusicPlayerParameterGranularity );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream writeStream( *buffer );
+    CleanupClosePushL( writeStream );
+    param->ExternalizeL( writeStream );
+    writeStream.CommitL();
+    buffer->Compress();
+    CleanupStack::PopAndDestroy( &writeStream );
+    if ( task.Exists() )
+        {
+//        task.SendMessage( KAppUidMusicPlayerX, buffer->Ptr( 0 ));
+        wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX,
+                    buffer->Ptr( 0 ) );
+        }
+    else        //Application needs to be launched. The first view is library view.
+        {
+        // Launch Music Player Application
+        RApaLsSession   appArcSession;
+        _LIT(KEmpty,"");
+        User::LeaveIfError(appArcSession.Connect());    // connect to AppArc server
+        TThreadId id;
+        appArcSession.StartDocument( KEmpty, KAppUidMusicPlayerX, id );
+        appArcSession.Close();                                
+        }
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PopAndDestroy( param );
+    wsSession.Close();
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::GoToNowPlayingL()");
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Opens musicplayer, if it is already open and playing it goes to nowplaying.
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::GoToNowPlayingL()
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::GoToNowPlayingL()");
+    //Launch player
+    RWsSession wsSession;
+    User::LeaveIfError( wsSession.Connect() );
+    CAknTaskList *taskList = CAknTaskList::NewL( wsSession );
+    TApaTask task = taskList->FindRootApp( KAppUidMusicPlayerX );
+    delete taskList;
+    CMPXParameter* param = new ( ELeave ) CMPXParameter();
+    CleanupStack::PushL( param );
+    param->iType.iUid = KMPXPluginTypePlaybackUid;
+    param->iCmdForward = EMPXCmdFwdNone;
+    CBufBase* buffer =
+            CBufFlat::NewL( KPlayerMusicPlayerParameterGranularity );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream writeStream( *buffer );
+    CleanupClosePushL( writeStream );
+    param->ExternalizeL( writeStream );
+    writeStream.CommitL();
+    buffer->Compress();
+    CleanupStack::PopAndDestroy( &writeStream );
+    if ( task.Exists() )
+        {
+        wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX,
+                    buffer->Ptr( 0 ) );
+        
+        
+        }
+    else
+        {
+        RApaLsSession ls;
+        CleanupClosePushL( ls );
+        User::LeaveIfError( ls.Connect() );
+        TApaAppInfo appInfo;
+        User::LeaveIfError( ls.GetAppInfo( appInfo, KAppUidMusicPlayerX ) );
+        CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC();
+        apaCommandLine->SetExecutableNameL( appInfo.iFullName );
+        apaCommandLine->SetTailEndL( buffer->Ptr( 0 ) );
+        User::LeaveIfError( ls.StartApp( *apaCommandLine ) );
+        CleanupStack::PopAndDestroy(); // apaCommandLine
+        CleanupStack::PopAndDestroy(); // ls
+        }
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PopAndDestroy( param );
+    wsSession.Close();
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::GoToNowPlayingL()");
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Opens Stand alone MP and goes to now playing, it will display last played
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::GoToLastPlayedL( TBool aMinimized )
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::GoToLastPlayed()");
+    //Launch player
+    RWsSession wsSession;
+    User::LeaveIfError( wsSession.Connect() );
+    CAknTaskList *taskList = CAknTaskList::NewL( wsSession );
+    TApaTask task = taskList->FindRootApp( KAppUidMusicPlayerX );
+    delete taskList;
+    CMPXParameter* param = new ( ELeave ) CMPXParameter();
+    CleanupStack::PushL( param );
+    param->iType.iUid = KMPXPluginTypeLastPlayedUid;//KMPXPluginTypePlaybackUid;
+    param->iCmdForward = EMPXCmdFwdNone;
+    CBufBase* buffer =
+            CBufFlat::NewL( KPlayerMusicPlayerParameterGranularity );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream writeStream( *buffer );
+    CleanupClosePushL( writeStream );
+    param->ExternalizeL( writeStream );
+    writeStream.CommitL();
+    buffer->Compress();
+    CleanupStack::PopAndDestroy( &writeStream );
+    if ( task.Exists() )
+        {
+        wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX,
+                    buffer->Ptr( 0 ) );
+        if (!aMinimized)
+            {
+            task.BringToForeground();
+            }
+        }
+    else
+        {
+        RApaLsSession ls;
+        CleanupClosePushL( ls );
+        User::LeaveIfError( ls.Connect() );
+        TApaAppInfo appInfo;
+        User::LeaveIfError( ls.GetAppInfo( appInfo, KAppUidMusicPlayerX ) );
+        CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC();
+        if (aMinimized)
+            {
+            apaCommandLine->SetCommandL(EApaCommandBackground);
+            
+            TInt err( RProperty::Define(
+                KAppUidMusicPlayerX, KMPXLaunchingOnBackground, RProperty::EInt ) );
+            MPX_DEBUG2( "CMusicPlayerActionHandler::GoToLastPlayed() RProperty define err = %d", err );
+            if ( err == KErrNone || err == KErrAlreadyExists )
+                {
+                err = RProperty::Set( KAppUidMusicPlayerX,
+                            KMPXLaunchingOnBackground,
+                            ETrue );
+                MPX_DEBUG2( "CMusicPlayerActionHandler::GoToLastPlayed() RProperty set to true err = %d", err );
+                }
+            }
+        apaCommandLine->SetExecutableNameL( appInfo.iFullName );
+        apaCommandLine->SetTailEndL( buffer->Ptr( 0 ) );
+        User::LeaveIfError( ls.StartApp( *apaCommandLine ) );
+        CleanupStack::PopAndDestroy(); // apaCommandLine
+        CleanupStack::PopAndDestroy(); // ls
+        
+        if ( aMinimized )
+            {
+            TInt err = RProperty::Set( KAppUidMusicPlayerX,
+                        KMPXLaunchingOnBackground,
+                        EFalse );
+            MPX_DEBUG2( "CMusicPlayerActionHandler::GoToLastPlayed() RProperty set to false err = %d", err );
+            }
+        }
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PopAndDestroy( param );
+    wsSession.Close();
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::GoToLastPlayed()");
+    return KErrNone;
+    }
+// ---------------------------------------------------------------------------
+// Extracts a descriptor
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::ExtractDesL( const CLiwMap* aMap,
+        RBuf& aString, const TDesC8& aMapName )
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::ExtractDesL()");
+    TInt errCode( KErrArgument );
+    TLiwVariant variant;
+    variant.PushL();
+    TPtrC tempString( KNullDesC );
+    if ( aMap->FindL( aMapName, variant) )
+        {
+        variant.Get( tempString );
+        aString.ReAllocL( tempString.Length() );
+        aString.Append( tempString );
+        errCode = KErrNone;
+        }
+    CleanupStack::PopAndDestroy( &variant );
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::ExtractDesL()");
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// Extract variant
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::ExtractVariantL( const CLiwMap* aMap,
+        TLiwVariant& aVariant, const TDesC8& aMapName )
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::ExtractVariantL()");
+    TInt errCode( KErrNone );
+    if ( ! aMap->FindL( aMapName, aVariant ) )
+        {
+        errCode = KErrArgument;
+        }
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::ExtractVariantL()");
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// From CAHPlugin
+// Executes provided action
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::ExecuteActionL( const CLiwMap* aMap )
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::ExecuteActionL()");
+    TInt errCode;
+    RBuf type;
+    CleanupClosePushL( type );
+    errCode = ExtractDesL( aMap, type, KType );
+    if ( errCode == KErrNone )
+        {
+        if ( ! type.CompareF( KActionPlaybackCommand ) )
+            {
+            errCode = ExecutePlaybackCommandL( aMap );
+            }
+        else
+            if ( ! type.CompareF( KactionMessageToMusicPlayer ) )
+                {
+                errCode = ExecuteMessageToMusicPlayerL( aMap );
+                }
+        }
+    CleanupStack::PopAndDestroy( &type );
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::ExecuteActionL()");
+    return errCode;
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/musicplayeractionhandlerplugin/src/proxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player Action Handler Plugin Implementation Proxy
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "musicplayeractionhandleruids.hrh"
+#include "musicplayeractionhandler.h"
+
+// ---------------------------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KMusicPlayerActionHandlerUID,
+            CMusicPlayerActionHandler::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// Exported proxy for instantiation method resolution
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+        TInt& aTableCount )
+    {
+    aTableCount =
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+
+    return ImplementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/rom/musichomescreen.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Widget
+*
+*/
+
+
+#ifndef MUSICHOMESCREEN_IBY
+#define MUSICHOMESCREEN_IBY
+
+#include <bldvariant.hrh>
+
+
+
+//Music Widget with xuikon resource
+//data=\epoc32\release\winscw\udeb\Z\private\200159c0\themes\2456\270513751\270564376\1.0\mw.o0000  private\200159c0\themes\2456\270513751\270564376\1.0\mw.o0000
+//data=\epoc32\release\winscw\udeb\Z\private\200159c0\themes\2456\270513751\270564376\1.0\sources\musicwidget.o0000  private\200159c0\themes\2456\270513751\270564376\1.0\sources\musicwidget.o0000
+//data=\epoc32\release\winscw\udeb\Z\private\200159c0\themes\2456\270513751\270564376\1.0\sources\box_bg_1x1.svg  private\200159c0\themes\2456\270513751\270564376\1.0\sources\box_bg_1x1.svg
+
+//TEMP IMAGES
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_prop_image_tb_pause_dimmed2.png resource\apps\qgn_prop_image_tb_pause_dimmed2.png
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_prop_image_tb_play2_dimmed2.png resource\apps\qgn_prop_image_tb_play2_dimmed2.png
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_prop_image_tb_stop_dimmed2.png resource\apps\qgn_prop_image_tb_stop_dimmed2.png
+
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_indi_mup_home_pause.png resource\apps\qgn_indi_mup_home_pause.png
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_indi_mup_home_play.png resource\apps\qgn_indi_mup_home_play.png
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_indi_mup_home_no_music.png resource\apps\qgn_indi_mup_home_no_music.png
+
+data=ZRESOURCE\apps\musichomescreenicons.mif APP_RESOURCE_DIR\musichomescreenicons.mif
+
+#endif // MUSICHOMESCREEN_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/rom/musichomescreenrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Homescreen Resources
+*
+*/
+
+
+
+#ifndef MUSICHOMESCREENRSC_IBY
+#define MUSICHOMESCREENRSC_IBY
+
+data=DATAZ_\resource\apps\musichomescreen.rsc	resource\apps\musichomescreen.rsc
+
+#endif // MUSICHOMESCREENRSC_IBY
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/rom/musicmatrixmenu.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Suite for Matrix Menu
+*
+*/
+
+
+#ifndef MUSICMATRIXMENU_IBY
+#define MUSICMATRIXMENU_IBY
+
+data=\epoc32\include\musichomescreen.rsg resource\apps\musichomescreen.rsg
+data=\epoc32\data\z\private\101F4CD2\import\suites\musicsuite\suite.xml private\101F4CD2\import\suites\musicsuite\suite.xml
+data=\epoc32\data\z\private\101F4CD2\import\suites\musicsuite\music_matrix_items.xml private\101F4CD2\import\suites\musicsuite\music_matrix_items.xml
+
+#endif // MUSICMATRIXMENU_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/src/dummy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: dummy
+*
+*/
+
+#include <e32def.h>
+
+EXPORT_C int E32Main()
+{
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen/src/mpxresource.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class provide API to read resource from resource file
+*
+*/
+
+
+// INCLUDE FILES
+#include <barsread.h>
+#include <mpxuser.h>
+#include <mpxlog.h>
+#include "mpxresource.h"
+
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Factory function
+// ----------------------------------------------------------------------------
+//
+CMPXResource* CMPXResource::NewL(const TDesC& aResourceFile)
+    {
+    CMPXResource* resObj = NewLC(aResourceFile);
+    CleanupStack::Pop(resObj);
+    return resObj;
+    }
+
+// ----------------------------------------------------------------------------
+// Factory function
+// ----------------------------------------------------------------------------
+//
+CMPXResource* CMPXResource::NewLC(const TDesC& aResourceFile)
+    {
+    MPX_DEBUG1("CMPXResource::NewLC");
+    CMPXResource* self = new (ELeave) CMPXResource();
+    CleanupStack::PushL (self);
+    self->ConstructL(aResourceFile);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Decrements the reference count, and delete the object if it is 0
+// ----------------------------------------------------------------------------
+//
+void CMPXResource::Release()
+    {
+    delete this;
+    }
+
+// ----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that might leave
+// ----------------------------------------------------------------------------
+//
+CMPXResource::CMPXResource()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Contruct the object
+// ----------------------------------------------------------------------------
+//
+void CMPXResource::ConstructL(const TDesC& aResourceFile)
+    {
+    // In order to support installation of individual plugin.
+    // aResourceFile must be a final name.
+    // All parse should be done in the plugin side.
+    MPX_DEBUG1("CMPXResource::ConstructL");
+    User::LeaveIfError(iFs.Connect());
+    MPX_DEBUG2("Open resource file %S", &aResourceFile);
+    iResourceFile.OpenL(iFs, aResourceFile);
+    iResourceFile.ConfirmSignatureL(0);
+    MPX_DEBUG1("CMPXResource::ConstructL End");
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXResource::~CMPXResource()
+    {
+    iResourceFile.Close();
+    iFs.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of descriptors
+// ----------------------------------------------------------------------------
+//
+CDesCArrayFlat* CMPXResource::ReadDesCArrayL(TInt aResourceId)
+    {
+    CDesCArrayFlat* descArray = ReadDesCArrayLC(aResourceId);
+    CleanupStack::Pop(descArray);
+    return descArray;
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of descriptors, leave on cleanup stack
+// ----------------------------------------------------------------------------
+//
+CDesCArrayFlat* CMPXResource::ReadDesCArrayLC(TInt aResourceId)
+    {
+    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC");
+    TResourceReader resReader;
+    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
+    resReader.SetBuffer(readBuffer);
+    CDesCArrayFlat* descArray = resReader.ReadDesCArrayL();
+    CleanupStack::PopAndDestroy(readBuffer);
+    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC End");
+    CleanupStack::PushL(descArray);
+    return descArray;
+    }
+
+// ----------------------------------------------------------------------------
+// Get a heap descriptor from the resource file
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXResource::ReadHBufCL(TInt aResourceId)
+    {
+    //MPX_DEBUG1("CMPXResource::ReadHBufCL");
+    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
+    TResourceReader resReader;
+    resReader.SetBuffer(readBuffer);
+    //resource type has to be LBUF
+    HBufC* hbuf = resReader.ReadHBufCL();
+    CleanupStack::PopAndDestroy(readBuffer);
+    return hbuf;
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of menu items
+// ----------------------------------------------------------------------------
+//
+CDesCArrayFlat* CMPXResource::ReadMenuArrayL(TInt aResourceId, RArray<TInt>& aIdArray)
+    {
+    CDesCArrayFlat* menuArray = ReadMenuArrayLC(aResourceId, aIdArray);
+    CleanupStack::Pop(menuArray);
+    return menuArray;
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of menu items, leave on cleanup stack
+// ----------------------------------------------------------------------------
+//
+CDesCArrayFlat* CMPXResource::ReadMenuArrayLC(TInt aResourceId, RArray<TInt>& aIdArray)
+    {
+    //MPX_DEBUG1("CMPXResource::ReadMenuArrayLC");
+    TResourceReader resReader;
+    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
+    resReader.SetBuffer(readBuffer);
+    TInt count(resReader.ReadInt16());
+    CDesCArrayFlat* descArray = new (ELeave) CDesCArrayFlat(count); ;
+    for (TInt k = 0; k < count; k++)
+              {
+              aIdArray.AppendL (resReader.ReadInt32());
+              HBufC* hbuf = resReader.ReadHBufCL();
+              CleanupStack::PushL(hbuf);
+              descArray->AppendL (*hbuf);
+              CleanupStack::PopAndDestroy(hbuf);
+        }
+    CleanupStack::PopAndDestroy(readBuffer);
+    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC End");
+    CleanupStack::PushL(descArray);
+    return descArray;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/bwins/dummyMusicu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?E32Main@@YAHXZ @ 1 NONAME ; int E32Main(void)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/music_matrix_items.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mm:content xmlns:mm="http://nokia.com/mmenu" 
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+            xsi:schemaLocation="http://nokia.com/mmenu ../mmenuschema.xsd" genre="musicsuite">
+<mm:localization namespace="musicsuite_loc" source="musichomescreen.rsc"/>
+
+    
+		<mm:item count="musicquery2:results/[$count]" template="logical_template_6" id="msuitecps"> 
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_OPEN" event="key:select" position="1" />
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_HELP" event="custom:musicsuitehelp" position="2" />
+        <mm:query namespace="musicquery" service="Service.ContentPublishing" interface="IDataSource">
+        <mm:command mode="sync" name="GetList">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter">
+                    	<mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="text"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_text1"/>
+                    </mm:key>
+            </mm:command>
+        </mm:query>
+        <mm:notify_request service="Service.ContentPublishing" interface="IDataSource">
+            <mm:command name="RequestNotification">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter"> 
+                        <mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="text"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_text1"/>
+                    </mm:key>
+            </mm:command>
+       </mm:notify_request>
+
+        <mm:output alias="mul_title" type="string" value="musicquery:results/[$index]/data_map/musicmenu_musicinfo_text1data"/>
+        
+        <mm:query namespace="musicquery2" service="Service.ContentPublishing" interface="IDataSource">
+        <mm:command mode="sync" name="GetList">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter">
+                    	<mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="text"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_text2"/>
+                    </mm:key>
+            </mm:command>
+        </mm:query>
+        <mm:notify_request service="Service.ContentPublishing" interface="IDataSource">
+            <mm:command name="RequestNotification">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter"> 
+                        <mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="text"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_text2"/>
+                    </mm:key>
+            </mm:command>
+       	</mm:notify_request>
+       
+        <mm:output alias="mul_detail" type="string" value="musicquery2:results/[$index]/data_map/musicmenu_musicinfo_text2data"/>
+        
+
+
+
+        <mm:query namespace="musicquery3" service="Service.ContentPublishing" interface="IDataSource">
+        <mm:command mode="sync" name="GetList">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter">
+                    	<mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="image"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_image"/>
+                    </mm:key>
+            </mm:command>
+        </mm:query>
+        <mm:notify_request service="Service.ContentPublishing" interface="IDataSource">
+            <mm:command name="RequestNotification">
+                    <mm:key name="type" type="string" value="cp_data"/>
+                    <mm:key name="filter"> 
+                        <mm:key name="publisher" type="string" value="MWPublisher"/>
+                    	<mm:key name="content_type" type="string" value="image"/>
+                    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_image"/>
+                    </mm:key>
+            </mm:command>
+       	</mm:notify_request>
+       
+        <mm:output alias="mul_icon">
+        <mm:image bitmap="musicquery3:results/[$index]/data_map/musicmenu_musicinfo_imagedata" mask="musicquery3:results/[$index]/data_map/musicmenu_musicinfo_imagedata_mask"/>
+        </mm:output>
+
+
+
+        <mm:event event="key:select">
+        	<mm:action service="Service.ContentPublishing" interface="IContentPublishing">
+				<mm:command name="ExecuteAction">
+					<mm:key name="type" type="string" value="cp_data"/>
+					<mm:key name="filter" type="map">
+						<mm:key name="publisher" type="string" value="MWPublisher"/>
+						<mm:key name="content_type" type="string" value="text"/>
+				    	<mm:key name="content_id" type="string" value="musicmenu_musicinfo_text1"/>
+						<mm:key name="action_trigger" type="string8" value="MMInfoTrigger"/>
+                    </mm:key>
+                </mm:command>
+            </mm:action>
+        </mm:event>
+    </mm:item>   
+    
+    <mm:item count="1" template="logical_template_6" id="msuitemymusic">
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_OPEN" event="key:select" position="1" />
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_HELP" event="custom:musicsuitehelp" position="2" />
+        <mm:output alias="mul_title">
+        	<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_MY_MUSIC"/>
+        </mm:output>
+    	<mm:query namespace="musicquery3" service="Service.ContentPublishing" interface="IDataSource">
+        	<mm:command mode="sync" name="GetList">
+            	<mm:key name="type" type="string" value="cp_data"/>
+                <mm:key name="filter">
+                   	<mm:key name="publisher" type="string" value="MpxCollectionPublisher"/>
+                   	<mm:key name="content_type" type="string" value="integer"/>
+                   	<mm:key name="content_id" type="string" value="musicmenu_collectioninfo_numb1"/>
+                </mm:key>
+            </mm:command>
+        </mm:query>
+        <mm:notify_request service="Service.ContentPublishing" interface="IDataSource">
+            <mm:command name="RequestNotification">
+     	       <mm:key name="type" type="string" value="cp_data"/>
+               <mm:key name="filter"> 
+               		<mm:key name="publisher" type="string" value="MpxCollectionPublisher"/>
+                    <mm:key name="content_type" type="string" value="integer"/>
+                   	<mm:key name="content_id" type="string" value="musicmenu_collectioninfo_numb1"/>
+               </mm:key>
+            </mm:command>
+       </mm:notify_request>
+
+		<!-- only one song present -->
+        <mm:output alias="mul_detail" condition="musicquery3:results/[$index]/data_map/musicmenu_collectioninfo_numb1data = 1">
+        	<mm:text value ="musicsuite_loc:R_MUSICHOMESCREEN_MY_MUSIC_1_SONG"/>
+        </mm:output>
+        <!-- multiple songs present -->
+        <mm:output alias="mul_detail" condition="musicquery3:results/[$index]/data_map/musicmenu_collectioninfo_numb1data &gt; 1">
+        	<!-- %N songs present -->
+        	<mm:text value ="musicsuite_loc:R_MUSICHOMESCREEN_MY_MUSIC_N_SONGS">
+ 				<mm:param value="musicquery3:results/[$index]/data_map/musicmenu_collectioninfo_numb1data"/>
+ 			</mm:text>
+        </mm:output>
+        <!-- default - no songs present -->
+        <mm:output alias="mul_detail">
+        	<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_MY_MUSIC_NO_SONGS"/>
+        </mm:output>
+        <mm:output alias="mul_icon">
+			<mm:image application_uid="0x102072C3"/>
+		</mm:output>    
+        
+        <mm:event event="key:select">
+            <mm:action service="Service.ActionHandler" interface="IDataAction">
+                <mm:command name="Execute">
+                    <mm:key name="plugin_id" type="uid" value="0x10207C16"/>
+                    <mm:key name="data">
+                        <mm:key name="type" type="string" value="MessageToMusicPlayer"/>
+                        <mm:key name="message" type="string" value="GoToMusicLibrary"/>
+                        <!--mm:key name="Path" type="string" value="MusicMenu"/-->
+                    </mm:key>
+                </mm:command>
+            </mm:action>
+        </mm:event>
+    </mm:item>
+   
+
+    <mm:item count="1" template="logical_template_6" id="msuitemusicstore">
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_OPEN" event="key:select" position="1" />
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_HELP" event="custom:musicsuitehelp" position="2" />
+        <mm:output alias="mul_title">
+        	<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_NOKIA_MUSIC_STORE"/>
+        </mm:output>
+        <mm:output alias="mul_detail">
+        		<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_NOKIA_STORE_AD"/>
+        </mm:output>
+        <mm:output alias="mul_icon">
+						<mm:image application_uid="0x101FFB51"/>
+		</mm:output> 
+        <mm:event event="key:select">
+            <mm:action service="Service.ActionHandler" interface="IDataAction">
+                <mm:command name="Execute">
+                    <mm:key>
+                        <mm:key name="plugin_id" type="uid" value="0x10282E5F"/>
+                        <mm:key name="data">
+                            <!-- At least one sub element is required in the data key. -->
+                            <mm:key name="type" type="string" value="launch_application"/>
+                            <mm:key name="launch_method" type="string" value="cmd_line"/>
+                            <mm:key name="application_uid" type="integer" value="0x101FFB51"/>
+                        </mm:key>
+                    </mm:key>
+                </mm:command>
+            </mm:action>      
+        </mm:event>
+    </mm:item>
+   
+   <mm:item count="1" template="logical_template_6" id="msuitefmradio">
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_OPEN" event="key:select" position="1" />
+				<mm:menuitem name="musicsuite_loc:R_MUSICHOMESCREEN_OPTIONS_HELP" event="custom:musicsuitehelp" position="2" />
+       	<mm:output alias="mul_title">
+        	<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_FM_RADIO"/>
+       	</mm:output>
+       	<mm:output alias="mul_detail">
+        	<mm:text value="musicsuite_loc:R_MUSICHOMESCREEN_FM_RADIO_AD"/>
+       	</mm:output>
+       	<mm:output alias="mul_icon">
+			<mm:image application_uid="0x10207A89"/>
+		</mm:output> 
+        <mm:event event="key:select">
+            <mm:action service="Service.ActionHandler" interface="IDataAction">
+                <mm:command name="Execute">
+                    <mm:key>
+                        <mm:key name="plugin_id" type="uid" value="0x10282E5F"/>
+                        <mm:key name="data">
+                            <!-- At least one sub element is required in the data key. -->
+                            <mm:key name="type" type="string" value="launch_application"/>
+                            <mm:key name="launch_method" type="string" value="cmd_line"/>
+                            <mm:key name="application_uid" type="integer" value="0x10207A89"/>
+                        </mm:key>
+                    </mm:key>
+                </mm:command>
+            </mm:action>
+        </mm:event> 
+    </mm:item>
+           
+</mm:content>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/musichomescreen.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource definitions for project MusicHomeScreen
+*
+*/
+
+
+NAME    MSCF
+
+#include <eikon.rsg>
+#include <eikon.rh>
+#include <avkon.rsg>
+#include <avkon.rh>
+#include <avkon.mbg>
+#include <avkon.loc>
+#include <appinfo.rh>
+#include <bldvariant.hrh>
+
+#include <data_caging_paths_strings.hrh>
+
+#include <musichomescreen.loc>
+
+// RESOURCE IDENTIFIER
+RESOURCE RSS_SIGNATURE { }
+
+RESOURCE TBUF { buf=""; }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_suite_title
+// Title for the music suite in the matrix menu
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_suite_title
+    {
+    buf = qtn_vmp_title_suite;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_fm_radio
+// Text for the title of the FM radio application 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_fm_radio
+    {
+    buf = qtn_vmp_title_fm_radio;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_fm_radio_ad
+// Text for the description of the FM radio 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_fm_radio_ad
+    {
+    buf = qtn_vmp_title_fm_radio_ad;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_last_played
+// Text for the most recently played song or track 
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_musichomescreen_last_played
+    {
+    txt = qtn_vmp_title_last_played;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_music_no_music
+// Text to indicate that that there are NO songs in the collection
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_music_no_music
+    {
+    buf = qtn_vmp_title_music_no_music;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_my_music
+// Text for title of the music collection item 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_my_music
+    {
+    buf = qtn_vmp_title_my_music;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_nokia_music_store
+// Text for nokia music store web service
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_nokia_music_store
+    {
+    buf = qtn_vmp_title_nokia_music_store;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_nokia_store_ad
+// Text for store description
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_nokia_store_ad
+    {
+    buf = qtn_vmp_title_nokia_store_ad;
+    }
+// ---------------------------------------------------------------------------
+// r_musichomescreen_now_playing
+// Text for currently playing song or track
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_musichomescreen_now_playing
+    {
+    txt = qtn_vmp_title_now_playing;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_my_music_1_song
+// Text to indicate that there is ONE song in the collection 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_my_music_1_song
+    {
+    buf = qtn_vmp_title_my_music_1_song;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_my_music_n_songs
+// Text to indicate that there are n songs in the collection 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_my_music_n_songs
+    {
+    buf = qtn_vmp_title_my_music_n_songs;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_my_music_no_songs
+// Text to indicate that there are no songs in the collection 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_my_music_no_songs
+    {
+    buf = qtn_vmp_title_my_music_no_songs;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_musichomescreen_go_to_music
+// Text to be displayed on the music widget when there is no played Music.
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_musichomescreen_go_to_music
+    {
+    txt = qtn_vmp_music_widget_go_to_music;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_musichomescreen_opening
+// Text too be displayed when we are about to open a song.
+// ---------------------------------------------------------------------------
+//
+RESOURCE LBUF r_musichomescreen_opening
+    {
+    txt = qtn_vmp_music_widget_opening;
+    }
+    
+// ---------------------------------------------------------------------------
+// r_musichomescreen_options_open
+// 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_options_open
+    {
+    buf = qtn_options_open;
+    }
+
+// ---------------------------------------------------------------------------
+// r_musichomescreen_options_help
+// 
+// ---------------------------------------------------------------------------
+//
+RESOURCE TBUF r_musichomescreen_options_help
+    {
+    buf = qtn_options_help;
+    }
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/suite.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<mm:content xmlns:mm="http://nokia.com/mmenu" 
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+            xsi:schemaLocation="http://nokia.com/mmenu ../mmenuschema.xsd">
+	<mm:localization namespace="musicsuite_loc" source="musichomescreen.rsc"/>
+	<mm:suite template="logical_template_6" type="list" genre="musicsuite" title="musicsuite_loc:R_MUSICHOMESCREEN_SUITE_TITLE">
+	<mm:event event="custom:musicsuitehelp">
+	        	<mm:action service="Service.ActionHandler" interface="IDataAction">
+               <mm:command name="Execute">
+                   <mm:key>
+                       <mm:key name="plugin_id" type="uid" value="0x2001B285"/>
+                       <mm:key name="data">
+                           <mm:key name="help_uid" type="integer" value="0x102072C3"/>
+                           <mm:key name="help_topic" type="string" value="MUS_HLP_MUSIC_SUITE_VIEW"/>
+                       </mm:key>
+                   </mm:key>
+               </mm:command>
+           	</mm:action>                
+	</mm:event>
+	</mm:suite>
+</mm:content>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,22 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  build inf file
+*
+*/
+
+
+#include "../install/musicwidget_10207c18/group/bld.inf"
+
+PRJ_PLATFORMS
+DEFAULT
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,78 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  The information required for building
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+// Support for productization and Carbide.Ui customization
+//********************************************************
+../hsps/00/manifest.dat /epoc32/data/Z/resource/homescreen/musicwidget_10207c18/hsps/manifest.dat
+../hsps/00/widgetconfiguration.xml /epoc32/data/Z/resource/homescreen/musicwidget_10207c18/hsps/widgetconfiguration.xml
+../hsps/00/musicwidgetconfiguration.dtd /epoc32/data/Z/resource/homescreen/musicwidget_10207c18/hsps/musicwidgetconfiguration.dtd
+../icons/musicwidgeticon.mif /epoc32/data/Z/resource/homescreen/musicwidget_10207c18/hsps/musicwidgeticon.mif
+
+../xuikon/00/MusicWidget.dat /epoc32/data/Z/resource/homescreen/musicwidget_10207c18/xuikon/MusicWidget_10207c18.dat
+../xuikon/00/MusicWidget.css /epoc32/data/Z/resource/homescreen/musicwidget_10207c18/xuikon/MusicWidget.css
+../xuikon/00/MusicWidget.xml /epoc32/data/Z/resource/homescreen/musicwidget_10207c18/xuikon/MusicWidget.xml
+
+// Arabic languages
+//*****************
+../xuikon/37/MusicWidget.css /epoc32/data/Z/resource/homescreen/musicwidget_10207c18/xuikon/37/MusicWidget.css
+../xuikon/50/MusicWidget.css /epoc32/data/Z/resource/homescreen/musicwidget_10207c18/xuikon/50/MusicWidget.css
+../xuikon/57/MusicWidget.css /epoc32/data/Z/resource/homescreen/musicwidget_10207c18/xuikon/57/MusicWidget.css
+../xuikon/94/MusicWidget.css /epoc32/data/Z/resource/homescreen/musicwidget_10207c18/xuikon/94/MusicWidget.css
+
+
+// Support for S60 localization
+//*****************************
+#ifndef __MUSICWIDGETCONFIGURATION_LOC__
+#define __MUSICWIDGETCONFIGURATION_LOC__
+../loc/musicwidgetconfiguration.loc         APP_LAYER_LOC_EXPORT_PATH(musicwidgetconfiguration.loc)
+#endif //__MUSICWIDGETCONFIGURATION_LOC__
+
+// Support for S60 builds
+//***********************
+../rom/musicwidget_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(musicwidget_10207c18_resources.iby)
+../rom/musicwidget_customer.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(musicwidget_10207c18_customer.iby)
+../rom/musicwidget_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(musicwidget_10207c18_variant.iby)
+../rom/musicwidget.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musicwidget_10207c18.iby)
+
+
+// Dtd-localization
+//*****************
+PRJ_EXTENSIONS
+START EXTENSION tools/dtd
+OPTION SWITCH_LOC_FILE_NAME musicwidget_10207c18
+OPTION DTD_TYPE widget
+OPTION LOC_FOLDERS yes
+END
+
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+
+//  End of File  
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/hsps/00/manifest.dat	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<package version="1.0">
+
+  <family>qhd_tch</family>
+
+
+  <type>widget</type>
+
+    <!-- interface uid -->
+  <interfaceuid>0x2001f48a</interfaceuid>
+
+	<!-- vendor uid  -->
+	<provideruid>0x101fb657</provideruid>
+
+	<!-- uid -->
+	<configurationuid>0x10207c18</configurationuid>
+
+	<!-- description -->
+	<fullname>&amp;qtn_musicwidget_configuration_name;</fullname>
+	<shortname>mw</shortname>
+	<version>1.0</version>
+
+	<description>&amp;qtn_musicwidget_configuration_desc;</description>
+	<filelogo>SKIN(270501603 8633): mif(musicwidgeticon.mif 16384 16385)</filelogo>
+	
+
+	<!-- configuration -->
+	<filexml>widgetconfiguration.xml</filexml>
+
+	<!-- Name of the localization files -->
+   <filedtd>musicwidgetconfiguration.dtd</filedtd>
+	<!-- Locale independent/common resources -->
+	
+
+  <!-- Locale specific resources -->
+	<localization>
+		<fileresource tag="xuikon">musicwidget.o0000</fileresource>
+	</localization>
+</package>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/hsps/00/musicwidgetconfiguration.dtd	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+============================================================================
+<FileName: "musicwidgetconfiguration.dtd">
+
+<FileDescription: "Localization strings for HSP Music Widget configuration">
+<FileVersion    : >
+
+<Copyright:
+"Copyright © 2008 Nokia Corporation.
+This material, including documentation and any related 
+computer programs, is protected by copyright controlled by 
+Nokia Corporation. All rights are reserved. Copying, 
+including reproducing, storing,  adapting or translating, any 
+or all of this material requires the prior written consent of 
+Nokia Corporation. This material also contains confidential 
+information which may not be disclosed to others without the 
+prior written consent of Nokia Corporation.">
+============================================================================
+-->
+
+<!--  LOCALISATION STRINGS  -->
+
+<!ENTITY qtn_musicwidget_configuration_name "Music Widget">
+<!ENTITY qtn_musicwidget_configuration_desc "Quick Access to your music library">
+
+<!-- End of File-->
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/hsps/00/widgetconfiguration.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+<configuration>
+    <control>
+        <settings/>
+    </control>
+</configuration>
Binary file musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/icons/musicwidgeticon.mif has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/loc/musicwidgetconfiguration.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for Music Widget Configuration
+*
+*/
+
+
+// d: This is the text used to identify the music widget,
+// d: this appears on the Widget manager's list
+// l: listrow_wgtman_pane_t1
+// w:
+// r: S60 v5.1
+#define qtn_musicwidget_configuration_name  "Music Widget"
+
+// d: This is the description for the music widget,
+// d: this appears on the Widget manager's list
+// l: listrow_wgtman_pane_t2
+// w:
+// r: S60 v5.1
+#define qtn_musicwidget_configuration_desc  "Quick access to your music"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/rom/musicwidget.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music widget HSPS-plugin IBY file.
+*
+*/
+
+
+#ifndef __MUSICWIDGET_10207c18_IBY__
+#define __MUSICWIDGET_10207c18_IBY__
+
+//#if defined(__LAYOUT_360_640_TOUCH) || defined(__LAYOUT_640_360_TOUCH)          
+
+// Enabled by DTD-localization tools
+data=ZPRIVATE\200159c0\install\musicwidget_10207c18\hsps\00\manifest.dat \private\200159c0\install\musicwidget_10207c18\hsps\00\manifest.dat
+
+//#endif // __LAYOUT_360_640_TOUCH || __LAYOUT_640_360_TOUCH 
+
+#endif // __MUSICWIDGET_10207c18_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/rom/musicwidget_customer.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music widget HSPS-plugin language specific IBY file.
+*
+*/
+
+
+#ifndef __MUSICWIDGET_10207c18_CUSTOMER_IBY__
+#define __MUSICWIDGET_10207c18_CUSTOMER_IBY__
+
+//#if defined(__LAYOUT_360_640_TOUCH) || defined(__LAYOUT_640_360_TOUCH)          
+
+// Enabled by DTD-localization tools, language specific
+data=ZPRIVATE\200159c0\install\musicwidget_10207c18\xuikon\00\musicwidget.o0000 \private\200159c0\install\musicwidget_10207c18\xuikon\00\musicwidget.o0000
+data=ZPRIVATE\200159c0\install\musicwidget_10207c18\hsps\00\musicwidgetconfiguration.dtd \private\200159c0\install\musicwidget_10207c18\hsps\00\musicwidgetconfiguration.dtd
+
+//#endif // __LAYOUT_360_640_TOUCH || __LAYOUT_640_360_TOUCH
+
+#endif // __MUSICWIDGET_10207c18_CUSTOMER_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/rom/musicwidget_resources.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music widget HSPS-plugin language specific IBY file.
+*
+*/
+
+
+#ifndef __MUSICWIDGET_10207c18_RESOURCES_IBY__
+#define __MUSICWIDGET_10207c18_RESOURCES_IBY__
+
+//#if defined(__LAYOUT_360_640_TOUCH) || defined(__LAYOUT_640_360_TOUCH)          
+
+// Enabled by DTD-localization tools, language specific
+#if defined (__LOCALES_37_IBY__)
+data=ZPRIVATE\200159c0\install\musicwidget_10207c18\xuikon\37\musicwidget.o0037 \private\200159c0\install\musicwidget_10207c18\xuikon\37\musicwidget.o0037
+#endif
+#if defined  (__LOCALES_50_IBY__)
+data=ZPRIVATE\200159c0\install\musicwidget_10207c18\xuikon\50\musicwidget.o0050 \private\200159c0\install\musicwidget_10207c18\xuikon\50\musicwidget.o0050
+#endif
+#if defined  (__LOCALES_57_IBY__)
+data=ZPRIVATE\200159c0\install\musicwidget_10207c18\xuikon\57\musicwidget.o0057 \private\200159c0\install\musicwidget_10207c18\xuikon\57\musicwidget.o0057
+#endif
+#if defined  (__LOCALES_94_IBY__)
+data=ZPRIVATE\200159c0\install\musicwidget_10207c18\xuikon\94\musicwidget.o0094 \private\200159c0\install\musicwidget_10207c18\xuikon\94\musicwidget.o0094
+#endif
+data=ZPRIVATE\200159c0\install\musicwidget_10207c18\hsps\00\musicwidgetconfiguration.dtd \private\200159c0\install\musicwidget_10207c18\hsps\00\musicwidgetconfiguration.dtd
+data=ZPRIVATE\200159c0\install\musicwidget_10207c18\hsps\00\musicwidgeticon.mif \private\200159c0\install\musicwidget_10207c18\hsps\00\musicwidgeticon.mif
+
+//#endif // __LAYOUT_360_640_TOUCH || __LAYOUT_640_360_TOUCH
+
+#endif // __MUSICWIDGET_10207c18_RESOURCES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/rom/musicwidget_variant.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music widget HSPS-plugin variant specific IBY file.
+*
+*/
+
+
+#ifndef __MUSICWIDGET_10207c18_VARIANT_IBY__
+#define __MUSICWIDGET_10207c18_VARIANT_IBY__
+
+//#if defined(__LAYOUT_360_640_TOUCH) || defined(__LAYOUT_640_360_TOUCH)          
+
+// Enabled by variation tools, variant specific
+data=ZPRIVATE\200159c0\install\musicwidget_10207c18\hsps\00\widgetconfiguration.xml \private\200159c0\install\musicwidget_10207c18\hsps\00\widgetconfiguration.xml
+
+//#endif // __LAYOUT_360_640_TOUCH || __LAYOUT_640_360_TOUCH
+
+#endif  // __MUSICWIDGET_10207c18_VARIANT_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/00/MusicWidget.css	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,135 @@
+widget#MusicWidget
+    {
+    display: block;
+    visibility: visible;
+    width:312px;
+    height:75px;
+    padding-top: 4px;
+    padding-bottom: 3px;
+    padding-left: 4px;
+    margin-left: auto;
+    margin-right: auto;
+    block-progression: rl;
+    direction: ltr;
+    nav-index:appearance;
+    }
+    
+box#area1
+    {
+    display: block;
+    visibility: visible;
+    width: 70px;
+    height: 70px;
+    margin-right: 3px;
+    padding-top: 3px;
+    padding-bottom: 2px;
+    padding-left: 2px;
+    padding-right: 2px;
+    direction: ltr;
+    block-progression: tb;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#area2
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: auto; 
+    block-progression: tb;
+    nav-index:appearance;
+    }
+    
+box#textbox
+    {
+    display: block;
+    visibility: visible;
+    margin-right: 3px;
+    width: 100%; 
+    height: 40%;
+    nav-index:appearance;
+    }
+
+box#toolbarbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 60%; 
+    block-progression: lr;
+    nav-index:appearance;
+    }
+    
+box.toolbarbuttonbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 100%;
+    margin-right: 3px;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+    
+box#textbox2
+    {
+    display: block;
+    visibility: visible;
+    margin-right: 3px;
+    width: auto; 
+    height: 100%; 
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#player_inactive
+{
+    display: block;
+
+}
+
+box#player_active
+{
+    display: none;
+}
+
+
+box:focus 
+    {
+    touchfeedbackdown: basic; 
+    touchfeedbackdrag: sensitive;
+    focus-background:"SKIN(268458534 9896)";
+    }
+
+
+image
+    {
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: auto;
+    margin-bottom: auto;
+    }
+image.area1_images
+    {
+    width: 70px;
+    height: 70px;
+    }
+    
+image.toolbarimage
+    {
+    width: 41px;
+    height: 41px;
+    }
+
+text
+    {
+    color:"SKIN(268458534 13056 74)";
+    display: block;
+    visibility: visible;
+    position: static;
+    font-family: EAknLogicalFontSecondaryFont;
+    font-size: 3.5u;
+    text-align:center;
+     direction: ltr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/00/MusicWidget.dat	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<data>
+    <AppUid>E029CF57</AppUid>
+    <Provideruid>101FB657</Provideruid>
+    <ThemeUid>10207C1C</ThemeUid>
+    <ThemeFullName>musicwidget</ThemeFullName>
+    <ThemeShortName>musicwidget</ThemeShortName>
+    <ThemeVersion>1.0</ThemeVersion>
+    <FileXML>MusicWidget.xml</FileXML>
+    <FileCSS>MusicWidget.css</FileCSS>
+</data>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/00/MusicWidget.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmluiml xmlns="http://www.series60.com/xml/xmluiml/1" version="1.0">
+
+
+    <widget id="MusicWidget">
+        <contentsource name="MWPublisher" value="0x20019594" />
+        <configuration name="service" value="Service.ContentPublishing"/>
+        <configuration name="interface" value="IContentPublishing"/>
+        <configuration name="command" value="GetList"/>
+        <configuration name="publisher" value="MWPublisher"/>
+	
+       
+        <box id="area1" focusable="true" _s60-initial-focus="1"> 
+            <actions>
+                <action>
+                    <trigger name="stylus">
+                        <property name="eventtype" value="up" />
+                    </trigger>
+                    <trigger name="activate"/>
+                    <trigger name="keyevent">
+                        <property name="scancode" value="3"/>
+                        <property name="eventtype" value="1"/>
+                    </trigger>
+                    <event name="MWPublisher/area1_image1(MWTrigger1)"/>
+                </action>
+            </actions>
+
+          <image class="area1_images" id="DefaultImage" path="SKIN(270501603 8633)"/>
+            <image class="area1_images" id="area1_image1">
+            		<configuration name="content_type" value="area1_image1"/>
+                <property class="MWPublisher/area1_image1_data"/>
+                <property class="policy/emptyContent" name="DefaultImage" value="display: block;"/>
+                <property class="policy/Content" name="DefaultImage" value="display: none;"/>
+                
+            </image>
+        </box><!--#area1-->
+
+        <box id="area2">        
+            <box id="player_inactive" visualisationaware="true">            
+                <box id="textbox2" focusable="true">
+                <actions>
+                    <action>
+                        <trigger name="stylus">
+                            <property name="eventtype" value="up" />
+                        </trigger>
+                        <trigger name="activate"/>
+                        <trigger name="keyevent">
+                            <property name="scancode" value="3"/>
+                            <property name="eventtype" value="1"/>
+                        </trigger>
+                        <event name="MWPublisher/default_text(MWTrigger2)"/>
+                    </action>
+                    <action>                    
+                        <trigger name="losevisualisation" />
+                        <event name="system/setfocus">
+                            <property name="id" value="area1"/>
+                        </event>                    
+                    </action>
+                </actions>
+    
+                <text id="area2_default_text">
+                		<configuration name="content_type" value="default_text"/>
+                    <property class="MWPublisher/default_text_data"/>                
+                    <property class="policy/emptyContent" name="player_inactive" value="display: none;"/>
+                    <property class="policy/emptyContent" name="player_active" value="display: block;"/>
+                    
+                    <property class="policy/Content"      name="player_inactive" value="display: block;"/>
+                    <property class="policy/Content"      name="player_active" value="display: none;"/>
+                                        
+                    
+                </text>
+                </box><!--#textbox2-->            
+            </box>
+            
+            <box id="player_active" visualisationaware="true">
+                <box id="textbox">
+                    <text id="area2_text1">
+                    		<configuration name="content_type" value="area2_text1"/>
+                        <property class="MWPublisher/area2_text1_data"/>
+                    </text>
+    
+                </box><!--#textbox-->
+    
+                <box id="toolbarbox">
+                    <box id="toolbarbutton1" class="toolbarbuttonbox" focusable="true">
+                        <actions>
+                            <action>
+                                <trigger name="stylus">
+                                    <property name="eventtype" value="up" />
+                                </trigger>
+                                <trigger name="activate"/>
+                                <trigger name="keyevent">
+                                    <property name="scancode" value="3"/>
+                                    <property name="eventtype" value="1"/>
+                                </trigger>
+                                <event name="MWPublisher/toolbar_b1(TB1Trigger)"/>
+                            </action>
+                            <action>
+                                <trigger name="losevisualisation" />
+                                <event name="system/setfocus">
+                                    <property name="id" value="area1"/>
+                                </event>
+                            </action>
+                        </actions>
+                        <image class="toolbarimage" id="toolbarimage1" >
+                        		<configuration name="content_type" value="toolbar_b1"/>
+                            <property class="MWPublisher/toolbar_b1_data"/>
+                        </image>
+                    </box><!--.toolbarbuttonbox-->
+    
+                    <box id="toolbarbutton2" class="toolbarbuttonbox" focusable="true">
+                        <actions>
+                            <action>
+                                <trigger name="stylus">
+                                    <property name="eventtype" value="up" />
+                                </trigger>
+                                <trigger name="activate"/>
+                                <trigger name="keyevent">
+                                    <property name="scancode" value="3"/>
+                                    <property name="eventtype" value="1"/>
+                                </trigger>
+                                <event name="MWPublisher/toolbar_b2(TB2Trigger)"/>
+                            </action>
+                            <action>
+                                <trigger name="losevisualisation" />
+                                <event name="system/setfocus">
+                                    <property name="id" value="area1"/>
+                                </event>
+                            </action>
+                        </actions>
+                        <image class="toolbarimage" id="toolbarimage2">
+                        		<configuration name="content_type" value="toolbar_b2"/>
+                            <property class="MWPublisher/toolbar_b2_data"/>                            
+                            <property class="policy/emptyContent"      name="player_active" value="display: none;"/>
+			    									<property class="policy/emptyContent"      name="player_inactive" value="display: block;"/>                                                        
+                            
+                        </image>
+                    </box><!--.toolbarbuttonbox-->
+    
+                    <box id="toolbarbutton3" class="toolbarbuttonbox" focusable="true">
+                        <actions>
+                            <action>
+                                <trigger name="stylus">
+                                    <property name="eventtype" value="up" />
+                                </trigger>
+                                <trigger name="activate"/>
+                                <trigger name="keyevent">
+                                    <property name="scancode" value="3"/>
+                                    <property name="eventtype" value="1"/>
+                                </trigger>
+                                <event name="MWPublisher/toolbar_b3(TB3Trigger)"/>
+                            </action>
+                            <action>
+                                <trigger name="losevisualisation" />
+                                <event name="system/setfocus">
+                                    <property name="id" value="area1"/>
+                                </event>
+                            </action>
+                        </actions>
+                        <image class="toolbarimage" id="toolbarimage3">
+                        		<configuration name="content_type" value="toolbar_b3"/>
+                            <property class="MWPublisher/toolbar_b3_data"/>
+                        </image>
+                    </box><!--.toolbarbuttonbox-->    
+                </box><!--#toolbarbox-->                
+            </box>                                
+        </box><!--#area2-->
+    </widget><!--#MusicWidget-->
+</xmluiml>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/37/MusicWidget.css	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,136 @@
+widget#MusicWidget
+    {
+    display: block;
+    visibility: visible;
+    width:312px;
+    height:75px;
+    padding-top: 4px;
+    padding-bottom: 3px;
+    padding-right: 4px;
+    margin-left: auto;
+    margin-right: auto;
+    block-progression: rl;
+    direction: rtl;
+    nav-index:appearance;
+    }
+    
+box#area1
+    {
+    display: block;
+    visibility: visible;
+    width: 70px;
+    height: 70px;
+    margin-left: 3px;
+    padding-top: 3px;
+    padding-bottom: 2px;
+    padding-left: 2px;
+    padding-right: 2px;
+    direction: ltr;
+    block-progression: tb;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#area2
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: auto; 
+    block-progression: tb;
+    nav-index:appearance;
+    }
+    
+box#textbox
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: 100%; 
+    height: 40%;
+    nav-index:appearance;
+    }
+
+box#toolbarbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 60%;
+    direction: ltr;
+    block-progression: rl;
+    nav-index:appearance;
+    }
+    
+box.toolbarbuttonbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 100%;
+    margin-left: 3px;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+    
+box#textbox2
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: auto; 
+    height: 100%; 
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#player_inactive
+{
+    display: block;
+
+}
+
+box#player_active
+{
+    display: none;
+}
+
+
+box:focus 
+    {
+    touchfeedbackdown: basic; 
+    touchfeedbackdrag: sensitive;
+    focus-background:"SKIN(268458534 9896)";
+    }
+
+
+image
+    {
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: auto;
+    margin-bottom: auto;
+    }
+image.area1_images
+    {
+    width: 70px;
+    height: 70px;
+    }
+    
+image.toolbarimage
+    {
+    width: 41px;
+    height: 41px;
+    }
+
+text
+    {
+    color:"SKIN(268458534 13056 74)";
+    display: block;
+    visibility: visible;
+    position: static;
+    font-family: EAknLogicalFontSecondaryFont;
+    font-size: 3.5u;
+    text-align:center;
+    direction: ltr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/50/MusicWidget.css	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,136 @@
+widget#MusicWidget
+    {
+    display: block;
+    visibility: visible;
+    width:312px;
+    height:75px;
+    padding-top: 4px;
+    padding-bottom: 3px;
+    padding-right: 4px;
+    margin-left: auto;
+    margin-right: auto;
+    block-progression: rl;
+    direction: rtl;
+    nav-index:appearance;
+    }
+    
+box#area1
+    {
+    display: block;
+    visibility: visible;
+    width: 70px;
+    height: 70px;
+    margin-left: 3px;
+    padding-top: 3px;
+    padding-bottom: 2px;
+    padding-left: 2px;
+    padding-right: 2px;
+    direction: ltr;
+    block-progression: tb;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#area2
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: auto; 
+    block-progression: tb;
+    nav-index:appearance;
+    }
+    
+box#textbox
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: 100%; 
+    height: 40%;
+    nav-index:appearance;
+    }
+
+box#toolbarbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 60%;
+    direction: ltr;
+    block-progression: rl;
+    nav-index:appearance;
+    }
+    
+box.toolbarbuttonbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 100%;
+    margin-left: 3px;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+    
+box#textbox2
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: auto; 
+    height: 100%; 
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#player_inactive
+{
+    display: block;
+
+}
+
+box#player_active
+{
+    display: none;
+}
+
+
+box:focus 
+    {
+    touchfeedbackdown: basic; 
+    touchfeedbackdrag: sensitive;
+    focus-background:"SKIN(268458534 9896)";
+    }
+
+
+image
+    {
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: auto;
+    margin-bottom: auto;
+    }
+image.area1_images
+    {
+    width: 70px;
+    height: 70px;
+    }
+    
+image.toolbarimage
+    {
+    width: 41px;
+    height: 41px;
+    }
+
+text
+    {
+    color:"SKIN(268458534 13056 74)";
+    display: block;
+    visibility: visible;
+    position: static;
+    font-family: EAknLogicalFontSecondaryFont;
+    font-size: 3.5u;
+    text-align:center;
+    direction: ltr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/57/MusicWidget.css	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,136 @@
+widget#MusicWidget
+    {
+    display: block;
+    visibility: visible;
+    width:312px;
+    height:75px;
+    padding-top: 4px;
+    padding-bottom: 3px;
+    padding-right: 4px;
+    margin-left: auto;
+    margin-right: auto;
+    block-progression: rl;
+    direction: rtl;
+    nav-index:appearance;
+    }
+    
+box#area1
+    {
+    display: block;
+    visibility: visible;
+    width: 70px;
+    height: 70px;
+    margin-left: 3px;
+    padding-top: 3px;
+    padding-bottom: 2px;
+    padding-left: 2px;
+    padding-right: 2px;
+    direction: ltr;
+    block-progression: tb;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#area2
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: auto; 
+    block-progression: tb;
+    nav-index:appearance;
+    }
+    
+box#textbox
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: 100%; 
+    height: 40%;
+    nav-index:appearance;
+    }
+
+box#toolbarbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 60%;
+    direction: ltr;
+    block-progression: rl;
+    nav-index:appearance;
+    }
+    
+box.toolbarbuttonbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 100%;
+    margin-left: 3px;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+    
+box#textbox2
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: auto; 
+    height: 100%; 
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#player_inactive
+{
+    display: block;
+
+}
+
+box#player_active
+{
+    display: none;
+}
+
+
+box:focus 
+    {
+    touchfeedbackdown: basic; 
+    touchfeedbackdrag: sensitive;
+    focus-background:"SKIN(268458534 9896)";
+    }
+
+
+image
+    {
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: auto;
+    margin-bottom: auto;
+    }
+image.area1_images
+    {
+    width: 70px;
+    height: 70px;
+    }
+    
+image.toolbarimage
+    {
+    width: 41px;
+    height: 41px;
+    }
+
+text
+    {
+    color:"SKIN(268458534 13056 74)";
+    display: block;
+    visibility: visible;
+    position: static;
+    font-family: EAknLogicalFontSecondaryFont;
+    font-size: 3.5u;
+    text-align:center;
+    direction: ltr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/data/themes/default/install/musicwidget_10207c18/xuikon/94/MusicWidget.css	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,136 @@
+widget#MusicWidget
+    {
+    display: block;
+    visibility: visible;
+    width:312px;
+    height:75px;
+    padding-top: 4px;
+    padding-bottom: 3px;
+    padding-right: 4px;
+    margin-left: auto;
+    margin-right: auto;
+    block-progression: rl;
+    direction: rtl;
+    nav-index:appearance;
+    }
+    
+box#area1
+    {
+    display: block;
+    visibility: visible;
+    width: 70px;
+    height: 70px;
+    margin-left: 3px;
+    padding-top: 3px;
+    padding-bottom: 2px;
+    padding-left: 2px;
+    padding-right: 2px;
+    direction: ltr;
+    block-progression: tb;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#area2
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: auto; 
+    block-progression: tb;
+    nav-index:appearance;
+    }
+    
+box#textbox
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: 100%; 
+    height: 40%;
+    nav-index:appearance;
+    }
+
+box#toolbarbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 60%;
+    direction: ltr;
+    block-progression: rl;
+    nav-index:appearance;
+    }
+    
+box.toolbarbuttonbox
+    {
+    display: block;
+    visibility: visible;
+    width: auto; 
+    height: 100%;
+    margin-left: 3px;
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+    
+box#textbox2
+    {
+    display: block;
+    visibility: visible;
+    margin-left: 3px;
+    width: auto; 
+    height: 100%; 
+    background-color: "SKIN(268458534 9886)";
+    nav-index:appearance;
+    }
+
+box#player_inactive
+{
+    display: block;
+
+}
+
+box#player_active
+{
+    display: none;
+}
+
+
+box:focus 
+    {
+    touchfeedbackdown: basic; 
+    touchfeedbackdrag: sensitive;
+    focus-background:"SKIN(268458534 9896)";
+    }
+
+
+image
+    {
+    margin-left: auto;
+    margin-right: auto;
+    margin-top: auto;
+    margin-bottom: auto;
+    }
+image.area1_images
+    {
+    width: 70px;
+    height: 70px;
+    }
+    
+image.toolbarimage
+    {
+    width: 41px;
+    height: 41px;
+    }
+
+text
+    {
+    color:"SKIN(268458534 13056 74)";
+    display: block;
+    visibility: visible;
+    position: static;
+    font-family: EAknLogicalFontSecondaryFont;
+    font-size: 3.5u;
+    text-align:center;
+    direction: ltr;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/eabi/dummyMusicu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z7E32Mainv @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for MusicHomeScreen.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../loc/musichomescreen.loc APP_LAYER_LOC_EXPORT_PATH(musichomescreen.loc)
+
+../rom/musichomescreen.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musichomescreen.iby)
+../rom/musichomescreenrsc.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(musichomescreenrsc.iby)
+../rom/musicmatrixmenu.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musicmatrixmenu.iby)
+
+
+
+../data/suite.xml /epoc32/release/winscw/udeb/z/private/101F4CD2/import/suites/musicsuite/suite.xml
+../data/music_matrix_items.xml /epoc32/release/winscw/udeb/z/private/101F4CD2/import/suites/musicsuite/music_matrix_items.xml
+
+../data/suite.xml /epoc32/data/z/private/101F4CD2/import/suites/musicsuite/suite.xml
+../data/music_matrix_items.xml /epoc32/data/z/private/101F4CD2/import/suites/musicsuite/music_matrix_items.xml
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE musichomescreenicons.mif
+OPTION HEADERFILE musichomescreenicons.mbg
+OPTION SOURCEFILE iconlist.txt
+END
+
+PRJ_EXTENSIONS
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE musicwidgeticon.mif
+OPTION HEADERFILE musicwidgeticon.mbg
+OPTION SOURCEFILE musicwidgeticon.txt
+END
+
+#if defined(SBSV2) && defined(WINSCW)
+START EXTENSION general/copyheaderfile
+   SRCFILE musichomescreen.rsg
+END
+#endif
+
+PRJ_MMPFILES
+musicsuiteconf.mmp
+#ifndef SBSV2
+gnumakefile export_musicsuiteconf.mk
+#endif
+#include "../mpxcollectionpublisher/group/bld.inf"
+#include "../musiccontentpublisher/group/bld.inf"
+#include "../mcpmusicplayer/group/bld.inf"
+#include "../musicplayeractionhandlerplugin/group/bld.inf"
+#include "../data/themes/default/group/bld.inf"
+PRJ_TESTMMPFILES
+PRJ_TESTEXPORTS
+
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/group/export_musicsuiteconf.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+#
+# Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  rsg export makefile for project
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+FINAL :
+	echo Exporting .rsg files...
+	copy \epoc32\include\musichomescreen.rsg $(ZDIR)\resource\apps\musichomescreen.rsg
+    
+MAKMAKE FREEZE LIB CLEANLIB RESOURCE RELEASABLES CLEAN BLD SAVESPACE :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/group/iconlist.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,9 @@
+-c8,8 qgn_prop_image_tb_prev
+-c8,8 qgn_prop_image_tb_next
+-c8,8 qgn_prop_image_tb_pause
+-c8,8 qgn_prop_image_tb_play2
+-c8,8 qgn_prop_image_tb_prev_dimmed
+-c8,8 qgn_prop_image_tb_next_dimmed
+-c8,8 qgn_prop_image_tb_pause_dimmed
+-c8,8 qgn_prop_image_tb_play2_dimmed
+-c8,8 qgn_indi_mup_default_album
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/group/musichomescreenicons.mk	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,51 @@
+#
+# Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:  icons makefile for project MusicHomeScreen
+#
+
+
+ifeq (WINS,$(findstring WINS,$(PLATFORM)))
+ZDIR=$(EPOCROOT)epoc32/release/$(PLATFORM)/$(CFG)/z
+else
+ZDIR=$(EPOCROOT)epoc32/data/z
+endif
+
+TARGETDIR=$(ZDIR)/resource/apps
+HEADERDIR=$(EPOCROOT)epoc32/include
+ICONTARGETFILENAME=$(TARGETDIR)/musichomescreenicons.mif
+HEADERFILENAME=$(HEADERDIR)/musichomescreenicons.mbg
+
+MAKMAKE : ;
+
+BLD : ;
+
+CLEAN : ;
+
+LIB : ;
+
+CLEANLIB : ;
+
+RESOURCE : 
+	mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) \
+		/Ficonlist.txt
+
+FREEZE : ;
+
+SAVESPACE : ;
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/group/musicsuiteconf.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+
+TARGET          dummyMusic.dll
+TARGETTYPE      dll
+
+CAPABILITY      CAP_GENERAL_DLL
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE   /epoc32/include/ecom
+
+SOURCEPATH      ../src
+SOURCE          dummy.cpp
+
+SOURCEPATH      .
+USERINCLUDE     ../loc
+
+START RESOURCE  ../data/musichomescreen.rss
+HEADER
+TARGETPATH      APP_RESOURCE_DIR
+
+LANGUAGE_IDS
+END
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/group/musicwidgeticon.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1 @@
+-c8,8 qgn_indi_mup_home_no_music
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/inc/cpglobals.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,138 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Global definitions
+ *
+*/
+
+
+#ifndef CPCLIENTGLOBALS_H
+#define CPCLIENTGLOBALS_H
+
+/** Data types for CP content */
+enum TDataTypes
+    {
+    ECPHardcodedText = 1, // 0001
+    ECPResourceText = 2, // 0010
+    ECPFilepathImage = 4, // 0100 
+    ECPResourceIcon = 8 // 1000
+    };
+
+enum TCPGetListOrder
+    {
+    ECPRecent = 1, // 0001
+    ECPPublisher = 2, // 0010
+    ECPContent = 4, // 0100 
+    ECPContentId = 8 // 1000 
+    };
+
+enum TFlag
+    {
+    EActivate = 1, // 0001
+    };
+    
+const TInt KNameArgumentsLimit = 5;
+
+_LIT( KService, "CP Service" );
+
+_LIT8( KCPInterface, "IDataSource" );
+_LIT8( KCPContentInterface, "IContentPublishing" );
+_LIT8( KCPService, "Service.ContentPublishing" );
+_LIT8( KCommand, "cmd" );
+
+//Supported Commands
+_LIT8( KGetList, "GetList" );
+_LIT8( KAdd, "Add" );
+_LIT8( KDelete, "Delete" );
+_LIT8( KRequestNotification, "RequestNotification" );
+_LIT8( KExecuteAction, "ExecuteAction" );
+_LIT8( KCmdCancel, "Cancel" );
+_LIT8( KActivate, "Activate" );
+_LIT8( KActivateTrigger, "activate" );
+_LIT8( KDeactivateTrigger, "deactivate" );
+
+// Input arguments
+_LIT8( KType, "type" );
+_LIT8( KAction, "action" );
+_LIT8( KItem, "item" );
+_LIT8( KFilter, "filter" );
+_LIT8( KData, "data" );
+_LIT8( KSortOrder, "sort_order" );
+_LIT8( KItemId, "item_id" );
+_LIT8( KByPublisher, "by_publisher" );
+_LIT8( KByEntryIds, "by_entryids" );
+_LIT8( KPublisherId, "publisher" );
+_LIT8( KContentType, "content_type" );
+_LIT8( KContentId, "content_id" );
+_LIT8( KExpirationDate, "expiration_date" );
+_LIT8( KActivatePublisher, "activate" );
+_LIT8( KIds, "ids" );
+_LIT8( KId, "id" );
+_LIT8( KFlag, "flag");
+_LIT8( KAccessList, "ACL" );
+_LIT8( KACLRead, "read");
+_LIT8( KACLWrite, "write");
+_LIT8( KACLDelete, "delete");
+_LIT8( KUIDs, "UID" );
+_LIT8( KCapability, "Capability" );
+_LIT( KAll, "all");
+_LIT( KSortPublisher, "publisher");
+_LIT( KSortContentType, "content_type");
+_LIT( KSortContentId, "content_id");
+_LIT( KSortRecent, "recent");
+_LIT( KOperationAdd, "add" );
+_LIT( KOperationUpdate, "update" );
+_LIT( KOperationDelete, "delete" );
+_LIT( KOperationExecute, "execute" );
+_LIT8( KDataType, "data_type" );
+_LIT8( KOperation, "operation" );
+_LIT8( KActionTrigger, "action_trigger" );
+_LIT8( KHardcodedText, "harcoded_text" );
+_LIT8( KResourceText, "resource_text" );
+_LIT8( KFilepathImage, "filepath_image" );
+_LIT8( KIdMask, "id_mask" );
+_LIT8( KResourceIcon, "resource_icon" );
+_LIT8( KIdIcon, "id_icon" );
+_LIT8( KIdText, "id_text" );
+_LIT( KCpData, "cp_data" );
+_LIT( KPublisher, "publisher" );
+_LIT8( KChangeInfo, "change_info" );
+
+_LIT8( KPublisher_Uid, "publisher_Uid" );
+
+// Argument in Action
+_LIT8( KActionHandlerInterface, "IDataAction" );
+_LIT8( KActionHandlerService, "Service.ActionHandler" );
+_LIT8( KCmdExecute, "Execute" );
+_LIT8( KPluginUid, "plugin_id" );
+_LIT8( KDataForActionHandler, "data" );
+
+_LIT8( KLaunchMethod, "launch_method" );
+_LIT8( KApplicationUid, "application_uid" );
+_LIT8( KDocumentName, "document_name" );
+_LIT8( KViewId, "view_id" );
+_LIT8( KMessageUid, "message_uid" );
+
+// Output
+_LIT8( KResults, "results" );
+_LIT8( KListMap, "list_map" );
+_LIT8( KStatus, "status" );
+_LIT8( KDataMap, "data_map" );
+_LIT8( KActionMap, "action_map" );
+_LIT8( KKey, "key" );
+
+_LIT8( KTransactionID, "TransactionID" );
+
+#endif /*CPCLIENTGLOBALS_H*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/inc/mpxresource.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class provide API to read resource from resource file
+*
+*/
+
+
+#ifndef CMPXRESOURCE_H
+#define CMPXRESOURCE_H
+
+//INCLUDES
+#include <e32base.h>
+#include <badesca.h>
+#include <barsc.h>
+
+// CLASS DECLARATION
+
+/**
+*  Resource class
+*  Singleton for one thread
+*/
+class CMPXResource : public CBase
+    {
+    public: // Factory and Release
+
+        /**
+        * Factory function, create the object.
+        * Note that calls to this must be matched with a call to Release().
+        *
+        * @param aResourceFile the resource file
+        *        In order to support installation of individual plugin.
+        *        aResourceFile must be a final name, including full file path.
+        *        All parse should be done in the plugin side.
+        *
+        * @return the resource object pointer
+        */
+        static CMPXResource* NewL(const TDesC& aResourceFile);
+
+        /**
+        * Factory function, create the object.
+        * Note that calls to this must be matched with a call to Release().
+        * @param aResourceFile the resource file
+        *        In order to support installation of individual plugin.
+        *        aResourceFile must be a final name, including full file path.
+        *        All parse should be done in the plugin side.
+        *
+        * @return the resource object pointer
+        */
+        static CMPXResource* NewLC(const TDesC& aResourceFile);
+
+        /**
+        * Decrements the reference count, and delete the object if it is 0
+        */
+        IMPORT_C void Release();
+
+    public: // New functions
+
+        /**
+        * Read array of descriptors
+        * @param aResourceId resource id
+        * @return array of descriptors. Ownership is abandoned.
+        */
+        CDesCArrayFlat* ReadDesCArrayL(TInt aResourceId);
+
+        /**
+        * Read array of descriptors
+        * @param aResourceId resource id
+        * @return array of descriptors. Ownership is abandoned.
+        */
+        CDesCArrayFlat* ReadDesCArrayLC(TInt aResourceId);
+
+        /**
+        * Get a heap descriptor from the resource file
+        * @param aResourceId resource id
+        * @return pointer to the heap descriptor.  Ownership is abandoned.
+        */
+        HBufC* ReadHBufCL(TInt aResourceId);
+
+        /**
+        * Read array of menu items
+        * @param aResourceId resource id
+        * @param aIdArray array of Id within the specified resource
+        * @return array of descriptors
+        */
+        CDesCArrayFlat* ReadMenuArrayL(TInt aResourceId, RArray<TInt>& aIdArray);
+
+        /**
+        * Read array of menu items
+        * @param aResourceId resource id
+        * @param aIdArray array of Id within the specified resource
+        * @return array of descriptors
+        */
+        CDesCArrayFlat* ReadMenuArrayLC(TInt aResourceId, RArray<TInt>& aIdArray);
+
+
+    private:
+
+        /**
+        * C++ constructor.
+        */
+        CMPXResource();
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL(const TDesC& aResourceFile);
+
+        /**
+        * Don't allow users to delete this object
+        * Release has to be called
+        */
+        virtual ~CMPXResource();
+
+
+    private: // Data
+        // Member variables
+        RFs               iFs;
+        RResourceFile     iResourceFile;
+    };
+
+#endif // CMPXRESOURCE_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/loc/musichomescreen.loc	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,147 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Localization strings for project MusicHomeScreen
+*
+*/
+
+/*
+  The syntax of a logical name entry in this file is the following:
+
+  // d:context description (line 1)
+  // d:context description (line N)
+  // l:layout id
+  // w:
+  // r:release information
+  //
+  #define qtn_<?feature_or_application>_?freetext "?text"
+
+  where
+      "qtn_" starts a logical name.  Note: "text_" has been used in
+           old logical names, but is deprecated.
+      "?feature/application" is 2-5 lower-case characters and/or numbers
+           identifying the larger context of the display text.
+      "?freetext" is the free text portion of the logical name.
+           It may contain only lower-case letters ('a' to 'z'), numbers
+           ('0' to '9'), and the underscore ('_').  The total length of
+           the logical name does must not exceed 50 characters.
+      "d:" Starts a description line clarifying the entry's context with
+           information like:
+           - Is a word a verb in imperative or is it a noun?  (For instance,
+             what does "Set" mean?)
+           - What will replace %U (unicode text parameter) or %N (number
+             parameter) included in texts?  (For instance, is it a phone
+             number or an e-mail address?)
+      "l:" Starts a layout id information (one line).
+           "P" and "No" are symbols in LAF's information table
+                - "P" is parent pane or current pane
+                - "No" is reference number in table
+      "r:" Starts a release information: one line indicating in which
+           S60 release the text was used for the first time.
+
+  Refer to the S60 localization instructions for more information.
+*/
+// LOCALISATION STRINGS
+CHARACTER_SET UTF8
+
+// d: Title of the Music suite in the matrix menu main screen
+// l: title_pane_t2/opt9
+// r: S60 v5.1
+//
+#define qtn_vmp_title_suite "Music"
+
+// d: The title for the most recently played track or song
+// d: this is when the music player is in stopped state 
+// l: list_logical_template_3_title
+// r: S60 v5.1
+//
+#define qtn_vmp_title_last_played "Last Played"	
+
+// d: The title for the currently playing track or song 
+// d: this is when the music player is in playing state
+// l: list_logical_template_3_title
+// r: S60 v5.1
+//
+#define qtn_vmp_title_now_playing "Now Playing"
+
+// d: The detail when music player was never launched
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_music_no_music "No Music Played"
+
+// d: The music the user has in his terminal
+// l: list_logical_template_3_title
+// r: S60 v5.1
+//
+#define qtn_vmp_title_my_music "My Music"
+
+// d: The text indicating that the user has only ONE song in his terminal
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_my_music_1_song "1 Song"
+
+// d: The text indicating that the number of songs the
+// d: user has in his terminal
+// d: %N is total number of songs in My Music
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_my_music_n_songs "%N Songs"
+
+// d: The text indicating that the user has NO songs in his terminal
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_my_music_no_songs	"No Songs"
+
+// d: The name of the Nokia music store web service
+// l: list_logical_template_3_title
+// r: S60 v5.1
+//
+#define qtn_vmp_title_nokia_music_store	"Nokia Music Store"
+
+// d: The description ad for the Nokia music store
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_nokia_store_ad "Explore millions of songs and download music"
+
+// d: The name for the radio application
+// l: list_logical_template_3_title
+// r: S60 v5.1
+//
+#define qtn_vmp_title_fm_radio "FM Radio"
+
+// d: The Ad for the Radio application
+// l: list_logical_template_3_detail
+// r: S60 v5.1
+//
+#define qtn_vmp_title_fm_radio_ad "Radio with RDS"
+
+// d: The Text to be displayed when the device intially
+// d: powers up or when the user returns to the homescreen
+// d: and has not played any Music or Podcast 
+// r: S60 v5.1
+//
+#define qtn_vmp_music_widget_go_to_music "Go To Music"
+
+// d: The Text to be displayed when we are about to open a
+// d: a song, the purpose is to inform the user that an 
+// d: operation is ongoing.
+// r: S60 v5.1
+//
+#define qtn_vmp_music_widget_opening "Opening ..."
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/data/mcpmusicplayer.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM registration for Music Player MCP Plugin
+*
+*/
+
+
+#include <registryinfo.rh>
+#include <mcppluginuids.hrh>
+#include "mcpmusicplayeruids.hrh"
+
+// ---------------------------------------------------------------------------
+// MCPMusicPlayerInfo
+// Declares info for implementation of the plugin
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO theInfo
+	{
+	// UID for the DLL
+	dll_uid = KMCPMusicPlayerDLL;
+	// Declare array of interface info
+	interfaces = 
+		{
+		INTERFACE_INFO
+			{
+			// UID of interface that is implemented
+			interface_uid = KMCPPluginUid;
+			implementations = 
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = KMCPMusicPlayerUID; 
+					version_no = 1;
+					display_name = "";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for MP MCP Plugin.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/mcpmusicplayer.iby  CORE_APP_LAYER_IBY_EXPORT_PATH(mcpmusicplayer.iby)
+
+PRJ_MMPFILES
+mcpmusicplayer.mmp
+
+PRJ_TESTMMPFILES
+PRJ_TESTEXPORTS
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/group/mcpmusicplayer.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for MusicPlayer MCP Plugin
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include "../inc/mcpmusicplayeruids.hrh"
+
+TARGET                  mcpmusicplayer.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D KMCPMusicPlayerDLL
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  mcpmusicplayer.cpp
+SOURCE                  proxy.cpp
+SOURCE                  aiplayerpluginengine.cpp
+SOURCE                  filemonitor.cpp
+SOURCE                  applicationmonitor.cpp
+SOURCE                  pnsmonitor.cpp
+ 
+USERINCLUDE             ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+USERINCLUDE             ../../inc
+
+SOURCEPATH              ../data
+START RESOURCE          mcpmusicplayer.rss 
+HEADER
+TARGET                  mcpmusicplayer.rsc
+TARGETPATH              resource/plugins 
+END
+
+LIBRARY                 euser.lib
+LIBRARY                 liwservicehandler.lib
+LIBRARY                 mpxplaybackutility.lib
+LIBRARY                 mpxcommon.lib           // mpxparameter
+LIBRARY                 efsrv.lib               // TParse
+LIBRARY                 commonengine.lib        // stringloader
+LIBRARY                 avkon.lib
+LIBRARY                 ws32.lib                // RWsSession
+LIBRARY                 apgrfx.lib              // TApaTask 
+LIBRARY                 bafl.lib                // FileExists()
+LIBRARY                 mpxcommonui.lib         // CMPXAlbumArtUtil
+LIBRARY                 fbscli.lib
+LIBRARY                 aknskins.lib
+LIBRARY                 aknicon.lib
+LIBRARY                 mpxcollectionutility.lib
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/inc/aiplayerpluginengine.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,199 @@
+/*
+* Copyright (c) 2007-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Engine which interfaces to MPX framework.
+*
+*/
+
+
+#ifndef C_AIPLAYERPLUGINENGINE_H
+#define C_AIPLAYERPLUGINENGINE_H
+
+#include <e32base.h>
+#include <mpxplaybackobserver.h>
+#include <mpxalbumartutilobserver.h>
+#include "aiplayerpluginengineobserver.h"
+
+class MMPXPlaybackUtility;
+class CMPXAlbumArtUtil;
+
+
+/**
+ *  Music Player Player Plugin Engine.
+ *  This class provides interface to MPX framework.
+ *
+ *  @lib aiplayerplugin2.lib
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CAiPlayerPluginEngine ) : public CBase,
+                                             public MMPXPlaybackObserver,
+                                             public MMPXPlaybackCallback,
+                                             public MMPXAlbumArtUtilObserver
+    {
+public: // Constructors and destructor
+
+    /**
+     * Two-phased constructor.
+     */
+    static CAiPlayerPluginEngine* NewL( MAiPlayerPluginEngineObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CAiPlayerPluginEngine();
+
+    /**
+     * From MMPXPlaybackObserver
+     * See mpxplaybackobserver.h for detailed description.
+     * @since S60 5.0
+     */
+    void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+    /**
+     * From MMPXPlaybackCallback
+     * See mpxplaybackobserver.h for detailed description.
+     * @since S60 5.0
+     */
+    void HandlePropertyL( TMPXPlaybackProperty aProperty, TInt aValue, TInt aError );
+    void HandleSubPlayerNamesL( TUid aPlayer, const MDesCArray* aSubPlayers, TBool aComplete, TInt aError );
+    void HandleMediaL( const CMPXMedia& aMedia, TInt aError );
+    void HandlePlaybackCommandComplete( CMPXCommand* aCommandResult, TInt aError );
+
+    /**
+     * From MMPXAlbumArtUtilObserver
+     * See mpxalbumartutilobserver.h for detailed description
+     * @since S60 3.2.3
+     */
+    void ExtractAlbumArtStarted();
+    void ExtractAlbumArtCompleted( CFbsBitmap* aBitmap, TInt aErr );
+public:
+
+    /**
+     * Get the current state of the active player.
+     *
+     * @return Active player state
+     * @see TMPlayerState
+     */
+    TMPlayerState PlayerState();
+
+    /**
+     * Get the title of the currently playing song.
+     *
+     * @return Song title
+     */
+    const TDesC& TitleL();
+
+    /**
+     * Get the artist of the currently playing song.
+     *
+     * @return Artist
+     */
+    const TDesC& Artist();
+    
+    /**
+     * Get the uri of the currently playing song.
+     *
+     * @return Uri
+     */
+    const TDesC& Uri();
+
+    /**
+     * Get the current position.
+     *
+     * @return Current position.
+     */
+    TInt Position();
+
+    /**
+     * Get the duration of the currently playing song.
+     *
+     * @return Song duration.
+     */
+    TInt Duration();
+
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CAiPlayerPluginEngine( MAiPlayerPluginEngineObserver& aObserver );
+
+    /**
+     * By default Symbian 2nd phase constructor is private.
+     */
+    void ConstructL();
+
+    /**
+     *  Handle playback message
+     *
+     *  @param aMessage playback message
+     */
+    void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+    /**
+     *  Handle playback property
+     *
+     *  @param aProperty the property
+     *  @param aValue the value of the property
+     *  @param aError error code
+     */
+    void DoHandlePropertyL( TInt aProperty, TInt aValue, TInt aError );
+
+    /**
+     *  Handle playback state changed.
+     *
+     *  @param aState New Playback state
+     */
+    void DoHandleStateChangedL( TMPXPlaybackState aState );
+
+    /**
+     * Displays error notes.
+     *
+     * @param aError Error ID to be handled.
+     */
+    void HandleErrorL( TInt aError );
+
+    /**
+     *  Map states from TMPXPlaybackState to TMPlayerState
+     *
+     *  @param aState State in TMPXPlaybackState format
+     *  @return State in TMPlayerState format, or KErrNotFound
+     *          if the state can't be mapped
+     */
+    TMPlayerState MapState( TMPXPlaybackState aState );
+
+   /**
+     *  Request media.
+     */
+    void RequestMediaL();
+private:    // Data
+
+    MAiPlayerPluginEngineObserver* 	iObserver; 			// Not owned
+    MMPXPlaybackUtility*            iPlaybackUtility;   // Owned    
+    CMPXAlbumArtUtil* iAlbumArtUtil;  // own
+    HBufC*		iTitle;  // own
+    HBufC*      iArtist;  // own
+    HBufC*      iUri;  // own
+    CMPXMedia*  iMedia;  // own
+    TInt		iPosition;
+    TInt		iDuration;
+    TBool       iExtractingAlbumArt;
+    TBool       iSkipping;
+    
+    
+    };
+
+#endif  // C_CAiPlayerPluginEngine_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/inc/aiplayerpluginengineobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player stautus observer
+*
+*/
+
+
+#ifndef M_AIPLAYERPLUGINENGINEOBSERVER_H
+#define M_AIPLAYERPLUGINENGINEOBSERVER_H
+
+#include <e32std.h>
+
+
+/**
+ *  Player state.
+ */
+enum TMPlayerState
+    {
+    EMPlayerStatePlaying,
+    EMPlayerStatePaused,
+    EMPlayerStateSeeking,
+    EMPlayerStateOther,
+    EMPlayerStateStarting,
+    EMPlayerStateStopped
+    };
+
+class CFbsBitmap;
+
+/**
+ *  Observer interface to be implemented by a client of AiPlayerPluginEngine.
+ *
+ *  @lib aiplayerplugin2.lib
+ *  @since S60 5.0
+ */
+class MAiPlayerPluginEngineObserver
+    {
+public:
+
+    /**
+     * Called when active player instance's state changes
+     *
+     * @since S60 5.0
+     * @param aState Active player state
+     * @see TMPlayerState
+     */
+    virtual void PlayerStateChanged( TMPlayerState aState ) = 0;
+
+    /**
+     * Called when track info changes (i.e. track changes or current track's
+     * info is updated) in the active player instance.
+     *
+     * @since S60 5.0
+     * @param aTitle Current track's title.
+     * @param aArtist Current track's artist.
+     */
+    virtual void TrackInfoChanged( const TDesC& aTitle, 
+            const TDesC& aArtist ) = 0;
+
+    /**
+     * Called each second during playback.
+     *
+     * @since S60 5.0
+     * @param aPosition Current playback position in seconds.
+     */
+    virtual void PlaybackPositionChanged( TInt aPosition ) = 0;
+
+    /**
+     * Called when album art is ready or when there is no album art.
+     *
+     * @since S60 5.0
+     * @param aBitmap the new album art.
+     */
+    virtual void AlbumArtChanged( CFbsBitmap* aBitmap ) = 0;
+    
+    /**
+     * Called When there is an ongoing operation.
+     *
+     * @since S60 5.0
+     */
+    virtual void Opening() = 0;
+    
+    /**
+     * Called when to indicate that the playlist changed and it is empty.
+     *
+     * @since S60 5.0
+     * @param aBitmap the new album art.
+     */
+    virtual void PlaylisIsEmpty() = 0;
+
+    };
+
+
+#endif // ?M_AIPLAYERPLUGINENGINEOBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/inc/applicationmonitor.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors an application for exit event.
+*
+*/
+
+
+#ifndef C_APPLICATIONMONITOR_H
+#define C_APPLICATIONMONITOR_H
+
+#include <e32base.h>
+
+class MApplicationMonitorObserver;
+class RThread;
+
+/**
+ *  Application monitor class
+ *
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CApplicationMonitor ) : public CActive
+    {
+
+public:
+
+    /**
+    * Two-phased constructor
+    */
+    static CApplicationMonitor* NewL( MApplicationMonitorObserver& aObserver);
+
+    /**
+    * Virtual destructor
+    */
+    virtual ~CApplicationMonitor();
+
+    /**
+    * Start monitoring a particular Application
+    * @param aApplication to monitor
+    * @param aRootAppIndication ETrue for RootApp and EFalse EmbeddedApp
+    */
+    void StartL(  TUid aAppUid , TBool aRootAppIndication = ETrue);
+   
+protected:
+        
+    /**
+    * From CActive
+    */
+    void RunL();
+    
+    /**
+    * From CActive
+    */
+    void DoCancel();
+
+    /**
+    *  From CActive
+    */
+    TInt RunError(TInt aError);    
+            
+private:
+    
+    /**
+    * Private constructor
+    */
+    CApplicationMonitor( MApplicationMonitorObserver& aObserver);
+
+    /**
+    * 2nd phased constructor
+    */
+    void ConstructL();
+
+private: // data
+    MApplicationMonitorObserver&  iObserver;
+    RThread iThread; 
+    };
+
+#endif // C_APPLICATIONMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/inc/applicationmonitorobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Observer class to the Application monitor
+*
+*/
+
+
+#ifndef M_APPLICATIONMONITOROBSERVER_H
+#define M_APPLICATIONMONITOROBSERVER_H
+
+#include <e32std.h>
+
+/** 
+*   Interface class to monitor an application exit.
+*/
+class MApplicationMonitorObserver
+    {
+public:
+    /**
+     * Handle an application close event.
+     */
+    virtual void HandleApplicationClosedL(TExitType aReason) = 0;
+    };
+
+#endif // M_APPLICATIONMONITOROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/inc/filemonitor.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors the file system for changes in a file.
+*
+*/
+
+
+#ifndef C_FILEMONITOR_H
+#define C_FILEMONITOR_H
+
+#include <e32base.h>
+#include <f32file.h>//??? remove???
+
+class MFileMonitorObserver;
+
+/**
+ *  File monitor class
+ *
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CFileMonitor ) : public CActive
+    {
+
+public:
+
+    /**
+    * Two-phased constructor
+    */
+    static CFileMonitor* NewL( MFileMonitorObserver& aObserver);
+
+    /**
+    * Virtual destructor
+    */
+    virtual ~CFileMonitor();
+
+    /**
+    * Start monitoring a particular file
+    * @param aFile file to monitor
+    */
+    void StartL( const TDesC& aFile );
+   
+protected:
+        
+    /**
+    * From CActive
+    */
+    void RunL();
+    
+    /**
+    * From CActive
+    */
+    void DoCancel();
+
+    /**
+    *  From CActive
+    */
+    TInt RunError(TInt aError);    
+            
+private:
+    
+    /**
+    * Private constructor
+    */
+    CFileMonitor( MFileMonitorObserver& aObserver);
+
+    /**
+    * 2nd phased constructor
+    */
+    void ConstructL();
+
+private: // data
+    MFileMonitorObserver&  iObserver;
+    RFs iFs; 
+    HBufC* iFilePath;
+    };
+
+#endif // C_FILEMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/inc/filemonitorobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Observer class to the file monitor
+*
+*/
+
+
+#ifndef M_FILEMONITOROBSERVER_H
+#define M_FILEMONITOROBSERVER_H
+
+
+/** 
+*   Interface class to monitor to get callbacks to folder changes
+*/
+class MFileMonitorObserver
+    {
+public:
+    /**
+     * Handle a file system change notification
+     *
+     */
+    virtual void HandleFileRemovedL() = 0;
+    };
+
+#endif // M_FILEMONITOROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/inc/mcpmusicplayer.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,396 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Updates Music Content Plublisher
+*
+*/
+
+
+#ifndef C_MCPMUSICPLAYER_H
+#define C_MCPMUSICPLAYER_H 
+
+#include <mpxplaybackcommanddefs.h> //for TMPXPlaybackCommand
+#include <e32std.h> // for TExitType
+#include <mcpplugin.h>
+#include <mcppluginobserver.h>
+#include <mpxcollectionobserver.h>
+#include "aiplayerpluginengineobserver.h"
+#include "filemonitorobserver.h"
+#include "applicationmonitorobserver.h"
+#include "pnsmonitorobserver.h"
+
+class MLiwInterface;
+class CLiwGenericParamList;
+class CAiPlayerPluginEngine;
+class CFileMonitor;
+class CApplicationMonitor;
+class CPNSMonitor;
+class RResourceFile;
+class MMPXCollectionUtility;
+
+/**
+ *  Music Player MCP plugin.
+ *  CMCPMusicPlayer implements CMCPPlugin
+ *
+ *  @since S60 S60 v5.0
+ */
+class CMCPMusicPlayer : public CMCPPlugin,
+                                public MAiPlayerPluginEngineObserver,
+                                public MFileMonitorObserver,
+                                public MApplicationMonitorObserver,
+                                public MMPXCollectionObserver,
+                                public MPNSMonitorObserver
+    {
+public:
+    /**
+     * Standard Symbian 2 phase constructor
+     */
+    static CMCPMusicPlayer* NewL(
+            MMCPPluginObserver* aObserver);
+
+    /**
+     * Standard C++ destructor.
+     */
+    virtual ~CMCPMusicPlayer();
+
+ // from base class CMCPPlugin
+
+    /**
+     * From CMCPPlugin
+     * @since S60 5.0
+     */
+    void Deactivate();
+    
+    /**
+     * From CMCPPlugin
+     * @since S60 5.0
+     */
+    void SkinChanged();
+        
+
+// from base class MAiPlayerPluginEngineObserver
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void PlayerStateChanged(TMPlayerState aState);
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void TrackInfoChanged(const TDesC& aTitle, const TDesC& aArtist);
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void PlaybackPositionChanged(TInt aPosition);
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void AlbumArtChanged( CFbsBitmap* aBitmap );
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void Opening();
+    
+    /**
+     * From MAiPlayerPluginEngineObserver
+     * @since S60 5.0
+     * See aiplayerpluginengineobserver.h for detailed description.
+     */
+    void PlaylisIsEmpty();
+    
+// from base class MFileMonitorObserver
+    /**
+     * from MFileMonitorObserver
+     * Handle a file system change notification
+     *
+     */
+    void HandleFileRemovedL();
+       
+// from base class MApplicationMonitorObserver
+    /**
+     * from MApplicationMonitorObserver
+     * Handle an application close event.
+     */
+    void HandleApplicationClosedL(TExitType aReason);
+    
+//from base class MMPXCollectionObserver  
+    /** 
+     *  Handle collection message
+     * 
+     *  @param aMsg collection message, ownership not transferred. 
+     *         Please check aMsg is not NULL before using it. 
+     *         If aErr is not KErrNone, plugin might still call back with more
+     *         info in the aMsg.
+     *  @param aErr system error code.
+     */
+    void HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr );
+
+    /**
+     *  Handles the collection entries being opened. Typically called
+     *  when client has Open()'d a folder.
+     *
+     *  @since S60 3.2.3
+     *  @param aEntries collection entries opened
+     *  @param aIndex focused entry
+     *  @param aComplete ETrue no more entries. EFalse more entries
+     *                   expected
+     *  @param aError error code   
+     */
+    void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, TBool aComplete,
+            TInt aError );
+
+    /**
+     *  Handles the item being opened. Typically called
+     *  when client has Open()'d an item. Client typically responds by
+     *  'playing' the item via the playlist.
+     *
+     *  @since S60 3.2.3
+     *  @param aPlaylist collection playlist
+     *  @param aError error code
+     */
+    void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError );
+
+    /**
+     * From MMPXCollectionMediaObserver 
+     * It handles MediaL event.
+     *
+     * @param aMedia object containing collection's informations
+     * @param aError error code
+     */
+    void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
+
+    /**
+     * from MPNSMonitorObserver
+     * Handle launching music player on the background.
+     */
+    void OpeningMusicPlayer();
+
+private:
+
+    /**
+     * Standard C++ constructor.
+     */
+    CMCPMusicPlayer( MMCPPluginObserver* aObserver );
+
+    /**
+     * Standard Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * returns ETrue if data can be propagated to the Music Content Publisher.
+     */
+    TBool IsOKToPublishData();
+     
+    /**
+     * Installs Playback command action, the puppose of this is to improve
+     * readability.
+     */
+    void InstallPlaybackCommandActionL( TMPXPlaybackCommand aCmd,
+            TMCPTriggerDestination aDestination );
+    /**
+     * Installs Launch Music Player action, the puppose of this is to improve
+     * readability.
+     */
+    void InstallLaunchMusicPlayerL( TMCPTriggerDestination aDestination );
+    
+    /**
+     * Installs Go To Now playing action, the puppose of this is to improve
+     * readability.
+     */
+    void InstallGoToNowPlayingL( TMCPTriggerDestination aDestination );
+        
+    /**
+     * Installs Go To Last Played action, the puppose of this is to improve
+     * readability.
+     */
+    void InstallGoToLastPlayedL( TMCPTriggerDestination aDestination, 
+             TBool aMinimized );
+    
+    /**
+     * Installs an action, mainly for readability purposes.
+     *
+     * @since S60 5.0
+     * @param aDestination Destination trigger that should launch the action.
+     */
+    void InstallGoToMusicL(TMCPTriggerDestination aDestination);
+    
+    /**
+     * Installs an action, mainly for readability purposes.
+     *
+     * @since S60 5.0
+     * @param aDestination Destination trigger that should launch the action.
+     */
+    void InstallGoToAlbumL(TMCPTriggerDestination aDestination);
+    
+    /**
+     * Installs an empty action, mainly for readability purposes.
+     *
+     * @since S60 5.0
+     * @param aDestination Destination trigger that should launch the action.
+     */
+    void InstallEmptyActionL(TMCPTriggerDestination aDestination);
+    
+    /**
+     * Installs actions and icons in the toolbar.
+     *
+     * @since S60 5.0
+     */
+    void UpdateToolBarL(TUint aToolBarState);
+    
+    /**
+     * Resets the widget an Music Suite.
+     *
+     * @since S60 5.0
+     */
+    void ResetL();
+
+    /**
+     * Get a heap descriptor from the resource file
+     *
+     * @since S60 5.0
+     */
+    void GetLocalizedStringL(RResourceFile& aResourceFile, HBufC*& aRetBuf,
+            TInt aResourceId);
+    
+    
+    /**
+     * @since S60 5.0
+     */
+    void ActivateL();
+    void DoUpdatePlayerStateL(TMPlayerState aState);
+    void DoUpdateTrackInfoL(const TDesC& aTitle, const TDesC& aArtist);
+    void DoUpdatePlaybackPositionL(TInt aPosition);
+    void DoUpdateAlbumArtL( CFbsBitmap* aBitmap );
+    void DoHandleOpeningL();
+    void DoHandlePlaylisIsEmptyL();
+    void DoHandleSkinChangedL();
+    
+    /**
+     * Logic of HandleCollectionMessageL, to avoid the function leaves
+     * 
+     * @param aMsg collection message
+     */
+    void HandleCollectionMessageL( CMPXMessage* aMsg );
+
+    /**
+     * Logic of HandleCollectionMessage, to avoid the function leaves
+     * 
+     * @param aMsg collection message
+     */
+    void DoHandleGeneralMessageL( const CMPXMessage& aMsg );
+       
+    /**
+    *  Music Player opening timer callback
+    *
+    *  @param aPtr pointer the this
+    */
+    static TInt MusicPlayerOpeningTimerCallback( TAny* aPtr );
+
+private: // data
+
+    /**
+     * Instance of MCP plugin observer
+     * Not owned.
+     */
+    MMCPPluginObserver* iMHObserver;
+    
+    /**
+     * Instance of CAiPlayerPluginEngine used to observe Music player via 
+     * MAiPlayerPluginEngineObserver.
+     * Owned.
+     */
+    CAiPlayerPluginEngine* iEngine;
+    
+    /**
+     * State indicator, the plugin can be active or inactive. 
+     */
+    TBool iActive;
+    
+    /**
+     * art cached indicator. 
+     */
+    TBool iArtCached;
+    
+    /**
+     * Used to monitor last played song. 
+     */
+    CFileMonitor* iFileMonitor;
+
+    /**
+     * Used to monitor if music player closes. 
+     */
+    CApplicationMonitor* iAppMonitor;
+    
+    /**
+     * Used to monitor publish and subscribe property. 
+     */
+    CPNSMonitor* iPNSMonitor;
+
+    /**
+     * Current Album Art. 
+     */
+    CFbsBitmap* iArtBitmap;
+    
+    /**
+     * The art that was extracted but not used due to the current stateof
+     * the plugin (acctive, not active) 
+     */
+    CFbsBitmap* iCachedArtBitmap;
+    
+    /**
+     * Album Art mask. 
+     */
+    CFbsBitmap* iArtBitmapMask;
+    
+    /**
+     * Current Toolbar State.
+     */  
+    TUint iToolBarState;
+    
+    /**
+    * Buffers for the localized strings
+    */
+    HBufC* iGoToMusicBuffer;
+    HBufC* iOpeningBuffer;
+    
+    /**
+     * Flag of Mass Storage mode or MTP mode
+     */
+    TBool iUSBOnGoing;
+   
+    /**
+     * collection utility
+     */
+    MMPXCollectionUtility* iCollectionUtility;
+
+    CPeriodic* iMusicPlayerOpeningTimer;
+    };
+
+#endif // C_MCPMUSICPLAYER_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/inc/mcpmusicplayeruids.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for Music Player MCPPlugin
+*
+*/
+
+
+#ifndef MCPMUSICPLAYERUIDS_H_
+#define MCPMUSICPLAYERUIDS_H_
+
+/** Ecom implementation uid for Music Player Action Handler Plugin */
+#define KMCPMusicPlayerUID 0x10207C14
+
+/** Ecom dll uid for Music Player Action Handler Plugin */
+#define KMCPMusicPlayerDLL 0x10207C15
+
+#endif /*MCPMUSICPLAYERUIDS_H_*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/inc/pnsmonitor.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors for publish and subscribe property.
+*
+*/
+
+
+#ifndef C_PNSMONITOR_H
+#define C_PNSMONITOR_H
+
+#include <e32base.h>
+
+class MPNSMonitorObserver;
+
+/**
+ *  publish and subscribe monitor class
+ *
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( CPNSMonitor ) : public CActive
+    {
+
+public:
+
+    /**
+    * Two-phased constructor
+    */
+    static CPNSMonitor* NewL( MPNSMonitorObserver& aObserver );
+
+    /**
+    * Virtual destructor
+    */
+    virtual ~CPNSMonitor();
+
+    /**
+    * Start monitoring a particular publish and subscribe property
+    */
+    void Start();
+   
+protected:
+        
+    /**
+    * From CActive
+    */
+    void RunL();
+    
+    /**
+    * From CActive
+    */
+    void DoCancel();
+
+    /**
+    *  From CActive
+    */
+    TInt RunError( TInt aError );    
+            
+private:
+    
+    /**
+    * Private constructor
+    */
+    CPNSMonitor( MPNSMonitorObserver& aObserver );
+
+    /**
+    * 2nd phased constructor
+    */
+    void ConstructL();
+
+private: // data
+    MPNSMonitorObserver& iObserver;
+    RProperty iPropertyHandler;
+    };
+
+#endif // C_PNSMONITOR_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/inc/pnsmonitorobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Interface class to monitor publish and subscribe property.
+*
+*/
+
+
+#ifndef M_PNSMONITOROBSERVER_H
+#define M_PNSMONITOROBSERVER_H
+
+/** 
+*   Interface class to monitor publish and subscribe property.
+*/
+class MPNSMonitorObserver
+    {
+public:
+
+    /**
+     * Called when launching music player on the background
+     * (when selecting play from the widget and music player is closed)
+     *
+     * @since S60 5.0
+     */
+    virtual void OpeningMusicPlayer() = 0;
+    };
+
+
+#endif // M_PNSMONITOROBSERVER_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/rom/mcpmusicplayer.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Player MCP Plugin
+*
+*/
+
+
+#ifndef MCPMUSICPLAYER_IBY
+#define MCPMUSICPLAYER_IBY
+
+ECOM_PLUGIN(mcpmusicplayer.dll, mcpmusicplayer.rss)
+
+#endif // MCPMUSICPLAYER_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/src/aiplayerpluginengine.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,544 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player stautus observer
+*
+*/
+
+
+#include <mpxplaybackutility.h>
+#include <mpxplaybackmessage.h>
+#include <mpxmedia.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediamusicdefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessagedefs.h>
+#include <mpxalbumartutil.h>
+#include <mpxlog.h>
+
+#include "aiplayerpluginengine.h"
+
+const TInt KMPXOneSecInMilliSecs( 1000 );
+const TUid  KMusicPlayerAppUid = { 0x102072C3 };
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::ConstructL()
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::ConstructL");
+    // Get the playback utility instance from engine.
+    //iPlaybackUtility = MMPXPlaybackUtility::NewL( KPbModeActivePlayer, this );
+    iPlaybackUtility = MMPXPlaybackUtility::NewL( KMusicPlayerAppUid, this );
+    iAlbumArtUtil = CMPXAlbumArtUtil::NewL();
+    if (iPlaybackUtility->StateL() == EPbStatePlaying)
+        {
+    	  RequestMediaL();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::NewL
+// ---------------------------------------------------------------------------
+//
+CAiPlayerPluginEngine* CAiPlayerPluginEngine::NewL( 
+        MAiPlayerPluginEngineObserver& aObserver )
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::NewL");
+    CAiPlayerPluginEngine* self = new ( ELeave ) 
+            CAiPlayerPluginEngine( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::CAiPlayerPluginEngine
+// ---------------------------------------------------------------------------
+//
+CAiPlayerPluginEngine::CAiPlayerPluginEngine( 
+        MAiPlayerPluginEngineObserver& aObserver )
+    : iObserver( &aObserver ),
+      iPlaybackUtility( NULL ),
+      iTitle( NULL ),
+      iArtist( NULL ),
+      iUri( NULL ),
+      iMedia( NULL ),
+      iPosition( KErrNotFound ),
+      iDuration( KErrNotFound ),
+      iExtractingAlbumArt( EFalse ),
+      iSkipping( EFalse )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::~CAiPlayerPluginEngine
+// ---------------------------------------------------------------------------
+//
+CAiPlayerPluginEngine::~CAiPlayerPluginEngine()
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::~CAiPlayerPluginEngine");
+    if ( iPlaybackUtility )
+        {
+        iPlaybackUtility->Close();
+        }
+    delete iMedia;
+    delete iAlbumArtUtil;
+    delete iTitle;
+    delete iArtist;
+    delete iUri;
+        
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandlePlaybackMessage( CMPXMessage* aMessage, 
+        TInt aError )
+    {
+    if ( aError == KErrNone && aMessage )
+        {
+        TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandlePropertyL( TMPXPlaybackProperty aProperty, 
+        TInt aValue, TInt aError )
+    {
+    DoHandlePropertyL( aProperty, aValue, aError );
+    }
+
+// ---------------------------------------------------------------------------
+// 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 CAiPlayerPluginEngine::HandleSubPlayerNamesL(
+    TUid /* aPlayer */,
+    const MDesCArray* /* aSubPlayers */,
+    TBool /* aComplete */,
+    TInt /* aError */ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandleMediaL( const CMPXMedia& aMedia, 
+        TInt aError )
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::HandleMediaL");
+    if ( KErrNone == aError )
+        {
+        delete iUri;
+        iUri = NULL;
+        if (aMedia.IsSupported(KMPXMediaGeneralUri))
+            {
+            TParsePtrC filePath(aMedia.ValueText(KMPXMediaGeneralUri) );
+            iUri = filePath.FullName().AllocL();
+            }
+        
+		delete iTitle;
+		iTitle = NULL;
+        if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) )
+            {
+            iTitle = ( aMedia.ValueText( KMPXMediaGeneralTitle ) ).AllocL();
+            }
+        else if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
+            {
+            TParsePtrC filePath( aMedia.ValueText( KMPXMediaGeneralUri ) );
+            iTitle = (filePath.Name()).AllocL();
+            }
+		delete iArtist;
+		iArtist = NULL;
+		iArtist = ( aMedia.ValueText( KMPXMediaMusicArtist ) ).AllocL();
+		
+		iObserver->TrackInfoChanged( *iTitle, *iArtist );
+        
+		if (!iSkipping)
+            {
+            if (iExtractingAlbumArt)
+                {
+                iAlbumArtUtil->CancelRequest();
+                iExtractingAlbumArt=EFalse;
+                }
+            
+            if ( aMedia.IsSupported( KMPXMediaMusicAlbumArtFileName ) )
+                {
+                delete iMedia;
+                iMedia=NULL;
+                iMedia = CMPXMedia::NewL( aMedia );
+                TRAPD(err,iAlbumArtUtil->ExtractAlbumArtL(
+                        *iMedia,
+                        *this,
+                        TSize(70,70)));
+                
+                if (err != KErrNone)
+                    {
+                    iObserver->AlbumArtChanged(NULL);
+                    }
+                }
+            else
+                {
+                iObserver->AlbumArtChanged(NULL);
+                }
+
+            }
+		else
+		    {
+		    iObserver->AlbumArtChanged(NULL);
+		    }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle completion of a asynchronous command
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandlePlaybackCommandComplete( 
+        CMPXCommand* /*aCommandResult*/, TInt /*aError*/ )
+    {
+    // do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXAlbumArtUtilObserver
+// Notify that extraction of album art started.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::ExtractAlbumArtStarted()
+    {
+    iExtractingAlbumArt = ETrue;
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXAlbumArtUtilObserver
+// Notify that the extraction of album art has completed.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::ExtractAlbumArtCompleted( 
+        CFbsBitmap* aBitmap, 
+        TInt aErr )
+    {
+    if (aErr == KErrNone)
+        {
+        iObserver->AlbumArtChanged(aBitmap);
+        }
+    else
+        {
+        iObserver->AlbumArtChanged(NULL);
+        }
+    iExtractingAlbumArt = EFalse;
+    }
+
+// ---------------------------------------------------------------------------
+// Get the current state of the active player
+// ---------------------------------------------------------------------------
+//
+TMPlayerState CAiPlayerPluginEngine::PlayerState()
+    {
+    MPX_DEBUG1( "CAiPlayerPluginEngine::PlayerState" );
+    TMPXPlaybackState state( EPbStateNotInitialised );
+    TRAP_IGNORE( state = iPlaybackUtility->StateL() );
+    return MapState( state );
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::TitleL
+// ---------------------------------------------------------------------------
+//
+const TDesC& CAiPlayerPluginEngine::TitleL()
+    {
+
+    if ( iTitle )
+        {
+        return *iTitle;
+        }
+     else
+        {
+        RequestMediaL();
+        return KNullDesC;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::Artist
+// ---------------------------------------------------------------------------
+//
+const TDesC& CAiPlayerPluginEngine::Artist()
+    {
+    if ( iArtist )
+        {
+        return *iArtist;
+        }
+     else
+        {
+        return KNullDesC;
+        }
+    }
+// ---------------------------------------------------------------------------
+// CAiPlayerPluginEngine::Artist
+// ---------------------------------------------------------------------------
+//
+const TDesC& CAiPlayerPluginEngine::Uri()
+    {
+    if ( iUri )
+        {
+        return *iUri;
+        }
+     else
+        {
+        return KNullDesC;
+        }
+    }
+
+// ----------------------------------------------------
+// CAiPlayerPluginEngine::Position
+// ----------------------------------------------------
+//
+TInt CAiPlayerPluginEngine::Position()
+    {
+    return iPosition;
+    }
+
+// ----------------------------------------------------
+// CAiPlayerPluginEngine::Duration
+// ----------------------------------------------------
+//
+TInt CAiPlayerPluginEngine::Duration()
+    {
+    return iDuration;
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::DoHandlePlaybackMessageL( 
+        const CMPXMessage& aMessage )
+    {
+    MPX_DEBUG1("CAiPlayerPluginEngine::DoHandlePlaybackMessageL");
+
+    TMPXMessageId id( 
+            aMessage.ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId ) );
+    if ( KMPXMessageGeneral == id )
+        {
+        TInt event( aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralEvent ) );
+        MPX_DEBUG2( "CAiPlayerPluginEngine::DoHandlePlaybackMessageL(%d)", 
+                event );
+        switch ( event )
+            {
+            case TMPXPlaybackMessage::EPropertyChanged:
+                {
+                TInt error( KErrNone );
+                DoHandlePropertyL(
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ),
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ),
+                    error );
+                break;
+                }
+            case TMPXPlaybackMessage::EStateChanged:
+                {
+				TMPXPlaybackState state( 
+				        aMessage.ValueTObjectL<TMPXPlaybackState>( 
+				                KMPXMessageGeneralType ));
+                MPX_DEBUG2("CAiPlayerPluginEngine::HandlePlaybackMessageL - E"
+                        "StateChanged(%d)", state);
+
+                DoHandleStateChangedL( state );
+                break;
+                }
+            case TMPXPlaybackMessage::EMediaChanged:
+            case TMPXPlaybackMessage::EPlaylistUpdated:
+                {
+                iPlaybackUtility->PropertyL( *this, EPbPropertyPosition );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyDuration );
+                RequestMediaL();
+                break;
+                }
+            case TMPXPlaybackMessage::ECommandReceived:
+                {
+                MPX_DEBUG2("CAiPlayerPluginEngine::HandlePlaybackMessageL - E"
+                        "CommandReceived(%d)",
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ) );
+                break;
+                }
+            case TMPXPlaybackMessage::EActivePlayerChanged:
+                {
+                MPX_DEBUG3("CAiPlayerPluginEngine::HandlePlaybackMessageL - E"
+                        "ActivePlayerChanged(%d, %d)",
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralType ), 
+                    aMessage.ValueTObjectL<TInt>( KMPXMessageGeneralData ) );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyPosition );
+                iPlaybackUtility->PropertyL( *this, EPbPropertyDuration );
+                DoHandleStateChangedL( iPlaybackUtility->StateL() );
+                // refresh media property
+                RequestMediaL();
+                break;
+                }
+            case TMPXPlaybackMessage::ESkipping:
+                {
+                MPX_DEBUG1( "CAiPlayerPluginEngine::DoHandlePlaybackMessageL - ESkipping");
+                iAlbumArtUtil->CancelRequest();
+                iObserver->Opening();
+                iSkipping =ETrue;
+                break;
+                }
+            case TMPXPlaybackMessage::ESkipEnd:
+                {
+                MPX_DEBUG1( "CAiPlayerPluginEngine::DoHandlePlaybackMessageL - ESkipEnd()");
+                iSkipping = EFalse;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback property.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::DoHandlePropertyL( TInt aProperty, TInt aValue, 
+        TInt aError )
+    {
+    MPX_DEBUG4("CAiPlayerPluginEngine::DoHandlePropertyL - Property(%d); Valu"
+            "e(%d); Error(%d)", aProperty, aValue, aError );
+    if ( KErrNone == aError )
+        {
+        switch ( aProperty	)
+            {
+            case EPbPropertyPosition:
+                {
+				iPosition = aValue / KMPXOneSecInMilliSecs;
+                iObserver->PlaybackPositionChanged( iPosition );
+                break;
+                }
+            case EPbPropertyDuration:
+                {
+				iDuration = aValue / KMPXOneSecInMilliSecs;
+                break;
+                }
+            default:
+                {
+                break;
+                }
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Handle playback state changed.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::DoHandleStateChangedL( TMPXPlaybackState aState )
+    {
+    TMPlayerState state = MapState( aState );
+    MPX_DEBUG3("CAiPlayerPluginEngine::DoHandleStateChangedL - State mapped "
+            "from (%d) to (%d)", aState, state );
+    if (state != EMPlayerStateStarting)
+        {
+        iObserver->PlayerStateChanged(state);
+        }
+    else 
+        {
+        iObserver->Opening();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Displays error notes.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::HandleErrorL( TInt aError )
+    {
+	MPX_DEBUG2("CAiPlayerPluginEngine::HandleErrorL(%d)", aError );
+    }
+
+// ---------------------------------------------------------------------------
+// Map states from TMPXPlaybackState to TMPlayerState
+// ---------------------------------------------------------------------------
+//
+TMPlayerState CAiPlayerPluginEngine::MapState( TMPXPlaybackState aState )
+    {
+	TMPlayerState state = EMPlayerStateOther;
+    switch ( aState )
+        {
+        case EPbStatePlaying:
+            state = EMPlayerStatePlaying;
+            break;
+        case EPbStatePaused:
+            state = EMPlayerStatePaused;
+            break;
+        case EPbStateSeekingForward:
+        case EPbStateSeekingBackward:
+            state = EMPlayerStateSeeking;
+            break;
+        case EPbStateNotInitialised:
+        case EPbStateInitialising:
+            state = EMPlayerStateStarting;
+            break;
+        case EPbStateStopped:
+            state = EMPlayerStateStopped;
+            break;
+        default:
+            break;
+        }
+    return state;
+    }
+
+// ---------------------------------------------------------------------------
+// Requests Media.
+// ---------------------------------------------------------------------------
+//
+void CAiPlayerPluginEngine::RequestMediaL()
+    {
+    MPX_DEBUG1( "CAiPlayerPluginEngine::RequestMediaL" );
+    MMPXSource* s = iPlaybackUtility->Source();
+    if ( s )
+        {
+        RArray<TMPXAttribute> attrs;
+        CleanupClosePushL(attrs);
+        attrs.Append( KMPXMediaGeneralUri );
+        attrs.Append( KMPXMediaGeneralTitle );
+        attrs.Append( KMPXMediaMusicArtist );
+        attrs.Append( KMPXMediaMusicAlbumArtFileName );
+        s->MediaL( attrs.Array(), *this );
+        CleanupStack::PopAndDestroy( &attrs );
+        }
+    else 
+        {
+        iObserver->PlaylisIsEmpty();
+        }
+    }
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/src/applicationmonitor.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,179 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors an application exit event.
+*
+*/
+
+#include <mpxlog.h>                     // MPX_DEBUG
+#include <e32base.h>
+#include <e32std.h>
+#include <apacmdln.h>
+#include <apgtask.h>
+#include <AknTaskList.h>
+
+
+#include "applicationmonitor.h"
+#include "applicationmonitorobserver.h"
+
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CApplicationMonitor::CApplicationMonitor( MApplicationMonitorObserver& aObserver)
+        : CActive( EPriorityNormal ),
+        iObserver( aObserver )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Second Phase Constructor
+// ---------------------------------------------------------------------------
+//
+void CApplicationMonitor::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CApplicationMonitor* CApplicationMonitor::NewL( MApplicationMonitorObserver& aObserver)
+    {
+    MPX_DEBUG1("CApplicationMonitor::NewL <---");
+    CApplicationMonitor* self = new( ELeave ) CApplicationMonitor( aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    MPX_DEBUG1("CApplicationMonitor::NewL --->");
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CApplicationMonitor::~CApplicationMonitor()
+    {
+    MPX_DEBUG1("CApplicationMonitor::~CApplicationMonitor <---");
+    Cancel();
+    iThread.Close();
+    MPX_DEBUG1("CApplicationMonitor::~CApplicationMonitor --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Starts monitoring a particular Application
+// ---------------------------------------------------------------------------
+//
+void CApplicationMonitor::StartL( TUid aAppUid , TBool aRootAppIndication )
+    {
+    MPX_DEBUG1("CApplicationMonitor::StartL <---");
+    RWsSession wsSession;
+    User::LeaveIfError( wsSession.Connect() );
+    TUint64 threadId(0);
+    TBool taskExists(EFalse);
+    TInt status = KErrNone;
+    if(aRootAppIndication)
+        {
+        CAknTaskList* taskList = CAknTaskList::NewL( wsSession );
+        TApaTask task = taskList->FindRootApp( aAppUid );
+        delete taskList;
+        taskExists = task.Exists();
+        threadId = task.ThreadId().Id();
+        }
+    else
+        {
+        TApaTaskList taskList( wsSession );
+        TApaTask task = taskList.FindApp( aAppUid );
+        taskExists = task.Exists();
+        threadId = task.ThreadId().Id();
+        }
+    wsSession.Close();
+    
+    if (taskExists)
+        {
+        MPX_DEBUG1("CApplicationMonitor::StartL app found");
+        status = iThread.Open(TThreadId(threadId));
+        if ( status == KErrNone )
+        	{
+        	iThread.Logon(iStatus);
+        	SetActive();
+			}
+        }
+    else
+        {
+        MPX_DEBUG1("CApplicationMonitor::StartL not app found");
+        User::Leave(KErrNotFound);
+        }
+    MPX_DEBUG1("CApplicationMonitor::StartL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// RunL callback
+// ---------------------------------------------------------------------------
+//
+void CApplicationMonitor::RunL()
+    {
+    MPX_DEBUG1("CApplicationMonitor::RunL <---");
+    switch (iStatus.Int())
+        {
+        case EExitKill: 
+        case EExitTerminate:
+        case EExitPanic:
+            MPX_DEBUG1("CApplicationMonitor::RunL kill\terminate\panic");
+            iObserver.HandleApplicationClosedL((TExitType) iStatus.Int());
+            break;
+        case KErrCancel:
+        case KErrNoMemory:
+            MPX_DEBUG1("CApplicationMonitor::RunL cancel\memory");
+            break;
+        case EExitPending: 
+        default:
+            MPX_DEBUG1("CApplicationMonitor::RunL exitpendin\default");
+            // Listen again
+            iThread.Logon(iStatus);
+            SetActive();
+            break;
+        }
+    MPX_DEBUG1("CApplicationMonitor::RunL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle Cancelling
+// ---------------------------------------------------------------------------
+//
+void CApplicationMonitor::DoCancel()
+    {
+    MPX_DEBUG1("CApplicationMonitor::DoCancel <---");
+    // Stop monitoring
+    iThread.LogonCancel(iStatus);
+    MPX_DEBUG1("CApplicationMonitor::DoCancel --->");
+    }
+
+// ----------------------------------------------------------------------------
+// Handles a leave occurring in the request completion event handler RunL()
+// ----------------------------------------------------------------------------
+//
+TInt CApplicationMonitor::RunError(TInt /*aError*/)
+    {
+    MPX_DEBUG1("CApplicationMonitor::RunError <---");
+    // Listen again
+    iThread.Logon(iStatus);
+    SetActive();
+    MPX_DEBUG1("CApplicationMonitor::RunError --->");
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/src/filemonitor.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors the file system for changes in a file.
+*
+*/
+
+
+#include <e32base.h>
+#include <bautils.h>
+#include <mpxlog.h>
+
+#include "filemonitor.h"
+#include "filemonitorobserver.h"
+
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CFileMonitor::CFileMonitor( MFileMonitorObserver& aObserver)
+        : CActive( EPriorityNormal ),
+        iObserver( aObserver ),
+        iFilePath( NULL )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Second Phase Constructor
+// ---------------------------------------------------------------------------
+//
+void CFileMonitor::ConstructL()
+    {
+    CActiveScheduler::Add( this );
+    User::LeaveIfError( iFs.Connect() );
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CFileMonitor* CFileMonitor::NewL( MFileMonitorObserver& aObserver)
+    {
+    CFileMonitor* self = new( ELeave ) CFileMonitor( aObserver);
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CFileMonitor::~CFileMonitor()
+    {
+    Cancel();
+    iFs.Close();
+    delete iFilePath;
+    }
+
+// ---------------------------------------------------------------------------
+// Starts monitoring a particular file
+// ---------------------------------------------------------------------------
+//
+void CFileMonitor::StartL(  const TDesC& aFile)
+    {
+    MPX_DEBUG1("CFileMonitor::Start <---");
+
+    delete iFilePath;
+    iFilePath = NULL;
+    iFilePath = aFile.AllocL();
+		
+    TNotifyType notType = ENotifyAll;
+    iFs.NotifyChange( notType, iStatus, *iFilePath );
+    SetActive();
+    MPX_DEBUG1("CFileMonitor::Start --->");
+    }
+
+// ---------------------------------------------------------------------------
+// RunL callback
+// ---------------------------------------------------------------------------
+//
+void CFileMonitor::RunL()
+    {
+    MPX_DEBUG1("CFileMonitor::RunL <---");
+    if (!BaflUtils::FileExists(iFs, *iFilePath ))
+        {
+        iObserver.HandleFileRemovedL();
+        MPX_DEBUG1("CFileMonitor::RunL - File was removed");
+        }
+    else
+        {
+        // Listen again
+        TNotifyType notType(ENotifyAll);
+        iFs.NotifyChange(notType, iStatus, *iFilePath);
+        SetActive();
+        MPX_DEBUG1("CFileMonitor::RunL - File exists");
+        }
+    MPX_DEBUG1("CFileMonitor::RunL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle Cancelling
+// ---------------------------------------------------------------------------
+//
+void CFileMonitor::DoCancel()
+    {
+    MPX_DEBUG1("CFileMonitor::DoCancel <---");
+
+    // Stop monitoring
+    iFs.NotifyChangeCancel();
+    MPX_DEBUG1("CFileMonitor::DoCancel --->");
+
+    }
+
+// ----------------------------------------------------------------------------
+// Handles a leave occurring in the request completion event handler RunL()
+// ----------------------------------------------------------------------------
+//
+TInt CFileMonitor::RunError(TInt aError)
+    {
+    MPX_DEBUG2("CFileMonitor::RunError(%d)", aError );
+   
+    // Listen again
+    TNotifyType notType(ENotifyAll);
+    iFs.NotifyChange( notType, iStatus, *iFilePath );
+    SetActive();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/src/mcpmusicplayer.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1332 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Updates Music Content Publisher
+*
+*/
+
+#include <mpxlog.h>                     // MPX_DEBUG
+#include <implementationproxy.h>
+#include <liwservicehandler.h>
+#include <liwvariant.h>
+#include <liwgenericparam.h>
+#include <StringLoader.h>
+#include <AknUtils.h>
+#include <AknsUtils.h>
+#include <aknsconstants.hrh>
+#include <musichomescreenicons.mbg>
+#include <musichomescreen.rsg>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionframeworkdefs.h>
+#include <AknTaskList.h>
+
+
+
+#include "cpglobals.h" //to be moved to domain API
+
+#include "mcpmusicplayer.h" 
+#include "mcpmusicplayeruids.hrh"
+#include "aiplayerpluginengine.h"
+#include "filemonitor.h"
+#include "applicationmonitor.h"
+#include "pnsmonitor.h"
+
+//const TUid  KLocalPlaybackUid = { 0x101FFC06 };
+const TInt  KMusicPlayerAppUidAsTInt =  0x102072C3;
+
+const TInt KMmUid3AsTInt( 0x101f4cd2 );
+const TInt KMSGUidAsTInt( 0x10003A39 );
+
+namespace TBK
+    {
+    const TUint  KSkeep_L          = 0x001; //000000000001
+    const TUint  KSkeep_R          = 0x002; //000000000010
+    const TUint  KPause            = 0x004; //000000000100
+    const TUint  KPlay             = 0x008; //000000001000
+    const TUint  KSkeep_L_dimmed   = 0x010; //000000010000
+    const TUint  KSkeep_R_dimmed   = 0x020; //000000100000
+    const TUint  KPause_dimmed     = 0x040; //000001000000
+    const TUint  KPlay_dimmed      = 0x080; //000010000000
+    const TUint  KPlay_last_played = 0x100; //000100000000
+    }
+
+_LIT( KEmpty, "" );
+_LIT( KNowPlaying, "LOC:NOW PLAYING" );
+_LIT( KLastPlayed, "LOC:LAST PLAYED" );
+
+
+_LIT( KMIF, "z:\\resource\\apps\\musichomescreenicons.mif");
+
+_LIT( KResourceFile, "z:musichomescreen.rsc");
+
+//for music player action handler - playback command
+_LIT( KActionPlaybackCommand , "PlaybackCommand" );
+_LIT8( KPBCommand, "command" );
+
+//for music player action handler - message to music player
+_LIT( KactionMessageToMusicPlayer, "MessageToMusicPlayer" );
+_LIT( KGoToNowPlaying, "GoToNowPlaying" );
+_LIT( KGoToLastPlayed, "GoToLastPlayed" );
+_LIT( KGoToLastPlayedMinimized, "GoToLastPlayedMinimized" );
+_LIT( KGoToAlbumView, "GoToAlbumView" );
+
+_LIT8( KMessage, "message" );
+_LIT8( KAdditionalData, "additional_data" );
+
+//for application launcher AHPlugin
+_LIT( KCmdLine, "cmd_line" );
+_LIT( KLaunchApp, "launch_application" );
+_LIT( KMessageWithTail, "message_with_tail" );
+_LIT8( KMessageForMMOpenMusicSuiteWithHide, "mm://root/musicsuite?exit=hide");
+
+
+//for time
+//_LIT( KSeparator, "/" );
+_LIT( KSeparatorhyphen, " - " );
+//_LIT( KMPXZeroDurationMark, "--" );
+//_LIT( KTitleNowPlaying, "Now Playing" );
+//_LIT( KTitleLastPlayed, "Last Played" );
+
+const TInt KMusicPlayerOpeningTimerInterval = 15000000; // 15 seconds
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMCPMusicPlayer::CMCPMusicPlayer(MMCPPluginObserver* aObserver)
+    {
+    iMHObserver = aObserver;
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::ConstructL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL <---");
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL creating engine");
+    iEngine = CAiPlayerPluginEngine::NewL( *this );
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL engine created");
+    AknsUtils::InitSkinSupportL();
+    //Load Loc strings
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL getting resource file");
+    RFs fs;
+    User::LeaveIfError(fs.Connect());
+    CleanupClosePushL(fs);  
+    TFileName fileName;
+    TParse* parseObj = new(ELeave) TParse();
+    TInt errInt = parseObj->Set( KResourceFile(),&KDC_APP_RESOURCE_DIR,NULL );
+    if(KErrNone != errInt)
+      {
+      delete parseObj;
+      User::Leave(errInt);
+      }
+    fileName = parseObj->FullName();
+    delete parseObj;
+    BaflUtils::NearestLanguageFile(fs,fileName);
+    if(!BaflUtils::FileExists(fs,fileName))
+        {
+        User::Leave(KErrNotFound);
+        }
+    RResourceFile resourceFile;
+    resourceFile.OpenL(fs,fileName);
+    CleanupClosePushL(resourceFile);
+    resourceFile.ConfirmSignatureL();
+    GetLocalizedStringL(resourceFile, iGoToMusicBuffer, R_MUSICHOMESCREEN_GO_TO_MUSIC);
+    GetLocalizedStringL(resourceFile, iOpeningBuffer, R_MUSICHOMESCREEN_OPENING);
+    CleanupStack::PopAndDestroy(&resourceFile);
+    CleanupStack::PopAndDestroy(&fs);
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL resources loaded");
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    TRAPD(err, iArtBitmapMask = AknsUtils::CreateBitmapL( skin, 
+            KAknsIIDQgnHomePhotoMask ) );
+    if (err == KErrNone)
+        {
+        AknIconUtils::DisableCompression(iArtBitmapMask);
+        TSize size( 70 , 70);
+        AknIconUtils::SetSize( iArtBitmapMask, size );
+        if (iArtBitmapMask->SetDisplayMode( EGray256 ) != KErrNone)
+            {
+            delete iArtBitmapMask;
+            iArtBitmapMask = NULL;
+            }
+        }
+    else
+        {
+        delete iArtBitmapMask;
+        iArtBitmapMask = NULL;
+        }
+    iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeDefault );
+    iMusicPlayerOpeningTimer = CPeriodic::NewL( CActive::EPriorityLow );
+    MPX_DEBUG1("CMCPMusicPlayer::ConstructL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMCPMusicPlayer* CMCPMusicPlayer::NewL(MMCPPluginObserver* aObserver)
+    {
+    CMCPMusicPlayer* self = new ( ELeave ) 
+    CMCPMusicPlayer( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMCPMusicPlayer::~CMCPMusicPlayer()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::~CMCPMusicPlayer <---");
+    if (iArtCached && iArtBitmap != iCachedArtBitmap)
+        {
+        delete iCachedArtBitmap;
+        }
+    delete iArtBitmap;
+    delete iArtBitmapMask;
+    delete iEngine;
+    delete iFileMonitor;
+    delete iAppMonitor;
+    delete iPNSMonitor;
+    delete iGoToMusicBuffer;
+    delete iOpeningBuffer;
+    if ( iCollectionUtility )
+    	{
+    	iCollectionUtility->Close();
+    	}
+    delete iMusicPlayerOpeningTimer;
+    MPX_DEBUG1("CMCPMusicPlayer::~CMCPMusicPlayer --->");
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TBool CMCPMusicPlayer::IsOKToPublishData()
+    {
+    return iActive;
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallPlaybackCommandActionL(TMPXPlaybackCommand aCmd,
+        TMCPTriggerDestination aDestination)
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallPlaybackCommandActionL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10207C16 ) ) );
+    mapData->InsertL( KType, TLiwVariant( KActionPlaybackCommand ) );
+    TInt32 cmd;
+    cmd=static_cast<TInt32>( aCmd );
+    mapData->InsertL( KPBCommand, TLiwVariant( cmd ) );
+    mapTrigger->InsertL( KData , TLiwVariant( mapData ) );
+    
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData  );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallPlaybackCommandActionL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallLaunchMusicPlayerL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallLaunchMusicPlayerL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10282E5F ) ) );
+    mapData->InsertL( KType, TLiwVariant( KLaunchApp ) );
+    mapData->InsertL( KLaunchMethod, TLiwVariant( KCmdLine ) );
+    mapData->InsertL(KApplicationUid,
+            TLiwVariant(TInt32(KMusicPlayerAppUidAsTInt) ) );
+    mapTrigger->InsertL( KData, TLiwVariant( mapData ) );
+    
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallLaunchMusicPlayerL --->");
+    }
+
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallGoToNowPlayingL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToNowPlayingL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10207C16 ) ) );
+    mapData->InsertL( KType, TLiwVariant( KactionMessageToMusicPlayer ) );
+    mapData->InsertL( KMessage, TLiwVariant( KGoToNowPlaying ) );
+    mapTrigger->InsertL( KData , TLiwVariant( mapData ) );
+
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData  );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToNowPlayingL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallGoToLastPlayedL(
+        TMCPTriggerDestination aDestination, TBool aMinimized )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToLastPlayedL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10207C16 ) ) );
+    mapData->InsertL( KType, TLiwVariant( KactionMessageToMusicPlayer ) );
+    if (aMinimized)
+        {
+        mapData->InsertL( KMessage, TLiwVariant( KGoToLastPlayedMinimized ) );
+        }
+    else
+        {
+        mapData->InsertL( KMessage, TLiwVariant( KGoToLastPlayed ) );
+        }
+    mapTrigger->InsertL( KData , TLiwVariant( mapData ) );
+
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData  );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToLastPlayedL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallGoToMusicL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToMusicL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10282E5F ) ) );
+    
+    mapData->InsertL( KType, TLiwVariant( KLaunchApp ) );
+    mapData->InsertL( KLaunchMethod, TLiwVariant( KMessageWithTail ) );
+    mapData->InsertL(KApplicationUid,
+            TLiwVariant(TInt32(KMmUid3AsTInt) ) );
+        mapData->InsertL( KAdditionalData, 
+            TLiwVariant( KMessageForMMOpenMusicSuiteWithHide ) );
+    mapData->InsertL(KMessageUid,
+            TLiwVariant(TInt32(KMSGUidAsTInt) ) );
+    
+    mapTrigger->InsertL( KData, TLiwVariant( mapData ) );
+    
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToMusicL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallGoToAlbumL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToAlbumL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10207C16 ) ) );
+       mapData->InsertL( KType, TLiwVariant( KactionMessageToMusicPlayer ) );
+       mapData->InsertL( KMessage, TLiwVariant( KGoToAlbumView ) );
+    mapTrigger->InsertL( KData, TLiwVariant( mapData ) );
+    
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallGoToAlbumL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::InstallEmptyActionL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::InstallEmptyActionL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    iMHObserver->PublishActionL( this, aDestination, mapTrigger );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMCPMusicPlayer::InstallEmptyActionL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Installs actions and icons in the toolbar.
+// ---------------------------------------------------------------------------
+//
+
+void CMCPMusicPlayer::UpdateToolBarL(TUint aToolBarState)
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL <---");
+    if (IsOKToPublishData())
+        {
+        TInt updateState;
+        //we update if there is a change on the state and if the new propery
+        //was set.
+        // updateState = ( new ^ old ) & new = new & ~old
+        updateState = aToolBarState & ~iToolBarState;
+        TAknsItemID iconId;
+        
+        if ( TBK::KSkeep_L & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPrev);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB1, iconId, 
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_prev, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_prev_mask);
+            InstallPlaybackCommandActionL(EPbCmdPrevious, 
+                    EMusicWidgetTB1Trigger);
+            iToolBarState |= TBK::KPlay_dimmed;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KSkeep_L");
+            }
+        
+        if ( TBK::KSkeep_R & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbNext);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB3, iconId, 
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_next, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_next_mask);
+            InstallPlaybackCommandActionL(EPbCmdNext, EMusicWidgetTB3Trigger);
+            iToolBarState |= TBK::KSkeep_R;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KSkeep_R");
+            }
+        
+        if ( TBK::KPause & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPause);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB2, iconId, 
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_pause, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_pause_mask);
+            InstallPlaybackCommandActionL(EPbCmdPlayPause,
+                    EMusicWidgetTB2Trigger);
+            iToolBarState |= TBK::KPause;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KPause");
+            }
+        
+        if ( TBK::KPlay & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPlay2 );
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB2, iconId,
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_play2, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_play2_mask);
+            InstallPlaybackCommandActionL(EPbCmdPlayPause, 
+                    EMusicWidgetTB2Trigger);
+            iToolBarState |= TBK::KPlay;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KPlay");
+            }
+        
+        if ( TBK::KPlay_last_played & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPlay2 );
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB2, iconId,
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_play2, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_play2_mask);
+            InstallGoToLastPlayedL(EMusicWidgetTB2Trigger, ETrue); 
+            iToolBarState |= TBK::KPlay_last_played;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KPlay_last_played");
+            }
+        
+        if ( TBK::KSkeep_L_dimmed & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPrevDimmed);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB1, iconId, 
+                    KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_prev_dimmed, 
+                    EMbmMusichomescreeniconsQgn_prop_image_tb_prev_dimmed_mask);
+            InstallEmptyActionL( EMusicWidgetTB1Trigger);
+            iToolBarState |= TBK::KSkeep_L_dimmed;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KSkeep_L_dimmed");
+            }
+        
+        if ( TBK::KSkeep_R_dimmed & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbNextDimmed);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB3, iconId, 
+                KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_next_dimmed, 
+                EMbmMusichomescreeniconsQgn_prop_image_tb_next_dimmed_mask);
+            InstallEmptyActionL( EMusicWidgetTB3Trigger);
+            iToolBarState |= TBK::KSkeep_R_dimmed;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KSkeep_R_dimmed");
+            }
+        
+        if ( TBK::KPause_dimmed & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPauseDimmed);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB2, iconId, 
+                KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_pause_dimmed, 
+                EMbmMusichomescreeniconsQgn_prop_image_tb_pause_dimmed_mask);
+            InstallEmptyActionL( EMusicWidgetTB2Trigger);
+            iToolBarState |= TBK::KPause_dimmed;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KPause_dimmed");
+            }
+        
+        if ( TBK::KPlay_dimmed & updateState )
+            {
+            iconId.Set( EAknsMajorGeneric, 
+                    EAknsMinorGenericQgnPropImageTbPlay2Dimmed);
+            iMHObserver->PublishImageL( this, EMusicWidgetToolbarB2, iconId, 
+                KMIF, EMbmMusichomescreeniconsQgn_prop_image_tb_play2_dimmed, 
+                EMbmMusichomescreeniconsQgn_prop_image_tb_play2_dimmed_mask);
+            InstallEmptyActionL( EMusicWidgetTB2Trigger);
+            iToolBarState |= TBK::KPlay_dimmed;
+            MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL KPlay_dimmed");
+            }
+        
+        iToolBarState = aToolBarState;
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::UpdateToolBarL <---");
+    }
+
+// ---------------------------------------------------------------------------
+// Resets the widget an Music Suite.
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::ResetL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::ResetL <---");
+    //Note that we are not checking if IsOKToPublishData()This will only get
+    //published if the plugin is still active on the music content publisher
+    //meaning that no other plugin has preempted us.
+    if ( iAppMonitor )
+        {
+        delete iAppMonitor;
+        iAppMonitor = NULL;
+        }
+    if (iFileMonitor)
+        {
+        delete iFileMonitor;
+        iFileMonitor = NULL;
+        }
+    if ( iPNSMonitor )
+        {
+        delete iPNSMonitor;
+        iPNSMonitor = NULL;
+        }
+    //Reset
+    iMHObserver->PublishTextL( this,EMusicWidgetDefaultText, iGoToMusicBuffer->Des() );
+    iMHObserver->PublishImageL(this,EMusicWidgetImage1,KEmpty);
+    InstallGoToAlbumL(EMusicWidgetTrigger1);
+    iMHObserver->PublishTextL( this,EMusicWidgetText1, KEmpty );
+    iMHObserver->PublishImageL(this,EMusicWidgetToolbarB1,KEmpty);
+    iMHObserver->PublishImageL(this,EMusicWidgetToolbarB2,KEmpty);
+    iMHObserver->PublishImageL(this,EMusicWidgetToolbarB3,KEmpty);
+    InstallEmptyActionL(EMusicWidgetTB1Trigger);
+    InstallEmptyActionL(EMusicWidgetTB2Trigger);
+    InstallEmptyActionL(EMusicWidgetTB3Trigger);
+    InstallGoToAlbumL(EMusicWidgetTrigger2);
+
+    
+    //Reset the music menu info
+    InstallEmptyActionL(EMusicMenuMusicInfoTrigger);
+    iMHObserver->PublishTextL( this, EMusicMenuMusicInfoLine1, 
+            KLastPlayed );
+    iMHObserver->PublishTextL( this, EMusicMenuMusicInfoLine2, 
+            KEmpty );
+    iMHObserver->PublishImageL( this, EMusicMenuMusicInfoImage1,
+        KAknsIIDQgnIndiMupDefaultAlbum, 
+        KMIF,
+        EMbmMusichomescreeniconsQgn_indi_mup_default_album,
+        EMbmMusichomescreeniconsQgn_indi_mup_default_album_mask); 
+    MPX_DEBUG1("CMCPMusicPlayer::ResetL --->");
+    }
+
+// ----------------------------------------------------------------------------
+// Get a heap descriptor from the resource file
+// ----------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::GetLocalizedStringL(RResourceFile& aResourceFile ,HBufC*& aRetBuf,
+        TInt aResourceId )
+   {
+   MPX_DEBUG1("CMCPMusicPlayer::GetLocalizedStringL <---");
+   HBufC8* dataBuffer = aResourceFile.AllocReadLC(aResourceId);
+   TResourceReader theReader;
+   theReader.SetBuffer(dataBuffer);
+   aRetBuf = theReader.ReadHBufCL();
+   CleanupStack::PopAndDestroy(dataBuffer);
+   MPX_DEBUG1("CMCPMusicPlayer::GetLocalizedStringL --->");
+   }
+
+// ----------------------------------------------------------------------------
+// Sets the plugin as active.
+// ----------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::ActivateL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL <---");
+    if ( iPNSMonitor )
+        {
+        delete iPNSMonitor;
+        iFileMonitor = NULL;
+        MPX_DEBUG1("CMCPMusicPlayer::ActivateL pns monitor deleted");
+        }
+    iPNSMonitor = CPNSMonitor::NewL(*this);
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL pns monitor created");
+    iPNSMonitor->Start();
+    if ( iAppMonitor )
+        {
+        delete iAppMonitor;
+        iAppMonitor = NULL;
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL app monitor deleted");
+    iAppMonitor = CApplicationMonitor::NewL(*this);
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL app monitor created");
+    TRAPD(err, 
+            iAppMonitor->StartL( TUid::Uid( KMusicPlayerAppUidAsTInt ) ) 
+          );
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL app monitor started");
+    if (KErrNone != err) //Music player is not running, it died somehow. 
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::ActivateL music player is not running");
+        if (iFileMonitor)
+            {
+            delete iFileMonitor;
+            iFileMonitor = NULL;
+            }
+        MPX_DEBUG1("CMCPMusicPlayer::ActivateL file monitor deleted");
+        const TDesC& uri = iEngine->Uri();
+        if ( uri != KNullDesC )
+            {
+            MPX_DEBUG1("CMCPMusicPlayer::ActivateL uri is not null creatin file monitor");
+            iFileMonitor = CFileMonitor::NewL(*this);
+            iFileMonitor->StartL( uri );
+            }
+        iActive = EFalse;
+        }
+    else //Music player is running
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::ActivateL music player is running, activating...");
+        iMHObserver->BecameActiveL(this);
+        iActive = ETrue;
+        MPX_DEBUG1("CMCPMusicPlayer::ActivateL we are active now");
+        
+        iMHObserver->PublishTextL( this, EMusicWidgetDefaultText, KEmpty );
+        InstallGoToAlbumL(EMusicWidgetTrigger1);
+        InstallGoToLastPlayedL(EMusicMenuMusicInfoTrigger, EFalse);
+        iMHObserver->PublishTextL(this, EMusicMenuMusicInfoLine1, 
+                 KNowPlaying);
+        DoUpdateTrackInfoL(iEngine->TitleL(), iEngine->Artist());
+        iToolBarState = 0;
+        DoUpdatePlayerStateL( iEngine->PlayerState() );
+        DoUpdateAlbumArtL(iArtCached ? iCachedArtBitmap : iArtBitmap);
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::ActivateL --->");
+    }
+
+
+void CMCPMusicPlayer::DoUpdatePlayerStateL(TMPlayerState aState)
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL <---");
+    switch ( aState )
+            {
+            case EMPlayerStatePlaying:
+                {
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL EMPlayerStatePlaying");
+                UpdateToolBarL(TBK::KSkeep_L|TBK::KPause|TBK::KSkeep_R);
+                break;
+                }
+            case EMPlayerStatePaused:
+                {
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL EMPlayerStatePaused");
+                UpdateToolBarL(TBK::KSkeep_L|TBK::KPlay|TBK::KSkeep_R);
+                break;
+                }
+            case EMPlayerStateSeeking:
+                {
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL EMPlayerStateSeeking");
+                UpdateToolBarL(TBK::KSkeep_L_dimmed |
+                        TBK::KPlay_dimmed |
+                        TBK::KSkeep_R_dimmed);
+                break;
+                }
+            case EMPlayerStateStopped:
+                {
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL EMPlayerStateStopped");
+                if ( iUSBOnGoing )
+                    {
+                    UpdateToolBarL( TBK::KSkeep_L_dimmed |
+                            TBK::KPlay_dimmed |
+                            TBK::KSkeep_R_dimmed );
+                    }
+                else
+                    {
+                    UpdateToolBarL(TBK::KSkeep_L|TBK::KPlay|TBK::KSkeep_R);
+                    }
+                break;
+                }
+            default:
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL default");
+                break;
+            }
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL --->");
+    }
+
+void CMCPMusicPlayer::DoUpdateTrackInfoL(const TDesC& aTitle, const TDesC& aArtist)
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL <---");
+    if ( IsOKToPublishData() )
+            {
+            HBufC* nowPlayingForMM = HBufC::NewLC( aTitle.Length() + 
+            		                               KSeparatorhyphen().Length() + aArtist.Length() );     
+            TPtr nowPlayingForMMPtr = nowPlayingForMM->Des();
+            if ( &aTitle && aTitle.Length() )
+                {
+                nowPlayingForMMPtr.Copy( aTitle );
+                }
+            if ( &aArtist && aArtist.Length() )
+                {
+                nowPlayingForMMPtr.Append(KSeparatorhyphen);
+                nowPlayingForMMPtr.Append(aArtist);
+                }            
+            iMHObserver->PublishTextL( this,EMusicWidgetText1, *nowPlayingForMM );
+            iMHObserver->PublishTextL(this, EMusicMenuMusicInfoLine2,
+                    *nowPlayingForMM);
+            CleanupStack::PopAndDestroy( nowPlayingForMM );
+            MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL deliting file monitor");
+            if (iFileMonitor)
+                {
+                delete iFileMonitor;
+                iFileMonitor = NULL;
+                }
+            
+            const TDesC& uri = iEngine->Uri();
+            if ( uri != KNullDesC )
+                {
+                MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL creating file monitor");
+                iFileMonitor = CFileMonitor::NewL(*this);
+                iFileMonitor->StartL( uri );
+                }
+            }
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdatePlayerStateL --->");
+    }
+
+void CMCPMusicPlayer::DoUpdatePlaybackPositionL(TInt /*aPosition*/)
+    {
+    /*
+     * 
+     * This code was left here in case some parts are helpfull
+     *  in the future, here is some code that used to work, 
+     *  Members and APIs used migh have changed.
+     *  
+        if ( IsOKToPublishData() )
+            {
+            const TInt KMPXMinSecSeparatorIndex = 2;
+            const TInt KMPXOneSecInMicroSecs = 1000000;
+            const TInt KMPXOneHourInSeconds = 60 * 60;
+            const TInt KMPXTimeIndicatorLength = 16;
+            
+            TBuf<KMPXTimeIndicatorLength> elapsed;
+            TBuf<KMPXTimeIndicatorLength> total;
+        
+            TInt64 playbackPosInSeconds;
+            TInt64 totalLengthInSeconds;
+        
+            playbackPosInSeconds = aPosition;
+            totalLengthInSeconds = iEngine->Duration();
+            HBufC* longFormatString;
+            HBufC* shortFormatString;
+        
+            longFormatString = StringLoader::LoadL(
+                    R_QTN_TIME_DURAT_LONG_WITH_ZERO );
+            shortFormatString = StringLoader::LoadL(
+                    R_QTN_TIME_DURAT_MIN_SEC_WITH_ZERO) ;
+            TPtrC format = *shortFormatString;
+        
+            if ( totalLengthInSeconds >= KMPXOneHourInSeconds )
+                {
+                // For tracks longer than an hour we use different time format and
+                //a slightly different layout which has more space for the time
+                //labels.
+                format.Set( *longFormatString );
+                }
+        
+            TTime elapsedTime( playbackPosInSeconds * KMPXOneSecInMicroSecs );
+            TTime totalTime( totalLengthInSeconds * KMPXOneSecInMicroSecs );
+        
+            if ( aPosition == 0 )
+                {
+                totalLengthInSeconds = 0;
+                }
+        
+            // Convert total playing time to texts.
+            elapsedTime.FormatL( elapsed, format );
+        
+            if ( totalLengthInSeconds )
+                {
+                // Time remaining
+                totalTime.FormatL( total, format );
+                }
+            else
+                {
+                // Time remaining: --:--
+                TLocale locale;
+                TBuf<KMPXTimeIndicatorLength> pos;
+                TChar separator = locale.TimeSeparator(KMPXMinSecSeparatorIndex);
+                total = KMPXZeroDurationMark;
+                total.Append( separator );
+                total += KMPXZeroDurationMark;
+                }
+        
+            AknTextUtils::LanguageSpecificNumberConversion( elapsed );
+            AknTextUtils::LanguageSpecificNumberConversion( total );
+            TBuf<128> duration;
+            TBuf<128> elapsedTimebuf;
+        
+            elapsedTimebuf.Copy( elapsed );
+        
+            duration.Copy( elapsed );
+            duration.Append( KSeparator );
+            duration.Append( total );
+        
+            iMHObserver->PublishTextL( this, EMusicWidgetText3, duration );
+        
+            delete longFormatString;
+            delete shortFormatString;
+            }
+     */
+    }
+
+void CMCPMusicPlayer::DoUpdateAlbumArtL( CFbsBitmap* aBitmap )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdateAlbumArtL <---");
+    //Make sure that iCachedArtBitmap is deleted or nulled in case it is an alias.
+    //This ensures that the data is not double deleted nor orphan.
+    if ( iCachedArtBitmap && iCachedArtBitmap !=  aBitmap  && iCachedArtBitmap != iArtBitmap)
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::DoUpdateAlbumArtL delete iCachedArtBitmap");
+        delete iCachedArtBitmap;
+        }
+    iCachedArtBitmap = NULL;
+    //Store the new bitmap.
+    if ( aBitmap != iArtBitmap )
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::DoUpdateAlbumArtL delete iArtBitmap");
+        delete iArtBitmap;
+        }
+    iArtBitmap = aBitmap;
+    iArtCached = EFalse;
+    
+    if (iArtBitmap)
+        {
+        TInt handle = iArtBitmap->Handle();
+        if (iArtBitmapMask)
+            {
+            TInt mskHandle = iArtBitmapMask->Handle();
+            iMHObserver->PublishImageL(this,EMusicWidgetImage1,handle,
+                    mskHandle);
+            }
+        else
+            {
+            iMHObserver->PublishImageL(this,EMusicWidgetImage1,handle);
+            }
+        iMHObserver->PublishImageL( this, EMusicMenuMusicInfoImage1, 
+                handle );
+        }
+    else
+        {
+        iMHObserver->PublishImageL( this, EMusicMenuMusicInfoImage1,
+                    KAknsIIDQgnIndiMupDefaultAlbum, 
+                    KMIF, EMbmMusichomescreeniconsQgn_indi_mup_default_album, 
+                    EMbmMusichomescreeniconsQgn_indi_mup_default_album_mask); 
+        iMHObserver->PublishImageL( this, EMusicWidgetImage1,
+                    KAknsIIDQgnIndiMupDefaultAlbum, 
+                    KMIF, EMbmMusichomescreeniconsQgn_indi_mup_default_album, 
+                    EMbmMusichomescreeniconsQgn_indi_mup_default_album_mask);
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::DoUpdateAlbumArtL --->");
+    }
+
+void CMCPMusicPlayer::DoHandleOpeningL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandleOpeningL <---");
+    if ( IsOKToPublishData() )
+        {
+        iMHObserver->PublishTextL( this,EMusicWidgetText1, iOpeningBuffer->Des() );
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandleOpeningL --->");
+    }
+
+void CMCPMusicPlayer::DoHandlePlaylisIsEmptyL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandlePlaylisIsEmptyL <---");
+    iActive = EFalse;
+    ResetL();
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandlePlaylisIsEmptyL --->");
+    }
+void CMCPMusicPlayer::DoHandleSkinChangedL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandleSkinChangedL <---");
+    //To make sure the mask gets recreated even if we don't use it right now.
+    delete iArtBitmapMask;
+    iArtBitmapMask = NULL;
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    
+    TRAPD(err, iArtBitmapMask = AknsUtils::CreateBitmapL( skin, 
+            KAknsIIDQgnHomePhotoMask ) );
+    if (err == KErrNone)
+        {
+        AknIconUtils::DisableCompression(iArtBitmapMask);
+        TSize size( 70 , 70);
+        AknIconUtils::SetSize( iArtBitmapMask, size );
+        if (iArtBitmapMask->SetDisplayMode( EGray256 ) != KErrNone)
+            {
+            delete iArtBitmapMask;
+            iArtBitmapMask = NULL;
+            }
+        }
+    else
+        {
+        delete iArtBitmapMask;
+        iArtBitmapMask = NULL;
+        }
+    
+    if (iArtBitmap)
+        {
+        TInt handle = iArtBitmap->Handle();
+        if (iArtBitmapMask)
+            {
+            TInt mskHandle = iArtBitmapMask->Handle();
+            iMHObserver->PublishImageL(
+                    this,
+                    EMusicWidgetImage1,
+                    handle, 
+                    mskHandle);
+            }
+        else
+            {
+            iMHObserver->PublishImageL(
+                    this,
+                    EMusicWidgetImage1,
+                    handle);
+            }
+        }
+    else
+        {
+        iMHObserver->PublishImageL( this, EMusicMenuMusicInfoImage1,
+                    KAknsIIDQgnIndiMupDefaultAlbum, 
+                    KMIF, EMbmMusichomescreeniconsQgn_indi_mup_default_album, 
+                    EMbmMusichomescreeniconsQgn_indi_mup_default_album_mask); 
+        iMHObserver->PublishImageL( this, EMusicWidgetImage1,
+                    KAknsIIDQgnIndiMupDefaultAlbum, 
+                    KMIF, EMbmMusichomescreeniconsQgn_indi_mup_default_album, 
+                    EMbmMusichomescreeniconsQgn_indi_mup_default_album_mask);
+        }
+       
+    TUint tbstate = iToolBarState;
+    //To Force a change on the toolbar with the current properties.
+    iToolBarState = 0;
+    if (!iActive)
+        {
+        //This is to force the icons to update, but we still want to keep
+        //the plugin as incative.
+        iActive = ETrue;
+        UpdateToolBarL(tbstate);
+        iActive = EFalse;
+        }
+    else
+        {
+        UpdateToolBarL(tbstate);
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::DoHandleSkinChangedL --->");
+    }
+   
+
+
+// ---------------------------------------------------------------------------
+// From CMCPPlugin
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::Deactivate()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::Deactivate() <---");
+    iActive = EFalse;
+    if (iFileMonitor)
+        {
+        delete iFileMonitor;
+        iFileMonitor = NULL;
+        }
+    if (iAppMonitor)
+        {
+        delete iAppMonitor;
+        iAppMonitor = NULL;
+        }
+    if ( iPNSMonitor )
+        {
+        delete iPNSMonitor;
+        iPNSMonitor = NULL;
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::Deactivate() --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From CMCPPlugin
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::SkinChanged()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::SkinChanged() <---");
+    TRAP_IGNORE( DoHandleSkinChangedL() );
+    MPX_DEBUG1("CMCPMusicPlayer::SkinChanged() --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::PlayerStateChanged( TMPlayerState aState )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::PlayerStateChanged <---");
+    //we want to activate only with states that can be triggered by the user.
+    if (!iActive && 
+	        aState == EMPlayerStatePlaying)
+        {
+        //ActivateL updates the whole widget and music suite data.
+        MPX_DEBUG1("CMCPMusicPlayer::PlayerStateChanged activating");
+        TRAP_IGNORE( ActivateL() );
+        }
+    else
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::PlayerStateChanged updating state");
+        TRAP_IGNORE(DoUpdatePlayerStateL(aState));
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::PlayerStateChanged --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::TrackInfoChanged( const TDesC& aTitle, 
+        const TDesC& aArtist )
+    
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::TrackInfoChanged <---");
+    if (iActive)
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::TrackInfoChanged updating track info");
+        TRAP_IGNORE(DoUpdateTrackInfoL(aTitle, aArtist));
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::TrackInfoChanged --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::PlaybackPositionChanged( TInt aPosition )
+    {
+    TRAP_IGNORE( DoUpdatePlaybackPositionL( aPosition ) );
+    }
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+// 
+void CMCPMusicPlayer::AlbumArtChanged( CFbsBitmap* aBitmap )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::AlbumArtChanged <---");
+    if (!iActive)
+        {
+        iCachedArtBitmap = aBitmap;
+        iArtCached = ETrue;
+        }
+    else
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::AlbumArtChanged updating album art");
+        TRAP_IGNORE( DoUpdateAlbumArtL( aBitmap ) );
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::AlbumArtChanged --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::Opening()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::Opening <---");
+    TRAP_IGNORE( DoHandleOpeningL() );
+    MPX_DEBUG1("CMCPMusicPlayer::Opening --->");
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::PlaylisIsEmpty()
+    {
+    //TRAP_IGNORE( DoHandlePlaylisIsEmptyL() );
+    }
+// ---------------------------------------------------------------------------
+// From MAiPlayerPluginEngineObserver
+// ---------------------------------------------------------------------------
+//  
+void CMCPMusicPlayer::HandleFileRemovedL()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::HandleFileRemovedL <---");
+    iActive = EFalse;
+    ResetL();
+    MPX_DEBUG1("CMCPMusicPlayer::HandleFileRemovedL --->");
+    }
+
+
+// ---------------------------------------------------------------------------
+// From MApplicationMonitorObserver
+// ---------------------------------------------------------------------------
+// 
+void CMCPMusicPlayer::HandleApplicationClosedL(TExitType aReason)
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL <---");
+    if (aReason == EExitPanic)
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL panic");
+        iActive = EFalse;
+        ResetL();
+        }
+    else
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL normal close");
+        UpdateToolBarL( TBK::KSkeep_L_dimmed |
+                TBK::KPlay_last_played |
+                TBK::KSkeep_R_dimmed );
+        if (IsOKToPublishData() )
+            {
+            iMHObserver->PublishTextL( this, EMusicWidgetDefaultText, KEmpty );
+            InstallGoToLastPlayedL(EMusicMenuMusicInfoTrigger, EFalse);       
+            iMHObserver->PublishTextL(this, EMusicMenuMusicInfoLine1,
+                                KLastPlayed);     
+            DoUpdateTrackInfoL(iEngine->TitleL(), iEngine->Artist());
+            DoUpdateAlbumArtL(iArtCached ? iCachedArtBitmap : iArtBitmap);
+            }
+        if ( iAppMonitor )
+            {
+            MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL deliting app monitor");
+            delete iAppMonitor;
+            iAppMonitor = NULL;
+            }
+        
+        iActive = EFalse;
+        //in case the app closed before the info was updated.
+        if (iEngine->TitleL() == KNullDesC)
+            {
+            MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL there is no title - resetting");
+            ResetL();
+            }
+        }
+    MPX_DEBUG1("CMCPMusicPlayer::HandleApplicationClosedL --->");
+    }
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection messages.
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::HandleCollectionMessage( CMPXMessage* aMsg, TInt aErr )
+    {
+    MPX_DEBUG1("--->CMCPMusicPlayer::HandleCollectionMessage()");
+    if ( aErr == KErrNone && aMsg )
+        {
+        TRAP_IGNORE( HandleCollectionMessageL( aMsg ));
+        }
+    MPX_DEBUG1("<---CMCPMusicPlayer::HandleCollectionMessage()");
+    }
+// ---------------------------------------------------------------------------
+// Handle collection messages.
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::HandleCollectionMessageL( CMPXMessage* aMsg )
+    {
+    MPX_DEBUG1("--->CMCPMusicPlayer::HandleCollectionMessageL()");
+    TMPXMessageId messageId = aMsg->ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId );
+    if ( messageId == KMPXMessageGeneral )
+        {
+        DoHandleGeneralMessageL( *aMsg );
+        }
+    MPX_DEBUG1("<---CMCPMusicPlayer::HandleCollectionMessageL()");
+    }
+// ---------------------------------------------------------------------------
+// Handle collection general message.
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::DoHandleGeneralMessageL(const CMPXMessage& aMsg)
+    {
+    TInt event = aMsg.ValueTObjectL<TInt> ( KMPXMessageGeneralEvent );
+    TInt type = aMsg.ValueTObjectL<TInt> ( KMPXMessageGeneralType );
+    MPX_DEBUG3("--->CMCPMusicPlayer::DoHandleGeneralMessageL(), event = %d, type = %d", event, type);
+
+    if ( event == TMPXCollectionMessage::EBroadcastEvent
+        && ( type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart ))
+        {
+        iUSBOnGoing = ETrue;
+        MPX_DEBUG2("CMCPMusicPlayer::DoHandleGeneralMessageL(), iUSBOnGoing changed to: %d", iUSBOnGoing );
+        UpdateToolBarL( TBK::KSkeep_L_dimmed |
+                TBK::KPlay_dimmed |
+                TBK::KSkeep_R_dimmed );
+        if ( IsOKToPublishData() )
+            {
+            InstallGoToAlbumL(EMusicMenuMusicInfoTrigger);
+            }
+        }
+    else if ( event == TMPXCollectionMessage::EBroadcastEvent
+            && ( type == EMcMsgUSBMassStorageEnd || type == EMcMsgUSBMTPEnd ))
+        {
+        iUSBOnGoing = EFalse;
+        MPX_DEBUG2("CMCPMusicPlayer::DoHandleGeneralMessageL(), iUSBOnGoing changed to: %d", iUSBOnGoing );
+        DoUpdatePlayerStateL( iEngine->PlayerState() );
+        if ( IsOKToPublishData() )
+            {
+            iMHObserver->PublishTextL( this, EMusicWidgetDefaultText,
+                    KEmpty );
+            InstallGoToLastPlayedL( EMusicMenuMusicInfoTrigger, ETrue );
+            iMHObserver->PublishTextL( this, EMusicMenuMusicInfoLine1,
+                    KLastPlayed );
+            DoUpdateTrackInfoL( iEngine->TitleL(), iEngine->Artist() );
+            DoUpdateAlbumArtL( iArtCached ? iCachedArtBitmap : iArtBitmap );
+            }
+        }
+    MPX_DEBUG3("<---CMCPMusicPlayer::DoHandleGeneralMessageL(), event = %d, type = %d", event, type);
+    }
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ---------------------------------------------------------------------------  
+//
+void CMCPMusicPlayer::HandleOpenL( const CMPXMedia& /*aEntries*/,
+        TInt /*aIndex*/, TBool /*aComplete*/, TInt /*aError*/ )
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// ---------------------------------------------------------------------------
+//
+void CMCPMusicPlayer::HandleOpenL( const CMPXCollectionPlaylist& /*aPlaylist*/,
+        TInt /*aError*/ )
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionMediaObserver
+// ---------------------------------------------------------------------------
+void CMCPMusicPlayer::HandleCollectionMediaL( const CMPXMedia& /*aMedia*/, TInt /*aError*/ )
+    {
+    // Do nothing
+    }
+
+// ---------------------------------------------------------------------------
+// From MPNSMonitorObserver
+// ---------------------------------------------------------------------------
+// 
+void CMCPMusicPlayer::OpeningMusicPlayer()
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::OpeningMusicPlayer <---");
+    // in this position, iActive is EFalse, so we can not call function
+    // DoHandleOpeningL() directly.
+    TRAP_IGNORE( 
+            iMHObserver->PublishTextL( this,
+                    EMusicWidgetText1,
+                    iOpeningBuffer->Des() ) );
+    
+    TCallBack cb( MusicPlayerOpeningTimerCallback, this );
+    iMusicPlayerOpeningTimer->Cancel();
+    iMusicPlayerOpeningTimer->Start( KMusicPlayerOpeningTimerInterval,
+            KMusicPlayerOpeningTimerInterval, cb );
+
+    MPX_DEBUG1("CMCPMusicPlayer::OpeningMusicPlayer --->");
+    }
+
+// ----------------------------------------------------------------------------
+// Music Player opening timer callback
+// ----------------------------------------------------------------------------
+//
+TInt CMCPMusicPlayer::MusicPlayerOpeningTimerCallback( TAny* aPtr )
+    {
+    MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback <---");
+    RWsSession wsSession;
+    TInt error = wsSession.Connect();
+    if ( error != KErrNone )
+        {
+        return error;
+        }
+    
+    TBool taskExists( EFalse );
+    CAknTaskList* taskList( NULL );
+    TRAPD( err, taskList = CAknTaskList::NewL( wsSession ) );
+    if ( err == KErrNone )
+        {
+        MPX_DEBUG2("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback "
+                "error = %d occur when creating CAknTaskList", err);
+        TApaTask task = taskList->FindRootApp( TUid::Uid( KMusicPlayerAppUidAsTInt ) );
+        delete taskList;
+        taskExists = task.Exists();
+        }
+    wsSession.Close();
+    
+    if ( !taskExists )
+        {
+        MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback Music Player not opened");
+        //Reset the widget and menu, music player is not running
+        TRAP_IGNORE( static_cast<CMCPMusicPlayer*>(aPtr)->ResetL() );
+        }
+    static_cast<CMCPMusicPlayer*>(aPtr)->iMusicPlayerOpeningTimer->Cancel();
+    
+    MPX_DEBUG1("CMCPMusicPlayer::MusicPlayerOpeningTimerCallback --->");
+    return KErrNone;
+    }
+ //  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/src/pnsmonitor.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Monitors the file system for changes in a file.
+*
+*/
+
+
+#include <mpxlog.h>
+#include <mpxconstants.h>
+
+#include "pnsmonitor.h"
+#include "pnsmonitorobserver.h"
+
+// RProperty key to identify the case when Music Player launching
+// in the background
+const TInt KMPXLaunchingOnBackground( 100 );
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CPNSMonitor::CPNSMonitor( MPNSMonitorObserver& aObserver )
+        : CActive( CActive::EPriorityLow ),
+        iObserver( aObserver )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Second Phase Constructor
+// ---------------------------------------------------------------------------
+//
+void CPNSMonitor::ConstructL()
+    {
+    User::LeaveIfError( iPropertyHandler.Attach( KAppUidMusicPlayerX,
+            KMPXLaunchingOnBackground ) );
+    CActiveScheduler::Add( this );
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor
+// ---------------------------------------------------------------------------
+//
+CPNSMonitor* CPNSMonitor::NewL( MPNSMonitorObserver& aObserver )
+    {
+    CPNSMonitor* self = new( ELeave ) CPNSMonitor( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CPNSMonitor::~CPNSMonitor()
+    {
+    Cancel();
+    iPropertyHandler.Close();
+    }
+
+// ---------------------------------------------------------------------------
+// Starts monitoring
+// ---------------------------------------------------------------------------
+//
+void CPNSMonitor::Start()
+    {
+    MPX_DEBUG1("CPNSMonitor::Start <---");
+    iPropertyHandler.Subscribe( iStatus );
+    SetActive();
+    MPX_DEBUG1("CPNSMonitor::Start --->");
+    }
+
+// ---------------------------------------------------------------------------
+// RunL callback
+// ---------------------------------------------------------------------------
+//
+void CPNSMonitor::RunL()
+    {
+    MPX_DEBUG1("CPNSMonitor::RunL <---");
+    TInt ret( 0 );
+    TInt err = RProperty::Get( KAppUidMusicPlayerX,
+                KMPXLaunchingOnBackground,
+                ret );
+
+    if ( ret )
+        {
+        iObserver.OpeningMusicPlayer();
+        MPX_DEBUG1("CPNSMonitor::RunL - Opening Music Player on the background");
+        }
+    
+	// Listen again
+    Start();
+    
+    MPX_DEBUG1("CPNSMonitor::RunL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Handle Cancelling
+// ---------------------------------------------------------------------------
+//
+void CPNSMonitor::DoCancel()
+    {
+    MPX_DEBUG1("CPNSMonitor::DoCancel <---");
+    // Stop monitoring
+    iPropertyHandler.Cancel();
+    MPX_DEBUG1("CPNSMonitor::DoCancel --->");
+    }
+
+// ----------------------------------------------------------------------------
+// Handles a leave occurring in the request completion event handler RunL()
+// ----------------------------------------------------------------------------
+//
+TInt CPNSMonitor::RunError( TInt aError )
+    {
+    MPX_DEBUG2("CPNSMonitor::RunError(%d)", aError );
+   
+    // Listen again
+    Start();
+    return KErrNone;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mcpmusicplayer/src/proxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player MCP Plugin Implementation Proxy
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "mcpmusicplayer.h"
+#include "mcpmusicplayeruids.hrh"
+
+// ---------------------------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KMCPMusicPlayerUID,
+            CMCPMusicPlayer::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// Exported proxy for instantiation method resolution
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+        TInt& aTableCount )
+    {
+    aTableCount =
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+
+    return ImplementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mpxcollectionpublisher/data/mpxcollectionpublisher.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM registration for Music Content Publisher
+*
+*/
+
+
+#include <registryinfo.rh>
+#include <contentharvesterpluginuids.hrh>
+#include "mpxcollectionpublisheruids.hrh"
+
+// ---------------------------------------------------------------------------
+// MpxCollectionPublisherPluginInfo
+// Declares info for implementation of the plugin
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO MpxCollectionPublisherPluginInfo
+    {
+    // UID for the DLL
+    dll_uid = KMpxCollectionPublisherDLL;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = KContentHarvesterPluginUid;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMpxCollectionPublisherUID; 
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mpxcollectionpublisher/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Music Content Publisher.
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/mpxcollectionpublisher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(mpxcollectionpublisher.iby)
+
+PRJ_MMPFILES
+mpxcollectionpublisher.mmp
+
+PRJ_TESTMMPFILES
+PRJ_TESTEXPORTS
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mpxcollectionpublisher/group/mpxcollectionpublisher.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,56 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for Music Content Publisher.
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include "../inc/mpxcollectionpublisheruids.hrh"
+
+TARGET                  mpxcollectionpublisher.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D KMpxCollectionPublisherDLL
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  proxy.cpp
+SOURCE                  mpxcollectionpublisher.cpp
+
+USERINCLUDE             ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+USERINCLUDE             ../../inc
+
+SOURCEPATH              ../data
+START RESOURCE          mpxcollectionpublisher.rss 
+HEADER
+TARGET                  mpxcollectionpublisher.rsc
+TARGETPATH              resource/plugins 
+END
+
+LIBRARY                 ecom.lib
+LIBRARY                 euser.lib
+LIBRARY                 liwservicehandler.lib     // TLiwVariant
+LIBRARY                 mpxcollectionutility.lib
+LIBRARY                 mpxcommon.lib
+LIBRARY                 mpxcollectionhelper.lib  
+
+//  End of File
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mpxcollectionpublisher/inc/mpxcollectionpublisher.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages MCP plugins, and content publishing.
+*
+*/
+
+
+#ifndef C_MUSICCONTENTPUBLISHER_H
+#define C_MUSICCONTENTPUBLISHER_H 
+
+#include <contentharvesterplugin.h>
+#include <mpxcollectionobserver.h>
+
+class MLiwInterface;
+class CLiwGenericParamList;
+
+// FORWARD DECLARATIONS
+class MMPXCollectionUtility;
+class MMPXCollectionUiHelper;
+class CMPXCollectionPath;
+
+/**
+ *  Music Content Publisher (a Content Harvester plugin)
+ *
+ *  @lib musiccontentpublisher.dll
+ *  @since S60 S60 v5.0
+ */
+class CMpxCollectionPublisher : public CContentHarvesterPlugin
+                               ,public MMPXCollectionObserver
+    {
+
+public:
+
+    /**
+     * Two-phased constructor.
+     */
+    static CMpxCollectionPublisher* NewL( MLiwInterface* aCPSInterface );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CMpxCollectionPublisher();
+
+    // from base class CContentHarvesterPlugin
+    /**
+     * From CContentHarvesterPlugin
+     * This is called by the Content Harvester Server to signal an update. 
+     */
+    void UpdateL();
+    
+    //From Base class MMPXCollectionMediaObserver
+    /**
+     * From MMPXCollectionMediaObserver 
+     * It handles open collection event.
+     */
+    void HandleOpenL( const CMPXMedia& aEntries, TInt aIndex, 
+    		 TBool aComplete, TInt  aError );
+    
+    /**
+     * From MMPXCollectionMediaObserver 
+     * It handles open collection event.
+     */                
+    void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist,
+    		 TInt aError ); 
+    
+    /**
+     * From MMPXCollectionMediaObserver 
+     * It handles MediaL event.
+     *
+     * @param aMedia object containing collection's informations
+     * @param aError error code
+     */
+    void HandleCollectionMediaL( const CMPXMedia& aMedia,
+    		TInt aError );
+    
+    /** 
+    *  Handle collection message
+    * 
+    *  @param aMsg collection message, ownership not transferred. 
+    *         Please check aMsg is not NULL before using it. 
+    *         If aErr is not KErrNone, plugin might still call back with more
+    *         info in the aMsg.
+    *  @param aErr system error code.
+    */
+    void HandleCollectionMessage( CMPXMessage* aMsg, TInt /*aErr*/);
+        
+
+
+private:
+
+    /**
+     * Default constructor.
+     */
+    CMpxCollectionPublisher( MLiwInterface* aCPSInterface );
+
+    /**
+     * Perform the second phase construction 
+     */
+    void ConstructL();
+    
+    /**
+	 * Logic of HandleCollectionMessage, to avoid the function leaves
+	 */
+	void DoHandleGeneralMessageL(const CMPXMessage& aMsg);
+
+	/**
+	 * Logic of HandleCollectionMessage, to avoid the function leaves
+	 * it handles item change operation
+	 */
+	void DoHandleItemChangedMessageL(const CMPXMessage& aMsg);   
+    
+	/**
+	 * Logic of HandleCollectionMessageL, to avoid the function leaves
+	 */
+	void HandleCollectionMessageL(CMPXMessage* aMsg);  		
+	
+    /**
+     * Called when a number needs to be updated.
+	 *
+	 * @since S60 5.0
+	 * @param aNum containing the number.
+	 */
+	void PublishNumberL( const TInt aNumb );
+
+private: // data
+
+    /**
+     * Instance of CPS interface used for update with CPS.
+     * Not own
+     */
+    MLiwInterface* iCPSInterface;
+    
+    /**
+    * MPX Collection utility
+    * Own.
+    */
+    MMPXCollectionUtility* iCollectionUtility;
+    
+    /**
+    * MPX Collection helper
+    * Own.
+    */
+    MMPXCollectionUiHelper* iCollectionUiHelper;
+    
+    /**
+     * Path to Music collection
+     * Own.
+     */
+    CMPXCollectionPath* iAllSongsPath;
+
+	/**
+	* Indicates whether we're in a massive refresh operation
+	*/
+	TBool iRefreshOperation;
+	
+    /**
+    * Array containig wanted collection attributes
+    * Own.
+    */	    
+	RArray<TMPXAttribute> iDefaultAttrs;
+
+    };
+
+#endif // C_MUSICCONTENTPUBLISHER_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mpxcollectionpublisher/inc/mpxcollectionpublisheruids.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for Music Content Publisher
+*
+*/
+
+
+#ifndef MPXCOLLECTIONPUBLISHERUIDS_H_
+#define MPXCOLLECTIONPUBLISHERUIDS_H_
+
+/** Ecom implementation uid for Music Player Action Handler Plugin */
+#define KMpxCollectionPublisherUID 0x10207C1A
+
+/** Ecom dll uid for Music Player Action Handler Plugin */
+#define KMpxCollectionPublisherDLL 0x10207C1D
+
+#endif /*MPXCOLLECTIONPUBLISHERUIDS_H_*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mpxcollectionpublisher/rom/mpxcollectionpublisher.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Mpx Collection Publisher
+*
+*/
+
+
+#ifndef MPXCOLLECTIONPUBLISHER_IBY
+#define MPXCOLLECTIONPUBLISHER_IBY
+
+ECOM_PLUGIN(mpxcollectionpublisher.dll, mpxcollectionpublisher.rss)
+
+#endif // MPXCOLLECTIONPUBLISHER_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mpxcollectionpublisher/src/mpxcollectionpublisher.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,299 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages MCP plugins, and content publishing.
+*
+*/
+
+
+#include <liwservicehandler.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxmessagecontainerdefs.h>
+#include <mpxmediacollectiondetaildefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionpath.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionmessage.h>
+
+#include "cpglobals.h" //This will be moved to domain API (HSFW)
+#include "mpxcollectionpublisher.h"
+
+
+
+_LIT8( KMCPDataKey,"musicmenu_collectioninfo_numb1data" );
+_LIT( KMCPublisher, "MpxCollectionPublisher" );
+_LIT( KMCPType,"integer" );
+_LIT( KMCPContent,"musicmenu_collectioninfo_numb1" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMpxCollectionPublisher::CMpxCollectionPublisher(
+        MLiwInterface* aCPSInterface ) : iRefreshOperation( EFalse )
+	{
+	iCPSInterface = aCPSInterface;
+
+	}
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMpxCollectionPublisher::ConstructL()
+    {
+    iDefaultAttrs.Append( KMPXMediaColDetailNumberOfItems );
+    iCollectionUiHelper = 
+            CMPXCollectionHelperFactory:: NewCollectionUiHelperL();      
+	iCollectionUtility = 
+	        MMPXCollectionUtility::NewL( this, KMcModeIsolated );
+    
+	TUid collection = KLocalCollection;
+	collection = iCollectionUtility->
+                    Collection().CollectionIDL( collection );
+    iCollectionUtility->Collection().CommandL( EMcCmdCollectionInit, 
+                                               collection.iUid );
+	//music
+    iAllSongsPath = iCollectionUiHelper->MusicAllSongsPathL();
+    iCollectionUtility->Collection().CancelRequest();
+    iCollectionUtility->Collection().MediaL( *iAllSongsPath , 
+    	        iDefaultAttrs.Array());
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMpxCollectionPublisher* CMpxCollectionPublisher::NewL(  
+        MLiwInterface* aCPSInterface )
+    {
+    CMpxCollectionPublisher* self = 
+            new ( ELeave ) CMpxCollectionPublisher( aCPSInterface );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMpxCollectionPublisher::~CMpxCollectionPublisher()
+    {
+    if ( iCollectionUiHelper )
+		{
+		iCollectionUiHelper->Close();
+		}
+
+	if ( iCollectionUtility )
+		{
+		iCollectionUtility->Close();
+		}
+	iDefaultAttrs.Close();
+	delete iAllSongsPath;
+    }
+
+  
+void CMpxCollectionPublisher::UpdateL() 
+    {
+
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// empty
+// ---------------------------------------------------------------------------
+// 	    
+void CMpxCollectionPublisher::HandleOpenL( const CMPXMedia& /* aMedia */,
+            TInt /* aIndex */,
+    		TBool /* aComplete */,TInt /* aError */  )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// empty
+// ---------------------------------------------------------------------------
+//     					
+void CMpxCollectionPublisher::HandleOpenL( 
+            const CMPXCollectionPlaylist& /* aPlaylist */, 
+            TInt /* aError */)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handles MediaL
+// ---------------------------------------------------------------------------
+// 
+void CMpxCollectionPublisher::HandleCollectionMediaL( const CMPXMedia& aMedia,
+		TInt aError )
+	{
+	if (KErrNone == aError && 
+	        aMedia.IsSupported( KMPXMediaColDetailNumberOfItems ) )
+		{
+		TInt numberOfSongs = 
+		       aMedia.ValueTObjectL<TBool>( KMPXMediaColDetailNumberOfItems );
+        PublishNumberL( numberOfSongs );
+		}
+	}
+
+// ---------------------------------------------------------------------------
+// Handle collection messages.
+// ---------------------------------------------------------------------------
+//
+void CMpxCollectionPublisher::HandleCollectionMessageL( CMPXMessage* aMsg )
+    {       
+    TMPXMessageId messageId = 
+            aMsg->ValueTObjectL<TMPXMessageId>( KMPXMessageGeneralId );
+    if ( messageId == KMPXMessageGeneral )        
+        {          
+        DoHandleGeneralMessageL( *aMsg );   
+        } 
+    else if( messageId == KMPXMessageIdItemChanged )
+        {
+        // Loop through messages for arrays.
+        //
+        if ( aMsg->IsSupported( KMPXMessageArrayContents ) )
+            {
+			CMPXMessageArray* messageArray =
+                    aMsg->Value<CMPXMessageArray>( KMPXMessageArrayContents );
+							
+            User::LeaveIfNull( messageArray ); 
+            for( TInt i=0; i<messageArray->Count(); ++i )
+                {
+                HandleCollectionMessage( (*messageArray)[i], KErrNone);  
+                } 
+            }            
+        else // Single item
+            {                
+            DoHandleItemChangedMessageL( *aMsg ) ;                
+            }                
+        }                     
+    }     
+
+// ---------------------------------------------------------------------------
+// From MMPXCollectionObserver
+// Handle collection messages.
+// ---------------------------------------------------------------------------
+//
+void CMpxCollectionPublisher::HandleCollectionMessage( CMPXMessage* aMsg, 
+                                                  TInt aError )
+    {
+	if ( aError == KErrNone && aMsg )
+		{
+        TRAP_IGNORE( HandleCollectionMessageL( aMsg ) );
+        }
+    }  
+
+// ---------------------------------------------------------------------------
+// Handle item change message.
+// ---------------------------------------------------------------------------
+//
+void CMpxCollectionPublisher::DoHandleItemChangedMessageL( 
+                                                    const  CMPXMessage& aMsg )
+    {
+    TMPXChangeEventType eventType( 
+            aMsg.ValueTObjectL<TMPXChangeEventType>( 
+                        KMPXMessageChangeEventType ) );
+    TMPXItemId itemId( 
+            aMsg.ValueTObjectL<TMPXItemId>(KMPXMessageMediaGeneralId ) );
+  
+    if ( !iRefreshOperation && 
+          ( eventType == EMPXItemDeleted || eventType == EMPXItemInserted ) ) 
+        { 
+        //everytime an item is changed we need to refresh data
+        iCollectionUtility->Collection().CancelRequest();
+        iCollectionUtility->Collection().MediaL( *iAllSongsPath , 
+        	        iDefaultAttrs.Array() );
+        }                           
+        
+    } 
+
+// ---------------------------------------------------------------------------
+// Handle collection general message.
+// ---------------------------------------------------------------------------
+//
+void CMpxCollectionPublisher::DoHandleGeneralMessageL(  
+        const CMPXMessage& aMsg )
+    {
+    TInt event = aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralEvent );
+    TInt type = aMsg.ValueTObjectL<TInt>( KMPXMessageGeneralType ); 
+    
+      
+    if ( event == TMPXCollectionMessage::EBroadcastEvent && 
+         ( type == EMcMsgRefreshStart || type == EMcMsgFormatStart ||             
+          type == EMcMsgUSBMassStorageStart || type == EMcMsgUSBMTPStart )         
+         )
+        {
+        //if refresh operation starts we block until refresh ends
+        iRefreshOperation = ETrue;
+        iCollectionUtility->Collection().CancelRequest(); 
+        }
+    else if ( event == TMPXCollectionMessage::EBroadcastEvent && 
+              ( type == EMcMsgRefreshEnd || type == EMcMsgFormatEnd ||
+               type == EMcMsgDiskRemoved || type == EMcMsgDiskInserted ||
+               type == EMcMsgUSBMassStorageEnd || type == EMcMsgUSBMTPEnd )
+            )
+        {
+        iRefreshOperation = EFalse;
+        iCollectionUtility->Collection().CancelRequest();
+        iCollectionUtility->Collection().MediaL( *iAllSongsPath , 
+        	        iDefaultAttrs.Array() );
+        }                       
+    }       
+
+// ---------------------------------------------------------------------------
+// Publishes a number to the required destination
+// ---------------------------------------------------------------------------
+//
+
+void CMpxCollectionPublisher::PublishNumberL( const TInt aNumb )
+	{
+	if ( iCPSInterface )
+		{
+		CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
+		CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+
+		TLiwGenericParam cptype( KType, TLiwVariant( KCpData ) );
+		inParam->AppendL( cptype );
+		CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC();
+		CLiwDefaultMap * map = CLiwDefaultMap::NewLC();
+
+		map->InsertL( KMCPDataKey, TLiwVariant( TInt32( aNumb ) ) );
+
+		cpdatamap->InsertL( KPublisherId, TLiwVariant( KMCPublisher ) );
+		cpdatamap->InsertL( KContentType, TLiwVariant( KMCPType ) );
+		cpdatamap->InsertL( KContentId, TLiwVariant( KMCPContent ) );
+		cpdatamap->InsertL( KDataMap, TLiwVariant( map ) );
+
+		TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) );
+		inParam->AppendL( item );
+
+		iCPSInterface->ExecuteCmdL( KAdd, *inParam, *outParam );
+
+		CleanupStack::PopAndDestroy( map );
+		CleanupStack::PopAndDestroy( cpdatamap );
+		CleanupStack::PopAndDestroy( outParam );
+		CleanupStack::PopAndDestroy( inParam );
+		}
+	}
+
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/mpxcollectionpublisher/src/proxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Content Publisher Implementation Proxy
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "mpxcollectionpublisher.h"
+#include "mpxcollectionpublisheruids.hrh"
+
+// ---------------------------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KMpxCollectionPublisherUID,
+            CMpxCollectionPublisher::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// Exported proxy for instantiation method resolution
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+        TInt& aTableCount )
+    {
+    aTableCount =
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+
+    return ImplementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/data/musiccontentpublisher.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM registration for Music Content Publisher
+*
+*/
+
+
+#include <registryinfo.rh>
+#include <contentharvesterpluginuids.hrh>
+#include "musiccontentpublisheruids.hrh"
+
+// ---------------------------------------------------------------------------
+// MCPPluginInfo
+// Declares info for implementation of the plugin
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO MCPPluginInfo
+    {
+    // UID for the DLL
+    dll_uid = KMusicContentPublisherDLL;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = KContentHarvesterPluginUid;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMusicContentPublisherUID; 
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Music Content Publisher.
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/musiccontentpublisher.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musiccontentpublisher.iby)
+
+PRJ_MMPFILES
+musiccontentpublisher.mmp
+
+PRJ_TESTMMPFILES
+PRJ_TESTEXPORTS
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/group/musiccontentpublisher.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for Music Content Publisher.
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include "../inc/musiccontentpublisheruids.hrh"
+
+TARGET                  musiccontentpublisher.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D KMusicContentPublisherDLL
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  musiccontentpublisher.cpp
+SOURCE                  proxy.cpp
+SOURCE                  pluginmanager.cpp
+SOURCE                  mcpharvesterpublisherobserver.cpp
+USERINCLUDE             ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+USERINCLUDE             ../../inc
+
+SOURCEPATH              ../data
+START RESOURCE          musiccontentpublisher.rss 
+HEADER
+TARGET                  musiccontentpublisher.rsc
+TARGETPATH              resource/plugins 
+END
+
+LIBRARY                 ecom.lib
+LIBRARY                 euser.lib
+LIBRARY                 liwservicehandler.lib   // TLiwVariant
+LIBRARY                 fbscli.lib
+LIBRARY                 aknskins.lib
+LIBRARY                 cone.lib
+LIBRARY                 aknicon.lib
+LIBRARY                 aknskinsrv.lib
+LIBRARY                 efsrv.lib
+LIBRARY                 bafl.lib
+LIBRARY                 estor.lib
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/inc/mcpharvesterpublisherobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Updates applications and icons in Operator Tile.
+*
+*/
+
+
+#ifndef C_MCPHARVESTERPUBLISHEROBSERVER_H
+#define C_MCPHARVESTERPUBLISHEROBSERVER_H 
+
+#include <e32base.h>
+#include <liwcommon.h>
+
+// FORWARD DECLARATIONS
+class CMusicContentPublisher;
+class CLiwServiceHandler;
+// CONSTANTS
+
+// CLASS DECLARATION
+/**
+ */
+
+class CMCPHarvesterPublisherObserver : public CBase, public MLiwNotifyCallback
+	{
+	public: // Constructors and destructor
+		/**
+		 * Two-phased constructor.
+		 */
+		static CMCPHarvesterPublisherObserver* NewL( CMusicContentPublisher* aHarvester );
+
+		/**
+		 * Two-phased constructor.
+		 */
+		static CMCPHarvesterPublisherObserver* NewLC( CMusicContentPublisher* aHarvester );
+		
+		/**
+		 * Destructor.
+		 */
+		virtual ~CMCPHarvesterPublisherObserver();
+
+
+
+	public:  //from MLiwNotifyCallback
+	    
+	    /**
+	    * Handles notifications caused by an asynchronous Execute*CmdL call
+	    * or an event.
+	    *
+	    * @param aCmdId The service command associated to the event.
+	    * @param aEventId Occured event, see LiwCommon.hrh.
+	    * @param aEventParamList Event parameters, if any, as defined per
+	    *        each event.
+	    * @param aInParamList Input parameters, if any, given in the
+	    *        related HandleCommmandL.
+	    * @return Error code for the callback.
+	    */
+	    virtual TInt HandleNotifyL(
+	        TInt aCmdId,
+	        TInt aEventId,
+	        CLiwGenericParamList& aEventParamList,
+	        const CLiwGenericParamList& aInParamList);
+	
+	public:
+	    
+	    /**
+	    * Registers to CPS for add, delete , update and execute notifications
+	    * @aFilter - filter for input parameter list
+	    * @return void.
+	    */
+	    void RegisterL( CLiwDefaultMap* aFilter );
+	    
+	    
+	private:
+	    /**
+        * Perform the second phase construction 
+        */      
+        void ConstructL();
+        
+        /**
+		* Default constructor.
+		*/
+		CMCPHarvesterPublisherObserver( CMusicContentPublisher* aHarvester );
+		
+		// Prhohibited
+		CMCPHarvesterPublisherObserver();
+
+	 
+	    void InitLiwL();
+	    
+	    void ReleaseLiw();
+		
+	private: // data
+	        
+	    // Reference of 
+	    // Owned
+	    MLiwInterface* iInterface;
+	    
+	    // Reference of 
+	    // Owned
+	    CLiwServiceHandler* iLiwHandler;	            
+	            
+	    // Reference of the sapi data
+	    // Not owned
+	    CMusicContentPublisher* iHarvester;
+	    
+	    // Call back error code
+	    TInt iError;
+    };
+
+#endif // C_MCPHARVESTERPUBLISHEROBSERVER_H 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/inc/musiccontentpublisher.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,414 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages MCP plugins, and content publishing.
+*
+*/
+
+
+#ifndef C_MUSICCONTENTPUBLISHER_H
+#define C_MUSICCONTENTPUBLISHER_H 
+
+#include <contentharvesterplugin.h>
+#include <mcppluginobserver.h>
+#include <libc/stddef.h>  // For wchar_t
+#include <e32hashtab.h>
+#include <AknsSrvClient.h>
+
+class MLiwInterface;
+class CLiwGenericParamList;
+class CPluginManager;
+class CFbsBitmap;
+class CCoeEnv;
+class TAknsItemID;
+class CMCPHarvesterPublisherObserver;
+
+
+struct TMCPDestinationItem
+    {
+    const TInt id;
+    const wchar_t* type;
+    const char* dataKey;
+    const wchar_t* content;
+    };
+
+struct TMCPImageDestinationInfoItem
+    {
+    const TMCPImageDestination id;
+    const TInt sizex;
+    const TInt sizey;
+    };
+
+
+struct TBmpMsk
+    {
+    CFbsBitmap *bitmap;
+    CFbsBitmap *mask;
+    };
+
+struct TMyBufferItem
+    {
+    TAny* buf;
+    TInt size;
+    };
+
+
+const TMCPDestinationItem KMCPDestinationInfo[] =
+    {
+     { EMusicWidgetImage1,      L"area1_image1", "area1_image1_data",       L"*" }
+    ,{ EMusicWidgetText1,       L"area2_text1",  "area2_text1_data",        L"*" }
+    ,{ EMusicWidgetToolbarB1,   L"toolbar_b1", "toolbar_b1_data",         L"*" }
+    ,{ EMusicWidgetToolbarB2,   L"toolbar_b2", "toolbar_b2_data",         L"*" }
+    ,{ EMusicWidgetToolbarB3,   L"toolbar_b3", "toolbar_b3_data",         L"*" }
+    ,{ EMusicWidgetDefaultText, L"default_text",  "default_text_data",       L"*" }
+    
+    ,{ EMusicWidgetTrigger1,    L"area1_image1", "MWTrigger1",  L"*" }
+    ,{ EMusicWidgetTrigger2,    L"default_text",  "MWTrigger2", L"*" }
+    ,{ EMusicWidgetTB1Trigger,  L"toolbar_b1", "TB1Trigger",    L"*" }
+    ,{ EMusicWidgetTB2Trigger,  L"toolbar_b2", "TB2Trigger",    L"*" }
+    ,{ EMusicWidgetTB3Trigger,  L"toolbar_b3", "TB3Trigger",    L"*" }
+            
+    ,{ EMusicMenuMusicInfoImage1,   L"image",  "musicmenu_musicinfo_imagedata", L"musicmenu_musicinfo_image" }
+    ,{ EMusicMenuMusicInfoLine1,        L"text",   "musicmenu_musicinfo_text1data",  L"musicmenu_musicinfo_text1" }
+    ,{ EMusicMenuMusicInfoLine2,        L"text",   "musicmenu_musicinfo_text2data",  L"musicmenu_musicinfo_text2" }
+    ,{ EMusicMenuMusicInfoTrigger, L"text",   "MMInfoTrigger",  L"musicmenu_musicinfo_text1" }
+    };
+
+
+const TMCPImageDestinationInfoItem KMCPImageDestinationInfo[] =
+
+    {
+        {EMusicWidgetImage1, 70,70}
+    ,
+        {EMusicWidgetToolbarB1, 41,41}
+    ,
+        {EMusicWidgetToolbarB2, 41,41}
+    ,
+        {EMusicWidgetToolbarB3, 41,41}
+    ,
+        {EMusicMenuMusicInfoImage1, 70,70} 
+    };
+
+/**
+ *  Music Content Publisher (a Content Harvester plugin)
+ *
+ *  @lib musiccontentpublisher.dll
+ *  @since S60 S60 v5.0
+ */
+class CMusicContentPublisher : public CContentHarvesterPlugin
+                       ,public MMCPPluginObserver
+                       ,public MAknsSkinChangeObserver
+    {
+
+public:
+
+// from base class MMCPPluginObserver
+    /**
+     * from MMCPPluginObserver
+     * Called when an image needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the image is to be placed.
+     * @param aImagePath Source path of the Image.
+     */
+    void PublishImageL(CMCPPlugin* aPlugin,
+            TMCPImageDestination aDestination, const TDesC& aImagePath);
+
+    /**
+     * from MMCPPluginObserver
+     * Called when an image needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the image is to be placed.
+     * @param aBitmapHandle Bitmap handle to the image.
+     * @param aMaskBitmapHandle Mask Bitmap handle for the image.
+     */
+    void PublishImageL(CMCPPlugin* aPlugin, 
+            TMCPImageDestination aDestination,
+            TInt aBitmapHandle,
+            TInt aMaskBitmapHandle = NULL);
+    
+    /**
+     * from MMCPPluginObserver
+     * Called when an image needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the image is to be placed.
+     * @param aID major and minor Skin ID info.
+     * @param aFilename fallback mif/mbm file.
+     * @param aFileBitmapId bitmap id within the fallback file.
+     * @param aFileMaskId mask id within the fallback file.
+     */
+    void PublishImageL(CMCPPlugin* aPlugin, 
+            TMCPImageDestination aDestination,
+            const TAknsItemID& aID,
+            const TDesC& aFilename,
+            const TInt aFileBitmapId,
+            const TInt aFileMaskId );
+
+    /**
+     * from MMCPPluginObserver
+     * Called when a text needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the text is to be placed.
+     * @param aText Descriptor containing the text.
+     */
+    void PublishTextL( CMCPPlugin* aPlugin, 
+            TMCPTextDestination aDestination, const TDesC& aText );
+
+    /**
+     * from MMCPPluginObserver
+     * Called when an action needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Destination trigger that should launch the action.
+     * @param aTrigerMap LIW Map containint the action that can be interpreted
+     * by the specified action handler plugin.
+     */
+    void PublishActionL( CMCPPlugin* aPlugin, 
+            TMCPTriggerDestination aDestination, 
+            CLiwDefaultMap* aTrigerMap );
+    
+    /**
+     * from MMCPPluginObserver
+     * Called when a plugin becomes active.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     */
+    void BecameActiveL( CMCPPlugin* aPlugin );
+    
+    /**
+     * from MMCPPluginObserver
+     * Called when a plugin becomes active.
+     *
+     * @since S60 5.0
+     * @param aDst The image destination.
+     * @return The size of the image destination.
+     */
+    TSize GetImageDestinationSize(TMCPImageDestination aDst);
+    
+    /**
+     * From MAknsSkinChangeObserver.
+     * Called by the skin server when skin content is changed and the
+     * connected client wants to be informed.
+     *
+     * @since 2.0
+     */
+    void SkinContentChanged();
+
+    /**
+     * From MAknsSkinChangeObserver.
+     * Called by the skin server to indicate that the current skin
+     * configuration has changed.
+     *
+     * @param aReason Reason code.
+     *
+     * @since 2.5
+     */
+    void SkinConfigurationChanged(
+            const TAknsSkinStatusConfigurationChangeReason /*aReason*/){};
+
+    /**
+     * From MAknsSkinChangeObserver.
+     * Called by the skin server to indicate that the available
+     * skin packages have changed.
+     *
+     * @param aReason Reason code.
+     *
+     * @since 2.5
+     */
+    void SkinPackageChanged(const TAknsSkinStatusPackageChangeReason /*aReason*/){};
+
+    void HandlePublisherNotificationL( const TDesC& aContentId, const TDesC8& aTrigger );
+    /**
+     * Two-phased constructor.
+     */
+    static CMusicContentPublisher* NewL( MLiwInterface* aCPSInterface );
+
+
+
+    // from base class CContentHarvesterPlugin
+    /**
+     * From CContentHarvesterPlugin
+     * This is called by the Content Harvester Server to signal an update. 
+     */
+    void UpdateL();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CMusicContentPublisher();
+    
+    /**
+     * Resets the destinations with default values and removes active plugin.
+     */
+    void ResetL();
+
+private:
+
+    /**
+     * Default constructor.
+     */
+    CMusicContentPublisher( MLiwInterface* aCPSInterface );
+
+    /**
+     * Perform the second phase construction 
+     */
+    void ConstructL();
+    
+    /**
+     * Installs an action, mainly for readability purposes.
+     *
+     * @since S60 5.0
+     * @param aDestination Destination trigger that should launch the action.
+     */
+    void InstallGoToMusicL(TMCPTriggerDestination aDestination);
+    
+    /**
+     * Installs an action, mainly for readability purposes.
+     *
+     * @since S60 5.0
+     * @param aDestination Destination trigger that should launch the action.
+     */
+    void InstallGoToAlbumL(TMCPTriggerDestination aDestination);
+    
+    /**
+     * Installs an rmpty action, mainly for readability purposes.
+     *
+     * @since S60 5.0
+     * @param aDestination Destination trigger that should launch the action.
+     */
+    void InstallEmptyActionL(TMCPTriggerDestination aDestination);
+    
+    
+    /**
+     * Maps an enum from TMCPImageDestination, TMCPTextDestination and 
+     * TMCPTriggerDestination to it's keys on CPS.
+     * @param aEnum the enum/destination
+     * @param aType the type key is loaded here
+     * @param aDataKey the data key is loaded here
+     * @param aContent the content key is loaded here
+     *
+     * @since S60 5.0
+     */
+    void MapEnumToDestinationInfoL(TInt aEnum,TPtrC& aType, TPtrC8& aDataKey, 
+            TPtrC& aContent);
+    
+    /**
+     * Resets the Bitmap cache.
+     *
+     * @since S60 5.0
+     */
+    void ResetBitmapCache();
+    
+    /**
+     * Resets the publishing buffers.
+     *
+     * @since S60 5.0
+     */
+    void ResetPublishingBuffers();
+    
+    TUint RegisterPublisherL( 
+        const TDesC& aPublisherId, 
+        const TDesC& aContentId,
+        const TDesC& aContentType );
+    
+    TUint CMusicContentPublisher::ExtractItemId( const CLiwGenericParamList& aInParamList );
+    
+    void RemoveL( TInt aDestination );
+    
+    /**
+     * Get a heap descriptor from the resource file
+     *
+     * @since S60 5.0
+     */
+    void GetLocalizedStringL(RResourceFile& aResourceFile, HBufC*& aRetBuf,
+            TInt aResourceId);
+    
+    void DoPublishL();
+    
+
+private: // data
+
+    /**
+     * Instance of CPS interface used for update with CPS.
+     * Not own
+     */
+    MLiwInterface* iCPSInterface;
+
+    /**
+     * Creates the plugins and manages the plugins table.
+     * Own.
+     */
+    CPluginManager* iPluginManager;
+    
+    /**
+     * Pointer to the active plugin.
+     * Not own.
+     */    
+    CMCPPlugin* iActivePlugin;
+    
+    /**
+     * mapping for the destination translation.
+     */    
+    RHashMap<TInt, TMCPDestinationItem> iDestinationMap;
+    
+    /**
+     * mapping for the destination  image info translation.
+     */    
+    RHashMap<TInt, TSize> iImageDestinationSizeMap;
+    
+    /**
+     * bitmap cache map.
+     */    
+    RHashMap<TInt, TBmpMsk> iBitmapCache;
+    
+    /**
+     * To keep the unpublished data.
+     */
+    RHashMap<TInt, TMyBufferItem> iPublishingDataBuffers;
+    
+    /**
+     * To keep the unpublished actions.
+     */
+    RHashMap<TInt, TMyBufferItem> iPublishingActionBuffers;
+    
+    /**
+    * Skin server session.
+    */
+    RAknsSrvSession iAknsSrvSession;
+    
+    /**
+    * Buffers for the localized strings
+    */
+    HBufC* iNowPlayingBuffer;
+    HBufC* iLastPlayedBuffer;
+    HBufC* iGoToMusicBuffer;
+
+    CMCPHarvesterPublisherObserver* iHPObserver;
+    TBool iIsPublisherActive;
+
+    HBufC* iInstanceId;
+   
+    };
+
+#endif // C_MUSICCONTENTPUBLISHER_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/inc/musiccontentpublisheruids.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for Music Content Publisher
+*
+*/
+
+
+#ifndef MUSICCONTENTPUBLISHERUIDS_H_
+#define MUSICCONTENTPUBLISHERUIDS_H_
+
+/** Ecom implementation uid for Music Player Action Handler Plugin */
+#define KMusicContentPublisherUID 0x10207C12
+
+/** Ecom dll uid for Music Player Action Handler Plugin */
+#define KMusicContentPublisherDLL 0x10207C13
+
+#endif /*MUSICCONTENTPUBLISHERUIDS_H_*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/inc/pluginmanager.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,150 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Plugin manager, responsible to load the plugins.
+*
+*/
+
+
+#ifndef C_PLUGINMANAGER_H
+#define C_PLUGINMANAGER_H
+
+#include <e32base.h>
+#include <e32hashtab.h>
+
+class REComSession;
+class CMusicContentPublisher;
+
+/**
+ *  Plugin manager.
+ *  Class used to manage the the ECOM plugins
+ *  @since S60 S60 v5.0
+ */
+class CPluginManager : public CActive
+    {
+public:
+
+    /**
+     * Standard Symbian 2 phase constructor
+     */
+    static CPluginManager* NewL( TUid aUid, TAny *aParameter , CMusicContentPublisher* aContentPublisher );
+
+    /**
+     * Standard Symbian 2 phase constructor
+     */
+    static CPluginManager* NewLC( TUid aUid, TAny *aParameter , CMusicContentPublisher* aContentPublisher  );
+
+    /**
+     * Standard C++ destructor.
+     */
+    ~CPluginManager();
+
+    /**
+     * Gets plugin with provided UID
+     *
+     * @param aUid required plugin
+     * @return pointer to plugin implementation
+     */
+    TAny* GetImplementation( TUid aUid );
+
+    /**
+     * Gets plugin with provided index
+     *
+     * @param aIndex index of plugin
+     * @return pointer to plugin implementation
+     */
+    TAny* GetImplementation( TInt aIndex );
+
+    /**
+     * Gets number of plugins
+     *
+     * @return number of plugins
+     */
+    TInt GetCount();
+
+protected:
+
+    /**
+     * From CActive, RunL.
+     * Handles the active object’s request completion event
+     */
+    void RunL();
+
+    /**
+     * From CActive, DoCancel.
+     * Implements cancellation of an outstanding request.
+     */
+    void DoCancel();
+
+    /**
+     * From CActive, RunError.
+     * Method called when leave occured in RunL
+     */
+    TInt RunError( TInt aError );
+
+private:
+
+    /**
+     * C++ default constructor.
+     */
+    CPluginManager( TUid aUid, TAny *aParameter, CMusicContentPublisher* aContentPublisher );
+
+    /**
+     * Perform the second phase construction of a CPluginManager object.
+     */
+    void ConstructL();
+
+    /**
+     * Loads ECOM plugins
+     */
+    void LoadPluginsL();
+
+    /**
+     * Cleans plugins table;
+     */
+    void CleanPluginsTable();
+
+private: //data
+
+    /**
+     * ECOM handler
+     * Own.
+     */
+    REComSession* iSession;
+
+    /**
+     * Map containing plugins
+     * Own.
+     */
+    RHashMap< TInt32, TAny*> iPluginMap;
+
+    /**
+     * UID of the interface
+     */
+    const TUid iUid;
+
+    /**
+     * Parameter to pass to the object creation method.
+     */
+    TAny* iParameter;
+    
+    /**
+     * Content Publisher / Parent, not owned.
+     */
+    CMusicContentPublisher* iContentPublisher;
+
+    };
+
+#endif // C_PLUGINMANAGER_H
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/inc/sapidatapluginconst.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Content model for data plug-in.
+*
+*/
+
+
+#ifndef SAPIDATAPLUGINCONST_H
+#define SAPIDATAPLUGINCONST_H
+
+#include <aicontentmodel.h>
+//#include "sapidatapluginuids.hrh"
+
+// AI Data Plug-in ECOM implementation UID.
+//const TInt KImplUidDataPlugin = SAPIDP_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_DATAPLUGIN;
+//const TUid KUidDataPlugin = { KImplUidDataPlugin };
+
+// ================================= CONTENT ===================================
+
+/**
+ * Content Model type identifier
+ */
+_LIT(KText ,"text");
+_LIT(KImage, "image");
+_LIT(KPlugin, "plugin");
+
+
+// CPS Constants
+_LIT(KService,         "service");
+_LIT(KInterface,       "interface");
+_LIT(KCommand,         "command");
+_LIT8( KType,          "type");
+_LIT( KCpData,         "cp_data");
+_LIT( KPubData,        "publisher" );
+_LIT8( KFilter,        "filter" );
+_LIT8( KDataMap,       "data_map");
+_LIT8( KActionTrigger, "action_trigger" );
+_LIT8( KGetList ,      "GetList" );
+_LIT( KExecute,       "execute" );
+_LIT8( KRequestNotification, "RequestNotification" );
+_LIT8( KChangeInfo, "change_info" );
+_LIT8( KListMap, "list_map" );
+_LIT8( KPublisherId, "publisher" );
+_LIT8( KContentType, "content_type" );
+_LIT8( KContentId,   "content_id" );
+_LIT8(KResults,      "results");
+_LIT( KAll, "all");
+_LIT8( KOperation, "operation" );
+
+_LIT( KOperationAdd, "add" );
+_LIT( KOperationUpdate, "update" );
+_LIT( KOperationDelete, "delete" );
+_LIT( KOperationExecute, "execute" );
+
+_LIT( KDeActive, "deactive");
+_LIT( KActive, "active");
+_LIT( KSuspend , "suspend");
+_LIT( KResume, "resume");
+
+// reserved extension for retrieving mask handle 
+_LIT8( KMask, "_mask");
+
+// Sapi Data Plugin Constants
+_LIT(KPluginNameSeprator, "/");
+
+/**
+ * Maximum length for the content name
+ */
+const TInt KMaxTypeLength = 8;
+
+/**
+ * Maximum length for the content name
+ */
+const TInt KSAPIContentNameMaxLength = 255;
+
+/**
+ * Maximum length for the content value
+ */
+const TInt KSAPIContentValueMaxLength = 255;
+
+/**
+ * Maximum length for the plugin name
+ */
+const TInt KAiPluginNameMaxLength = 255;
+
+
+#endif /* SAPIDATAPLUGINCONST_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/rom/musiccontentpublisher.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Content Publisher
+*
+*/
+
+
+#ifndef MUSICCONTENTPUBLISHER_IBY
+#define MUSICCONTENTPUBLISHER_IBY
+
+ECOM_PLUGIN(musiccontentpublisher.dll, musiccontentpublisher.rss)
+
+#endif // MUSICCONTENTPUBLISHER_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/src/mcpharvesterpublisherobserver.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,253 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Updates CPS storage
+*
+*/
+
+
+// INCLUDE FILES
+
+#include "mcpharvesterpublisherobserver.h"
+#include "musiccontentpublisher.h"
+#include "sapidatapluginconst.h"
+
+#include <liwservicehandler.h>
+#include <liwvariant.h>
+#include <liwgenericparam.h>
+
+
+_LIT( KPublisher, "publisher" );
+_LIT8( KCPContentInterface, "IContentPublishing" );
+_LIT8( KCPService, "Service.ContentPublishing" );
+_LIT( KMyOperationExecute, "execute" );
+
+// =============================================================================
+// --------------------------------------------------------------------------
+// Cleanup utility for RPointerArray
+// --------------------------------------------------------------------------
+//
+static void DoCleanup( TAny* aPtr )
+    {
+    __ASSERT_DEBUG( aPtr, User::Invariant() );
+    static_cast< RCriteriaArray* >( aPtr )->ResetAndDestroy();
+    }
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Constructor
+// ----------------------------------------------------------------------------
+//
+CMCPHarvesterPublisherObserver::CMCPHarvesterPublisherObserver( CMusicContentPublisher* aHarvester )
+    : iHarvester( aHarvester )
+	{
+	}
+
+// ----------------------------------------------------------------------------
+// Two-phased constructor.
+// ----------------------------------------------------------------------------
+//
+CMCPHarvesterPublisherObserver* CMCPHarvesterPublisherObserver::NewL( 
+        CMusicContentPublisher* aHarvester )
+    {
+    CMCPHarvesterPublisherObserver* self = CMCPHarvesterPublisherObserver::NewLC( aHarvester ) ;
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+CMCPHarvesterPublisherObserver* CMCPHarvesterPublisherObserver::NewLC( 
+        CMusicContentPublisher* aHarvester )
+    {
+    CMCPHarvesterPublisherObserver* self( 
+        new( ELeave ) CMCPHarvesterPublisherObserver( aHarvester ) );
+        
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMCPHarvesterPublisherObserver::~CMCPHarvesterPublisherObserver()
+    {
+    ReleaseLiw();
+    }
+
+// ----------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ----------------------------------------------------------------------------
+//
+void CMCPHarvesterPublisherObserver::ConstructL()
+    {
+    InitLiwL();
+    }
+
+// ---------------------------------------------------------------------------
+// Handles Published content notification
+// ---------------------------------------------------------------------------
+//
+TInt CMCPHarvesterPublisherObserver::HandleNotifyL( 
+    TInt /*aErrorCode */, 
+    TInt /*aEventId*/,
+    CLiwGenericParamList& aEventParamList, 
+    const CLiwGenericParamList& /*aInParamList*/ )
+    {
+    //__UHEAP_MARK;
+    TInt pos(0);
+
+    aEventParamList.FindFirst(pos, KChangeInfo);
+    if (pos != KErrNotFound)
+        {
+        // Get list of maps
+        TLiwVariant variant = (aEventParamList)[pos].Value();
+        variant.PushL();
+        const CLiwList* changeMapsList = variant.AsList();
+        
+        TPtrC publisher;
+        TPtrC operation;
+        TPtrC8 trigger;
+
+        // Iter through list content
+        for (TInt i = 0; i < changeMapsList->Count(); ++i)
+            {
+             if ( changeMapsList->AtL( i, variant )) 
+                 {
+                 const CLiwMap* map  = variant.AsMap();
+                 
+                 // Check what triggered a notification
+                 variant.Reset();
+                 if ( map->FindL( KOperation, variant ))
+                     {
+                     operation.Set( variant.AsDes()); 
+                     }
+                 if ( operation == KMyOperationExecute )
+                     {
+                     variant.Reset();
+                     if( map->FindL( KActionTrigger, variant ))
+                         {
+                         trigger.Set( variant.AsData()); 
+                         }
+                     TLiwVariant pubVariant;
+                     if( map->FindL( KContentId, pubVariant) )
+                         {
+                         publisher.Set( pubVariant.AsDes());
+                         }
+                     pubVariant.PushL();
+                     if( publisher.Length() && trigger.Length())
+                         {
+                         iHarvester->HandlePublisherNotificationL( publisher, trigger );
+                         }
+                     CleanupStack::PopAndDestroy( &pubVariant );
+                     }
+                 }
+            }
+        CleanupStack::PopAndDestroy( &variant );
+        }
+    //__UHEAP_MARKEND;
+    return KErrNone;
+
+    }
+
+// ---------------------------------------------------------------------------
+// Register for notifications
+// ---------------------------------------------------------------------------
+//
+void CMCPHarvesterPublisherObserver::RegisterL( CLiwDefaultMap* aFilter )
+    {
+    CLiwGenericParamList* inParamList( CLiwGenericParamList::NewLC() );
+    CLiwGenericParamList* outParamList( CLiwGenericParamList::NewLC() );
+    
+    // Fill in input list for RequestNotification command
+    inParamList->AppendL(TLiwGenericParam(KType,TLiwVariant( KPublisher )));
+    inParamList->AppendL(TLiwGenericParam(KFilter ,TLiwVariant( aFilter )));
+        
+    iError = KErrNone;
+    TRAP( iError, iInterface->ExecuteCmdL( 
+                KRequestNotification,
+                *inParamList,
+                *outParamList,
+                0,
+                this ) );
+    
+    CleanupStack::PopAndDestroy( outParamList );
+    CleanupStack::PopAndDestroy( inParamList ); 
+    }
+
+// ------------------------------------------------------------------------
+// CWidgetUiWindowManager::FindObserver
+//
+// Init LIW interface.
+// ------------------------------------------------------------------------
+void CMCPHarvesterPublisherObserver::InitLiwL()
+    {
+    if ( !iLiwHandler )
+        {
+        TInt error( KErrNone );
+        CLiwGenericParamList* in( NULL );
+        CLiwGenericParamList* out( NULL );
+        CLiwCriteriaItem* criterion( NULL );
+
+        RCriteriaArray array( 1 );
+        TCleanupItem cleanup( DoCleanup, &array );
+        CleanupStack::PushL( cleanup );
+
+        // Do the basic initialization.
+        iLiwHandler = CLiwServiceHandler::NewL();
+
+        // Get iCPSIface.
+        in = CLiwGenericParamList::NewLC();
+        out = CLiwGenericParamList::NewLC();
+
+        criterion = CLiwCriteriaItem::NewL( 
+            KLiwCmdAsStr,
+            KCPContentInterface, 
+            KCPService );
+            
+        error = array.Append( criterion );
+        if ( error )
+            {
+            delete criterion; criterion = NULL;
+            User::Leave( error );
+            }
+
+        criterion->SetServiceClass( TUid::Uid( KLiwClassBase ) );
+            
+        iLiwHandler->AttachL( array );
+        iLiwHandler->ExecuteServiceCmdL( *criterion, *in, *out ); 
+
+        out->FindFirst( error, KCPContentInterface );
+        User::LeaveIfError( error );
+
+        iInterface = (*out)[ error ].Value().AsInterface();
+
+        CleanupStack::PopAndDestroy( 3 );
+        }
+    }
+
+void CMCPHarvesterPublisherObserver::ReleaseLiw()
+    {    
+    if ( iInterface )
+        {
+        iInterface->Close();
+        iInterface = NULL;
+        }
+        
+    delete iLiwHandler;
+    iLiwHandler = NULL;
+    }
+ //  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/src/musiccontentpublisher.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1134 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages MCP plugins, and content publishing.
+*
+*/
+
+#include <mpxlog.h>                     // MPX_DEBUG
+#include <liwservicehandler.h>
+#include <liwvariant.h>
+#include <liwgenericparam.h>
+
+#include <mcpplugin.h>
+#include <mcppluginuids.hrh>
+#include <fbs.h>
+#include <coemain.h>
+#include <AknsUtils.h>
+#include <gdi.h>
+#include <musichomescreen.rsg>
+#include <bautils.h>
+#include <data_caging_path_literals.hrh>
+#include <s32mem.h>
+#include <e32hashtab.h>
+
+#include "cpglobals.h" //This will be moved to domain API (HSFW)
+#include "musiccontentpublisher.h"
+#include "pluginmanager.h"
+#include "mcpharvesterpublisherobserver.h"
+
+_LIT( KPubData,        "publisher" );
+
+
+_LIT8( KMyActive, "active" );
+_LIT8( KMyDeActive, "deactive");
+_LIT8( KMySuspend, "suspend");
+_LIT8( KMyResume, "resume");
+_LIT8( KMyActionMap, "action_map" );
+_LIT8( KMyItem, "item" );
+_LIT8( KMyAdd, "Add" );
+_LIT8( KMyItemId, "item_id" );
+_LIT( KMyActionName, "data" );
+
+_LIT( KEmpty, "" );
+_LIT( KLoc, "LOC:");
+_LIT( KWildCard, "*");
+
+_LIT( KNowPlaying, "LOC:NOW PLAYING" );
+_LIT( KLastPlayed, "LOC:LAST PLAYED" );
+_LIT( KMask, "_mask");
+_LIT( KMWPublisher, "MWPublisher");
+_LIT( KactionMessageToMusicPlayer, "MessageToMusicPlayer" );
+_LIT( KGoToAlbumView, "GoToAlbumView" );
+_LIT8( KMessage, "message" );
+
+//for application launcher AHPlugin
+const TInt KMmUid3AsTInt( 0x101f4cd2 );
+const TInt KMSGUidAsTInt( 0x10003A39 );
+_LIT8( KAdditionalData, "additional_data" );
+_LIT( KLaunchApp, "launch_application" );
+_LIT( KMessageWithTail, "message_with_tail" );
+_LIT8( KMessageForMMOpenMusicSuiteWithHide, "mm://root/musicsuite?exit=hide");
+
+_LIT( KResourceFile, "z:musichomescreen.rsc");
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CMusicContentPublisher::CMusicContentPublisher( MLiwInterface* aCPSInterface )
+    {
+    iCPSInterface = aCPSInterface;
+    iActivePlugin=NULL;
+    iIsPublisherActive = EFalse;
+
+    }
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::ConstructL()
+    {
+    MPX_DEBUG1("CMusicContentPublisher::ConstructL <---");
+    //Load the destination translation table.
+    TInt dstl (sizeof(KMCPDestinationInfo)/sizeof(TMCPDestinationItem));
+    for (TInt i = 0; i < dstl; i++)
+        {
+        iDestinationMap.InsertL(KMCPDestinationInfo[i].id, 
+                KMCPDestinationInfo[i]);
+        }
+    
+    dstl = (sizeof(KMCPImageDestinationInfo)/sizeof(
+            TMCPImageDestinationInfoItem));
+    for (TInt i = 0; i < dstl; i++)
+        {
+        iImageDestinationSizeMap.Insert(KMCPImageDestinationInfo[i].id,
+                TSize(KMCPImageDestinationInfo[i].sizex,
+                        KMCPImageDestinationInfo[i].sizey));
+        }
+    
+    MPX_DEBUG1("CMusicContentPublisher::ConstructL loading resources");
+    //Load Loc strings
+    RFs fs;
+    User::LeaveIfError(fs.Connect());
+    CleanupClosePushL(fs);  
+    TFileName fileName;
+    TParse* parseObj = new(ELeave) TParse();
+    TInt errInt = parseObj->Set( KResourceFile(),&KDC_APP_RESOURCE_DIR,NULL );
+    if(KErrNone != errInt)
+      {
+      delete parseObj;
+      User::Leave(errInt);
+      }
+    fileName = parseObj->FullName();
+    delete parseObj;
+    BaflUtils::NearestLanguageFile(fs,fileName);
+    if(!BaflUtils::FileExists(fs,fileName))
+        {
+        User::Leave(KErrNotFound);
+        }
+    RResourceFile resourceFile;
+    resourceFile.OpenL(fs,fileName);
+    CleanupClosePushL(resourceFile);
+    resourceFile.ConfirmSignatureL();
+    GetLocalizedStringL(resourceFile, iLastPlayedBuffer, R_MUSICHOMESCREEN_LAST_PLAYED);
+    GetLocalizedStringL(resourceFile, iNowPlayingBuffer, R_MUSICHOMESCREEN_NOW_PLAYING);
+    GetLocalizedStringL(resourceFile, iGoToMusicBuffer, R_MUSICHOMESCREEN_GO_TO_MUSIC);
+    CleanupStack::PopAndDestroy(&resourceFile);
+    CleanupStack::PopAndDestroy(&fs);
+    MPX_DEBUG1("CMusicContentPublisher::ConstructL resources loaded");
+    
+    // connect to the skin server, to receive skin changed event.
+    iAknsSrvSession.Connect(this);
+    
+    // enable skin.
+    AknsUtils::InitSkinSupportL();
+
+    MPX_DEBUG1("CMusicContentPublisher::ConstructL subscribing to observer");
+ 
+    TUint id = RegisterPublisherL( 
+            KMWPublisher,
+            KAll, 
+            KAll );
+        
+    if( id != 0 )
+        {
+    CLiwDefaultMap* filter = CLiwDefaultMap::NewLC();
+
+    filter->InsertL( KPublisherId, TLiwVariant( KMWPublisher ) );
+    filter->InsertL( KContentId, TLiwVariant( KAll) );
+    filter->InsertL( KContentType, TLiwVariant( KAll ) );
+
+    iHPObserver = CMCPHarvesterPublisherObserver::NewL(this);
+    iHPObserver->RegisterL(filter);
+    CleanupStack::PopAndDestroy(filter);
+        }
+    //Reset the music menu info
+    InstallEmptyActionL(EMusicMenuMusicInfoTrigger);
+    PublishTextL( NULL, EMusicMenuMusicInfoLine1, iLastPlayedBuffer->Des() );
+    PublishTextL( NULL, EMusicMenuMusicInfoLine2, KEmpty );
+    PublishImageL( NULL, EMusicMenuMusicInfoImage1, KEmpty );
+    
+    MPX_DEBUG1("CMusicContentPublisher::ConstructL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMusicContentPublisher* CMusicContentPublisher::NewL(  
+        MLiwInterface* aCPSInterface )
+    {
+    CMusicContentPublisher* self = new ( ELeave ) CMusicContentPublisher( 
+            aCPSInterface );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CMusicContentPublisher::~CMusicContentPublisher()
+    {
+    
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher <---");
+    if(iHPObserver)
+        {
+        MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher deleting observer");
+        delete iHPObserver; 
+        }
+    delete iNowPlayingBuffer;
+    delete iLastPlayedBuffer;
+    delete iGoToMusicBuffer;
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher closing destination maps");
+    iImageDestinationSizeMap.Close();
+    iDestinationMap.Close();
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher resetting bitmap cache");
+    ResetBitmapCache();
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher closing skin server session");
+    iAknsSrvSession.Close();
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher deleting plugin manager");
+    delete iPluginManager;
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher resetting publishing buffers");
+    ResetPublishingBuffers();
+    MPX_DEBUG1("CMusicContentPublisher::~CMusicContentPublisher --->");
+    if ( iInstanceId )
+    	{
+    	delete iInstanceId;
+    	}
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::InstallGoToMusicL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::InstallGoToMusicL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10282E5F ) ) );
+    mapData->InsertL( KType, TLiwVariant( KLaunchApp ) );
+    mapData->InsertL( KLaunchMethod, TLiwVariant( KMessageWithTail ) );
+    mapData->InsertL(KApplicationUid,
+            TLiwVariant(TInt32(KMmUid3AsTInt) ) );
+        mapData->InsertL( KAdditionalData, 
+            TLiwVariant( KMessageForMMOpenMusicSuiteWithHide ) );
+    mapData->InsertL(KMessageUid,
+            TLiwVariant(TInt32(KMSGUidAsTInt) ) );
+    
+    mapTrigger->InsertL( KData, TLiwVariant( mapData ) );
+    
+    PublishActionL( NULL, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMusicContentPublisher::InstallGoToMusicL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::InstallGoToAlbumL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::InstallGoToAlbumL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    CLiwDefaultMap* mapData = CLiwDefaultMap::NewLC();
+    
+    mapTrigger->InsertL( KPluginUid, TLiwVariant( TUid::Uid( 0x10207C16 ) ) );
+       mapData->InsertL( KType, TLiwVariant( KactionMessageToMusicPlayer ) );
+       mapData->InsertL( KMessage, TLiwVariant( KGoToAlbumView ) );
+    mapTrigger->InsertL( KData, TLiwVariant( mapData ) );
+    
+    PublishActionL( NULL, aDestination, mapTrigger );
+    
+    CleanupStack::PopAndDestroy( mapData );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMusicContentPublisher::InstallGoToAlbumL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::InstallEmptyActionL(
+        TMCPTriggerDestination aDestination )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::InstallEmptyActionL <---");
+    CLiwDefaultMap* mapTrigger = CLiwDefaultMap::NewLC();
+    PublishActionL( NULL, aDestination, mapTrigger );
+    CleanupStack::PopAndDestroy( mapTrigger );
+    MPX_DEBUG1("CMusicContentPublisher::InstallEmptyActionL --->");
+    }
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::MapEnumToDestinationInfoL(TInt aEnum,
+        TPtrC& aType, TPtrC8& aDataKey, TPtrC& aContent)
+    {
+    MPX_DEBUG1("CMusicContentPublisher::MapEnumToDestinationInfoL <---");
+    TMCPDestinationItem* tmpdstitemp;
+    tmpdstitemp = iDestinationMap.Find(aEnum);
+    
+    if (tmpdstitemp)
+        {
+        TPtrC type ( reinterpret_cast<const TUint16*>(
+                tmpdstitemp->type) );
+        TPtrC8 dataKey ( reinterpret_cast<const TUint8*>(
+                tmpdstitemp->dataKey ) );
+        TPtrC content ( reinterpret_cast<const TUint16*>(
+                    tmpdstitemp->content) );
+
+        aType.Set(type);
+        aDataKey.Set(dataKey);
+
+        if ( !content.Compare( KWildCard ) )
+            {
+            aContent.Set( iInstanceId->Des() );
+            }
+        else
+            {
+            aContent.Set(content);
+            }
+        }
+    else
+        {
+        //API user provided an invalid destination or the destination is not
+        //defined properly.
+        __ASSERT_DEBUG(EFalse,User::Invariant());
+        }
+    MPX_DEBUG1("CMusicContentPublisher::MapEnumToDestinationInfoL --->");
+    }
+
+// ----------------------------------------------------------------------------
+// Get a heap descriptor from the resource file
+// ----------------------------------------------------------------------------
+//
+void CMusicContentPublisher::GetLocalizedStringL(RResourceFile& aResourceFile,
+        HBufC*& aRetBuf, TInt aResourceId )
+   {
+   MPX_DEBUG1("CMusicContentPublisher::GetLocalizedStringL <---");
+   HBufC8* dataBuffer = aResourceFile.AllocReadLC(aResourceId);
+   TResourceReader theReader;
+   theReader.SetBuffer(dataBuffer);
+   aRetBuf = theReader.ReadHBufCL();
+   CleanupStack::PopAndDestroy(dataBuffer);
+   MPX_DEBUG1("CMusicContentPublisher::GetLocalizedStringL --->");
+   }
+
+// ----------------------------------------------------------------------------
+// Publishes buffered data and actions.
+// ----------------------------------------------------------------------------
+//
+void CMusicContentPublisher::DoPublishL()
+    {
+    MPX_DEBUG1("CMusicContentPublisher::DoPublishL <---");
+    THashMapIter<TInt, TMyBufferItem> dataIter( iPublishingDataBuffers );
+    MPX_DEBUG1("CMusicContentPublisher::DoPublishL publishing data");
+    
+    TMyBufferItem const* itemptr;
+    itemptr = dataIter.NextValue();
+    while (itemptr)
+        {
+        CLiwGenericParamList* inParam = CLiwGenericParamList::NewLC();
+        CLiwGenericParamList* outParam = CLiwGenericParamList::NewLC();
+        
+        TPtrC8 dataKey;
+        TPtrC type;
+        TPtrC content;
+        MapEnumToDestinationInfoL(*dataIter.CurrentKey(), type, dataKey, content);
+        
+        TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
+        inParam->AppendL( cptype );
+        CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC( );
+        
+        
+        RMemReadStream rs( itemptr->buf, itemptr->size );
+        CLiwDefaultMap* map = CLiwDefaultMap::NewLC( rs );
+         
+        cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
+        cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
+        cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
+        cpdatamap->InsertL( KDataMap  , TLiwVariant( map ) );
+    
+        TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
+        inParam->AppendL( item );
+ 
+        iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+        CleanupStack::PopAndDestroy( map );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        CleanupStack::PopAndDestroy( outParam );
+        CleanupStack::PopAndDestroy( inParam );
+        
+        itemptr = dataIter.NextValue();
+        }
+        
+    //The order in wich we publish is important, actions should be published after the data contents.
+    THashMapIter<TInt, TMyBufferItem> actionIter( iPublishingActionBuffers );
+    MPX_DEBUG1("CMusicContentPublisher::DoPublishL publishing actions");
+    
+    itemptr = NULL;
+    itemptr = actionIter.NextValue();
+    while (itemptr)
+        {
+        CLiwGenericParamList* inParam = CLiwGenericParamList::NewLC();
+        CLiwGenericParamList* outParam = CLiwGenericParamList::NewLC();
+        
+        TPtrC8 dataKey;
+        TPtrC type;
+        TPtrC content;
+        MapEnumToDestinationInfoL( *actionIter.CurrentKey(), type, dataKey, content );
+        
+        TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
+        inParam->AppendL( cptype );
+        CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC( );
+        
+        
+        RMemReadStream rs( itemptr->buf, itemptr->size );
+        CLiwDefaultMap* map = CLiwDefaultMap::NewLC( rs );
+         
+        cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
+        cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
+        cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
+        cpdatamap->InsertL( KMyActionMap  , TLiwVariant( map ) );
+    
+        TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
+        inParam->AppendL( item );
+ 
+        iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+        CleanupStack::PopAndDestroy( map );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        CleanupStack::PopAndDestroy( outParam );
+        CleanupStack::PopAndDestroy( inParam );
+        
+        itemptr = actionIter.NextValue();
+        }
+    MPX_DEBUG1("CMusicContentPublisher::CMusicContentPublisher::DoPublishL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Resets all the graphical elements.
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::ResetL()
+    {
+    MPX_DEBUG1("CMusicContentPublisher::ResetL <---");
+    //Plugin deletion is handled by the pluginmanager.
+    iActivePlugin = NULL;
+    //Reset The Widget
+    PublishImageL(NULL,EMusicWidgetImage1,KEmpty);
+    InstallGoToAlbumL(EMusicWidgetTrigger1);
+    PublishTextL( NULL,EMusicWidgetText1, KEmpty );
+    PublishImageL(NULL,EMusicWidgetToolbarB1,KEmpty);
+    PublishImageL(NULL,EMusicWidgetToolbarB2,KEmpty);
+    PublishImageL(NULL,EMusicWidgetToolbarB3,KEmpty);
+    InstallEmptyActionL(EMusicWidgetTB1Trigger);
+    InstallEmptyActionL(EMusicWidgetTB2Trigger);
+    InstallEmptyActionL(EMusicWidgetTB3Trigger);
+    PublishTextL( NULL,EMusicWidgetDefaultText, iGoToMusicBuffer->Des() );  
+    InstallGoToAlbumL(EMusicWidgetTrigger2);
+
+    //Reset the music menu info
+    InstallEmptyActionL(EMusicMenuMusicInfoTrigger);
+    PublishTextL( NULL, EMusicMenuMusicInfoLine1, iLastPlayedBuffer->Des() );
+    PublishTextL( NULL, EMusicMenuMusicInfoLine2, KEmpty );
+    PublishImageL( NULL, EMusicMenuMusicInfoImage1, KEmpty );
+    MPX_DEBUG1("CMusicContentPublisher::Reset --->");
+    }
+// ---------------------------------------------------------------------------
+// 
+// ---------------------------------------------------------------------------
+//
+TSize CMusicContentPublisher::GetImageDestinationSize(
+        TMCPImageDestination aDst)
+    {
+    MPX_DEBUG1("CMusicContentPublisher::GetImageDestinationSize <---");
+    TSize * ret;
+    ret = iImageDestinationSizeMap.Find(aDst);
+    if (ret)
+        {
+        MPX_DEBUG1("CMusicContentPublisher::GetImageDestinationSize --->");
+        return *ret;    
+        }
+    else
+        {
+        MPX_DEBUG1("CMusicContentPublisher::GetImageDestinationSize --->");
+        return TSize(0,0);
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Destroys the bitmaps saved on the cache.
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::ResetBitmapCache()
+    {
+    MPX_DEBUG1("CMusicContentPublisher::ResetBitmapCache <---");
+    THashMapIter<TInt, TBmpMsk> iter(iBitmapCache);
+    TBmpMsk const* ptr = iter.NextValue();
+    CFbsBitmap* bmp( NULL );
+    CFbsBitmap* msk( NULL );
+    while ( ptr )
+        {
+        bmp = ptr->bitmap;
+        msk = ptr->mask;
+        delete bmp;
+        bmp = NULL;
+        delete msk;
+        msk = NULL;
+        ptr = iter.NextValue();
+        }
+    iBitmapCache.Close();
+    MPX_DEBUG1("CMusicContentPublisher::ResetBitmapCache --->");
+    }
+    
+// ---------------------------------------------------------------------------
+// Destroys the publishing buffers.
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::ResetPublishingBuffers()
+    {
+    THashMapIter<TInt, TMyBufferItem> dataIter( iPublishingDataBuffers );
+    THashMapIter<TInt, TMyBufferItem> actionIter( iPublishingActionBuffers );
+    
+    TMyBufferItem const* itemptr;
+    itemptr = dataIter.NextValue();
+    while (itemptr)
+        {
+        User::Free(itemptr->buf);
+        dataIter.RemoveCurrent();
+        itemptr = dataIter.NextValue();
+        }
+    iPublishingDataBuffers.Close();
+    itemptr = NULL;
+    itemptr = actionIter.NextValue();
+    while (itemptr)
+        {
+        User::Free(itemptr->buf);
+        actionIter.RemoveCurrent();
+        itemptr = actionIter.NextValue();
+        }
+    iPublishingActionBuffers.Close();
+    }
+
+TUint CMusicContentPublisher::RegisterPublisherL( 
+    const TDesC& aPublisherId, 
+    const TDesC& aContentId,
+    const TDesC& aContentType )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::RegisterPublisherL <---");
+    TUint id( 0 );
+    if( iCPSInterface )
+        {   
+        CLiwGenericParamList* inparam( CLiwGenericParamList::NewLC() );
+        CLiwGenericParamList* outparam( CLiwGenericParamList::NewLC() );
+
+        TLiwGenericParam type( KType, TLiwVariant( KPubData ));
+        inparam->AppendL( type );
+        CLiwDefaultMap* cpdatamap = CLiwDefaultMap::NewLC();
+        CLiwDefaultMap* datamap = CLiwDefaultMap::NewLC();
+        CLiwDefaultMap* actionmap( NULL );
+
+        // Create the data map for publisher registry
+        cpdatamap->InsertL( KContentType, TLiwVariant( aContentType ));
+        cpdatamap->InsertL( KContentId, TLiwVariant( aContentId ));
+        cpdatamap->InsertL( KPublisherId, TLiwVariant( aPublisherId ));
+
+        
+        // Create the action map for publisher registry
+        actionmap = CLiwDefaultMap::NewLC();
+        actionmap->InsertL(KMyActive, TLiwVariant( KMyActionName ));
+        actionmap->InsertL(KMyDeActive, TLiwVariant( KMyActionName ));
+        actionmap->InsertL(KMySuspend, TLiwVariant( KMyActionName ));
+        actionmap->InsertL(KMyResume, TLiwVariant( KMyActionName ));
+ 
+        cpdatamap->InsertL( KMyActionMap, TLiwVariant(actionmap));
+        CleanupStack::PopAndDestroy( actionmap );
+        
+        TLiwGenericParam item( KMyItem, TLiwVariant( cpdatamap ));        
+        inparam->AppendL( item );
+        
+        iCPSInterface->ExecuteCmdL( KMyAdd , *inparam, *outparam);
+        id = ExtractItemId(*outparam);
+        
+        CleanupStack::PopAndDestroy( datamap );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        item.Reset();
+        type.Reset();   
+        CleanupStack::PopAndDestroy(outparam);
+        CleanupStack::PopAndDestroy(inparam);
+        }
+    MPX_DEBUG1("CMusicContentPublisher::RegisterPublisherL --->");
+    return id;
+    }
+
+TUint CMusicContentPublisher::ExtractItemId( const CLiwGenericParamList& aInParamList )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::ExtractItemId <---");
+    TUint result ( 0 );
+    TInt pos( 0 );
+    aInParamList.FindFirst( pos, KMyItemId );
+    if( pos != KErrNotFound )
+        {
+        // item id present - extract and return
+        aInParamList[pos].Value().Get( result );
+        }
+    MPX_DEBUG1("CMusicContentPublisher::ExtractItemId --->");
+    return result;
+    }
+ 
+ // ---------------------------------------------------------------------------
+// removes CPS entry for the required destination
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::RemoveL( TInt aDestination )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::RemoveL <---");
+    if( iCPSInterface )
+        {
+        CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
+        CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+        TPtrC8 dataKey;
+        TPtrC type;
+        TPtrC content;
+        MapEnumToDestinationInfoL(aDestination, type, dataKey, content);
+        TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
+        inParam->AppendL( cptype );
+        CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
+        cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
+        cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
+        cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
+        TLiwGenericParam item( KFilter, TLiwVariant( cpdatamap ) ); 
+        inParam->AppendL( item );
+        iCPSInterface->ExecuteCmdL( KDelete , *inParam, *outParam);
+        CleanupStack::PopAndDestroy( cpdatamap );
+        CleanupStack::PopAndDestroy( outParam );
+        CleanupStack::PopAndDestroy( inParam );
+        }  
+    MPX_DEBUG1("CMusicContentPublisher::RemoveL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Publishes an image from path to the required destination
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::PublishImageL( CMCPPlugin* aPlugin,  
+        TMCPImageDestination aDestination, 
+        const TDesC& aImagePath )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL <---");
+    if( iCPSInterface && iActivePlugin == aPlugin )
+        {
+        CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
+        CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+        
+        TPtrC8 dataKey;
+        TPtrC type;
+        TPtrC content;
+        MapEnumToDestinationInfoL(aDestination, type, dataKey, content);
+        
+        TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
+        inParam->AppendL( cptype );
+        CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
+        CLiwDefaultMap * map = CLiwDefaultMap::NewLC( );
+        
+         
+        map->InsertL(dataKey, TLiwVariant( aImagePath ) );
+        
+        cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
+        cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
+        cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
+        cpdatamap->InsertL( KDataMap  , TLiwVariant( map ) );
+    
+        TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
+        inParam->AppendL( item );
+        
+        if ( aDestination >= EMusicMenuMusicInfoImage1 )
+            {
+            iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+            }
+        else
+            {
+            if ( iIsPublisherActive )
+                {
+                iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+                }
+            TMyBufferItem* ptr;
+            ptr = iPublishingDataBuffers.Find(aDestination);
+            if (ptr) //remove the old one
+                {
+                User::Free(ptr->buf);
+                iPublishingDataBuffers.Remove(aDestination);
+                }
+            TInt sz = map->Size();
+            TMyBufferItem bufferitem;
+            bufferitem.size = map->Size();
+            bufferitem.buf = User::AllocL(map->Size());
+            RMemWriteStream ws(bufferitem.buf, bufferitem.size);
+            map->ExternalizeL(ws);
+            iPublishingDataBuffers.Insert(aDestination, bufferitem);
+            }
+        CleanupStack::PopAndDestroy( map );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        CleanupStack::PopAndDestroy( outParam );
+        CleanupStack::PopAndDestroy( inParam );
+        }   
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Publishes an image from bitmap handle to the required destination
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::PublishImageL( CMCPPlugin* aPlugin, 
+        TMCPImageDestination aDestination,
+        TInt aBitmapHandle,
+        TInt aMaskBitmapHandle)
+    {
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL <---");
+    if( iCPSInterface && iActivePlugin == aPlugin )
+        {
+        CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
+        CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+        
+        TPtrC8 dataKey;
+        TPtrC type;
+        TPtrC content;
+        MapEnumToDestinationInfoL(aDestination, type, dataKey, content);
+        
+        TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
+        inParam->AppendL( cptype );
+        CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
+        CLiwDefaultMap * map = CLiwDefaultMap::NewLC( );
+        
+         
+        if (aDestination == EMusicMenuMusicInfoImage1)
+            {
+            //Matrix Menu expects a Tint32 (TVariantTypeId::EVariantTypeTInt32)   
+            map->InsertL(dataKey, TLiwVariant( TInt32( aBitmapHandle ) ) );
+            }
+        else 
+            {
+            //Homescreen expects a TBool/TInt 
+            //(TVariantTypeId::EVariantTypeTBool)
+            map->InsertL(dataKey, TLiwVariant( aBitmapHandle ) );
+            }
+        
+        if (aMaskBitmapHandle)
+            {
+            HBufC8* maskResult = HBufC8::NewLC( 
+                    dataKey.Length() + KMask().Length() );
+            TPtr8 maskResultPtr = maskResult->Des();
+            maskResultPtr.Append( dataKey );
+            maskResultPtr.Append( KMask );
+            if (aDestination == EMusicMenuMusicInfoImage1)
+                {
+                //Matrix Menu expects a Tint32 (TVariantTypeId::EVariantTypeTInt32)   
+                map->InsertL(maskResultPtr, TLiwVariant( (TInt32)aMaskBitmapHandle ) );
+                }
+            else 
+                {
+                //Homescreen expects a TBool/TInt 
+                //(TVariantTypeId::EVariantTypeTBool)
+                map->InsertL(maskResultPtr, TLiwVariant( aMaskBitmapHandle ) );
+                }
+            CleanupStack::PopAndDestroy( maskResult );
+            }
+        
+        cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
+        cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
+        cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
+        cpdatamap->InsertL( KDataMap  , TLiwVariant( map ) );
+    
+        TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
+        inParam->AppendL( item );
+        
+        if ( aDestination >= EMusicMenuMusicInfoImage1 )
+            {
+            iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+            }
+        else
+            {
+            if ( iIsPublisherActive )
+                {
+                iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );  	
+                }
+            TMyBufferItem* ptr;
+            ptr = iPublishingDataBuffers.Find(aDestination);
+            if (ptr) //remove the old one
+                {
+                User::Free(ptr->buf);
+                iPublishingDataBuffers.Remove(aDestination);
+                }
+            TInt sz = map->Size();
+            TMyBufferItem bufferitem;
+            bufferitem.size = map->Size();
+            bufferitem.buf = User::AllocL(map->Size());
+            RMemWriteStream ws(bufferitem.buf, bufferitem.size);
+            map->ExternalizeL(ws);
+            iPublishingDataBuffers.Insert(aDestination, bufferitem);
+            }
+        CleanupStack::PopAndDestroy( map );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        CleanupStack::PopAndDestroy( outParam );
+        CleanupStack::PopAndDestroy( inParam );
+        }
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Publishes an image from skin id and mif to the required destination
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::PublishImageL(CMCPPlugin* aPlugin, 
+        TMCPImageDestination aDestination,
+        const TAknsItemID& aID,
+        const TDesC& aFilename,
+        const TInt aFileBitmapId,
+        const TInt aFileMaskId )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL <---");
+    TBmpMsk* bitmapandmask;
+    bitmapandmask = iBitmapCache.Find(aID.iMajor+aID.iMinor);
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+    if (!bitmapandmask)
+        {
+        // Load from skin
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+        AknsUtils::CreateIconL(
+                    skin,
+                    aID,
+                    bitmap,
+                    mask,
+                    aFilename,
+                    aFileBitmapId,
+                    aFileMaskId);
+        AknIconUtils::SetSize(
+                bitmap,
+                GetImageDestinationSize(aDestination),
+                EAspectRatioPreserved );
+        AknIconUtils::SetSize(mask,
+                GetImageDestinationSize(aDestination),
+                EAspectRatioPreserved );
+        TBmpMsk bmpAndMsk;
+        bmpAndMsk.bitmap=bitmap;
+        bmpAndMsk.mask=mask;
+        iBitmapCache.Insert(aID.iMajor+aID.iMinor,bmpAndMsk);
+        bitmapandmask = iBitmapCache.Find(aID.iMajor+aID.iMinor);
+        __ASSERT_DEBUG(bitmapandmask,User::Invariant());
+        }
+    bitmap = bitmapandmask->bitmap;
+    mask = bitmapandmask->mask;
+    
+    PublishImageL( aPlugin, aDestination, bitmap->Handle() , mask->Handle()); 
+    MPX_DEBUG1("CMusicContentPublisher::PublishImageL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Publishes a text from path to the required destination
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::PublishTextL( CMCPPlugin* aPlugin, 
+        TMCPTextDestination aDestination, 
+        const TDesC& aText )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::PublishTextL <---");
+    if( iCPSInterface && iActivePlugin == aPlugin)
+        {
+        CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
+        CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+        
+        TPtrC8 dataKey;
+        TPtrC type;
+        TPtrC content;
+        MapEnumToDestinationInfoL(aDestination, type, dataKey, content);
+        
+        TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
+        inParam->AppendL( cptype );
+        CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
+        CLiwDefaultMap * map = CLiwDefaultMap::NewLC( );
+        
+        if (KErrNotFound == aText.Find(KLoc))
+            {
+            map->InsertL( dataKey , TLiwVariant( aText ) );    
+            }
+        else
+            {
+            if ( ! aText.Compare( KNowPlaying ) )
+                {
+                map->InsertL( dataKey , TLiwVariant( iNowPlayingBuffer ) );
+                }
+            else if ( ! aText.Compare( KLastPlayed ) )
+                {
+                map->InsertL( dataKey , TLiwVariant( iLastPlayedBuffer ) );
+                }
+            else
+                {
+                map->InsertL( dataKey , TLiwVariant( aText ) );
+                }
+            }
+        
+        cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
+        cpdatamap->InsertL( KContentType , TLiwVariant( type ) );
+        cpdatamap->InsertL( KContentId  , TLiwVariant( content ) );
+        cpdatamap->InsertL( KDataMap  , TLiwVariant( map ) );
+        
+        TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
+        inParam->AppendL( item );
+        
+        if ( aDestination >= EMusicMenuMusicInfoLine1 )
+            {
+            if (aText  != KEmpty)
+                {
+                iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+                }
+            else
+                {
+                iCPSInterface->ExecuteCmdL( KDelete , *inParam, *outParam);
+                }
+            }
+        else
+            {
+            if ( iIsPublisherActive )
+                {
+                iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );        	
+                }
+            TMyBufferItem* ptr;
+            ptr = iPublishingDataBuffers.Find(aDestination);
+            if (ptr) //remove the old one
+                {
+                User::Free(ptr->buf);
+                iPublishingDataBuffers.Remove(aDestination);
+                }
+            TInt sz = map->Size();
+            TMyBufferItem bufferitem;
+            bufferitem.size = map->Size();
+            bufferitem.buf = User::AllocL(map->Size());
+            RMemWriteStream ws(bufferitem.buf, bufferitem.size);
+            map->ExternalizeL(ws);
+            iPublishingDataBuffers.Insert(aDestination, bufferitem);
+            }
+        CleanupStack::PopAndDestroy( map );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        CleanupStack::PopAndDestroy( outParam );
+        CleanupStack::PopAndDestroy( inParam );
+        }  
+    MPX_DEBUG1("CMusicContentPublisher::PublishTextL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Publishes an action from a trigger map to the required destination
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::PublishActionL( CMCPPlugin* aPlugin, 
+        TMCPTriggerDestination aDestination,
+        CLiwDefaultMap* aTriggerMap )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::PublishActionL <---");
+     if( iCPSInterface && iActivePlugin == aPlugin)
+        {
+        CLiwGenericParamList * inParam = CLiwGenericParamList::NewLC();
+        CLiwGenericParamList * outParam = CLiwGenericParamList::NewLC();
+        
+        TPtrC8 triggerKey;
+        TPtrC hostType;
+        TPtrC hostContent;
+        
+        MapEnumToDestinationInfoL(aDestination, hostType, triggerKey, 
+                hostContent);
+        
+        TLiwGenericParam cptype( KType , TLiwVariant( KCpData ) );
+        inParam->AppendL( cptype );
+        
+        CLiwDefaultMap * cpdatamap = CLiwDefaultMap::NewLC( );
+        cpdatamap->InsertL( KPublisherId , TLiwVariant( KMWPublisher ) );
+        cpdatamap->InsertL( KContentType , TLiwVariant( hostType ) );
+        cpdatamap->InsertL( KContentId  , TLiwVariant( hostContent ) );
+        
+        CLiwDefaultMap * actionmap = CLiwDefaultMap::NewLC( );
+        actionmap->InsertL( triggerKey , TLiwVariant( aTriggerMap ) );
+        cpdatamap->InsertL( KActionMap  , TLiwVariant( actionmap ) );
+        
+        TLiwGenericParam item( KItem, TLiwVariant( cpdatamap ) ); 
+        inParam->AppendL( item );
+        
+        if ( aDestination >= EMusicMenuMusicInfoTrigger )
+            {
+            iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+            }
+        else
+            {
+            if ( iIsPublisherActive )
+                {
+            	  iCPSInterface->ExecuteCmdL( KAdd , *inParam, *outParam );
+                }
+            TMyBufferItem* ptr;
+            ptr = iPublishingActionBuffers.Find(aDestination);
+            if (ptr) //remove the old one
+                {
+                User::Free(ptr->buf);
+                iPublishingActionBuffers.Remove(aDestination);
+                }
+            TInt sz = actionmap->Size();
+            TMyBufferItem bufferitem;
+            bufferitem.size = actionmap->Size();
+            bufferitem.buf = User::AllocL(actionmap->Size());
+            RMemWriteStream ws(bufferitem.buf, bufferitem.size);
+            actionmap->ExternalizeL(ws);
+            iPublishingActionBuffers.Insert(aDestination, bufferitem);
+            }
+        CleanupStack::PopAndDestroy( actionmap );
+        CleanupStack::PopAndDestroy( cpdatamap );
+        CleanupStack::PopAndDestroy( outParam );
+        CleanupStack::PopAndDestroy( inParam );
+        }
+    MPX_DEBUG1("CMusicContentPublisher::PublishActionL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Called when a plugin becomes active, it deactivates the previous plugin.
+// ---------------------------------------------------------------------------
+//
+void CMusicContentPublisher::BecameActiveL( CMCPPlugin* aPlugin )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::BecameActiveL <---");
+    if ( iActivePlugin != aPlugin )
+        {
+        if ( iActivePlugin )
+            {
+            MPX_DEBUG1("CMusicContentPublisher::BecameActiveL deactivating old plugin");
+            iActivePlugin->Deactivate();
+            MPX_DEBUG1("CMusicContentPublisher::BecameActiveL plugin deactivated");
+            PublishImageL( iActivePlugin, EMusicMenuMusicInfoImage1, KEmpty );
+            }
+        iActivePlugin = aPlugin;
+        }
+    MPX_DEBUG1("CMusicContentPublisher::BecameActiveL --->");
+    }
+// ---------------------------------------------------------------------------
+// From CContentHarvesterPlugin
+// This function updates information in CPS storage
+// ---------------------------------------------------------------------------
+//    
+void CMusicContentPublisher::UpdateL() 
+    {
+    MPX_DEBUG1("CMusicContentPublisher::UpdateL <---");
+    if ( !iPluginManager )
+        {
+        MPX_DEBUG1("CMusicContentPublisher::UpdateL creating the plugin manager");
+        iPluginManager = CPluginManager::NewL(
+                TUid::Uid( KMCPPluginUid ), 
+                static_cast<MMCPPluginObserver*>( this ),
+                this );
+        }
+    MPX_DEBUG1("CMusicContentPublisher::UpdateL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// From MAknsSkinChangeObserver.
+// Called by the skin server when skin content is changed and the
+// connected client wants to be informed.
+// ---------------------------------------------------------------------------
+// 
+void CMusicContentPublisher::SkinContentChanged()
+    {
+    MPX_DEBUG1("CMusicContentPublisher::SkinContentChanged <---");
+    ResetBitmapCache();
+    if(iActivePlugin)
+        {
+        iActivePlugin->SkinChanged();
+        }
+    MPX_DEBUG1("CMusicContentPublisher::SkinContentChanged --->");
+    }
+
+void CMusicContentPublisher::HandlePublisherNotificationL( const TDesC& aContentId, const TDesC8& aTrigger )
+    {
+    MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL <---");
+    if ( aTrigger == KMyActive )
+        {
+        MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL activate");
+        if ( !iInstanceId )
+            {
+            iInstanceId = aContentId.AllocL();
+        	  //Reset The Widget
+        	  MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL activate --> Reset Widget");
+        	  RDebug::Print(aContentId);
+            PublishImageL(NULL,EMusicWidgetImage1,KEmpty);
+        	InstallGoToAlbumL( EMusicWidgetTrigger1 );
+            PublishTextL( NULL,EMusicWidgetText1, KEmpty );
+            PublishImageL(NULL,EMusicWidgetToolbarB1,KEmpty);
+            PublishImageL(NULL,EMusicWidgetToolbarB2,KEmpty);
+            PublishImageL(NULL,EMusicWidgetToolbarB3,KEmpty);
+            InstallEmptyActionL(EMusicWidgetTB1Trigger);
+            InstallEmptyActionL(EMusicWidgetTB2Trigger);
+            InstallEmptyActionL(EMusicWidgetTB3Trigger);
+            PublishTextL( NULL,EMusicWidgetDefaultText, iGoToMusicBuffer->Des() );
+			InstallGoToAlbumL( EMusicWidgetTrigger2 );
+            }
+        else
+            {
+            delete iInstanceId;
+            iInstanceId = NULL;
+            iInstanceId = aContentId.AllocL();
+            }
+        }
+    else if ( aTrigger ==  KMyDeActive)
+        {
+        MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL deactivate");
+        //Removing al the CPS entrys to prevent flicker of old text and unwanted images (old/expired handles).
+        RemoveL( EMusicWidgetImage1 );
+        RemoveL( EMusicWidgetText1 );
+        RemoveL( EMusicWidgetToolbarB1 );
+        RemoveL( EMusicWidgetToolbarB2 );
+        RemoveL( EMusicWidgetToolbarB3 );
+        RemoveL( EMusicWidgetDefaultText );
+        }
+    else if ( aTrigger ==  KMySuspend)
+        {
+        MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL suspend");
+        iIsPublisherActive = EFalse;
+        }
+    else if ( aTrigger ==  KMyResume)
+        {
+        MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL resume");
+        iIsPublisherActive = ETrue;
+        DoPublishL();
+        }
+    MPX_DEBUG1("CMusicContentPublisher::HandlePublisherNotificationL --->");
+    }
+
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/src/pluginmanager.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,250 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Plugin manager, responsible to load the plugins.
+*
+*/
+
+#include <mpxlog.h>                     // MPX_DEBUG
+#include <ecom/ecom.h>
+// for CeanupResetAndDestroyPushL
+#include <mmf/common/mmfcontrollerpluginresolver.h>
+
+#include "musiccontentpublisher.h"
+#include "pluginmanager.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CPluginManager::CPluginManager( TUid aUid, 
+        TAny* aParameter, 
+        CMusicContentPublisher* aContentPublisher) :
+                CActive( EPriorityStandard ), 
+                iUid( aUid ), 
+                iParameter( aParameter ), 
+                iContentPublisher(aContentPublisher)
+    {
+    }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void CPluginManager::ConstructL()
+    {
+    MPX_DEBUG1("CPluginManager::ConstructL <---");
+    iSession = &REComSession::OpenL();
+    LoadPluginsL();
+    iSession->NotifyOnChange( iStatus );
+    CActiveScheduler::Add( this );
+    SetActive();
+    MPX_DEBUG1("CPluginManager::ConstructL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CPluginManager* CPluginManager::NewL( TUid aUid, 
+        TAny *aParameter, 
+        CMusicContentPublisher* aContentPublisher )
+    {
+    CPluginManager* self = CPluginManager::NewLC( aUid, 
+            aParameter, 
+            aContentPublisher );
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CPluginManager* CPluginManager::NewLC( TUid aUid, 
+        TAny *aParameter,
+        CMusicContentPublisher* aContentPublisher )
+    {
+    CPluginManager* self = new( ELeave ) CPluginManager( aUid, 
+            aParameter, 
+            aContentPublisher );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// destructor
+// ---------------------------------------------------------------------------
+CPluginManager::~CPluginManager()
+    {
+    MPX_DEBUG1("CPluginManager::~CPluginManager <---");
+    Cancel();
+    CleanPluginsTable();
+    iPluginMap.Close();
+    if ( iSession )
+        {
+        iSession->Close();
+        }
+    REComSession::FinalClose();
+    MPX_DEBUG1("CPluginManager::~CPluginManager --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Retuns a plugin by UID
+// ---------------------------------------------------------------------------
+//
+TAny* CPluginManager::GetImplementation( TUid aUid )
+    {
+    TInt32 key = aUid.iUid;
+    TAny* ret= NULL;
+    TAny** imp= NULL;
+    imp = iPluginMap.Find( key );
+    if ( imp )
+        {
+        ret = *imp;
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Retuns a plugin by index
+// ---------------------------------------------------------------------------
+//
+TAny* CPluginManager::GetImplementation( TInt aIndex )
+    {
+    TAny* ret= NULL;
+    THashMapIter<TInt32, TAny*> iter( iPluginMap );
+    TAny*const* ptr = iter.NextValue();
+    for ( TInt i( 0 ); ptr; i++ )
+        {
+        if ( i == aIndex )
+            {
+            ret = *ptr;
+            break;
+            }
+        ptr = iter.NextValue();
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
+// Returns the count of the plug-ins.
+// ---------------------------------------------------------------------------
+//
+TInt CPluginManager::GetCount()
+    {
+    return iPluginMap.Count();
+    }
+
+// ---------------------------------------------------------------------------
+// Loads the plugins.
+// ---------------------------------------------------------------------------
+//
+void CPluginManager::LoadPluginsL()
+    {
+    MPX_DEBUG1("CPluginManager::LoadPluginsL <---");
+    // Read info about all implementations into infoArray
+    RImplInfoPtrArray infoArray;
+    CleanupResetAndDestroyPushL( infoArray );
+
+    REComSession::ListImplementationsL( iUid, infoArray );
+    for ( TInt i = 0; i < infoArray.Count(); i++ )
+        {
+        TUid current_plugin = infoArray[i]->ImplementationUid();
+        TAny* plug( NULL );
+        TUid temp;
+        TInt err( KErrNone );
+        TRAP( err, plug = REComSession::CreateImplementationL(
+                        current_plugin,
+                        temp,
+                        iParameter ) );
+        if ( err == KErrNone && plug )
+            {
+            CleanupStack::PushL( plug );
+            TInt32 key = current_plugin.iUid;
+            iPluginMap.InsertL( key, plug );
+            CleanupStack::Pop( plug );
+            }
+        }
+
+    CleanupStack::PopAndDestroy( &infoArray );
+    MPX_DEBUG1("CPluginManager::LoadPluginsL --->");
+    }
+
+// ---------------------------------------------------------------------------
+// Unloads the plgugins.
+// ---------------------------------------------------------------------------
+//        
+void CPluginManager::CleanPluginsTable()
+    {
+    MPX_DEBUG1("CPluginManager::CleanPluginsTable <---");
+    THashMapIter<TInt32, TAny*> iter( iPluginMap );
+    TAny*const* ptr = iter.NextValue();
+    CBase* plug( NULL );
+    const TInt32* pluginUid( NULL );
+    while ( ptr )
+        {
+        plug = static_cast<CBase*>( *ptr );
+        delete plug;
+        plug = NULL;
+        pluginUid = iter.CurrentKey();
+        REComSession::DestroyedImplementation( TUid::Uid( *pluginUid ) );
+        ptr = iter.NextValue();
+        pluginUid = NULL;
+        }
+    MPX_DEBUG1("CPluginManager::CleanPluginsTable --->");
+    }
+
+// ---------------------------------------------------------------------------
+//From CActive
+// ---------------------------------------------------------------------------
+//
+void CPluginManager::RunL()
+    {
+    MPX_DEBUG1("CPluginManager::RunL <---");
+    CleanPluginsTable();
+    iPluginMap.Close();
+    iContentPublisher->ResetL();
+    LoadPluginsL();
+    iSession->NotifyOnChange( iStatus );
+    SetActive();
+    MPX_DEBUG1("CPluginManager::RunL --->");
+    }
+
+// ---------------------------------------------------------------------------
+//From CActive
+// ---------------------------------------------------------------------------
+//
+void CPluginManager::DoCancel()
+    {
+    MPX_DEBUG1("CPluginManager::DoCancel <---");
+    iSession->CancelNotifyOnChange( iStatus );
+    MPX_DEBUG1("CPluginManager::DoCancel --->");
+    }
+
+// ---------------------------------------------------------------------------
+//From CActive
+// ---------------------------------------------------------------------------
+//
+TInt CPluginManager::RunError( TInt /*aError*/ )
+    {
+    MPX_DEBUG1("CPluginManager::RunError <---");
+    MPX_DEBUG1("CPluginManager::RunError --->");
+    return KErrNone;
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musiccontentpublisher/src/proxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Content Publisher Implementation Proxy
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "musiccontentpublisher.h"
+#include "musiccontentpublisheruids.hrh"
+
+// ---------------------------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KMusicContentPublisherUID,
+            CMusicContentPublisher::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// Exported proxy for instantiation method resolution
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+        TInt& aTableCount )
+    {
+    aTableCount =
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+
+    return ImplementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musicplayeractionhandlerplugin/data/musicplayeractionhandlerplugin.rss	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM registration for Music Player Action Handler Plugin
+*
+*/
+
+
+#include <registryinfo.rh>
+#include <ahpluginuids.hrh>
+#include "musicplayeractionhandleruids.hrh"
+
+// ---------------------------------------------------------------------------
+// MusicPlayerActionHandlerPluginInfo
+// Declares info for implementation of the plugin
+// ---------------------------------------------------------------------------
+//
+RESOURCE REGISTRY_INFO MusicPlayerActionHandlerPluginInfo
+    {
+    // UID for the DLL
+    dll_uid = KMusicPlayerActionHandlerDLL;
+    // Declare array of interface info
+    interfaces =
+        {
+        INTERFACE_INFO
+            {
+            // UID of interface that is implemented
+            interface_uid = KAHPluginInterfaceUid;
+            implementations =
+                {
+                IMPLEMENTATION_INFO
+                    {
+                    implementation_uid = KMusicPlayerActionHandlerUID;
+                    version_no = 1;
+                    display_name = "";
+                    default_data = "";
+                    opaque_data = "";
+                    }
+                };
+            }
+        };
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musicplayeractionhandlerplugin/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for Music Player Action Handler Plugin
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../rom/musicplayeractionhandlerplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(musicplayeractionhandlerplugin.iby)
+
+PRJ_MMPFILES
+musicplayeractionhandlerplugin.mmp
+
+PRJ_TESTMMPFILES
+PRJ_TESTEXPORTS
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musicplayeractionhandlerplugin/group/musicplayeractionhandlerplugin.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for Music Player ActionHandlerPlugin
+*
+*/
+
+
+
+#include <platform_paths.hrh>
+#include "../inc/musicplayeractionhandleruids.hrh"
+
+TARGET                  musicplayeractionhandlerplugin.dll
+TARGETTYPE              PLUGIN
+UID                     0x10009D8D KMusicPlayerActionHandlerDLL 
+
+CAPABILITY              CAP_ECOM_PLUGIN
+VENDORID                VID_DEFAULT
+
+SOURCEPATH              ../src
+SOURCE                  proxy.cpp
+SOURCE                  musicplayeractionhandler.cpp
+
+USERINCLUDE             ../inc
+
+APP_LAYER_SYSTEMINCLUDE
+SYSTEMINCLUDE           /epoc32/include/ecom
+
+SOURCEPATH              ../data
+START RESOURCE          musicplayeractionhandlerplugin.rss
+HEADER
+TARGET                  musicplayeractionhandlerplugin.rsc
+TARGETPATH              resource/plugins 
+END
+
+LIBRARY                 euser.lib
+LIBRARY                 liwservicehandler.lib   // TLiwVariant
+LIBRARY                 ws32.lib                // RWsSession
+LIBRARY                 apgrfx.lib              // TApaTask, TApaTaskList, RApaLsSession
+LIBRARY                 apparc.lib              // CApaCommandLine, TApaAppInfo
+LIBRARY                 estor.lib               // RBufWriteStream, RWriteStream
+LIBRARY                 mpxcommon.lib           // CMPXparameter
+LIBRARY                 mpxplaybackutility.lib  // MMPXPlaybackUtility
+LIBRARY                 mpxcommonui.lib         // Common UI helpers
+LIBRARY                 mpxcollectionhelper.lib // Collection helpers
+LIBRARY                 avkon.lib               // CAknTaskList
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musicplayeractionhandlerplugin/inc/musicplayeractionhandler.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,140 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player Action Handler Plugin
+*
+*/
+
+
+#ifndef C_MUSICPLAYERACTIONHANDLER_H
+#define C_MUSICPLAYERACTIONHANDLER_H
+
+#include <ahplugin.h>
+
+// FORWARD DECLARATION
+class CLiwMap;
+class TLiwVariant;
+class MMPXPlaybackUtility;
+
+/**
+ *  Music Player Action Handler Plugin.
+ *  Class extends the CAHPlugin in order to be used as a plugin for
+ *  action handler.
+ *  @since S60 S60 v5.0
+ */
+NONSHARABLE_CLASS( CMusicPlayerActionHandler ) : public CAHPlugin
+    {
+public:
+
+    /**
+     * Standard Symbian 2 phase constructor
+     */
+    static CMusicPlayerActionHandler* NewL();
+
+    /**
+     * Standard Symbian 2 phase constructor
+     */
+    static CMusicPlayerActionHandler* NewLC();
+
+    /**
+     * Standard C++ destructor.
+     */
+    ~CMusicPlayerActionHandler();
+
+// from base class CAHPlugin
+
+    /**
+     * From CAHPlugin
+     * This is called by the AH to execute an action 
+     * @param aMap an action object to be executed
+     * @return Error code
+     */
+    TInt ExecuteActionL( const CLiwMap* aMap );
+
+private:
+    /**
+     * Standard Symbian 2nd phase constructor.
+     */
+    void ConstructL();
+
+    /**
+     * Executes Playback command on the current player.
+     * @param aMap an action object to be executed
+     * @return status code
+     */
+    TInt ExecutePlaybackCommandL( const CLiwMap* aMap );
+
+    /**
+     * Sends a message to Music Player.
+     * @param aMap an action object to be executed
+     * @return status code
+     */
+    TInt ExecuteMessageToMusicPlayerL( const CLiwMap* aMap );
+
+    /**
+     * goes to now-playing view
+     * @return status code
+     */
+    TInt GoToNowPlayingL();
+    
+    /**
+     * goes to The last Played song.
+     * @param aMinimized indicates if app should be in the background.
+     * @return status code
+     */
+    TInt GoToLastPlayedL(TBool aMinimazed);
+    
+    /**
+     * goes to library/collection view
+     * @return status code
+     */
+    TInt GoToMusicLibraryL();
+    
+    /**
+     * goes to Album & Artist view
+     * @return status code
+     */
+    TInt GoToAlbumViewL();
+    
+    /**
+     * Gets a descriptor from the map.
+     * @param aMap containing the data.
+     * @param aString where the data is extracted to.
+     * @param aMapName element of the map that is to be extracted.
+     * @return status code
+     */
+    TInt ExtractDesL( const CLiwMap* aMap, RBuf& aString,
+            const TDesC8& aMapName );
+
+    /**
+     * Gets a variant from the map.
+     * @param aMap containing the data.
+     * @param aVariant where the data is extracted to.
+     * @param aMapName element of the map that is to be extracted.
+     * @return status code
+     */
+    TInt ExtractVariantL( const CLiwMap* aMap, TLiwVariant& aVariant,
+            const TDesC8& aMapName );
+
+private: // data
+
+    /**
+     * The playback utility where playback operations are performed.
+     * Own.
+     */
+    MMPXPlaybackUtility* iPlaybackUtility;
+    };
+
+#endif /* C_MUSICPLAYERACTIONHANDLER_H */
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musicplayeractionhandlerplugin/inc/musicplayeractionhandleruids.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for Musci Playe ActionHandler Plugin
+*
+*/
+
+
+#ifndef MUSICPLAYERACTIONHANDLERUIDS_H_
+#define MUSICPLAYERACTIONHANDLERUIDS_H_
+
+/** Ecom implementation uid for Music Player Action Handler Plugin */
+#define KMusicPlayerActionHandlerUID 0x10207C16
+
+/** Ecom dll uid for Music Player Action Handler Plugin */
+#define KMusicPlayerActionHandlerDLL 0x10207C17
+
+#endif /*MUSICPLAYERACTIONHANDLERUIDS_H_*/
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musicplayeractionhandlerplugin/rom/musicplayeractionhandlerplugin.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Player Action Handler Plugin
+*
+*/
+
+
+#ifndef MUSICPLAYERACTIONHANDLERPLUGIN_IBY
+#define MUSICPLAYERACTIONHANDLERPLUGIN_IBY
+
+ECOM_PLUGIN(musicplayeractionhandlerplugin.dll, musicplayeractionhandlerplugin.rsc)
+
+#endif // MUSICPLAYERACTIONHANDLERPLUGIN_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musicplayeractionhandlerplugin/src/musicplayeractionhandler.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,501 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player Action Handler Plugin
+*
+*/
+
+
+#include <liwvariant.h>                 // TLiwVariant
+#include <apgcli.h>                     // RApaLsSession, TApaAppInfo
+#include <apacmdln.h>                   // CApaCommandLine
+#include <apgtask.h>                    // TApaTaskList
+#include <mpxlog.h>                     // MPX_DEBUG
+#include <mpxparameter.h>               // CMPXParameter
+#include <mpxplaybackutility.h>         // MMPXPlaybackUtility
+#include <mpxconstants.h>               // KAppUidMusicPlayerX
+#include <mpxmusicplayerviewplugin.hrh> // KMPXPluginTypePlaybackUid
+#include <AknTaskList.h>                // CAknTaskList
+
+#include <mpxcommonuihelper.h>
+#include <mpxcollectionhelperfactory.h>
+#include "musicplayeractionhandler.h"
+#include <mpxcollectionpath.h>
+
+
+
+
+const TInt KPlayerMusicPlayerParameterGranularity = 50;
+const TUid  KMusicPlayerAppUid = { 0x102072C3 };
+
+// RProperty key to identify the case when Music Player launching
+// in the background
+const TInt KMPXLaunchingOnBackground( 100 );
+
+//map values
+_LIT( KActionPlaybackCommand , "PlaybackCommand" );
+_LIT( KactionMessageToMusicPlayer, "MessageToMusicPlayer" );
+_LIT( KGoToNowPlaying, "GoToNowPlaying" );
+_LIT( KGoToLastPlayed, "GoToLastPlayed" );
+_LIT( KGoToLastPlayedMinimized, "GoToLastPlayedMinimized" );
+_LIT( KGoToMusicLibrary, "GoToMusicLibrary" );
+_LIT( KGoToAlbumView, "GoToAlbumView" );
+
+//map keys
+_LIT8( KType, "type" );
+_LIT8( KCommand, "command" );
+_LIT8( KMessage, "message" );
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void CMusicPlayerActionHandler::ConstructL()
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::ConstructL()");
+    
+    //iPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeActivePlayer );
+    iPlaybackUtility = MMPXPlaybackUtility::NewL( KMusicPlayerAppUid);
+
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::ConstructL()");
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMusicPlayerActionHandler* CMusicPlayerActionHandler::NewL()
+    {
+    CMusicPlayerActionHandler* self = CMusicPlayerActionHandler::NewLC();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+CMusicPlayerActionHandler* CMusicPlayerActionHandler::NewLC()
+    {
+    CMusicPlayerActionHandler* self = new( ELeave ) CMusicPlayerActionHandler;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// destructor
+// ---------------------------------------------------------------------------
+//
+CMusicPlayerActionHandler::~CMusicPlayerActionHandler()
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::~CMusicPlayerActionHandler()");
+    if ( iPlaybackUtility )
+        {
+        iPlaybackUtility->Close();
+        }
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::~CMusicPlayerActionHandler()");
+    }
+
+// ---------------------------------------------------------------------------
+// Executes Playback command on current player
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::ExecutePlaybackCommandL(const CLiwMap* aMap)
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::ExecutePlaybackCommandL()");
+    TInt errCode;
+    TLiwVariant variant;
+    variant.PushL();
+    errCode = ExtractVariantL( aMap, variant, KCommand );
+    if ( errCode == KErrNone )
+        {
+        TMPXPlaybackCommand Command;
+        Command = static_cast<TMPXPlaybackCommand>( variant.AsTInt32() );
+        iPlaybackUtility->CommandL( Command );
+        }
+    CleanupStack::PopAndDestroy( &variant);
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::ExecutePlaybackCommandL()");
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// Sends a message to music player
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::ExecuteMessageToMusicPlayerL(
+        const CLiwMap* aMap )
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::"
+            "ExecuteMessageToMusicPlayerL()");
+    TInt errCode;
+    RBuf msg;
+    CleanupClosePushL( msg );
+    errCode = ExtractDesL( aMap, msg, KMessage );
+    if ( errCode == KErrNone )
+        {
+        if ( ! msg.CompareF( KGoToNowPlaying ) )
+            {
+            errCode = GoToNowPlayingL();
+            }
+        else if ( ! msg.CompareF( KGoToLastPlayed ) )
+            {
+            errCode = GoToLastPlayedL( EFalse );
+            }
+        else if ( ! msg.CompareF( KGoToLastPlayedMinimized ) )
+            {
+            errCode = GoToLastPlayedL( ETrue );
+            }
+        else if ( ! msg.CompareF( KGoToMusicLibrary ) )
+            {
+            errCode = GoToMusicLibraryL();
+            }  
+        else if ( ! msg.CompareF( KGoToAlbumView ) )
+        	{
+            errCode = GoToAlbumViewL();
+            } 
+        }
+    CleanupStack::PopAndDestroy( &msg );
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::"
+            "ExecuteMessageToMusicPlayerL()");
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// Opens musicplayer in library view, even if it is already open and playing.
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::GoToMusicLibraryL()
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::GoToMusicLibraryL()");
+    //Launch player
+    RWsSession wsSession;
+    User::LeaveIfError( wsSession.Connect() );
+    CAknTaskList *taskList = CAknTaskList::NewL( wsSession );
+    TApaTask task = taskList->FindRootApp( KAppUidMusicPlayerX );
+    delete taskList;
+    CMPXParameter* param = new ( ELeave ) CMPXParameter();
+    CleanupStack::PushL( param );
+    param->iType.iUid = KMPXPluginTypeCollectionUid;
+    param->iCmdForward = EMPXCmdFwdNone;
+
+    MMPXCollectionUiHelper* collectionHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+    CMPXCollectionPath* path = collectionHelper->MusicMenuPathL();
+	path->AppendL(3); // Albums
+    if (path)
+        {
+        param->iCollectionPath = path;
+        param->iPathType = EMPXTypeCollectionPath;
+        }
+    collectionHelper->Close();
+    
+    CBufBase* buffer =
+            CBufFlat::NewL( KPlayerMusicPlayerParameterGranularity );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream writeStream( *buffer );
+    CleanupClosePushL( writeStream );
+    param->ExternalizeL( writeStream );
+    writeStream.CommitL();
+    buffer->Compress();
+    CleanupStack::PopAndDestroy( &writeStream );
+    if ( task.Exists() )
+        {
+//        task.SendMessage( KAppUidMusicPlayerX, buffer->Ptr( 0 ));
+        wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX,
+                    buffer->Ptr( 0 ) );
+        }
+    else        //Application needs to be launched. The first view is library view.
+        {
+        // Launch Music Player Application
+        RApaLsSession   appArcSession;
+        _LIT(KEmpty,"");
+        User::LeaveIfError(appArcSession.Connect());    // connect to AppArc server
+        TThreadId id;
+        appArcSession.StartDocument( KEmpty, KAppUidMusicPlayerX, id );
+        appArcSession.Close();                                
+        }
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PopAndDestroy( param );
+    wsSession.Close();
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::GoToMusicLibraryL()");
+    return KErrNone;
+    }
+	
+// ---------------------------------------------------------------------------
+// Opens musicplayer in Album and Artist view, even if it is already open and playing.
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::GoToAlbumViewL()
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::GoToAlbumViewL()");
+    //Launch player
+    RWsSession wsSession;
+    User::LeaveIfError( wsSession.Connect() );
+    CAknTaskList *taskList = CAknTaskList::NewL( wsSession );
+    TApaTask task = taskList->FindRootApp( KAppUidMusicPlayerX );
+    delete taskList;
+    CMPXParameter* param = new ( ELeave ) CMPXParameter();
+    CleanupStack::PushL( param );
+    param->iType.iUid = KMPXPluginTypeCollectionUid;
+    param->iCmdForward = EMPXCmdFwdNone;
+   
+    MMPXCollectionUiHelper* collectionHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+    CMPXCollectionPath* path = collectionHelper->MusicMenuPathL();
+    path->AppendL(3); // Albums
+    if (path)
+        {
+        param->iCollectionPath = path;
+        param->iPathType = EMPXTypeCollectionPath;
+        }
+    collectionHelper->Close();
+    
+    CBufBase* buffer =
+            CBufFlat::NewL( KPlayerMusicPlayerParameterGranularity );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream writeStream( *buffer );
+    CleanupClosePushL( writeStream );
+    param->ExternalizeL( writeStream );
+    writeStream.CommitL();
+    buffer->Compress();
+    CleanupStack::PopAndDestroy( &writeStream );
+    if ( task.Exists() )
+        {
+//        task.SendMessage( KAppUidMusicPlayerX, buffer->Ptr( 0 ));
+        wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX,
+                    buffer->Ptr( 0 ) );
+        }
+    else        //Application needs to be launched. The first view is library view.
+        {
+        // Launch Music Player Application
+        RApaLsSession   appArcSession;
+        _LIT(KEmpty,"");
+        User::LeaveIfError(appArcSession.Connect());    // connect to AppArc server
+        TThreadId id;
+        appArcSession.StartDocument( KEmpty, KAppUidMusicPlayerX, id );
+        appArcSession.Close();                                
+        }
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PopAndDestroy( param );
+    wsSession.Close();
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::GoToAlbumViewL()");
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Opens musicplayer, if it is already open and playing it goes to nowplaying.
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::GoToNowPlayingL()
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::GoToNowPlayingL()");
+    //Launch player
+    RWsSession wsSession;
+    User::LeaveIfError( wsSession.Connect() );
+    CAknTaskList *taskList = CAknTaskList::NewL( wsSession );
+    TApaTask task = taskList->FindRootApp( KAppUidMusicPlayerX );
+    delete taskList;
+    CMPXParameter* param = new ( ELeave ) CMPXParameter();
+    CleanupStack::PushL( param );
+    param->iType.iUid = KMPXPluginTypePlaybackUid;
+    param->iCmdForward = EMPXCmdFwdNone;
+    CBufBase* buffer =
+            CBufFlat::NewL( KPlayerMusicPlayerParameterGranularity );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream writeStream( *buffer );
+    CleanupClosePushL( writeStream );
+    param->ExternalizeL( writeStream );
+    writeStream.CommitL();
+    buffer->Compress();
+    CleanupStack::PopAndDestroy( &writeStream );
+    if ( task.Exists() )
+        {
+        wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX,
+                    buffer->Ptr( 0 ) );
+        
+        
+        }
+    else
+        {
+        RApaLsSession ls;
+        CleanupClosePushL( ls );
+        User::LeaveIfError( ls.Connect() );
+        TApaAppInfo appInfo;
+        User::LeaveIfError( ls.GetAppInfo( appInfo, KAppUidMusicPlayerX ) );
+        CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC();
+        apaCommandLine->SetExecutableNameL( appInfo.iFullName );
+        apaCommandLine->SetTailEndL( buffer->Ptr( 0 ) );
+        User::LeaveIfError( ls.StartApp( *apaCommandLine ) );
+        CleanupStack::PopAndDestroy(); // apaCommandLine
+        CleanupStack::PopAndDestroy(); // ls
+        }
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PopAndDestroy( param );
+    wsSession.Close();
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::GoToNowPlayingL()");
+    return KErrNone;
+    }
+
+
+// ---------------------------------------------------------------------------
+// Opens Stand alone MP and goes to now playing, it will display last played
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::GoToLastPlayedL( TBool aMinimized )
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::GoToLastPlayed()");
+    //Launch player
+    RWsSession wsSession;
+    User::LeaveIfError( wsSession.Connect() );
+    CAknTaskList *taskList = CAknTaskList::NewL( wsSession );
+    TApaTask task = taskList->FindRootApp( KAppUidMusicPlayerX );
+    delete taskList;
+    CMPXParameter* param = new ( ELeave ) CMPXParameter();
+    CleanupStack::PushL( param );
+    param->iType.iUid = KMPXPluginTypeLastPlayedUid;//KMPXPluginTypePlaybackUid;
+    param->iCmdForward = EMPXCmdFwdNone;
+    CBufBase* buffer =
+            CBufFlat::NewL( KPlayerMusicPlayerParameterGranularity );
+    CleanupStack::PushL( buffer );
+    RBufWriteStream writeStream( *buffer );
+    CleanupClosePushL( writeStream );
+    param->ExternalizeL( writeStream );
+    writeStream.CommitL();
+    buffer->Compress();
+    CleanupStack::PopAndDestroy( &writeStream );
+    if ( task.Exists() )
+        {
+        wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX,
+                    buffer->Ptr( 0 ) );
+        if (!aMinimized)
+            {
+            task.BringToForeground();
+            }
+        }
+    else
+        {
+        RApaLsSession ls;
+        CleanupClosePushL( ls );
+        User::LeaveIfError( ls.Connect() );
+        TApaAppInfo appInfo;
+        User::LeaveIfError( ls.GetAppInfo( appInfo, KAppUidMusicPlayerX ) );
+        CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC();
+        if (aMinimized)
+            {
+            apaCommandLine->SetCommandL(EApaCommandBackground);
+            
+            TInt err( RProperty::Define(
+                KAppUidMusicPlayerX, KMPXLaunchingOnBackground, RProperty::EInt ) );
+            MPX_DEBUG2( "CMusicPlayerActionHandler::GoToLastPlayed() RProperty define err = %d", err );
+            if ( err == KErrNone || err == KErrAlreadyExists )
+                {
+                err = RProperty::Set( KAppUidMusicPlayerX,
+                            KMPXLaunchingOnBackground,
+                            ETrue );
+                MPX_DEBUG2( "CMusicPlayerActionHandler::GoToLastPlayed() RProperty set to true err = %d", err );
+                }
+            }
+        apaCommandLine->SetExecutableNameL( appInfo.iFullName );
+        apaCommandLine->SetTailEndL( buffer->Ptr( 0 ) );
+        User::LeaveIfError( ls.StartApp( *apaCommandLine ) );
+        CleanupStack::PopAndDestroy(); // apaCommandLine
+        CleanupStack::PopAndDestroy(); // ls
+        
+        if ( aMinimized )
+            {
+            TInt err = RProperty::Set( KAppUidMusicPlayerX,
+                        KMPXLaunchingOnBackground,
+                        EFalse );
+            MPX_DEBUG2( "CMusicPlayerActionHandler::GoToLastPlayed() RProperty set to false err = %d", err );
+            }
+        }
+    CleanupStack::PopAndDestroy( buffer );
+    CleanupStack::PopAndDestroy( param );
+    wsSession.Close();
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::GoToLastPlayed()");
+    return KErrNone;
+    }
+// ---------------------------------------------------------------------------
+// Extracts a descriptor
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::ExtractDesL( const CLiwMap* aMap,
+        RBuf& aString, const TDesC8& aMapName )
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::ExtractDesL()");
+    TInt errCode( KErrArgument );
+    TLiwVariant variant;
+    variant.PushL();
+    TPtrC tempString( KNullDesC );
+    if ( aMap->FindL( aMapName, variant) )
+        {
+        variant.Get( tempString );
+        aString.ReAllocL( tempString.Length() );
+        aString.Append( tempString );
+        errCode = KErrNone;
+        }
+    CleanupStack::PopAndDestroy( &variant );
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::ExtractDesL()");
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// Extract variant
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::ExtractVariantL( const CLiwMap* aMap,
+        TLiwVariant& aVariant, const TDesC8& aMapName )
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::ExtractVariantL()");
+    TInt errCode( KErrNone );
+    if ( ! aMap->FindL( aMapName, aVariant ) )
+        {
+        errCode = KErrArgument;
+        }
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::ExtractVariantL()");
+    return errCode;
+    }
+
+// ---------------------------------------------------------------------------
+// From CAHPlugin
+// Executes provided action
+// ---------------------------------------------------------------------------
+//
+TInt CMusicPlayerActionHandler::ExecuteActionL( const CLiwMap* aMap )
+    {
+    MPX_DEBUG1("-->CMusicPlayerActionHandler::ExecuteActionL()");
+    TInt errCode;
+    RBuf type;
+    CleanupClosePushL( type );
+    errCode = ExtractDesL( aMap, type, KType );
+    if ( errCode == KErrNone )
+        {
+        if ( ! type.CompareF( KActionPlaybackCommand ) )
+            {
+            errCode = ExecutePlaybackCommandL( aMap );
+            }
+        else
+            if ( ! type.CompareF( KactionMessageToMusicPlayer ) )
+                {
+                errCode = ExecuteMessageToMusicPlayerL( aMap );
+                }
+        }
+    CleanupStack::PopAndDestroy( &type );
+    MPX_DEBUG1("<--CMusicPlayerActionHandler::ExecuteActionL()");
+    return errCode;
+    }
+
+//  End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/musicplayeractionhandlerplugin/src/proxy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player Action Handler Plugin Implementation Proxy
+*
+*/
+
+
+#include <e32std.h>
+#include <implementationproxy.h>
+#include "musicplayeractionhandleruids.hrh"
+#include "musicplayeractionhandler.h"
+
+// ---------------------------------------------------------------------------
+// Map the interface UIDs to implementation factory functions
+// ---------------------------------------------------------------------------
+//
+const TImplementationProxy ImplementationTable[] =
+    {
+    IMPLEMENTATION_PROXY_ENTRY( KMusicPlayerActionHandlerUID,
+            CMusicPlayerActionHandler::NewL )
+    };
+
+// ---------------------------------------------------------------------------
+// Exported proxy for instantiation method resolution
+// ---------------------------------------------------------------------------
+//
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(
+        TInt& aTableCount )
+    {
+    aTableCount =
+        sizeof( ImplementationTable ) / sizeof( TImplementationProxy );
+
+    return ImplementationTable;
+    }
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/rom/musichomescreen.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Widget
+*
+*/
+
+
+#ifndef MUSICHOMESCREEN_IBY
+#define MUSICHOMESCREEN_IBY
+
+#include <bldvariant.hrh>
+
+
+
+//Music Widget with xuikon resource
+//data=\epoc32\release\winscw\udeb\Z\private\200159c0\themes\2456\270513751\270564376\1.0\mw.o0000  private\200159c0\themes\2456\270513751\270564376\1.0\mw.o0000
+//data=\epoc32\release\winscw\udeb\Z\private\200159c0\themes\2456\270513751\270564376\1.0\sources\musicwidget.o0000  private\200159c0\themes\2456\270513751\270564376\1.0\sources\musicwidget.o0000
+//data=\epoc32\release\winscw\udeb\Z\private\200159c0\themes\2456\270513751\270564376\1.0\sources\box_bg_1x1.svg  private\200159c0\themes\2456\270513751\270564376\1.0\sources\box_bg_1x1.svg
+
+//TEMP IMAGES
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_prop_image_tb_pause_dimmed2.png resource\apps\qgn_prop_image_tb_pause_dimmed2.png
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_prop_image_tb_play2_dimmed2.png resource\apps\qgn_prop_image_tb_play2_dimmed2.png
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_prop_image_tb_stop_dimmed2.png resource\apps\qgn_prop_image_tb_stop_dimmed2.png
+
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_indi_mup_home_pause.png resource\apps\qgn_indi_mup_home_pause.png
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_indi_mup_home_play.png resource\apps\qgn_indi_mup_home_play.png
+//data=\epoc32\release\winscw\udeb\Z\resource\apps\qgn_indi_mup_home_no_music.png resource\apps\qgn_indi_mup_home_no_music.png
+
+data=ZRESOURCE\apps\musichomescreenicons.mif APP_RESOURCE_DIR\musichomescreenicons.mif
+
+#endif // MUSICHOMESCREEN_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/rom/musichomescreenrsc.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Homescreen Resources
+*
+*/
+
+
+
+#ifndef MUSICHOMESCREENRSC_IBY
+#define MUSICHOMESCREENRSC_IBY
+
+data=DATAZ_\resource\apps\musichomescreen.rsc	resource\apps\musichomescreen.rsc
+
+#endif // MUSICHOMESCREENRSC_IBY
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/rom/musicmatrixmenu.iby	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  IBY file for the Music Suite for Matrix Menu
+*
+*/
+
+
+#ifndef MUSICMATRIXMENU_IBY
+#define MUSICMATRIXMENU_IBY
+
+data=\epoc32\include\musichomescreen.rsg resource\apps\musichomescreen.rsg
+data=\epoc32\data\z\private\101F4CD2\import\suites\musicsuite\suite.xml private\101F4CD2\import\suites\musicsuite\suite.xml
+data=\epoc32\data\z\private\101F4CD2\import\suites\musicsuite\music_matrix_items.xml private\101F4CD2\import\suites\musicsuite\music_matrix_items.xml
+
+#endif // MUSICMATRIXMENU_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/src/dummy.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,23 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: dummy
+*
+*/
+
+#include <e32def.h>
+
+EXPORT_C int E32Main()
+{
+	return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musichomescreen_multiview/src/mpxresource.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  This class provide API to read resource from resource file
+*
+*/
+
+
+// INCLUDE FILES
+#include <barsread.h>
+#include <mpxuser.h>
+#include <mpxlog.h>
+#include "mpxresource.h"
+
+
+// ============================ MEMBER FUNCTIONS ==============================
+
+// ----------------------------------------------------------------------------
+// Factory function
+// ----------------------------------------------------------------------------
+//
+CMPXResource* CMPXResource::NewL(const TDesC& aResourceFile)
+    {
+    CMPXResource* resObj = NewLC(aResourceFile);
+    CleanupStack::Pop(resObj);
+    return resObj;
+    }
+
+// ----------------------------------------------------------------------------
+// Factory function
+// ----------------------------------------------------------------------------
+//
+CMPXResource* CMPXResource::NewLC(const TDesC& aResourceFile)
+    {
+    MPX_DEBUG1("CMPXResource::NewLC");
+    CMPXResource* self = new (ELeave) CMPXResource();
+    CleanupStack::PushL (self);
+    self->ConstructL(aResourceFile);
+    return self;
+    }
+
+// ----------------------------------------------------------------------------
+// Decrements the reference count, and delete the object if it is 0
+// ----------------------------------------------------------------------------
+//
+void CMPXResource::Release()
+    {
+    delete this;
+    }
+
+// ----------------------------------------------------------------------------
+// C++ default constructor can NOT contain any code, that might leave
+// ----------------------------------------------------------------------------
+//
+CMPXResource::CMPXResource()
+    {
+    }
+
+// ----------------------------------------------------------------------------
+// Contruct the object
+// ----------------------------------------------------------------------------
+//
+void CMPXResource::ConstructL(const TDesC& aResourceFile)
+    {
+    // In order to support installation of individual plugin.
+    // aResourceFile must be a final name.
+    // All parse should be done in the plugin side.
+    MPX_DEBUG1("CMPXResource::ConstructL");
+    User::LeaveIfError(iFs.Connect());
+    MPX_DEBUG2("Open resource file %S", &aResourceFile);
+    iResourceFile.OpenL(iFs, aResourceFile);
+    iResourceFile.ConfirmSignatureL(0);
+    MPX_DEBUG1("CMPXResource::ConstructL End");
+    }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXResource::~CMPXResource()
+    {
+    iResourceFile.Close();
+    iFs.Close();
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of descriptors
+// ----------------------------------------------------------------------------
+//
+CDesCArrayFlat* CMPXResource::ReadDesCArrayL(TInt aResourceId)
+    {
+    CDesCArrayFlat* descArray = ReadDesCArrayLC(aResourceId);
+    CleanupStack::Pop(descArray);
+    return descArray;
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of descriptors, leave on cleanup stack
+// ----------------------------------------------------------------------------
+//
+CDesCArrayFlat* CMPXResource::ReadDesCArrayLC(TInt aResourceId)
+    {
+    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC");
+    TResourceReader resReader;
+    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
+    resReader.SetBuffer(readBuffer);
+    CDesCArrayFlat* descArray = resReader.ReadDesCArrayL();
+    CleanupStack::PopAndDestroy(readBuffer);
+    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC End");
+    CleanupStack::PushL(descArray);
+    return descArray;
+    }
+
+// ----------------------------------------------------------------------------
+// Get a heap descriptor from the resource file
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXResource::ReadHBufCL(TInt aResourceId)
+    {
+    //MPX_DEBUG1("CMPXResource::ReadHBufCL");
+    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
+    TResourceReader resReader;
+    resReader.SetBuffer(readBuffer);
+    //resource type has to be LBUF
+    HBufC* hbuf = resReader.ReadHBufCL();
+    CleanupStack::PopAndDestroy(readBuffer);
+    return hbuf;
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of menu items
+// ----------------------------------------------------------------------------
+//
+CDesCArrayFlat* CMPXResource::ReadMenuArrayL(TInt aResourceId, RArray<TInt>& aIdArray)
+    {
+    CDesCArrayFlat* menuArray = ReadMenuArrayLC(aResourceId, aIdArray);
+    CleanupStack::Pop(menuArray);
+    return menuArray;
+    }
+
+// ----------------------------------------------------------------------------
+// Read array of menu items, leave on cleanup stack
+// ----------------------------------------------------------------------------
+//
+CDesCArrayFlat* CMPXResource::ReadMenuArrayLC(TInt aResourceId, RArray<TInt>& aIdArray)
+    {
+    //MPX_DEBUG1("CMPXResource::ReadMenuArrayLC");
+    TResourceReader resReader;
+    HBufC8* readBuffer = iResourceFile.AllocReadLC(aResourceId);
+    resReader.SetBuffer(readBuffer);
+    TInt count(resReader.ReadInt16());
+    CDesCArrayFlat* descArray = new (ELeave) CDesCArrayFlat(count); ;
+    for (TInt k = 0; k < count; k++)
+              {
+              aIdArray.AppendL (resReader.ReadInt32());
+              HBufC* hbuf = resReader.ReadHBufCL();
+              CleanupStack::PushL(hbuf);
+              descArray->AppendL (*hbuf);
+              CleanupStack::PopAndDestroy(hbuf);
+        }
+    CleanupStack::PopAndDestroy(readBuffer);
+    //MPX_DEBUG1("CMPXResource::ReadDesCArrayLC End");
+    CleanupStack::PushL(descArray);
+    return descArray;
+    }
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/audio_application_features_api/audio_application_features_api.metaxml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,17 @@
+<?xml version="1.0" ?>
+<api id="9fe491e6e994068875fc678cb851e723" dataversion="2.0">
+  <name>Audio Application Features API</name>
+  <description>Central Repository keys for storing common application level audio related variation keys.</description>
+  <type>c++</type>
+  <collection>mpxmusicplayer</collection>
+  <libs>
+  </libs>
+  <release category="platform"/>
+  <attributes>
+     <!-- This indicates wether the api provedes separate html documentation -->
+     <!-- or is the additional documentation generated from headers. -->
+     <!-- If you are unsuere then the value is "no" -->
+     <htmldocprovided>no</htmldocprovided>
+     <adaptation>no</adaptation>
+  </attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/audio_application_features_api/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                Audio Application Features API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/musicplayerdomaincrkeys.h     APP_LAYER_PLATFORM_EXPORT_PATH(musicplayerdomaincrkeys.h)
+../inc/MusicPlayerInternalCRKeys.h     APP_LAYER_PLATFORM_EXPORT_PATH(MusicPlayerInternalCRKeys.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/audio_application_features_api/inc/MusicPlayerInternalCRKeys.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player internal CenRep keys.
+*
+*/
+
+
+
+#ifndef MUSICPLAYERINTERNALCRKEYS_H
+#define MUSICPLAYERINTERNALCRKEYS_H
+
+#include <musicplayerdomaincrkeys.h>
+
+
+
+#endif      // MUSICPLAYERINTERNALCRKEYS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/audio_application_features_api/inc/musicplayerdomaincrkeys.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Player domain CenRep keys.
+*
+*/
+
+
+
+#ifndef MUSICPLAYERDOMAINCRKEYS_H
+#define MUSICPLAYERDOMAINCRKEYS_H
+
+// Audio ApplicationFeatures API
+
+const TUid KCRUidMusicPlayerFeatures = {0x101F880D};
+
+// Block non-DRM protected content playback
+const TUint32 KRequireDRMInPlayback        = 0x00000002;
+
+// Space separated list of audio formats (MIME-types) to block,
+// when KRequireDRMInPlayback is enabled
+const TUint32 KPlaybackRestrictedMimeTypes = 0x00000003;
+
+#endif      // MUSICPLAYERDOMAINCRKEYS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Includes all the Domain API specific bld.inf files, which 
+*                export files.
+*
+*/
+
+
+#include "../mpx_music_player_app_api/group/bld.inf"
+#include "../mpx_music_player_commonui_api/group/bld.inf"
+#include "../mpx_music_player_media_key_handler_api/group/bld.inf"
+#include "../mpx_music_player_remote_control_api/group/bld.inf"
+#include "../mpx_music_shop_ui_api/group/bld.inf"
+#include "../mpx_music_wap_adapter_cenrep_api/group/bld.inf"
+#include "../mpx_music_store_api/group/bld.inf"
+
+#include "../audio_application_features_api/group/bld.inf"
+
+#include "../music_content_publisher_plugin_api/group/bld.inf"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                MPX Music Player App API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/mpxconstants.h                   APP_LAYER_PLATFORM_EXPORT_PATH(mpxconstants.h)
+../inc/mpxmusicplayerviewplugin.hrh     APP_LAYER_PLATFORM_EXPORT_PATH(mpxmusicplayerviewplugin.hrh)
+../inc/mpxmusicplayer.hrh               APP_LAYER_PLATFORM_EXPORT_PATH(mpxmusicplayer.hrh)
+../inc/mpxcommonuihelper.h              APP_LAYER_PLATFORM_EXPORT_PATH(mpxcommonuihelper.h)
+../inc/mpxinternalcrkeys.h              APP_LAYER_PLATFORM_EXPORT_PATH(mpxinternalcrkeys.h)
+../inc/mpxappui.hrh                     APP_LAYER_PLATFORM_EXPORT_PATH(mpxappui.hrh)
+../inc/mpxtlshelper.h                   APP_LAYER_PLATFORM_EXPORT_PATH(mpxtlshelper.h)
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/inc/mpxappui.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource header for project mpxmusicplayer
+*
+*/
+
+
+
+#ifndef MPXAPPUI_HRH
+#define MPXAPPUI_HRH
+
+// ENUMS
+enum TMPXAppUiCommandIds
+    {
+    EMPXCmdPlay = 0x2000,
+    EMPXCmdPause,
+    EMPXCmdStop,
+    EMPXCmdNext,
+    EMPXCmdPrevious,
+    EMPXCmdSeekForward,
+    EMPXCmdSeekBackward,
+    EMPXCmdStopSeeking,
+    EMPXCmdVolumeUp,
+    EMPXCmdVolumeDown,
+    EMPXCmdVolumeChanged,
+    EMPXCmdForcePlay,
+    EMPXCmdSaveAndReopen,
+    EMPXCmdSaveAndExit,
+    EMPXCmdSaveAndExitHostApp,
+    EMPXCmdSaveCancelled,
+    EMPXCmdSaveComplete,
+    EMPXCmdGoToNowPlaying,
+    EMPXCmdPlayPause,
+    EMPXCmdIsFileSaved,
+    EMPXCmdAfterSaveUseAsCascade,
+    EMPXCmdAfterSaveAiwCmdAssign,
+    EMPXCmdSaveForUseAsRingtone,
+    EMPXCmdSaveForUseAsContact,
+    EMPXCmdSaveNotProgress,
+    EMPXCmdIgnoreExternalCommand,
+    EMPXCmdHandleExternalCommand,
+    EMPXCmdHideApp,
+    EMPXCmdGotoCollection,
+    EMPXCmdVolumeMute,
+    EMPXCmdVolumeUnMute,
+    EMPXCmdCancelReorder
+
+    };
+#endif  // MPXAPPUI_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/inc/mpxcommonuihelper.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,525 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition of helper utility for Common UI
+*
+*/
+
+
+
+#ifndef C_CMPXCOMMONUIHELPER_H
+#define C_CMPXCOMMONUIHELPER_H
+
+#ifdef __ENABLE_MSK
+#include <eikbtgpc.h>
+#endif // __ENABLE_MSK
+#include <mpxcollectionuihelperobserver.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcommonui.rsg>
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXDrmUiHelper;
+class MProgressDialogCallback;
+class CAknWaitDialog;
+class MMPXCollectionUtility;
+class CEikButtonGroupContainer;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+ * Common UI helper utility class.
+ *
+ * @lib mpxcommonui.lib
+ * @since S60 3.2.3
+ */
+NONSHARABLE_CLASS( CMPXCommonUiHelper ) : public CBase,
+                                          public MMPXCHelperObserver
+    {
+public:
+
+    /**  Duration display mode */
+    enum TMPXDuratDisplayMode
+        {
+        EMPXDuratAuto = 0,
+        EMPXDuratHMS
+        };
+
+    /**
+    * Two-phased constructor.
+    *
+    * @since S60 3.2.3
+    * @aCollectionUtility Collection utility to use for this helper
+    * @return Pointer to newly created object.
+    */
+    IMPORT_C static CMPXCommonUiHelper* NewL(MMPXCollectionUtility* aCollectionUtility = NULL);
+
+    /**
+    * Destructor.
+    */
+    virtual ~CMPXCommonUiHelper();
+
+    /**
+    * Check if the host application is messaging or browser
+    * @since S60 3.2.3
+    * @return ETrue if host is messaging or browser, EFalse otherwise
+    */
+    IMPORT_C TBool IsHostMessagingBrowserL();
+
+    /**
+    * Check if the host application is the Podcasting Application
+    * @since S60 3.2.3
+    * @return ETrue if host is Podcasting Application, EFalse otherwise
+    */
+    IMPORT_C TBool IsHostPodcastingAppL();
+
+    /**
+    * Check if the host application is messaging
+    * @since S60 3.2.3
+    * @return ETrue if host is messaging, EFalse otherwise
+    */
+    IMPORT_C TBool IsHostMessagingL();
+
+    /**
+    * Check if the host application is browser
+    * @since S60 3.2.3
+    * @return ETrue if host is browser, EFalse otherwise
+    */
+    IMPORT_C TBool IsHostBrowserL();
+
+    /**
+    * Convert to displayable duration
+    *
+    * @since S60 3.2.3
+    * @param aduration Duration in seconds
+    * @param aMode time display mode
+    * @return A heap descriptor that contains displayable duration
+    *         (ownership transferred). Caller must destroy this object
+    *         after use.
+    */
+    IMPORT_C HBufC* DisplayableDurationL(
+        TInt64 aDuration,
+        TMPXDuratDisplayMode aMode = EMPXDuratAuto );
+
+    /**
+    * Convert to displayable duration in text format
+    *
+    * @since S60 3.2.3
+    * @param aduration Duration in seconds
+    * @return A heap descriptor that contains displayable duration
+    *         (ownership transferred). Caller must destroy this object
+    *         after use.
+    */
+    IMPORT_C HBufC* DisplayableDurationInTextL(
+        TInt64 aDuration );
+
+    /**
+    * Set current file as ringing tone.
+    *
+	* @since S60 3.2.3
+    * @param aMedia Media properties of the current track. the media must
+    *               contain the following attributes:
+    *               TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri )
+    *               TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle )
+    *               TMPXAttribute( KMPXMediaIdDrm, EMPXMediaDrmProtected )
+    *               TMPXAttribute( KMPXMediaIdDrm, EMPXMediaDrmRightsStatus )
+    *               TMPXAttribute( KMPXMediaIdDrm, EMPXMediaDrmCanSetAutomated )
+    * @param aSetToAllProfiles ETrue if set ringtone to all profiles.
+    *                          EFalse if set ringtone to active profile.
+    * @param aShowQuery If ETrue, a confirmation query is shown before
+    *                   setting ringtone. This setting will only apply if
+    *                   aSetToAllProfiles is set to ETrue. No effect if
+    *                   aSetToAllProfiles is set to EFalse.
+    */
+    IMPORT_C void DoSetAsRingingToneL(
+        const CMPXMedia& aMedia,
+        TBool aSetToAllProfiles,
+        TBool aShowQuery = EFalse );
+
+    /**
+    * Check if current profile mode is offline mode.
+    *
+    * @since S60 3.2.3
+    * @return ETrue if in Offline mode. Otherwise, EFalse.
+    */
+    IMPORT_C TBool IsProfileOfflineModeL();
+
+    /*
+    * Returns path of the default drive used to store playlist, attachments,
+    * downloads and ringtones.
+    * @return a path of the default drive
+    * @since S60 3.2.3
+    */
+    IMPORT_C HBufC* DefaultDriveLC();
+
+    /*
+    * Returns a path of the next available drive used for saving playlists, ringtones,
+    * downloads and attachments. The order of priority is internal mass store,
+    * MMC, then phone memory.
+    *
+    * @since S60 3.2.3
+    * @param aSize
+    */
+    IMPORT_C HBufC* AvailableDriveLC( TInt aSize );
+
+    /**
+    * Display information note
+    *
+    * @since S60 3.2.3
+    * @param aResourceId Resource id of the text string
+    */
+    IMPORT_C void DisplayInfoNoteL( TInt aResourceId );
+
+    /**
+    * Display information note
+    *
+    * @since S60 3.2.3
+    * @param aText Text to be shown on the note
+    */
+    IMPORT_C void DisplayInfoNoteL( const TDesC& aText );
+
+    /**
+    * Display confirmation note
+    *
+    * @since S60 3.2.3
+    * @param aResourceId Resource id of the text string
+    */
+    IMPORT_C void DisplayConfirmNoteL( TInt aResourceId );
+
+    /**
+    * Display confirmation note
+    *
+    * @since S60 3.2.3
+    * @param aText Text to be shown on the note
+    */
+    IMPORT_C void DisplayConfirmNoteL( const TDesC& aText );
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+    void DisplayConfirmNoteL( const TDesC& aText, TInt aResourceId );
+//#endif // __COVER_DISPLAY
+// Cover UI end
+
+    /**
+    * Convert a value from bytes to kB/MB/GB.
+    *
+    * @since S60 3.2.3
+    * @param aByte Number of bytes
+    * @param ETrue to append " free" at the end of the string
+    */
+    IMPORT_C HBufC* UnitConversionL( TInt64 aByte, TBool aFree = EFalse );
+
+    /**
+    * Finds all user playlists in the given collection
+    *
+    * @since S60 3.2.3
+    */
+    IMPORT_C CMPXMedia* FindPlaylistsL();
+
+    /**
+    * Add to saved playlist
+    *
+    * @since S60 3.2.3
+    * @param aPlaylists media containing a media array
+    *         each entry in the array must contain the following attributes
+    *         TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle )
+    *         TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId )
+    *         TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralDrive )
+    * @param aTracks Tracks to be add to the playlist
+    *          media containing a media array
+    *          must contain at least 1 element
+    *          each entry in the arry must contain the following attributes
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralType )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralCategory )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle )
+    * @param aObserver pointer to callback
+    * @param aCallback call back for wait dialog
+    *
+    * @return ETrue if the user accepts the save dialog, EFalse otherwise
+    */
+    IMPORT_C TBool AddToSavedPlaylistL(
+        const CMPXMedia& aPlaylists, const CMPXMedia& aTracks,
+        MMPXCHelperObserver* aObserver,
+        MProgressDialogCallback* aCallback );
+
+    /**
+    * Create new playlist
+    *
+    * @since S60 3.2.3
+    * @param aTracks Tracks to be add to the playlist
+    *          media containing a media array
+    *          can be a valid array with 0 length
+    *          each entry in the arry must contain the following attributes
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralType )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralCategory )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle )
+    * @param aObserver pointer to callback
+    * @param aCallback call back for wait dialog
+    *
+    * @return ETrue if user accepts the query, EFalse otherwise
+    */
+    IMPORT_C TBool CreatePlaylistL( const CMPXMedia& aTracks,
+        MMPXCHelperObserver* aObserver,
+        MProgressDialogCallback* aCallback );
+
+    /**
+	* Launches rename dialog
+	*
+	* @since S60 3.2.3
+	* @param aOldName original name, with the extension (e.g. a.mp3)
+	* @param aNewName on return, this will be populated with the new name
+	*                 inputed by the user
+	* @param aPath    the path to the file, without the file name (e.g. c:\\data\\)
+	* @return generic return code from AknDialog
+	*/
+	IMPORT_C TInt LaunchRenameDialogL(
+        const TDesC& aOldName,
+		TDes& aNewName,
+		const TDesC& aPath );
+
+    /**
+    * Shows wait note
+    *
+    * @since S60 3.2.3
+    * @param aText text to display
+    * @param aCBAId button group ID
+    * @param aVisibilityDelayOff If set ETrue the dialog will be visible
+    *                            immediality. Use only when the length of
+    *                            the process is ALWAYS over 1.5 seconds.
+    * @param aCallback call back
+    * @param aResId resource Id for the WaitNote, default is R_MPX_GENERIC_WAIT_NOTE
+    */
+    IMPORT_C void ShowWaitNoteL( TDesC& aText, TInt aCBAId,
+        TBool aVisibilityDelayOff, MProgressDialogCallback* aCallback, TInt aResId = R_MPX_GENERIC_WAIT_NOTE );
+
+    /**
+     * Dismiss wait note
+     */
+    IMPORT_C void DismissWaitNoteL();
+
+    /**
+    * Handles displaying the error message for given error code
+    * according to the media object provided
+    *
+    * @since S60 3.2.3
+    * @param aError Error code
+    * @param aMedia MPXMedia object
+    * @param aFile Handle to file
+    * @return KErrNone if no error, or else if a dialog is displayed will
+    *         return the Button ID used to dismiss dialog.
+    */
+    IMPORT_C TInt HandleErrorL( TInt aError,
+                                const CMPXMedia* aMedia=NULL,
+                                RFile* aFile=NULL );
+
+    /**
+    * Adds given resource text as MSK to CBA.
+    *
+    * @since S60 3.2.3
+    * @param aCba a button group container
+    * @param aResourceId middle softkey label.
+    * @param aCommandId command that should be performed when MSK
+    *        is pressed.
+    */
+    IMPORT_C void SetMiddleSoftKeyLabelL(
+        CEikButtonGroupContainer& aCba,
+        TInt aResourceId,
+        TInt aCommandId );
+
+    /**
+    * Removes current MSK label
+    *
+    * @since S60 3.2.3
+    * @param aCba a button group container
+    */
+    IMPORT_C void RemoveMiddleSoftKeyLabel(
+        CEikButtonGroupContainer& aCba );
+
+    /**
+    * Adds given resource icon as MSK to CBA.
+    *
+    * @since S60 3.2.3
+    * @param aCba a button group container
+    * @param aBitmap a bitmap
+    * @param aMask a bitmap mask
+    */
+    IMPORT_C void SetMiddleSoftKeyIconL(
+        CEikButtonGroupContainer& aCba,
+        CFbsBitmap* aBitmap,
+        CFbsBitmap* aMask );
+
+    /**
+    * Generate the next available title from the given title for the category.
+    * The generated title is unique within the category regardless of the
+    * media type within the category and its location.
+    * e.g. c:\data\playlists\Playlist.m3u exists in the collection, the next
+    * available title for the playlist category will be Playlist(01) regardless
+    * if the title is going to be used for a playlist located in e:\data\playlists
+    * or if it's a xml playlist file.
+    *
+    * @since S60 3.2.3
+    * @param aCategory specifies the category for the title
+    * @param aBaseTitle specifies the base title for new title generation
+    * @return the next available title in the category in "BaseTitle(number)"
+    *         format where number is the lowest available number.
+    */
+    IMPORT_C HBufC* GenerateTitleL(
+        TMPXGeneralCategory aCategory,
+        const TDesC& aBaseTitle );
+
+    /**
+    * Checks if Exit option should be hidden
+    *
+    * @since S60 3.2.3
+    * @return ETrue if exit option should be hidden, EFalse otherwise
+    */
+    IMPORT_C TBool ExitOptionHiddenL();
+
+    /**
+    * Sets standalone mode process ID
+    *
+    * @since S60 3.2.3
+    * @param aPId Process ID for standalone mode, 0 to reset
+    * @return ETrue if successful, EFalse otherwise
+    */
+    IMPORT_C static TBool SetStandAloneModePId( TInt64 aPId );
+
+    /**
+    * Gets stand alone mode's process id
+    *
+    * @since S60 3.2.3
+    * @return Stand alone mode's process ID, or 0 if not found
+    */
+    IMPORT_C static TInt64 StandAloneModePId();
+
+
+    /**
+    * Checks if the application with the provided group id is in foreground
+    * This method is required because AppUi()->IsForeground() does not work
+    * properly when the screen saver is active
+    *
+    * @since S60 3.2.3
+    * @param aWindowGroupId application group identifier
+    * @return ETrue if the application is in foreground, EFalse otherwise
+    */
+    IMPORT_C TBool IsForegroundApplication(TInt aWindowGroupId);
+
+    /**
+    * Get the Drive Number for the MMC card
+    *
+    * @since S60 3.2.3
+    * @return Drive Number as defined in TDriveNumber or error code
+    */
+    IMPORT_C static TInt MMCDriveNumber();
+
+
+    /**
+     * Cancel all subsequent operations scheduled by CollectionUiHelper
+     * Currently, this method is only used to cancel adding songs incrementally
+     * to the playlist (user clicks on Cancel on the wait note)
+     */
+    IMPORT_C void CancelCollectionOperation();
+    
+                            
+private:
+
+    /**
+    * C++ default constructor.
+    *
+    * @since S60 3.2.3
+    * @param aCollectionUtility Collection utility to use for this helper
+    */
+    CMPXCommonUiHelper(MMPXCollectionUtility* aCollectionUtility);
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    /**
+    * Check if memory card is present and writable.
+    *
+    * @since S60 3.2.3
+    * @param aDrive If return is ETrue, aDrive contains the drive letter
+    * @return ETrue if memory card is present and writable.
+    */
+    TBool IsMemoryCardWritable( TChar& aDrive );
+
+    /**
+    * Show playlist creation queries: memory selection and name query.
+    *
+    * @since S60 3.2.3
+    * @param aPath Descriptor to receive the full path and
+    *              name of the playlist file
+    */
+    TBool PlaylistCreationQueriesL( TDes& aPath );
+
+    /**
+    * Get next available playlist full pathname based on the information passed.
+    *
+    * @since S60 3.2.3
+    * @param aBuf Buffer contains the file path and initial playlist name (optional).
+    *             This buffer must be big enough to hold all texts.
+    * @return KErrNone if everything ok.
+    */
+    TInt GetNextPlaylistNameL( TDes& aBuf );
+
+    /**
+    * Finds all medias in the specified category. Matching medias should
+    * return the specified attributes
+    *
+    * @since S60 3.2.3
+    * @param aAttrs attributes to return for the matching media(s)
+    * @return matching media(s)
+    */
+    CMPXMedia* FindAllL(TMPXGeneralCategory aCategory, const TArray<TMPXAttribute>& aAttrs);
+
+    /**
+    * From MMPXCHelperObserver
+    * Handles the completion of any collection helper event.
+    *
+    * @since S60 3.2.3
+    * @param aOperation, operation completed
+    * @param aErr. the error code
+    * @param aArgument Argument returned from the operation
+    */
+    void HandleOperationCompleteL( TCHelperOperation aOperation,
+                                   TInt aErr,
+                                   void* aArgument );
+
+    TBool PlaylistCreateNameExistL( TDes& aName, const TParseBase& aParse );
+private:    // Data
+
+    TInt                        iResourceOffset;   // must be freed
+    CMPXDrmUiHelper*            iMpxDrmHelper; // owned
+    MMPXCollectionUiHelper*     iCollectionUiHelper;
+    MMPXCHelperObserver*        iAddObserver;
+    CAknWaitDialog*             iWaitDialog;
+    MMPXCollectionUtility*      iCollectionUtility; // not owned
+    TInt                        iAppUiResourceOffset;
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+    TBool iCoverDisplay;
+//#endif
+// Cover UI end
+
+    };
+
+#endif  // C_CMPXCOMMONUIHELPER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/inc/mpxconstants.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPXMusicPlayer constants
+*
+*/
+
+
+
+#ifndef MPXCONSTANTS_H
+#define MPXCONSTANTS_H
+
+
+// INCLUDES
+#include "mpxmusicplayer.hrh"
+
+
+// CONSTANTS
+// MusicPlayer application UID
+const TUid KAppUidMusicPlayerX = {KMusicPlayerAppUidConstant};
+
+// Host application UIDs in embedded mode
+#define KMPXMessagingUid  0x100058C5
+#define KMPXMmsViewerUid  0x100058DF
+#define KMPXMmsEditorUid  0x100058DE
+#define KMPXMailViewerUid 0x101F4CE4
+#define KMPXMailEditorUid 0x101F4CD6
+#define KMPXBrowserUid    0x10008D39
+#define KMPXBrowserUid2   0x1020724D
+#define KMPXMusicShopUid  0x101F8839
+
+// Uid for Podcast Collection Plugin
+const TUid KMPXUidPodcastDBPlugin = { 0x101FFC3C };
+
+// DATA TYPES
+
+// MPX Music Player start up parameters (dochandler), the order of enums can't 
+// be changed.
+enum TMPXLaunchMode
+    {
+    // Player is started in playing state
+    EMPXLaunchModePlaying,
+
+    // Player is started in stopped state
+    EMPXLaunchModeStopped,
+
+    // Player is started to play a preview
+    // clip embedded in the audio file
+    EMPXLaunchModePlayPreview,
+
+    // Not in embedded mode or unknown status
+    EMPXLaunchModeUnknown,
+
+    // A single track was opened in embedded mode
+    EMPXLaunchModeTrack,
+
+    // A playlist was opened in embedded mode
+    EMPXLaunchModePlaylist,
+
+    // A temporary playlist was opened by
+    // marking several tracks in Gallery
+    EMPXLaunchModeTempPlaylist
+    };
+
+// ERROR CODES
+
+// Error code to note that the rights on a DRM file are about to expire
+// so the proper warning message can be displayed.
+const TInt KMPXRightsAboutToExpire  = -40000;     
+
+// Error code to indicate that all tracks in a playlist are invalid so the
+// proper error message can be displayed.
+const TInt KMPXAllTracksInvalid     = -40001;
+
+// Error code to indicate that playback not allowed during video call
+const TInt KMPXErrorVideoCall       = -40002;
+
+#endif  // MPXCONSTANTS_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/inc/mpxinternalcrkeys.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX internal CenRep keys.
+*
+*/
+
+
+
+#ifndef MPXINTERNALCRKEYS_H
+#define MPXINTERNALCRKEYS_H
+
+
+// Music Player Application Features Uid
+const TUid KCRUidMPXMPFeatures = { 0x101FFCD0 };
+
+
+// Local variation property value
+const TUint32 KMPXMPLocalVariation   = 0x00000001;
+
+// Feature flag definitions for local variation
+
+
+// Feature to enable changing ringing tone for all profiles. When disabled
+// ringing tone is changed only for the active profile.
+#define KMPXChangeRTForAll      0x0001
+
+// Feature to enable marquee (scrolling) text for artist name label in
+// Music Player. When enabled and if the artist name is too long to fit into
+// space reserved for it, the label starts scrolling. Scrolling is associated
+// to player state, when playing is started the label starts scrolling and if
+// the playing is stopped the scrolling stops, too.
+#define KMPXMarqueeArtistName   0x0002
+
+// Feature to enable Rocker Key Mapping support.
+#define KMPXRockerMappingSupport 0x0004
+
+// Feature to disable podcasting from music player
+// +128 to disable podcasting
+#define KMPXDisablePodcastingOption 0x0008
+
+// Feature to enable Go To MusicShop option in option menus.
+#define KMPXEnableGoToMusicShopOption 0x0010
+
+// Feature to enable Find In MusicShop option in option menus
+#define KMPXEnableFindInMusicShopOption 0x0020
+
+// Feature to enable exit option in option menus.
+#define KMPXEnableExitOption 0x0040
+
+// Feature to open Music Player in Artists & Album collection view.
+#define KMPXStartMusicPlayerinArtistsandAlbums 0x0080
+
+// Speed Scroll settings feature Uid
+const TUid KCRUidMPXMPExtendedFeatures = { 0x101FFCD1 };
+
+// Speed scrolling settings
+// setting for buffer time from idle to first speed
+const TUint32 KMPXMPSpeedScrollFirBuffTime    = 0x00000001;
+// setting for buffer time from first speed to second speed
+const TUint32 KMPXMPSpeedScrollSecBuffTime    = 0x00000002;
+// value for first speed
+const TUint32 KMPXMPSpeedScrollFirSpeed       = 0x00000003;
+// value for second speed
+const TUint32 KMPXMPSpeedScrollSecSpeed       = 0x00000004;
+
+#endif  // MPXINTERNALCRKEYS_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/inc/mpxmusicplayer.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPXMusicPlayer constants
+*
+*/
+
+
+
+#ifndef MPXMUSICPLAYER_HRH
+#define MPXMUSICPLAYER_HRH
+
+
+// CONSTANTS
+// MusicPlayer application UID
+#define KMusicPlayerAppUidConstant  0x102072C3
+
+#endif  // MPXMUSICPLAYER_HRH   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/inc/mpxmusicplayerviewplugin.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,41 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource header for project View plugin type
+*
+*/
+
+
+
+#ifndef MPXMUSICPLAYERVIEWPLUGIN_HRH
+#define MPXMUSICPLAYERVIEWPLUGIN_HRH
+
+/** Plugin type UIDs */
+#define KMPXPluginTypePlaybackUid           0x101FFCA0
+#define KMPXPluginTypeCollectionUid         0x101FFCA1
+#define KMPXPluginTypeAudioEffectsUid       0x101FFCA2
+#define KMPXPluginTypeEqualizerUid          0x101FFCA3
+#define KMPXPluginTypeMetadataEditorUid     0x101FFCA4
+#define KMPXPluginTypeAlbumArtEditorUid     0x101FFCA5
+#define KMPXPluginTypePlaylistEditorUid     0x101FFCA6
+#define KMPXPluginTypeAddSongsEditorUid     0x101FFCA7
+#define KMPXPluginTypeMainUid               0x101FFCA9
+#define KMPXPluginTypeUPnPBrowseDialogUid   0x101FFCAD
+#define KMPXPluginTypeEmbeddedPlaybackUid   0x1011FCAF
+#define KMPXPluginTypeWaitNoteDialogUid     0x101FFC6E
+//To restor last played and start playing automatically.
+#define KMPXPluginTypeLastPlayedUid         0x10207C1B
+
+#endif  // MPXMUSICPLAYERVIEWPLUGIN_HRH
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/inc/mpxtlshelper.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX TLS helper implementation
+*
+*/
+
+
+
+#ifndef C_MPXTLSHELPER_H
+#define C_MPXTLSHELPER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxconstants.h>
+
+
+// DATA TYPES
+
+/**
+ * Structure used to store information in TLS.
+ */
+NONSHARABLE_STRUCT( TMPXTlsStruct )
+    {
+    /**
+     * Host application UID. Used in embedded mode.
+     */
+    TUid iHostUid;
+
+    /**
+     * Flag to indicate save is allowed. Used in embedded mode.
+     */
+    TBool iNeedSave;
+
+    /**
+     * Flag to indicate move is allowed. Used in embedded mode.
+     */
+    TBool iAllowMove;
+
+    /**
+     * Player init mode. Used in embedded mode.
+     */
+    TMPXLaunchMode iLaunchMode;
+
+    /**
+     * Usage count.
+     */
+    TInt useCount;
+
+    /**
+     * File Name of the saved clip
+     */
+    TFileName iFilePath;
+    };
+
+
+// CLASS DECLARATION
+
+/**
+ *  MPX TLS Helper.
+ *
+ *  @lib mpxcommonui.lib
+ *  @since S60 v3.2.3
+ */
+NONSHARABLE_CLASS( MPXTlsHelper )
+    {
+public:
+
+    /**
+     * Initialize TLS for storing application information.
+     *
+     * @since S60 v3.2.3
+     */
+    IMPORT_C static void InitializeL();
+
+    /**
+     * Uninitialize TLS data storage. Must be called
+     * before exiting application to unload resources.
+     *
+     * @since S60 v3.2.3
+     */
+    IMPORT_C static void Uninitialize();
+
+    /**
+     * Store host application UID to TLS.
+     *
+     * @since S60 v3.2.3
+     * @param aUid Host application UIDs
+     */
+    IMPORT_C static void SetHostUidL( const TUid& aUid );
+
+    /**
+     * Fetch host application UID from TLS.
+     *
+     * @since S60 v3.2.3
+     * @return Host application UID if application is in embedded mode
+     */
+    IMPORT_C static TUid HostUid();
+
+    /**
+     * Set 'need save' flag. If the flag is set,
+     * user is asked to save the track when exiting embedded mode.
+     *
+     * @since S60 v3.2.3
+     * @param aNeedSave ETrue if save query should be shown on exit
+     */
+    IMPORT_C static void SetNeedSave( TBool aNeedSave );
+
+    /**
+     * Get 'need save' flag. If the flag is set,
+     * user is asked to save the track when exiting embedded mode.
+     *
+     * @since S60 v3.2.3
+     * @return ETrue If save query should be shown on exit
+     */
+    IMPORT_C static TBool NeedSave();
+
+    /**
+     * Sets Allow Move flag.
+     *
+     * @since S60 v3.2.3
+     * @param aAllowMove ETrue if the clip should be moved instead of copy
+     */
+    IMPORT_C static void SetAllowMove( TBool aAllowMove );
+
+    /**
+     * Gets Allow Move flag.
+     *
+     * @since S60 v3.2.3
+     * @return ETrue if the clip should be moved instead of copy
+     */
+    IMPORT_C static TBool AllowMove();
+
+    /**
+     * Set launch mode.
+     *
+     * @since S60 v3.2.3
+     * @param aMode Launch mode in embedded mode, see TMPXLaunchMode
+     */
+    IMPORT_C static void SetLaunchModeL( TMPXLaunchMode aMode );
+
+    /**
+     * Get launch mode.
+     *
+     * @since S60 v3.2.3
+     * @return Launch mode in embedded mode, see TMPXLaunchMode
+     */
+    IMPORT_C static TMPXLaunchMode LaunchMode();
+
+    /**
+     * Get the full path of saved file name.
+     *
+     * @since S60 v3.2.3
+     * @return path to saved clip
+     */
+    IMPORT_C static TFileName FilePath();
+
+    /**
+     * Set the full path of saved file name.
+     *
+     * @since S60 v3.2.3
+     * @param aFilePath
+     */
+    IMPORT_C static void SetFilePath( const TDesC& aFilePath );
+    };
+
+#endif  // C_MPXTLSHELPER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/mpx_music_player_app_api.metaxml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="0795d44c7f1995198e04bfe40216cc78" dataversion="2.0">
+<name>MPX Music Player App API</name>
+<description>Provides declarations/definition for the music player app</description>
+<type>c++</type>
+<collection>mpxmusicplayer</collection>
+<libs>
+</libs>
+<release category="platform" sinceversion=""/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/conf/tcMpxMusicPlayerTest.cfg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,330 @@
+[Test]
+title 1: Initialize TLS Helper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 1
+[Endtest]
+
+[Test]
+title 2: Verify Host Uid
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 2
+[Endtest]
+
+[Test]
+title 3: Verify Host Uid - NotReady
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 3
+[Endtest]
+
+[Test]
+title 4: Verify NeedSave flag
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 4
+[Endtest]
+
+[Test]
+title 5: Verify AllowMove flag
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 5
+[Endtest]
+
+
+[Test]
+title 6: Verify Launch Mode
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 6
+[Endtest]
+
+[Test]
+title 7: Verify Launch Mode - NotReady
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 7
+[Endtest]
+
+
+[Test]
+title 8: Verify File Path
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 8
+[Endtest]
+
+[Test]
+title 9: Uninitialize TLS Helper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 9
+[Endtest]
+
+[Test]
+title 10: NewL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 10
+[Endtest]
+
+[Test]
+title 11: ~CMPXCommonUiHelper CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 11
+[Endtest]
+
+[Test]
+title 12: IsHostMessagingBrowserL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 12
+[Endtest]
+
+[Test]
+title 13: IsHostPodcastingAppL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 13
+[Endtest]
+
+[Test]
+title 14: IsHostMessagingL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 14
+[Endtest]
+
+[Test]
+title 15: IsHostBrowserL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 15
+[Endtest]
+
+
+[Test]
+title 16: DisplayableDurationL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 16
+[Endtest]
+
+[Test]
+title 17: DisplayableDurationInTextL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 17
+[Endtest]
+
+[Test]
+title 18: DoSetAsRingingToneL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 18
+[Endtest]
+
+[Test]
+title 19: IsProfileOfflineModeL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 19
+[Endtest]
+
+[Test]
+title 20: DefaultDriveLC CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 20
+[Endtest]
+
+[Test]
+title 21: AvailableDriveLC CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 21
+[Endtest]
+
+[Test]
+title 22-1:IliegalCharacters DisplayInfoNoteL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 22
+[Endtest]
+
+[Test]
+title 22-2:FileNotFound DisplayInfoNoteL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 23
+[Endtest]
+
+[Test]
+title 23-1:IliegalCharacters DisplayInfoNoteL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 24
+[Endtest]
+
+[Test]
+title 23-2:FileNotFound DisplayInfoNoteL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 25
+[Endtest]
+
+[Test]
+title 24-1:KMPXSaveNote DisplayConfirmNoteL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 26
+[Endtest]
+
+[Test]
+title 24-2:KMPXSaveToCollectionNote DisplayConfirmNoteL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 27
+[Endtest]
+
+[Test]
+title 25-1:KMPXSaveNote DisplayConfirmNoteL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 28
+[Endtest]
+
+[Test]
+title 25-2:KMPXSaveToCollectionNote DisplayConfirmNoteL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 29
+[Endtest]
+
+[Test]
+title 26: UnitConversionL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 30
+[Endtest]
+
+[Test]
+title 27: FindPlaylistsL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 31
+[Endtest]
+
+
+
+
+
+
+
+
+
+
+
+
+[Test]
+title 28: AddToSavedPlaylistL CMPXCommonUiHelper
+
+// Show dialog
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 32
+
+// Press key
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 33
+
+[Endtest]
+
+
+[Test]
+title 29: CreatePlaylistL CMPXCommonUiHelper
+
+// Show dialog
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 34
+
+// Press key
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 35
+
+[Endtest]
+
+[Test]
+title 30: LaunchRenameDialogL CMPXCommonUiHelper
+
+// Show dialog
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 36
+
+// Press key
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 37
+
+[Endtest]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[Test]
+title 31: ShowWaitNoteL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 38
+[Endtest]
+
+[Test]
+title 32.1: DismissWaitNoteL CMPXCommonUiHelper:Wait dialog existed
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 39
+[Endtest]
+
+[Test]
+title 32.2: DismissWaitNoteL CMPXCommonUiHelper:Wait dialog did not existed
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 40
+[Endtest]
+
+[Test]
+title 33: HandleErrorL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 41
+[Endtest]
+
+
+[Test]
+title 34: SetMiddleSoftKeyLabelL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 42
+[Endtest]
+
+
+[Test]
+title 35: RemoveMiddleSoftKeyLabel CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 43
+[Endtest]
+
+
+[Test]
+title 36: GenerateTitleL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 44
+[Endtest]
+
+[Test]
+title 37: ExitOptionHiddenL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 45
+[Endtest]
+
+[Test]
+title 38: SetStandAloneModePId CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 46
+[Endtest]
+
+[Test]
+title 39: StandAloneModePId CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 47
+[Endtest]
+
+[Test]
+title 40: IsForegroundApplication CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 48
+[Endtest]
+
+[Test]
+title 41: MMCDriveNumber CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 49
+[Endtest]
+
+
+
+
+
+
+
+[Test]
+title 42: CancelCollectionOperation CMPXCommonUiHelper
+
+// Show dialog
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 50
+
+// Press key
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 51
+
+[Endtest]
+
+
+
+
+[Test]
+title 43: SetMiddleSoftKeyIconL CMPXCommonUiHelper
+run testscripter c:\testframework\ui_mpxmusicplayertest.cfg 52
+[Endtest]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/conf/ui_mpxmusicplayertest.cfg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,627 @@
+[Test]
+title 1: Initialize TLS Helper
+create ui_mpxmusicplayertest mp
+mp Initialize
+mp Uninitialize
+delete mp 
+pause 1000
+[Endtest]
+
+[Test]
+title 2: Verify Host Uid
+create ui_mpxmusicplayertest mp
+mp Initialize
+mp VerifyHostUid KErrNone
+mp Uninitialize
+delete mp 
+pause 1000
+[Endtest]
+
+[Test]
+title 3: Verify Host Uid - NotReady
+create ui_mpxmusicplayertest mp
+mp VerifyHostUid KErrNotReady
+delete mp 
+pause 1000
+[Endtest]
+
+[Test]
+title 4: Verify NeedSave flag
+create ui_mpxmusicplayertest mp
+mp Initialize
+mp VerifyNeedSave
+mp Uninitialize
+delete mp 
+pause 1000
+[Endtest]
+
+[Test]
+title 5: Verify AllowMove flag
+create ui_mpxmusicplayertest mp
+mp Initialize
+mp VerifyAllowMove
+mp Uninitialize
+delete mp 
+pause 1000
+[Endtest]
+
+[Test]
+title 6: Verify Launch Mode
+create ui_mpxmusicplayertest mp
+mp Initialize
+mp VerifyLaunchMode KErrNone
+mp Uninitialize
+delete mp 
+pause 1000
+[Endtest]
+
+[Test]
+title 7: Verify Launch Mode - NotReady
+create ui_mpxmusicplayertest mp
+mp VerifyLaunchMode KErrNotReady
+delete mp 
+pause 1000
+[Endtest]
+
+[Test]
+title 8: Verify File Path
+create ui_mpxmusicplayertest mp
+mp Initialize
+mp VerifyFilePath
+mp Uninitialize
+delete mp 
+pause 1000
+[Endtest]
+
+[Test]
+title 9: Uninitialize TLS Helper
+create ui_mpxmusicplayertest mp
+mp Initialize
+mp Uninitialize
+delete mp 
+pause 1000
+[Endtest]
+
+[Test]
+title 10: NewL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 11: ~CMPXCommonUiHelper CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 12: IsHostMessagingBrowserL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperIsHostMessagingBrowserL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 13: IsHostPodcastingAppL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperIsHostPodcastingAppL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 14: IsHostMessagingL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperIsHostMessagingL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 15: IsHostBrowserL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperIsHostBrowserL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 16: DisplayableDurationL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDisplayableDurationL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 17: DisplayableDurationInTextL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDisplayableDurationInTextL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 18: DoSetAsRingingToneL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDoSetAsRingingToneL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 19: IsProfileOfflineModeL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperIsProfileOfflineModeL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 20: DefaultDriveLC CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDefaultDriveLC
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 21: AvailableDriveLC CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperAvailableDriveLC
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 22-1:IliegalCharacters DisplayInfoNoteL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDisplayInfoNoteLRSCID IliegalCharacters
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 22-2:FileNotFound DisplayInfoNoteL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDisplayInfoNoteLRSCID FileNotFound
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 23-1:IliegalCharacters DisplayInfoNoteL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDisplayInfoNoteLText IliegalCharacters
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 23-2:FileNotFound DisplayInfoNoteL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDisplayInfoNoteLText FileNotFound
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 24-1:KMPXSaveNote DisplayConfirmNoteL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDisplayConfirmNoteLRSCID Saved_successfully!
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 24-2:KMPXSaveToCollectionNote DisplayConfirmNoteL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDisplayConfirmNoteLRSCID Saved_to_collection_successfully!
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 25-1:KMPXSaveNote DisplayConfirmNoteL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDisplayConfirmNoteLText Saved_successfully!
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 25-2:KMPXSaveToCollectionNote DisplayConfirmNoteL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDisplayConfirmNoteLText Saved_to_collection_successfully!
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 26: UnitConversionL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+//mp UiHelperDoSetAsRingingToneL
+mp UiHelperUnitConversionL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 27: FindPlaylistsL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperFindPlaylistsL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+
+
+
+
+
+
+
+
+
+
+
+
+[Test]
+title 28: AddToSavedPlaylistL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperAddToSavedPlaylistL
+pause 4000                            //added 5,11,2008
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 28-Presskey: AddToSavedPlaylistL CMPXCommonUiHelper
+pause 3000			//
+presskey global EKeyDevice0 	//
+[Endtest]
+
+
+
+[Test]
+title 29: CreatePlaylistL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperCreatePlaylistL
+pause 4000                            //added 5,11,2008
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 29-Presskey: CreatePlaylistL CMPXCommonUiHelper
+pause 3000			//
+presskey global EKeyDevice0 	//
+[Endtest]
+
+[Test]
+title 30: LaunchRenameDialogL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperLaunchRenameDialogL mpxtestplaylist playlist C:\testing\data
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 30-Presskey: LaunchRenameDialogL CMPXCommonUiHelper
+pause 3000			//
+//typetext TesterPlaylist		//rename playlist's name
+presskey global EKeyDevice0 	//
+[Endtest]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[Test]
+title 31: ShowWaitNoteL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+//mp UiHelperCreatePlaylistL                    //added 10,31
+mp UiHelperShowWaitNoteL
+pause 3000 
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 32.1: DismissWaitNoteL CMPXCommonUiHelper:Wait dialog existed
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+//mp UiHelperCreatePlaylistL                    //added 10,31
+mp UiHelperShowWaitNoteL
+mp UiHelperDismissWaitNoteL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+
+[Test]
+title 32.2: DismissWaitNoteL CMPXCommonUiHelper:Wait dialog did not existed
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperDismissWaitNoteL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 33: HandleErrorL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperHandleErrorL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 34: SetMiddleSoftKeyLabelL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperSetMiddleSoftKeyLabelL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 35: RemoveMiddleSoftKeyLabel CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperSetMiddleSoftKeyLabelL
+mp UiHelperRemoveMiddleSoftKeyLabel
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 36: GenerateTitleL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperGenerateTitleL CategoryNewTitle
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 37: ExitOptionHiddenL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperExitOptionHiddenL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 38: SetStandAloneModePId CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperSetStandAloneModePId
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 39: StandAloneModePId CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperSetStandAloneModePId
+mp UiHelperStandAloneModePId
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 40: IsForegroundApplication CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperIsForegroundApplication
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 41: MMCDriveNumber CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperMMCDriveNumber
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+
+
+
+
+
+
+[Test]
+title 42: CancelCollectionOperation CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperCreatePlaylistL
+mp UiHelperCancelCollectionOperation
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
+[Test]
+title 42-Presskey: CancelCollectionOperation CMPXCommonUiHelper
+pause 3000			//
+presskey global EKeyDevice1 	//
+[Endtest]
+
+
+
+
+
+
+
+
+[Test]
+title 43: SetMiddleSoftKeyIconL CMPXCommonUiHelper
+bringtoforeground
+create ui_mpxmusicplayertest mp
+mp CMPXCommonUiHelperNewL
+mp UiHelperSetMiddleSoftKeyIconL
+mp CMPXCommonUiHelperDestruct
+delete mp 
+sendtobackground
+pause 1000
+[Endtest]
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxmusicplayertest
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+#include "../ui_mpxmusicplayertest/group/bld.inf"
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/init/TestFramework.ini	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,202 @@
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#   + XML, Test report will be xml type, for example 'TestReport.xml'.
+#          Note, that xml format is available only when output is set to FILE.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module.
+# 	- Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+#		DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport    # Possible values are: 'Empty', 'Summary', 'Environment',
+                                                     'TestCases' or 'FullReport'
+
+CreateTestReport= YES         # Possible values: YES or NO
+
+UITestingSupport= YES 
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport_ui_mpxmusicplayertest
+
+TestReportFormat= TXT         # Possible values: TXT, HTML or XML
+TestReportOutput= FILE        # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone  # Possible values are:
+              # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+              # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+              # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+              # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0                    # Default timeout value for each test case. In milliseconds
+#UITestingSupport= YES        # Possible values: YES or NO
+#SeparateProcesses= YES       # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= testcombiner
+TestCaseFile=  c:\testframework\tcMpxMusicPlayerTest.cfg
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+#	- Will write log file in unicode format.
+#		+ YES, Log file will be written in unicode format
+#		+ NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES    # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML         # Possible values: TXT or HTML
+#EmulatorOutput= FILE         # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML         # Possible values: TXT or HTML
+#HardwareOutput= FILE         # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE  # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES       # Possible values: YES or NO
+#WithTimeStamp= YES           # Possible values: YES or NO
+#WithLineBreak= YES           # Possible values: YES or NO
+#WithEventRanking= YES        # Possible values: YES or NO
+
+#FileUnicode= YES             # Possible values: YES or NO
+#AddTestCaseTitle= YES        # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/Bwins/ui_mpxmusicplayertestu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/EABI/ui_mpxmusicplayertestu.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+	_ZTI17CEdwinTestControl @ 2 NONAME ; #<TI>#
+	_ZTV17CEdwinTestControl @ 3 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project ui_mpxharvestertest
+*
+*/
+
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+// NOTE: If using ARS requirements .mmp file operation should be done under this.
+// 'abld test build'
+
+ui_mpxmusicplayertest.mmp
+
+PRJ_MMPFILES
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+/agnmodel/group/agnmodel.mmp
+#if defined(MARM)
+/agnmodel/group/agsvexe.mmp
+#endif
+*/
+
+
+//  End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/group/ui_mpxmusicplayertest.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project ui_mpxmusicplayertest
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          ui_mpxmusicplayertest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+VENDORID     	VID_DEFAULT
+
+DEFFILE         ui_mpxmusicplayertest.def
+
+SOURCEPATH      ../src
+SOURCE          ui_mpxmusicplayertest.cpp
+SOURCE          ui_mpxmusicplayertestBlocks.cpp EdwinTestControl.cpp
+
+USERINCLUDE     ../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY         mpxcommonui.lib mpxcollectionutility.lib fbscli.lib cone.lib aknskins.lib aknskinsrv.lib efsrv.lib eikcoctl.lib eikcore.lib eikctl.lib avkon.lib mpxcommon.lib bafl.lib estor.lib apgrfx.lib AknIcon.lib commonengine.lib eikdlg.lib
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/group/ui_mpxmusicplayertest.pkg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,66 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: pakage file for make installation file for STIF
+;
+;
+; Installation file for STIF MPXMusicPlayer test Application in Platform Security Environments
+;
+
+; Languages
+&EN
+
+; Package header
+#{"STIF MPXMusicPlayer Test Application"},(0x101FB3E3),0,0,0, TYPE=SA
+
+; Localised Vendor name
+%{"MPXMusicPlayerStif"}
+
+; Unique Vendor name
+:"Vendor"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+
+; // STIF GUI (STIFTestFramework\Series60_UI is need to compile)
+"..\..\data\mmc\mpxtest1.mp3"   -   "e:\testing\data\mpxtest1.mp3" 
+"..\..\data\mmc\mpxtest2.mp3"   -   "e:\testing\data\mpxtest2.mp3" 
+"..\..\data\mmc\mpxtestplaylist.m3u"   -   "e:\testing\data\mpxtestplaylist.m3u" 
+"..\..\init\TestFramework.ini"   -   "c:\testframework\TestFramework.ini" 
+"..\..\conf\ui_mpxmusicplayertest.cfg"   -   "c:\testframework\ui_mpxmusicplayertest.cfg"
+"..\..\conf\tcMpxMusicPlayerTest.cfg"   -   "c:\testframework\tcMpxMusicPlayerTest.cfg"
+"\epoc32\release\armv5\urel\ui_mpxmusicplayertest.dll"   -   "c:\Sys\Bin\ui_mpxmusicplayertest.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/inc/EdwinTestControl.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CEdwinTestControl test class for STIF Test Framework TestScripter.
+*
+*/
+#ifndef EDWINTESTCONTROL_H_
+#define EDWINTESTCONTROL_H_
+
+#include <eikedwin.h>
+
+class CAknsBasicBackgroundControlContext;
+
+class CEdwinTestControl : public CCoeControl, public MCoeControlObserver
+    {
+public:
+	static CEdwinTestControl* NewL(void);
+	virtual ~CEdwinTestControl();
+protected:
+	TTypeUid::Ptr MopSupplyObject(TTypeUid aId); // 
+private:
+	virtual void SizeChanged();
+	virtual void HandleResourceChange(TInt aType);
+	virtual TInt CountComponentControls() const;
+	virtual CCoeControl* ComponentControl(TInt aIndex) const;
+    void ConstructL(/*void*/);
+	void Draw(const TRect& aRect) const;
+	
+	void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType);
+	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType );	
+private:
+	CAknsBasicBackgroundControlContext*	iBgContext; 
+	CEikEdwin* iEditWin;
+};
+
+
+#endif /*EDWINTESTCONTROL_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/inc/mpxcommonuihelper.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,527 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definition of helper utility for Common UI
+*
+*/
+
+
+
+#ifndef C_CMPXCOMMONUIHELPER_H
+#define C_CMPXCOMMONUIHELPER_H
+
+#ifdef __ENABLE_MSK
+#include <eikbtgpc.h>
+#endif // __ENABLE_MSK
+#include <mpxcollectionuihelperobserver.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcommonui.rsg>
+
+#include <mpxcollectionutility.h>  
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+class CMPXDrmUiHelper;
+class MProgressDialogCallback;
+class CAknWaitDialog;
+class MMPXCollectionUtility;
+class CEikButtonGroupContainer;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+ * Common UI helper utility class.
+ *
+ * @lib mpxcommonui.lib
+ * @since S60 3.2.3
+ */
+NONSHARABLE_CLASS( CMPXCommonUiHelper ) : public CBase,
+                                          public MMPXCHelperObserver
+    {
+public:
+
+    /**  Duration display mode */
+    enum TMPXDuratDisplayMode
+        {
+        EMPXDuratAuto = 0,
+        EMPXDuratHMS
+        };
+
+    /**
+    * Two-phased constructor.
+    *
+    * @since S60 3.2.3
+    * @aCollectionUtility Collection utility to use for this helper
+    * @return Pointer to newly created object.
+    */
+    IMPORT_C static CMPXCommonUiHelper* NewL(MMPXCollectionUtility* aCollectionUtility = NULL);
+
+    /**
+    * Destructor.
+    */
+    virtual ~CMPXCommonUiHelper();
+
+    /**
+    * Check if the host application is messaging or browser
+    * @since S60 3.2.3
+    * @return ETrue if host is messaging or browser, EFalse otherwise
+    */
+    IMPORT_C TBool IsHostMessagingBrowserL();
+
+    /**
+    * Check if the host application is the Podcasting Application
+    * @since S60 3.2.3
+    * @return ETrue if host is Podcasting Application, EFalse otherwise
+    */
+    IMPORT_C TBool IsHostPodcastingAppL();
+
+    /**
+    * Check if the host application is messaging
+    * @since S60 3.2.3
+    * @return ETrue if host is messaging, EFalse otherwise
+    */
+    IMPORT_C TBool IsHostMessagingL();
+
+    /**
+    * Check if the host application is browser
+    * @since S60 3.2.3
+    * @return ETrue if host is browser, EFalse otherwise
+    */
+    IMPORT_C TBool IsHostBrowserL();
+
+    /**
+    * Convert to displayable duration
+    *
+    * @since S60 3.2.3
+    * @param aduration Duration in seconds
+    * @param aMode time display mode
+    * @return A heap descriptor that contains displayable duration
+    *         (ownership transferred). Caller must destroy this object
+    *         after use.
+    */
+    IMPORT_C HBufC* DisplayableDurationL(
+        TInt64 aDuration,
+        TMPXDuratDisplayMode aMode = EMPXDuratAuto );
+
+    /**
+    * Convert to displayable duration in text format
+    *
+    * @since S60 3.2.3
+    * @param aduration Duration in seconds
+    * @return A heap descriptor that contains displayable duration
+    *         (ownership transferred). Caller must destroy this object
+    *         after use.
+    */
+    IMPORT_C HBufC* DisplayableDurationInTextL(
+        TInt64 aDuration );
+
+    /**
+    * Set current file as ringing tone.
+    *
+	* @since S60 3.2.3
+    * @param aMedia Media properties of the current track. the media must
+    *               contain the following attributes:
+    *               TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri )
+    *               TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle )
+    *               TMPXAttribute( KMPXMediaIdDrm, EMPXMediaDrmProtected )
+    *               TMPXAttribute( KMPXMediaIdDrm, EMPXMediaDrmRightsStatus )
+    *               TMPXAttribute( KMPXMediaIdDrm, EMPXMediaDrmCanSetAutomated )
+    * @param aSetToAllProfiles ETrue if set ringtone to all profiles.
+    *                          EFalse if set ringtone to active profile.
+    * @param aShowQuery If ETrue, a confirmation query is shown before
+    *                   setting ringtone. This setting will only apply if
+    *                   aSetToAllProfiles is set to ETrue. No effect if
+    *                   aSetToAllProfiles is set to EFalse.
+    */
+    IMPORT_C void DoSetAsRingingToneL(
+        const CMPXMedia& aMedia,
+        TBool aSetToAllProfiles,
+        TBool aShowQuery = EFalse );
+
+    /**
+    * Check if current profile mode is offline mode.
+    *
+    * @since S60 3.2.3
+    * @return ETrue if in Offline mode. Otherwise, EFalse.
+    */
+    IMPORT_C TBool IsProfileOfflineModeL();
+
+    /*
+    * Returns path of the default drive used to store playlist, attachments,
+    * downloads and ringtones.
+    * @return a path of the default drive
+    * @since S60 3.2.3
+    */
+    IMPORT_C HBufC* DefaultDriveLC();
+
+    /*
+    * Returns a path of the next available drive used for saving playlists, ringtones,
+    * downloads and attachments. The order of priority is internal mass store,
+    * MMC, then phone memory.
+    *
+    * @since S60 3.2.3
+    * @param aSize
+    */
+    IMPORT_C HBufC* AvailableDriveLC( TInt aSize );
+
+    /**
+    * Display information note
+    *
+    * @since S60 3.2.3
+    * @param aResourceId Resource id of the text string
+    */
+    IMPORT_C void DisplayInfoNoteL( TInt aResourceId );
+
+    /**
+    * Display information note
+    *
+    * @since S60 3.2.3
+    * @param aText Text to be shown on the note
+    */
+    IMPORT_C void DisplayInfoNoteL( const TDesC& aText );
+
+    /**
+    * Display confirmation note
+    *
+    * @since S60 3.2.3
+    * @param aResourceId Resource id of the text string
+    */
+    IMPORT_C void DisplayConfirmNoteL( TInt aResourceId );
+
+    /**
+    * Display confirmation note
+    *
+    * @since S60 3.2.3
+    * @param aText Text to be shown on the note
+    */
+    IMPORT_C void DisplayConfirmNoteL( const TDesC& aText );
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+    void DisplayConfirmNoteL( const TDesC& aText, TInt aResourceId );
+//#endif // __COVER_DISPLAY
+// Cover UI end
+
+    /**
+    * Convert a value from bytes to kB/MB/GB.
+    *
+    * @since S60 3.2.3
+    * @param aByte Number of bytes
+    * @param ETrue to append " free" at the end of the string
+    */
+    IMPORT_C HBufC* UnitConversionL( TInt64 aByte, TBool aFree = EFalse );
+
+    /**
+    * Finds all user playlists in the given collection
+    *
+    * @since S60 3.2.3
+    */
+    IMPORT_C CMPXMedia* FindPlaylistsL();
+
+    /**
+    * Add to saved playlist
+    *
+    * @since S60 3.2.3
+    * @param aPlaylists media containing a media array
+    *         each entry in the array must contain the following attributes
+    *         TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle )
+    *         TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId )
+    *         TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralDrive )
+    * @param aTracks Tracks to be add to the playlist
+    *          media containing a media array
+    *          must contain at least 1 element
+    *          each entry in the arry must contain the following attributes
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralType )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralCategory )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle )
+    * @param aObserver pointer to callback
+    * @param aCallback call back for wait dialog
+    *
+    * @return ETrue if the user accepts the save dialog, EFalse otherwise
+    */
+    IMPORT_C TBool AddToSavedPlaylistL(
+        const CMPXMedia& aPlaylists, const CMPXMedia& aTracks,
+        MMPXCHelperObserver* aObserver,
+        MProgressDialogCallback* aCallback );
+
+    /**
+    * Create new playlist
+    *
+    * @since S60 3.2.3
+    * @param aTracks Tracks to be add to the playlist
+    *          media containing a media array
+    *          can be a valid array with 0 length
+    *          each entry in the arry must contain the following attributes
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralType )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralCategory )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId )
+    *          TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle )
+    * @param aObserver pointer to callback
+    * @param aCallback call back for wait dialog
+    *
+    * @return ETrue if user accepts the query, EFalse otherwise
+    */
+    IMPORT_C TBool CreatePlaylistL( const CMPXMedia& aTracks,
+        MMPXCHelperObserver* aObserver,
+        MProgressDialogCallback* aCallback );
+
+    /**
+	* Launches rename dialog
+	*
+	* @since S60 3.2.3
+	* @param aOldName original name, with the extension (e.g. a.mp3)
+	* @param aNewName on return, this will be populated with the new name
+	*                 inputed by the user
+	* @param aPath    the path to the file, without the file name (e.g. c:\\data\\)
+	* @return generic return code from AknDialog
+	*/
+	IMPORT_C TInt LaunchRenameDialogL(
+        const TDesC& aOldName,
+		TDes& aNewName,
+		const TDesC& aPath );
+
+    /**
+    * Shows wait note
+    *
+    * @since S60 3.2.3
+    * @param aText text to display
+    * @param aCBAId button group ID
+    * @param aVisibilityDelayOff If set ETrue the dialog will be visible
+    *                            immediality. Use only when the length of
+    *                            the process is ALWAYS over 1.5 seconds.
+    * @param aCallback call back
+    * @param aResId resource Id for the WaitNote, default is R_MPX_GENERIC_WAIT_NOTE
+    */
+    IMPORT_C void ShowWaitNoteL( TDesC& aText, TInt aCBAId,
+        TBool aVisibilityDelayOff, MProgressDialogCallback* aCallback, TInt aResId = R_MPX_GENERIC_WAIT_NOTE );
+
+    /**
+     * Dismiss wait note
+     */
+    IMPORT_C void DismissWaitNoteL();
+
+    /**
+    * Handles displaying the error message for given error code
+    * according to the media object provided
+    *
+    * @since S60 3.2.3
+    * @param aError Error code
+    * @param aMedia MPXMedia object
+    * @param aFile Handle to file
+    * @return KErrNone if no error, or else if a dialog is displayed will
+    *         return the Button ID used to dismiss dialog.
+    */
+    IMPORT_C TInt HandleErrorL( TInt aError,
+                                const CMPXMedia* aMedia=NULL,
+                                RFile* aFile=NULL );
+
+    /**
+    * Adds given resource text as MSK to CBA.
+    *
+    * @since S60 3.2.3
+    * @param aCba a button group container
+    * @param aResourceId middle softkey label.
+    * @param aCommandId command that should be performed when MSK
+    *        is pressed.
+    */
+    IMPORT_C void SetMiddleSoftKeyLabelL(
+        CEikButtonGroupContainer& aCba,
+        TInt aResourceId,
+        TInt aCommandId );
+
+    /**
+    * Removes current MSK label
+    *
+    * @since S60 3.2.3
+    * @param aCba a button group container
+    */
+    IMPORT_C void RemoveMiddleSoftKeyLabel(
+        CEikButtonGroupContainer& aCba );
+
+    /**
+    * Adds given resource icon as MSK to CBA.
+    *
+    * @since S60 3.2.3
+    * @param aCba a button group container
+    * @param aBitmap a bitmap
+    * @param aMask a bitmap mask
+    */
+    IMPORT_C void SetMiddleSoftKeyIconL(
+        CEikButtonGroupContainer& aCba,
+        CFbsBitmap* aBitmap,
+        CFbsBitmap* aMask );
+
+    /**
+    * Generate the next available title from the given title for the category.
+    * The generated title is unique within the category regardless of the
+    * media type within the category and its location.
+    * e.g. c:\data\playlists\Playlist.m3u exists in the collection, the next
+    * available title for the playlist category will be Playlist(01) regardless
+    * if the title is going to be used for a playlist located in e:\data\playlists
+    * or if it's a xml playlist file.
+    *
+    * @since S60 3.2.3
+    * @param aCategory specifies the category for the title
+    * @param aBaseTitle specifies the base title for new title generation
+    * @return the next available title in the category in "BaseTitle(number)"
+    *         format where number is the lowest available number.
+    */
+    IMPORT_C HBufC* GenerateTitleL(
+        TMPXGeneralCategory aCategory,
+        const TDesC& aBaseTitle );
+
+    /**
+    * Checks if Exit option should be hidden
+    *
+    * @since S60 3.2.3
+    * @return ETrue if exit option should be hidden, EFalse otherwise
+    */
+    IMPORT_C TBool ExitOptionHiddenL();
+
+    /**
+    * Sets standalone mode process ID
+    *
+    * @since S60 3.2.3
+    * @param aPId Process ID for standalone mode, 0 to reset
+    * @return ETrue if successful, EFalse otherwise
+    */
+    IMPORT_C static TBool SetStandAloneModePId( TInt64 aPId );
+
+    /**
+    * Gets stand alone mode's process id
+    *
+    * @since S60 3.2.3
+    * @return Stand alone mode's process ID, or 0 if not found
+    */
+    IMPORT_C static TInt64 StandAloneModePId();
+
+
+    /**
+    * Checks if the application with the provided group id is in foreground
+    * This method is required because AppUi()->IsForeground() does not work
+    * properly when the screen saver is active
+    *
+    * @since S60 3.2.3
+    * @param aWindowGroupId application group identifier
+    * @return ETrue if the application is in foreground, EFalse otherwise
+    */
+    IMPORT_C TBool IsForegroundApplication(TInt aWindowGroupId);
+
+    /**
+    * Get the Drive Number for the MMC card
+    *
+    * @since S60 3.2.3
+    * @return Drive Number as defined in TDriveNumber or error code
+    */
+    IMPORT_C static TInt MMCDriveNumber();
+
+
+    /**
+     * Cancel all subsequent operations scheduled by CollectionUiHelper
+     * Currently, this method is only used to cancel adding songs incrementally
+     * to the playlist (user clicks on Cancel on the wait note)
+     */
+    IMPORT_C void CancelCollectionOperation();
+    
+                            
+private:
+
+    /**
+    * C++ default constructor.
+    *
+    * @since S60 3.2.3
+    * @param aCollectionUtility Collection utility to use for this helper
+    */
+    CMPXCommonUiHelper(MMPXCollectionUtility* aCollectionUtility);
+
+    /**
+    * By default Symbian 2nd phase constructor is private.
+    */
+    void ConstructL();
+
+    /**
+    * Check if memory card is present and writable.
+    *
+    * @since S60 3.2.3
+    * @param aDrive If return is ETrue, aDrive contains the drive letter
+    * @return ETrue if memory card is present and writable.
+    */
+    TBool IsMemoryCardWritable( TChar& aDrive );
+
+    /**
+    * Show playlist creation queries: memory selection and name query.
+    *
+    * @since S60 3.2.3
+    * @param aPath Descriptor to receive the full path and
+    *              name of the playlist file
+    */
+    TBool PlaylistCreationQueriesL( TDes& aPath );
+
+    /**
+    * Get next available playlist full pathname based on the information passed.
+    *
+    * @since S60 3.2.3
+    * @param aBuf Buffer contains the file path and initial playlist name (optional).
+    *             This buffer must be big enough to hold all texts.
+    * @return KErrNone if everything ok.
+    */
+    TInt GetNextPlaylistNameL( TDes& aBuf );
+
+    /**
+    * Finds all medias in the specified category. Matching medias should
+    * return the specified attributes
+    *
+    * @since S60 3.2.3
+    * @param aAttrs attributes to return for the matching media(s)
+    * @return matching media(s)
+    */
+    CMPXMedia* FindAllL(TMPXGeneralCategory aCategory, const TArray<TMPXAttribute>& aAttrs);
+
+    /**
+    * From MMPXCHelperObserver
+    * Handles the completion of any collection helper event.
+    *
+    * @since S60 3.2.3
+    * @param aOperation, operation completed
+    * @param aErr. the error code
+    * @param aArgument Argument returned from the operation
+    */
+    void HandleOperationCompleteL( TCHelperOperation aOperation,
+                                   TInt aErr,
+                                   void* aArgument );
+
+    TBool PlaylistCreateNameExistL( TDes& aName, const TParseBase& aParse );
+private:    // Data
+
+    TInt                        iResourceOffset;   // must be freed
+    CMPXDrmUiHelper*            iMpxDrmHelper; // owned
+    MMPXCollectionUiHelper*     iCollectionUiHelper;
+    MMPXCHelperObserver*        iAddObserver;
+    CAknWaitDialog*             iWaitDialog;
+    MMPXCollectionUtility*      iCollectionUtility; // not owned
+    TInt                        iAppUiResourceOffset;
+
+// Cover UI start
+//#ifdef __COVER_DISPLAY
+    TBool iCoverDisplay;
+//#endif
+// Cover UI end
+
+    };
+
+#endif  // C_CMPXCOMMONUIHELPER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/inc/ui_mpxmusicplayertest.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Cmpxmusicplayertest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+#ifndef UI_MPXMUSICPLAYERTEST_H
+#define UI_MPXMUSICPLAYERTEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+
+#include <mpxtlshelper.h>
+#include "mpxcommonuihelper.h"
+#include <mpxcollectionutility.h>
+#include "edwintestcontrol.h"
+#include <mpxcollectionuihelperobserver.h>
+
+#include <AknProgressDialog.h>
+#include <EIKCMOBS.H>
+// CONSTANTS
+const TInt KErrBadTestParameter = -1000;         // Error on configuration file
+const TUid KHostUid = { 0x101FB3E3 };
+const TInt KMusicPlayerMSKControlID = 3;
+// MACROS
+// Logging path
+#ifdef __WINSCW__
+_LIT( KmpxmusicplayertestLogPath, "\\testing\\log\\" );
+_LIT( KRingToneFileName, "c:\\testing\\data\\mpxtest1.mp3" );
+_LIT( KRingToneFilePath, "c:\\testing\\data\\" );
+#else
+_LIT( KmpxmusicplayertestLogPath, "e:\\testing\\log\\" );
+_LIT( KRingToneFileName, "e:\\testing\\data\\mpxtest1.mp3" );
+_LIT( KRingToneFilePath, "e:\\testing\\data\\" );
+#endif
+// Log file
+_LIT( KmpxmusicplayertestLogFile, "mpxmusicplayertest.txt" );
+
+_LIT( KTagKErrNone, "KErrNone" );
+_LIT( KTagKErrNotReady, "KErrNotReady" );
+_LIT( KMPXIliegalCharacters, "IliegalCharacters" );
+_LIT( KMPXFileNotFound, "FileNotFound" );
+_LIT( KMPXSaveToCollectionNote, "Saved_to_collection_successfully!" );
+_LIT( KMPXSaveNote, "Saved_successfully!" );
+
+// FORWARD DECLARATIONS
+class MPXTlsHelper;
+class CMPXCommonUiHelper;
+class MMPXCollectionUtility;
+class CEdwinTestControl;
+
+// CLASS DECLARATION
+
+/**
+*  Cmpxmusicplayertest test class for STIF Test Framework TestScripter.
+*
+*  @lib mpxmusicplayertest.lib
+*  @since S60 v3.2.3
+*/
+NONSHARABLE_CLASS(Cmpxmusicplayertest) : public CScriptBase,
+										 public MProgressDialogCallback,
+										 public MEikCommandObserver,
+										 public MMPXCHelperObserver
+    {
+	public:  // Constructors and destructor
+	
+		/**
+		* Two-phased constructor.
+		*/
+		static Cmpxmusicplayertest* NewL( CTestModuleIf& aTestModuleIf );
+	
+		/**
+		* Destructor.
+		*/
+		virtual ~Cmpxmusicplayertest();
+	
+	public: // Functions from base classes
+	
+		/**
+		* From CScriptBase Runs a script line.
+		* @since S60 v3.2.3
+		* @param aItem Script line containing method name and parameters
+		* @return Symbian OS error code
+		*/
+		virtual TInt RunMethodL( CStifItemParser& aItem );
+		
+		// function from MProgressDialogCallback
+		virtual void DialogDismissedL( TInt aButtonId );
+		//function from MEikCommandObserver
+		virtual void ProcessCommandL(TInt aCommandId);
+		//function from MMPXCHelperObserver
+		virtual void HandleOperationCompleteL( TCHelperOperation aOperation,
+		                                           TInt aErr,
+		                                           void* aArgument );
+	private:
+	
+		/**
+		* C++ default constructor.
+		*/
+		Cmpxmusicplayertest( CTestModuleIf& aTestModuleIf );
+	
+		/**
+		* By default Symbian 2nd phase constructor is private.
+		*/
+		void ConstructL();
+	
+		/**
+		* Frees all resources allocated from test methods.
+		* @since S60 v3.2.3
+		*/
+		void Delete();
+	
+		/**
+		* Test methods are listed below.
+		* @since S60 v3.2.3
+		* @param aItem Script line containing parameters.
+		* @return Symbian OS error code.
+		*/
+		TInt Initialize( CStifItemParser& aItem );
+		TInt VerifyHostUid( CStifItemParser& aItem );
+		TInt VerifyNeedSave( CStifItemParser& aItem );
+		TInt VerifyAllowMove( CStifItemParser& aItem );
+		TInt VerifyLaunchMode( CStifItemParser& aItem );
+		TInt VerifyFilePath( CStifItemParser& aItem );
+		TInt Uninitialize( CStifItemParser& aItem );                      			  //debug pass  10,28
+		
+		//test functions for mpxcommonuihelper.h
+		//to test IMPORT_C static CMPXCommonUiHelper* NewL(MMPXCollectionUtility* aCollectionUtility = NULL);
+		TInt CMPXCommonUiHelperNewL( CStifItemParser& aItem );                        //debug pass  10,28
+		//to test virtual ~CMPXCommonUiHelper();
+		TInt CMPXCommonUiHelperDestruct( CStifItemParser& aItem );                    //debug pass  10,28
+		//to test IMPORT_C TBool IsHostMessagingBrowserL();
+		TInt UiHelperIsHostMessagingBrowserL( CStifItemParser& aItem );               //debug pass  10,28
+		//to test IMPORT_C TBool IsHostPodcastingAppL();
+		TInt UiHelperIsHostPodcastingAppL( CStifItemParser& aItem ); 				  //debug pass  10,28
+		//to test IMPORT_C TBool IsHostMessagingL();
+		TInt UiHelperIsHostMessagingL( CStifItemParser& aItem );    				  //debug pass  10,28
+		//to test IMPORT_C TBool IsHostBrowserL();
+		TInt UiHelperIsHostBrowserL( CStifItemParser& aItem ); 						  //debug pass  10,28
+		//to test IMPORT_C HBufC* DisplayableDurationL(
+	    //											TInt64 aDuration,
+	    //											TMPXDuratDisplayMode aMode = EMPXDuratAuto );
+		TInt UiHelperDisplayableDurationL( CStifItemParser& aItem );  				  //debug pass  10,29
+		//to test IMPORT_C HBufC* DisplayableDurationInTextL(TInt64 aDuration );
+		TInt UiHelperDisplayableDurationInTextL( CStifItemParser& aItem ); 			  //debug pass  10,29 
+	    //to test IMPORT_C void DoSetAsRingingToneL(
+	    //											const CMPXMedia& aMedia,
+	    //											TBool aSetToAllProfiles,
+	    //											TBool aShowQuery = EFalse );
+		TInt UiHelperDoSetAsRingingToneL( CStifItemParser& aItem );  			 	  //debug pass  10,29	
+		//to test IMPORT_C TBool IsProfileOfflineModeL();
+		TInt UiHelperIsProfileOfflineModeL( CStifItemParser& aItem );			 	  //debug pass  10,29	
+		//to test IMPORT_C HBufC* DefaultDriveLC();
+		TInt UiHelperDefaultDriveLC( CStifItemParser& aItem );			 	 		  //debug 10,29 crash-->pass 10,31
+		//to test IMPORT_C HBufC* AvailableDriveLC( TInt aSize );
+		TInt UiHelperAvailableDriveLC( CStifItemParser& aItem );		 	 		  //debug 10,29	crash-->pass 10,31
+		//to test IMPORT_C void DisplayInfoNoteL( TInt aResourceId );
+		TInt UiHelperDisplayInfoNoteLRSCID( CStifItemParser& aItem );  			 	  //debug pass  10,29			
+		//to test IMPORT_C void DisplayInfoNoteL( const TDesC& aText );
+		TInt UiHelperDisplayInfoNoteLText( CStifItemParser& aItem ); 			 	  //debug pass  10,29	 		
+		//to test IMPORT_C void DisplayConfirmNoteL( TInt aResourceId );
+		TInt UiHelperDisplayConfirmNoteLRSCID( CStifItemParser& aItem );		 	  //debug pass  10,29	 	
+		//to test IMPORT_C void DisplayConfirmNoteL( const TDesC& aText );
+		TInt UiHelperDisplayConfirmNoteLText( CStifItemParser& aItem );			 	  //debug pass  10,29	
+		//to test IMPORT_C HBufC* UnitConversionL( TInt64 aByte, TBool aFree = EFalse );
+		TInt UiHelperUnitConversionL( CStifItemParser& aItem );				 		  //debug pass  10,29	
+		//to test IMPORT_C CMPXMedia* FindPlaylistsL();
+		TInt UiHelperFindPlaylistsL( CStifItemParser& aItem );				 		  //debug pass  10,29		
+		//to test IMPORT_C TBool AddToSavedPlaylistL(
+	    //						const CMPXMedia& aPlaylists, const CMPXMedia& aTracks,
+	    //						MMPXCHelperObserver* aObserver,
+	    //						MProgressDialogCallback* aCallback );
+		TInt UiHelperAddToSavedPlaylistL( CStifItemParser& aItem );		 			  //debug pass  10,30	
+		//to test IMPORT_C TBool CreatePlaylistL( const CMPXMedia& aTracks,
+	    //										 MMPXCHelperObserver* aObserver,
+	    //										 MProgressDialogCallback* aCallback );
+		TInt UiHelperCreatePlaylistL( CStifItemParser& aItem );		 			  	  //debug pass  10,30	
+		//to test IMPORT_C TInt LaunchRenameDialogL(
+	    //											const TDesC& aOldName,
+		//											TDes& aNewName,
+		//											const TDesC& aPath );
+		TInt UiHelperLaunchRenameDialogL( CStifItemParser& aItem );		 			  //debug pass  10,30	
+		//to test IMPORT_C void ShowWaitNoteL( TDesC& aText, TInt aCBAId,
+	    //									   TBool aVisibilityDelayOff,
+		//									   MProgressDialogCallback* aCallback,
+		//									   TInt aResId = R_MPX_GENERIC_WAIT_NOTE );
+		TInt UiHelperShowWaitNoteL( CStifItemParser& aItem );						  //debug 10,30	crash-->pass 5,11,2008
+		//to test IMPORT_C void DismissWaitNoteL();
+		TInt UiHelperDismissWaitNoteL( CStifItemParser& aItem );				  //debug 10,30	crash-->pass 5,11,2008
+		//to test IMPORT_C TInt HandleErrorL( TInt aError,
+	    //									  const CMPXMedia* aMedia=NULL,
+	    //									  RFile* aFile=NULL );
+		TInt UiHelperHandleErrorL( CStifItemParser& aItem );		 			 	  //debug pass  10,30
+		//to test IMPORT_C void SetMiddleSoftKeyLabelL(
+	    //										CEikButtonGroupContainer& aCba,
+	    //										TInt aResourceId,
+	    //										TInt aCommandId );
+		TInt UiHelperSetMiddleSoftKeyLabelL( CStifItemParser& aItem );			  	  //debug 10,30	crash-->pass 6,11,2008
+		// to test IMPORT_C void RemoveMiddleSoftKeyLabel(CEikButtonGroupContainer& aCba );
+		TInt UiHelperRemoveMiddleSoftKeyLabel( CStifItemParser& aItem );		  	  //debug 10,30	crash-->pass 6,11,2008
+	    //to test IMPORT_C void SetMiddleSoftKeyIconL(
+	    //											  CEikButtonGroupContainer& aCba,
+	    //											  CFbsBitmap* aBitmap,
+	    //											  CFbsBitmap* aMask );
+	    TInt UiHelperSetMiddleSoftKeyIconL( CStifItemParser& aItem );                 // debug 10,30 crash-->pass 6,11,2008 
+	    //to test IMPORT_C HBufC* GenerateTitleL(
+	    //											TMPXGeneralCategory aCategory,
+	    //											const TDesC& aBaseTitle );
+		TInt UiHelperGenerateTitleL( CStifItemParser& aItem );  		 			  //debug pass  10,30  
+		//to test IMPORT_C TBool ExitOptionHiddenL();
+		TInt UiHelperExitOptionHiddenL( CStifItemParser& aItem );		 			  //debug pass  10,30   
+		//to test IMPORT_C static TBool SetStandAloneModePId( TInt64 aPId );
+		TInt UiHelperSetStandAloneModePId( CStifItemParser& aItem );		 		  //debug pass  10,30 	
+		//to test IMPORT_C static TInt64 StandAloneModePId();
+		TInt UiHelperStandAloneModePId( CStifItemParser& aItem );		 		  	  //debug pass  10,30 
+		//to test IMPORT_C TBool IsForegroundApplication(TInt aWindowGroupId);
+		TInt UiHelperIsForegroundApplication( CStifItemParser& aItem );	 		  	  //debug pass  10,30 
+		//to test IMPORT_C static TInt MMCDriveNumber();
+		TInt UiHelperMMCDriveNumber( CStifItemParser& aItem );	 		 		  	  //debug pass  10,30 
+		//to test IMPORT_C void CancelCollectionOperation();
+		TInt UiHelperCancelCollectionOperation( CStifItemParser& aItem );		  	  //debug       10,30 	through
+		
+		
+		
+	private:    // Data
+		// TLS Helper only contains static functions; no instance is necessary.
+		CMPXCommonUiHelper* iUiHelper;
+		CEdwinTestControl* iEdwinTestControl ;
+		MMPXCollectionUtility* iUtilityForUiHelper;
+    };
+
+#endif      // MPXMUSICPLAYERTEST_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/src/EdwinTestControl.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CEdwinTestControl test class for STIF Test Framework TestScripter.
+*
+*/
+#include "EdwinTestControl.h"
+#include <eikenv.h>
+#include <aknsutils.h> 
+#include <aknsdrawutils.h> 
+#include <aknutils.h> 
+#include <aknsbasicbackgroundcontrolcontext.h>
+
+
+CEdwinTestControl::~CEdwinTestControl()
+	{
+	delete iEditWin;
+	iEditWin = NULL;
+	delete iBgContext;
+	iBgContext = NULL;
+	}   
+ 
+CEdwinTestControl* CEdwinTestControl::NewL(void)
+    {
+    CEdwinTestControl* self = new(ELeave)CEdwinTestControl();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+void CEdwinTestControl::ConstructL(void)
+    {
+    CreateWindowL();
+ 
+    iEditWin = new (ELeave) CEikEdwin();
+    iEditWin->ConstructL( 0, 100, 100, 1 );
+    iEditWin->SetContainerWindowL( *this );
+    iEditWin->CreateTextViewL();
+//    iEditWin->SetInputCapabilitiesL( TCoeInputCapabilities::EAllText );
+    
+	// make first with no size at all
+	iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgScreen,TRect(0,0,1,1), ETrue );
+	// Setting rect will cause SizeChanged to be called
+	// and iBgContext size & position is updated accordingly.
+	SetRect( CEikonEnv::Static()->EikAppUi()->ClientRect() );	
+	
+	ActivateL();
+	DrawNow();
+    }
+ 
+void CEdwinTestControl::SizeChanged()
+	{
+	if ( iBgContext )
+		{
+		iBgContext->SetRect(Rect());
+ 
+		if ( &Window() )
+			{
+			iBgContext->SetParentPos( PositionRelativeToScreen() );
+			}
+		}
+	if ( iEditWin )
+		{
+		iEditWin->SetRect(Rect());	
+		}
+	}
+ 
+ 
+void CEdwinTestControl::HandleResourceChange( TInt aType )
+	{
+	TRect rect;
+ 
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+    	{    
+        AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
+        SetRect(rect);
+    	}
+ 
+	CCoeControl::HandleResourceChange(aType);
+	}
+ 
+ 
+TTypeUid::Ptr CEdwinTestControl::MopSupplyObject(TTypeUid aId)
+	{
+	if ( iBgContext )
+		{
+		return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+		}	
+
+	return CCoeControl::MopSupplyObject( aId );
+	}
+ 
+ 
+void CEdwinTestControl::Draw(const TRect& aRect) const
+	{
+	CWindowGc& gc = SystemGc();
+    
+    // draw background skin first.
+  	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+	AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect );
+	}
+
+TInt CEdwinTestControl::CountComponentControls() const
+{
+    return 1;
+}
+ 
+CCoeControl* CEdwinTestControl::ComponentControl(TInt aIndex) const
+{
+    switch (aIndex)
+    	{
+        case 0:
+        	return iEditWin;
+        default:
+            return 0;
+    	}
+}
+
+void CEdwinTestControl::HandleControlEventL( CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/)
+	{
+
+	}
+
+TKeyResponse CEdwinTestControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
+	{
+	if ( iEditWin )
+		{
+		return iEditWin->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/src/ui_mpxmusicplayertest.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,180 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Cmpxmusicplayertest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include <SettingServerClient.h>
+#include "ui_mpxmusicplayertest.h"
+
+#include <COEAUI.H>
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::Cmpxmusicplayertest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// ---------------------------------------------------------------------------
+//
+Cmpxmusicplayertest::Cmpxmusicplayertest(
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// ---------------------------------------------------------------------------
+//
+void Cmpxmusicplayertest::ConstructL()
+    {
+    iLog = CStifLogger::NewL( KmpxmusicplayertestLogPath,
+                          KmpxmusicplayertestLogFile,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+
+	// Print title of the test case
+    TName title;
+    TestModuleIf().GetTestCaseTitleL(title);
+    iLog->Log(_L(" "));
+    iLog->Log(_L("[Title] %S"), &title);
+    
+    //=================================added UI controler
+    iEdwinTestControl = CEdwinTestControl::NewL();
+//    CleanupStack::PushL( iEdwinTestControl );
+    CCoeEnv::Static()->AppUi()->AddToStackL( iEdwinTestControl );
+    iEdwinTestControl->MakeVisible(ETrue);
+//    CleanupStack::Pop( iEdwinTestControl );
+    //=================================added UI controler
+    }
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::NewL
+// Two-phased constructor.
+// ---------------------------------------------------------------------------
+//
+Cmpxmusicplayertest* Cmpxmusicplayertest::NewL(
+    CTestModuleIf& aTestModuleIf )
+    {
+    Cmpxmusicplayertest* self = new (ELeave) Cmpxmusicplayertest( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+    return self;
+    }
+// function from MMPXCHelperObserver
+void Cmpxmusicplayertest::DialogDismissedL( TInt aButtonId )
+    {
+    iLog->Log(_L("MProgressDialogCallback::DialogDismissedL is called,with a TInt aButtonId %d pressed."),aButtonId);
+    switch(aButtonId)
+    	{
+    	case EAknSoftkeyOk:
+    	case EAknSoftkeySelect:
+    	case EAknSoftkeyYes:
+    		if(iEdwinTestControl)
+    			{
+    			iEdwinTestControl->DrawDeferred();
+    			}
+    		break;
+    	case EAknSoftkeyCancel:
+    		//TInt err = UiHelperDismissWaitNoteL();
+    		TInt err = KErrNone;  
+		    TRAP(err,iUiHelper->DismissWaitNoteL());
+    		iLog->Log(_L("EAknSoftkeyCancel is pressed. %d returned."),err);
+    		break;		
+    	default:
+    		iLog->Log(_L("Nothing is done."));
+    		break;	
+    	}
+    }
+
+// function from MEikCommandObserver
+void Cmpxmusicplayertest::ProcessCommandL(TInt aCommandId)
+    {
+    iLog->Log(_L("MEikCommandObserver::ProcessCommandL is called,with a TInt aCommandId %d"),aCommandId);
+    }
+
+// function from MMPXCHelperObserver
+void Cmpxmusicplayertest::HandleOperationCompleteL( TCHelperOperation aOperation,
+        											TInt aErr,
+        											void* /*aArgument*/ )
+    {
+    switch( aOperation )
+    	{
+    	case EAddOp:
+    		iLog->Log(_L("A playlist is created with an error %d returned."),		aErr);
+    		break;
+    	case EDeleteOp:	
+    		iLog->Log(_L("A playlist is deleted with an error %d returned."),		aErr);
+    		break;
+    	case ESetOp:	
+    	    iLog->Log(_L("A playlist is set with an error %d returned."),			aErr);
+    	    break;
+    	case EEmbeddedOpenOp:	
+    	    iLog->Log(_L("A playlist is embeded open with an error %d returned."),	aErr);
+    	    break;
+    	case EMoveOp:	
+    	    iLog->Log(_L("A playlist is moved with an error %d returned."),			aErr);
+    	    break;   
+    	case EExportPlaylistOp:	
+    	    iLog->Log(_L("A playlist is exported with an error %d returned."),		aErr);
+    	    break;  
+    	case ERenameOp:	
+    	    iLog->Log(_L("A playlist is renamed with an error %d returned."),		aErr);
+    	    break;
+    	case EReorderPlaylistOp:	
+    	    iLog->Log(_L("A playlist is reordered with an error %d returned."),		aErr);
+    	    break;
+    	default:
+    		iLog->Log(_L("Nothing is done."));
+    		break;
+    	}     
+    }
+
+
+// Destructor
+Cmpxmusicplayertest::~Cmpxmusicplayertest()
+    {
+    // Delete resources allocated from test methods
+    Delete();
+    // Delete logger
+    delete iLog;
+    
+    //added 28,10,2008
+    if(iEdwinTestControl)
+    	{
+    	CCoeEnv::Static()->AppUi()->RemoveFromStack( iEdwinTestControl );
+    	delete iEdwinTestControl;
+    	}
+   
+    }
+
+// ======== GLOBAL FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL(
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+    return ( CScriptBase* ) Cmpxmusicplayertest::NewL( aTestModuleIf );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_app_api/tsrc/ui_mpxmusicplayertest/src/ui_mpxmusicplayertestBlocks.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,1442 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Cmpxmusicplayertest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32svr.h>
+#include <badesca.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+
+#include <mpxtlshelper.h>
+#include "ui_mpxmusicplayertest.h"
+#include <COEAUI.H>
+#include <EIKENV.H>
+#include "edwintestcontrol.h"
+#include <mpxmediadrmdefs.h>
+#include <mpxmedia.h>
+#include <mpxattribute.h>
+#include <StringLoader.h>
+#include <mpx.rsg>
+#include <mpxmediaarray.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxcommonui.rsg>
+#include <eikbtgpc.h>
+#include <mpxinternalcrkeys.h>
+#include <APGTASK.H>
+#include <avkon.mbg>
+#include <AknIconUtils.h>
+#include <aknconsts.h>
+#include <avkon.rsg>
+#include <COEMAIN.H>
+//#include <MediaPlayer.rsg> //though it seems a little bit curious to use mediaplayer's resource 4,11,2008
+#include <mpxplaybackcommanddefs.h>
+#include <AknWaitDialog.h>
+#include <eikbtgpc.h>
+#include <eikbtgrp.h>
+#include <EIKDIALG.H>
+
+
+class CMPXMedia;
+class CMPXMediaArray;
+class CEikButtonGroupContainer;
+class TApaTaskList;
+class CCoeEnv;
+class CAknWaitDialog;
+class CEikButtonGroupContainer;
+class MEikButtonGroup;
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::Delete
+// Delete here all resources allocated and opened from test methods.
+// Called from destructor.
+// ---------------------------------------------------------------------------
+//
+void Cmpxmusicplayertest::Delete()
+    {
+	MPXTlsHelper::Uninitialize();
+    }
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::RunMethodL(
+    CStifItemParser& aItem )
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function.
+        ENTRY( "Initialize", Cmpxmusicplayertest::Initialize ),
+        ENTRY( "VerifyHostUid", Cmpxmusicplayertest::VerifyHostUid ),
+        ENTRY( "VerifyNeedSave", Cmpxmusicplayertest::VerifyNeedSave ),
+        ENTRY( "VerifyAllowMove", Cmpxmusicplayertest::VerifyAllowMove ),
+        ENTRY( "VerifyLaunchMode", Cmpxmusicplayertest::VerifyLaunchMode ),
+        ENTRY( "VerifyFilePath", Cmpxmusicplayertest::VerifyFilePath ),
+        ENTRY( "Uninitialize", Cmpxmusicplayertest::Uninitialize ),
+       
+        //test functions for mpxcommonuihelper.h
+        ENTRY( "CMPXCommonUiHelperNewL", Cmpxmusicplayertest::CMPXCommonUiHelperNewL ),
+        ENTRY( "CMPXCommonUiHelperDestruct", Cmpxmusicplayertest::CMPXCommonUiHelperDestruct ),
+        ENTRY( "UiHelperIsHostMessagingBrowserL", Cmpxmusicplayertest::UiHelperIsHostMessagingBrowserL ),
+        ENTRY( "UiHelperIsHostPodcastingAppL", Cmpxmusicplayertest::UiHelperIsHostPodcastingAppL ),
+        ENTRY( "UiHelperIsHostMessagingL", Cmpxmusicplayertest::UiHelperIsHostMessagingL ),
+        ENTRY( "UiHelperIsHostBrowserL", Cmpxmusicplayertest::UiHelperIsHostBrowserL ),
+        ENTRY( "UiHelperDisplayableDurationL", Cmpxmusicplayertest::UiHelperDisplayableDurationL ),
+        ENTRY( "UiHelperDisplayableDurationInTextL", Cmpxmusicplayertest::UiHelperDisplayableDurationInTextL ),
+        ENTRY( "UiHelperDoSetAsRingingToneL", Cmpxmusicplayertest::UiHelperDoSetAsRingingToneL ),
+        ENTRY( "UiHelperIsProfileOfflineModeL", Cmpxmusicplayertest::UiHelperIsProfileOfflineModeL ),
+        ENTRY( "UiHelperDefaultDriveLC", Cmpxmusicplayertest::UiHelperDefaultDriveLC ),
+        ENTRY( "UiHelperAvailableDriveLC", Cmpxmusicplayertest::UiHelperAvailableDriveLC ),
+        ENTRY( "UiHelperDisplayInfoNoteLRSCID", Cmpxmusicplayertest::UiHelperDisplayInfoNoteLRSCID ),
+        ENTRY( "UiHelperDisplayInfoNoteLText", Cmpxmusicplayertest::UiHelperDisplayInfoNoteLText ),
+        ENTRY( "UiHelperDisplayConfirmNoteLRSCID", Cmpxmusicplayertest::UiHelperDisplayConfirmNoteLRSCID ),
+        ENTRY( "UiHelperDisplayConfirmNoteLText", Cmpxmusicplayertest::UiHelperDisplayConfirmNoteLText ),
+        ENTRY( "UiHelperUnitConversionL", Cmpxmusicplayertest::UiHelperUnitConversionL ),
+        ENTRY( "UiHelperFindPlaylistsL", Cmpxmusicplayertest::UiHelperFindPlaylistsL ),
+        ENTRY( "UiHelperAddToSavedPlaylistL", Cmpxmusicplayertest::UiHelperAddToSavedPlaylistL ),
+        ENTRY( "UiHelperCreatePlaylistL", Cmpxmusicplayertest::UiHelperCreatePlaylistL ),
+        ENTRY( "UiHelperLaunchRenameDialogL", Cmpxmusicplayertest::UiHelperLaunchRenameDialogL ),
+        ENTRY( "UiHelperShowWaitNoteL", Cmpxmusicplayertest::UiHelperShowWaitNoteL ),
+        ENTRY( "UiHelperDismissWaitNoteL", Cmpxmusicplayertest::UiHelperDismissWaitNoteL ),
+        ENTRY( "UiHelperHandleErrorL", Cmpxmusicplayertest::UiHelperHandleErrorL ),
+        ENTRY( "UiHelperSetMiddleSoftKeyLabelL", Cmpxmusicplayertest::UiHelperSetMiddleSoftKeyLabelL ),
+        ENTRY( "UiHelperRemoveMiddleSoftKeyLabel", Cmpxmusicplayertest::UiHelperRemoveMiddleSoftKeyLabel ),
+        ENTRY( "UiHelperSetMiddleSoftKeyIconL", Cmpxmusicplayertest::UiHelperSetMiddleSoftKeyIconL ),  
+        ENTRY( "UiHelperGenerateTitleL", Cmpxmusicplayertest::UiHelperGenerateTitleL ),
+        ENTRY( "UiHelperExitOptionHiddenL", Cmpxmusicplayertest::UiHelperExitOptionHiddenL ),
+        ENTRY( "UiHelperSetStandAloneModePId", Cmpxmusicplayertest::UiHelperSetStandAloneModePId ),
+        ENTRY( "UiHelperStandAloneModePId", Cmpxmusicplayertest::UiHelperStandAloneModePId ),
+        ENTRY( "UiHelperIsForegroundApplication", Cmpxmusicplayertest::UiHelperIsForegroundApplication ),
+        ENTRY( "UiHelperMMCDriveNumber", Cmpxmusicplayertest::UiHelperMMCDriveNumber ),
+        ENTRY( "UiHelperCancelCollectionOperation", Cmpxmusicplayertest::UiHelperCancelCollectionOperation ),
+        
+        };
+
+    const TInt count = sizeof( KFunctions ) /
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::Initialize
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::Initialize( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::Initialize"));
+    TRAPD( err , MPXTlsHelper::InitializeL());
+    if ( err != KErrNone )
+    	{
+    	iLog->Log(_L("InitializeL returned: %d"), err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::Uninitialize
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::Uninitialize( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::Uninitialize"));
+    TInt err = KErrNone;
+    MPXTlsHelper::Uninitialize();
+    if ( err != KErrNone )
+    	{
+    	iLog->Log(_L("Uninitialize returned: %d"), err);
+    	}
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::VerifyHostUid
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::VerifyHostUid( CStifItemParser& aItem )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::VerifyHostUid"));
+    TInt err = KErrNone;
+    TPtrC string;
+	if ( KErrNone == aItem.GetNextString(string) )
+		{
+		if ( string == KTagKErrNone )
+			{
+			TRAP( err , MPXTlsHelper::SetHostUidL(KHostUid));
+			if ( err == KErrNone )
+				{
+				if ( KHostUid == MPXTlsHelper::HostUid() )
+					{
+					iLog->Log(_L("Host Uid match!"));
+					}
+				else
+					{
+					iLog->Log(_L("ERROR: Host Uid doesn't match!"));
+					err = KErrGeneral;
+					}
+				}
+			else
+				{
+				iLog->Log(_L("SetHostUidL returned: %d"), err);
+				}
+			}
+		else if ( string == KTagKErrNotReady )
+			{
+			TRAP( err , MPXTlsHelper::SetHostUidL(KHostUid));
+			if ( err == KErrNotReady )
+				{
+				err = KErrNone;
+				}
+			else
+				{
+				iLog->Log(_L("ERROR: %d"), err);
+				}
+			}
+		else
+			{
+			iLog->Log(_L("Bad parameter on config file"));
+			err = KErrBadTestParameter;
+			}
+		}
+	else
+		{
+		iLog->Log(_L("Bad parameter on config file"));
+		err = KErrBadTestParameter;
+		}
+
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::VerifyNeedSave
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::VerifyNeedSave( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::VerifyNeedSave"));
+    MPXTlsHelper::SetNeedSave(EFalse);
+    if ( MPXTlsHelper::NeedSave() )
+    	{
+    	iLog->Log(_L("ERROR: Flag doesn't match! - true"));
+    	return KErrGeneral;
+    	}
+
+    MPXTlsHelper::SetNeedSave(ETrue);
+    if ( !MPXTlsHelper::NeedSave() )
+    	{
+    	iLog->Log(_L("ERROR: Flag doesn't match! - false"));
+    	return KErrGeneral;
+    	}
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::VerifyAllowMove
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::VerifyAllowMove( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::VerifyAllowMove"));
+    MPXTlsHelper::SetAllowMove(EFalse);
+    if ( MPXTlsHelper::AllowMove() )
+    	{
+    	iLog->Log(_L("ERROR: Flag doesn't match! - true"));
+    	return KErrGeneral;
+    	}
+
+    MPXTlsHelper::SetAllowMove(ETrue);
+    if ( !MPXTlsHelper::AllowMove() )
+    	{
+    	iLog->Log(_L("ERROR: Flag doesn't match! - false"));
+    	return KErrGeneral;
+    	}
+
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::VerifyLaunchMode
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::VerifyLaunchMode( CStifItemParser& aItem )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::VerifyLaunchMode"));
+    TInt err = KErrNone;
+    TPtrC string;
+	if ( KErrNone == aItem.GetNextString(string) )
+		{
+		if ( string == KTagKErrNone )
+			{
+			TRAP( err , MPXTlsHelper::SetLaunchModeL(EMPXLaunchModePlaying));
+			if ( err == KErrNone )
+				{
+				if ( EMPXLaunchModePlaying == MPXTlsHelper::LaunchMode() )
+					{
+					iLog->Log(_L("Launch mode match!"));
+					}
+				else
+					{
+					iLog->Log(_L("ERROR: Launch mode doesn't match!"));
+					err = KErrGeneral;
+					}
+				}
+			else
+				{
+				iLog->Log(_L("SetLaunchModeL returned: %d"), err);
+				}
+			}
+		else if ( string == KTagKErrNotReady )
+			{
+			TRAP( err , MPXTlsHelper::SetLaunchModeL(EMPXLaunchModePlaying));
+			if ( err == KErrNotReady )
+				{
+				err = KErrNone;
+				}
+			else
+				{
+				iLog->Log(_L("ERROR: %d"), err);
+				}
+			}
+		else
+			{
+			iLog->Log(_L("Bad parameter on config file"));
+			err = KErrBadTestParameter;
+			}
+		}
+	else
+		{
+		iLog->Log(_L("Bad parameter on config file"));
+		err = KErrBadTestParameter;
+		}
+
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::VerifyFilePath
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::VerifyFilePath( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::VerifyFilePath"));
+    TInt err = KErrNone;
+    TBuf<120> KPath;
+    KPath.Append(_L("Cmpxmusicplayertest"));
+
+    MPXTlsHelper::SetFilePath(KPath);
+    if ( KPath == MPXTlsHelper::FilePath() )
+    	{
+    	iLog->Log(_L("File path match!"));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR: File path doesn't match!"));
+    	err = KErrGeneral;
+    	}
+
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::CMPXCommonUiHelperNewL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::CMPXCommonUiHelperNewL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::CMPXCommonUiHelperNewL"));
+    TInt err = KErrNone;    
+    iUtilityForUiHelper=MMPXCollectionUtility::NewL();
+    TRAP(err,iUiHelper = CMPXCommonUiHelper::NewL(iUtilityForUiHelper));
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("Creation of CMPXCommonUiHelper succeeds!"));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR: Creation of CMPXCommonUiHelper fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::CMPXCommonUiHelperDestruct
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::CMPXCommonUiHelperDestruct( CStifItemParser& /*aItem*/ )
+    {
+	TInt err = KErrNone;  
+    if(iUiHelper)
+    	{
+    	delete iUiHelper;
+    	iUiHelper=NULL;
+    	    if(iUtilityForUiHelper)
+    	    	{
+			    	iUtilityForUiHelper->Close();
+			    	iUtilityForUiHelper=NULL;
+    	    	}
+    	}
+    else
+    	{
+    	iLog->Log(_L("Cmpxmusicplayertest::CMPXCommonUiHelperDestruct"));  
+    	TRAP(err,iUtilityForUiHelper=MMPXCollectionUtility::NewL());
+    	TRAP(err,iUiHelper = CMPXCommonUiHelper::NewL(iUtilityForUiHelper) );
+    	TRAP(err,delete iUiHelper);
+    	iUiHelper=NULL;
+    	iUtilityForUiHelper->Close();
+    	iUtilityForUiHelper=NULL;
+    	if ( err == KErrNone )
+    		{
+    		iLog->Log(_L("CMPXCommonUiHelperDestruct succeeds!"));
+    		}
+    	else
+    		{
+    		iLog->Log(_L("ERROR:CMPXCommonUiHelperDestruct fails!%d returns!"),err);
+    		}
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperIsHostMessagingBrowserL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperIsHostMessagingBrowserL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperIsHostMessagingBrowserL"));
+    TInt err = KErrNone;  
+    TBool isHostMessagingBrowser;
+    TRAP(err,isHostMessagingBrowser=iUiHelper->IsHostMessagingBrowserL());
+    if(err==KErrNone)
+    	{
+    	if(isHostMessagingBrowser)
+    		{
+    		iLog->Log(_L("UiHelperIsHostMessagingBrowserL succeeds with TBool ETrue returned!"));
+    		}
+    	else
+    		{
+    		iLog->Log(_L("UiHelperIsHostMessagingBrowserL succeeds with TBool EFalse returned!"));
+    		}
+    	}
+    else
+    	{
+    	iLog->Log(_L("UiHelperIsHostMessagingBrowserL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperIsHostPodcastingAppL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperIsHostPodcastingAppL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperIsHostPodcastingAppL"));
+    TInt err = KErrNone;  
+    TBool isHostPodcastingApp;
+    TRAP( err , isHostPodcastingApp=iUiHelper->IsHostPodcastingAppL());
+    if(err == KErrNone)
+    	{
+    	if(isHostPodcastingApp)
+    		{
+    		iLog->Log(_L("UiHelperIsHostPodcastingAppL succeeds with TBool ETrue returned!"));
+    		}
+    	else
+    		{
+    		iLog->Log(_L("UiHelperIsHostPodcastingAppL succeeds with TBool EFalse returned!"));
+    		}
+    	}
+    else
+    	{
+    	iLog->Log(_L("UiHelperIsHostPodcastingAppL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperIsHostMessagingL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperIsHostMessagingL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperIsHostMessagingL"));
+    TInt err = KErrNone;  
+    TBool isHostMessaging;
+    TRAP( err , isHostMessaging=iUiHelper->IsHostMessagingL());
+    if(err==KErrNone)
+    	{
+    	if(isHostMessaging)
+    		{
+    		iLog->Log(_L("UiHelperIsHostMessagingL succeeds with TBool ETrue returned!"));
+    		}
+    	else
+    		{
+    		iLog->Log(_L("UiHelperIsHostMessagingL succeeds with TBool EFalse returned!"));
+    		}
+    	}
+    else
+    	{
+    	iLog->Log(_L("UiHelperIsHostMessagingL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperIsHostBrowserL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperIsHostBrowserL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperIsHostBrowserL"));
+    TInt err = KErrNone;  
+    TBool isHostBrowser;
+    TRAP( err , isHostBrowser=iUiHelper->IsHostBrowserL());
+    if( err == KErrNone )
+    	{
+    	if( isHostBrowser )
+    		{
+    		iLog->Log(_L("UiHelperIsHostBrowserL succeeds with TBool ETrue returned!"));
+    		}
+    	else
+    		{
+    		iLog->Log(_L("UiHelperIsHostBrowserL succeeds with TBool EFalse returned!"));
+    		}
+    	}
+    else
+    	{
+    	iLog->Log(_L("UiHelperIsHostBrowserL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperDisplayableDurationL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperDisplayableDurationL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperDisplayableDurationL"));
+    TInt err = KErrNone;    
+    TInt64 duration=100;
+    HBufC* recievedDuration;
+    TRAP( err , recievedDuration = iUiHelper->DisplayableDurationL(duration));
+    delete recievedDuration;
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperDisplayableDurationL succeeds!"));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperDisplayableDurationL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperDisplayableDurationInTextL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperDisplayableDurationInTextL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperDisplayableDurationInTextL"));
+    TInt err = KErrNone;    
+    TInt64 duration=1000000;
+    HBufC* recievedDuration;
+    TRAP( err , recievedDuration=iUiHelper->DisplayableDurationInTextL(duration));
+    delete recievedDuration;
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperDisplayableDurationInTextL succeeds!"));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperDisplayableDurationInTextL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperDoSetAsRingingToneL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperDoSetAsRingingToneL( CStifItemParser& aItem )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperDoSetAsRingingToneL"));
+    TInt err = KErrNone;    
+    CMPXMedia* media=CMPXMedia::NewL();
+    CleanupStack::PushL(media);
+    media->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri )       ,EMPXSong);
+    media->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle)      ,EMPXSong);
+    media->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdDrm,     EMPXMediaDrmProtected )     ,EMPXSong);
+    media->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdDrm,     EMPXMediaDrmRightsStatus )  ,EMPXSong);
+    media->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdDrm,     EMPXMediaDrmCanSetAutomated),EMPXSong);
+    TPtrC string;
+    if ( KErrNone == aItem.GetNextString(string) )
+    	{
+    	TBuf<120> ringToneFileName;
+    	ringToneFileName.Append(KRingToneFilePath);
+    	ringToneFileName.Append(string);
+    	media->SetTextValueL( KMPXMediaGeneralUri, ringToneFileName );
+    	}
+    else
+    	{
+    	media->SetTextValueL( KMPXMediaGeneralUri, KRingToneFileName );
+    	}   
+    TRAP( err , iUiHelper->DoSetAsRingingToneL(*media,EFalse));
+    CleanupStack::PopAndDestroy(media);
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperDoSetAsRingingToneL succeeds!"));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperDoSetAsRingingToneL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperIsProfileOfflineModeL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperIsProfileOfflineModeL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperIsProfileOfflineModeL"));
+    TInt err = KErrNone;    
+    TBool isOfflineMode;
+    TRAP( err , isOfflineMode=iUiHelper->IsProfileOfflineModeL());
+    if ( err == KErrNone )
+    	{
+    	if(isOfflineMode)
+    		{
+    		iLog->Log(_L("UiHelperIsProfileOfflineModeL succeeds with TBool ETrue returned!"));
+    		}
+    	else
+    		{
+    		iLog->Log(_L("UiHelperIsProfileOfflineModeL succeeds with TBool EFalse returned!"));
+    		}
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperIsProfileOfflineModeL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperDefaultDriveLC
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperDefaultDriveLC( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperDefaultDriveLC"));
+    TInt err = KErrNone;    
+    TRAP( err , CleanupStack::PopAndDestroy(iUiHelper->DefaultDriveLC()));
+    if ( err == KErrNone )
+    	{    	
+    	iLog->Log(_L("UiHelperDefaultDriveLC succeeds!"));   		
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperDefaultDriveLC fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperAvailableDriveLC
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperAvailableDriveLC( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperAvailableDriveLC"));
+    TInt err = KErrNone;    
+    TRAP( err , CleanupStack::PopAndDestroy(iUiHelper->AvailableDriveLC(0)));   
+    if ( err == KErrNone )
+    	{    	
+    	iLog->Log(_L("UiHelperAvailableDriveLC succeeds!"));   		
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperAvailableDriveLC fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperDisplayInfoNoteL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperDisplayInfoNoteLRSCID( CStifItemParser& aItem )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperDisplayInfoNoteLRSCID"));
+    TInt err = KErrNone; 
+    TPtrC string;
+    if ( KErrNone == aItem.GetNextString(string) )
+        {
+        if(string==KMPXIliegalCharacters)
+        	{
+        	TRAP( err , iUiHelper->DisplayInfoNoteL(R_MPX_QTN_FLDR_ILLEGAL_CHARACTERS));   ;
+        	}
+        else if(string==KMPXFileNotFound)
+        	{
+        	TRAP( err , iUiHelper->DisplayInfoNoteL(R_MPX_FILE_NOT_FOUND_TEXT));   
+        	}
+        if ( err == KErrNone )
+        	{    	
+        	iLog->Log(_L("UiHelperDisplayInfoNoteLRSCID succeeds!"));   		
+        	}
+        else
+        	{
+        	iLog->Log(_L("ERROR:UiHelperDisplayInfoNoteLRSCID fails!%d returns!"),err);
+        	}
+        } 
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperDisplayInfoNoteLText
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperDisplayInfoNoteLText( CStifItemParser& aItem )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperDisplayInfoNoteLText"));
+    TInt err = KErrNone; 
+    TPtrC string;
+    if ( KErrNone == aItem.GetNextString(string) )
+        {
+        if(string==KMPXIliegalCharacters)
+        	{
+        	_LIT(KilligalCharacters,"Name cannot contain the characters < > \\ /\" |:*?");
+        	HBufC* text=HBufC::New(50);
+        	(*text) = KilligalCharacters;
+        	TRAP( err , iUiHelper->DisplayInfoNoteL(*text)); 
+        	delete text;
+        	}
+        else if(string==KMPXFileNotFound)
+        	{
+        	_LIT(KfileNotFound,"File not found. Operation cancelled.");
+        	HBufC* text=HBufC::New(40);
+        	(*text) = KfileNotFound;
+        	TRAP( err , iUiHelper->DisplayInfoNoteL(*text));
+        	delete text;
+        	}
+        if ( err == KErrNone )
+        	{    	
+        	iLog->Log(_L("UiHelperDisplayInfoNoteLText succeeds!"));   		
+        	}
+        else
+        	{
+        	iLog->Log(_L("ERROR:UiHelperDisplayInfoNoteLText fails!%d returns!"),err);
+        	}
+        } 
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperDisplayConfirmNoteLRSCID
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperDisplayConfirmNoteLRSCID( CStifItemParser& aItem )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperDisplayConfirmNoteLRSCID"));
+    TInt err = KErrNone; 
+    TPtrC string;
+    if ( KErrNone == aItem.GetNextString(string) )
+        {
+        if(string==KMPXSaveToCollectionNote)
+        	{
+        	TRAP( err , iUiHelper->DisplayConfirmNoteL(R_MPX_SAVED_TO_COLLECTION_NOTE));   ;
+        	}
+        else if(string==KMPXSaveNote)
+        	{
+        	TRAP( err , iUiHelper->DisplayConfirmNoteL(R_MPX_SAVED_NOTE));   
+        	}
+        if ( err == KErrNone )
+        	{    	
+        	iLog->Log(_L("UiHelperDisplayConfirmNoteLRSCID succeeds!"));   		
+        	}
+        else
+        	{
+        	iLog->Log(_L("ERROR:UiHelperDisplayConfirmNoteLRSCID fails!%d returns!"),err);
+        	}
+        } 
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperDisplayConfirmNoteLText
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperDisplayConfirmNoteLText( CStifItemParser& aItem )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperDisplayConfirmNoteLText"));
+    TInt err = KErrNone; 
+    TPtrC string;
+    if ( KErrNone == aItem.GetNextString(string) )
+        {
+        if(string==KMPXSaveToCollectionNote)
+        	{
+        	_LIT(KilligalCharacters,"Saved to Music library");
+        	HBufC* text=HBufC::New(50);
+        	(*text) = KilligalCharacters;
+        	TRAP( err , iUiHelper->DisplayConfirmNoteL(*text)); 
+        	delete text;
+        	}
+        else if(string==KMPXSaveNote)
+        	{
+        	_LIT(KfileNotFound,"Saved to Gallery");
+        	HBufC* text=HBufC::New(40);
+        	(*text) = KfileNotFound;
+        	TRAP( err , iUiHelper->DisplayConfirmNoteL(*text));
+        	delete text;
+        	}
+        if ( err == KErrNone )
+        	{    	
+        	iLog->Log(_L("UiHelperDisplayConfirmNoteLText succeeds!"));   		
+        	}
+        else
+        	{
+        	iLog->Log(_L("ERROR:UiHelperDisplayConfirmNoteLText fails!%d returns!"),err);
+        	}
+        } 
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperUnitConversionL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperUnitConversionL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperUnitConversionL"));
+    TInt err = KErrNone;    
+    HBufC* conversion;
+    TInt64 byte=100000;
+    TRAP( err , conversion=iUiHelper->UnitConversionL(byte));   
+    delete conversion;
+    if ( err == KErrNone )
+    	{    	
+    	iLog->Log(_L("UiHelperUnitConversionL succeeds!"));   		
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperUnitConversionL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperFindPlaylistsL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperFindPlaylistsL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperFindPlaylistsL"));
+    TInt err = KErrNone;    
+    CMPXMedia* media;
+    TRAP( err , media=iUiHelper->FindPlaylistsL()); 
+    delete media;
+    if ( err == KErrNone )
+    	{    	
+    	iLog->Log(_L("UiHelperFindPlaylistsL succeeds!"));   		
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperFindPlaylistsL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperAddToSavedPlaylistL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperAddToSavedPlaylistL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperAddToSavedPlaylistL"));
+    TInt err = KErrNone;  
+    
+    CMPXMedia* mediaPlaylist=CMPXMedia::NewL();
+    CleanupStack::PushL(mediaPlaylist);
+    CMPXMediaArray* mediaArrayForPlaylist=CMPXMediaArray::NewL();
+    mediaPlaylist->SetCObjectValueL<CMPXMediaArray>(KMPXMediaArrayContents,mediaArrayForPlaylist);
+    CMPXMedia* mediaPlaylistEntry1=CMPXMedia::NewL();
+    CleanupStack::PushL(mediaPlaylistEntry1);
+    mediaPlaylistEntry1->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle ),EMPXSong);
+    mediaPlaylistEntry1->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId )   ,EMPXSong);
+    mediaPlaylistEntry1->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralDrive ),EMPXSong);
+    mediaArrayForPlaylist->AppendL(mediaPlaylistEntry1);
+        
+    CMPXMedia* mediaPlaylistEntry2=CMPXMedia::NewL();
+    CleanupStack::PushL(mediaPlaylistEntry2);
+    mediaPlaylistEntry2->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle ) ,EMPXSong);
+    mediaPlaylistEntry2->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId )    ,EMPXSong);
+    mediaPlaylistEntry2->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralDrive ) ,EMPXSong);
+    mediaArrayForPlaylist->AppendL(mediaPlaylistEntry2);
+        
+    CMPXMedia* mediaTrack=CMPXMedia::NewL();
+    CleanupStack::PushL(mediaTrack);
+    CMPXMediaArray* mediaArrayForTrack=CMPXMediaArray::NewL();    
+    mediaTrack->SetCObjectValueL<CMPXMediaArray>(KMPXMediaArrayContents,mediaArrayForTrack);
+    CMPXMedia* mediaTrackEntry1=CMPXMedia::NewL();
+    CleanupStack::PushL(mediaTrackEntry1);
+    mediaTrackEntry1->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralType ),    EMPXSong);
+    mediaTrackEntry1->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralCategory ),EMPXSong);
+    mediaTrackEntry1->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId ),	  EMPXSong);  
+    mediaTrackEntry1->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle ),	  EMPXSong);
+    mediaArrayForTrack->AppendL(mediaTrackEntry1);
+      
+    CMPXMedia* mediaTrackEntry2=CMPXMedia::NewL();
+    CleanupStack::PushL(mediaTrackEntry2);
+    mediaTrackEntry2->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralType ),    EMPXSong);
+    mediaTrackEntry2->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralCategory ),EMPXSong);
+    mediaTrackEntry2->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId ),	  EMPXSong);  
+    mediaTrackEntry2->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle ),	  EMPXSong);
+    mediaArrayForTrack->AppendL(mediaTrackEntry2);
+    
+    TBool isPlaylistSaved(EFalse);
+    TRAP(err,isPlaylistSaved=iUiHelper->AddToSavedPlaylistL(*mediaPlaylist,*mediaTrack,this,this));
+
+    CleanupStack::Pop(mediaTrackEntry2);
+    CleanupStack::Pop(mediaTrackEntry1);
+    CleanupStack::PopAndDestroy(mediaTrack);
+    CleanupStack::Pop(mediaPlaylistEntry2);
+    CleanupStack::Pop(mediaPlaylistEntry1);
+    CleanupStack::PopAndDestroy(mediaPlaylist);
+    mediaPlaylist=NULL;
+    delete mediaArrayForPlaylist;
+    delete mediaArrayForTrack;
+    mediaArrayForTrack=NULL;
+
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperAddToSavedPlaylistL succeeds!"));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperAddToSavedPlaylistL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperCreatePlaylistL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperCreatePlaylistL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperCreatePlaylistL"));
+    TInt err = KErrNone;  
+         
+    CMPXMedia* mediaTrack=CMPXMedia::NewL();
+    CleanupStack::PushL(mediaTrack);
+    CMPXMediaArray* mediaArrayForTrack=CMPXMediaArray::NewL();    
+    mediaTrack->SetCObjectValueL<CMPXMediaArray>(KMPXMediaArrayContents,mediaArrayForTrack);
+    CMPXMedia* mediaTrackEntry1=CMPXMedia::NewL();
+    CleanupStack::PushL(mediaTrackEntry1);
+    mediaTrackEntry1->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralType ),    EMPXSong);
+    mediaTrackEntry1->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralCategory ),EMPXSong);
+    mediaTrackEntry1->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId ),	  EMPXSong);  
+    mediaTrackEntry1->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle ),	  EMPXSong);
+    mediaArrayForTrack->AppendL(mediaTrackEntry1);
+      
+    CMPXMedia* mediaTrackEntry2=CMPXMedia::NewL();
+    CleanupStack::PushL(mediaTrackEntry2);
+    mediaTrackEntry2->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralType ),    EMPXSong);
+    mediaTrackEntry2->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralCategory ),EMPXSong);
+    mediaTrackEntry2->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralId ),	  EMPXSong);  
+    mediaTrackEntry2->SetTObjectValueL<TMPXGeneralCategory>(TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralTitle ),	  EMPXSong);
+    mediaArrayForTrack->AppendL(mediaTrackEntry2);
+
+    TBool isPlaylistCreated = EFalse;
+    TRAP(err,isPlaylistCreated=iUiHelper->CreatePlaylistL( *mediaTrack, this, this ));
+    
+    CleanupStack::Pop(mediaTrackEntry2);
+    CleanupStack::Pop(mediaTrackEntry1);
+    CleanupStack::PopAndDestroy(mediaTrack);
+  
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperCreatePlaylistL succeeds!"));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperCreatePlaylistL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperLaunchRenameDialogL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperLaunchRenameDialogL( CStifItemParser& aItem )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperLaunchRenameDialogL"));
+    TInt err = KErrNone; 
+    TBuf<120> oldName;
+    TBuf<120> newName;
+    TBuf<120> path;
+    TPtrC ptrOldname;
+    TPtrC ptrNewname;
+    TPtrC ptrPath;
+    if ( KErrNone == aItem.GetNextString(ptrOldname) )
+    	{
+    	oldName.Append(ptrOldname);
+    	if(KErrNone == aItem.GetNextString(ptrNewname))
+    		{
+    		newName.Append(ptrNewname);
+    		if(KErrNone == aItem.GetNextString(ptrPath))
+    			{
+    			path.Append(ptrPath);
+    			TInt recievedInt;
+    			TRAP(err,recievedInt=iUiHelper->LaunchRenameDialogL(oldName,newName,path));
+    			if ( err == KErrNone )
+		    		{
+		    		iLog->Log(_L("UiHelperLaunchRenameDialogL succeeds!"));
+		    		return err;
+		    		}
+		    	else
+		    		{
+		    		iLog->Log(_L("ERROR:UiHelperLaunchRenameDialogL fails!%d returns!"),err);
+		    		return err;
+		    		}
+    			}
+    		else
+    			{
+    			iLog->Log(_L("UiHelperLaunchRenameDialogL cannot get the path!"));
+    			return KErrBadTestParameter;
+    			}
+    		}
+    	else
+    		{
+    		iLog->Log(_L("UiHelperLaunchRenameDialogL cannot get the new name!"));
+    		return KErrBadTestParameter;
+    		}
+    	}
+    else
+    	{
+    	iLog->Log(_L("UiHelperLaunchRenameDialogL cannot get the old name!"));
+    	return KErrBadTestParameter;
+    	}   
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperShowWaitNoteL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperShowWaitNoteL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperShowWaitNoteL"));
+    TInt err = KErrNone;  
+    HBufC* text = StringLoader::LoadLC(
+                                R_MPX_QTN_NMP_NOTE_ADDING_ONE_SONG );
+    iUiHelper->ShowWaitNoteL(*text,R_AVKON_SOFTKEYS_EMPTY,EFalse,this);
+    CleanupStack::PopAndDestroy( text );
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperShowWaitNoteL succeeds!"));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperShowWaitNoteL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperDismissWaitNoteL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperDismissWaitNoteL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperDismissWaitNoteL"));
+    TInt err = KErrNone;  
+    TRAP(err,iUiHelper->DismissWaitNoteL());  
+    iLog->Log(_L("UiHelperDismissWaitNoteL succeeds!"));	
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperHandleErrorL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperHandleErrorL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperHandleErrorL"));
+    TInt err = KErrNone;    
+    TRAP( err , iUiHelper->HandleErrorL(KMPXRightsAboutToExpire));  
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperHandleErrorL succeeds!"));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperHandleErrorL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperSetMiddleSoftKeyLabelL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperSetMiddleSoftKeyLabelL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperSetMiddleSoftKeyLabelL"));
+    TInt err = KErrNone;  
+    CEikButtonGroupContainer::TUse use = CEikButtonGroupContainer::ECba;
+    CEikButtonGroupContainer::TOrientation oriecntation = CEikButtonGroupContainer::EVertical;
+    CEikButtonGroupContainer* groupContainer = CEikButtonGroupContainer::NewL(
+    																		use,
+    																		oriecntation,
+    																		this,
+    																		NULL,
+    																		CEikButtonGroupContainer::EDelayActivation);
+    CleanupStack::PushL(groupContainer);
+    TBuf<10> mskText;
+    _LIT(KMSKText,"MskKey");
+    mskText.Append(KMSKText);
+    groupContainer->AddCommandToStackL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, EPbCmdNext,mskText);
+    //cannot find the right resource ID
+    TRAP(err,iUiHelper->SetMiddleSoftKeyLabelL(*groupContainer,R_MPX_STATUS_PANE,EPbCmdPlay)); 
+    CleanupStack::PopAndDestroy(groupContainer);
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperSetMiddleSoftKeyLabelL succeeds!"));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperSetMiddleSoftKeyLabelL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperRemoveMiddleSoftKeyLabel
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperRemoveMiddleSoftKeyLabel( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperRemoveMiddleSoftKeyLabel"));
+    TInt err = KErrNone;   
+    CEikButtonGroupContainer::TUse use=CEikButtonGroupContainer::ECba;
+    CEikButtonGroupContainer::TOrientation oriecntation=CEikButtonGroupContainer::EVertical;
+    CEikButtonGroupContainer* groupContainer;
+    TRAP(err,groupContainer=CEikButtonGroupContainer::NewL(
+    																		use,
+    																		oriecntation,
+    																		this,
+    																		NULL,
+    																		CEikButtonGroupContainer::EDelayActivation));
+    CleanupStack::PushL( groupContainer );//added on 2009.3.18
+    //    CleanupStack::PushL(groupContainer);
+    TBuf<10> mskText;
+    _LIT(KMSKText,"MskKey");
+    mskText.Append(KMSKText);
+    TRAP(err,groupContainer->AddCommandToStackL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, EPbCmdNext,mskText));
+    
+    iUiHelper->RemoveMiddleSoftKeyLabel(*groupContainer);
+    CleanupStack::PopAndDestroy(groupContainer);
+    iLog->Log(_L("UiHelperRemoveMiddleSoftKeyLabel succeeds!"));
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperSetMiddleSoftKeyIconL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperSetMiddleSoftKeyIconL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperSetMiddleSoftKeyIconL"));
+    TInt err = KErrNone; 
+    CEikButtonGroupContainer::TUse use=CEikButtonGroupContainer::ECba;
+    CEikButtonGroupContainer::TOrientation oriecntation=CEikButtonGroupContainer::EVertical;
+    CEikButtonGroupContainer* groupContainer=CEikButtonGroupContainer::NewL(
+    																		use,
+    																		oriecntation,
+    																		this,
+    																		NULL,
+    																		CEikButtonGroupContainer::EDelayActivation);
+    CleanupStack::PushL(groupContainer);
+    CFbsBitmap* bitmap = NULL;
+    CFbsBitmap* mask = NULL;
+    AknIconUtils::CreateIconLC( bitmap, mask, 
+                               TFileName(KAvkonBitmapFile), 
+                               (TInt)EMbmAvkonQgn_note_progress,
+                               (TInt)EMbmAvkonQgn_note_progress_mask );
+    TBuf<10> mskText;
+    _LIT(KMSKText,"MskKey");
+    mskText.Append(KMSKText);
+    groupContainer->AddCommandToStackL(CEikButtonGroupContainer::EMiddleSoftkeyPosition, EPbCmdNext,mskText);
+    
+    TRAP(err,iUiHelper->SetMiddleSoftKeyIconL(*groupContainer,bitmap,mask));    
+    CleanupStack::Pop(2);
+    CleanupStack::PopAndDestroy(groupContainer); 
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperSetMiddleSoftKeyIconL succeeds!"));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperSetMiddleSoftKeyIconL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperGenerateTitleL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperGenerateTitleL( CStifItemParser& aItem )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperGenerateTitleL"));
+    TInt err = KErrNone;   
+    TPtrC string;
+    if ( KErrNone == aItem.GetNextString(string) )
+    	{
+    	HBufC* retCategoryTitle;
+    	TBuf<120> newCategoryTitle;
+    	newCategoryTitle.Append(string);
+    	//Maybe we could modify the cfg file to make it really generate a new title.
+    	TRAP(err,retCategoryTitle=iUiHelper->GenerateTitleL(EMPXSong,newCategoryTitle);); 
+    	if ( err == KErrNone )
+    		{
+    		iLog->Log(_L("UiHelperGenerateTitleL succeeds!"));
+    		return err;
+    		}
+    	else
+    		{
+    		iLog->Log(_L("ERROR:UiHelperGenerateTitleL fails!%d returns!"),err);
+    		return err;
+    		}
+    	} 
+    else
+    	{
+    	return KErrBadTestParameter;
+    	}  
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperExitOptionHiddenL
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperExitOptionHiddenL( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperExitOptionHiddenL"));
+    TInt err = KErrNone;   
+    TBool isHidden;
+    TRAP(err,isHidden=iUiHelper->ExitOptionHiddenL()); 
+    if ( err == KErrNone )
+    	{
+    	if(isHidden)
+    		{
+    		iLog->Log(_L("UiHelperExitOptionHiddenL succeeds with TBool ETrue!"));
+    		}
+    	else
+    		{
+    		iLog->Log(_L("UiHelperExitOptionHiddenL succeeds with TBool EFalse!"));
+    		}
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperExitOptionHiddenL fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperSetStandAloneModePId
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperSetStandAloneModePId( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperSetStandAloneModePId"));
+    TInt err = KErrNone; 
+    RProcess proc;
+    TBool isSetDone;
+    isSetDone=iUiHelper->SetStandAloneModePId( proc.Id().Id());
+    if ( err == KErrNone )
+    	{
+    	if(isSetDone)
+    		{
+    		iLog->Log(_L("UiHelperSetStandAloneModePId succeeds with TBool ETrue!"));
+    		}
+    	else
+    		{
+    		iLog->Log(_L("UiHelperSetStandAloneModePId succeeds with TBool EFalse!"));
+    		}
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperSetStandAloneModePId fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperStandAloneModePId
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperStandAloneModePId( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperStandAloneModePId"));
+    TInt err = KErrNone; 
+    TInt64 retPId;
+    retPId=iUiHelper->StandAloneModePId();
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperStandAloneModePId succeeds with StandAloneModePId returned %d!"),retPId);
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperStandAloneModePId fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperIsForegroundApplication
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperIsForegroundApplication( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperIsForegroundApplication"));
+    TInt err = KErrNone; 
+    TApaTaskList taskList(CCoeEnv::Static()->WsSession());
+    TApaTask taskInForeground = taskList.FindByPos( 0 );
+    TInt WindowGroupId=taskInForeground.WgId();
+    TBool isForeApp;
+    isForeApp=iUiHelper->IsForegroundApplication(WindowGroupId);
+    if ( err == KErrNone )
+    	{
+    	if(isForeApp)
+    		{
+    		iLog->Log(_L("UiHelperIsForegroundApplication succeeds.It's foreground application."));
+    		}
+    	else
+    		{
+    		iLog->Log(_L("UiHelperIsForegroundApplication succeeds.It's not foreground application."));
+    		}
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperIsForegroundApplication fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperMMCDriveNumber
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperMMCDriveNumber( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperMMCDriveNumber"));
+    TInt err = KErrNone;    
+    TInt DriveNO;
+    DriveNO=iUiHelper->MMCDriveNumber();
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperMMCDriveNumber succeeds.MMCDriveNumber is %d."),DriveNO);
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperMMCDriveNumber fails!%d returns!"),err);
+    	}
+    return err;
+    }
+// ---------------------------------------------------------------------------
+// Cmpxmusicplayertest::UiHelperCancelCollectionOperation
+// ?implementation_description
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt Cmpxmusicplayertest::UiHelperCancelCollectionOperation( CStifItemParser& /*aItem*/ )
+    {
+    iLog->Log(_L("Cmpxmusicplayertest::UiHelperCancelCollectionOperation"));
+    TInt err = KErrNone;    
+    iUiHelper->CancelCollectionOperation();
+    if ( err == KErrNone )
+    	{
+    	iLog->Log(_L("UiHelperCancelCollectionOperation succeeds."));
+    	}
+    else
+    	{
+    	iLog->Log(_L("ERROR:UiHelperCancelCollectionOperation fails!%d returns!"),err);
+    	}
+    return err;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                MPX Music Player Common UI API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/mpxalbumartutil.h                APP_LAYER_PLATFORM_EXPORT_PATH(mpxalbumartutil.h)
+../inc/mpxalbumartutilobserver.h        APP_LAYER_PLATFORM_EXPORT_PATH(mpxalbumartutilobserver.h)
+../inc/mpxlbxextendedfeatures.h         APP_LAYER_PLATFORM_EXPORT_PATH(mpxlbxextendedfeatures.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/inc/mpxalbumartutil.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,136 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX album art utility
+*
+*/
+
+
+#ifndef CMPXALBUMARTUTIL_H
+#define CMPXALBUMARTUTIL_H
+
+#include <gdi.h>
+#include <metadatafield.hrh>
+#include <thumbnailmanager.h>
+#include <thumbnailmanagerobserver.h>
+
+class CMPXMedia;
+class MMPXAlbumArtUtilObserver;
+class CMPXImageUtil;
+class CRepository;
+/**
+*  Music Player common utility class
+*/
+class CMPXAlbumArtUtil: public CBase, public MThumbnailManagerObserver
+    {
+public:
+    /**
+    *  Two phased contructor
+    */
+    IMPORT_C static CMPXAlbumArtUtil* NewL();
+
+    /**
+    *  Destuctor
+    */
+    IMPORT_C ~CMPXAlbumArtUtil();
+
+    /**
+    *  Extract album art data,
+    *
+    * @since S60 3.2.3
+    * @param aProp media property. the media must contain the following
+    *              attributes:
+    *              TMPXAttribute( KMPXMediaIdMusic, EMPXMediaMusicAlbumArtFileName )
+    *              TMPXAttribute( KMPXMediaIdGeneral, EMPXMediaGeneralUri )
+    * @param aObs callback after the operation completed.
+    * @param aSize The size of the required destination BMP.
+    * @param aDisplayMode the display mode of the destination BMP
+    * @return bitmap object
+    */
+    IMPORT_C void ExtractAlbumArtL(const CMPXMedia& aProp,
+                                   MMPXAlbumArtUtilObserver& aObs,
+                                   const TSize& aSize,
+                                   TDisplayMode aDisplayMode = EColor64K);
+
+   /**
+    * Cancel outstanding asynch requests
+    * @since S60 3.2.3
+    */
+   IMPORT_C void CancelRequest();
+   
+   
+public: // from base class MThumbnailManagerObserver
+
+    /**
+     * From MThumbnailManagerObserver
+     * Preview thumbnail generation or loading is complete.
+     *
+     * @param aThumbnail     An object representing the resulting thumbnail.
+     * @param aId            Request ID for the operation
+     */
+    void ThumbnailPreviewReady( MThumbnailData& aThumbnail, TThumbnailRequestId aId );
+
+    /**
+     * From MThumbnailManagerObserver
+     * Final thumbnail bitmap generation or loading is complete.
+     *
+     * @param aError         Error code.
+     * @param aThumbnail     An object representing the resulting thumbnail.
+     * @param aId            Request ID for the operation.
+     */
+    void ThumbnailReady( TInt aError, MThumbnailData& aThumbnail, TThumbnailRequestId aId );
+
+private:
+    /**
+    * C++ constructor
+    */
+    CMPXAlbumArtUtil();
+
+    /**
+    * Second phase constructor
+    *
+    */
+    void ConstructL();
+
+    /**
+    * Extract binary meta data from file
+    *
+    * @since S60 3.2.3
+    * @param aFileName file name
+    * @param aFieldId metadata field id
+    *
+    */
+    HBufC8* ExtractBinaryMetaDataLC(const TDesC& aFilename,
+                                    TMetaDataFieldId aFieldId);
+									
+	/** -----------------------------------------------------------------------------
+    * Extract Thumbnail for the current song
+    * -----------------------------------------------------------------------------
+    */								
+   void ExtractThumbnailL( const CMPXMedia* aMedia);
+
+private:
+    CMPXImageUtil* iArtUtil;
+    CThumbnailManager*          iThumbnailManager;      // Owned
+    TDisplayMode            iDisplayMode ; //Owned
+    TSize                       iImageSize;
+    TSize                       iFullScreenImageSize;
+    TSize                       iGridViewImageSize;
+    TInt iReqId;
+    HBufC* iFilename;
+    MMPXAlbumArtUtilObserver* iObserver;
+    };
+
+#endif      // CMPXALBUMARTUTIL_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/inc/mpxalbumartutilobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class declaration of MMPXUtilObserver.
+*
+*/
+
+
+#ifndef MMPXALBUMARTUTILOBSERVER_H
+#define MMPXALBUMARTUTILOBSERVER_H
+
+#include <e32def.h>
+
+class CFbsBitmap;
+
+// CLASS DECLARATION
+
+/**
+*  Observer class for Async util operation
+*/
+NONSHARABLE_CLASS(MMPXAlbumArtUtilObserver)
+    {
+public:
+    /**
+    * Notify that extraction of album art started.
+    */
+    virtual void ExtractAlbumArtStarted() = 0;
+
+    /**
+    * Notify that extraction of album art completed.
+    *
+    * @since S60 3.2.3
+    * @param aBitmap a converted image.
+    * @param aErr error code
+    */
+    virtual void ExtractAlbumArtCompleted(CFbsBitmap* aBitmap, TInt aErr ) = 0;
+
+    };
+
+#endif // MMPXALBUMARTUTILOBSERVER_H
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/inc/mpxlbxextendedfeatures.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,333 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Class declarations of CMPXLbxExtendedFeatures
+*
+*/
+
+
+#ifndef MPXLBXEXTENDEDFEATURES_H
+#define MPXLBXEXTENDEDFEATURES_H
+
+// INCLUDES
+#include <mdaaudiotoneplayer.h>
+#include <mpxcollectionobserver.h>
+
+// FORWARD DECLARATIONS
+class CEikTextListBox;
+class CAknNavigationDecorator;
+class CAknNaviLabel;
+class CAknNavigationControlContainer;
+class MMPXCollectionUtility;
+
+
+// CLASS DECLARATION
+
+/**
+*  CMPXLbxExtendedFeatures class
+*
+*  Extended features for listbox views
+*/
+NONSHARABLE_CLASS( CMPXLbxExtendedFeatures ) : public CBase,
+                                               public MMdaAudioToneObserver,
+                                               public MMPXCollectionObserver
+    {
+public:
+
+    enum TMPXKeyStatus
+        {
+        EMPXKeyOther = 0,
+        EMPXKeyUp,
+        EMPXKeyDown
+        };
+
+    enum TMPXScrollingStates
+        {
+        EMPXScrollingIdle = 0,
+        EMPXScrolling1stBufferTime,
+        EMPXScrolling1stSpeed,
+        EMPXScrolling2ndBufferTime,
+        EMPXScrolling2ndSpeed
+        };
+
+public: // Constructors and destructor
+
+    /**
+    * Symbian OS two-phased constructor.
+    * @since S60 3.2.3
+    * @param aLbx The handle to the list box view
+    * @param aEnableSetIndex ETrue to enable set index to collection server
+    *                        everytime the list is browsed
+    */
+    IMPORT_C static CMPXLbxExtendedFeatures* NewL(
+        CEikTextListBox* aLbx,
+        TBool aEnableSetIndex = ETrue );
+
+    /**
+    * C++ default destructor.
+    * @since S60 3.2.3
+    */
+    IMPORT_C virtual ~CMPXLbxExtendedFeatures();
+
+private:
+
+    /**
+    * C++ default constructor.
+    * @since S60 3.2.3
+    * @param aLbx The handle to the list box view
+    * @param aEnableSetIndex ETrue to enable set index to collection server
+    *                        everytime the list is browsed
+    */
+    CMPXLbxExtendedFeatures(
+        CEikTextListBox* aLbx,
+        TBool aEnableSetIndex );
+
+    /**
+    * Symbian OS default constructor.
+    * @since S60 3.2.3
+    */
+    void ConstructL();
+
+public:     // New functions
+
+    /**
+    * Handle listbox key events
+    * @since S60 3.2.3
+    * @param aKeyEvent Key event
+    * @param aType Type of key event
+    */
+    IMPORT_C TKeyResponse HandleLbxKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+
+    /**
+    * Enable or disable speed scrolling
+    * @since S60 3.2.3
+    * @param isEnable ETrue if speed scrolling is desired.  EFalse otherwise.
+    */
+    IMPORT_C void EnableSpeedScrollL( TBool isEnable );
+
+    /**
+    * Enable or disable navipane labeling
+    * @since S60 3.2.3
+    * @param aNaviEnable ETrue if labeling is desired.  EFalse otherwise.
+    */
+    IMPORT_C void SpeedNaviUpdating( TBool aNaviEnable );
+
+    /**
+    * Reset everything to default.
+    * @since S60 3.2.3
+    */
+    void Reset();
+
+    /**
+    * Enable or disable auto loop
+    * @since S60 3.2.3
+    * @param isEnable ETrue if auto loop is desired.  EFalse otherwise.
+    */
+    void EnableAutoLoop( TBool isEnable );
+
+    /**
+    * Timer callback, this is called on each timer event.
+    * @since S60 3.2.3
+    * @param aPtr pointer to the object for type casting (given in Timer creation).
+    * @return ETrue after successful timer cycle.
+    */
+    static TInt TimerCallBack( TAny* aPtr );
+
+private:    // New functions
+
+    /**
+    * Construct and start buffer timer.
+    * @since S60 3.2.3
+    */
+    void StartTimerL();
+
+    /**
+    * Stop and destroy timer.
+    * @since S60 3.2.3
+    */
+    void StopTimer();
+
+    /**
+    * Change scrolling status, called by TimerCallBack().
+    * @since S60 3.2.3
+    */
+    void BufferTimerHandler();
+
+    /**
+    * Update the scrolling speed
+    * @since S60 3.2.3
+    */
+    void UpdateScrollingSpeed( TMPXKeyStatus aKeyStatus );
+
+    /**
+    * Check if boundary is reached.
+    * @since S60 3.2.3
+    * @param aKeyStatus current key status.
+    * @return ETrue is boundary is reahced.  Otherwise EFalse.
+    */
+    TBool CheckBoundaryCases( TMPXKeyStatus aKeyStatus );
+
+    /**
+    * Get info (ie. scrolling speed) from the cenrep
+    * @since S60 3.2.3
+    */
+    void GetInfoFromCenRepL();
+
+    /**
+    * Updates the Navi pane with the appropriate speed text
+    * @since S60 3.2.3
+    */
+    void SetNaviSpeedTextL( TBool boundaryReached );
+
+    /**
+    * Handles key event down
+    * @since S60 3.2.3
+    * @param aKeyEvent Key event
+    */
+    TKeyResponse HandleEventKeyDownL( const TKeyEvent& aKeyEvent );
+
+    /**
+    * Handles key event up
+    * @since S60 3.2.3
+    * @param aKeyEvent Key event
+    */
+    TKeyResponse HandleEventKeyUpL( const TKeyEvent& aKeyEvent );
+
+    /**
+    * Enables/Disables Keysound
+    * @since S60 3.2.3
+    * @param aEnable ETrue to enable key sound, EFalse to disable
+    */
+    void EnableKeySoundL( TBool aEnable );
+
+    /**
+    * Send an async command to the collection to update the index
+    * @since S60 3.2.3
+    * @param aIndex index to set
+    * @param aForceSet ETrue if speed scrolling checking should be bypassed
+    */
+    void SetIndexToCollectionL( TInt aIndex, TBool aForceSet = EFalse );
+
+    /**
+    * Handle collection message
+    * @since S60 3.2.3
+    * @param aMessage collection message
+    * @param aError Error code
+    */
+    void DoHandleCollectionMessageL( CMPXMessage* aMessage, TInt aError );
+
+// from base class MMdaAudioToneObserver
+    /**
+    * From MMdaAudioToneObserver. Called after tone has been initialized.
+    * @since S60 3.2.3
+    * @param aError Error code
+    */
+    void MatoPrepareComplete(TInt aError);
+
+    /**
+    * From MMdaAudioToneObserver. Called after tone has been played.
+    * @since S60 3.2.3
+    * @param aError Error code
+    */
+    void MatoPlayComplete(TInt aError);
+
+    /**
+    * From MMPXCollectionObserver
+    * Handle collection message.
+    * @since S60 3.2.3
+    * @param aMessage Collection message
+    * @param aErr system error code.
+    */
+    void HandleCollectionMessage(
+        CMPXMessage* aMessage, TInt aError );
+
+    /**
+    * From MMPXCollectionObserver
+    * Handles the collection entries being opened. Typically called
+    * when client has Open()'d a folder
+    *
+    * @since S60 3.2.3
+    * @param aEntries collection entries opened
+    * @param aIndex focused entry
+    * @param aComplete ETrue no more entries. EFalse more entries
+    *                  expected
+    * @param aError error code
+    */
+    void HandleOpenL(
+        const CMPXMedia& aEntries,
+        TInt aIndex,
+        TBool aComplete,
+        TInt aError );
+
+    /**
+    * From MMPXCollectionObserver
+    * Handles the collection entries being opened. Typically called
+    * when client has Open()'d an item. Client typically responds by
+    * 'playing' the item
+    *
+    * @since S60 3.2.3
+    * @param aPlaylist collection path to item
+    * @param aError error code
+    */
+    void HandleOpenL(
+        const CMPXCollectionPlaylist& aPlaylist,
+        TInt aError );
+
+    /**
+    * From MMPXCollectionObserver
+    * Handle media properties
+    *
+    * @since S60 3.2.3
+    * @param aMedia media
+    * @param aError error code
+    */
+    void HandleCollectionMediaL(
+        const CMPXMedia& aMedia,
+        TInt aError );
+
+    private:    // Data
+
+    RWsSession              iWsSession;
+    CPeriodic*              iTimer;
+    CEikTextListBox*        iLbx;
+    TMPXKeyStatus           iKeyStatus;
+    TMPXScrollingStates     iScrollingState;
+    CMdaAudioToneUtility*   iToneUtility;
+    MMPXCollectionUtility*  iCollectionUtility;
+
+    // Contain info from shared data
+    TInt                    iFirstBufferTime;
+    TInt                    iSecondBufferTime;
+    TInt                    iFirstSpeed;
+    TInt                    iSecondSpeed;
+    TInt                    iIndexCount; // counter for speed scolling set index check
+    TInt                    iResourceOffset;   // must be freed
+
+    TBool                   iSpeedScrollEnabled;
+    TBool                   iAutoLoopEnabled;
+    TBool                   iNaviEnabled;
+    TBool                   iKeysoundEnabled;
+    TBool                   iSkipEvent;
+    TBool                   iFirstKeyEvent;
+    TBool                   iSkipPlaying;
+    TBool                   iEnableSetIndex;
+
+    //FOR NAVI PANE
+    CAknNavigationDecorator*        iNaviDecorator;
+    CAknNaviLabel*                  iNaviLabel;
+    CAknNavigationControlContainer* iNaviPane;
+    };
+
+#endif  // MPXLBXEXTENDEDFEATURES_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/mpx_music_player_commonui_api.metaxml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,15 @@
+<?xml version="1.0" ?>
+<api id="a7944ba9b50d3c2a677ab38b945f2b16" dataversion="2.0">
+<name>MPX Music Player Commonui API</name>
+<description>Provides common music player UI interface</description>
+<type>c++</type>
+<collection>mpxmusicplayer</collection>
+<libs>
+<lib name="mpxcommonui.lib"/>
+</libs>
+<release category="platform" sinceversion=""/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/conf/ui_mpxmusicplayercommonuitest.cfg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,86 @@
+[Test]
+title Example
+create ui_mpxmusicplayercommonuitest player
+player Example pa ra me ters
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 1: CMPXAlbumArtUtilCreate
+create ui_mpxmusicplayercommonuitest player
+player CMPXAlbumArtUtilCreate
+player CMPXAlbumArtUtilDestructor
+delete player
+[Endtest] 
+
+
+[Test]
+title 2: CMPXAlbumArtUtilDestructor
+create ui_mpxmusicplayercommonuitest player
+player CMPXAlbumArtUtilCreate
+player CMPXAlbumArtUtilDestructor
+delete player
+[Endtest] 
+
+[Test]
+title 3: CMPXAlbumArtUtilExtractAlbumArtL
+create ui_mpxmusicplayercommonuitest player
+player CMPXAlbumArtUtilCreate
+player CMPXAlbumArtUtilExtractAlbumArtL  my.mbm  Waterlilies.jpg
+player CMPXAlbumArtUtilDestructor
+delete player
+[Endtest] 
+
+[Test]
+title 4: CMPXAlbumArtUtilCancelRequest
+create ui_mpxmusicplayercommonuitest player
+player CMPXAlbumArtUtilCreate
+player CMPXAlbumArtUtilExtractAlbumArtL my.mbm Waterlilies.jpg
+player CMPXAlbumArtUtilCancelRequest
+player CMPXAlbumArtUtilDestructor
+delete player
+[Endtest] 
+
+[Test]
+title 5: CMPXLbxExtendedFeaturesCreate
+create ui_mpxmusicplayercommonuitest player
+player CMPXLbxExtendedFeaturesCreate
+player CMPXLbxExtendedFeaturesDestructor
+delete player
+[Endtest]
+
+[Test]
+title 6: CMPXLbxExtendedFeaturesDestructor
+create ui_mpxmusicplayercommonuitest player
+player CMPXLbxExtendedFeaturesCreate
+player CMPXLbxExtendedFeaturesDestructor
+delete player
+[Endtest]  
+
+[Test]
+title 7: CMPXLbxExtendedFeaturesHandleLbxKeyEventL
+create ui_mpxmusicplayercommonuitest player
+player CMPXLbxExtendedFeaturesCreate
+player CMPXLbxExtendedFeaturesHandleLbxKeyEventL
+player CMPXLbxExtendedFeaturesDestructor
+delete player
+[Endtest]  
+
+[Test]
+title 8: CMPXLbxExtendedFeaturesEnableSpeedScrollL
+create ui_mpxmusicplayercommonuitest player
+player CMPXLbxExtendedFeaturesCreate
+player CMPXLbxExtendedFeaturesEnableSpeedScrollL
+player CMPXLbxExtendedFeaturesDestructor
+delete player
+[Endtest]  
+
+[Test]
+title 9: CMPXLbxExtendedFeaturesSpeedNaviUpdating
+create ui_mpxmusicplayercommonuitest player
+player CMPXLbxExtendedFeaturesCreate
+player CMPXLbxExtendedFeaturesSpeedNaviUpdating
+player CMPXLbxExtendedFeaturesDestructor
+delete player
+[Endtest]  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxharvestertest
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+// Test sound file
+
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+#include "../ui_mpxmusicplayercommonuitest/group/bld.inf"
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/init/TestFramework.ini	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,202 @@
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#   + XML, Test report will be xml type, for example 'TestReport.xml'.
+#          Note, that xml format is available only when output is set to FILE.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module.
+# 	- Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+#		DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport    # Possible values are: 'Empty', 'Summary', 'Environment',
+                                                     'TestCases' or 'FullReport'
+
+CreateTestReport= YES         # Possible values: YES or NO
+
+UITestingSupport= YES 
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport_ui_mpxmusicplayercommonuitest
+
+TestReportFormat= TXT         # Possible values: TXT, HTML or XML
+TestReportOutput= FILE        # Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone  # Possible values are:
+              # 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+              # 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+              # 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+              # 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0                    # Default timeout value for each test case. In milliseconds
+#UITestingSupport= YES        # Possible values: YES or NO
+#SeparateProcesses= YES       # Possible values: YES or NO (default: NO)
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= TestScripter
+TestCaseFile=  c:\testframework\ui_mpxmusicplayercommonuitest.cfg
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+#	- Will write log file in unicode format.
+#		+ YES, Log file will be written in unicode format
+#		+ NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES    # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML         # Possible values: TXT or HTML
+#EmulatorOutput= FILE         # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML         # Possible values: TXT or HTML
+#HardwareOutput= FILE         # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE  # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES       # Possible values: YES or NO
+#WithTimeStamp= YES           # Possible values: YES or NO
+#WithLineBreak= YES           # Possible values: YES or NO
+#WithEventRanking= YES        # Possible values: YES or NO
+
+#FileUnicode= YES             # Possible values: YES or NO
+#AddTestCaseTitle= YES        # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/Bmarm/ui_mpxmusicplayercommonuitestU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/Bwins/ui_mpxmusicplayercommonuitestU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/EABI/ui_mpxmusicplayercommonuitestU.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,7 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+	_ZTI17CEdwinTestControl @ 2 NONAME ; #<TI>#
+	_ZTI19CListBoxTestControl @ 3 NONAME ; #<TI>#
+	_ZTV17CEdwinTestControl @ 4 NONAME ; #<VT>#
+	_ZTV19CListBoxTestControl @ 5 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project ui_mpxmusicplayercommonuitest
+*
+*/
+
+
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+// Example: 
+/*
+/agnmodel/inc/AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+ui_mpxmusicplayercommonuitest.mmp
+
+PRJ_MMPFILES
+//ui_mpxmusicplayercommonuitest_nrm.mmp
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+/agnmodel/group/agnmodel.mmp
+#if defined(MARM)
+/agnmodel/group/agsvexe.mmp
+#endif
+*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/group/ui_mpxmusicplayercommonuitest.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,83 @@
+/*TYPE TESTCLASS*//*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project ui_mpxmusicplayercommonuitest
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          ui_mpxmusicplayercommonuitest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         ui_mpxmusicplayercommonuitest.def
+
+#ifdef SBSV2
+USERINCLUDE     ../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+#else // SBSV2 not defined
+USERINCLUDE     ../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+#endif // SBSV2
+
+SOURCE          ui_mpxmusicplayercommonuitest.cpp
+SOURCE          ui_mpxmusicplayercommonuitestBlocks.cpp EdwinTestControl.cpp ListBoxTestControl.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib ws32.lib
+LIBRARY         mpxcommonui.lib mpxcollectionutility.lib fbscli.lib cone.lib aknskins.lib aknskinsrv.lib efsrv.lib eikcoctl.lib eikcore.lib eikctl.lib avkon.lib mpxcommon.lib bafl.lib estor.lib apgrfx.lib AknIcon.lib commonengine.lib eikdlg.lib
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
+APP_LAYER_SYSTEMINCLUDE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/group/ui_mpxmusicplayercommonuitest.pkg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,66 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: pakage file for make installation file for STIF
+;
+;
+; Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+; // STIF GUI (STIFTestFramework\Series60_UI is need to compile)
+"..\..\data\mmc\my.mbm"   -   "e:\testing\data\my.mbm" 
+"..\..\data\mmc\Waterlilies.jpg"   -   "e:\testing\data\Waterlilies.jpg" 
+"..\..\init\TestFramework.ini"   -   "c:\testframework\TestFramework.ini" 
+"..\..\conf\ui_mpxmusicplayercommonuitest.cfg"   -   "c:\testframework\ui_mpxmusicplayercommonuitest.cfg"
+"\epoc32\release\armv5\urel\ui_mpxmusicplayercommonuitest.dll"   -   "c:\Sys\Bin\ui_mpxmusicplayercommonuitest.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/group/ui_mpxmusicplayercommonuitest_DoxyFile.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,222 @@
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = ui_mpxmusicplayercommonuitest
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = Z:\s60\mw\music\music_dom\mpx_music_player_commonui_api\tsrc\ui_mpxmusicplayercommonuitest\
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = Z:\s60\mw\music\music_dom\mpx_music_player_commonui_api\tsrc\ui_mpxmusicplayercommonuitest\
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/inc/EdwinTestControl.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CEdwinTestControl test class for STIF Test Framework TestScripter.
+*
+*/
+#ifndef EDWINTESTCONTROL_H_
+#define EDWINTESTCONTROL_H_
+
+#include <eikedwin.h>
+
+class CAknsBasicBackgroundControlContext;
+
+class CEdwinTestControl : public CCoeControl, public MCoeControlObserver
+    {
+public:
+	static CEdwinTestControl* NewL(void);
+	virtual ~CEdwinTestControl();
+protected:
+	TTypeUid::Ptr MopSupplyObject(TTypeUid aId); // 
+private:
+	virtual void SizeChanged();
+	virtual void HandleResourceChange(TInt aType);
+	virtual TInt CountComponentControls() const;
+	virtual CCoeControl* ComponentControl(TInt aIndex) const;
+    void ConstructL(void);
+	void Draw(const TRect& aRect) const;
+	
+	void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType);
+	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType );	
+private:
+	CAknsBasicBackgroundControlContext*	iBgContext; 
+	CEikEdwin* iEditWin;
+};
+
+
+#endif /*EDWINTESTCONTROL_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/inc/ListBoxTestControl.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CListBoxTestControl test class for STIF Test Framework TestScripter.
+*
+*/
+#ifndef LISTBOXTESTCONTROL_H_
+#define LISTBOXTESTCONTROL_H_
+
+#include <eiktxlbx.h>
+
+class CAknsBasicBackgroundControlContext;
+
+class CListBoxTestControl : public CCoeControl, public MCoeControlObserver
+    {
+public:
+	static CListBoxTestControl* NewL(void);
+	virtual ~CListBoxTestControl();
+protected:
+	TTypeUid::Ptr MopSupplyObject(TTypeUid aId); // 
+private:
+	virtual void SizeChanged();
+	virtual void HandleResourceChange(TInt aType);
+	virtual TInt CountComponentControls() const;
+	virtual CCoeControl* ComponentControl(TInt aIndex) const;
+    void ConstructL(void);
+	void Draw(const TRect& aRect) const;
+	
+	void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType);
+	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType );	
+private:
+	CAknsBasicBackgroundControlContext*	iBgContext; 
+	CEikTextListBox* iListBox;
+};
+
+
+#endif /*LISTBOXTESTCONTROL_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/inc/ui_mpxmusicplayercommonuitest.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,190 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMPXMusicPlayerCommonuiStifTest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+#ifndef ui_mpxmusicplayercommonuitest_H
+#define ui_mpxmusicplayercommonuitest_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+
+#include <mpxalbumartutil.h>
+#include <mpxmedia.h>
+#include "mpxalbumartutilobserver.h"
+#include "mpxmediageneraldefs.h"
+#include "mpxmediamusicdefs.h"
+
+#include "EdwinTestControl.h"
+#include "ListBoxTestControl.h"
+#include "mpxlbxextendedfeatures.h"
+
+
+
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+#ifdef __WINSCW__
+// Logging path
+_LIT( Kui_mpxmusicplayercommonuitestLogPath, "c:\\logs\\testframework\\ui_mpxmusicplayercommonuitest\\" );
+//Data path
+_LIT( Kui_mpxmusicplayercommonuitestDataPath, "c:\\testing\\data\\" );
+// Log file
+_LIT( Kui_mpxmusicplayercommonuitestLogFile, "ui_mpxmusicplayercommonuitest.txt" ); 
+_LIT( Kui_mpxmusicplayercommonuitestLogFileWithTitle, "ui_mpxmusicplayercommonuitest_[%S].txt" );
+#else
+// Logging path
+_LIT( Kui_mpxmusicplayercommonuitestLogPath, "e:\\logs\\testframework\\ui_mpxmusicplayercommonuitest\\" );
+//Data path
+_LIT( Kui_mpxmusicplayercommonuitestDataPath, "e:\\testing\\data\\" );
+// Log file
+_LIT( Kui_mpxmusicplayercommonuitestLogFile, "ui_mpxmusicplayercommonuitest.txt" ); 
+_LIT( Kui_mpxmusicplayercommonuitestLogFileWithTitle, "ui_mpxmusicplayercommonuitest_[%S].txt" );
+#endif
+
+//class ?FORWARD_CLASSNAME;
+class CMPXMusicPlayerCommonuiStifTest ;
+
+class CmpxMusicPlayerCommonuiTest;
+class CMPXAlbumArtUtil;
+class CMPXMedia;
+class CMPXLbxExtendedFeatures;
+
+class CMPXLbxExtendedFeatures;
+
+
+// CLASS DECLARATION
+
+/**
+*  CMPXMusicPlayerCommonuiStifTest  test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ui_mpxmusicplayercommonuitest.lib
+*  @since Series60_version
+*/
+NONSHARABLE_CLASS(CMPXMusicPlayerCommonuiStifTest ) : public CScriptBase, public MMPXAlbumArtUtilObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CMPXMusicPlayerCommonuiStifTest * NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPXMusicPlayerCommonuiStifTest ();
+
+    public: 
+       	    //function from mpxalbumartutilobserver.h
+       	     void ExtractAlbumArtStarted();
+
+       	  //function from mpxalbumartutilobserver.h
+       	     void ExtractAlbumArtCompleted(CFbsBitmap* aBitmap, TInt aErr );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+        
+  
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CMPXMusicPlayerCommonuiStifTest ( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        /**
+        * Example test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt ExampleL( CStifItemParser& aItem );
+        //test functions for mpxalbumartutil.h
+        //to test IMPORT_C static CMPXAlbumArtUtil* NewL();
+        TInt CMPXAlbumArtUtilCreate( CStifItemParser& aItem );//Pass Debug
+        //to test IMPORT_C ~CMPXAlbumArtUtil();
+        TInt CMPXAlbumArtUtilDestructor (CStifItemParser& aItem );//Pass Debug
+        // to test IMPORT_C void ExtractAlbumArtL(const CMPXMedia& aProp,
+        //											MMPXAlbumArtUtilObserver& aObs,
+        //											const TSize& aSize,
+        //											TDisplayMode aDisplayMode = EColor64K);
+        TInt CMPXAlbumArtUtilExtractAlbumArtL (CStifItemParser& aItem );//Pass Debug
+        //to test IMPORT_C void CancelRequest();
+        TInt CMPXAlbumArtUtilCancelRequest (CStifItemParser& aItem );//Pass Debug
+        
+        
+        //test functions for mpxlbxextendedfeatures.h
+        //to test  IMPORT_C static CMPXLbxExtendedFeatures* NewL(
+        //														CEikTextListBox* aLbx,
+        //														TBool aEnableSetIndex = ETrue );
+        TInt CMPXLbxExtendedFeaturesCreate( CStifItemParser& aItem );//Pass Debug
+        //to test IMPORT_C virtual ~CMPXLbxExtendedFeatures();
+        TInt CMPXLbxExtendedFeaturesDestructor( CStifItemParser& aItem );//Pass Debug
+        //to test IMPORT_C TKeyResponse HandleLbxKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
+        TInt CMPXLbxExtendedFeaturesHandleLbxKeyEventL( CStifItemParser& aItem );//Pass Debug
+        //to test   IMPORT_C void EnableSpeedScrollL( TBool isEnable );
+        TInt CMPXLbxExtendedFeaturesEnableSpeedScrollL( CStifItemParser& aItem );//Pass Debug
+        //to test IMPORT_C void SpeedNaviUpdating( TBool aNaviEnable );
+        TInt CMPXLbxExtendedFeaturesSpeedNaviUpdating( CStifItemParser& aItem );//Pass Debug
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+    private:    // Friend classes
+    	CMPXAlbumArtUtil* iMPXAlbumArtUtil;
+    	CMPXLbxExtendedFeatures* iMPXLbxExtendedFeatures;
+    };
+
+#endif      // ui_mpxmusicplayercommonuitest_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/src/EdwinTestControl.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CEdwinTestControl test class for STIF Test Framework TestScripter.
+*
+*/
+#include "EdwinTestControl.h"
+#include <eikenv.h>
+#include <aknsutils.h> 
+#include <aknsdrawutils.h> 
+#include <aknutils.h> 
+#include <aknsbasicbackgroundcontrolcontext.h>
+
+
+CEdwinTestControl::~CEdwinTestControl()
+	{
+	delete iEditWin;
+	iEditWin = NULL;
+	delete iBgContext;
+	iBgContext = NULL;
+	}   
+ 
+CEdwinTestControl* CEdwinTestControl::NewL(void)
+    {
+    CEdwinTestControl* self = new(ELeave)CEdwinTestControl();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+void CEdwinTestControl::ConstructL()
+    {
+    CreateWindowL();
+ 
+    iEditWin = new (ELeave) CEikEdwin();
+    iEditWin->ConstructL( 0, 100, 100, 1 );
+    iEditWin->SetContainerWindowL( *this );
+    iEditWin->CreateTextViewL();
+//    iEditWin->SetInputCapabilitiesL( TCoeInputCapabilities::EAllText );
+    
+	// make first with no size at all
+	iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgScreen,TRect(0,0,1,1), ETrue );
+	// Setting rect will cause SizeChanged to be called
+	// and iBgContext size & position is updated accordingly.
+	SetRect( CEikonEnv::Static()->EikAppUi()->ClientRect() );	
+	
+	ActivateL();
+	DrawNow();
+    }
+ 
+void CEdwinTestControl::SizeChanged()
+	{
+	if ( iBgContext )
+		{
+		iBgContext->SetRect(Rect());
+ 
+		if ( &Window() )
+			{
+			iBgContext->SetParentPos( PositionRelativeToScreen() );
+			}
+		}
+	if ( iEditWin )
+		{
+		iEditWin->SetRect(Rect());	
+		}
+	}
+ 
+ 
+void CEdwinTestControl::HandleResourceChange( TInt aType )
+	{
+	TRect rect;
+ 
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+    	{    
+        AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
+        SetRect(rect);
+    	}
+ 
+	CCoeControl::HandleResourceChange(aType);
+	}
+ 
+ 
+TTypeUid::Ptr CEdwinTestControl::MopSupplyObject(TTypeUid aId)
+	{
+	if ( iBgContext )
+		{
+		return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+		}	
+
+	return CCoeControl::MopSupplyObject( aId );
+	}
+ 
+ 
+void CEdwinTestControl::Draw(const TRect& aRect) const
+	{
+	CWindowGc& gc = SystemGc();
+    
+    // draw background skin first.
+  	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+	AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect );
+	}
+
+TInt CEdwinTestControl::CountComponentControls() const
+{
+    return 1;
+}
+ 
+CCoeControl* CEdwinTestControl::ComponentControl(TInt aIndex) const
+{
+    switch (aIndex)
+    	{
+        case 0:
+        	return iEditWin;
+        default:
+            return 0;
+    	}
+}
+
+void CEdwinTestControl::HandleControlEventL( CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/)
+	{
+    // TODO: Add your control event handler code here
+	}
+
+TKeyResponse CEdwinTestControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
+	{
+	if ( iEditWin )
+		{
+		return iEditWin->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/src/ListBoxTestControl.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,166 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CListBoxTestControl test class for STIF Test Framework TestScripter.
+*
+*/
+#include "ListBoxTestControl.h"
+#include <eikenv.h>
+#include <aknsutils.h> 
+#include <aknsdrawutils.h> 
+#include <aknutils.h> 
+#include <aknsbasicbackgroundcontrolcontext.h>
+#include <eiklbi.h> 
+
+CListBoxTestControl::~CListBoxTestControl()
+	{
+	delete iListBox;
+	iListBox = NULL;
+	delete iBgContext;
+	iBgContext = NULL;
+	}   
+ 
+CListBoxTestControl* CListBoxTestControl::NewL(void)
+    {
+    CListBoxTestControl* self = new(ELeave)CListBoxTestControl();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+void CListBoxTestControl::ConstructL(void)
+    {
+    CreateWindowL();
+
+    
+    iListBox = new(ELeave) CEikTextListBox();
+    iListBox->SetContainerWindowL(*this);
+    iListBox->SetMopParent(this);
+    iListBox->ConstructL( this, EAknListBoxSelectionList );
+    
+    CDesCArray* items = static_cast<CDesCArray*> (iListBox->Model()->ItemTextArray());
+    _LIT(KItem1, "MenuItem_1");
+    items->AppendL(KItem1);
+    _LIT(KItem2, "MenuItem_2");
+    items->AppendL(KItem2);
+    _LIT(KItem3, "MenuItem_3");
+    items->AppendL(KItem3);
+    _LIT(KItem4, "MenuItem_4");
+    items->AppendL(KItem4);
+    _LIT(KItem5, "MenuItem_5");
+    items->AppendL(KItem5);
+
+    iListBox->Model()->SetOwnershipType(ELbmOwnsItemArray);
+
+    iListBox->HandleItemAdditionL();
+    iListBox->SetFocus(ETrue);
+
+    
+    iListBox->CreateScrollBarFrameL();
+    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto);	    
+    
+	// make first with no size at all
+	iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgScreen,TRect(0,0,1,1), ETrue);
+	// Setting rect will cause SizeChanged to be called
+	// and iBgContext size & position is updated accordingly.
+	SetRect( CEikonEnv::Static()->EikAppUi()->ClientRect() );	
+		
+	ActivateL();
+	DrawNow();
+}
+ 
+void CListBoxTestControl::SizeChanged()
+	{
+	if ( iBgContext )
+		{
+		iBgContext->SetRect(Rect());
+ 
+		if ( &Window() )
+			{
+			iBgContext->SetParentPos( PositionRelativeToScreen() );
+			}
+		}
+	if ( iListBox )
+		{
+		iListBox->SetRect(Rect());	
+		}
+	}
+ 
+ 
+void CListBoxTestControl::HandleResourceChange(TInt aType)
+	{
+	TRect rect;
+ 
+    if ( aType==KEikDynamicLayoutVariantSwitch )
+    	{    
+        AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
+        SetRect(rect);
+    	}
+ 
+	CCoeControl::HandleResourceChange(aType);
+	}
+ 
+ 
+TTypeUid::Ptr CListBoxTestControl::MopSupplyObject(TTypeUid aId)
+	{	
+	if (iBgContext)
+		{
+			return MAknsControlContext::SupplyMopObject(aId, iBgContext );
+		}	
+	return CCoeControl::MopSupplyObject(aId);
+	}
+ 
+ 
+void CListBoxTestControl::Draw(const TRect& aRect) const
+	{
+	CWindowGc& gc = SystemGc();
+    
+    // draw background skin first.
+  	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+	AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect );
+	}
+
+TInt CListBoxTestControl::CountComponentControls() const
+	{
+    return 1;
+	}
+ 
+CCoeControl* CListBoxTestControl::ComponentControl(TInt aIndex) const
+	{
+    switch (aIndex)
+    	{
+        case 0:
+            return iListBox; 
+        default:
+            return 0;
+    	}
+	}
+
+void CListBoxTestControl::HandleControlEventL( CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/)
+	{
+    // TODO: Add your control event handler code here
+	}
+
+TKeyResponse CListBoxTestControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
+	{
+	if( iListBox )
+		{
+		return iListBox->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/src/ui_mpxmusicplayercommonuitest.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,164 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMPXMusicPlayerCommonuiStifTest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "ui_mpxmusicplayercommonuitest.h"
+#include <SettingServerClient.h>
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Cui_mpxmusicplayercommonuitest::Cui_mpxmusicplayercommonuitest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXMusicPlayerCommonuiStifTest::CMPXMusicPlayerCommonuiStifTest ( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMPXMusicPlayerCommonuiStifTest::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(Kui_mpxmusicplayercommonuitestLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(Kui_mpxmusicplayercommonuitestLogFile);
+        }
+
+    iLog = CStifLogger::NewL( Kui_mpxmusicplayercommonuitestLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMPXMusicPlayerCommonuiStifTest * CMPXMusicPlayerCommonuiStifTest::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CMPXMusicPlayerCommonuiStifTest * self = new (ELeave) CMPXMusicPlayerCommonuiStifTest ( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CMPXMusicPlayerCommonuiStifTest::~CMPXMusicPlayerCommonuiStifTest ()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+    
+    }
+//function from mpxalbumartutilobserver.h
+void CMPXMusicPlayerCommonuiStifTest::ExtractAlbumArtStarted()
+    { 
+	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::ExtractAlbumArtL Started."));
+    }
+ //function from mpxalbumartutilobserver.h
+void CMPXMusicPlayerCommonuiStifTest::ExtractAlbumArtCompleted(CFbsBitmap* /*aBitmap*/, TInt aErr )
+    {     
+	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::ExtractAlbumArtL returned: %d"),aErr);    
+    }
+
+//-----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CMPXMusicPlayerCommonuiStifTest::SendTestClassVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("ui_mpxmusicplayercommonuitest.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) CMPXMusicPlayerCommonuiStifTest ::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_commonui_api/tsrc/ui_mpxmusicplayercommonuitest/src/ui_mpxmusicplayercommonuitestBlocks.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,306 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMPXMusicPlayerCommonuiStifTest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "ui_mpxmusicplayercommonuitest.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void CMPXMusicPlayerCommonuiStifTest::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicPlayerCommonuiStifTest::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "Example", CMPXMusicPlayerCommonuiStifTest ::ExampleL ),
+        //test functions for mpxalbumartutil.h
+        ENTRY( "CMPXAlbumArtUtilCreate", CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilCreate ),
+        ENTRY( "CMPXAlbumArtUtilDestructor", CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilDestructor ),
+        ENTRY( "CMPXAlbumArtUtilExtractAlbumArtL", CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilExtractAlbumArtL ),
+        ENTRY( "CMPXAlbumArtUtilCancelRequest", CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilCancelRequest ),
+        //test functions for mpxlbxextendedfeatures.h
+        ENTRY( "CMPXLbxExtendedFeaturesCreate", CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesCreate ),
+        ENTRY( "CMPXLbxExtendedFeaturesDestructor", CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesDestructor ),
+        ENTRY( "CMPXLbxExtendedFeaturesHandleLbxKeyEventL", CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesHandleLbxKeyEventL ),
+        ENTRY( "CMPXLbxExtendedFeaturesEnableSpeedScrollL", CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesEnableSpeedScrollL ),
+        ENTRY( "CMPXLbxExtendedFeaturesSpeedNaviUpdating", CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesSpeedNaviUpdating ),
+
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicPlayerCommonuiStifTest::ExampleL( CStifItemParser& aItem )
+    {
+
+	    // Print to UI
+	    _LIT( Kui_mpxmusicplayercommonuitest, "ui_mpxmusicplayercommonuitest" );
+	    _LIT( KExample, "In Example" );
+	    TestModuleIf().Printf( 0, Kui_mpxmusicplayercommonuitest, KExample );
+	    // Print to log file
+	    iLog->Log( KExample );
+	
+	    TInt i = 0;
+	    TPtrC string;
+	    _LIT( KParam, "Param[%i]: %S" );
+	    while ( aItem.GetNextString ( string ) == KErrNone )
+	        {
+	          TestModuleIf().Printf( i, Kui_mpxmusicplayercommonuitest, 
+	                                KParam, i, &string );
+	          i++;
+	        }
+	
+	    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilCreate
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilCreate( CStifItemParser& /*aItem*/ )
+    {
+    TInt err=KErrNone;
+   
+    iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilCreate"));
+    
+    TRAP( err , iMPXAlbumArtUtil = CMPXAlbumArtUtil::NewL() );
+    
+	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilCreate returned: %d"), err);
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilDestructor
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilDestructor( CStifItemParser& /*aItem*/ )
+    {
+    TInt err=KErrNone;
+    iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilDestructor begin:"));
+    
+    if( iMPXAlbumArtUtil != NULL )
+    	{
+		 delete iMPXAlbumArtUtil;
+		 iMPXAlbumArtUtil = NULL;
+    	}
+	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilDestructor end."));
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilExtractAlbumArtL
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilExtractAlbumArtL( CStifItemParser& aItem )
+    {
+    TInt err=KErrNone;
+    TPtrC string;
+   // CFbsBitmap* bitmap(NULL);
+    iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilExtractAlbumArtL"));
+    
+    while ( aItem.GetNextString( string ) == KErrNone )
+           {
+	    	TBuf<120> uri;
+	    	uri.Append(Kui_mpxmusicplayercommonuitestDataPath);
+	    	uri.Append(string);
+	    	while ( aItem.GetNextString( string ) == KErrNone )
+	    		 {
+		    	  TBuf<120> KFileName;
+		    	  KFileName.Append(Kui_mpxmusicplayercommonuitestDataPath);
+		    	  KFileName.Append(string);
+				  CMPXMedia* media = CMPXMedia::NewL();
+				  CleanupStack::PushL(media);
+				  media->SetTObjectValueL(KMPXMediaMusicAlbumArtFileName, KFileName);
+				  media->SetTObjectValueL(KMPXMediaGeneralUri,uri);
+				  TRAP(err,iMPXAlbumArtUtil->ExtractAlbumArtL(*media,*this,TSize(1,1)));
+				  CleanupStack::PopAndDestroy(media);
+			      iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilExtractAlbumArtL returned: %d"), err);
+			    }
+           }
+    
+    return err;
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::CMPXAlbumArtUtilCancelRequest
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilCancelRequest( CStifItemParser& /*aItem*/ )
+    {
+    TInt err=KErrNone;
+    iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXAlbumArtUtilCancelRequest begin:"));
+    
+    iMPXAlbumArtUtil->CancelRequest();
+    
+	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CancelRequest end."));
+	
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesCreate
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesCreate( CStifItemParser& /*aItem*/ )
+    {
+    TInt err=KErrNone;
+    iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesCreate"));
+    
+    CEikTextListBox* listBox = new (ELeave) CEikTextListBox;
+    TRAP( err,iMPXLbxExtendedFeatures = CMPXLbxExtendedFeatures::NewL(listBox) );
+    
+    if ( listBox != NULL )
+    	{
+		 delete listBox;
+		 listBox = NULL;
+    	}
+	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::NewL returned: %d"), err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesDestructor
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesDestructor( CStifItemParser& /*aItem*/ )
+    {
+    TInt err=KErrNone;
+    iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesDestructor begin:"));
+    
+    if( iMPXLbxExtendedFeatures != NULL )
+    	{
+		 delete iMPXLbxExtendedFeatures;
+		 iMPXLbxExtendedFeatures = NULL;
+    	}
+    
+	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::Destructor end."));
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesHandleLbxKeyEventL
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesHandleLbxKeyEventL( CStifItemParser& /*aItem*/ )
+    {
+    TInt err=KErrNone;
+    TKeyEvent keyEvent;
+    iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesHandleLbxKeyEventL"));
+    
+    iMPXLbxExtendedFeatures->EnableSpeedScrollL(ETrue);
+    TRAP( err , iMPXLbxExtendedFeatures->HandleLbxKeyEventL(keyEvent,EEventNull) );
+    
+	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest ::HandleLbxKeyEventL returned: %d"), err);
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesEnableSpeedScrollL
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesEnableSpeedScrollL( CStifItemParser& /*aItem*/ )
+    {
+    TInt err=KErrNone;
+    iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesEnableSpeedScrollL"));
+    
+    TRAP( err,iMPXLbxExtendedFeatures->EnableSpeedScrollL(ETrue) );
+    
+	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::EnableSpeedScrollL returned: %d"), err);
+    return err;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMPXMusicPlayerCommonuiStifTest ::CMPXLbxExtendedFeaturesSpeedNaviUpdating
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesSpeedNaviUpdating( CStifItemParser& /*aItem*/ )
+    {
+    TInt err=KErrNone;
+    iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::CMPXLbxExtendedFeaturesSpeedNaviUpdating begin:"));
+    
+    iMPXLbxExtendedFeatures->SpeedNaviUpdating(ETrue);
+    
+	iLog->Log(_L("CMPXMusicPlayerCommonuiStifTest::SpeedNaviUpdating end."));
+    return err;
+    }
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                MPX Music Player Media Key Handler API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../inc/mpxmediakeyhandler.h             APP_LAYER_PLATFORM_EXPORT_PATH(mpxmediakeyhandler.h)
+../inc/mpxmediakeyhandlerobserver.h     APP_LAYER_PLATFORM_EXPORT_PATH(mpxmediakeyhandlerobserver.h)
+../inc/mpxmediakeyhandlerdefs.h         APP_LAYER_PLATFORM_EXPORT_PATH(mpxmediakeyhandlerdefs.h)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/inc/mpxmediakeyhandler.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,109 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX media key handler interface definition
+*
+*/
+
+
+
+#ifndef C_MMPXMEDIAKEYHANDLER_H
+#define C_MMPXMEDIAKEYHANDLER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxmediakeyhandlerobserver.h>
+#include <mpxmediakeyhandlerdefs.h>
+
+// DATA TYPES
+typedef TInt TMPXMediaKeyPopupFlags;
+
+// CONSTANTS
+/**
+ * Constants for media key feature flags
+ */
+#define EDisplayVolumePopup 0x0001
+#define EDisplayMediaPopup  0x0002
+
+// CLASS DECLARATION
+
+/**
+ *  MPX media key handler interface.
+ *
+ *  @lib mpxmediakeyhandler.lib
+ *  @since S60 3.2.3
+ */
+NONSHARABLE_CLASS( MMPXMediaKeyHandler )
+    {
+public:
+
+    /**
+     * Two-phased constructor.
+     *
+     * @since S60 5.0
+     * @param aFlags Flags for creating popups.
+     * @param aObserver Media key command observer
+     * @return Pointer to newly created object.
+     */
+    IMPORT_C static MMPXMediaKeyHandler* NewL(
+        TMPXMediaKeyPopupFlags aFlags,
+        MMPXMediaKeyHandlerObserver* aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~MMPXMediaKeyHandler();
+
+    /**
+     * Show playback popup
+     *
+     * @since S60 3.2.3
+     * @param aMode Playback popup behaviour mode
+     */
+    virtual void ShowPlaybackPopupL( TMPXPlaybackPopupModes aMode ) = 0;
+
+    /**
+     * Show Volume popup
+     *
+     * @since S60 5.0
+     */
+    virtual void ShowVolumePopupL() = 0;
+
+    /**
+     * Dismiss notifier popup.
+     *
+     * @since S60 3.2.3
+     * @param aFlags Popup flag to determine which popup(s) should
+     *               be dismissed.
+     */
+    virtual void DismissNotifier( TMPXMediaKeyPopupFlags aFlags ) = 0;
+
+
+    /**
+     * Enable or disable Media Key behavior
+     * @since S60 3.2.3
+     * @param aEnable, ETrue, media keys are sent to observers
+     *                 EFalse, media keys are ignored
+     */
+    virtual void SetEnableMediaKeys( TBool aEnable ) = 0;
+    
+    /**
+     * Gets called when orientation change begins
+     */    
+    virtual void NotifyOrientationChangeBegin() = 0;
+    };
+
+#endif  // C_MMPXMEDIAKEYHANDLER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/inc/mpxmediakeyhandlerdefs.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Definitions used in Media Key Handler.
+*
+*/
+
+
+
+#ifndef MPXMEDIAKEYHANDLERDEFS_H
+#define MPXMEDIAKEYHANDLERDEFS_H
+
+
+/**
+ * Playback popup behaviour modes.
+ * @since S60 3.2.3
+ */
+enum TMPXPlaybackPopupModes
+    {
+    EMPXPopupNoTimeout = 0,
+    EMPXPopupTimeout,
+    EMPXPopupShowIfVisible,
+    EMPXPopupShowIfVisibleRestartTimer
+    };
+
+#endif  // MPXMEDIAKEYHANDLERDEFS_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/inc/mpxmediakeyhandlerobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MPX media key command observer interface definition
+*
+*/
+
+
+
+#ifndef C_MMPXMEDIAKEYHANDLEROBSERVER_H
+#define C_MMPXMEDIAKEYHANDLEROBSERVER_H
+
+
+// INCLUDES
+#include <e32base.h>
+#include <mpxplaybackcommanddefs.h>
+
+// CLASS DECLARATION
+
+/**
+ *  MPX Media Key Handler command observer.
+ *
+ *  @lib mpxmediakeyhandler.lib
+ *  @since S60 5.0
+ */
+NONSHARABLE_CLASS( MMPXMediaKeyHandlerObserver )
+    {
+public:
+
+    /**
+     * Handle media key commands.
+     *
+     * @since 5.0
+     * @param aCommand Command to be handled.
+     * @param aData data for the specific command
+     */
+    virtual void HandleMediaKeyCommand(
+        const TMPXPlaybackCommand aCommand,
+        const TInt aData ) = 0;
+    };
+
+#endif  // C_MMPXMEDIAKEYHANDLEROBSERVER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/mpx_music_player_media_key_handler_api.metaxml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,15 @@
+<?xml version="1.0" ?>
+<api id="e10d111d0c81ecb62dff7114f986ea9c" dataversion="2.0">
+<name>MPX Music Player Media Key Handler API</name>
+<description>Provides interface for the media key handler</description>
+<type>c++</type>
+<collection>mpxmusicplayer</collection>
+<libs>
+<lib name="mpxmediakeyhandler.lib"/>
+</libs>
+<release category="platform" sinceversion=""/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/conf/ui_mpxmusicplayerkeyhandertest.cfg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,86 @@
+[Test]
+title Example
+create ui_mpxmusicplayerkeyhandertest foobar
+foobar Example pa ra me ters
+delete foobar
+[Endtest] 
+
+[Test]
+title 1: MPXmusicplayermediahandlerInstance
+create ui_mpxmusicplayerkeyhandertest MPXmusic
+bringtoforeground
+MPXmusic MPXmusicplayermediahandlerInstance
+pause 1000
+MPXmusic EDWT_Delete
+MPXmusic MPXmusicplayermediahandlerDestructor
+delete MPXmusic
+sendtobackground
+[Endtest]
+
+[Test]
+title 2: MPXmusicplayermediahandlerDestructor
+create ui_mpxmusicplayerkeyhandertest MPXmusic
+bringtoforeground
+MPXmusic MPXmusicplayermediahandlerInstance
+pause 1000
+MPXmusic EDWT_Delete
+MPXmusic MPXmusicplayermediahandlerDestructor
+delete MPXmusic
+sendtobackground
+[Endtest]
+
+[Test]
+title 3: MPXmusicplayermediahandlerShowPlaybackPopupL
+create ui_mpxmusicplayerkeyhandertest MPXmusic
+bringtoforeground
+MPXmusic MPXmusicplayermediahandlerInstance
+pause 1000
+MPXmusic MPXmusicplayermediahandlerShowPlaybackPopupL
+pause 1000
+MPXmusic EDWT_Delete
+MPXmusic MPXmusicplayermediahandlerDestructor
+delete MPXmusic
+sendtobackground
+[Endtest]
+
+[Test]
+title 4: MPXmusicplayermediahandlerShowVolumePopupL
+create ui_mpxmusicplayerkeyhandertest MPXmusic
+bringtoforeground
+MPXmusic MPXmusicplayermediahandlerInstance
+pause 1000
+MPXmusic MPXmusicplayermediahandlerShowVolumePopupL
+pause 1000
+MPXmusic EDWT_Delete
+MPXmusic MPXmusicplayermediahandlerDestructor
+delete MPXmusic
+sendtobackground
+[Endtest]
+
+[Test]
+title 5: MPXmusicplayermediahandlerDismissNotifier
+create ui_mpxmusicplayerkeyhandertest MPXmusic
+bringtoforeground
+MPXmusic MPXmusicplayermediahandlerInstance
+pause 1000
+MPXmusic MPXmusicplayermediahandlerDismissNotifier
+pause 1000
+MPXmusic EDWT_Delete
+MPXmusic MPXmusicplayermediahandlerDestructor
+delete MPXmusic
+sendtobackground
+[Endtest]
+
+[Test]
+title 6: MPXmusicplayermediahandlerSetEnableMediaKeys
+create ui_mpxmusicplayerkeyhandertest MPXmusic
+bringtoforeground
+MPXmusic MPXmusicplayermediahandlerInstance
+pause 1000
+MPXmusic MPXmusicplayermediahandlerSetEnableMediaKeys
+pause 1000
+MPXmusic EDWT_Delete
+MPXmusic MPXmusicplayermediahandlerDestructor
+delete MPXmusic
+sendtobackground
+[Endtest]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxmusicplayertest
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+#include "../ui_mpxmusicplayerkeyhandertest/group/bld.inf"
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/init/TestFramework.ini	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,197 @@
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module.
+# 	- Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+#		DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport_ui_mpxmusicplayerkeyhandertest
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone	# Possible values are:
+						# 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+					  	# 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+					  	# 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+					  	# 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0                              # Default timeout value for each test case. In milliseconds
+UITestingSupport= YES
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= c:\testframework\ui_mpxmusicplayerkeyhandertest.cfg
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+#	- Will write log file in unicode format.
+#		+ YES, Log file will be written in unicode format
+#		+ NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES    # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML         # Possible values: TXT or HTML
+#EmulatorOutput= FILE         # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML         # Possible values: TXT or HTML
+#HardwareOutput= FILE         # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE  # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES       # Possible values: YES or NO
+#WithTimeStamp= YES           # Possible values: YES or NO
+#WithLineBreak= YES           # Possible values: YES or NO
+#WithEventRanking= YES        # Possible values: YES or NO
+
+#FileUnicode= YES             # Possible values: YES or NO
+#AddTestCaseTitle= YES        # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/Bmarm/ui_mpxmusicplayerkeyhandertestU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/Bwins/ui_mpxmusicplayerkeyhandertestU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/EABI/ui_mpxmusicplayerkeyhandertestU.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,5 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+	_ZTI17CEdwinTestControl @ 2 NONAME ; #<TI>#
+	_ZTV17CEdwinTestControl @ 3 NONAME ; #<VT>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project ui_mpxmusicplayermediakeyhandertest
+*
+*/
+
+
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+// Example: 
+/*
+/agnmodel/inc/AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+ui_mpxmusicplayerkeyhandertest.mmp
+
+PRJ_MMPFILES
+
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+/agnmodel/group/agnmodel.mmp
+#if defined(MARM)
+/agnmodel/group/agsvexe.mmp
+#endif
+*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/group/ui_mpxmusicplayerkeyhandertest.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,88 @@
+/*TYPE TESTCLASS*//*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project definition file for project ui_mpxmediakeyhandlertest
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          ui_mpxmusicplayerkeyhandertest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         ui_mpxmusicplayerkeyhandertest.def
+
+#ifdef SBSV2
+USERINCLUDE     ../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+#else // SBSV2 not defined
+USERINCLUDE     ../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+#endif // SBSV2
+
+SOURCE          ui_mpxmusicplayerkeyhandertest.cpp
+SOURCE          ui_mpxmusicplayerkeyhandertestBlocks.cpp EdwinTestControl.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+LIBRARY			efsrv.lib 
+LIBRARY         cone.lib 
+LIBRARY         ws32.lib avkon.lib eikcoctl.lib eikctl.lib bafl.lib apgrfx.lib aknskins.lib aknskinsrv.lib aknswallpaperutils.lib eikcore.lib
+LIBRARY         estor.lib 
+LIBRARY         sysutil.lib
+LIBRARY         apmime.lib mpxmediakeyhandler.lib
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/group/ui_mpxmusicplayerkeyhandertest.pkg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,65 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: pakage file for make installation file for STIF
+;
+;
+; Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+; // STIF GUI (STIFTestFramework\Series60_UI is need to compile)
+
+"..\..\init\TestFramework.ini"   -   "c:\testframework\TestFramework.ini" 
+"..\..\conf\ui_mpxmusicplayerkeyhandertest.cfg"   -   "c:\testframework\ui_mpxmusicplayerkeyhandertest.cfg"
+"\epoc32\release\armv5\urel\ui_mpxmusicplayerkeyhandertest.dll"   -   "c:\Sys\Bin\ui_mpxmusicplayerkeyhandertest.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/group/ui_mpxmusicplayerkeyhandertest_DoxyFile.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,222 @@
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = ui_mpxmusicplayerkeyhandertest
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = Z:\s60\app\music\music_dom\mpx_music_player_media_key_handler_api\tsrc\ui_mpxmusicplayerkeyhandertest\
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = Z:\s60\app\music\music_dom\mpx_music_player_media_key_handler_api\tsrc\ui_mpxmusicplayerkeyhandertest\
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/inc/EdwinTestControl.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,47 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CEdwinTestControl test class for STIF Test Framework TestScripter.
+*
+*/
+#ifndef EDWINTESTCONTROL_H_
+#define EDWINTESTCONTROL_H_
+
+#include <eikedwin.h>
+
+class CAknsBasicBackgroundControlContext;
+
+class CEdwinTestControl : public CCoeControl, public MCoeControlObserver
+    {
+public:
+	static CEdwinTestControl* NewL(void);
+	virtual ~CEdwinTestControl();
+protected:
+	TTypeUid::Ptr MopSupplyObject(TTypeUid aId); // 
+private:
+	virtual void SizeChanged();
+	virtual void HandleResourceChange(TInt aType);
+	virtual TInt CountComponentControls() const;
+	virtual CCoeControl* ComponentControl(TInt aIndex) const;
+    void ConstructL(void);
+	void Draw(const TRect& aRect) const;
+	
+	void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType);
+	TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType );	
+private:
+	CAknsBasicBackgroundControlContext*	iBgContext; 
+	CEikEdwin* iEditWin;
+};
+
+
+#endif /*EDWINTESTCONTROL_H_*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/inc/ui_mpxmusicplayerkeyhandertest.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,202 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMPXMusicplayermediakeyhandertest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+
+#ifndef MPXMUSICPLAYERMEDIAKEYHANDERTEST_H
+#define MPXMUSICPLAYERMEDIAKEYHANDERTEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+#include <mpxmediakeyhandlerobserver.h>
+#include <mpxmediakeyhandler.h>
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+#ifdef __WINSCW__
+// Logging path
+_LIT( KmpxmusicplayermediakeyhandertestLogPath, "c:\\logs\\testframework\\mpxmusicplayermediakeyhandertest\\" ); 
+// Log file
+_LIT( KmpxmusicplayermediakeyhandertestLogFile, "mpxmusicplayermediakeyhandertest.txt" ); 
+_LIT( KmpxmusicplayermediakeyhandertestLogFileWithTitle, "mpxmusicplayermediakeyhandertest_[%S].txt" );
+#else
+_LIT( KmpxmusicplayermediakeyhandertestLogPath, "e:\\logs\\testframework\\mpxmusicplayermediakeyhandertest\\" ); 
+// Log file
+_LIT( KmpxmusicplayermediakeyhandertestLogFile, "mpxmusicplayermediakeyhandertest.txt" ); 
+_LIT( KmpxmusicplayermediakeyhandertestLogFileWithTitle, "mpxmusicplayermediakeyhandertest_[%S].txt" );
+#endif
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+class CMPXMusicplayermediakeyhandertest;
+class CCoeControl;
+class MMPXMediaKeyHandler;
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  CMPXMusicplayermediakeyhandertest test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CMPXMusicplayermediakeyhandertest) : public CScriptBase,
+													   public MMPXMediaKeyHandlerObserver
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CMPXMusicplayermediakeyhandertest* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CMPXMusicplayermediakeyhandertest();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+        virtual void HandleMediaKeyCommand(const TMPXPlaybackCommand /*aCommand*/,const TInt /*aData*/ ) {};
+    protected:  // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    protected:  // Functions from base classes
+
+        /**
+        * From ?base_class ?member_description
+        */
+        //?type ?member_function();
+
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CMPXMusicplayermediakeyhandertest( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        /**
+        * Example test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt ExampleL( CStifItemParser& aItem );
+        TInt CancelMoveMR( CStifItemParser& aItem );
+        virtual TInt EDWT_DeleteL( CStifItemParser& aItem );
+        virtual TInt MPXmusicplayermediahandlerInstance( CStifItemParser& /*aItem*/ );
+        TInt MPXmusicplayermediahandlerDestructor( CStifItemParser& );
+        TInt MPXmusicplayermediahandlerShowPlaybackPopupL( CStifItemParser& /* aItem*/ );
+        TInt MPXmusicplayermediahandlerShowVolumePopupL( CStifItemParser& /* aItem*/ );
+        TInt MPXmusicplayermediahandlerDismissNotifier( CStifItemParser& /* aItem*/ );
+        TInt MPXmusicplayermediahandlerSetEnableMediaKeys( CStifItemParser& /* aItem*/ );
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+    public:     // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    protected:  // Data
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+    private:    // Data
+        
+        // ?one_line_short_description_of_data
+        //?data_declaration;
+
+        // Reserved pointer for future extension
+        //TAny* iReserved;
+
+    public:     // Friend classes
+        //?friend_class_declaration;
+    protected:  // Friend classes
+        //?friend_class_declaration;
+    private:    // Friend classes
+        //?friend_class_declaration;
+    	CCoeControl* iEdwinTestControl;
+    	MMPXMediaKeyHandler* iMPXMediaKeyHandler;
+    };
+
+#endif      // MPXMUSICPLAYERMEDIAKEYHANDERTEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/src/EdwinTestControl.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: CEdwinTestControl test class for STIF Test Framework TestScripter.
+*
+*/
+#include "EdwinTestControl.h"
+#include <eikenv.h>
+#include <aknsutils.h> 
+#include <aknsdrawutils.h> 
+#include <aknutils.h> 
+#include <aknsbasicbackgroundcontrolcontext.h>
+
+
+CEdwinTestControl::~CEdwinTestControl()
+	{
+	delete iEditWin;
+	iEditWin = NULL;
+	delete iBgContext;
+	iBgContext = NULL;
+	}   
+ 
+CEdwinTestControl* CEdwinTestControl::NewL(void)
+    {
+    CEdwinTestControl* self = new(ELeave)CEdwinTestControl();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+ 
+void CEdwinTestControl::ConstructL()
+    {
+    CreateWindowL();
+ 
+    iEditWin = new (ELeave) CEikEdwin();
+    iEditWin->ConstructL( 0, 100, 100, 1 );
+    iEditWin->SetContainerWindowL( *this );
+    iEditWin->CreateTextViewL();
+//    iEditWin->SetInputCapabilitiesL( TCoeInputCapabilities::EAllText );
+    
+	// make first with no size at all
+	iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgScreen,TRect(0,0,1,1), ETrue );
+	// Setting rect will cause SizeChanged to be called
+	// and iBgContext size & position is updated accordingly.
+	SetRect( CEikonEnv::Static()->EikAppUi()->ClientRect() );	
+	
+	ActivateL();
+	DrawNow();
+    }
+ 
+void CEdwinTestControl::SizeChanged()
+	{
+	if ( iBgContext )
+		{
+		iBgContext->SetRect(Rect());
+ 
+		if ( &Window() )
+			{
+			iBgContext->SetParentPos( PositionRelativeToScreen() );
+			}
+		}
+	if ( iEditWin )
+		{
+		iEditWin->SetRect(Rect());	
+		}
+	}
+ 
+ 
+void CEdwinTestControl::HandleResourceChange( TInt aType )
+	{
+	TRect rect;
+ 
+    if ( aType == KEikDynamicLayoutVariantSwitch )
+    	{    
+        AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect);
+        SetRect(rect);
+    	}
+ 
+	CCoeControl::HandleResourceChange(aType);
+	}
+ 
+ 
+TTypeUid::Ptr CEdwinTestControl::MopSupplyObject(TTypeUid aId)
+	{
+	if ( iBgContext )
+		{
+		return MAknsControlContext::SupplyMopObject( aId, iBgContext );
+		}	
+
+	return CCoeControl::MopSupplyObject( aId );
+	}
+ 
+ 
+void CEdwinTestControl::Draw(const TRect& aRect) const
+	{
+	CWindowGc& gc = SystemGc();
+    
+    // draw background skin first.
+  	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+	AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect );
+	}
+
+TInt CEdwinTestControl::CountComponentControls() const
+{
+    return 1;
+}
+ 
+CCoeControl* CEdwinTestControl::ComponentControl(TInt aIndex) const
+{
+    switch (aIndex)
+    	{
+        case 0:
+        	return iEditWin;
+        default:
+            return 0;
+    	}
+}
+
+void CEdwinTestControl::HandleControlEventL( CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/)
+	{
+    // TODO: Add your control event handler code here
+	}
+
+TKeyResponse CEdwinTestControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
+	{
+	if ( iEditWin )
+		{
+		return iEditWin->OfferKeyEventL( aKeyEvent, aType );
+		}
+	else
+		{
+		return EKeyWasNotConsumed;
+		}
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/src/ui_mpxmusicplayerkeyhandertest.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMPXMusicplayermediakeyhandertest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "ui_mpxmusicplayerkeyhandertest.h"
+#include <SettingServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::CMPXMusicplayermediakeyhandertest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXMusicplayermediakeyhandertest::CMPXMusicplayermediakeyhandertest( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CMPXMusicplayermediakeyhandertest::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(KmpxmusicplayermediakeyhandertestLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(KmpxmusicplayermediakeyhandertestLogFile);
+        }
+
+    iLog = CStifLogger::NewL( KmpxmusicplayermediakeyhandertestLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CMPXMusicplayermediakeyhandertest* CMPXMusicplayermediakeyhandertest::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CMPXMusicplayermediakeyhandertest* self = new (ELeave) CMPXMusicplayermediakeyhandertest( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CMPXMusicplayermediakeyhandertest::~CMPXMusicplayermediakeyhandertest()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+//-----------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CMPXMusicplayermediakeyhandertest::SendTestClassVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("ui_mpxmusicplayerkeyhandertest.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) CMPXMusicplayermediakeyhandertest::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/ui_mpxmusicplayerkeyhandertest/src/ui_mpxmusicplayerkeyhandertestBlocks.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,322 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CMPXMusicplayermediakeyhandertest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "ui_mpxmusicplayerkeyhandertest.h"
+
+#include <coeaui.h>
+#include "EdwinTestControl.h"
+#include <EIKENV.H>
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void CMPXMusicplayermediakeyhandertest::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicplayermediakeyhandertest::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "Example", CMPXMusicplayermediakeyhandertest::ExampleL ),
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+        ENTRY( "MPXmusicplayermediahandlerInstance", CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance ),
+        ENTRY( "EDWT_Delete", CMPXMusicplayermediakeyhandertest::EDWT_DeleteL ),
+        ENTRY( "MPXmusicplayermediahandlerDestructor", CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerDestructor ),
+        ENTRY( "MPXmusicplayermediahandlerShowPlaybackPopupL", CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerShowPlaybackPopupL ),
+        ENTRY( "MPXmusicplayermediahandlerShowVolumePopupL", CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerShowVolumePopupL ),
+        ENTRY( "MPXmusicplayermediahandlerDismissNotifier", CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerDismissNotifier ),
+        ENTRY( "MPXmusicplayermediahandlerSetEnableMediaKeys", CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerSetEnableMediaKeys ),
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicplayermediakeyhandertest::ExampleL( CStifItemParser& aItem )
+    {
+
+    // Print to UI
+    _LIT( Kmpxmusicplayermediakeyhandertest, "mpxmusicplayermediakeyhandertest" );
+    _LIT( KExample, "In Example" );
+    TestModuleIf().Printf( 0, Kmpxmusicplayermediakeyhandertest, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+
+    TInt i = 0;
+    TPtrC string;
+    _LIT( KParam, "Param[%i]: %S" );
+    while ( aItem.GetNextString ( string ) == KErrNone )
+        {
+        TestModuleIf().Printf( i, Kmpxmusicplayermediakeyhandertest, 
+                                KParam, i, &string );
+        i++;
+        }
+
+    return KErrNone;
+
+    }
+
+// ---------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance
+// Create Musicplayermediahandler Instance Move operation function
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance( CStifItemParser& /* aItem*/ )
+	{
+    iLog->Log(_L("CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance"));
+    
+    TInt err = KErrNone;
+    
+    iEdwinTestControl = CEdwinTestControl::NewL();
+    CleanupStack::PushL( iEdwinTestControl );    	    
+    CCoeEnv::Static()->AppUi()->AddToStackL( iEdwinTestControl );
+    iEdwinTestControl->MakeVisible(ETrue);
+    CleanupStack::Pop( iEdwinTestControl );
+    
+    if ( !iMPXMediaKeyHandler )
+        {
+        // Handle media key in appui
+        iMPXMediaKeyHandler = MMPXMediaKeyHandler::NewL(
+            EDisplayVolumePopup | EDisplayMediaPopup,
+            this );
+        }
+	if(err != KErrNone)
+	  {
+	  iLog->Log(_L("CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance"),err);
+	  }
+       return err;
+	}
+  
+// -----------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::EDWT_DeleteL
+// EDWT DeleteL
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicplayermediakeyhandertest::EDWT_DeleteL( CStifItemParser& )
+	{
+    CCoeEnv::Static()->AppUi()->RemoveFromStack( iEdwinTestControl );
+    
+    delete iEdwinTestControl;
+    iEdwinTestControl = NULL;
+
+    return KErrNone;		
+	}
+
+// -----------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::MMPXMediaKeyHandlerDestructor
+// MMPXMediaKeyHandler Destructor
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerDestructor( CStifItemParser& )
+	{
+	
+	iLog->Log(_L("CMPXMusicplayermediakeyhandertest::MMPXMediaKeyHandlerDestructor"));
+	    
+	TInt err = KErrNone;
+	
+    delete iMPXMediaKeyHandler;
+    iMPXMediaKeyHandler = NULL;
+    
+    return err;		
+	}
+
+// ---------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerShowPlaybackPopupL
+// MPXmusicplayermediahandler Show Playback PopupL function
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerShowPlaybackPopupL( CStifItemParser& /* aItem*/ )
+	{
+    iLog->Log(_L("CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance"));
+    
+    TInt err = KErrNone;
+    
+   TRAP(err,iMPXMediaKeyHandler->ShowPlaybackPopupL(EMPXPopupTimeout));
+    
+	if(err != KErrNone)
+	  {
+	  iLog->Log(_L("CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance"),err);
+	  }
+       return err;
+	}
+
+// ---------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerShowVolumePopupL
+// MPXmusic playermediahandler Show Volume PopupL function
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerShowVolumePopupL( CStifItemParser& /* aItem*/ )
+	{
+    iLog->Log(_L("CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance"));
+    
+    TInt err = KErrNone;
+    
+   TRAP(err,iMPXMediaKeyHandler->ShowVolumePopupL());
+    
+	if(err != KErrNone)
+	  {
+	  iLog->Log(_L("CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance"),err);
+	  }
+       return err;
+	}
+// ---------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerSetEnableMediaKeys
+// MPXmusic player media handler Set Enable MediaKeys function
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerSetEnableMediaKeys( CStifItemParser& /* aItem*/ )
+	{
+    iLog->Log(_L("CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance"));
+    
+    TInt err = KErrNone;
+    
+    TRAP(err,iMPXMediaKeyHandler->SetEnableMediaKeys(EFalse));
+    
+	if(err != KErrNone)
+	  {
+	  iLog->Log(_L("CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance"),err);
+	  }
+       return err;
+	}
+// ---------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerDismissNotifier
+// MPXmusic player media handler Dismiss Notifier function
+// (other items were commented in a header).
+// ---------------------------------------------------------------------------
+//
+TInt CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerDismissNotifier( CStifItemParser& /* aItem*/ )
+	{
+    iLog->Log(_L("CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance"));
+    
+    TInt err = KErrNone;
+    
+    TRAP(err,iMPXMediaKeyHandler->DismissNotifier(EDisplayMediaPopup | EDisplayVolumePopup));
+    
+	if(err != KErrNone)
+	  {
+	  iLog->Log(_L("CMPXMusicplayermediakeyhandertest::MPXmusicplayermediahandlerInstance"),err);
+	  }
+       return err;
+	}
+
+// -----------------------------------------------------------------------------
+// CMPXMusicplayermediakeyhandertest::?member_function
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+/*
+TInt CMPXMusicplayermediakeyhandertest::?member_function(
+   CItemParser& aItem )
+   {
+
+   ?code
+
+   }
+*/
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_remote_control_api/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                MPX Music Player Remote Control API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/mplayersecondarydisplayapi.h     APP_LAYER_PLATFORM_EXPORT_PATH(mplayersecondarydisplayapi.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_remote_control_api/inc/mplayersecondarydisplayapi.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,838 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Note IDs and other definitions for secondary displays
+*
+*/
+
+
+#ifndef MPLAYERSECONDARYDISPLAYAPI_H
+#define MPLAYERSECONDARYDISPLAYAPI_H
+
+/**
+* Category value used for Music Player notes
+*/
+const TUid KMPlayerNoteCategory = {0x102072C3};
+
+/**
+* Note IDs for notes Music Player publishes for secondary display
+* implementations.
+*
+* \%U parameters are passed as 16-bit descriptors and \%N parameters as 32-bit
+* signed integers in the data buffer given to mediator command observers.
+*
+* @note The \% character is escaped in comments to make sure documentation
+* parsers parse this file correctly.
+*
+* @see CMediatorCommandResponder
+* @since S60 3.2.3
+*/
+enum TMPlayerSecondaryDisplayNote
+    {
+    /**
+     * Not used.
+     */
+    EMPlayerNoteNone = 0,
+
+    /**
+     * Confirmation note after saving a clip or a playlist.
+     * - \%U is the title of the saved track or playlist
+     *
+     * \em qtn_mus_note_saved_to_collection
+     * "%U saved to Music Library"
+     */
+    EMPlayerNoteClipSaved,
+
+    /**
+     * Error note when attempting to play an invalid or corrupted clip.
+     *
+     * \em qtn_mp_note_corrupt_file
+     * "File is corrupt. Operation cancelled."
+     */
+    EMPlayerNoteInvalidClip,
+
+    /**
+     * Error note when attempting to play an invalid or corrupted playlist.
+     *
+     * \em qtn_nmp_note_open_broken_playlist
+     * "Playlist file cannot be found. Unable to open."
+     */
+    EMPlayerNoteInvalidPlaylist,
+
+    /**
+     * Error note when attempting to play an empty playlist.
+     *
+     * \em qtn_nmp_note_empty_playlist
+     * "Playlist is empty.\nNothing to play."
+     */
+    EMPlayerNoteEmptyPlaylist,
+
+    /**
+     * Error note when attempting to play a category of tracks and none of the
+     * tracks are playable.
+     *
+     * \em qtn_nmp_note_invalid_list
+     * "Unable to play selection. Operation cancelled."
+     */
+    EMPlayerNoteInvalidGroup,
+
+    /**
+     * Wait note shown when Music Library DB is created after starting
+     * Music Player for the first time.
+     *
+     * \em qtn_mus_note_searching
+     * "Searching for music."
+     */
+    EMPlayerNoteCreatingDb,
+
+    /**
+     * Information note shown after Music Library DB was was created but
+     * no tracks were found.
+     *
+     * \em qtn_mus_note_search_complete_no_tracks1
+     * "Search complete\nNothing found"
+     */
+    EMPlayerNoteDbCreationCompleteEmpty,
+
+    /**
+     * Information note shown after Music Library DB was created and
+     * some tracks were found.
+     * - \%N is the number of (new) tracks
+     *
+     * \em qtn_mus_note_search_complete1
+     * "Search complete\nSongs: %0N\nPlaylists: %1N"
+     */
+    EMPlayerNoteDbCreationComplete,
+
+    /**
+     * Wait note shown when updating Music Library DB
+     * - \%0N is the number of added tracks
+     * - \%1N is the number of removed tracks
+     *
+     * \em qtn_mus_note_updating_db1
+     * "Refreshing\nAdded: %0N"
+     */
+    EMPlayerNoteUpdatingDb,
+
+    /**
+     * Information note shown when updating Music Library DB is complete.
+     * - \%0N is the number of added tracks
+     * - \%1N is the number of removed tracks
+     *
+     * \em qtn_mus_note_updating_db_complete1
+     * "Refresh complete\nAdded: %0N"
+     */
+    EMPlayerNoteDbUpdateComplete,
+
+    /**
+     * Information note shown when updating Music Library DB was stopped
+     * by the user.
+     * - \%0N is the number of added tracks
+     * - \%1N is the number of removed tracks
+     *
+     * \em qtn_mus_note_updating_db_stopped1
+     * "Refresh stopped\nAdded: %0N"
+     */
+    EMPlayerNoteDbUpdateStopped,
+
+    /**
+     * Wait note for updating Music Library DB.
+     * No track counts are shown.
+     *
+     * \em qtn_mus_note_updating_db_short
+     * "Updating Music Library."
+     */
+    EMPlayerNoteUpdatingDbShort,
+
+    /**
+     * Information note shown when updating Music Library DB is complete.
+     * No track counts are shown.
+     *
+     * \em qtn_mus_note_update_complete_unmod
+     * "Update complete."
+     */
+    EMPlayerNoteDbUpdateCompleteShort,
+
+    /**
+     * Information note shown when updating Music Library DB was stopped
+     * by the user. No track counts are shown.
+     *
+     * \em qtn_mus_note_updating_db_stopped_short
+     * "Update stopped."
+     */
+    EMPlayerNoteDbUpdateStoppedShort,
+
+    /**
+     * Error note shown when there is not enough free space on memory card
+     * to add all tracks to Music Library DB.
+     *
+     * \em qtn_mus_note_memory_card_full
+     * "Not enough memory to add tracks from memory card to Music Library..."
+     */
+    EMPlayerNoteDbUpdateDiscFull,
+
+    /**
+     * Information note shown when playback had to be paused in progressive
+     * download, because all downloaded data has been played.
+     *
+     * \em qtn_mus_note_played_all_dl_content
+     * "All downloaded content has been played."
+     */
+    EMPlayerNoteAllDlContentPlayed,
+
+    /**
+     * Information note shown when attempting to use Music Player during
+     * a video call.
+     *
+     * \em qtn_mus_info_video_call_ongoing
+     * "Music Player cannot be used during video call."
+     */
+    EMPlayerNoteVideoCall,
+
+    /**
+     * Note shown when attempting to play a non-protected track when
+     * KRequireDRMInPlayback is enabled.
+     *
+     * \em qtn_mp_info_tone_no_drm
+     * "Unprotected file. Cannot be played."
+     */
+    EMPlayerNoteCannotPlayUnprotected,
+
+    /**
+     * Wait note shown when saving a track in embedded mode.
+     *
+     * \em qtn_gen_note_saving
+     * "Saving"
+     */
+    EMPlayerNoteSaving,
+
+    /**
+     * Query shown when attempting to exit Music Player without saving
+     * a downloaded/received track/playlist in embedded mode.
+     * - \%U is the title of the track or the name of the playlist
+     *
+     * \em qtn_iv_query_conf_save_downloaded
+     * "%U has not been saved. Save now?"
+     */
+    EMPlayerQueryNotSaved,
+
+    /**
+     * Wait note when deleting either a single track or a category.
+     * - \%U is the title of the track or the name of the category
+     *
+     * \em qtn_album_waiting_deleting1 , qtn_mus_query_conf_delete_all1
+     * "Deleting '%U'"
+     * "Deleting songs belonging to '%U'"
+     */
+    EMPlayerNoteDeletingSingle,
+
+    /**
+     * when deleting several marked tracks.
+     *
+     * \em qtn_nmp_del_songs_wait_note
+     * "Deleting songs"
+     */
+    EMPlayerNoteDeletingMany,
+
+    /**
+     * Confirmation query shown when attempting to delete a category.
+     *
+     * \em qtn_nmp_query_conf_delete_group
+     * "Delete all songs belonging to '%U'?"
+     */
+    EMPlayerQueryDeleteCategory,
+
+    /**
+     * Confirmation query shown when attempting to delete a single track or
+     * a playlist.
+     *
+     * \em qtn_query_common_conf_delete
+     * "Delete?\n%U"
+     */
+    EMPlayerQueryDeleteTrack,
+
+    /**
+     * Confirmation query shown when attempting to delete several marked
+     * tracks.
+     * - \%N is the number of tracks to be deleted
+     *
+     * \em qtn_nmp_del_songs_query
+     * "Delete %N songs?"
+     */
+    EMPlayerQueryDeleteTracks,
+
+    /**
+     * Confirmation query shown when attempting to all tracks in a category
+     * to Now Playing List.
+     * - \%U is the name of the category
+     *
+     * \em qtn_mus_query_conf_add_all_to_playing_pl
+     * "Add all tracks belonging to %U to Now Playing?"
+     */
+    EMPlayerQueryAddAllToNowPlaying,
+
+    /**
+     * Confirmation query shown when attempting to all tracks in a category
+     * to a new playlist.
+     * - \%U is the name of the category
+     *
+     * \em qtn_mus_query_conf_add_all_to_new_pl
+     * "Create new playlist of all tracks belonging to %U?"
+     */
+    EMPlayerQueryAddAllToNewPl,
+
+    /**
+     * Confirmation query shown when attempting to all tracks in a category
+     * to an existing playlist.
+     * - \%U is the name of the category
+     *
+     * \em qtn_mus_query_conf_add_all_to_pl
+     * "Add all tracks belonging to %U to a playlist?"
+     */
+    EMPlayerQueryAddAllToSavedPl,
+
+    /**
+     * Confirmation query shown when attempting to remove several tracks
+     * from a playlist.
+     * - \%N is the number of tracks to be removed
+     *
+     * \em qtn_mus_query_conf_remove_many1
+     * "Remove %N songs from the playlist?"
+     */
+    EMPlayerQueryRemoveTracks,
+
+    /**
+     * Confirmation query shown when attempting to remove a single track
+     * from a playlist.
+     * - \%U is the name of the track to be removed
+     *
+     * \em qtn_mus_query_conf_remove_track
+     * "Remove %U from the playlist?"
+     */
+    EMPlayerQueryRemoveTrack,
+
+    /**
+     * Confirmation query shown in embedded mode when setting a track
+     * as ringing tone and it has not yet been saved.
+     *
+     * \em qtn_mp_query_embd_rtone_change_for_all
+     * "Tone will be saved to Gallery and changed for all profiles. Continue?"
+     */
+    EMPlayerQuerySaveAndSetAsRt,
+
+    /**
+     * Confirmation query shown when setting a track as ringing tone.
+     *
+     * \em qtn_mg_query_rtone_change_for_all
+     * "Ringing tone will be changed for all profiles. Change?"
+     */
+    EMPlayerQuerySetAsRt,
+
+    /**
+     * Wait note shown when copying tracks/playlists using the organize
+     * function.
+     *
+     * \em qtn_mg_copying_many_files
+     * "Copying files"
+     */
+    EMPlayerNoteCopyingTracks,
+
+    /**
+     * Wait note shown when copying a single track or playlist using the
+     * organize function.
+     * - \%U is the title of the track or name of the playlist
+     *
+     * \em qtn_mg_waiting_copy
+     * "Copying %U"
+     */
+    EMPlayerNoteCopyingTrack,
+
+    /**
+     * Wait note shown when moving tracks/playlists using the organize
+     * function.
+     *
+     * \em qtn_mg_moving_many_files
+     * "Moving files"
+     */
+    EMPlayerNoteMovingTracks,
+
+    /**
+     * Wait note shown when moving a single track or playlist using the
+     * organize function.
+     * - \%U is the title of the track or name of the playlist
+     *
+     * \em qtn_album_waiting_move
+     * "Moving %U"
+     */
+    EMPlayerNoteMovingTrack,
+
+    /**
+     * List query shown when choosing a playlist to add tracks to.
+     * List contents are not available for secondary displays.
+     *
+     * \em qtn_mus_title_select_pl
+     * "Select playlist:"
+     */
+    EMPlayerQuerySelectPlaylist,
+
+    /**
+     * List query shown when choosing visualization plug-in.
+     *
+     * \em qtn_mus_title_select_visualization
+     * "Select visualization:"
+     */
+    EMPlayerQuerySelectVisualization,
+
+    /**
+     * Global note shown when running out of disk space when saving, moving,
+     * or copying files.
+     * - Data buffer contains the drive letter of drive in question
+     *
+     * \em qtn_memlo_mmc_not_enough_memory or \em qtn_memlo_not_enough_memory
+     */
+    EMPlayerNoteDiskFull,
+
+    /**
+    * Wait Note when MMC card becomes anavailable.
+    * \em qtn_nmp_note_mmc_unavailable
+    * "Memory card no longer available. Updating music library."
+    */
+    EMPlayerNoteMMCUnavailableWaitNote,
+
+    /**
+    * Wait note when opening album art.
+    * \em qtn_nmp_note_opening
+    * "Opening..."
+    */
+    EMPlayerNoteOpeningAlbumArt,
+
+    /**
+    * Wait note for opening cache.
+    * \em qtn_nmp_note_opening_db
+    * "Opening..."
+    */
+    EMPlayerNoteOpeningDb,
+
+    /**
+    * Wait note for scan cancelled opening cache.
+    * \em qtn_nmp_note_cancelled_db
+    * "Stopping search..."
+    */
+    EMPlayerNoteCancelledDbWaitNote,
+
+    /**
+    * Wait note for completing scan opening cache.
+    * \em qtn_nmp_note_completing_db
+    * "Completing search..."
+    */
+    EMPlayerNoteCompletingDb,
+
+    /**
+    * Wait note text when renaming a category with one item.
+    * \em qtn_nmp_note_updating_name1
+    * "Updating 1 song"
+    */
+    EMPlayerNoteUpdateOneItem,
+
+    /**
+    * Wait note text when renaming a category.
+    * \em qtn_nmp_note_updating_name
+    * "Updating %N songs"
+    */
+    EMPlayerNoteUpdateManyItems,
+
+    /**
+    * Wait note text when a corrupt db has been detected and collection
+    *is attempting to rebuild the db
+    * \em qtn_nmp_note_rebuilding_db
+    * "Repairing corrupt library. Searching for songs."
+    */
+    EMPlayerNoteRebuildingDb,
+     /**
+    * Wait note used in wait note while saving an item.
+    * \em qtn_nmp_wait_save_one_item
+    * "Saving %U"
+    */
+    EMPlayerNoteSaveOneItem,
+
+    /**
+    * Wait Note used when remove one track.
+    * \em qtn_mus_note_removing_track1
+    * "Removing '%U'"
+    */
+    EMPlayerNoteRemovingTrack,
+
+    /**
+    * Wait note used when remove multiple tracks.
+    * \em qtn_nmp_note_removing_many
+    * "Removing songs"
+    */
+    EMPlayerNoteRemovingMany,
+
+    /**
+    * Wait note for adding album art.
+    * \em qtn_nmp_note_adding_album_art
+    * "Changing album art"
+    */
+    EMPlayerNoteAddingAlbumArt,
+
+    /**
+    * Wait note for adding one song.
+    * \em qtn_nmp_note_adding_one_song
+    * "Adding song"
+    */
+    EMPlayerNoteAddingSong,
+
+    /**
+    * Wait note for adding many songs.
+    * \em qtn_mus_note_adding_tracks1
+    * "Adding songs"
+    */
+    EMPlayerNoteAddingManySongs,
+
+    /**
+    * Wait note for restoring arlbum art.
+    * \em qtn_nmp_note_restoring_album_art
+    * "Restoring album art"
+    */
+    EMPlayerNoteRestoreAlbumArt,
+
+    /**
+    * Confirmation query when MMC card is inserted into the phone.
+    * \em qtn_nmp_note_mmc_inserted
+    * "New memory card detected. Update music library?"
+    */
+    EMPlayerNoteMMCInserted,
+
+    /**
+    * Confirmation query after a MTP sync has occured.
+    * \em qtn_nmp_note_library_refresh_sync
+    * "Music may need to be refreshed due to recent USB sync. Refresh now?"
+    */
+    EMPlayerNoteUSBSyncRefresh,
+
+    /**
+    * Confirmation query when sending invalid songs.
+    * \em qtn_nmp_query_send_valid_songs1
+    * "Some songs cannot be sent. Continue?"
+    */
+    EMPlayerNoteSendInvalidSongs,
+
+    /**
+    * Confirmation note text when ringtone is set.
+    * \em qtn_nmp_note_ringtone_set
+    * "%U set as ringing tone for active profile"
+    */
+    EMPlayerRingtoneSet,
+
+    /**
+    * Confirmation query used when clip isn't supported by collection.
+    * \em qtn_nmp_note_saved_to_gallery
+    * "Saved to Media Gallery"
+    */
+    EMPlayerNoteSavedtoGallery,
+
+    /**
+    * Confirmation query used in note when save is ok.
+    * \em qtn_nmp_note_saved_to_collection
+    * "Saved to Music Library"
+    */
+    EMPlayerNoteSavedtoCollection,
+    /**
+    * Confirmation query for adding Album Art.
+    * \em qtn_nmp_query_add_art_to_album
+    * "Album art for all songs in album will be changed. Continue?"
+    */
+    EMPlayerNoteAddArtToAlbum,
+
+    /**
+    * Confirmation query for adding Songs.
+    * \em qtn_nmp_query_add_songs
+    * "Add songs now?"
+    */
+    EMPlayerNoteAddSongs,
+
+    /**
+    * Confirmation query for canceling download.
+    * \em qtn_musicshop_note_cancel
+    * "Unable to resume download after cancelling. Cancel anyway?"
+    */
+    EMPlayerNoteMusicshopCancel,
+
+    /**
+    * Confirmation note for original arlbum art restored.
+    * \em qtn_nmp_note_art_restored
+    * "Original album art restored"
+    */
+    EMPlayerNoteArtRestored,
+
+    /**
+    * Confirmation note for invalid changing album art.
+    * \em qtn_nmp_note_change_with_invalid
+    * "Album art for some songs could not be changed"
+    */
+    EMPlayerNoteAlbumArtChangeInvalid,
+
+    /**
+    * Confirmation note for invalid updating songs name.
+    * \em qtn_nmp_note_rename_with_invalid
+    * "Some songs could not be updated with %U name"
+    */
+    EMPlayerNoteRenameInvalid,
+
+    /**
+    * Confirmation qurey for restoring album art.
+    * \em qtn_nmp_query_restore_art_to_album
+    * "Original art for all songs in album will be restored. Continue?"
+    */
+    EMPlayerNoteRestoreArtToAlbum,
+
+    /**
+    * Confirmation query for drm not alllowed.
+    * \em qtn_nmp_note_art_changed
+    * "Album art changed"
+    */
+    EMPlayerNoteAlbumArtChanged,
+
+    /**
+    * Confirmation query for adding single song to playlist.
+    * \em qtn_mus_note_track_added_to_pl1
+    * "Song added to %U"
+    */
+    EMPlayerNoteAddSongToPlaylist,
+
+    /**
+    * Confirmation query for adding many songs to playlist.
+    * \em qtn_mus_multiple_tracks_added_to_pl1
+    * "%N songs added to %U"
+    */
+    EMPlayerNoteAddManySongToPlaylist,
+
+    /**
+    * Confirmation query for adding many songs to playlist.
+    * \em qtn_sm_all_serv_failed
+    * "Saving failed "
+    */
+    EMPlayerNoteSavingFailed,
+
+    /**
+    * Warning Note to warn the user that we wer unable to re-create the DB
+    * after a DB corrupted event has been detected.
+    * \em qtn_nmp_note_out_of_disk_error
+    * "Not enough memory to add songs to library. Delete some data and refresh".
+    */
+    EMPlayerNoteCannotCreateDB,
+
+    /**
+    * Warning note for adding many songs to playlist.
+    * \em qtn_nmp_exp_warn_n_counts
+    * "Rights for %U will expire after %N uses. Renew license on PC."
+    */
+    EMPlayerNoteDrmExpNUse,
+
+    /**
+    * Information note after a MTP sync has occured.
+    * \em qtn_nmp_note_library_updated_sync
+    * "Music library was updated during Media Player Sync"
+    */
+    EMPlayerNoteMTPSyncInfo,
+
+    /**
+    * Information note when not enough memory to perform specified operation.
+    * \em qtn_nmp_memlo_not_enough_memory
+    * "Not enough memory to complete operation. Delete some data first"
+    */
+    EMPlayerNoteNotEnoughMemoryNotification,
+
+    /**
+    * Information note when making changes to items that are currently playing.
+    * \em qtn_nmp_note_changes_take_effect
+    * "Changes will take effect after %U stopped playing"
+    *
+    */
+    EMPlayerNoteMakingChangesInformationNote,
+
+    /**
+    * Information note for db scan stopped and songs found.
+    * \em qtn_mus_note_search_stopped1
+    * "Search stopped\nSongs: %0N\nPlaylists: %1N"
+    */
+    EMPlayerNoteDbSearchStoppedItemFound,
+
+    /**
+    * Information note for db scan stopped and no song found.
+    * \em qtn_mus_note_search_stopped_no_tracks1
+    * "Search stopped\nNothing found"
+    */
+    EMPlayerNoteDbSearchStoppedNothingFound,
+
+    /**
+    * Information note used to display file deletion failed.
+    * \em qtn_nmp_delete_file_open
+    * "Unable to delete song. It is currently in use."
+    */
+    EMPlayerDeleteFileIsOpened,
+
+    /**
+    * Information note used to display multiple file deletion failed
+    * \em qtn_nmp_delete_mult_file_open
+    * "Unable to delete some songs. They are currently in use."
+    */
+    EMPlayerDeleteMultFileIsOpened,
+
+    /**
+    * Information note when cannot play DRM music due to no rights.
+    * \em qtn_nmp_note_drm_expired_playback
+    * "Rights are expired. Unable to play %U"
+    */
+    EMPlayerNoteDrmExpiredPlayback,
+
+    /**
+    * Information note when all songs to be sent are invalid.
+    * \em qtn_nmp_note_nothing_to_send
+    * "Songs cannot be found. Nothing to send."
+    */
+    EMPlayerNoteSendAllInvalidSongs,
+
+    /**
+    * Information note when not enough memory to perform a refresh.
+    * \em qtn_nmp_note_no_mem_complete_refresh
+    * "Not enough memory to add more music to the library.
+    * Delete some data first"
+    */
+    EMPlayerNoteCannotCompleteRefresh,
+
+    /**
+    * Information note for unable to play DRM protected music over bluetooth.
+    * \em qtn_nmp_note_protected_over_bluetooth
+    * "Song is protected. Unable to play over Bluetooth headset".
+    */
+    EMPlayerNoteNoDRMOverBT,
+
+    /**
+    * Information note when attempting to perform an operation on broken file.
+    * \em qtn_mp_note_broken_file
+    * "File cannot be found. Operation cancelled."
+    */
+    EMPlayerBrokenfile,
+
+    /**
+    * Information note when attempting to play an invalid playlist.
+    * \em qtn_nmp_note_play_broken_file
+    * "Playlist file cannot be found. Unable to play."
+    */
+    EMPlayerNoteInvalidFile,
+
+    /**
+    * Information note when WMDRM rights activation key has one count remaining.
+    * \em qtn_nmp_exp_warn_1_count
+    * "Rights for %U will expire in 1 use. Renew license on PC."
+    */
+    EMPlayerNoteWDrmExpOneUse,
+
+    /**
+    * Information note when WMDRM rights are about to expire in one day.
+    * \em qtn_nmp_exp_warn_1_day
+    * "Rights for %U will expire in 1 day.  Renew license on PC."
+    */
+    EMPlayerNoteWDrmExpOneDay,
+
+    /**
+    * Information note when WMDRM rights are about to expire.
+    * \em qtn_nmp_exp_warn_today
+    * "Rights for %U will expire today.  Renew license on PC."
+    */
+    EMPlayerNoteWDrmExpToday,
+
+    /**
+    * Information note when WMDRM rights are about to expire in multiple days.
+    * \em qtn_nmp_exp_warn_n_days
+    * "Rights for %U will expire after %N uses. Renew license on PC."
+    */
+    EMPlayerNoteWDrmExpNDays,
+
+    /**
+    * Information note when WMDRM rights have expired.
+    * \em qtn_nmp_license_exp
+    * "Unable to play song.  Rights are invalid or expired.  Renew rights on PC."
+    */
+    EMPlayerNoteWDrmLicenseExp,
+
+    /**
+    * Information note for drm not alllowed.
+    * \em qtn_mp_drm_not_allowed
+    * "Unable to select a copyright protected item."
+    */
+    EMPlayerNoteDrmNotAllowed
+
+// Cover UI start
+    ,
+    /**
+    * Query for a new playlist: should tracks be added to it or not?
+    * \em qtn_nmp_query_add_songs
+    * "Add songs now?"
+    */
+    EMPlayerQueryAddSongsToPlaylist,
+
+    /**
+    * Query whether the selected track should be moved to another library
+    * \em qtn_nmp_query_move_to_library
+    * "Item will be moved to %U library. Some details may be lost. Continue?"
+    */
+    EMPlayerQueryMoveToLibrary,
+
+    /**
+    * Generic confirmation query. Text can vary, but dialog is modal.
+    * "%U"
+    */
+    EMPlayerQueryConfirmationGeneric,
+
+    /**
+    * Query for name for a playlist to be created.
+    * \em qtn_mp_enter_pl_name
+    * "Playlist name:"
+    */
+    EMPlayerQueryCreatePlaylist,
+
+    /**
+    * Query for new name for an item.
+    * \em qtn_nmp_prmpt_new_name
+    * "New name:"
+    */
+    EMPlayerQueryPrmptNewName,
+
+    /**
+    * Progress dialog for USB connection in progress.
+    * \em qtn_nmp_note_usb_connection_in_progress
+    * "USB connection in progress"
+    */
+    EMPlayerUSBConnectionInProgress,
+
+
+    /**
+    * Progress dialog for USB connection in progress.
+    * \em qtn_nmp_note_usb_connection_in_progress
+    * "USB connection in progress"
+    */
+    EMPlayerMTPConnectionInProgress,
+
+    /**
+    * Progress dialog for formatting wait note.
+    * \em qtn_nmp_note_mp_unavailable_mmc
+    * "Music Player unable to access memory card. Memory card operation underway."
+    */
+    EMPlayerFormatting
+
+// Cover UI end
+    };
+#endif // MPLAYERSECONDARYDISPLAYAPI_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_player_remote_control_api/mpx_music_player_remote_control_api.metaxml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="cd7edbc96589920d16d57d07000d931c" dataversion="2.0">
+<name>MPX Music Player Remote Control API</name>
+<description>Provides means to control MPX Music Player remotely (e.g. from Active Idle plugin)</description>
+<type>c++</type>
+<collection>mpxmusicplayer</collection>
+<libs>
+</libs>
+<release category="platform" sinceversion=""/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_shop_ui_api/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                MPX Music Shop UI API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/MMusicShopBrViewCallback.h       APP_LAYER_PLATFORM_EXPORT_PATH(MMusicShopBrViewCallback.h)
+../inc/MusicShopEmbeddedLauncher.h      APP_LAYER_PLATFORM_EXPORT_PATH(MusicShopEmbeddedLauncher.h)
+../inc/MusicShopExternalInterface.h     APP_LAYER_PLATFORM_EXPORT_PATH(MusicShopExternalInterface.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_shop_ui_api/inc/MMusicShopBrViewCallback.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MusicShop Browser  view callback provider.
+*
+*/
+
+
+#ifndef M_MUSICSHOP_BR_VIEW_CALLBACK_H
+#define M_MUSICSHOP_BR_VIEW_CALLBACK_H
+
+// INCLUDE FILES
+#include <MusicShopExternalInterface.h>
+
+
+// CLASS DECLARATION
+
+/**
+* Interface to give callback to browser view.
+*
+* @lib MusicShopLib.lib
+* @since S60 3.2.3
+*/
+class MMusicShopBrViewCallback
+    {
+    public:
+        enum TMusDownloadControlCommandId
+            {
+            EPauseDownload = 0x01, // pause
+            EResumeDownload, // resume
+            ECancelDownload // cancel
+            };
+        /**
+        * Activate the MusicShop application view based on view id
+        *
+        * @since S60 3.2.3
+        * @param aViewId view id,
+        *                KUidMusBrViewId for browser  view,
+        *                KUidMusBmViewId for bookmark view.
+        */
+        virtual void ActivateMusicShopViewL (TUid aViewId) = 0;
+
+        /**
+        * Handle pause/resume/cancel download related commands from Music Player playback view.
+        *
+        * @since S60 3.2.3
+        * @param aControlDownloadCommandId pause/resume/cancel download command id.
+        */
+        virtual void HandleDownloadCommandL ( TMusDownloadControlCommandId aControlDownloadCommandId ) = 0;
+    };
+
+#endif //M_MUSICSHOP_BR_VIEW_CALLBACK_H
+
+    // End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_shop_ui_api/inc/MusicShopEmbeddedLauncher.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,134 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MusicShop embedded launcher
+*
+*/
+
+
+
+#ifndef MUSICSHOP_EMBEDDED_LAUNCHER_H
+#define MUSICSHOP_EMBEDDED_LAUNCHER_H
+
+#include <MusicShopExternalInterface.h>
+#include <Avkon.rsg>
+#include <AknServerApp.h>
+
+class CAknNullService;
+class CAknLaunchAppService;
+class CGenericParamList;
+
+const TInt KMusDefaultIap = 0; // 0 means application will take the default
+                               // internet access point from comms db.
+
+/**
+* Launches MusicShop in Embedded mode.
+*
+* @lib MusicShopLib.lib
+* @since S60 3.2.3
+*/
+
+NONSHARABLE_CLASS ( CMusicShopEmbeddedLauncher )
+    : public CBase,
+      public MAknServerAppExitObserver
+    {
+    public:
+
+        /**
+        * First phase constructor,
+        *
+        * @since S60 v3.2.3
+        * @param aCoeEnv Eikon environment
+        */
+        static IMPORT_C CMusicShopEmbeddedLauncher* NewL(CEikonEnv* aCoeEnv);
+
+        /**
+        * Destructor
+        *
+        * @since S60 v3.2.3
+        */
+        IMPORT_C virtual ~CMusicShopEmbeddedLauncher();
+
+        /**
+        * Activate MusicShop browser view, this API can also
+        * be used to send DNL message to already launched MS
+        * application.
+        *
+        * @since S60 v3.2.3
+        * @param aUrlLink name of the url
+        * @param aDefaultAccessPoint URL access point
+        *                            0 to use default AP
+        * @param aRskId Right softkey id
+        */
+        static IMPORT_C void ActivateMusBrViewL(
+                        const TDesC& aUrlLink,
+                        const TUint aDefaultAccessPoint = KMusDefaultIap,
+                        const TInt aRskId = R_AVKON_SOFTKEYS_OPTIONS_BACK);
+
+        /**
+        * This will launch the music shop application based on view id
+        *
+        * @since S60 v3.2.3
+        * @param aUrlLink If Url is set to NULL then Bookmark view
+        *                 is launched else browser view.
+        * @param aDefaultAccessPoint URL access point
+        *                            0 to use default AP
+        * @param aRskId Right softkey id
+        */
+        IMPORT_C void LaunchMusicShopL(
+                        const TDesC& aUrlLink,
+                        const TUint aDefaultAccessPoint = KMusDefaultIap,
+                        const TInt aRskId = R_AVKON_SOFTKEYS_OPTIONS_BACK);
+    private:
+        /**
+        * Default Contructor
+        *
+        * @since S60 v3.2.3
+        * @param aCoeEnv Eikon environment
+        */
+        CMusicShopEmbeddedLauncher(CEikonEnv* aCoeEnv);
+
+        /**
+        * Second phase constructor
+        *
+        * @since S60 v3.2.3
+        */
+        void ConstructL();
+
+        /**
+        * This will launch the music shop application based on view id and URL value
+        *
+        * @since S60 v3.2.3
+        * @param aViewId KUidMusBmViewId for launching Bookmark view else
+        *                KUidMusBrViewId for browser view
+        * @param aUrlLink Link to be loaded by the browser view.
+        * @param aDefaultAccessPoint URL access point
+        * @param aRskId Right softkey id
+        */
+        void LaunchMusicShopL(
+                        const TUid& aViewId,
+                        const TDesC& aUrlLink,
+                        const TUint aDefaultAccessPoint,
+                        const TInt aRskId
+                        );
+
+
+    private:
+        CEikonEnv* iCoeEnv;
+        CAknNullService*        iNullService;
+        CAknLaunchAppService*   iLaunchAppService;
+    };
+
+#endif // MUSICSHOP_EMBEDDED_LAUNCHER_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_shop_ui_api/inc/MusicShopExternalInterface.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contains external interface UID/DNL
+*
+*/
+
+
+#ifndef MUSICSHOP_EXTERNAL_INTERFACE_H
+#define MUSICSHOP_EXTERNAL_INTERFACE_H
+
+
+#include <vwsdef.h>
+#include <HttpDownloadMgrCommon.h> // KMaxUrlLength
+
+const TUid KUidMusicShop = { 0x101F8839 }; // UID of the application
+const TUid KUidMusBmViewId = {0x101F883A};
+const TUid KUidMusBrViewId = {0x101F883B};
+
+const TUid KUidMusDnlBmLinkMsg = {0x00000001};
+const TUid KUidMusDnlBrUrlLinkMsg = {0x00000002};
+const TUid KUidMusDnlBmViewBackToPageMsg = {0x00000003};
+
+
+class TMushopBrViewDnl
+    {
+    public: // member variable
+        TBuf<KMaxUrlLength> iUrl;
+        TUint iDefaultAccessPoint;
+        TInt  iRskId;
+    };
+
+typedef TPckgBuf<TMushopBrViewDnl> TMushopBrViewDnlBuf;
+
+
+#endif // MUSICSHOP_EXTERNAL_INTERFACE_H
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_shop_ui_api/mpx_music_shop_ui_api.metaxml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,22 @@
+<?xml version="1.0" ?>
+<api id="52a85e06a1ce10894a08ad08037ddaeb" dataversion="2.0">
+<name>MPX Music Shop Ui API</name>
+<description>Provides interface for MPX Music Shop UI</description>
+<type>c++</type>
+<collection>None</collection>
+<libs><lib name="BrowserEngine.lib"/>
+<lib name="DownloadMgrUiLib.lib"/>
+<lib name="MGXMediaFileApi.lib"/>
+<lib name="ConnectionManager.lib"/>
+<lib name="mpxcollectionhelper.lib"/>
+<lib name="mpxplaybackutility.lib"/>
+<lib name="mpxviewutility.lib"/>
+<lib name="mpxcommon.lib"/>
+<lib name="DrmServerInterfaces.lib"/>
+</libs>
+<release category="platform" sinceversion=""/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                MPX Music Store in Music Shop API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/mpxfindinmusicshop.h             APP_LAYER_PLATFORM_EXPORT_PATH(mpxfindinmusicshop.h)
+../inc/mpxfindinmusicshop.inl           APP_LAYER_PLATFORM_EXPORT_PATH(mpxfindinmusicshop.inl)
+../inc/mpxfindinmusicshopcommon.h       APP_LAYER_PLATFORM_EXPORT_PATH(mpxfindinmusicshopcommon.h)
+../inc/MusicStoreUidConstants.h         APP_LAYER_PLATFORM_EXPORT_PATH(MusicStoreUidConstants.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/inc/MusicStoreUidConstants.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  MusicStore App UID constants
+*
+*/
+
+
+
+
+#ifndef MUSICSTOREAPPUIDCONST_H
+#define MUSICSTOREAPPUIDCONST_H
+
+// Music Shop Wrapper (or Music Store)
+// use by Music Player for the "Find in Music Shop"
+const TUid KUidMusicStore = { 0x10207BF5 }; // UID used in MusicStoreApp.cpp
+
+
+#endif // MUSICSTOREAPPUIDCONST_H
+// End of File
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/inc/mpxfindinmusicshop.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM plugin interface for find in music shop
+*
+*/
+
+
+
+#ifndef MPX_FIND_IN_MUSICSHOP_H
+#define MPX_FIND_IN_MUSICSHOP_H
+
+// CONSTANTS
+const TUid KSchemeHandlerDefinitionUid = { 0x101FFB53 };
+
+/**
+* Find in Music Shop ECOM plugin class
+*/
+class CMPXFindInMShop : public CBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        inline static CMPXFindInMShop* NewL();
+
+        /**
+        * Destructor.
+        */
+        inline virtual ~CMPXFindInMShop();
+
+    public: // New functions
+
+        /**
+        * Create Search String
+        *
+        * @since S60 3.2.3
+        * @param song name, artist name, album name, composer name and genre
+        * @return HBufC* for the constructed string, and ownership of return object is transferred
+        */
+        virtual HBufC* CreateSearchURLL( const TDesC& aSongName,
+                                          const TDesC& aArtistName,
+                                          const TDesC& aAlbumName,
+                                          const TDesC& aComposer,
+                                          const TDesC& aGenre ) = 0;
+    private:    // Data
+
+        TUid iDtorKey; // Destructor key for ECOM
+
+    };
+
+#include <mpxfindinmusicshop.inl>
+
+#endif      // MPX_FIND_IN_MUSICSHOP_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/inc/mpxfindinmusicshop.inl	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2006-2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ECOM inline loading file
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <ecom/ecom.h>  
+#include "mpxfindinmusicshop.h"
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CMPXFindInMShop::~CMPXFindInMShop
+// Standard virtual destructor
+// -----------------------------------------------------------------------------
+//
+CMPXFindInMShop::~CMPXFindInMShop()
+      {
+      REComSession::DestroyedImplementation( iDtorKey );
+      }
+          
+// -----------------------------------------------------------------------------
+// CMPXFindInMShop::CMPXFindInMShop
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CMPXFindInMShop* CMPXFindInMShop::NewL()
+    {
+    // Create the ecom implementation
+    // plugin dll must reside in ROM in order to be loaded!
+    //
+    CMPXFindInMShop* imp = NULL;
+    RImplInfoPtrArray plugins;
+    REComSession::ListImplementationsL( KSchemeHandlerDefinitionUid, plugins );
+    TInt err = KErrNotFound;
+    for( TInt i=0; i<plugins.Count(); ++i )
+        {
+        CImplementationInformation* info = plugins[i];
+        if( info->RomBased() )
+            {
+            err = KErrNone;
+            TUid uid = info->ImplementationUid();    
+            imp = reinterpret_cast<CMPXFindInMShop*>
+                ( REComSession::CreateImplementationL( uid, _FOFF( CMPXFindInMShop, iDtorKey ) ) );
+            break;
+            }
+        }
+    User::LeaveIfError( err );
+    plugins.ResetAndDestroy();
+    plugins.Close();
+    return imp;
+    }
+    
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/inc/mpxfindinmusicshopcommon.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Contains the const between mpxmusicplayer and musicshop
+*
+*/
+
+
+#ifndef CMPXFINDINMUSICSHOPCOMMON_H
+#define CMPXFINDINMUSICSHOPCOMMON_H
+
+
+// CONST DECLARATION
+
+// P/S Keys for find in music shop
+const TUint KMShopCategoryId = 0;
+const TUint KMShopCategoryName = 1;
+
+// Indicate that P/S key KMShopCategoryId 
+// is not valid for Find In Music Shop.
+const TUint KFindInMShopKeyInValid = 0x0;
+// P/S key KMShopCategoryId 
+// is valid for Find In Music Shop.
+const TUint KFindInMShopKeyValid = 0xF;
+
+// The following constants need to match with the RProperty::Define for
+// RProperty::EText which has maximum size of 512 bytes in the Collection
+// View.
+
+// The final search string URL with Title, Artist, and Album has this
+// max size. Increase this size when RProperty::ELargeText is used
+const TInt KSearchUrlMaxSize = 512;
+
+// Max size from P/S stored search string created from Collection View.
+const TInt KCategoryValueMaxSize = 512;
+
+#endif // CMPXFINDINMUSICSHOPCOMMON_H
+
+// End of File
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/mpx_music_store_api.metaxml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<api id="d14b6c6b51110435af383a40f271900e" dataversion="2.0">
+<name>MPX Music Store Find API</name>
+<description>Provides interface for the find feature in MPX music shop</description>
+<type>c++</type>
+<collection>None</collection>
+<libs></libs>
+<release category="platform" sinceversion=""/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/conf/mpxmusicstoretest.cfg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,25 @@
+[Test]
+title Example
+create mpxmusicstoretest foobar
+foobar Example pa ra me ters
+delete foobar
+[Endtest] 
+
+
+[Test]
+title 1:CMPXFindInMShopCreate
+create mpxmusicstoretest musicStore
+musicStore CMPXFindInMShopCreate
+musicStore CMPXFindInMShopDestructor
+delete musicStore
+[Endtest] 
+
+
+[Test]
+title 2: CMPXFindInMShopDestructor
+create mpxmusicstoretest musicStore
+musicStore CMPXFindInMShopCreate
+musicStore CMPXFindInMShopDestructor
+delete musicStore
+[Endtest] 
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Build information file for project mpxharvestertest
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_TESTEXPORTS
+// Test sound file
+
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+#include "../mpxmusicstoretest/group/bld.inf"
+
+//  End of File  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/init/TestFramework.ini	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,197 @@
+#
+# This is STIF initialization file
+# Comment lines start with '#'-character.
+# See STIF TestFramework users guide.doc for instructions
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set following test engine settings:
+#	- Set Test Reporting mode. TestReportMode's possible values are:
+#		+ 'Summary': Summary of the tested test cases.
+#		+ 'Environment': Hardware and software info.
+#		+ 'TestCases': Test case report.
+#		+ 'FullReport': Set of all above ones.
+#		+ Example 'TestReportMode= Summary TestCases'
+#
+# 	- CreateTestReport setting controls report creation mode
+#		+ YES, Test report will created.
+#		+ NO, No Test report.
+#
+# 	- File path indicates the base path of the test report.
+# 	- File name indicates the name of the test report.
+#
+# 	- File format indicates the type of the test report.
+#		+ TXT, Test report file will be txt type, for example 'TestReport.txt'.
+#		+ HTML, Test report will be html type, for example 'TestReport.html'.
+#
+# 	- File output indicates output source of the test report.
+#		+ FILE, Test report logging to file.
+#		+ RDEBUG, Test report logging to using rdebug.
+#
+# 	- File Creation Mode indicates test report overwriting if file exist.
+#		+ OVERWRITE, Overwrites if the Test report file exist.
+#		+ APPEND, Continue logging after the old Test report information if
+#                 report exist.
+# 	- Sets a device reset module's dll name(Reboot).
+#		+ If Nokia specific reset module is not available or it is not correct one
+#		  StifHWResetStub module may use as a template for user specific reset
+#		  module.
+# 	- Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation
+#		DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02
+#
+
+[Engine_Defaults]
+
+TestReportMode= FullReport		# Possible values are: 'Empty', 'Summary', 'Environment',
+                                                               'TestCases' or 'FullReport'
+
+CreateTestReport= YES			# Possible values: YES or NO
+
+TestReportFilePath= C:\LOGS\TestFramework\
+TestReportFileName= TestReport_mpxmusicstoretest
+
+TestReportFormat= TXT			# Possible values: TXT or HTML
+TestReportOutput= FILE			# Possible values: FILE or RDEBUG
+TestReportFileCreationMode= OVERWRITE	# Possible values: OVERWRITE or APPEND
+
+DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting
+
+DisableMeasurement= stifmeasurementdisablenone	# Possible values are:
+						# 'stifmeasurementdisablenone', 'stifmeasurementdisableall'
+					  	# 'stifmeasurementplugin01', 'stifmeasurementplugin02',
+					  	# 'stifmeasurementplugin03', 'stifmeasurementplugin04',
+					  	# 'stifmeasurementplugin05' or 'stifbappeaprofiler'
+
+Timeout= 0                              # Default timeout value for each test case. In milliseconds
+UITestingSupport= YES
+[End_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Module configurations start
+# Modules are added between module tags
+# tags. Module name is specified after ModuleName= tag, like
+# ModuleName= XXXXXXXXX
+# Modules might have initialisation file, specified as
+# IniFile= c:\testframework\YYYYYY
+# Modules might have several configuration files, like
+# TestCaseFile= c:\testframework\NormalCases.txt
+# TestCaseFile= c:\testframework\SmokeCases.txt
+# TestCaseFile= c:\testframework\ManualCases.txt
+
+# (TestCaseFile is synonym for old term ConfigFile)
+
+# Following case specifies demo module settings. Demo module
+# does not read any settings from file, so tags 
+# IniFile and TestCaseFile are not used.
+# In the simplest case it is enough to specify only the
+# name of the test module when adding new test module
+
+[New_Module]
+ModuleName= testscripter
+TestCaseFile= c:\testframework\mpxmusicstoretest.cfg
+[End_Module]
+
+
+# Load testmoduleXXX, optionally with initialization file and/or test case files
+#[New_Module]
+#ModuleName= testmodulexxx
+
+#TestModuleXXX used initialization file
+#IniFile= c:\testframework\init.txt
+
+#TestModuleXXX used configuration file(s)
+#TestCaseFile= c:\testframework\testcases1.cfg
+#TestCaseFile= c:\testframework\testcases2.cfg
+#TestCaseFile= c:\testframework\manualtestcases.cfg
+
+#[End_Module]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+
+
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+# Set STIF logging overwrite parameters for Logger.
+# 	Hardware and emulator environment logging path and styles can
+# 	be configured from here to overwrite the Logger's implemented values.
+#	
+#	Settings description:
+#	- Indicates option for creation log directory/directories. If log directory/directories
+#         is/are not created by user they will make by software.
+#		+ YES, Create log directory/directories if not allready exist.
+#		+ NO, Log directory/directories not created. Only created one is used.
+#
+#	- Overwrite emulator path setting.
+#		+ Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined 
+#		           Logger's path 'D:\\LOGS\\Module\\' with those definition the path
+#		           will be 'C:\LOGS\TestFramework\LOGS\Module\'
+#
+#	- Overwrite emulator's logging format.
+#		+ TXT, Log file(s) will be txt type(s), for example 'Module.txt'.
+#		+ HTML, Log file(s) will be html type(s), for example 'Module.html'.
+#
+#	- Overwrited emulator logging output source.
+#		+ FILE, Logging to file(s).
+#		+ RDEBUG, Logging to using rdebug(s).
+#
+#	- Overwrite hardware path setting (Same description as above in emulator path).
+#	- Overwrite hardware's logging format(Same description as above in emulator format).
+#	- Overwrite hardware's logging output source(Same description as above in emulator output).
+#
+#	- File Creation Mode indicates file overwriting if file exist.
+#		+ OVERWRITE, Overwrites if file(s) exist.
+#		+ APPEND, Continue logging after the old logging information if file(s) exist.
+#
+#	- Will thread id include to the log filename.
+#		+ YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'.
+#		+ NO, No thread id to log file(s), Example filename 'Module.txt'.
+#
+#	- Will time stamps include the to log file.
+#		+ YES, Time stamp added to each line in log file(s). Time stamp is 
+#                 for example'12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No time stamp(s).
+#
+#	- Will line breaks include to the log file.
+#		+ YES, Each logging event includes line break and next log event is in own line.
+#		+ NO, No line break(s).
+#
+#	- Will event ranking include to the log file.
+#		+ YES, Event ranking number added to each line in log file(s). Ranking number
+#                 depends on environment's tics, for example(includes time stamp also)
+#                 '012   12.Nov.2003 115958    LOGGING INFO'
+#		+ NO, No event ranking.
+#
+#	- Will write log file in unicode format.
+#		+ YES, Log file will be written in unicode format
+#		+ NO, Log will be written as normal, not unicode, file.
+#
+
+[Logger_Defaults]
+
+#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#'
+#NOTE: TestEngine and TestServer logging settings cannot change here
+
+#CreateLogDirectories= YES    # Possible values: YES or NO
+
+#EmulatorBasePath= C:\LOGS\TestFramework\
+#EmulatorFormat= HTML         # Possible values: TXT or HTML
+#EmulatorOutput= FILE         # Possible values: FILE or RDEBUG
+
+#HardwareBasePath= D:\LOGS\TestFramework\
+#HardwareFormat= HTML         # Possible values: TXT or HTML
+#HardwareOutput= FILE         # Possible values: FILE or RDEBUG
+
+#FileCreationMode= OVERWRITE  # Possible values: OVERWRITE or APPEND
+
+#ThreadIdToLogFile= YES       # Possible values: YES or NO
+#WithTimeStamp= YES           # Possible values: YES or NO
+#WithLineBreak= YES           # Possible values: YES or NO
+#WithEventRanking= YES        # Possible values: YES or NO
+
+#FileUnicode= YES             # Possible values: YES or NO
+#AddTestCaseTitle= YES        # Possible values: YES or NO
+[End_Logger_Defaults]
+# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
+
+# End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/Bmarm/mpxmusicstoretestU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/Bwins/mpxmusicstoretestU.DEF	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/EABI/mpxmusicstoretestU.def	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,3 @@
+EXPORTS
+	_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ?Description
+*
+*/
+
+
+
+PRJ_PLATFORMS
+// specify the platforms your component needs to be built for here
+// defaults to WINS MARM so you can ignore this if you just build these
+DEFAULT
+
+PRJ_TESTEXPORTS
+// NOTE: If using ARS requirements all export operations should be done under this.
+// 'abld test export'
+
+PRJ_EXPORTS
+// Specify the source file followed by its destination here
+// copy will be used to copy the source file to its destination
+// If there's no destination then the source file will be copied
+// to the same name in /epoc32/include
+// Example: 
+/*
+/agnmodel/inc/AGMCOMON.H
+*/
+
+PRJ_TESTMMPFILES
+mpxMusicStoreTest.mmp
+
+PRJ_MMPFILES
+
+// Specify the .mmp files required for building the important component
+// releasables.
+//
+// Specify "tidy" if the component you need to build doesn't need to be
+// released. Specify "ignore" if the MMP file exists but should be
+// ignored.
+// Example:
+/*
+/agnmodel/group/agnmodel.mmp
+#if defined(MARM)
+/agnmodel/group/agsvexe.mmp
+#endif
+*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/group/mpxmusicstoretest.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,82 @@
+/*TYPE TESTCLASS*//*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  API test automation file for project mpxmusicstoretest
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          mpxmusicstoretest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         mpxMusicStoreTest.def
+
+#ifdef SBSV2
+	USERINCLUDE     ../inc 
+
+	    APP_LAYER_SYSTEMINCLUDE
+
+	SOURCEPATH      ../src
+#else // SBSV2 not defined
+USERINCLUDE     ../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+#endif // SBSV2
+
+SOURCE          mpxMusicStoreTest.cpp
+SOURCE          mpxMusicStoreTestBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib ecom.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/group/mpxmusicstoretest.pkg	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,64 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description: pakage file for make installation file for STIF
+;
+;
+; Installation file for STIF
+;
+
+; Languages
+&EN
+
+; Provide value for uid
+#{"STIF"},(0x00000000),1,1,0,TYPE=SA
+
+; Series60 product id for S60 3.0
+[0x101F7961], 0, 0, 0, {"Series60ProductID"}
+
+; Localised Vendor name
+%{"Nokia"}
+
+; Unique Vendor name
+:"Nokia"
+
+; Logo
+; None
+
+; Package signature - Optional
+; None
+
+; Start of Package body
+
+; Condition blocks
+; None
+
+; Options list
+; None
+
+; Install files
+; // STIF GUI (STIFTestFramework\Series60_UI is need to compile)
+"..\..\init\TestFramework.ini"   -   "c:\testframework\TestFramework.ini" 
+"..\..\conf\mpxmusicstoretest.cfg"   -   "c:\testframework\mpxmusicstoretest.cfg"
+"\epoc32\release\armv5\udeb\mpxmusicstoretest.dll"   -   "c:\Sys\Bin\mpxmusicstoretest.dll"
+  
+; Embedded SIS 
+; None
+
+; End of Package body
+
+; PKG dependencies
+; None
+
+; PKG capabilities
+; None
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/group/mpxmusicstoretest_DoxyFile.txt	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,222 @@
+# Doxyfile 1.4.1
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+PROJECT_NAME           = mpxMusicStoreTest
+PROJECT_NUMBER         = 
+OUTPUT_DIRECTORY       = Z:\s60\mw\music\music_dom\mpx_music_store_api\tsrc\mpxMusicStoreTest\
+CREATE_SUBDIRS         = NO
+OUTPUT_LANGUAGE        = English
+USE_WINDOWS_ENCODING   = YES
+BRIEF_MEMBER_DESC      = YES
+REPEAT_BRIEF           = YES
+ABBREVIATE_BRIEF       = 
+ALWAYS_DETAILED_SEC    = NO
+INLINE_INHERITED_MEMB  = NO
+FULL_PATH_NAMES        = NO
+STRIP_FROM_PATH        = 
+STRIP_FROM_INC_PATH    = 
+SHORT_NAMES            = NO
+JAVADOC_AUTOBRIEF      = NO
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP         = NO
+INHERIT_DOCS           = YES
+DISTRIBUTE_GROUP_DOC   = NO
+TAB_SIZE               = 8
+ALIASES                = 
+OPTIMIZE_OUTPUT_FOR_C  = YES
+OPTIMIZE_OUTPUT_JAVA   = NO
+SUBGROUPING            = YES
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+EXTRACT_ALL            = YES
+EXTRACT_PRIVATE        = NO
+EXTRACT_STATIC         = NO
+EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_METHODS  = NO
+HIDE_UNDOC_MEMBERS     = NO
+HIDE_UNDOC_CLASSES     = NO
+HIDE_FRIEND_COMPOUNDS  = NO
+HIDE_IN_BODY_DOCS      = NO
+INTERNAL_DOCS          = YES
+CASE_SENSE_NAMES       = YES
+HIDE_SCOPE_NAMES       = NO
+SHOW_INCLUDE_FILES     = YES
+INLINE_INFO            = YES
+SORT_MEMBER_DOCS       = YES
+SORT_BRIEF_DOCS        = NO
+SORT_BY_SCOPE_NAME     = NO
+GENERATE_TODOLIST      = NO
+GENERATE_TESTLIST      = NO
+GENERATE_BUGLIST       = NO
+GENERATE_DEPRECATEDLIST= YES
+ENABLED_SECTIONS       = 
+MAX_INITIALIZER_LINES  = 30
+SHOW_USED_FILES        = YES
+SHOW_DIRECTORIES       = YES
+FILE_VERSION_FILTER    = 
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+QUIET                  = NO
+WARNINGS               = YES
+WARN_IF_UNDOCUMENTED   = YES
+WARN_IF_DOC_ERROR      = YES
+WARN_NO_PARAMDOC       = NO
+WARN_FORMAT            = "$file:$line: $text"
+WARN_LOGFILE           = 
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+INPUT                  = Z:\s60\mw\music\music_dom\mpx_music_store_api\tsrc\mpxMusicStoreTest\
+FILE_PATTERNS          = *.h \
+                         *.rh \
+                         *.hrh
+RECURSIVE              = YES
+EXCLUDE                = 
+EXCLUDE_SYMLINKS       = NO
+EXCLUDE_PATTERNS       = 
+EXAMPLE_PATH           = 
+EXAMPLE_PATTERNS       = 
+EXAMPLE_RECURSIVE      = NO
+IMAGE_PATH             = 
+INPUT_FILTER           = 
+FILTER_PATTERNS        = 
+FILTER_SOURCE_FILES    = NO
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+SOURCE_BROWSER         = NO
+INLINE_SOURCES         = NO
+STRIP_CODE_COMMENTS    = YES
+REFERENCED_BY_RELATION = YES
+REFERENCES_RELATION    = YES
+VERBATIM_HEADERS       = YES
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+ALPHABETICAL_INDEX     = NO
+COLS_IN_ALPHA_INDEX    = 5
+IGNORE_PREFIX          = 
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+GENERATE_HTML          = NO
+HTML_OUTPUT            = html
+HTML_FILE_EXTENSION    = .html
+HTML_HEADER            = 
+HTML_FOOTER            = 
+HTML_STYLESHEET        = 
+HTML_ALIGN_MEMBERS     = YES
+GENERATE_HTMLHELP      = YES
+CHM_FILE               = 
+HHC_LOCATION           = 
+GENERATE_CHI           = NO
+BINARY_TOC             = YES
+TOC_EXPAND             = YES
+DISABLE_INDEX          = YES
+ENUM_VALUES_PER_LINE   = 4
+GENERATE_TREEVIEW      = YES
+TREEVIEW_WIDTH         = 250
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+GENERATE_LATEX         = NO
+LATEX_OUTPUT           = latex
+LATEX_CMD_NAME         = latex
+MAKEINDEX_CMD_NAME     = makeindex
+COMPACT_LATEX          = NO
+PAPER_TYPE             = a4wide
+EXTRA_PACKAGES         = 
+LATEX_HEADER           = 
+PDF_HYPERLINKS         = NO
+USE_PDFLATEX           = NO
+LATEX_BATCHMODE        = NO
+LATEX_HIDE_INDICES     = NO
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+GENERATE_RTF           = YES
+RTF_OUTPUT             = Doc
+COMPACT_RTF            = YES
+RTF_HYPERLINKS         = YES
+RTF_STYLESHEET_FILE    = 
+RTF_EXTENSIONS_FILE    = 
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+GENERATE_MAN           = NO
+MAN_OUTPUT             = man
+MAN_EXTENSION          = .3
+MAN_LINKS              = NO
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML           = NO
+XML_OUTPUT             = xml
+XML_SCHEMA             = 
+XML_DTD                = 
+XML_PROGRAMLISTING     = YES
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+GENERATE_AUTOGEN_DEF   = NO
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD       = NO
+PERLMOD_LATEX          = NO
+PERLMOD_PRETTY         = YES
+PERLMOD_MAKEVAR_PREFIX = 
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+ENABLE_PREPROCESSING   = YES
+MACRO_EXPANSION        = YES
+EXPAND_ONLY_PREDEF     = NO
+SEARCH_INCLUDES        = YES
+INCLUDE_PATH           = 
+INCLUDE_FILE_PATTERNS  = 
+PREDEFINED             = NONSHARABLE_CLASS
+EXPAND_AS_DEFINED      = 
+SKIP_FUNCTION_MACROS   = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+TAGFILES               = 
+GENERATE_TAGFILE       = 
+ALLEXTERNALS           = NO
+EXTERNAL_GROUPS        = YES
+PERL_PATH              = /usr/bin/perl
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+CLASS_DIAGRAMS         = YES
+HIDE_UNDOC_RELATIONS   = YES
+HAVE_DOT               = NO
+CLASS_GRAPH            = YES
+COLLABORATION_GRAPH    = YES
+GROUP_GRAPHS           = YES
+UML_LOOK               = NO
+TEMPLATE_RELATIONS     = YES
+INCLUDE_GRAPH          = YES
+INCLUDED_BY_GRAPH      = YES
+CALL_GRAPH             = NO
+GRAPHICAL_HIERARCHY    = YES
+DIRECTORY_GRAPH        = YES
+DOT_IMAGE_FORMAT       = png
+DOT_PATH               = 
+DOTFILE_DIRS           = 
+MAX_DOT_GRAPH_WIDTH    = 1024
+MAX_DOT_GRAPH_HEIGHT   = 1024
+MAX_DOT_GRAPH_DEPTH    = 0
+DOT_TRANSPARENT        = NO
+DOT_MULTI_TARGETS      = NO
+GENERATE_LEGEND        = YES
+DOT_CLEANUP            = YES
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+SEARCHENGINE           = NO
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/group/mpxmusicstoretest_nrm.mmp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,82 @@
+/*TYPE TESTCLASS*//*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  ?Description
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+TARGET          mpxmusicstoretest.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x101FB3E3
+
+CAPABILITY      ALL -TCB
+/* Remove comments and replace 0x00000000 with correct vendor id */
+// VENDORID     0x00000000
+/* Remove comments and replace 0x00000000 with correct secure id */
+// SECUREID     0x00000000
+
+//TARGETPATH      ?target_path
+DEFFILE         mpxMusicStoreTest.def
+
+#ifdef SBSV2
+	USERINCLUDE     ../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+	SOURCEPATH      ../src
+#else // SBSV2 not defined
+	USERINCLUDE     ../inc 
+
+APP_LAYER_SYSTEMINCLUDE
+
+	SOURCEPATH      ../src
+#endif // SBSV2
+
+SOURCE          mpxMusicStoreTest.cpp
+SOURCE          mpxMusicStoreTestBlocks.cpp
+
+//RESOURCE        resource_file
+//RESOURCE        resource_file2
+
+LIBRARY         euser.lib
+LIBRARY         stiftestinterface.lib
+LIBRARY         stiftestengine.lib
+
+LANG            SC
+
+/*
+START WINS      
+?wins_specific_information
+END
+
+START MARM
+?marm_specific_information
+END
+*/
+// Other possible keywords:
+ 
+// DOCUMENT     ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes)
+/*
+START BITMAP ?target
+TARGETPATH   ?emulated_path_on_target_machine
+HEADER
+SOURCE       ?color_depth ?source_bitmap
+END
+*/
+// DEFFILE ?filename
+// AIF ?filename
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/inc/mpxmusicstoretest.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,151 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CmpxMusicStoreTest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+#ifndef MPXMUSICSTORETEST_H
+#define MPXMUSICSTORETEST_H
+
+//  INCLUDES
+#include <StifLogger.h>
+#include <TestScripterInternal.h>
+#include <StifTestModule.h>
+#include <TestclassAssert.h>
+//#include "mpxfindinmusicshop.h"
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+#define TEST_CLASS_VERSION_MAJOR 0
+#define TEST_CLASS_VERSION_MINOR 0
+#define TEST_CLASS_VERSION_BUILD 0
+
+// Logging path
+_LIT( KmpxMusicStoreTestLogPath, "\\logs\\testframework\\mpxMusicStoreTest\\" ); 
+// Log file
+_LIT( KmpxMusicStoreTestLogFile, "mpxMusicStoreTest.txt" ); 
+_LIT( KmpxMusicStoreTestLogFileWithTitle, "mpxMusicStoreTest_[%S].txt" );
+
+// FUNCTION PROTOTYPES
+//?type ?function_name(?arg_list);
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+//class CmpxMusicStoreTest;
+//class CMPXFindInMShop;
+// DATA TYPES
+//enum ?declaration
+//typedef ?declaration
+//extern ?data_type;
+
+// CLASS DECLARATION
+
+/**
+*  CmpxMusicStoreTest test class for STIF Test Framework TestScripter.
+*  ?other_description_lines
+*
+*  @lib ?library
+*  @since ?Series60_version
+*/
+NONSHARABLE_CLASS(CmpxMusicStoreTest) : public CScriptBase
+    {
+    public:  // Constructors and destructor
+
+        /**
+        * Two-phased constructor.
+        */
+        static CmpxMusicStoreTest* NewL( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * Destructor.
+        */
+        virtual ~CmpxMusicStoreTest();
+
+    public: // New functions
+
+        /**
+        * ?member_description.
+        * @since ?Series60_version
+        * @param ?arg1 ?description
+        * @return ?description
+        */
+        //?type ?member_function( ?type ?arg1 );
+
+    public: // Functions from base classes
+
+        /**
+        * From CScriptBase Runs a script line.
+        * @since ?Series60_version
+        * @param aItem Script line containing method name and parameters
+        * @return Symbian OS error code
+        */
+        virtual TInt RunMethodL( CStifItemParser& aItem );
+        TInt CMPXFindInMShopCreate( CStifItemParser& aItem );
+        TInt CMPXFindInMShopDestructor(CStifItemParser& aItem);
+        
+    private:
+
+        /**
+        * C++ default constructor.
+        */
+        CmpxMusicStoreTest( CTestModuleIf& aTestModuleIf );
+
+        /**
+        * By default Symbian 2nd phase constructor is private.
+        */
+        void ConstructL();
+
+        // Prohibit copy constructor if not deriving from CBase.
+        // ?classname( const ?classname& );
+        // Prohibit assigment operator if not deriving from CBase.
+        // ?classname& operator=( const ?classname& );
+
+        /**
+        * Frees all resources allocated from test methods.
+        * @since ?Series60_version
+        */
+        void Delete();
+
+        /**
+        * Test methods are listed below. 
+        */
+
+        /**
+        * Example test method.
+        * @since ?Series60_version
+        * @param aItem Script line containing parameters.
+        * @return Symbian OS error code.
+        */
+        virtual TInt ExampleL( CStifItemParser& aItem );
+        
+        /**
+         * Method used to log version of test class
+         */
+        void SendTestClassVersion();
+
+        //ADD NEW METHOD DEC HERE
+        //[TestMethods] - Do not remove
+
+   
+    private:    // Friend classes
+        //?friend_class_declaration;
+    	//CMPXFindInMShop* iMPXFindInMShop;
+    };
+
+#endif      // MPXMUSICSTORETEST_H
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/src/mpxmusicstoretest.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,201 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CmpxMusicStoreTest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+
+// INCLUDE FILES
+#include <Stiftestinterface.h>
+#include "mpxmusicstoretest.h"
+#include <SettingServerClient.h>
+
+// EXTERNAL DATA STRUCTURES
+//extern  ?external_data;
+
+// EXTERNAL FUNCTION PROTOTYPES  
+//extern ?external_function( ?arg_type,?arg_type );
+
+// CONSTANTS
+//const ?type ?constant_var = ?constant;
+
+// MACROS
+//#define ?macro ?macro_def
+
+// LOCAL CONSTANTS AND MACROS
+//const ?type ?constant_var = ?constant;
+//#define ?macro_name ?macro_def
+
+// MODULE DATA STRUCTURES
+//enum ?declaration
+//typedef ?declaration
+
+// LOCAL FUNCTION PROTOTYPES
+//?type ?function_name( ?arg_type, ?arg_type );
+
+// FORWARD DECLARATIONS
+//class ?FORWARD_CLASSNAME;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// ?function_name ?description.
+// ?description
+// Returns: ?value_1: ?description
+//          ?value_n: ?description_line1
+//                    ?description_line2
+// -----------------------------------------------------------------------------
+//
+/*
+?type ?function_name(
+    ?arg_type arg,  // ?description
+    ?arg_type arg)  // ?description
+    {
+
+    ?code  // ?comment
+
+    // ?comment
+    ?code
+    }
+*/
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CmpxMusicStoreTest::CmpxMusicStoreTest
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CmpxMusicStoreTest::CmpxMusicStoreTest( 
+    CTestModuleIf& aTestModuleIf ):
+        CScriptBase( aTestModuleIf )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CmpxMusicStoreTest::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -----------------------------------------------------------------------------
+//
+void CmpxMusicStoreTest::ConstructL()
+    {
+    //Read logger settings to check whether test case name is to be
+    //appended to log file name.
+    RSettingServer settingServer;
+    TInt ret = settingServer.Connect();
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        }
+    // Struct to StifLogger settigs.
+    TLoggerSettings loggerSettings; 
+    // Parse StifLogger defaults from STIF initialization file.
+    ret = settingServer.GetLoggerSettings(loggerSettings);
+    if(ret != KErrNone)
+        {
+        User::Leave(ret);
+        } 
+    // Close Setting server session
+    settingServer.Close();
+
+    TFileName logFileName;
+    
+    if(loggerSettings.iAddTestCaseTitle)
+        {
+        TName title;
+        TestModuleIf().GetTestCaseTitleL(title);
+        logFileName.Format(KmpxMusicStoreTestLogFileWithTitle, &title);
+        }
+    else
+        {
+        logFileName.Copy(KmpxMusicStoreTestLogFile);
+        }
+
+    iLog = CStifLogger::NewL( KmpxMusicStoreTestLogPath, 
+                          logFileName,
+                          CStifLogger::ETxt,
+                          CStifLogger::EFile,
+                          EFalse );
+    
+    SendTestClassVersion();
+    }
+
+// -----------------------------------------------------------------------------
+// CmpxMusicStoreTest::NewL
+// Two-phased constructor.
+// -----------------------------------------------------------------------------
+//
+CmpxMusicStoreTest* CmpxMusicStoreTest::NewL( 
+    CTestModuleIf& aTestModuleIf )
+    {
+    CmpxMusicStoreTest* self = new (ELeave) CmpxMusicStoreTest( aTestModuleIf );
+
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+
+    }
+
+// Destructor
+CmpxMusicStoreTest::~CmpxMusicStoreTest()
+    { 
+
+    // Delete resources allocated from test methods
+    Delete();
+
+    // Delete logger
+    delete iLog; 
+
+    }
+
+//-----------------------------------------------------------------------------
+// CmpxMusicStoreTest::SendTestClassVersion
+// Method used to send version of test class
+//-----------------------------------------------------------------------------
+//
+void CmpxMusicStoreTest::SendTestClassVersion()
+	{
+	TVersion moduleVersion;
+	moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR;
+	moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR;
+	moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD;
+	
+	TFileName moduleName;
+	moduleName = _L("mpxmusicstoretest.dll");
+
+	TBool newVersionOfMethod = ETrue;
+	TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
+	}
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+
+// -----------------------------------------------------------------------------
+// LibEntryL is a polymorphic Dll entry point.
+// Returns: CScriptBase: New CScriptBase derived object
+// -----------------------------------------------------------------------------
+//
+EXPORT_C CScriptBase* LibEntryL( 
+    CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
+    {
+
+    return ( CScriptBase* ) CmpxMusicStoreTest::NewL( aTestModuleIf );
+
+    }
+
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_store_api/tsrc/mpxmusicstoretest/src/mpxmusicstoretestBlocks.cpp	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  CmpxMusicStoreTest test class for STIF Test Framework TestScripter.
+*
+*/
+
+
+
+// [INCLUDE FILES] - do not remove
+#include <e32svr.h>
+#include <StifParser.h>
+#include <Stiftestinterface.h>
+#include "mpxmusicstoretest.h"
+
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CmpxMusicStoreTest::Delete
+// Delete here all resources allocated and opened from test methods. 
+// Called from destructor. 
+// -----------------------------------------------------------------------------
+//
+void CmpxMusicStoreTest::Delete() 
+    {
+
+    }
+
+// -----------------------------------------------------------------------------
+// CmpxMusicStoreTest::RunMethodL
+// Run specified method. Contains also table of test mothods and their names.
+// -----------------------------------------------------------------------------
+//
+TInt CmpxMusicStoreTest::RunMethodL( 
+    CStifItemParser& aItem ) 
+    {
+
+    static TStifFunctionInfo const KFunctions[] =
+        {  
+        // Copy this line for every implemented function.
+        // First string is the function name used in TestScripter script file.
+        // Second is the actual implementation member function. 
+        ENTRY( "Example", CmpxMusicStoreTest::ExampleL ),
+        ENTRY( "CMPXFindInMShopCreate", CmpxMusicStoreTest::CMPXFindInMShopCreate ),
+        ENTRY( "CMPXFindInMShopDestructor", CmpxMusicStoreTest::CMPXFindInMShopDestructor ),
+       
+
+        //ADD NEW ENTRY HERE
+        // [test cases entries] - Do not remove
+
+        };
+
+    const TInt count = sizeof( KFunctions ) / 
+                        sizeof( TStifFunctionInfo );
+
+    return RunInternalL( KFunctions, count, aItem );
+
+    }
+
+// -----------------------------------------------------------------------------
+// CmpxMusicStoreTest::ExampleL
+// Example test method function.
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CmpxMusicStoreTest::ExampleL( CStifItemParser& aItem )
+    {
+
+    // Print to UI
+    _LIT( KmpxMusicStoreTest, "mpxMusicStoreTest" );
+    _LIT( KExample, "In Example" );
+    TestModuleIf().Printf( 0, KmpxMusicStoreTest, KExample );
+    // Print to log file
+    iLog->Log( KExample );
+
+    TInt i = 0;
+    TPtrC string;
+    _LIT( KParam, "Param[%i]: %S" );
+    while ( aItem.GetNextString ( string ) == KErrNone )
+        {
+        TestModuleIf().Printf( i, KmpxMusicStoreTest, 
+                                KParam, i, &string );
+        i++;
+        }
+
+    return KErrNone;
+
+    }
+
+// -----------------------------------------------------------------------------
+// CmpxMusicStoreTest::CMPXFindInMShopCreate
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CmpxMusicStoreTest::CMPXFindInMShopCreate( CStifItemParser& /*aItem*/ )
+	{
+	 TInt err=KErrNone;
+     iLog->Log(_L("CmpxMusicStoreTest::CMPXFindInMShopCreate"));
+    
+    // iMPXFindInMShop=CMPXFindInMShop::NewL();
+    
+	 iLog->Log(_L("CmpxMusicStoreTest::NewL returned: %d"), err);
+     return err;
+	}
+
+// -----------------------------------------------------------------------------
+// CmpxMusicStoreTest::CMPXFindInMShopDestructor
+// ?implementation_description
+// (other items were commented in a header).
+// -----------------------------------------------------------------------------
+//
+TInt CmpxMusicStoreTest::CMPXFindInMShopDestructor( CStifItemParser& /*aItem*/ )
+	{
+	 TInt err=KErrNone;
+     iLog->Log(_L("CmpxMusicStoreTest::CMPXFindInMShopDestructor"));
+    
+    /* if(iMPXFindInMShop!=NULL)
+       {
+	    delete iMPXFindInMShop;
+	    iMPXFindInMShop=NULL;
+       }*/
+	 iLog->Log(_L("CmpxMusicStoreTest::NewL returned: %d"), err);
+	// REComSession::FinalClose();
+     return err;
+	}
+
+
+
+// ========================== OTHER EXPORTED FUNCTIONS =========================
+// None
+
+//  [End of File] - Do not remove
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_wap_adapter_cenrep_api/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,27 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                MPX Music WAP Adapter Cenrep keys API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/MusicWapCenRepKeys.h             APP_LAYER_PLATFORM_EXPORT_PATH(MusicWapCenRepKeys.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_wap_adapter_cenrep_api/inc/MusicWapCenRepKeys.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Wap Adapter cenrep keys
+*
+*/
+
+
+
+#ifndef MUSICWAPADAPTERCRKEYS_H
+#define MUSICWAPADAPTERCRKEYS_H
+
+// CenRep UID for Music Store
+const TUid KCRUidMusicShopSettings = {0x10207BF5};
+
+const TUint32 KMusicShopToProxy            = 0x00000001;
+const TUint32 KMusicShopBookmarkName       = 0x00000002;
+const TUint32 KMusicShopURI                = 0x00000003;
+const TUint32 KMusicShopAuthType           = 0x00000004;
+const TUint32 KMusicShopAuthName           = 0x00000005;
+const TUint32 KMusicShopAuthSecret         = 0x00000006;
+const TUint32 KMusicShopSearchURI          = 0x00000007;
+const TUint32 KMusicShopIAP                = 0x00000008;
+const TUint32 KMusicShopFeatureFlagSupport = 0x00000009;
+const TUint32 KMusicShopAppWrapperSupport  = 0x0000000A;
+const TUint32 KMusicShopAlwaysAsk          = 0x0000000B;
+const TUint32 KMusicShopHideSetting        = 0x0000000C;
+const TUint32 KMusicShopVersion            = 0x0000000D;
+
+#define KSupportRTSP 0x00000001;
+#define KSupportWLan 0x00000002;
+#define KSupportMusicShopWrapper 0x00000004;
+#define KSupportMusicShopSettings 0x00000008;
+
+#endif      // MUSICWAPADAPTERCRKEYS_H
+
+
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/mpx_music_wap_adapter_cenrep_api/mpx_music_wap_adapter_cenrep_api.metaxml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,14 @@
+<?xml version="1.0" ?>
+<api id="74abc7e84982526cda28140566f1bab7" dataversion="2.0">
+<name>MPX Music Wap Adapter Cenrep API</name>
+<description>Provides interface for the Music Wap Push Configuration</description>
+<type>c++</type>
+<collection>None</collection>
+<libs>
+</libs>
+<release category="platform" sinceversion=""/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/music_content_publisher_plugin_api/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  File that exports the files belonging to 
+:                Music Content Publisher plugin API
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+../inc/mcppluginuids.hrh          APP_LAYER_PLATFORM_EXPORT_PATH(mcppluginuids.hrh)
+../inc/mcpplugin.h                APP_LAYER_PLATFORM_EXPORT_PATH(mcpplugin.h)
+../inc/mcppluginobserver.h        APP_LAYER_PLATFORM_EXPORT_PATH(mcppluginobserver.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/music_content_publisher_plugin_api/inc/mcpplugin.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Music Content Publisher Plugin interface definition
+*
+*/
+
+
+#ifndef C_MCPPLUGIN_H
+#define C_MCPPLUGIN_H
+
+#include <e32base.h>
+
+
+/**
+ * The interface class for all MCP plugins
+ * Plugins are responsible for updating data and actions to the Music Widget
+ * and Music Suite.
+ *
+ * The implementator of this interface should implement Deactivate function that 
+ * will be invoked when the plugin is preempted by another plugin.
+ *
+ * IMPORTANT NOTE: 
+ * It is recommended that the plugin does not publish data while not active.
+ * After calling Deactivate on the plugin it should change its state to
+ * not active.
+ *
+ */
+class CMCPPlugin : public CBase
+    {
+public:
+
+    /** 
+     * Triggers Deactivation Process.
+     * Note: This should return immediatelly.
+     *       Just a change of state variable is recommended.
+     */
+    virtual void Deactivate() = 0;
+    
+    /** 
+     * Announces a change on the skin.
+     * Note: Plugins should republish all the skinned icons.
+     *       Called only on the active plugin, plugins are responsible to
+     *       republish all the icons when they become active.
+     */
+    virtual void SkinChanged() {};
+    };
+
+#endif // C_MCPPLUGIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/music_content_publisher_plugin_api/inc/mcppluginobserver.h	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,213 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Manages MCP plugins, and content publishing.
+*
+*/
+
+
+#ifndef M_MCPPLUGINOBSERVER_H
+#define M_MCPPLUGINOBSERVER_H
+
+class CLiwDefaultMap;
+class CMCPPlugin;
+class TAknsItemID;
+
+
+/**
+ * Music Widget and Music Suite Image Destinations.
+ * 
+ * 9.1 Music Widget has two panels, The left panel contains an image:
+ * TMCPImageDestination:EMusicWidgetImage1.
+ * If we publish an empty image here the default icon will be displayed.
+ * The right panel contains a toolbar with 3 buttons:
+ * TMCPImageDestination:EMusicWidgetToolbarB1, 
+ * TMCPImageDestination:EMusicWidgetToolbarB2,
+ * TMCPImageDestination:EMusicWidgetToolbarB3.
+ * 
+ * 9.1 Music Suite has a top row that displays information about the current
+ * playing and last played. This row contains an image:
+ * TMCPImageDestination:EMusicMenuMusicInfoImage1
+ */
+enum TMCPImageDestination
+    {
+     EMusicWidgetImage1 = 1000
+     ,EMusicWidgetToolbarB1
+     ,EMusicWidgetToolbarB2
+     ,EMusicWidgetToolbarB3
+     
+     ,EMusicMenuMusicInfoImage1 = 1100
+    };
+
+/**
+ * Music Widget and Music Suite Text Destinations.
+ * 
+ * 9.1 Music Widget has two panels, The right panel contains two text items:
+ * TMCPTextDestination:EMusicWidgetText1, 
+ * TMCPTextDestination:EMusicWidgetDefaultText.
+ * If we publish a EMusicWidgetDefaultText the toolbar will not be displayed.
+ * To show the toolbar and the text information row : EMusicWidgetText1 we 
+ * should publish empty text to the EMusicWidgetDefaultText
+ * 
+ * 9.1 Music Suite has a top row that displays information about the current
+ * playing and last played. This row contains two lines:
+ * TMCPTextDestination:EMusicMenuMusicInfoLine1
+ * TMCPTextDestination:EMusicMenuMusicInfoLine2
+ */
+enum TMCPTextDestination
+    {
+     EMusicWidgetText1 = 2000
+     ,EMusicWidgetDefaultText
+     
+     ,EMusicMenuMusicInfoLine1 = 2100
+     ,EMusicMenuMusicInfoLine2
+    };
+
+
+/**
+ * Music Widget and Music Suite Trigger Destinations.
+ * 
+ * 9.1 Music Widget has two panels, The left panel contains an image where we
+ * can install an action: 
+ * TMCPTriggerDestination:EMusicWidgetTrigger1
+ * When the toolbar is hiden because there is a default text the panel
+ * functions as a button where we can install:
+ * TMCPTriggerDestination:EMusicWidgetTrigger2
+ * When there is no default text on the right panel it contains a toolbar with
+ * 3 buttons where we can install the following actions:
+ * TMCPTriggerDestination:EMusicWidgetTB1Trigger, 
+ * TMCPTriggerDestination:EMusicWidgetTB2Trigger,
+ * TMCPTriggerDestination:EMusicWidgetTB3Trigger.
+ * 
+ * 9.1 Music Suite has a top row that displays information about the current
+ * playing and last played, when this item is selected the following action
+ * will be triggered:
+ * TMCPTriggerDestination:EMusicMenuMusicInfoTrigger
+ */
+enum TMCPTriggerDestination
+    {
+     EMusicWidgetTrigger1 = 3000
+     ,EMusicWidgetTrigger2
+     ,EMusicWidgetTB1Trigger
+     ,EMusicWidgetTB2Trigger
+     ,EMusicWidgetTB3Trigger
+     
+     ,EMusicMenuMusicInfoTrigger =3100
+    };
+
+/**
+ *  Observer interface, to be implemented by the Music Content Publisher.
+ *  This interface is to be used to inform the music content publisher of
+ *  changes on the plugin that need to be propagated to the Music Widget UI
+ *  or the Music suite UI. 
+ *  @since S60 5.0
+ */
+class MMCPPluginObserver
+    {
+public:
+    
+    /**
+     * Called when an image needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the image is to be placed.
+     * @param aImagePath Source path of the Image.
+     */
+    virtual void PublishImageL(CMCPPlugin* aPlugin,
+            TMCPImageDestination aDestination, 
+            const TDesC& aImagePath) = 0;
+
+    /**
+     * Called when an image needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the image is to be placed.
+     * @param aBitmapHandle Bitmap handle to the image.
+     *        the bitmaps should be preseverd by the plugins.
+     * @param aMaskBitmapHandle Mask Bitmap handle for the image.
+     */
+    virtual void PublishImageL(CMCPPlugin* aPlugin, 
+            TMCPImageDestination aDestination,
+            TInt aBitmapHandle,
+            TInt aMaskBitmapHandle = NULL) = 0;
+    
+    /**
+     * Called when an image needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the image is to be placed.
+     * @param aID major and minor Skin ID info.
+     * @param aFilename fallback mif/mbm file.
+     * @param aFileBitmapId bitmap id within the fallback file.
+     * @param aFileMaskId mask id within the fallback file.
+     * NOTE:This keeps a cache of the skined incons, sizes are 
+     *      calculated on the observer based on the widget version.
+     */
+    virtual void PublishImageL(CMCPPlugin* aPlugin, 
+            TMCPImageDestination aDestination,
+            const TAknsItemID& aID,
+            const TDesC& aFilename,
+            const TInt aFileBitmapId,
+            const TInt aFileMaskId ) = 0;
+
+    /**
+     * Called when a text needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Where the text is to be placed.
+     * @param aText Descriptor containing the text.
+     */
+    virtual void PublishTextL( CMCPPlugin* aPlugin, 
+            TMCPTextDestination aDestination, 
+            const TDesC& aText ) = 0;
+
+    /**
+     * Called when an action needs to be updated.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     * @param aDestination Destination trigger that should launch the action.
+     * @param aTrigerMap LIW Map containint the action that can be interpreted
+     * by the specified action handler plugin.
+     */
+    virtual void PublishActionL( CMCPPlugin* aPlugin, 
+            TMCPTriggerDestination aDestination, 
+            CLiwDefaultMap* aTrigerMap ) = 0;
+    
+    /**
+     * Called when a plugin becomes active.
+     *
+     * @since S60 5.0
+     * @param aPlugin Where the mesage is coming from.
+     */
+    virtual void BecameActiveL( CMCPPlugin* aPlugin ) = 0;
+    
+    /**
+     * Called when a plugin becomes active.
+     *
+     * @since S60 5.0
+     * @param aDst The image destination.
+     * @return The size of the image destination.
+     * NOTE: this should be used to query the size of the image destination.
+     *       Resizing is responsibility of the plugin in the case of 
+     *       bitmap handle publishing.
+     */
+    virtual TSize GetImageDestinationSize(TMCPImageDestination aDst) = 0;
+
+    };
+
+#endif /*MCPPLUGINOBSERVER_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/music_content_publisher_plugin_api/inc/mcppluginuids.hrh	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2008-2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Resource headers for MCP Plugin 
+*
+*/
+
+
+#ifndef MCPPLUGINUIDS_HRH_
+#define MCPPLUGINUIDS_HRH_
+
+#define KMCPPluginUid 0x10207C19 // interface uid
+
+#endif /*MCPPLUGINUIDS_HRH_*/
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/musicplayer_plat/music_content_publisher_plugin_api/music_content_publisher_plugin_api.metaxml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<api id="34e9afe9ddf82785e6dedaf5d4eb7301" dataversion="2.0">
+<name>music content publisher plugin api</name>
+<description>ECom API for Music Content Publisher plugins.</description>
+<type>c++</type>
+<collection>musichomescreen</collection>
+<libs></libs>
+<release category="platform" sinceversion="0"/>
+<attributes>
+<htmldocprovided>no</htmldocprovided>
+<adaptation>no</adaptation>
+</attributes>
+</api>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SystemDefinition schema="3.0.0">
+  <package id="musicplayer" name="Music Player Apps" levels="plugins support hs app">
+    <collection id="musicvisualization" name="Music Visualization" level="plugins">
+      <component id="musicvisualizationplugin" filter="s60" name="Music Visualization Plugin" class="plugin">
+        <unit bldFile="musicvisualization/musicvisualizationplugin/group"/>
+      </component>
+      <component id="mpxvisualizationplugins" filter="s60" name="MPX Visualization Plugins" class="plugin">
+        <unit bldFile="musicvisualization/mpxvisualizationplugins/group"/>
+      </component>
+    </collection>
+    <collection id="mpxmusicplayer" name="MPX Music Player" level="app">
+      <component id="mpxmusicplayer_help" filter="s60" name="Help">
+        <unit bldFile="mpxmusicplayer/help/group"/>
+      </component>
+      <component id="mpxmusicplayer_commonui" filter="s60" name="MPX Common UI">
+        <unit bldFile="mpxmusicplayer/commonui/group"/>
+      </component>
+      <component id="activeidle" filter="s60" name="MPX Active Idle">
+        <unit bldFile="mpxmusicplayer/activeidle/group"/>
+      </component>
+      <component id="metadatahandler" filter="s60" name="MPX Metadata Handler">
+        <unit bldFile="mpxmusicplayer/metadatahandler/group"/>
+      </component>
+      <component id="mediakeyhandler" filter="s60" name="MPX Media Key Handler">
+        <unit bldFile="mpxmusicplayer/mediakeyhandler/group"/>
+      </component>
+      <component id="mpxmusicplayer_app" filter="s60" name="MPX Application">
+        <unit bldFile="mpxmusicplayer/app/group"/>
+      </component>
+      <component id="mpxmusicplayer_build" filter="s60" name="MPX Music Player Build">
+      	<!--  can the exports be distributed to the above components?  -->
+        <unit bldFile="mpxmusicplayer/group"/>
+      </component>
+    </collection>
+    <collection id="musichomescreen" name="Music Home Screen" level="hs">
+      <component id="mpxcollectionpublisher" filter="s60" name="MPX Collection Publisher" introduced="^2">
+        <unit bldFile="musichomescreen/mpxcollectionpublisher/group"/>
+      </component>
+      <component id="musiccontentpublisher" filter="s60" name="Music Content Publisher" introduced="^2">
+        <unit bldFile="musichomescreen/musiccontentpublisher/group"/>
+      </component>
+      <component id="mcpmusicplayer" filter="s60" name="Music Player MCP Plugin" class="plugin" introduced="^2">
+        <unit bldFile="musichomescreen/mcpmusicplayer/group"/>
+      </component>
+      <component id="musicplayeractionhandlerplugin" filter="s60" name="Music Player Action Handler Plugin" class="plugin" introduced="^2">
+        <unit bldFile="musichomescreen/musicplayeractionhandlerplugin/group"/>
+      </component>
+      <component id="data" filter="s60" name="MPX Data" introduced="^2">
+      	<!-- does this make sense to be a component? should it just be #include from musichomescreen/group? -->
+        <unit bldFile="musichomescreen/data/themes/default/group"/>
+      </component>
+      <component id="musichomescreen_build" filter="s60" name="Music Homescreen Build" introduced="^2">
+        <unit bldFile="musichomescreen/group"/>
+      </component>
+    </collection>
+    <collection id="mpxplugins" name="MPX Plugins" level="plugins">
+      <component id="serviceplugins" filter="s60" name="MPX Service Plugins" class="plugin">
+        <unit bldFile="mpxplugins/serviceplugins/group"/>
+      </component>
+      <component id="viewplugins" filter="s60" name="MPX View Plugins" class="plugin">
+        <unit bldFile="mpxplugins/viewplugins/group"/>
+      </component>
+      <component id="mpxplugins_build" filter="s60" name="MPX Plugins Build">
+      	<!--  can the exports be distributed to the above components?  -->
+        <unit bldFile="mpxplugins/group"/>
+      </component>
+    </collection>
+    <collection id="musicplayer_info" name="Music Player Apps Info" level="app">
+      <component id="musicplayer_plat" filter="s60" name="Music Player Apps Platform Interfaces" class="api">
+        <unit bldFile="musicplayer_plat/group"/>
+        	<!-- can only have one unit. Need to #include the rest from the above -->
+        <unit bldFile="musicplayer_plat/mpx_music_player_app_api/tsrc/group"/>
+        <unit bldFile="musicplayer_plat/mpx_music_player_commonui_api/tsrc/group"/>
+        <unit bldFile="musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/group"/>
+        <unit bldFile="musicplayer_plat/mpx_music_store_api/tsrc/group"/>
+        <unit bldFile="musicplayer_plat/music_visualization_plugin_api/tsrc/group"/>
+      </component>
+      <component id="musicplayer_test" filter="s60" purpose="development" name="Music Player Apps Test">
+      	<!-- should this be uncommented? -->
+        <!-- <unit bldFile="tsrc/group"/> -->
+      </component>
+    </collection>
+  </package>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sysdef_1_4_0.dtd	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,86 @@
+ <!ELEMENT SystemDefinition (systemModel?, build?)>
+ <!ATTLIST SystemDefinition
+  name CDATA #REQUIRED
+  schema CDATA #REQUIRED>
+ <!ELEMENT systemModel (layer+)>
+ <!ELEMENT layer (logicalset* | module*)*>
+ <!ATTLIST layer
+  name CDATA #REQUIRED
+  levels CDATA #IMPLIED
+  span CDATA #IMPLIED>
+ <!ELEMENT logicalset (logicalsubset* | module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalset name CDATA #REQUIRED>
+ <!ELEMENT logicalsubset (module* | unit* | package* | prebuilt*)*>
+ <!ATTLIST logicalsubset name CDATA #REQUIRED>
+ <!ELEMENT module (component* | unit* | package* | prebuilt*)*>
+ <!ATTLIST module
+  name CDATA #REQUIRED
+  level CDATA #IMPLIED>
+ <!ELEMENT component (unit* | package* | prebuilt*)*>
+ <!ATTLIST component name CDATA #REQUIRED>
+ <!ELEMENT unit EMPTY>
+ <!ATTLIST unit
+  unitID ID #REQUIRED
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  bldFile CDATA #REQUIRED
+  priority CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT package EMPTY>
+ <!ATTLIST package
+  name CDATA #REQUIRED
+  mrp CDATA #REQUIRED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT prebuilt EMPTY>
+ <!ATTLIST prebuilt
+  name CDATA #REQUIRED
+  version CDATA #REQUIRED
+  late (Y|N) #IMPLIED
+  filter CDATA #IMPLIED
+  contract CDATA #IMPLIED>
+ <!ELEMENT build (option* | target+ | targetList+ | unitList+ | configuration+)*>
+ <!ELEMENT unitList (unitRef+)>
+ <!ATTLIST unitList
+  name ID #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT unitRef EMPTY>
+ <!ATTLIST unitRef unit IDREF #REQUIRED>
+ <!ELEMENT targetList EMPTY>
+ <!ATTLIST targetList
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  target IDREFS #REQUIRED>
+ <!ELEMENT target EMPTY>
+ <!ATTLIST target
+  name ID #REQUIRED
+  abldTarget CDATA #REQUIRED
+  description CDATA #REQUIRED>
+ <!ELEMENT option EMPTY>
+ <!ATTLIST option
+  name ID #REQUIRED
+  abldOption CDATA #REQUIRED
+  description CDATA #REQUIRED
+  enable (Y | N | y | n) #REQUIRED>
+ <!ELEMENT configuration (unitListRef+ | layerRef+ | task+)*>
+ <!ATTLIST configuration
+  name ID #REQUIRED
+  description CDATA #REQUIRED
+  filter CDATA #REQUIRED>
+ <!ELEMENT task ( unitListRef* , (buildLayer | specialInstructions))>
+ <!ELEMENT unitListRef EMPTY>
+ <!ATTLIST unitListRef unitList IDREF #REQUIRED>
+ <!ELEMENT layerRef EMPTY>
+ <!ATTLIST layerRef layerName CDATA #REQUIRED>
+ <!ELEMENT buildLayer EMPTY>
+ <!ATTLIST buildLayer
+  command CDATA #REQUIRED
+  targetList IDREFS #IMPLIED
+  unitParallel (Y | N | y | n) #REQUIRED
+  targetParallel (Y | N | y | n) #IMPLIED>
+ <!ELEMENT specialInstructions EMPTY>
+ <!ATTLIST specialInstructions
+  name CDATA #REQUIRED
+  cwd CDATA #REQUIRED
+  command CDATA #REQUIRED>  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tsrc/group/bld.inf	Thu Dec 17 08:45:05 2009 +0200
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Project specification for musicplayer projects.
+*
+*/
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_TESTEXPORTS
+
+PRJ_EXPORTS
+
+PRJ_TESTMMPFILES
+#include "../../musicplayer_plat/mpx_music_player_app_api/tsrc/group/bld.inf"
+#include "../../musicplayer_plat/mpx_music_player_commonui_api/tsrc/group/bld.inf"
+#include "../../musicplayer_plat/mpx_music_player_media_key_handler_api/tsrc/group/bld.inf"
+#include "../../musicplayer_plat/mpx_music_store_api/tsrc/group/bld.inf"
+
+PRJ_MMPFILES
+
+//  End of File